RtlpGetSetBootStatusData
INT64 __stdcall RtlpGetSetBootStatusData(
PVOID Handle,
UINT8 Get,
RTL_BSD_ITEM_TYPE DataItem,
PVOID DataBuffer,
UINT64 DataBufferLength,
UINT64 *BytesReturned){
INT64 result;
int v11;
INT64 Length;
size_t Size;
union _LARGE_INTEGER ByteOffset;
struct _IO_STATUS_BLOCK IoStatusBlock;
IO_STATUS_BLOCK v16;
Size = 0i64;
ByteOffset.QuadPart = 0i64;
IoStatusBlock = 0i64;
v16 = 0i64;
LODWORD(result) = ZwReadFile(Handle, 0i64, 0i64, 0i64, &IoStatusBlock, (char *)&Size + 4, 4u, &ByteOffset, 0i64);
if( (int)result >= 0 )
{
result = RtlBootStatusItemInfo((unsigned int)DataItem, &ByteOffset, &Size);
v11 = result;
if( (int)result >= 0 )
{
ByteOffset.HighPart = 0;
Length = (unsigned int)Size;
if( (unsigned int)Size + (unsigned __int64)ByteOffset.LowPart > HIDWORD(Size) )
{
return 3221225561i64;
}
else if( (unsigned int)DataBufferLength < (unsigned int)Size )
{
return 3221225507i64;
}
else
{
if( Get )
{
if( BootStatFileHandleAcquired && BootStatFileHandle == Handle && BootStatDataCache )
{
IoStatusBlock.Information = (unsigned int)Size;
memmove((UINT8 *)DataBuffer, (UINT8 *)BootStatDataCache + ByteOffset.LowPart, (unsigned int)Size);
}
else
{
v11 = ZwReadFile(Handle, 0i64, 0i64, 0i64, &IoStatusBlock, DataBuffer, Size, &ByteOffset, 0i64);
}
}
else
{
if( BootStatFileHandleAcquired && BootStatFileHandle == Handle && BootStatDataCache )
memmove((UINT8 *)BootStatDataCache + ByteOffset.LowPart, (UINT8 *)DataBuffer, (unsigned int)Size);
v11 = ZwWriteFile(Handle, 0i64, 0i64, 0i64, &IoStatusBlock, DataBuffer, Length, &ByteOffset, 0i64);
if( v11 >= 0 && !BootStatDisableFlush )
v11 = ZwFlushBuffersFile(Handle, &v16);
RtlpRecordBootStatusData(1, (INT64)DataBuffer, ByteOffset.QuadPart, Length);
}
if( v11 >= 0 )
{
if( BytesReturned )
*(_DWORD *)BytesReturned = IoStatusBlock.Information;
}
return(unsigned int)v11;
}
}
}
return result;
}Referenced by:
RtlGetSetBootStatusData