WheaGetErrPacketFromErrRecord

_WHEA_ERROR_PACKET_V2 *__stdcall WheaGetErrPacketFromErrRecord(_WHEA_ERROR_RECORD *Record){
  _WHEA_ERROR_PACKET_V2 *v1; 
  int SectionCount; 
  _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR *SectionDescriptor; 
  int v5; 
  __int64 SectionOffset; 
  _WHEA_ERROR_PACKET_V2 *v7; 

  v1 = 0i64;
  if( Record->Header.Signature == 1380274243 )
  {
    SectionCount = Record->Header.SectionCount;
    if( Record->Header.Length >= 72 * SectionCount + 128 )
    {
      SectionDescriptor = Record->SectionDescriptor;
      v5 = 0;
      if( SectionCount )
      {
        while( RtlCompareMemory(&SectionDescriptor->SectionType, &WHEA_ERROR_PACKET_SECTION_GUID, 16) != (_SIZE_T *)16 )
        {
          ++SectionDescriptor;
          if( ++v5 >= (unsigned int)Record->Header.SectionCount )
            return v1;
        }
        SectionOffset = SectionDescriptor->SectionOffset;
        if( Record->Header.Length >= (unsigned int)(SectionOffset + SectionDescriptor->SectionLength) )
        {
          v7 = (_WHEA_ERROR_PACKET_V2 *)((char *)Record + SectionOffset);
          if( *(unsigned int *)((char *)&Record->Header.Signature + SectionOffset) != 1095059543 )
            return 0i64;
          return v7;
        }
      }
    }
  }
  return v1;
}

Referenced by:

WheapAttemptArchitecturalErrorRecovery