PiDevCfgConfigureDeviceKeys

NTSTATUS __stdcall PiDevCfgConfigureDeviceKeys(
        _DEVICE_NODE *DeviceNode,
        PI_DEVCFG_DEVICE_CONTEXT *DeviceContext,
        VOID *ConfigurationKeyHandle,
        UINT64 ConfigurationScope,
        UINT64 *ConfigFlags,
        UINT64 *ConfigStatus){
  int v6; 
  NTSTATUS inited; 
  INT64 v11; 
  INT64 v12; 
  unsigned int *v14; 
  unsigned int *v15; 
  unsigned int *v16; 
  INT64 v17; 
  INT64 v18; 
  INT64 v19; 
  INT64 v20; 
  _KEY_VALUE_FULL_INFORMATION *KeyValueInfoResult; 
  VOID *KeyHandle; 
  __int128 v23; 
  _PI_DEVCFG_RESOLVE_CONTEXT ResolveContext[4]; 
  __int128 v25; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 

  KeyHandle = 0i64;
  KeyValueInfoResult = 0i64;
  v6 = ConfigurationScope;
  v23 = 0i64;
  *(_OWORD *)ResolveContext = 0i64;
  v25 = 0i64;
  if( ConfigFlags )
    *(_DWORD *)ConfigFlags = 0;
  if( ConfigStatus )
    *(_DWORD *)ConfigStatus = 0;
  inited = PiDevCfgInitResolveContext(DeviceNode, ConfigurationKeyHandle, ResolveContext);
  if( inited >= 0 )
  {
    inited = PiDevCfgEnumDeviceKeys(
               (__int64)DeviceNode,
               (__int64)DeviceContext,
               (__int64)ConfigurationKeyHandle,
               v6,
               1u,
               (__int64)PiDevCfgConfigureDeviceKeyCallback,
               (__int64)ResolveContext);
    if( inited >= 0 )
    {
      if( (v6 & 8) == 0
        || (inited = PiDevCfgConfigureDeviceInterfaces(
                       *((WCHAR **)DeviceContext + 1),
                       ConfigurationKeyHandle,
                       ResolveContext),
            inited >= 0) )
      {
        if( (v6 & 0x10) == 0
          || (inited = PiDevCfgConfigureSoftwareDevices(
                         *((VOID **)DeviceContext + 2),
                         ConfigurationKeyHandle,
                         v11,
                         v12,
                         v17,
                         v18,
                         v19,
                         v20),
              inited >= 0) )
        {
          if( (v6 & 0x20) == 0
            || (inited = PiDevCfgConfigureDeviceFilters(*((VOID **)DeviceContext + 2), ConfigurationKeyHandle),
                inited >= 0) )
          {
            *(&ObjectAttributes.Length + 1) = 0;
            memset(&ObjectAttributes.Attributes + 1, 0, 20);
            *((_QWORD *)&v23 + 1) = L"Status";
            LODWORD(v23) = 917516;
            ObjectAttributes.ObjectName = (_UNICODE_STRING *)&v23;
            ObjectAttributes.Length = 48;
            ObjectAttributes.RootDirectory = ConfigurationKeyHandle;
            ObjectAttributes.Attributes = 576;
            if( ZwOpenKey(&KeyHandle, 0x20019ui64, &ObjectAttributes, v12, v17, v18, v19, v20) >= 0 )
            {
              if( ConfigStatus )
              {
                if( PiDevCfgQueryResolveValue(ResolveContext, KeyHandle, (WCHAR *)L"Reboot", &KeyValueInfoResult) >= 0 )
                {
                  if( PnpValidateRegistryDword((__int64)KeyValueInfoResult) && *(unsigned int *)((char *)v14 + v14[2]) )
                    *(_DWORD *)ConfigStatus |= 0x40u;
                  ExFreePoolWithTag(v14, 0);
                }
                if( PiDevCfgQueryResolveValue(
                       ResolveContext,
                       KeyHandle,
                       (WCHAR *)L"ClassConfigured",
                       &KeyValueInfoResult) >= 0 )
                {
                  if( PnpValidateRegistryDword((__int64)KeyValueInfoResult) && *(unsigned int *)((char *)v15 + v15[2]) )
                    *(_DWORD *)ConfigStatus |= 2u;
                  ExFreePoolWithTag(v15, 0);
                }
              }
              if( ConfigFlags
                && PiDevCfgQueryResolveValue(ResolveContext, KeyHandle, (WCHAR *)L"ConfigFlags", &KeyValueInfoResult) >= 0 )
              {
                if( PnpValidateRegistryDword((__int64)KeyValueInfoResult) )
                  *(_DWORD *)ConfigFlags |= *(unsigned int *)((char *)v16 + v16[2]);
                ExFreePoolWithTag(v16, 0);
              }
            }
          }
        }
      }
    }
  }
  PiDevCfgFreeResolveContext(ResolveContext);
  if( KeyHandle )
    ZwClose((_HANDLE)KeyHandle);
  return inited;
}

Referenced by:

PiDevCfgConfigureDevice
PiDevCfgConfigureDeviceDriverConfiguration
PiDevCfgConfigureDeviceLocation
PpDevCfgProcessDeviceOperations