I have tried to modify the sample code provided by Walter Oney which
provide an AutoLaunch service for Win 2K. I want to launch an
application for a network device where I did not write the driver. My
code snipet looks like --
DEV_BROADCAST_DEVICEINTERFACE filter = {0};
filter.dbcc_size = sizeof(filter);
filter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
filter.dbcc_classguid = GUID_DEVCLASS_NET;
m_hNotification = RegisterDeviceNotification(m_hService, (PVOID)
&filter, DEVICE_NOTIFY_SERVICE_HANDLE);
I realize that all GUID_DEVCLASS_NET events will be sent to the
service and I will need to find out if any particular event is of
interest. That part I have figured out. My problem is that I do not
see the "plug" or "unplug" events being sent to the m_hService handler
in the first place. What am I doing wrong?
Thanks,
Scott
Hi,
For anyone that cares, I found the answer after much toil. The filter
should be set as follows:
filter.dbcc_classguid = GUID_NDIS_LAN_CLASS
which is defined in ndisguid.h
This produces events on my particular Network card. I'm not sure if it
will work for all but give it a try. You can then parse the devices to
find of if your particular device in there.
Scott