PiDevCfgResolveVariableDeviceProperty

NTSTATUS __stdcall PiDevCfgResolveVariableDeviceProperty(
        _PI_DEVCFG_RESOLVE_CONTEXT *ResolveContext,
        VOID *VariableKeyHandle,
        _PI_DEVCFG_VARIABLE_ENTRY *VariableEntryResult){
  int RegistryValue; 
  _KEY_VALUE_FULL_INFORMATION *v7; 
  unsigned int DataLength; 
  _WORD *v9; 
  wchar_t *v10; 
  __int64 v11; 
  int ObjectProperty; 
  size_t v13; 
  _PI_DEVCFG_VARIABLE_ENTRY v14; 
  _DWORD *PoolWithTag; 
  __int64 v17; 
  VOID **v18; 
  __int64 v19; 
  PVOID P; 
  _KEY_VALUE_FULL_INFORMATION *Information; 
  INT64 v22; 
  _UNICODE_STRING UnicodeString; 
  _UNICODE_STRING GuidString; 
  _GUID Guid; 
  int v26; 

  Information = 0i64;
  *(_DWORD *)(&GuidString.MaximumLength + 1) = 0;
  LODWORD(v22) = 0;
  LODWORD(v19) = 0;
  P = 0i64;
  v26 = 0;
  *(_QWORD *)&UnicodeString.Length = 0i64;
  UnicodeString.Buffer = 0i64;
  Guid = 0i64;
  RegistryValue = IopGetRegistryValue(VariableKeyHandle, (PWCHAR)L"PropertyGuid", 0i64, &Information);
  if( RegistryValue < 0 )
    goto LABEL_57;
  v7 = Information;
  if( !PnpValidateRegistryString(Information) )
    goto LABEL_20;
  DataLength = v7->DataLength;
  v9 = (_WORD *)((char *)v7 + v7->DataOffset);
  LODWORD(Information) = 0;
  PnpRegSzToString(v9, DataLength, (int *)&Information);
  GuidString.MaximumLength = v7->DataLength;
  v10 = (wchar_t *)((char *)v7 + v7->DataOffset);
  GuidString.Length = (unsigned __int16)Information;
  GuidString.Buffer = v10;
  RegistryValue = RtlGUIDFromString(&GuidString, &Guid);
  if( RegistryValue < 0 )
    goto LABEL_15;
  ExFreePoolWithTag(v7, 0);
  Information = 0i64;
  RegistryValue = IopGetRegistryValue(VariableKeyHandle, (PWCHAR)L"PropertyId", 0i64, &Information);
  if( RegistryValue < 0 )
  {
LABEL_57:
    v7 = Information;
  }
  else
  {
    v7 = Information;
    if( !PnpValidateRegistryDword((__int64)Information) )
      goto LABEL_20;
    v11 = *(_QWORD *)ResolveContext;
    v26 = *(ULONG *)((char *)&v7->TitleIndex + v7->DataOffset);
    ObjectProperty = PnpGetObjectProperty(
                       0x47706E50u,
                       0i64,
                       *(_QWORD *)(v11 + 48),
                       1u,
                       0i64,
                       0i64,
                       (INT64)&Guid,
                       (INT64)&v22,
                       (__int64)&P,
                       (__int64)&v19);
    RegistryValue = ObjectProperty;
    if( ObjectProperty < 0 )
    {
      if( ObjectProperty == -1073741275 )
      {
        RegistryValue = 0;
        goto LABEL_56;
      }
    }
    else
    {
      if( (unsigned int)v22 > 0x2012 )
        goto LABEL_46;
      if( (_DWORD)v22 == 8210 )
      {
        v13 = v19;
        if( PnpValidateMultiSzData(P, v19) )
        {
          v14 = 7;
          goto LABEL_13;
        }
        goto LABEL_20;
      }
      if( (unsigned int)v22 > 0xD )
      {
        if( (_DWORD)v22 == 18 )
          goto LABEL_11;
        if( (_DWORD)v22 != 17 )
        {
          if( (_DWORD)v22 == 20 )
            goto LABEL_11;
          if( (unsigned int)v22 > 0x15 )
          {
            if( (unsigned int)v22 > 0x18 )
            {
              if( (_DWORD)v22 != 25 )
                goto LABEL_46;
LABEL_11:
              v13 = v19;
              if( PnpValidateStringData((__int64)P, v19) )
              {
                v14 = 1;
LABEL_13:
                PoolWithTag = P;
                P = 0i64;
LABEL_14:
                VariableEntryResult[8] = v14;
                VariableEntryResult[9] = v13;
                *((_QWORD *)VariableEntryResult + 5) = PoolWithTag;
                goto LABEL_15;
              }
              goto LABEL_20;
            }
            goto LABEL_47;
          }
          goto LABEL_46;
        }
        if( (_DWORD)v19 == 1 )
        {
          v14 = 4;
          v13 = 4;
          PoolWithTag = ExAllocatePoolWithTag(1ui64, 4ui64, 1667526736i64);
          if( PoolWithTag )
          {
            v17 = *(_BYTE *)P == 0xFF;
            goto LABEL_29;
          }
          goto LABEL_28;
        }
LABEL_20:
        RegistryValue = -1073741823;
        goto LABEL_15;
      }
      if( (_DWORD)v22 != 13 )
      {
        if( (unsigned int)v22 > 5 )
        {
          if( (unsigned int)v22 <= 7 )
          {
LABEL_47:
            if( (_DWORD)v19 == 4 )
            {
              v14 = 4;
              v13 = 4;
              goto LABEL_13;
            }
            goto LABEL_20;
          }
          if( (unsigned int)v22 <= 9 )
          {
            v13 = 8;
            if( (_DWORD)v19 == 8 )
            {
              v14 = 11;
              goto LABEL_13;
            }
            goto LABEL_20;
          }
LABEL_46:
          v13 = v19;
          v14 = 3;
          goto LABEL_13;
        }
        if( (unsigned int)v22 >= 4 )
        {
          if( (_DWORD)v19 != 2 )
            goto LABEL_20;
          v14 = 4;
          v13 = 4;
          PoolWithTag = ExAllocatePoolWithTag(1ui64, 4ui64, 1667526736i64);
          if( PoolWithTag )
          {
            LODWORD(v17) = *(unsigned __int16 *)P;
            goto LABEL_29;
          }
LABEL_28:
          RegistryValue = -1073741670;
          goto LABEL_15;
        }
        if( (unsigned int)v22 > 1 )
        {
          if( (_DWORD)v19 != 1 )
            goto LABEL_20;
          v14 = 4;
          v13 = 4;
          PoolWithTag = ExAllocatePoolWithTag(1ui64, 4ui64, 1667526736i64);
          if( PoolWithTag )
          {
            LODWORD(v17) = *(unsigned __int8 *)P;
LABEL_29:
            *PoolWithTag = v17;
            goto LABEL_14;
          }
          goto LABEL_28;
        }
LABEL_56:
        PoolWithTag = 0i64;
        v13 = 0;
        v14 = 0;
        goto LABEL_14;
      }
      if( (_DWORD)v19 != 16 )
        goto LABEL_20;
      RegistryValue = RtlStringFromGUIDEx((_GUID *)P, &UnicodeString, 1u);
      if( RegistryValue >= 0 )
      {
        v13 = UnicodeString.Length + 2;
        v14 = 1;
        v18 = ExAllocatePoolWithTag(1ui64, v13, 1667526736i64);
        PoolWithTag = v18;
        if( v18 )
        {
          memmove(v18, UnicodeString.Buffer, v13);
          goto LABEL_14;
        }
        goto LABEL_28;
      }
    }
  }
LABEL_15:
  RtlFreeAnsiString(&UnicodeString);
  if( P )
    ExFreePoolWithTag(P, 0);
  if( v7 )
    ExFreePoolWithTag(v7, 0);
  return RegistryValue;
}

Referenced by:

No references.