BiLoadSystemStore
INT64 __fastcall BiLoadSystemStore(VOID **StoreHandle){
DOUBLE v1;
UINT8 *v3;
int SystemStorePath;
UINT8 *v5;
int v6;
__int64 v7;
unsigned int v8;
UINT8 *PoolWithTag;
void *v10;
WCHAR v12;
struct _UNICODE_STRING DestinationString;
void *Src;
void *a3;
a3 = 0i64;
Src = 0i64;
DestinationString = 0i64;
v3 = 0i64;
SystemStorePath = BcdGetSystemStorePath((WCHAR **)&Src);
v5 = (UINT8 *)Src;
v6 = SystemStorePath;
if( SystemStorePath >= 0 )
{
v7 = -1i64;
do
++v7;
while( *((_WORD *)Src + v7) );
v8 = v7 + 1;
PoolWithTag = (UINT8 *)ExAllocatePoolWithTag(PagedPool, 2 * v8 + 12, 0x4B444342ui64);
v3 = PoolWithTag;
if( PoolWithTag )
{
*(_DWORD *)PoolWithTag = 1;
*((_DWORD *)PoolWithTag + 1) = 2 * v8 + 12;
*((_DWORD *)PoolWithTag + 2) = 3;
memmove(PoolWithTag + 12, v5, 2i64 * v8);
v6 = BiAddStoreFromFile((INT64)v3, 0, &a3);
if( v6 < 0 )
{
BiLogMessage();
if( v6 == -1073741757 )
{
RtlInitUnicodeString(&DestinationString, (PCWSTR)v5, v12);
BiLogFileOwnerProcess(0.0, v1);
}
}
else
{
v10 = a3;
v6 = BiMarkTreatAsSystemStore(a3, 1u);
if( v6 < 0 )
{
BiLogMessage();
BcdCloseStore(v10);
}
else if( BiIsSystemStore(v10) )
{
*StoreHandle = v10;
}
else
{
BiLogMessage();
BcdCloseStore(v10);
v6 = -1073741672;
}
}
}
else
{
v6 = -1073741670;
}
}
if( v5 )
ExFreePoolWithTag(v5, 0x4B444342u);
if( v3 )
ExFreePoolWithTag(v3, 0x4B444342u);
return(unsigned int)v6;
}Referenced by:
BiOpenSystemStore