WM_DEVICECHANGE on Windows 2000.

Hi,

The problem is related to getting WM_DEVICECHANGE on
Windows 2000.

In my software I install virtual serial ports and
modems on those ports. I have
a MFC program that uses the OnDeviceChange method to
listen for notifications.

With this, when I install/uninstall the virtual serial
ports, I do not get the
DBT_DEVICEREMOVECOMPLETE or DBT_DEVICEARRIVAL messages
in the OnDeviceChange method. But instead I only get
DBT_DEVNODECHANGED.

However for the same virtual ports and modems, I get
the
DBT_DEVICEREMOVECOMPLETE and DBT_DEVICEARRIVAL
messages on WIN98 and ME. I also observed the same
problem of not getting
these messages on WIN2000 by using Spy ++.

As I mentioned earlier, please note that there is no
removal/arrival of hardware.
The COM ports are virtual ports. Is there any thing
additional that i need to do on
WIN2K to enable these broadcast messages.

Thanks in advance,
Regards,
Jayadev


Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hello,

With this, when I install/uninstall the virtual serial
ports, I do not get the
DBT_DEVICEREMOVECOMPLETE or DBT_DEVICEARRIVAL messages
in the OnDeviceChange method. But instead I only get
DBT_DEVNODECHANGED.

I remember this problem, but I’am not shure about my
solution. Maybe here is a difference between Windows 2000
raw installation and SP1.

I assume your driver use IoRegisterDeviceInterface().

elli


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi,
Thanks Elli for confirming the problem. As you
assumed, I do IoRegisterDeviceInterface() and then
Set/Disable the state of the interface during the
IRP_MN_START_DEVICE and IRP_MN_REMOVE_DEVICE using
IoSetDeviceInterfaceState(). Still, I don’t get the
broadcast notification.
But the DDK clearly says that the system notifies the
application.

=====================================================
This is a paragraph in the DDK under the section
IoSetDeviceInterfaceState. >>

If a call to this routine successfully exposes a
device interface, the system notifies any components
that registered for PnP notification of a device class
change. Similarly, if a call to this routine disables
an existing device interface, the system sends
appropriate notfications.

Can you make me more clear regarding the SP1 and
retail 2000 release. Is there any service pack
available which has the fix.

Regards,
Jay

— Mathias Ellinger wrote:
> Hello,
>
> >
> >With this, when I install/uninstall the virtual
> serial
> >ports, I do not get the
> >DBT_DEVICEREMOVECOMPLETE or DBT_DEVICEARRIVAL
> messages
> >in the OnDeviceChange method. But instead I only
> get
> >DBT_DEVNODECHANGED.
>
> I remember this problem, but I’am not shure about my
> solution. Maybe here is a difference between Windows
> 2000
> raw installation and SP1.
>
> I assume your driver use
> IoRegisterDeviceInterface().
>
> elli
>
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

PNP notification works flawlessly on Win2K. Check your app to see
whether you are using the right guid. I have seen people registering for
notification on Setup class guid instead of Interface class guid and
scratching their head all day long wondering why it doesn’t work.

I would suggest you to use the Notify app of toaster package
(src\general\toaster\exe\notify) and just replace the guid with yours
and see if that works. You can download the app from
http://support.microsoft.com/support/kb/articles/Q263/8/32.ASP.

-Eliyas

-----Original Message-----
From: jayadev m n [mailto:xxxxx@yahoo.com]
Sent: Thursday, August 23, 2001 7:03 AM
To: NT Developers Interest List
Subject: [ntdev] WM_DEVICECHANGE on Windows 2000.

Hi,

The problem is related to getting WM_DEVICECHANGE on
Windows 2000.

In my software I install virtual serial ports and
modems on those ports. I have
a MFC program that uses the OnDeviceChange method to
listen for notifications.

With this, when I install/uninstall the virtual serial
ports, I do not get the
DBT_DEVICEREMOVECOMPLETE or DBT_DEVICEARRIVAL messages
in the OnDeviceChange method. But instead I only get
DBT_DEVNODECHANGED.

However for the same virtual ports and modems, I get
the
DBT_DEVICEREMOVECOMPLETE and DBT_DEVICEARRIVAL
messages on WIN98 and ME. I also observed the same
problem of not getting
these messages on WIN2000 by using Spy ++.

As I mentioned earlier, please note that there is no
removal/arrival of hardware.
The COM ports are virtual ports. Is there any thing
additional that i need to do on
WIN2K to enable these broadcast messages.

Thanks in advance,
Regards,
Jayadev


Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Thanks Eliyas,

My understanding regarding the the PNP notification in
windows 2000 was wrong, one probable reasons was that,
I compared the working of Windows 98 SE/ Me with that
of Windows 2000. As I mentioned in my earlier posting,
Windows 98 /Me posted/Broadcasted the Pnp Notification
for all devices that are added or removed,
irrespective of whether a window registers for the Pnp
notification using the RegisterDeviceInterface() for a
given interface.

I realised this after re-reading the DDK doc, and it
clearly said that “windows 2000 will notify for all
the windows that are registered for the interface” and
the doc never said any thing about the Broadcast.

I have the following questions to ask the forum.

  1. For curiosity and knowledge base, I would like to
    know, what urged microsoft to change the behavour in
    2000 ? Is broadcasting these messages wrong by design
    ?

  2. Where can I get the GUID for the interfaces for
    different class of devices ? Some headers gives the
    setup class GUID.
    It accidentally happened so that, I took the GUID in
    the Serial sample(src\kernel\serial) and used the same
    to register for pnp notification. It was the interface
    for the serial class of devices and I successfully
    started getting the pnp notification for the serial
    class of device. This interface is

Interface : {86e0d1e0-8089-11d0-9ce4-08003e301f73}
This is defined as GUID_CLASS_COMPORT in ntddser.h of
DDK.

  1. Where can I get similar interface for Modem class
    of device? I guess that the Modem.cpl would have
    registered for such an interface and hence gets the
    notification when ever any modem is added/deleted by
    any program.

Thanks and Regards,
Jay


Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> 1. For curiosity and knowledge base, I would like to

know, what urged microsoft to change the behavour in
2000 ? Is broadcasting these messages wrong by design
?

I certainly would presume to speak for Microsoft, but broadcasting to all
Windows scales linerally with number of Windows as opposed to linerally with
the potentially very much smaller set of ‘registered Windows’. Sending the
messages only to the Windows that registered for them just significantly
reduces the amount of code that is executed when a device is plugged in (I
like those types of things since it’s faster, and in my case, it’s harder
for me to write bugs in the code if I don’t actually have to write the
code!).

That said, I’m also not sure I observed the same behavior that you did on
Windows 98 - I’ve always registered, first on the device interface, then on
the handle after the arrival notification or enumeration. Interesting, I
may have to fire up 98 and see if I can reproduce what you’re seeing.

  1. Where can I get the GUID for the interfaces for
    different class of devices ? Some headers gives the
    setup class GUID.
    It accidentally happened so that, I took the GUID in
    the Serial sample(src\kernel\serial) and used the same
    to register for pnp notification. It was the interface
    for the serial class of devices and I successfully
    started getting the pnp notification for the serial
    class of device. This interface is

Interface : {86e0d1e0-8089-11d0-9ce4-08003e301f73}
This is defined as GUID_CLASS_COMPORT in ntddser.h of
DDK.

These GUIDs are driver-specific, and are conceptually a part of the
interface to the driver, just as the DeviceIoControl code definitions and
parameters are. The best way to get these GUIDs is to have the source code
to the particular driver you’re using, or very good documentation/support
from the driver provider. Without that, you can figure out the GUIDs pretty
easily by peeking around in the registry, but that only gets you the GUID,
and not the rest of the interface, such as DeviceIoControl definitions, so
often doesn’t do you much good.

Many devices (and device types) have a higher-level API, provided by the
operating system or by the device vendor. In those cases, application
programmers don’t use the GUID/handle/DeviceIoControl interface to talk to
those devices. Most of the ‘standard’ device types fall into this category,
such as Modems (TAPI), Scanners (STI), Network Adapters (WinSock), Sound
Boards (DirectSound, DirectMusic, etc.), Video Boards (GDI, DirectX, OpenGL,
etc.), and Printers (GDI, etc.). For those device types, because the OS
provides these higher-level APIs, Microsoft, the device vendors, or driver
writers for those device types often don’t provide the lower-level interface
information such as the GUID and DeviceIoControl codes. This is all further
complicated by the various different driver models for those types of
devices.

For a number of drivers, these values are in the ntddxxx.h files in the DDK,
as you’ve already seen for the COM ports.

For a custom device type, whether this low-level interface information is
provided is entirely up to the device vendor.

  1. Where can I get similar interface for Modem class
    of device? I guess that the Modem.cpl would have
    registered for such an interface and hence gets the
    notification when ever any modem is added/deleted by
    any program.

I’d recommend checking into using TAPI to get this information first, and if
that isn’t what you need, use regedt32 to look around in the registry. A
quick look through my registry shows {2c7089aa-2e0e-11d1-b114-00c04fc2aae4}
as an interface (maybe not the only one) for the Lucent 56K PCI V.90 PCI DF
Modem in this laptop. I got this by looking at
HKLM\System\CurrentControlSet\Enum\PCI<hardware id>, until I found my
modem, then looking under
HKLM\System\CurrentControlSet\Control\DeviceClasses until I found the device
interface class for that hardware ID. Beware again the difference between
Device Interface Class and Setup Class (which is
{4D36E96D-E325-11CE-BFC1-08002BE10318} for this modem) - they’re not the
same, and the Setup Class GUID is in the registry as well.

