WheaPersistBadPageToBcd
NTSTATUS __stdcall WheaPersistBadPageToBcd(INT64 Page){
_QWORD *v1;
NTSTATUS Object;
PVOID v4;
NTSTATUS ElementData;
unsigned int v6;
NTSTATUS v7;
_QWORD *PoolWithTag;
UINT64 v9;
int v11[4];
UINT64 v12;
VOID *a3;
PVOID ObjectHandle;
a3 = 0i64;
v1 = 0i64;
ObjectHandle = 0i64;
Object = BcdOpenStore(Page, 0, &a3);
if( Object < 0 )
goto LABEL_20;
if( (int)BcdOpenObject(a3, &GUID_BAD_MEMORY_GROUP, &ObjectHandle) < 0 )
{
v11[0] = 1;
v11[1] = 537919488;
Object = BcdCreateObject((__int64)a3, (__int64)&GUID_BAD_MEMORY_GROUP, v11, (__int64 *)&ObjectHandle);
if( Object < 0 )
{
v4 = ObjectHandle;
goto LABEL_18;
}
}
v4 = ObjectHandle;
LODWORD(v12) = 0;
ElementData = BcdGetElementData(ObjectHandle, 0x1700000Aui64, 0i64, &v12);
v6 = v12;
if( ElementData != -1073741789 )
v6 = 0;
v7 = ElementData;
LODWORD(v12) = v6;
PoolWithTag = ExAllocatePoolWithTag(PagedPool, v6 + 8i64, 0x61656857ui64);
v1 = PoolWithTag;
if( !PoolWithTag )
{
Object = -1073741670;
goto LABEL_18;
}
if( v7 != -1073741789 )
{
LABEL_12:
v9 = v6 >> 3;
if( WheapIsPageInList(v1, v9, Page) )
{
Object = 0;
}
else
{
v1[v9] = Page;
WheapSortBadPages((__int64)v1, v9 + 1);
if( (unsigned int)WheapCountBadPageExtents(v1, (int)v9 + 1) <= 0x40 )
{
Object = BcdSetElementData(v4, 0x1700000Aui64, v1, v6 + 8);
if( Object >= 0 )
Object = 0;
}
else
{
Object = -1073741823;
}
}
goto LABEL_18;
}
Object = BcdGetElementData(v4, 0x1700000Aui64, PoolWithTag, &v12);
if( Object >= 0 )
{
v6 = v12;
goto LABEL_12;
}
LABEL_18:
if( v4 )
BcdCloseObject(v4);
LABEL_20:
if( a3 )
BcdCloseStore(a3);
if( v1 )
ExFreeHeapPool(v1);
return Object;
}Referenced by:
EmpRemoveBadS3PageWorker
WheapAttemptPhysicalPageOffline
WheapCheckForAndReportErrorsFromPreviousSession