tags:

views:

20

answers:

1
    [DllImport("winusb.dll", SetLastError = true)]
    internal static extern Boolean WinUsb_ReadPipe(IntPtr InterfaceHandle, Byte PipeID, 
    ref Byte Buffer, UInt32 BufferLength, ref UInt32 LengthTransferred, IntPtr Overlapped);

I am using the api to read async data from usb device, it work most of the time in 32 bit OS. But fails most of the time on 64 bit system.

Can anybody guide me is this a problem with the api definition, firmware or else.

A: 

You show no code but the import. My immediate question is are you linking to the 64-bit version of winusb.dll on 64-bit systems? If your application is compiled for Any CPU in will run in 64-bit mode on 64-bit operating systems, and cannot P/Invoke into 32-bit libraries.

Matthew Ferreira
It compiled using AnyCPU option, some time i get LengthTransferred > 0 but some time it stuck on 0 length.
malik badar