Re: Issue with pinvoking DeviceIoControl: switching USB function driver at run time
- From: "Rohan_Sreeram via PocketPCJunkies.com" <u52410@uwe>
- Date: Tue, 09 Jun 2009 16:04:35 GMT
Thanks Chris.
Sorry about that, must have commented the original one, to try out something.
But I am sending a zero in there anyways, so guess it should be harmless.
Here's the code with the correction:
[DllImport("coredll.dll", EntryPoint = "DeviceIoControl", SetLastError = true)
]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool DeviceIoControl(IntPtr hDevice,
uint
dwIoControlCode,
byte[]
lpInBuffer, // LPVOID lpInBuffer - any input data required for the IOCTL
int
nInBufferSize,
byte[]
lpOutBuffer,
int
nOutBufferSize,
ref int
lpBytesReturned,
IntPtr
lpOverlapped);
****
uint dwBytes = 0;
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
System.IntPtr getUSBfnHandle = GetUfnController();
bool ioctl_ret = DeviceIoControl(getUSBfnHandle,
IOCTL_UFN_CHANGE_CURRENT_CLIENT,
enc.GetBytes
("Mass_Storage_Class"),
enc.GetByteCount
("Mass_Storage_Class"),
null, // empty lpOutBuffer
0, // no nOutBufferSize
ref dwBytes,
IntPtr.Zero);
***
Still facing the same issue though.
Thanks,
Rohan
Chris Tacke, eMVP wrote:
This is certainly wrong:
ref ulong lpBytesReturned
that's 64-bit,and it should be 32.
Hi,[quoted text clipped - 138 lines]
Thanks,
Rohan
--
Message posted via http://www.pocketpcjunkies.com
.
- Follow-Ups:
- Re: Issue with pinvoking DeviceIoControl: switching USB function driver at run time
- From: Chris Tacke, eMVP
- Re: Issue with pinvoking DeviceIoControl: switching USB function driver at run time
- References:
- Issue with pinvoking DeviceIoControl: switching USB function driver at run time
- From: Rohan_Sreeram via PocketPCJunkies.com
- Re: Issue with pinvoking DeviceIoControl: switching USB function driver at run time
- From: Chris Tacke, eMVP
- Issue with pinvoking DeviceIoControl: switching USB function driver at run time
- Prev by Date: Re: Issue with pinvoking DeviceIoControl: switching USB function driver at run time
- Next by Date: Re: Issue with pinvoking DeviceIoControl: switching USB function driver at run time
- Previous by thread: Re: Issue with pinvoking DeviceIoControl: switching USB function driver at run time
- Next by thread: Re: Issue with pinvoking DeviceIoControl: switching USB function driver at run time
- Index(es):
Relevant Pages
|