PiDevCfgVerifyService

NTSTATUS __stdcall PiDevCfgVerifyService(WCHAR *ServiceName, UINT8 *BootStart, UINT64 *PnpFlags){
  int v3; 
  unsigned int v6; 
  int RegistryValue; 
  unsigned int *v8; 
  unsigned int *v9; 
  unsigned int *v11; 
  _UNICODE_STRING DestinationString; 
  _KEY_VALUE_FULL_INFORMATION *Information; 
  VOID *ServiceHandle; 

  ServiceHandle = 0i64;
  LOBYTE(v3) = 0;
  Information = 0i64;
  DestinationString = 0i64;
  v6 = 4;
  if( BootStart )
    *BootStart = 0;
  if( PnpFlags )
    *(_DWORD *)PnpFlags = 0;
  RtlInitUnicodeString(&DestinationString, ServiceName);
  RegistryValue = PipOpenServiceEnumKeys(&DestinationString, 0x20019ui64, &ServiceHandle, 0i64, 0);
  if( RegistryValue >= 0 )
  {
    RegistryValue = IopGetRegistryValue(ServiceHandle, (PWCHAR)L"Type", 0i64, &Information);
    if( RegistryValue >= 0 )
    {
      if( PnpValidateRegistryDword((__int64)Information) )
        v3 = *(unsigned int *)((char *)v8 + v8[2]);
      else
        RegistryValue = -1073741823;
      ExFreePoolWithTag(v8, 0);
      if( RegistryValue >= 0 )
      {
        if( (v3 & 0xB) == 0 )
          goto LABEL_23;
        RegistryValue = IopGetRegistryValue(ServiceHandle, (PWCHAR)L"Start", 0i64, &Information);
        if( RegistryValue < 0 )
          goto LABEL_20;
        if( PnpValidateRegistryDword((__int64)Information) )
          v6 = *(unsigned int *)((char *)v9 + v9[2]);
        else
          RegistryValue = -1073741823;
        ExFreePoolWithTag(v9, 0);
        if( RegistryValue < 0 )
          goto LABEL_20;
        if( v6 <= 4 )
        {
          if( BootStart )
            *BootStart = v6 == 0;
          if( PnpFlags && IopGetRegistryValue(ServiceHandle, (PWCHAR)&stru_1407D01E0._Xmm9, 0i64, &Information) >= 0 )
          {
            if( PnpValidateRegistryDword((__int64)Information) )
              *(_DWORD *)PnpFlags = *(unsigned int *)((char *)v11 + v11[2]);
            ExFreePoolWithTag(v11, 0);
          }
        }
        else
        {
LABEL_23:
          RegistryValue = -1073741823;
        }
      }
    }
  }
LABEL_20:
  if( ServiceHandle )
    ZwClose((_HANDLE)ServiceHandle);
  return RegistryValue;
}

Referenced by:

PiDevCfgQueryDriverConfiguration