WmipGetSysIds

INT64 __stdcall WmipGetSysIds(
        SYSID_UUID **SysIdUuid,
        UINT64 *SysIdUuidCount,
        SYSID_1394 **SysId1394,
        UINT64 *SysId1394Count){
  SYSID_UUID **v7; 
  int SMBiosStructure; 
  __int64 v9; 
  unsigned int v10; 
  SYSID_UUID *v11; 
  SYSID_UUID *v12; 
  INT64 result; 
  SYSID_1394 *v14; 
  char *v15; 
  _OWORD *PoolWithTag; 
  UINT64 SysIdUuidCounta; 
  int v18; 
  char SysIdBiosRevision[4]; 
  UINT64 NumberEntries; 
  LARGE_INTEGER SysidTablePhysicalAddress; 
  VOID *StructPtr; 
  PVOID BaseAddress; 
  v7 = SysIdUuid;
  SysidTablePhysicalAddress.QuadPart = 0i64;
  LODWORD(NumberEntries) = 0;
  KeWaitForSingleObject(&WmipSMMutex, Executive, 0, 0, 0i64);
  if( !WmipSysIdRead )
  {
    if( (int)WmipFindSysIdTable(&SysidTablePhysicalAddress, (UINT8 *)SysIdBiosRevision, &NumberEntries) < 0 )
    {
      BaseAddress = 0i64;
      StructPtr = 0i64;
      HIDWORD(NumberEntries) = 0;
      SMBiosStructure = WmipFindSMBiosStructure(1u, &StructPtr, &BaseAddress, (UINT64 *)((char *)&NumberEntries + 4));
      v18 = SMBiosStructure;
      if( SMBiosStructure >= 0 )
      {
        WmipSysId1394 = 0i64;
        WmipSysId1394Count = 0;
        v15 = (char *)StructPtr;
        if( *((_BYTE *)StructPtr + 1) <= 8u )
        {
          WmipSysIdUuid = 0i64;
          WmipSysIdUuidCount = 0;
        }
        else
        {
          PoolWithTag = ExAllocatePoolWithTag(PagedPool, 0x10ui64, 0x73696D57ui64);
          if( PoolWithTag )
          {
            *PoolWithTag = *(_OWORD *)(v15 + 8);
            WmipSysIdUuidCount = 1;
            WmipSysIdUuid = (__int64)PoolWithTag;
            v18 = 0;
          }
          else
          {
            ExFreePoolWithTag(0i64, 0);
            v18 = -1073741823;
          }
        }
        if( BaseAddress )
          MmUnmapIoSpace(BaseAddress, HIDWORD(NumberEntries));
        ExReleaseResourceLite(&WmipSMBiosLock);
        KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
        SMBiosStructure = v18;
      }
    }
    else
    {
      SysIdUuidCounta = 0i64;
      SMBiosStructure = WmipParseSysIdTable(
                          SysidTablePhysicalAddress,
                          (unsigned int)NumberEntries,
                          0i64,
                          &SysIdUuidCounta,
                          0i64,
                          (UINT64 *)((char *)&SysIdUuidCounta + 4));
      if( SMBiosStructure >= 0 )
      {
        v9 = (unsigned int)(16 * SysIdUuidCounta);
        v10 = v9 + 8 * HIDWORD(SysIdUuidCounta);
        if( v10 )
        {
          v11 = (SYSID_UUID *)ExAllocatePoolWithTag(PagedPool, v10, 0x73696D57ui64);
          v12 = v11;
          if( !v11 )
          {
            KeReleaseMutex(&WmipSMMutex, 0);
            return 3221225626i64;
          }
          v14 = (SYSID_1394 *)&v11->Uuid[v9];
          SMBiosStructure = WmipParseSysIdTable(
                              SysidTablePhysicalAddress,
                              (unsigned int)NumberEntries,
                              v11,
                              &SysIdUuidCounta,
                              v14,
                              (UINT64 *)((char *)&SysIdUuidCounta + 4));
          if( SMBiosStructure < 0 )
          {
            ExFreePoolWithTag(v12, 0);
          }
          else
          {
            WmipSysIdUuid = (__int64)v12;
            WmipSysIdUuidCount = SysIdUuidCounta;
            WmipSysId1394 = (__int64)v14;
            WmipSysId1394Count = HIDWORD(SysIdUuidCounta);
          }
        }
      }
    }
    WmipSysIdRead = SMBiosStructure != -1073741670;
    WmipSysIdStatus = SMBiosStructure;
    v7 = SysIdUuid;
  }
  KeReleaseMutex(&WmipSMMutex, 0);
  result = (unsigned int)WmipSysIdStatus;
  if( WmipSysIdStatus >= 0 )
  {
    *v7 = (SYSID_UUID *)WmipSysIdUuid;
    *(_DWORD *)SysIdUuidCount = WmipSysIdUuidCount;
    *SysId1394 = (SYSID_1394 *)WmipSysId1394;
    *(_DWORD *)SysId1394Count = WmipSysId1394Count;
  }
  return result;
}

Referenced by:

WmipQueryWmiDataBlock