PiCMGetRegistryProperty

NTSTATUS __stdcall PiCMGetRegistryProperty(
        PVOID IoctlInputBuffer,
        UINT64 IoctlInputBufferSize,
        PVOID IoctlOutputBuffer,
        UINT64 IoctlOutputBufferSize,
        UINT64 *BytesUsed){
  UINT64 *v5; 
  unsigned int v6; 
  UINT8 *PoolWithTag; 
  NTSTATUS v9; 
  NTSTATUS DeviceRegProp; 
  NTSTATUS v11; 
  UINT64 BufferSize; 
  UINT64 ExpectedOutputSize; 
  UINT64 IoctlOutputBufferSizea; 
  UINT64 Type; 
  INT64 v17[2]; 
  __int128 v18; 
  __int128 v19; 
  UINT64 v20; 
  UINT64 RequiredSize; 
  v5 = (UINT64 *)RequiredSize;
  Type = 0i64;
  v6 = IoctlOutputBufferSize;
  LODWORD(RequiredSize) = 0;
  *(_DWORD *)v5 = 0;
  PoolWithTag = 0i64;
  *(_OWORD *)v17 = 0i64;
  v20 = 0i64;
  v18 = 0i64;
  v19 = 0i64;
  v9 = PiCMCaptureRegistryPropertyInputData(
         (unsigned __int64)IoctlInputBuffer,
         IoctlInputBufferSize,
         (int)BytesUsed,
         (__int64)v17);
  if( v9 < 0 )
    goto LABEL_21;
  if( (_QWORD)v18 && !HIDWORD(v17[0]) && !*((_QWORD *)&v19 + 1) && !(_DWORD)v20 && !(_DWORD)v19 )
  {
    if( !IoctlOutputBuffer || v6 < 0x14 )
    {
      v9 = -1073741811;
      goto LABEL_22;
    }
    if( v6 != 20 )
    {
      PoolWithTag = (UINT8 *)ExAllocatePoolWithTag(PagedPool, v6 - 20, 0x34706E50ui64);
      if( !PoolWithTag )
        v9 = -1073741670;
    }
    if( v9 < 0 )
      goto LABEL_22;
    v9 = PiCMConvertRegistryProperty(SHIDWORD(v18), (_DWORD *)&Type + 1);
    if( v9 < 0 )
      goto LABEL_22;
    LODWORD(RequiredSize) = v6 - 20;
    if( LODWORD(v17[1]) == 1 )
    {
      DeviceRegProp = CmGetDeviceRegProp(
                        PiPnpRtlCtx,
                        (const wchar_t *)v18,
                        0i64,
                        SHIDWORD(Type),
                        (__int64)&Type,
                        (__int64)PoolWithTag,
                        (__int64)&RequiredSize,
                        0);
LABEL_16:
      v9 = DeviceRegProp;
      goto LABEL_17;
    }
    if( LODWORD(v17[1]) == 2 )
    {
      DeviceRegProp = CmGetInstallerClassRegProp(
                        PiPnpRtlCtx,
                        v18,
                        0i64,
                        SHIDWORD(Type),
                        (__int64)&Type,
                        (__int64)PoolWithTag,
                        (__int64)&RequiredSize);
      goto LABEL_16;
    }
  }
  v9 = -1073741811;
LABEL_17:
  if( v9 >= 0 )
  {
    LODWORD(IoctlOutputBufferSizea) = v6;
    LODWORD(ExpectedOutputSize) = HIDWORD(v20);
    LODWORD(BufferSize) = RequiredSize;
    v11 = PiCMReturnBufferResultData(
            (unsigned int)v9,
            (unsigned int)RequiredSize,
            (unsigned int)Type,
            PoolWithTag,
            BufferSize,
            ExpectedOutputSize,
            IoctlOutputBuffer,
            IoctlOutputBufferSizea,
            v5);
    goto LABEL_19;
  }
LABEL_22:
  LODWORD(IoctlOutputBufferSizea) = v6;
  LODWORD(ExpectedOutputSize) = HIDWORD(v20);
  LODWORD(BufferSize) = 0;
  v11 = PiCMReturnBufferResultData(
          (unsigned int)v9,
          (unsigned int)RequiredSize,
          (unsigned int)Type,
          0i64,
          BufferSize,
          ExpectedOutputSize,
          IoctlOutputBuffer,
          IoctlOutputBufferSizea,
          v5);
LABEL_19:
  v9 = v11;
  if( PoolWithTag )
    ExFreePoolWithTag(PoolWithTag, 0x34706E50u);
LABEL_21:
  PiCMReleaseRegistryPropertyInputData((INT64)v17);
  return v9;
}

Referenced by:

No references.