Win7. WM_DEVICECHANGE:: DBT_DEVICEARRIVAL Vs DBT_DEVNODES_CHANGED.

Hi All,
this is a query on the Windows messages.
My app needs to know when new device is added(specifically a audio output
device) is added.

So I supposed, my window message handler can use the WM_DEVICECHANGE, and
DBT_DEVICEARRIVAL.

But the app is receiving only DEVNODES_CHANGED all the time.
why is this? What is the best approach to be notified of new audio devices
added? Please advise.

Regards,
Madhusudhana

Did you call RegisterDeviceNotification with the appropriate device interface guid?

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Madhusudan Narayan
Sent: Monday, February 15, 2010 11:02 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Win7. WM_DEVICECHANGE:: DBT_DEVICEARRIVAL Vs DBT_DEVNODES_CHANGED.

Hi All,
this is a query on the Windows messages.
My app needs to know when new device is added(specifically a audio output device) is added.

So I supposed, my window message handler can use the WM_DEVICECHANGE, and DBT_DEVICEARRIVAL.

But the app is receiving only DEVNODES_CHANGED all the time.
why is this? What is the best approach to be notified of new audio devices added? Please advise.

Regards,
Madhusudhana
— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I have used the guid (“4d36e96c-e325-11ce-bfc1-08002be10318”).

This is how I am doing it
DEV_BROADCAST_DEVICEINTERFACE dev;
dev.dbcc_devicetype=DBT_DEVTYP_DEVICEINTERFACE;

//dev.dbcc_classguid;//uuid(“4d36e96c-e325-11ce-bfc1-08002be10318”);
dev.dbcc_classguid.Data1=0x4d36e96c;
dev.dbcc_classguid.Data2=0xe325;
dev.dbcc_classguid.Data3=0x11ce;
dev.dbcc_classguid.Data4[0]=0xbf;
dev.dbcc_classguid.Data4[1]=0xc1;
dev.dbcc_classguid.Data4[2]=0x08;
dev.dbcc_classguid.Data4[3]=0x00;
dev.dbcc_classguid.Data4[4]=0x2b;
dev.dbcc_classguid.Data4[5]=0xe1;
dev.dbcc_classguid.Data4[6]=0x03;
dev.dbcc_classguid.Data4[7]=0x18;

dev.dbcc_size=sizeof(DEV_BROADCAST_DEVICEINTERFACE);

Tried with both
RegisterDeviceNotification(hInstance,&dev,DEVICE_NOTIFY_WINDOW_HANDLE);

and

RegisterDeviceNotification(hInstance,&dev,DEVICE_NOTIFY_WINDOW_HANDLE|DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);

None of these worked :frowning:

On Wed, Feb 17, 2010 at 12:21 PM, Doron Holan wrote:

> Did you call RegisterDeviceNotification with the appropriate device
> interface guid?
>
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *Madhusudan Narayan
> Sent: Monday, February 15, 2010 11:02 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Win7. WM_DEVICECHANGE:: DBT_DEVICEARRIVAL Vs
> DBT_DEVNODES_CHANGED.
>
>
>
> Hi All,
> this is a query on the Windows messages.
> My app needs to know when new device is added(specifically a audio output
> device) is added.
>
> So I supposed, my window message handler can use the WM_DEVICECHANGE, and
> DBT_DEVICEARRIVAL.
>
> But the app is receiving only DEVNODES_CHANGED all the time.
> why is this? What is the best approach to be notified of new audio devices
> added? Please advise.
>
>
> Regards,
> Madhusudhana
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

  1. It is certainly much easier to use GUID_DEVCLASS_MEDIA. OR convert the string to a guid with any number of built in functions so that you get the order in the Data4 array correct

  2. That is a device class, not a device interface. Device class defines pretty UI things like icons, not how the device works.

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Madhusudan Narayan
Sent: Tuesday, February 16, 2010 11:07 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Win7. WM_DEVICECHANGE:: DBT_DEVICEARRIVAL Vs DBT_DEVNODES_CHANGED.

I have used the guid (“4d36e96c-e325-11ce-bfc1-08002be10318”).

This is how I am doing it
DEV_BROADCAST_DEVICEINTERFACE dev;
dev.dbcc_devicetype=DBT_DEVTYP_DEVICEINTERFACE;

//dev.dbcc_classguid;//uuid(“4d36e96c-e325-11ce-bfc1-08002be10318”);
dev.dbcc_classguid.Data1=0x4d36e96c;
dev.dbcc_classguid.Data2=0xe325;
dev.dbcc_classguid.Data3=0x11ce;
dev.dbcc_classguid.Data4[0]=0xbf;
dev.dbcc_classguid.Data4[1]=0xc1;
dev.dbcc_classguid.Data4[2]=0x08;
dev.dbcc_classguid.Data4[3]=0x00;
dev.dbcc_classguid.Data4[4]=0x2b;
dev.dbcc_classguid.Data4[5]=0xe1;
dev.dbcc_classguid.Data4[6]=0x03;
dev.dbcc_classguid.Data4[7]=0x18;

dev.dbcc_size=sizeof(DEV_BROADCAST_DEVICEINTERFACE);

Tried with both
RegisterDeviceNotification(hInstance,&dev,DEVICE_NOTIFY_WINDOW_HANDLE);

and

RegisterDeviceNotification(hInstance,&dev,DEVICE_NOTIFY_WINDOW_HANDLE|DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);

None of these worked :frowning:

On Wed, Feb 17, 2010 at 12:21 PM, Doron Holan > wrote:
Did you call RegisterDeviceNotification with the appropriate device interface guid?

From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.commailto:xxxxx] On Behalf Of Madhusudan Narayan
Sent: Monday, February 15, 2010 11:02 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Win7. WM_DEVICECHANGE:: DBT_DEVICEARRIVAL Vs DBT_DEVNODES_CHANGED.

Hi All,
this is a query on the Windows messages.
My app needs to know when new device is added(specifically a audio output device) is added.

So I supposed, my window message handler can use the WM_DEVICECHANGE, and DBT_DEVICEARRIVAL.

But the app is receiving only DEVNODES_CHANGED all the time.
why is this? What is the best approach to be notified of new audio devices added? Please advise.

Regards,
Madhusudhana
— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

I tried GUID_DEVCLASS_MEDIA with no luck :frowning:

Did you mean I should use different structure , not
DEV_BROADCAST_DEVICEINTERFACE? If so which one?

-Madhusudhana

On Wed, Feb 17, 2010 at 12:40 PM, Doron Holan wrote:

> 1) It is certainly much easier to use GUID_DEVCLASS_MEDIA. OR
> convert the string to a guid with any number of built in functions so that
> you get the order in the Data4 array correct
>
> 2) That is a device class, not a device interface. Device class
> defines pretty UI things like icons, not how the device works.
>
>
>
> d
>
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *Madhusudan Narayan
> Sent: Tuesday, February 16, 2010 11:07 PM
>
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Win7. WM_DEVICECHANGE:: DBT_DEVICEARRIVAL Vs
> DBT_DEVNODES_CHANGED.
>
>
>
> I have used the guid (“4d36e96c-e325-11ce-bfc1-08002be10318”).
>
> This is how I am doing it
> DEV_BROADCAST_DEVICEINTERFACE dev;
> dev.dbcc_devicetype=DBT_DEVTYP_DEVICEINTERFACE;
>
> //dev.dbcc_classguid;//uuid(“4d36e96c-e325-11ce-bfc1-08002be10318”);
> dev.dbcc_classguid.Data1=0x4d36e96c;
> dev.dbcc_classguid.Data2=0xe325;
> dev.dbcc_classguid.Data3=0x11ce;
> dev.dbcc_classguid.Data4[0]=0xbf;
> dev.dbcc_classguid.Data4[1]=0xc1;
> dev.dbcc_classguid.Data4[2]=0x08;
> dev.dbcc_classguid.Data4[3]=0x00;
> dev.dbcc_classguid.Data4[4]=0x2b;
> dev.dbcc_classguid.Data4[5]=0xe1;
> dev.dbcc_classguid.Data4[6]=0x03;
> dev.dbcc_classguid.Data4[7]=0x18;
>
> dev.dbcc_size=sizeof(DEV_BROADCAST_DEVICEINTERFACE);
>
> Tried with both
> RegisterDeviceNotification(hInstance,&dev,DEVICE_NOTIFY_WINDOW_HANDLE);
>
> and
>
>
> RegisterDeviceNotification(hInstance,&dev,DEVICE_NOTIFY_WINDOW_HANDLE|DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
>
> None of these worked :frowning:
>
>
> On Wed, Feb 17, 2010 at 12:21 PM, Doron Holan
> wrote:
>
> Did you call RegisterDeviceNotification with the appropriate device
> interface guid?
>
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *Madhusudan Narayan
> Sent: Monday, February 15, 2010 11:02 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Win7. WM_DEVICECHANGE:: DBT_DEVICEARRIVAL Vs
> DBT_DEVNODES_CHANGED.
>
>
>
> Hi All,
> this is a query on the Windows messages.
> My app needs to know when new device is added(specifically a audio output
> device) is added.
>
> So I supposed, my window message handler can use the WM_DEVICECHANGE, and
> DBT_DEVICEARRIVAL.
>
> But the app is receiving only DEVNODES_CHANGED all the time.
> why is this? What is the best approach to be notified of new audio devices
> added? Please advise.
>
>
> Regards,
> Madhusudhana
>
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

The guid you are using is wrong. That is a device class (ie setup) guid. You need a device interface guid. I don’t know if KS has a publicly documented device interface guid, perhaps tim knows

d

tiny phone keyboard + fat thumbs = you do the muth


From: Madhusudan Narayan
Sent: Friday, February 19, 2010 2:22 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Win7. WM_DEVICECHANGE:: DBT_DEVICEARRIVAL Vs DBT_DEVNODES_CHANGED.

I tried GUID_DEVCLASS_MEDIA with no luck :frowning:

Did you mean I should use different structure , not DEV_BROADCAST_DEVICEINTERFACE? If so which one?

-Madhusudhana

On Wed, Feb 17, 2010 at 12:40 PM, Doron Holan > wrote:

1) It is certainly much easier to use GUID_DEVCLASS_MEDIA. OR convert the string to a guid with any number of built in functions so that you get the order in the Data4 array correct

