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?
It sounds as though you need to impersonate the drivers client.