W2k - Service program - register device notification problem

T

TD

Hello,

My service program does not receive the
event "SERVICE_CONTROL_DEVICEEVENT"
for a device event of an USB device.

What I do is :

// Define the GUID class

DEFINE_GUID (GUID_DBU_DEVICE,
0x36FC9E60,0xC465,0x11CF,
0x80,0x56,0x44,0x45,0x53,0x54,0x00,0x00);

// Register the service ctrl handler

hServiceStatus = RegisterServiceCtrlHandlerEx( ... );

// ServiceCtrlHandler

switch(dwControl)

{ case SERVICE_CONTROL_DEVICEEVENT:

[...]

}

// Register for device notification

Filter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);

Filter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;

Filter.dbcc_classguid = GUID_DBU_DEVICE;

hDevNotify = RegisterDeviceNotification(

hServiceStatus ,

&Filter,

DEVICE_NOTIFY_SERVICE_HANDLE

);



And when reporting the status to the SCM, I specify, as in
the document of
Microsoft



ServiceStatus.dwControlsAccepted =

SERVICE_ACCEPT_PARAMCHANGE |

SERVICE_ACCEPT_HARDWAREPROFILECHANGE |

SERVICE_ACCEPT_POWEREVENT |

[...]

SetServiceStatus(hServiceStatus, &ServiceStatus)



It seems that everything is OK. But It doesn't work. Do
you think that there
is something else that I have to check?

Is it a bug of Microsoft?



Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top