I have a Win32 Service App, which registers an opened device handle for
removed check. This App works fine in XP-x64. but not in Vista-x64.

The Vista-x64 send the SERVICE_CONTROL_DEVICEEVENT /
DBT_DEVICEREMOVECOMPLETE with the value in the DEV_BROADCAST_HANDLE parameter
:

dbch_size --> sizeof(DEV_BROADCAST_HANDLE)
dbch_devicetype --> DBT_DEVTYP_HANDLE
dbch_handle ---> NULL
dbch_hdevnotify ---> NULL

This makes me to have no way to determent which handle I registered has
been removed.

Is there anyway to solve this problem?

Re: RegisterDeviceNotification on Vista x64 by Mathias

Mathias
Fri Apr 20 03:05:15 CDT 2007

Hi,

this is not normaly. I do this in XP, VISTA, VISTA64 to detect the removal from USB
device. It your register sequence correct ?

DEV_BROADCAST_HANDLE filter;

ZeroMemory( &filter, sizeof(filter));

filter.dbch_size = sizeof(filter);
filter.dbch_devicetype = DBT_DEVTYP_HANDLE;
filter.dbch_handle = handle;

The difference, I have not a service. I create always a windows in my class to detect
PnP events. I know a Window and a Service in VISTA is not supported. Try the detection
from normal windows program.

elli

Alfredo Uen wrote:

> I have a Win32 Service App, which registers an opened device handle for
> removed check. This App works fine in XP-x64. but not in Vista-x64.
>
> The Vista-x64 send the SERVICE_CONTROL_DEVICEEVENT /
> DBT_DEVICEREMOVECOMPLETE with the value in the DEV_BROADCAST_HANDLE parameter
> :
>
> dbch_size --> sizeof(DEV_BROADCAST_HANDLE)
> dbch_devicetype --> DBT_DEVTYP_HANDLE
> dbch_handle ---> NULL
> dbch_hdevnotify ---> NULL
>
> This makes me to have no way to determent which handle I registered has
> been removed.
>
> Is there anyway to solve this problem?



--