> Thanks and Regards,
> Jay
>
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> —
> You are currently subscribed to ntdev as: xxxxx@driverdev.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Whoops, sorry - make that “I certainly would NOT presume to speak for
Microsoft.”

Timothy A. Johns — xxxxx@driverdev.com
Driver Development Corporation — 800.841.0092
Bring Up Your Hardware — Fast. www.driverdev.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Timothy A. Johns
Sent: Sunday, August 26, 2001 11:17 AM
To: NT Developers Interest List
Subject: [ntdev] Re: WM_DEVICECHANGE on Windows 2000.

> 1. For curiosity and knowledge base, I would like to
> know, what urged microsoft to change the behavour in
> 2000 ? Is broadcasting these messages wrong by design
> ?

I certainly would presume to speak for Microsoft, but broadcasting to all
Windows scales linerally with number of Windows as opposed to
linerally with
the potentially very much smaller set of ‘registered Windows’.
Sending the
messages only to the Windows that registered for them just significantly
reduces the amount of code that is executed when a device is plugged in (I
like those types of things since it’s faster, and in my case, it’s harder
for me to write bugs in the code if I don’t actually have to write the
code!).

That said, I’m also not sure I observed the same behavior that you did on
Windows 98 - I’ve always registered, first on the device
interface, then on
the handle after the arrival notification or enumeration. Interesting, I
may have to fire up 98 and see if I can reproduce what you’re seeing.

>
> 2. Where can I get the GUID for the interfaces for
> different class of devices ? Some headers gives the
> setup class GUID.
> It accidentally happened so that, I took the GUID in
> the Serial sample(src\kernel\serial) and used the same
> to register for pnp notification. It was the interface
> for the serial class of devices and I successfully
> started getting the pnp notification for the serial
> class of device. This interface is
>
> Interface : {86e0d1e0-8089-11d0-9ce4-08003e301f73}
> This is defined as GUID_CLASS_COMPORT in ntddser.h of
> DDK.

These GUIDs are driver-specific, and are conceptually a part of the
interface to the driver, just as the DeviceIoControl code definitions and
parameters are. The best way to get these GUIDs is to have the
source code
to the particular driver you’re using, or very good documentation/support
from the driver provider. Without that, you can figure out the
GUIDs pretty
easily by peeking around in the registry, but that only gets you the GUID,
and not the rest of the interface, such as DeviceIoControl definitions, so
often doesn’t do you much good.

Many devices (and device types) have a higher-level API, provided by the
operating system or by the device vendor. In those cases, application
programmers don’t use the GUID/handle/DeviceIoControl interface to talk to
those devices. Most of the ‘standard’ device types fall into
this category,
such as Modems (TAPI), Scanners (STI), Network Adapters (WinSock), Sound
Boards (DirectSound, DirectMusic, etc.), Video Boards (GDI,
DirectX, OpenGL,
etc.), and Printers (GDI, etc.). For those device types, because the OS
provides these higher-level APIs, Microsoft, the device vendors, or driver
writers for those device types often don’t provide the
lower-level interface
information such as the GUID and DeviceIoControl codes. This is
all further
complicated by the various different driver models for those types of
devices.

For a number of drivers, these values are in the ntddxxx.h files
in the DDK,
as you’ve already seen for the COM ports.

For a custom device type, whether this low-level interface information is
provided is entirely up to the device vendor.

> 3. Where can I get similar interface for Modem class
> of device? I guess that the Modem.cpl would have
> registered for such an interface and hence gets the
> notification when ever any modem is added/deleted by
> any program.
>

I’d recommend checking into using TAPI to get this information
first, and if
that isn’t what you need, use regedt32 to look around in the registry. A
quick look through my registry shows
{2c7089aa-2e0e-11d1-b114-00c04fc2aae4}
as an interface (maybe not the only one) for the Lucent 56K PCI
V.90 PCI DF
Modem in this laptop. I got this by looking at
HKLM\System\CurrentControlSet\Enum\PCI<hardware id>, until I found my
> modem, then looking under
> HKLM\System\CurrentControlSet\Control\DeviceClasses until I found
> the device
> interface class for that hardware ID. Beware again the difference between
> Device Interface Class and Setup Class (which is
> {4D36E96D-E325-11CE-BFC1-08002BE10318} for this modem) - they’re not the
> same, and the Setup Class GUID is in the registry as well.
>
>
> > Thanks and Regards,
> > Jay
> >
> >
> >
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Make international calls for as low as $.04/minute with Yahoo! Messenger
> > http://phonecard.yahoo.com/
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@driverdev.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@driverdev.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com