Hi, All,
I develop a WDM Driver that in the AddDevice()£¬I use
IoRegisterPlugPlayNotification() to register listen to an USB device's
insert/remove.In its callback function, I use following code to get the
DeviceObject£º
if(IsEqualGUID(dicn->Event, GUID_DEVICE_INTERFACE_ARRIVAL))
{
status = IoGetDeviceObjectPointer(
dicn->SymbolicLinkName,
FILE_ALL_ACCESS,
&pFile,
&pdo);
.................
}
I found that in win 2000£¬the pdo return back is tha same as the
DeviceObject of the lower driver. So after that, the IRP build by me can be
successfully send to the lower device¡£At this time, the
dicn->SymbolicLinkName looks like
\??\USB#Vid_6513Pid_0089#51e37dc9701#{guid}
But in win98, the same codeget different result. IoGetDeviceObjectPointer
£¨£©return NTSUCCESS£¬but the pdo return back is different from the
DeviceObject of the lower driver. The IRP build by me£¬can't be send to
lower driver by IoCallDriver()¡£what's the problem? this time £¬the
dicn->SymbolicLinkName looks like
\DosDevice\0000000000000002\{guid}
Further more, I found that, in win 2000, when I call
IoGetDeviceObjectPointer(), the lower driver will recieve an IRP_MJ_CREATE.
But in win 98, the lower one can't recieve that IRP.
why? It seems so strange. in win98, the IoGetDeviceObjectPointer() can
return success, and give a pdo to me, but I can't use it.
Could anybody be kind enough to show me some light in that? Thanks in
advance!