473,322 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Access Denied opening device with CreateFile?

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
Dec 12 '06 #1
1 4309
"Joe B." <jo*********@comcast.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>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.
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
Dec 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: CMiYC | last post by:
I'm attempting to open an USB HID device using createfile from kernel32. The open attempt always fails. This is the call I'm using: CreateFile(HidName$, &HC0000000, 3, 0, 3, 0 ,0) HidName$...
5
by: Benjamin de Waal | last post by:
Hey all, I'm trying to figure out how to directly write to a device in Windows. Basically, what I'm wanting to do is create an image of a device (specifically, a CompactFlash card that uses a...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
2
by: Karl Koscher | last post by:
I'm trying to communicate with a USB device using C#. I'm able to determine the device path using P/Invoke and SetupDiGetClassDevs, SetupDiEnumDeviceInterfaces, and SetupDiGetDeviceInterfaceDetail,...
12
by: Ron Weldy | last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net files. On my workstation I have a share set up to the folder where the web files reside. I am just doing quick and dirty...
1
by: d.albano | last post by:
Hi to all, this is my first post in this group. I need to directly access to a disk but i'm getting some problem to let to filestream to work. I use createfile to acquire PhysicalDrive0...
1
by: cpajoe2001 | last post by:
I am having an issue and after searching around online for a day and half now and finding others with the same problem but yet no solution to my issue I am looking for help. What i have is ServerA...
5
by: DotNetDanny | last post by:
Hello Machine: Windows Vista Business, standalone machine (no domain). Installed an old classic ASP webapplication in IIS7, running under a new app.pool with 'NETWORK SERVICE' account (using...
3
by: Jeff Louie | last post by:
A bit of background. I have been asked to offer an independent programming study for high school students. I thought it would be really cool to challenge them with an embedded coding challenge on...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.