PiDevCfgResolveVariableKeyValue

NTSTATUS __stdcall PiDevCfgResolveVariableKeyValue(
        _PI_DEVCFG_RESOLVE_CONTEXT *ResolveContext,
        VOID *VariableKeyHandle,
        _PI_DEVCFG_VARIABLE_ENTRY *VariableEntryResult){
  _PI_DEVCFG_VARIABLE_ENTRY *v3; 
  int v6; 
  NTSTATUS RegistryValue; 
  _KEY_VALUE_FULL_INFORMATION *v8; 
  wchar_t *v9; 
  NTSTATUS v10; 
  ULONG DataOffset; 
  NTSTATUS v12; 
  NTSTATUS v13; 
  _DWORD *v14; 
  size_t v15; 
  _PI_DEVCFG_VARIABLE_ENTRY v16; 
  VOID **PoolWithTag; 
  VOID **v18; 
  VOID *KeyHandleResult; 
  _KEY_VALUE_FULL_INFORMATION *Information; 
  PVOID P; 

  Information = 0i64;
  v3 = VariableEntryResult;
  P = 0i64;
  KeyHandleResult = 0i64;
  v6 = PiDevCfgResolveVariableKeyHandle(ResolveContext, VariableKeyHandle, &KeyHandleResult);
  if( v6 < 0 )
    goto LABEL_31;
  RegistryValue = IopGetRegistryValue(VariableKeyHandle, (PWCHAR)L"ValueName", 0i64, &Information);
  v8 = Information;
  v6 = RegistryValue;
  if( RegistryValue >= 0 )
  {
    if( !PnpValidateRegistryString(Information) )
    {
      v6 = -1073741823;
      goto LABEL_29;
    }
    v9 = (wchar_t *)((char *)v8 + v8->DataOffset);
    if( *v9 != 36 )
    {
LABEL_12:
      v12 = IopGetRegistryValue(KeyHandleResult, v9, 0i64, (_KEY_VALUE_FULL_INFORMATION **)&P);
      v6 = v12;
      if( v12 < 0 )
      {
        if( v12 != -1073741772 )
          goto LABEL_17;
        v13 = IopGetRegistryValue(VariableKeyHandle, (PWCHAR)L"DefaultValue", 0i64, (_KEY_VALUE_FULL_INFORMATION **)&P);
        v6 = v13;
        if( v13 < 0 )
        {
          if( v13 == -1073741772 )
          {
            v6 = 0;
            v14 = 0i64;
            goto LABEL_19;
          }
LABEL_17:
          v14 = P;
          goto LABEL_27;
        }
      }
      v14 = P;
LABEL_19:
      if( v14 )
      {
        if( !PnpValidateRegistryValue(v14) )
        {
          v6 = -1073741823;
          goto LABEL_27;
        }
        v15 = v14[3];
        v16 = v14[1];
        PoolWithTag = ExAllocatePoolWithTag(1ui64, v15, 1667526736i64);
        v18 = PoolWithTag;
        if( !PoolWithTag )
        {
          v6 = -1073741670;
          goto LABEL_27;
        }
        memmove(PoolWithTag, (char *)v14 + (unsigned int)v14[2], v15);
        v3 = VariableEntryResult;
      }
      else
      {
        v16 = 0;
        v15 = 0;
        v18 = 0i64;
      }
      v3[8] = v16;
      v3[9] = v15;
      *((_QWORD *)v3 + 5) = v18;
LABEL_27:
      if( v14 )
        ExFreePoolWithTag(v14, 0);
      goto LABEL_29;
    }
    Information = 0i64;
    v10 = PiDevCfgResolveVariable(ResolveContext, v9 + 1, (_PI_DEVCFG_VARIABLE_ENTRY **)&Information);
    v6 = v10;
    if( v10 >= 0 )
    {
      DataOffset = Information[1].DataOffset;
      if( DataOffset && (DataOffset <= 2 || DataOffset == 7) )
        v9 = *(wchar_t **)&Information[1].NameLength;
      goto LABEL_12;
    }
    if( v10 == -1073741772 )
      goto LABEL_12;
  }
LABEL_29:
  if( v8 )
    ExFreePoolWithTag(v8, 0);
LABEL_31:
  if( KeyHandleResult )
    ZwClose((_HANDLE)KeyHandleResult);
  return v6;
}

Referenced by:

No references.