WmipFindSMBiosStructure

NTSTATUS __stdcall WmipFindSMBiosStructure(UINT8 Type, VOID **StructPtr, VOID **MapPtr, UINT64 *MapSize){
  _ETHREAD *CurrentThread; 
  int v9; 
  VOID *v10; 
  unsigned __int8 *v11; 
  unsigned __int8 *v12; 
  unsigned __int8 *i; 
  NTSTATUS v15; 

  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --CurrentThread->Tcb.KernelApcDisable;
  ExAcquireResourceSharedLite((UINT64)&ExBootDevicesRemovedEvent + 3328, 1);
  v9 = 0;
  v15 = 0;
  if( WmipSMBiosTablePhysicalAddress.QuadPart )
  {
    v10 = MmMapIoSpaceEx(WmipSMBiosTablePhysicalAddress, (unsigned int)WmipSMBiosTableLength, 4ui64);
    *MapPtr = v10;
    if( v10 )
    {
      *(_DWORD *)MapSize = WmipSMBiosTableLength;
      v11 = (unsigned __int8 *)*MapPtr;
      goto LABEL_7;
    }
    v9 = -1073741670;
  }
  else
  {
    v9 = -1073741823;
  }
  v11 = 0i64;
  v15 = v9;
LABEL_7:
  if( v9 < 0 )
  {
LABEL_20:
    ExReleaseResourceLite((PERESOURCE)&ExBootDevicesRemovedEvent + 32);
    KeLeaveCriticalRegionThread(KeGetCurrentThread());
    return v15;
  }
  *StructPtr = 0i64;
  v12 = &v11[(unsigned int)WmipSMBiosTableLength];
  v15 = -1073741823;
  while( v11 < v12 )
  {
    if( *v11 == Type )
    {
      *StructPtr = v11;
      v15 = 0;
      break;
    }
    for( i = &v11[v11[1]]; *(_WORD *)i && i < v12; ++i )
      ;
    v11 = i + 2;
  }
  if( v15 < 0 )
  {
    if( *MapPtr )
      MmUnmapIoSpace(*MapPtr, *(unsigned int *)MapSize);
    goto LABEL_20;
  }
  return v15;
}

Referenced by:

WmipGetSMBiosEventlog
WmipGetSysIds