PipOpenServiceEnumKeys
NTSTATUS __stdcall PipOpenServiceEnumKeys(
_UNICODE_STRING *ServiceKeyName,
UINT64 DesiredAccess,
VOID **ServiceHandle,
VOID **ServiceEnumHandle,
UINT8 CreateEnum){
unsigned int v6;
NTSTATUS result;
INT64 v10;
INT64 v11;
NTSTATUS v12;
NTSTATUS v13;
__int64 *v14;
INT64 CreateOptions;
UINT64 CreateOptionsa;
INT64 v17;
INT64 v18;
VOID *KeyHandle;
INT64 v20;
PVOID Handle;
_UNICODE_STRING KeyName;
_OBJECT_ATTRIBUTES ObjectAttributes;
Handle = 0i64;
v20 = 0i64;
v6 = DesiredAccess;
KeyName = 0i64;
result = PnpCtxGetCachedContextBaseKey(*(&stru_140CF2E80 + 607), PNPCTX_BASE_KEY_TYPE_SERVICES, (VOID **)&v20);
if( result >= 0 )
{
*(&ObjectAttributes.Length + 1) = 0;
memset(&ObjectAttributes.Attributes + 1, 0, 20);
ObjectAttributes.RootDirectory = (void *)v20;
ObjectAttributes.Length = 48;
ObjectAttributes.Attributes = 576;
ObjectAttributes.ObjectName = ServiceKeyName;
result = ZwOpenKey(&KeyHandle, v6, &ObjectAttributes, v10, CreateOptions, v17, 0i64, v20);
if( result == -1073741772 )
{
v14 = 0i64;
while( 1 )
{
if( !v14 )
v14 = (__int64 *)(*(&stru_140CF2E80 + 607) + 8i64);
v14 = (__int64 *)*v14;
if( v14 == (__int64 *)(*(&stru_140CF2E80 + 607) + 8i64) || !v14 )
break;
result = PnpCtxGetCachedNodeBaseKey(*(&stru_140CF2E80 + 607), v14, 6, &v20);
if( result < 0 )
{
if( result != -2147483622 )
goto LABEL_3;
break;
}
*(&ObjectAttributes.Length + 1) = 0;
memset(&ObjectAttributes.Attributes + 1, 0, 20);
ObjectAttributes.RootDirectory = (void *)v20;
ObjectAttributes.Length = 48;
ObjectAttributes.Attributes = 576;
ObjectAttributes.ObjectName = ServiceKeyName;
result = ZwOpenKey(&KeyHandle, v6, &ObjectAttributes, v11, CreateOptionsa, v18, 0i64, v20);
if( result != -1073741772 )
goto LABEL_3;
}
result = -1073741772;
}
LABEL_3:
if( result >= 0 )
{
if( ServiceEnumHandle || CreateEnum )
{
*(_DWORD *)&KeyName.Length = 655368;
KeyName.Buffer = (wchar_t *)&stru_1407D01E0._Xmm7;
if( CreateEnum )
{
LODWORD(CreateOptionsa) = 1;
v12 = IopCreateRegistryKeyEx(&Handle, KeyHandle, &KeyName, v6, CreateOptionsa, 0i64);
}
else
{
*(&ObjectAttributes.Length + 1) = 0;
memset(&ObjectAttributes.Attributes + 1, 0, 20);
ObjectAttributes.RootDirectory = KeyHandle;
ObjectAttributes.ObjectName = &KeyName;
ObjectAttributes.Length = 48;
ObjectAttributes.Attributes = 576;
v12 = ZwOpenKey(&Handle, v6, &ObjectAttributes, v11, CreateOptionsa, v18, (INT64)KeyHandle, v20);
}
v13 = v12;
if( v12 < 0 )
{
ZwClose((_HANDLE)KeyHandle);
return v13;
}
if( ServiceEnumHandle )
*ServiceEnumHandle = Handle;
else
ZwClose((_HANDLE)Handle);
}
if( ServiceHandle )
*ServiceHandle = KeyHandle;
else
ZwClose((_HANDLE)KeyHandle);
return 0;
}
}
return result;
}Referenced by:
IoOpenDriverRegistryKey
PiDevCfgMakeServiceBootStart
PiDevCfgVerifyService
PiProcessDriverInstance
PipApplyFunctionToServiceInstances
PipCallDriverAddDeviceQueryRoutine
PipDmgGetDriverDmarCompatLevel
PipGetDriverKsrGuid
PipHardwareConfigActivateService
PipServiceInstanceToDeviceInstance
PnpDriverLoadingFailed
PpDevCfgInit