简体   繁体   中英

Registering for USB insertion/removal notifications (Windows Service)

I am writing Windows Service which logs information on inserted or removed USB devices. RegisterDeviceNotification function returns valid handle, but SERVICE_CONTROL_DEVICEEVENT notifications still not come to service control handler function.

I used Tom Bell's " Detecting USB Device Insertion and Removal Using Windows API " and "Creating your own Windows Service" from Habrahabr.

I'm new to Services and Windows API, so could you please look at my code and tell what may be wrong? And if the code is correct, is there any pitfalls(?) connected with security restrictions or something like this?

[EDIT moved from answer]

The problem was not in code, but in incorrectly installed VirtualBox :)

问题不在代码中,而是在错误安装的VirtualBox中:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM