Hi All,
I have been trying to find a way to eject a USB mass storage device from my system using C# (WinXP). I found a WinAPI called EjectDiskFromSADrive() in ntmsapi.dll ( however I am having trouble getting it to work.
In my code, I chose to call the Unicode implemetation :-
Method call :-
Returns a value 8242573992334983171 - no idea what that could be...
Has anyone used this API before ?
Thanks in advance,
Dachyon.
I have been trying to find a way to eject a USB mass storage device from my system using C# (WinXP). I found a WinAPI called EjectDiskFromSADrive() in ntmsapi.dll ( however I am having trouble getting it to work.
In my code, I chose to call the Unicode implemetation :-
Code:
[DllImport("ntmsapi.dll", CharSet = CharSet.Unicode)]
public static extern long EjectDiskFromSADriveW(
[In, MarshalAs(UnmanagedType.LPWStr)] string lpComputerName,
[In, MarshalAs(UnmanagedType.LPWStr)] string lpAppName,
[In, MarshalAs(UnmanagedType.LPWStr)] string lpDeviceName,
[In] int hWnd,
[In, MarshalAs(UnmanagedType.LPWStr)] string lpTitle,
[In, MarshalAs(UnmanagedType.LPWStr)] string lpMessage,
[In] int dwOptions);
Method call :-
Code:
long val = EjectDiskFromSADriveW("", "", "\\\\.\\E", 0, "A Title", "A Message", 4);
Returns a value 8242573992334983171 - no idea what that could be...
Has anyone used this API before ?
Thanks in advance,
Dachyon.