PiSwStopDestroy
NTSTATUS __stdcall PiSwStopDestroy(PWCHAR ParentDeviceInstanceId){
const WCHAR *v1;
INT64 v2;
_ETHREAD *CurrentThread;
INT64 v4;
const WCHAR *v5;
WCHAR v6;
LIST_ENTRY *Children;
NTSTATUS v8;
int v9;
LIST_ENTRY *Flink;
INT64 v11;
const wchar_t *Blink;
struct _UNICODE_STRING DestinationString;
wchar_t *Str2;
Str2 = 0i64;
DestinationString = 0i64;
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
v4 = v2;
v5 = v1;
--*((_WORD *)CurrentThread + 242);
ExAcquireResourceExclusiveLite((ERESOURCE *)PiSwLockObj, 1u);
RtlInitUnicodeString(&DestinationString, v5, v6);
Children = PiSwFindChildren(&DestinationString);
if( Children )
{
PnpConcatPWSTR(
0xC8ui64,
0x57706E50ui64,
&Str2,
2ui64,
L"SWD\\",
L"DRIVERENUM",
*(_QWORD *)&DestinationString.Length,
DestinationString.Buffer);
v8 = v9;
if( v9 >= 0 )
{
Flink = Children->Flink;
while( Flink != Children )
{
v11 = (INT64)&Flink[-6];
Blink = (const wchar_t *)Flink[-6].Blink;
Flink = Flink->Flink;
if( !wcsicmp(Blink, Str2) && (*(_DWORD *)(v11 + 4) & 1) == 0 && PiSwFindPdoAssociation(v11, v4, 1) )
PiSwCloseDevice((CHAR *)v11);
}
}
if( Str2 )
ExFreePoolWithTag(Str2, 0x57706E50u);
}
else
{
v8 = -1073741772;
}
ExReleaseResourceLite((PERESOURCE)PiSwLockObj);
KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
return v8;
}Referenced by:
IopRemoveDevice