2) That is a device class, not a device interface. Device class defines pretty UI things like icons, not how the device works.

d

From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.commailto:xxxxx] On Behalf Of Madhusudan Narayan
Sent: Tuesday, February 16, 2010 11:07 PM

To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Win7. WM_DEVICECHANGE:: DBT_DEVICEARRIVAL Vs DBT_DEVNODES_CHANGED.

I have used the guid (“4d36e96c-e325-11ce-bfc1-08002be10318”).

This is how I am doing it
DEV_BROADCAST_DEVICEINTERFACE dev;
dev.dbcc_devicetype=DBT_DEVTYP_DEVICEINTERFACE;

//dev.dbcc_classguid;//uuid(“4d36e96c-e325-11ce-bfc1-08002be10318”);
dev.dbcc_classguid.Data1=0x4d36e96c;
dev.dbcc_classguid.Data2=0xe325;
dev.dbcc_classguid.Data3=0x11ce;
dev.dbcc_classguid.Data4[0]=0xbf;
dev.dbcc_classguid.Data4[1]=0xc1;
dev.dbcc_classguid.Data4[2]=0x08;
dev.dbcc_classguid.Data4[3]=0x00;
dev.dbcc_classguid.Data4[4]=0x2b;
dev.dbcc_classguid.Data4[5]=0xe1;
dev.dbcc_classguid.Data4[6]=0x03;
dev.dbcc_classguid.Data4[7]=0x18;

dev.dbcc_size=sizeof(DEV_BROADCAST_DEVICEINTERFACE);

Tried with both
RegisterDeviceNotification(hInstance,&dev,DEVICE_NOTIFY_WINDOW_HANDLE);

and

RegisterDeviceNotification(hInstance,&dev,DEVICE_NOTIFY_WINDOW_HANDLE|DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);

None of these worked :frowning:

On Wed, Feb 17, 2010 at 12:21 PM, Doron Holan > wrote:
Did you call RegisterDeviceNotification with the appropriate device interface guid?

From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.commailto:xxxxx] On Behalf Of Madhusudan Narayan
Sent: Monday, February 15, 2010 11:02 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Win7. WM_DEVICECHANGE:: DBT_DEVICEARRIVAL Vs DBT_DEVNODES_CHANGED.

Hi All,
this is a query on the Windows messages.
My app needs to know when new device is added(specifically a audio output device) is added.

So I supposed, my window message handler can use the WM_DEVICECHANGE, and DBT_DEVICEARRIVAL.

But the app is receiving only DEVNODES_CHANGED all the time.
why is this? What is the best approach to be notified of new audio devices added? Please advise.

Regards,
Madhusudhana
— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

Doron Holan wrote:

I don’t know if KS has a publicly documented device interface
guid, perhaps tim knows

I believe it’s possible to register for *all* device interface class notifications. If you do that, you could just plug in your device and see which GUIDs show up.

Hi Chris,
I tried with the flag DEVICE_NOTIFY_ALL_INTERFACE_CLASSES.

But the only Messages(6 identical messages) I am getting is
“DBT_DEVNODES_CHANGED” for which there is no additional information about
the device.

On Sun, Feb 21, 2010 at 9:57 PM, wrote:

> Doron Holan wrote:
>
> > I don’t know if KS has a publicly documented device interface
> > guid, perhaps tim knows
>
> I believe it’s possible to register for all device interface class
> notifications. If you do that, you could just plug in your device and see
> which GUIDs show up.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Madhusudan Narayan wrote:

But the only Messages(6 identical messages) I am getting is
“DBT_DEVNODES_CHANGED” for which there is no additional
information about the device.

Assuming you set up the call sequence correctly, maybe the device’s driver just doesn’t expose a device interface. Is that possible?