|
I am creating a UMDF driver which needs to change the brightness of the LCD back light.
The following line of code works in a Console App and successfully returns a handle to the device:
HANDLE hDevice = CreateFile(L"\\\\.\\LCD", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
However, when I use the exact same piece of code in my driver it returns INVALID_HANDLE_VALUE and GetLastError() gives code 5 which is 'Access is denied'
The driver is being debugged remotely on an x64 Windows 7 machine using the standard WDKRemoteUser profile.
Does anyone know what the problem might be? Do I need to set permissions and, if so, how?
|
|
|
|
|
I'm not sure that you can use a normal CreateFile() call in a driver; see here[^] for further information.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
He would get a compile error of CreateFile() was not part of the UMDF (User mode driver frame work) API,, so it he wont need to use the kernel equivalent.
He could try MAMIMUM_ALLOWED, always a usefull trick to get at least something open, and then look at the privileges his shell is running and what his driver set.
|
|
|
|
|
I'm not sure why you are telling me this, I would think the OP would be more interested. Although almost a month on I doubt it.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Thought you might be interested to know that UMDF is a usermode driver so will use the win32 API and not the kernel API. Of course you are free to not give a sh*t if you like.
|
|
|
|