PnpUnregisterPlugPlayNotification
__int64 __fastcall PnpUnregisterPlugPlayNotification(PVOID P, char a2){
_FAST_MUTEX *v2;
char v5;
INT64 v6;
_ETHREAD *CurrentThread;
PVOID *v9;
PVOID *v10;
PVOID *v11;
PVOID *v12;
PVOID **v13;
v2 = (_FAST_MUTEX *)*((_QWORD *)P + 8);
v5 = 0;
ExAcquireFastMutex((PFAST_MUTEX)((char *)&PnpReplaceEvent + 64));
if( BYTE2(NlsMbCodePageTag) )
{
ExAcquireFastMutex((PFAST_MUTEX)((char *)&stru_140C452E0 + 128));
v9 = (PVOID *)PnpDeferredRegistrationList;
while( v9 != &PnpDeferredRegistrationList )
{
v10 = v9 + 2;
v11 = v9;
if( v9[2] == P )
{
v5 = 1;
if( v2 )
ExAcquireFastMutex(v2);
v12 = (PVOID *)*v9;
v9 = v12;
if( v12[1] != v11 || (v13 = (PVOID **)v11[1], *v13 != v11) )
__fastfail(3u);
*v13 = v12;
v12[1] = v13;
PnpDereferenceNotify(*v10);
if( v2 )
KeReleaseGuardedMutex(v2);
ExFreePoolWithTag(v11, 0x37706E50u);
}
else
{
v9 = (PVOID *)*v9;
}
}
KeReleaseGuardedMutex((PKGUARDED_MUTEX)((char *)&stru_140C452E0 + 128));
}
KeReleaseGuardedMutex((PKGUARDED_MUTEX)((char *)&PnpReplaceEvent + 64));
if( a2 )
{
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
--CurrentThread->Tcb.KernelApcDisable;
ExAcquireResourceExclusiveLite(*((_QWORD *)P + 9), 1, v6);
}
else if( v2 )
{
ExAcquireFastMutex(v2);
}
if( !*((_BYTE *)P + 58) || v5 )
{
*((_BYTE *)P + 58) = 1;
if( a2 )
{
ExReleaseResourceLite(*((PERESOURCE *)P + 9));
KeLeaveCriticalRegionThread(KeGetCurrentThread());
if( v2 )
ExAcquireFastMutex(v2);
}
PnpDereferenceNotify(P);
}
else if( a2 )
{
ExReleaseResourceLite(*((PERESOURCE *)P + 9));
KeLeaveCriticalRegionThread(KeGetCurrentThread());
return 0i64;
}
if( v2 )
KeReleaseGuardedMutex(v2);
return 0i64;
}Referenced by:
IoUnregisterPlugPlayNotification
IoUnregisterPlugPlayNotificationEx
PopCleanCoolingExtension
PopPolicyDeviceTargetChange
SmKmFileInfoCleanup