Jump to content

  • Log In with Google      Sign In   
  • Create Account


DBT_DEVICEARRIVAL Message is sending unrecognisable Class GUIDs


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 gretty   Members   -  Reputation: 209

Like
0Likes
Like

Posted 27 January 2013 - 12:38 AM

Hello

 

I am attempting to determine the Class Type of a device that has been connected to the computer. If its a Monitor(for eg a TV or Projector) I

want to perform specific actions like change the display settings of the computer.

My method of determining the class type of a device involves the following steps: 

- Register for device notifications   
- Detect WM_DEVICECHANGE events: if the wParam value = DBT_DEVICEARRIVAL:  
        - I convert the lParam value to a PDEV_BROADCAST_DEVICEINTERFACE variable and inspect that variables dbcc_classguid attribute
        - If the dbcc_classguid attribute == "{4d36e96e-e325-11ce-bfc1-08002be10318}" then I have found a monitor device



My Problem: Whenever I connect my LG Wide Screen TV to my computer it sends an unrecognisable dbcc_classguid.

For some reason, upon connection of the TV I receive 2 DBT_DEVICEARRIVAL messages. The lParam contains the following GUID's. What kind of device class is this?:
 

{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}  
{866519b5-3f07-4c97-b7df-24c5d8a8ccb8}



Funnily enough if I inspect the Windows Device Manager application(after I have connected the TV) I can see that the TV is stored under Monitors and that its class GUID is indeed the Monitor Class GUID, ie, {4d36e96e-e325-11ce-bfc1-08002be10318}. So this is REALLY weird. Also I connected a regular computer monitor screen to my laptop and it sent the exact same GUIDs and also sent 2 arrival messages.

Heres my code. Why am I receiving weird Class GUIDs upon connection of a TV to my computer? What kind of device are those 2 GUID's for? Maybe I am receiving the Hardware GUIDs and not the Class GUIDs?

      

 

 case DBT_DEVICEARRIVAL:
        {
            PDEV_BROADCAST_HDR pBroad = (PDEV_BROADCAST_HDR) lParam;
            if (pBroad->dbch_devicetype != DBT_DEVTYP_DEVICEINTERFACE) {
                debug_print("pBroad->dbch_devicetype != DBT_DEVTYP_DEVICEINTERFACE\n");
                break;
            }

            PDEV_BROADCAST_DEVICEINTERFACE pInter = (PDEV_BROADCAST_DEVICEINTERFACE) pBroad;
            _tprintf(_T("Device Data: %s\n %x\n\n"), pInter->dbcc_name, pInter->dbcc_devicetype);
            
            debug_print("Printing Device Data");
            outputDeviceData(toString(pInter->dbcc_classguid), SPDRP_CLASSGUID);

            if (isMonitorDevice(pInter->dbcc_classguid)) {
                // TODO: change display mode and etc.
                debug_print("is MonitorDevice!!!");
            }
            else debug_print("is NOT MonitorDevice!!!");
        }
        break;

 

 

The output of my application is:

Message DBT_DEVICEARRIVAL:

 Device Data:
 \\?\DISPLAY#GSM3AD7#5&20a3f50d&0&UID513#{866519b5-3f07-4c97-b7df-24
 c5d8a8ccb8}  5

 {866519b5-3f07-4c97-b7df-24c5d8a8ccb8} is NOT MonitorDevice!!!

 Message DBT_DEVICEARRIVAL:

 Device Data:
 \\?\DISPLAY#GSM3AD7#5&20a3f50d&0&UID513#{e6f07b5f-ee97-4a90-b076-33
 f57bf4eaa7}  5

 {e6f07b5f-ee97-4a90-b076-33f57bf4eaa7} is NOT MonitorDevice!!!

 



Sponsor:

#2 Khatharr   Crossbones+   -  Reputation: 2919

Like
0Likes
Like

Posted 27 January 2013 - 04:13 AM

Your isMonitorDevice() function is simply checking against a single specific GUID (based on what I saw on stackoverflow). Isn't it possible that there's more than one device class for monitors? (It's also possible that this section of the API is broken. A couple things found while poking around google suggest that this may be the case.)

What is your end goal? What are you using the GUIDs for?

Edited by Khatharr, 27 January 2013 - 04:16 AM.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#3 gretty   Members   -  Reputation: 209

Like
0Likes
Like

Posted 27 January 2013 - 06:09 PM

The goal is to detect when a tv is connected to the computer. So I check the class guid of a newly connected device and compare it to the generic monitor guid. Maybe there's an easier way though, any ideas?

#4 Khatharr   Crossbones+   -  Reputation: 2919

Like
0Likes
Like

Posted 28 January 2013 - 05:18 AM

Are you using DirectX? I think you could you just respond to the DBT_DEVICEARRIVAL message by re-enumerating the displays.

Edited by Khatharr, 28 January 2013 - 05:24 AM.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS