problem with opening device using CreateFile



Hello,
I posted this first in the C/C++ newsgroup and it was suggested I should try
here.

I have been wading through using SetupDi... API to get a device path to use
in CreateFile so that I could open a USB HID device.
I can now get a device path, but when I try to open for
GENERIC_READ|GENERIC_WRITE, I get an error that only tells me "Access
Denied". If I use zero in dwDesiredAccess, I get a valid handle that I can
use for device query access and use HidD_GetAttributes to read the Vendor ID
and Product ID so on that level I know I am accessing the correct devices.
However, I am not sure how to debug the "Access Denied" error so that I can
open the devices to use WriteFile and ReadFile.
I have tried various combinations of DesiredAccess and ShareMode.
The documentation on CreateFile indicates that the SecurityAttributes are
ignored. I am using Vis Studio 2005, working in C, op system is XP,
user-land Application.
Anyone have ideas?
Joe


.