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


.



Relevant Pages

  • Access Denied opening device with CreateFile?
    ... API to get a device path to use ... in CreateFile so that I could open a USB HID device. ... The documentation on CreateFile indicates that the SecurityAttributes are ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Flush SMB Cache on Windows Vista?
    ... when client tries to open that file on server machine (via CreateFile API) - the same pathname is used - which is incorrect of course because you need UNC name here. ... the cache information has not been updated.) ...
    (microsoft.public.win32.programmer.networks)
  • Re: A buffer mapped to a file?
    ... You could try a named pipe, if the program really just calls CreateFile and reads or write to the resulting handle, but as soon as a program tries to do something like query file size, set file pointer, or soforth, that will break. ... Basically I have a buffer of data and need to feed it into an API ... that are within the filesystem namespace and will the ReadFileAPI ...
    (microsoft.public.win32.programmer.kernel)
  • Re: How do I link to C Library functions in windows?
    ... Any Win32 API that takes or returns a string will have an A and a W ... What do you mean by "setup the stack"? ... If CreateFile returns ... push eax; which I should save to the stack ...
    (comp.lang.asm.x86)
  • Re: ReadFile vs fread
    ... assured that the windows API would not hinder performance if I switch to using CreateFile ReadFile, ... So, I believe that if you switch to CreateFile, ReadFile, etc. you will be fine. ... I would suggest you to read this very interesting optimization series on Raymond Chen's blog (when he optimizes his code, he directly uses Win32 API functions like CreateFile, file-mapping, etc.) ... Loading the dictionary, part 2: ...
    (microsoft.public.vc.language)