WheapCreateRecordFromGenericErrorData
NTSTATUS __stdcall WheapCreateRecordFromGenericErrorData(
WHEA_ERROR_SOURCE_DESCRIPTOR *Source,
_WHEA_ERROR_PACKET_V2 *Packet,
WHEA_ERROR_RECORD *Record,
UINT64 a4){
unsigned int v6;
unsigned int v7;
unsigned int DataLength;
_DWORD *v9;
CHAR *v10;
unsigned int v11;
unsigned int v12;
int v13;
INT64 v14;
_WHEA_ERROR_RECORD_HEADER_FLAGS v15;
char v16;
int v17;
WHEA_GENERIC_ERROR_DATA_ENTRY_V2 *v18;
ULONG ErrorDataLength;
unsigned int v20;
int v21;
bool v22;
unsigned int v23;
NTSTATUS v24;
__int64 v25;
int v26;
WHEA_GENERIC_ERROR_DATA_ENTRY_V2 *v27;
struct EX_RUNDOWN_REF **v28;
CHAR *v29;
UINT64 ErrorEntryLength;
INT64 Structured;
int Src[8];
char pszDest[32];
int v37;
NTSTATUS v38;
v6 = a4;
memset((INT64)Src, 0i64);
v7 = 20;
DataLength = Packet->DataLength;
v9 = (unsigned int *)((char *)&Packet->Signature + Packet->DataOffset);
if( DataLength >= 0x14 )
{
v11 = v9[3] + 20;
if( v11 < 0x14 )
{
v10 = (CHAR *)"Overflow_Finding_Structured_Len";
goto LABEL_47;
}
v12 = v9[1];
if( v12 && (v13 = v9[2]) != 0 )
{
if( v11 > v12 )
{
v10 = "Unstructered_Data_Too_Soon";
goto LABEL_47;
}
if( v13 + v12 < v12 )
{
v10 = "Overflow_Unstructured_End";
goto LABEL_47;
}
if( v13 + v12 > DataLength )
{
v10 = "Unstructured_Overruns_Buffer";
goto LABEL_47;
}
}
else if( v11 > DataLength )
{
v10 = "Error_Overruns_Buffer";
goto LABEL_47;
}
if( v6 < 0x80 )
{
v10 = "Header_Overruns_Buffer";
goto LABEL_47;
}
memset((INT64)Record, 0i64);
WheaInitializeRecordHeader(&Record->Header);
Record->Header.Severity = Packet->ErrorSeverity;
Record->Header.NotifyType = Packet->NotifyType;
Record->Header.Flags.AsULONG ^= (Record->Header.Flags.AsULONG ^ (2 * Packet->Flags.AsULONG)) & 2;
v15.0 = ($9E46E3073B5FFFFC8430EEE7126B55BF)Record->Header.Flags;
v16 = *(_BYTE *)&v15.0 ^ (Packet->Flags.AsULONG >> 1);
Record->Header.Length = v6;
Record->Header.Flags.AsULONG = v15.AsULONG ^ v16 & 4;
v17 = (*v9 >> 4) & 0x3FF;
if( v17 )
{
while( v7 + 64 >= v7 )
{
if( v7 + 64 > v11 )
{
v10 = "Entry_Header_Overruns_Structure";
goto LABEL_47;
}
v18 = (WHEA_GENERIC_ERROR_DATA_ENTRY_V2 *)((char *)v9 + v7);
ErrorDataLength = v18->ErrorDataLength;
if( v18->Revision.AsUSHORT == 768 )
{
v20 = ErrorDataLength + 72;
v21 = -1;
v22 = v20 < 0x48;
}
else
{
v20 = ErrorDataLength + 64;
v21 = -1;
v22 = v20 < 0x40;
}
if( !v22 )
v21 = v20;
if( v22 )
{
v10 = "Overflow_Entry_Length";
goto LABEL_47;
}
v23 = v7 + v21;
if( v7 + v21 < v7 )
{
v10 = "Overflow_Next_Entry_Offset";
goto LABEL_47;
}
v7 += v21;
if( v23 > v11 )
{
v10 = "Next_Entry_Overruns_Structure";
goto LABEL_47;
}
LODWORD(ErrorEntryLength) = v21;
v24 = WheapAddSectionFromGenericErrorData(Source, Record, v6, v18, ErrorEntryLength, 1u);
if( v24 < 0 )
{
v29 = (CHAR *)"Failed_Add_Section";
goto LABEL_34;
}
++v37;
if( !--v17 )
goto LABEL_29;
}
v10 = "Overflow_Entry_Header_Offset";
goto LABEL_47;
}
LABEL_29:
v25 = (unsigned int)v9[1];
if( (_DWORD)v25 && (v26 = v9[2]) != 0 )
{
v27 = (WHEA_GENERIC_ERROR_DATA_ENTRY_V2 *)((char *)v9 + v25);
v28 = (struct EX_RUNDOWN_REF **)Source;
LODWORD(ErrorEntryLength) = v26;
v24 = WheapAddSectionFromGenericErrorData(Source, Record, v6, v27, ErrorEntryLength, 0);
if( v24 < 0 )
{
v29 = "Failed_Add_Unstructured";
LABEL_34:
RtlStringCchCopyA(pszDest, 0x20ui64, v29);
LABEL_44:
if( v24 >= 0 )
return v24;
goto LABEL_48;
}
}
else
{
v28 = (struct EX_RUNDOWN_REF **)Source;
}
if( Packet->ErrorSeverity == WheaErrSevRecoverable )
WheapAddRecoveryPacketToErrorRecord(v28, (INT64 *)Record, v6, v14, ErrorEntryLength, Structured);
v24 = 0;
goto LABEL_44;
}
v10 = "Error_Packet_Lenth_Too_Small";
LABEL_47:
v24 = -1073741811;
RtlStringCchCopyA(pszDest, 0x20ui64, v10);
LABEL_48:
if( !*((_BYTE *)Source + 64) )
{
Src[3] = 0;
Src[0] = 1733060695;
Src[1] = 1;
Src[2] = 72;
Src[5] = -2147483627;
Src[4] = 1280201291;
Src[6] = 2;
Src[7] = 40;
v38 = v24;
WheaLogInternalEvent(Src);
}
return v24;
}Referenced by:
WheapDefaultErrSrcCreateRecord
WheapDeviceDriverCreateRecord