PnpGetGenericStorePropertyKeys
signed int __fastcall PnpGetGenericStorePropertyKeys(
__int64 a1,
char *a2,
const wchar_t *a3,
char a4,
__int64 a5,
unsigned int a6,
unsigned int *a7){
char v7;
const wchar_t *v8;
char *v9;
signed int result;
unsigned int i;
int v13;
__int64 v14;
unsigned int v15;
int v16;
__int64 v17;
__int64 v18;
ULONG v19;
int v20;
bool v21;
int v22;
__int64 v23;
__int64 v24;
__int64 v25;
unsigned int v27;
int v28;
ULONG Value;
HANDLE Handle;
HANDLE v31;
HANDLE KeyHandle;
size_t pcchLength;
const wchar_t *v34;
struct _UNICODE_STRING DestinationString;
__int64 v36;
GUID Guid;
WCHAR v38[16];
WCHAR SourceString[40];
char v40[176];
v7 = 0;
v34 = a3;
v8 = a3;
*a7 = 0;
v9 = a2;
v36 = a5;
KeyHandle = 0i64;
v31 = 0i64;
Handle = 0i64;
v28 = 0;
Value = 0;
Guid = 0i64;
DestinationString = 0i64;
if( !a3 || (result = RtlUnalignedStringCchLengthW(a3, 0x55ui64, &pcchLength), result >= 0) )
{
result = PnpOpenPropertiesKey(a1, v9, 0i64, 9u, 0, v25, &KeyHandle);
if( result == -1073741772 )
return 0;
if( result >= 0 )
{
for( i = 0; ; i = pcchLength )
{
while( 1 )
{
do
{
v27 = 39;
v13 = RegRtlEnumKey(KeyHandle, i++, (char *)SourceString, &v27);
LODWORD(pcchLength) = i;
}
while( v13 == -1073741789 );
if( v13 )
{
ZwClose(KeyHandle);
return a6 < *a7 ? 0xC0000023 : 0;
}
if( (int)RtlInitUnicodeStringEx(&DestinationString, SourceString) >= 0
&& RtlGUIDFromString(&DestinationString, &Guid) >= 0 )
{
v14 = 0i64;
if( a1 )
v14 = *(_QWORD *)(a1 + 224);
if( (int)SysCtxRegOpenKey(v14, (char *)KeyHandle, SourceString, 0, 9u, &v31) >= 0 )
break;
}
}
v15 = 0;
while( 1 )
{
do
{
v27 = 9;
v16 = RegRtlEnumKey(v31, v15++, (char *)v38, &v27);
}
while( v16 == -1073741789 );
if( v16 )
break;
if( (int)RtlInitUnicodeStringEx(&DestinationString, v38) >= 0
&& RtlUnicodeStringToInteger(&DestinationString, 0x10ui64, (UINT64 *)&Value) >= 0 )
{
v17 = 0i64;
if( a1 )
v17 = *(_QWORD *)(a1 + 224);
if( (int)SysCtxRegOpenKey(v17, (char *)v31, v38, 0, 1u, &Handle) >= 0 )
{
if( a4 )
{
v19 = 0;
do
{
v27 = 85;
v20 = PnpCtxRegEnumValue(v18, Handle, v19++, v40, &v27, (__int64)&v28, 0i64, 0i64);
}
while( v20 == -1073741789 );
v8 = v34;
v21 = v20 == 0;
}
else
{
v27 = 0;
v22 = RegRtlQueryValue(Handle, v8, &v28, 0i64, (__int64)&v27);
if( !v22 )
goto LABEL_31;
v21 = v22 == -1073741789;
}
if( v21 )
LABEL_31:
v7 = 1;
ZwClose(Handle);
v21 = v7 == 0;
v7 = 0;
if( !v21 )
{
v23 = *a7;
if( (unsigned int)v23 < a6 )
{
v24 = v36;
*(GUID *)(v36 + 20 * v23) = Guid;
*(_DWORD *)(v24 + 20i64 * *a7 + 16) = Value;
LODWORD(v23) = *a7;
}
*a7 = v23 + 1;
v7 = 0;
}
}
}
}
ZwClose(v31);
}
}
}
return result;
}Referenced by:
DrvDbDeleteObjectSubKey
PiCreateDriverSwDeviceCallback
PiDevCfgCopyObjectProperties
PiDqPnPGetObjectPropertyKeys
PnpGetObjectPropertyKeysWorker