PiDevCfgInitResolveContext

NTSTATUS __stdcall PiDevCfgInitResolveContext(
        _DEVICE_NODE *DeviceNode,
        VOID *ConfigurationKeyHandle,
        PI_DEVCFG_RESOLVE_CONTEXT *ResolveContext){
  INT64 v3; 
  NTSTATUS v6; 
  INT64 v7; 
  int v8; 
  NTSTATUS v9; 
  VOID **PoolWithTag; 
  __int64 v12; 
  __int64 v13; 
  _QWORD *v14; 
  __int64 v15; 
  VOID *v16; 
  INT64 v17; 
  _OBJECT_ATTRIBUTES ObjectAttributes; 
  VOID *KeyHandle; 

  KeyHandle = 0i64;
  HIDWORD(v17) = 0;
  *((_QWORD *)ResolveContext + 1) = 0i64;
  *((_QWORD *)ResolveContext + 3) = 0i64;
  *(&ObjectAttributes.Length + 1) = 0;
  *(&ObjectAttributes.Attributes + 1) = 0;
  *(_QWORD *)ResolveContext = DeviceNode;
  *((_QWORD *)ResolveContext + 2) = 0i64;
  ObjectAttributes.ObjectName = (_UNICODE_STRING *)&v17;
  LODWORD(v17) = 1310738;
  ObjectAttributes.Length = 48;
  ObjectAttributes.Attributes = 576;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  v6 = ZwOpenKey(
         (VOID **)ResolveContext + 2,
         0x20019ui64,
         &ObjectAttributes,
         v3,
         v17,
         (INT64)L"Variables",
         *(INT64 *)&ObjectAttributes.Length,
         (INT64)ConfigurationKeyHandle);
  v8 = v6;
  if( v6 != -1073741772 )
  {
    if( v6 < 0 )
      goto LABEL_4;
    PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x7F0ui64, 1667526736i64);
    *((_QWORD *)ResolveContext + 3) = PoolWithTag;
    if( !PoolWithTag )
    {
      v8 = -1073741670;
      goto LABEL_4;
    }
    v12 = 0i64;
    v13 = 127i64;
    do
    {
      v14 = (_QWORD *)(v12 + *((_QWORD *)ResolveContext + 3));
      v12 += 16i64;
      v14[1] = v14;
      *v14 = v14;
      --v13;
    }
    while( v13 );
  }
  memset(&ObjectAttributes.Attributes + 1, 0, 20);
  LODWORD(v17) = 3014700;
  ObjectAttributes.ObjectName = (_UNICODE_STRING *)&v17;
  ObjectAttributes.Attributes = 576;
  v9 = ZwOpenKey(
         &KeyHandle,
         0x20019ui64,
         &ObjectAttributes,
         v7,
         v17,
         (INT64)L"Setup\\ResolveFilePaths",
         48i64,
         (INT64)ConfigurationKeyHandle);
  v8 = v9;
  if( v9 == -1073741772 || v9 == -1073741444 )
    goto LABEL_3;
  if( v9 < 0 )
    goto LABEL_4;
  v8 = PiDrvDbResolveKeyFilePaths((_HANDLE)ConfigurationKeyHandle);
  if( v8 < 0 )
  {
LABEL_3:
    v8 = 0;
    goto LABEL_4;
  }
  if( *(&stru_140CF2E80 + 607) && (v15 = *(_QWORD *)(*(&stru_140CF2E80 + 607) + 224i64)) != 0 )
    v16 = *(VOID **)(v15 + 8);
  else
    v16 = 0i64;
  RegRtlDeleteTreeInternal(KeyHandle, 0i64, v16, 0);
LABEL_4:
  if( KeyHandle )
    ZwClose((_HANDLE)KeyHandle);
  if( v8 < 0 )
    PiDevCfgFreeResolveContext(ResolveContext);
  return v8;
}

Referenced by:

PiDevCfgConfigureDeviceKeys
PiDevCfgVerifyDeviceAllowed