WheapCompressErrorRecord

VOID __stdcall WheapCompressErrorRecord(UINT64 Flags, _WHEA_ERROR_RECORD *Record){
  unsigned __int16 SectionCount; 
  char v4; 
  _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR *SectionDescriptor; 
  __int16 v6; 
  unsigned int i; 
  __int64 v8; 
  _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR *v9; 
  int v10; 
  unsigned int SectionOffset; 
  unsigned int v12; 
  __int64 v13; 

  SectionCount = Record->Header.SectionCount;
  v4 = Flags;
  if( (Flags & 2) != 0 )
  {
    SectionDescriptor = Record->SectionDescriptor;
    v6 = 0;
    for( i = 0; i < SectionCount; ++i )
    {
      v8 = *(_QWORD *)&SectionDescriptor->SectionType.Data1 - *(_QWORD *)&WHEA_ERROR_PACKET_SECTION_GUID.Data1;
      if( !v8 )
        v8 = *(_QWORD *)SectionDescriptor->SectionType.Data4 - *(_QWORD *)WHEA_ERROR_PACKET_SECTION_GUID.Data4;
      if( v8 )
      {
        ++SectionDescriptor;
      }
      else
      {
        if( SectionCount - i != 1 )
        {
          memmove(SectionDescriptor, &SectionDescriptor[1], 72 * (SectionCount - i - 1));
          SectionCount = Record->Header.SectionCount;
        }
        ++v6;
      }
    }
    SectionCount -= v6;
    Record->Header.SectionCount = SectionCount;
  }
  v9 = Record->SectionDescriptor;
  v10 = v4 & 1;
  if( v10 )
    SectionOffset = 72 * SectionCount + 128;
  else
    SectionOffset = v9->SectionOffset;
  v12 = 0;
  if( SectionCount )
  {
    do
    {
      v13 = v9->SectionOffset;
      if( SectionOffset < (unsigned int)v13 )
      {
        memmove((char *)Record + SectionOffset, (char *)Record + v13, v9->SectionLength);
        v9->SectionOffset = SectionOffset;
      }
      SectionOffset += v9->SectionLength;
      ++v12;
      ++v9;
    }
    while( v12 < Record->Header.SectionCount );
  }
  memset((char *)Record + SectionOffset, 0i64, Record->Header.Length - SectionOffset);
  if( v10 )
    Record->Header.Length = SectionOffset;
}

Referenced by:

WheaReportHwError
WheapReportBootError