The Strange DeviceIoControl result with IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS

20 02 2008

On the Windows XP x64 running on the MacBook, the DeviceIoControl with IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS returns strange result.


HANDLE display = CreateFile(L"\\\\.\\LCD", FILE_ANY_ACCESS,
                                       0, NULL, OPEN_EXISTING, 0, NULL);

if( display != INVALID_HANDLE_VALUE )
{
     DISPLAY_BRIGHTNESS bright;
     DWORD bytesReturned;
     if( DeviceIoControl(display,
         IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS,
         NULL, 0, &bright,
        sizeof(bright), &bytesReturned, NULL) )
     ...

The DeviceIoControl returns non-null. So, it means there is no error, but, the bytesReturned is 0.

I checked the device names using WinObj from the sysinternals. There was no “LCD” device there. Probably it is the reason, but then, the CreateFile should fail.