Re: CreateFile failed in limited user account with error code 5(Access Denied)??

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Doron,

Some updates from my side for device1:
The problem was because, i was using the following key in my inf,
HKR,,Security,,"D:P(A;;GA;;;SY)(A;;GA;;;BA)", which i changed to,
HKR,,Security,,"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GR;;;WD)
(A;;GR;;;RC)"
and got it working.

No issues with device1.

i have progressed furthur in my code and struck on a different problem
for a Different Device, lat us say device2.

i have another device2 which is installed under my own GUID, which
i've generated with GUID Generator Tool, and i have Created a
DeviceObject and Registered an interface for the user mode to
communicate with a Different GUID Obtained from GUIDGenerator tool. i
am trying open this device object using CreateFile from user mode
application, which completes with ERROR_SUCCESS but the Handle is
InValid.


m_hBus = CreateFile ( m_DeviceInterfaceDetailData->DevicePath,
GENERIC_READ, // Only read access
0,
NULL,
OPEN_EXISTING,
0,
NULL);

if( INVALID_HANDLE_VALUE == m_hBus )
{
szLogMsg.Format(_T("CreateFile failed: %d"), GetLastError());
MyTrace( TRACE_ERROR, (szLogMsg) );
AfxMessageBox(szLogMsg);
return FALSE;
}


Here it hits the if( INVALID_HANDLE_VALUE == m_hBus ) condition and
GetLastError() returns ERROR_SUCCESS.

The Similar Code, worked for the earlier Device1, but the device2
behaves as mentioned above.
only difference is Device1 is installed under System Class and Device2
is installed under my own Class.

Thanks in Advance

Thanks and Regards,
Neo
.