- HID CreateFile Access Denied Error
- Posted by Sari Connard on August 15th, 2003
I am trying to use the usbhidio C++ example programs to
read the attributes of my HID device. The device I am
using is a HID keyboard. I get the device detected and
can output the Vendor and Product ID, but when I do a
DeviceHandle=CreateFile (detailData->DevicePath,
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
(LPSECURITY_ATTRIBUTES)NULL,
OPEN_EXISTING,
0,
NULL);
I always get CreateFile: Denied Access Error. I have
tried using GENERIC_WRITE only and FILE_FLAG_OVERLAPPED
and other various parameter options, but still get the
same error.
My device path looks like this ...
CreateFile with DevicePath = [\\?
\hid#vid_04f2&pid_0110#6&34da47c9&0&0000#{4d1e55b2 -f16f-
11cf-88cb-001111000030}]
I hope someone can tell me how to get this working.
TIA! Sari
- Posted by Tom V S on August 15th, 2003
You cannot open the collections of type Mouse/Keyboard. MouClass/Keyboard
class driver allows only one open connection, hidsev opens it right away as
soon as the collection started, so your call fails.
"Sari Connard" <sari@norcrossgroup.com> wrote in message
news:015701c36341$4fbbaef0$a101280a@phx.gbl...
- Posted by Slobodan Brcin on August 15th, 2003
Try using this functions to enumerate and open hid devices.
GetRawInputDeviceList
GetRawInputDeviceInfo
Slobodan
"Sari Connard" <sari@norcrossgroup.com> wrote in message
news:015701c36341$4fbbaef0$a101280a@phx.gbl...
- Posted by Robert Marquardt on August 16th, 2003
Tom V S wrote:
You are wrong.
Windows has opened the device already wih an exclusive CreateFile call
of its own. All subsequent CreateFile calls fail.
Opening WITHOUT read or write access works.
The HID API functions are implemented as DeviceIoControl calls to the
HID class drivers and DevicIoControl explicitly works on such file
handles. This includes HidD_SetFeature to send feature reports.
Only ReadFile and WriteFile fail.
- Posted by jc on August 20th, 2003
So,
does this mean you you have to use DevicIoControl calls to
make it work? With a createfile for no read/write access?
I'm having the same problem. These examples don't work.
thanks
- Posted by Doron Holan [MS] on August 22nd, 2003
see my other reply, put your barcode reports in a separate top level
collection. it will be enumerated as a separate PDO and there will be no
reason to write a driver at all.
d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Bruce Tompkins" <brucetompkins@spiritofcomputing.com> wrote in message
news:29fa01c367ff$28845b30$7d02280a@phx.gbl...
- Posted by Robert Marquardt on August 22nd, 2003
jc wrote:
As i already told you cannot read or write.
Thi is not a driver specific issue. It is simple file security.