Hi,

I must confess I don't do this in c++, but since there is no forum for vb.net, I'll try to make it simple (If you disagree on this thread being here please feel free to delete it).

I call function like this:

DeviceHandle = CreateFile _
(DeviceName, _
GENERIC_READ Or GENERIC_WRITE, _
FILE_SHARE_READ Or FILE_SHARE_WRITE, _
Security, _
OPEN_EXISTING, _
0, _
0)

And error I get is 5 ERROR_ACCESS_DENIED. I tried to open file and write to it, and I succeeded but with device it just won't work.

DeviceName: "\\.\HID#Vid_XXXX&Pid_0001#6&2b3c76e7&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}"

Security: bInheritHandle -1 Integer
lpSecurityDescriptor 0 Integer
nLength 12 Integer


Even more troubling is that when I try to open device only with GENERIC_WRITE I get the handle (no error).

Opening only with GENERIC_READ also returns error 5.

Anyone had similar experience, or has solution to my problem? Please do post, any help is appreciated.

PS. Maybe Windows opened device for reading and locked it so I can't access it?