Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / December 2006

Tip: Looking for answers? Try searching our database.

Access Denied opening device with CreateFile?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe B. - 12 Dec 2006 20:54 GMT
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.
Anyone have ideas?
Thanks
Joe
William DePalo [MVP VC++] - 13 Dec 2006 00:17 GMT
>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.
[quoted text clipped - 5 lines]
> 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.

To be honest, I have no experience with USB devices. If you were getting
that error on file access, I'd suggest looking into the sharing parameter.
If no one responds with more definitive information here you might try
posting again in the kernel group:

   microsoft.public.win32.programmer.kernel

Regards.
Will

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.