PiDevCfgConfigureSoftwareDevices
VOID __stdcall PiDevCfgConfigureSoftwareDevices(PVOID DeviceInstanceKeyHandle, PVOID ConfigurationKeyHandle){
NTSTATUS v3;
NTSTATUS v4;
char *v5;
WCHAR *PoolWithTag;
unsigned int v7;
NTSTATUS v8;
__int64 v9;
__int64 v10;
__int64 v11;
__int64 v12;
NTSTATUS v13;
UINT64 Length;
UINT64 Lengtha;
UINT64 Lengthb;
UNICODE_STRING KeyName;
struct _OBJECT_ATTRIBUTES ObjectAttributes;
UINT64 ResultLength;
void *KeyHandle;
HANDLE Handle;
ObjectAttributes.RootDirectory = ConfigurationKeyHandle;
Handle = 0i64;
LODWORD(ResultLength) = 0;
KeyHandle = 0i64;
ObjectAttributes.ObjectName = &KeyName;
KeyName.Buffer = L"Devices";
*(_QWORD *)&KeyName.Length = 1048590i64;
*(_QWORD *)&ObjectAttributes.Length = 48i64;
*(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
*(_QWORD *)&ObjectAttributes.Attributes = 576i64;
v3 = ZwOpenKey(&KeyHandle, 0x20019u, &ObjectAttributes);
if( v3 != -1073741772 && v3 >= 0 )
{
LODWORD(Length) = 0;
*(_DWORD *)&KeyName.Length = 1048590;
KeyName.Buffer = L"Devices";
v4 = IopCreateRegistryKeyEx(&Handle, DeviceInstanceKeyHandle, &KeyName, 0xF003Fui64, Length, 0i64);
v5 = (char *)Handle;
if( v4 >= 0 )
{
PoolWithTag = (WCHAR *)ExAllocatePoolWithTag(PagedPool, 0x220ui64, 0x63647050ui64);
if( PoolWithTag )
{
LODWORD(Lengtha) = 544;
v7 = 0;
v8 = ZwEnumerateKey(KeyHandle, 0i64, KeyBasicInformation, PoolWithTag, Lengtha, &ResultLength);
if( v8 >= 0 )
{
do
{
PoolWithTag[((unsigned __int64)*((unsigned int *)PoolWithTag + 3) >> 1) + 8] = 0;
if( PiPnpRtlCtx && (v9 = *(_QWORD *)(PiPnpRtlCtx + 224)) != 0 )
v10 = *(_QWORD *)(v9 + 8);
else
v10 = 0i64;
RegRtlDeleteTreeInternal(v5, PoolWithTag + 8, v10, 0);
if( PiPnpRtlCtx && (v11 = *(_QWORD *)(PiPnpRtlCtx + 224)) != 0 )
v12 = *(_QWORD *)(v11 + 8);
else
v12 = 0i64;
if( (int)RegRtlCopyTreeInternal(
(char *)KeyHandle,
PoolWithTag + 8,
(__int64)v5,
PoolWithTag + 8,
0,
v12,
0) < 0 )
break;
++v7;
LODWORD(Lengthb) = 544;
v13 = ZwEnumerateKey(KeyHandle, v7, KeyBasicInformation, PoolWithTag, Lengthb, &ResultLength);
}
while( v13 >= 0 );
}
ExFreePoolWithTag(PoolWithTag, 0);
}
}
if( v5 )
ZwClose(v5);
}
if( KeyHandle )
ZwClose(KeyHandle);
}Referenced by:
PiDevCfgConfigureDeviceKeys