PiDevCfgEnumDeviceKeys
__int64 __fastcall PiDevCfgEnumDeviceKeys(
__int64 a1,
__int64 a2,
__int64 a3,
int a4,
char a5,
__int64 (__fastcall *a6)(__int64, __int64, int *, void *),
__int64 a7){
int *v7;
void *v8;
unsigned int v11;
unsigned int v12;
NTSTATUS v13;
int v15;
int DeviceRegProp;
__int64 v17;
__int64 v18;
__int64 v19;
int v20;
WCHAR v21;
const WCHAR *v22;
const wchar_t *v23;
NTSTATUS v24;
int v25;
int v26;
HANDLE Handle;
void *KeyHandle;
int v29;
int v30;
void *v31;
struct _UNICODE_STRING DestinationString;
__int64 v33;
__int64 v34;
__int64(__fastcall *v35)(__int64, __int64, int *, void *);
void *v36;
struct _OBJECT_ATTRIBUTES ObjectAttributes;
struct _OBJECT_ATTRIBUTES v38;
char v39[76];
__int16 v40;
v7 = &dword_140985B9C;
v35 = a6;
v8 = (void *)a3;
v33 = a7;
v36 = (void *)a3;
v34 = a1;
v11 = 0;
KeyHandle = 0i64;
DestinationString = 0i64;
Handle = 0i64;
v12 = 0;
v31 = 0i64;
v29 = 0;
v30 = 0;
while( 1 )
{
if( (a4 & *(v7 - 1)) == 0 )
goto LABEL_4;
RtlInitUnicodeString(&DestinationString, *(PCWSTR *)(v7 - 3), a3);
*(_QWORD *)&ObjectAttributes.Length = 48i64;
KeyHandle = 0i64;
*(_QWORD *)&ObjectAttributes.Attributes = 576i64;
ObjectAttributes.ObjectName = &DestinationString;
ObjectAttributes.RootDirectory = v8;
*(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
v13 = ZwOpenKey(&KeyHandle, 0x20019u, &ObjectAttributes);
if( v13 == -1073741772 )
goto LABEL_4;
if( v13 < 0 )
goto LABEL_26;
v15 = v7[1];
if( v15 )
{
DeviceRegProp = CmOpenDeviceRegKey(
PiPnpRtlCtx,
*(const wchar_t **)(a2 + 8),
v15,
0,
983103,
a5,
(__int64)&Handle,
0i64);
goto LABEL_14;
}
if( !CmIsStateSeparationEnabled() )
goto LABEL_20;
if( (_DWORD)v17 == 4 )
{
LODWORD(v17) = 4;
LABEL_20:
v20 = PnpCtxOpenContextBaseKey(v18, v17, v19, 0xF003Fu, &Handle);
goto LABEL_21;
}
if( (_DWORD)v17 == 6 )
goto LABEL_36;
v20 = PnpCtxOpenContextNodeBaseKey(v18, v17, v19, v17, v25, v26, &Handle);
LABEL_21:
DeviceRegProp = v20;
if( v20 < 0 )
goto LABEL_14;
if( *v7 == 7 )
{
v23 = *(const wchar_t **)(a2 + 8);
v29 = 78;
DeviceRegProp = CmGetDeviceRegProp(PiPnpRtlCtx, v23, 0i64, 9, (__int64)&v30, (__int64)v39, (__int64)&v29, 0);
if( DeviceRegProp < 0 )
goto LABEL_14;
if( v30 != 1 )
{
LABEL_36:
ZwClose(KeyHandle);
KeyHandle = 0i64;
goto LABEL_4;
}
v40 = 0;
v22 = (const WCHAR *)v39;
}
else
{
v22 = *(const WCHAR **)(v7 + 3);
}
if( v22 )
{
RtlInitUnicodeString(&DestinationString, v22, v21);
*(_QWORD *)&v38.Length = 48i64;
v31 = 0i64;
v38.RootDirectory = Handle;
*(_QWORD *)&v38.Attributes = 576i64;
v38.ObjectName = &DestinationString;
*(_OWORD *)&v38.SecurityDescriptor = 0i64;
v24 = ZwOpenKey(&v31, 0xF003Fu, &v38);
DeviceRegProp = v24;
if( v24 >= 0 )
{
ZwClose(Handle);
Handle = v31;
}
}
LABEL_14:
if( DeviceRegProp == -1073741772 )
goto LABEL_36;
if( DeviceRegProp < 0 )
break;
v26 = v33;
v25 = (int)Handle;
v13 = v35(v34, a2, v7 - 3, KeyHandle);
if( v13 == -1073741248 )
goto LABEL_6;
if( v13 < 0 )
{
LABEL_26:
v11 = v13;
goto LABEL_6;
}
ZwClose(KeyHandle);
KeyHandle = 0i64;
ZwClose(Handle);
Handle = 0i64;
LABEL_4:
++v12;
v7 += 8;
if( v12 >= 7 )
goto LABEL_6;
v8 = v36;
}
v11 = DeviceRegProp;
LABEL_6:
if( KeyHandle )
ZwClose(KeyHandle);
if( Handle )
ZwClose(Handle);
return v11;
}Referenced by:
PiDevCfgConfigureDeviceKeys
PiDevCfgResetDeviceKeys