0

I am using DeviceIOControl() to send IOCTL system request to device drivers. My problem is of its first argument, the device path.

For example, to open one monitor handle, I can use path name, "\\\\.\\LCD", to create handle using CreateFile() and put this handle into DeviceIOControl().

However, since I have 2 monitors connected to my laptop, I would like to know the LCD device naming conventions on Windows. How do I name the second LCD device path to open another handle, or enumerate all LCD devices path if I have more?

Furthermore, is it possible to look up all the device paths using Windows built-in application?

Thanks in advance.

Nick Chang
  • 1
  • 1
  • 4
  • you need call [`CM_Get_Device_Interface_ListW`](https://learn.microsoft.com/en-us/windows/desktop/api/cfgmgr32/nf-cfgmgr32-cm_get_device_interface_listw) with [`GUID_DEVINTERFACE_MONITOR`](https://learn.microsoft.com/en-us/windows-hardware/drivers/install/guid-devinterface-monitor) – RbMm Jan 06 '19 at 15:45
  • @RbMm Do I have to add "pDeviceID" returned by CM_Get_Device_Interface_ListW() in the end of "\\\\.\\LCD\\"? If yes, I am confused why it works with "\\\\.\\LCD" only too? – Nick Chang Jan 06 '19 at 16:13
  • no, you need use string(s) returned by `CM_Get_Device_Interface_ListW` as is in call `CreateFileW`. *why it works with "\\\\.\\LCD"* - this mean in concrete your system exist symbolic link with such name wich point to some monitor device – RbMm Jan 06 '19 at 16:36
  • @RbMm Thanks, I see. Besides, I am curious about the difference between using IOCTL and SetMonitorBrightness() API? Is IOCTL a more secure/general way to control the monitors? Why I would ask this is because SetMonitorBrightness() is limited to DDC/CI. Hope IOCTL is my desired solution to most monitors. – Nick Chang Jan 06 '19 at 17:33
  • `SetMonitorBrightness` internal call [`DDCCISetVCPFeature(hMonitor, 0x10, dwNewBrightness)`](https://learn.microsoft.com/en-us/windows/desktop/monitor/ddccisetvcpfeature) wich in kernel mode lead to calls `CPhysicalMonitorHandle::DdcciSetVCPFeature` -> `CPhysicalMonitorHandle::DdcciSendIoctlToMonitorDevice` - so really some ioctl (0x232443 - like `IOCTL_VIDEO_SET_POINTER_ATTR` ?) however you can send ioctl direct yourself, this is more power, if you know what is ioctl and it data format – RbMm Jan 06 '19 at 18:07
  • @RbMm Thanks! I can understand your point. The SetMonitorBrightness() will call IOCTL code in the end, but [this post](https://social.msdn.microsoft.com/Forums/en-US/3ab0c466-91c7-4490-8e79-202035c68cb1/how-to-adjust-screen-brightness-level-on-notebookos-win10-x64?forum=vcgeneral) mentions that `IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS` is used for notebook internal LCD but not external monitors. I wonder if there is any document illustrating the difference between these two. – Nick Chang Jan 07 '19 at 13:12

0 Answers0