c++ - how to convert this to C# -


hi have following code convert c#. share light here how can convert c#? not familiar c++. on function deviceiocontrol calling winbase api. in c#, function should use replace deviceiocontrol?

sharemode = file_share_read | file_share_write;    accessmode        = generic_read | generic_write;     sprintf(ff, "\\\\.\\%s", device);     hfile = createfile(ff, accessmode, sharemode, null, open_existing, 0, null);      if(hfile == invalid_handle_value) {            *response = -1;            sprintf((response + 1), "failed open device %s", device);             return;    }       status = deviceiocontrol(hfile,                                            ioctl_scsi_get_address,                                                     null,                                                     0,                                                     inquiry_data,                                                     sizeof(inquiry_data),                                                     &returned,                                                     false); 

you must use p/invoke interop access deviceiocontrol. here link has similar calls , should starting point: defrag api c# wrappers


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -