PnpDisableDeviceInterfaces
NTSTATUS __stdcall PnpDisableDeviceInterfaces(UNICODE_STRING *DeviceInstancePath){
_ETHREAD *CurrentThread;
void *PoolWithTag;
NTSTATUS MatchingFilteredDeviceInterfaceList;
unsigned int v5;
WCHAR *i;
struct _UNICODE_STRING DestinationString;
unsigned int v9;
WCHAR *OutString;
v9 = 0;
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
PoolWithTag = 0i64;
OutString = 0i64;
DestinationString = 0i64;
--*((_WORD *)CurrentThread + 242);
ExAcquireResourceExclusiveLite(&PnpRegistryDeviceResource, 1u);
MatchingFilteredDeviceInterfaceList = PnpUnicodeStringToWstr(&OutString, 0i64, DeviceInstancePath);
if( MatchingFilteredDeviceInterfaceList >= 0 )
{
v9 = 4096;
MatchingFilteredDeviceInterfaceList = -1073741789;
v5 = 0;
while( v5 < 5 )
{
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
PoolWithTag = ExAllocatePoolWithTag(PagedPool, 2i64 * v9, 0x20207050ui64);
if( !PoolWithTag )
{
MatchingFilteredDeviceInterfaceList = -1073741670;
break;
}
++v5;
MatchingFilteredDeviceInterfaceList = CmGetMatchingFilteredDeviceInterfaceList(
PiPnpRtlCtx,
0i64,
(__int64)OutString,
1,
0i64,
0i64,
(__int64)PoolWithTag,
v9,
(__int64)&v9,
0);
if( MatchingFilteredDeviceInterfaceList != -1073741789 )
break;
}
if( MatchingFilteredDeviceInterfaceList >= 0 )
{
for( i = (WCHAR *)PoolWithTag; *i; i += ((unsigned __int64)DestinationString.Length + 2) >> 1 )
{
MatchingFilteredDeviceInterfaceList = RtlInitUnicodeStringEx(&DestinationString, i);
if( MatchingFilteredDeviceInterfaceList >= 0 )
IoSetDeviceInterfaceState(&DestinationString, 0);
}
}
}
ExReleaseResourceLite(&PnpRegistryDeviceResource);
KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
PnpUnicodeStringToWstrFree(OutString, DeviceInstancePath);
return MatchingFilteredDeviceInterfaceList;
}Referenced by:
PnpSurpriseRemoveLockedDeviceNode