RtlpCopyExtendedContext
NTSTATUS __stdcall RtlpCopyExtendedContext(
INT8 Operation,
_CONTEXT_EX *Destination,
_CONTEXT_EX *DestinationLayout,
UINT64 ContextFlags,
_CONTEXT_EX *Source,
_CONTEXT_EX *SourceLayout){
unsigned int v6;
char v9;
_CONTEXT_EX *v10;
_CONTEXT_EX *v11;
__int64 Offset;
__int64 v13;
_X86_NT5_CONTEXT *v14;
_X86_NT5_CONTEXT *v15;
NTSTATUS result;
v6 = ContextFlags;
if( (ContextFlags & 0x27FFFF80) != 0x10000
&& (ContextFlags & 0x27FFFFA0) != 0x100000
&& (ContextFlags & 0x7FFFFF0) != 0x200000
&& (ContextFlags & 0x7FFFFE0) != 0x400000 )
{
return -1073741811;
}
v9 = 1;
if( (ContextFlags & 0x100040) == 1048640 || (ContextFlags & 0x10040) == 65600 )
{
if( !KUSER_SHARED_DATA.XState.EnabledFeatures )
return -1073741637;
v9 = 3;
}
v10 = Source;
v11 = Destination;
if( DestinationLayout )
v11 = DestinationLayout;
if( SourceLayout )
v10 = SourceLayout;
Offset = v11->Legacy.Offset;
v13 = v10->Legacy.Offset;
if( (_DWORD)Offset != (_DWORD)v13 || v11->Legacy.Length < v10->Legacy.Length )
return -1073741811;
v14 = (_X86_NT5_CONTEXT *)((char *)&Destination->All + Offset);
v15 = (_X86_NT5_CONTEXT *)((char *)&Source->All + v13);
if( (v6 & 0x10000) != 0 )
{
RtlpCopyLegacyContextX86((unsigned __int8)Operation, v14, v6, v15);
}
else if( (v6 & 0x100000) != 0 )
{
RtlpCopyLegacyContextAmd64((unsigned __int8)Operation, v14, v6, v15);
}
else if( (v6 & 0x200000) != 0 )
{
RtlpCopyLegacyContextArm(Operation, (__int64)v14, v6, (__int64)v15);
}
else if( (v6 & 0x400000) != 0 )
{
RtlpCopyLegacyContextArm64(Operation, (__int64)v14, v6, (__int64)v15);
}
if( (v9 & 2) == 0 )
return 0;
result = RtlpCopyXStateChunk(Operation, Destination, v11, Source, v10);
if( result >= 0 )
return 0;
return result;
}Referenced by:
KiDispatchException
RtlpReadExtendedContext
RtlpWriteExtendedContext