MiCopyToUntrustedMemory
VOID __fastcall MiCopyToUntrustedMemory(
VOID *UntrustedDestination,
VOID *Source,
UINT64 NumberOfBytes,
UINT64 ChunkSize){
unsigned int v4;
_BYTE *v5;
_BYTE *v6;
__int64 v7;
unsigned int v8;
unsigned int i;
__int64 v10;
v4 = NumberOfBytes;
v5 = Source;
v6 = UntrustedDestination;
v7 = 0i64;
v10 = 0i64;
if( (_DWORD)ChunkSize
|| (((unsigned __int8)UntrustedDestination | (unsigned __int8)Source) & 7) != 0
|| (NumberOfBytes & 7) != 0 )
{
while( v4 )
{
if( (_DWORD)ChunkSize )
{
v8 = ChunkSize;
if( (unsigned int)ChunkSize > v4 )
v8 = 1;
}
else
{
v8 = v4 & 7;
if( (v4 & 7) != 0 )
{
if( ((v8 - 1) & v8) != 0 )
v8 = 1;
}
else
{
v8 = 8;
}
}
if( ((v8 - 1) & (unsigned int)v6) != 0 )
v8 = 1;
for( i = 0; i < v8; ++i )
{
*((_BYTE *)&v10 + i) = *v5++;
v7 = v10;
}
switch( v8 )
{
case 1u:
*v6 = v7;
break;
case 2u:
*(_WORD *)v6 = v7;
break;
case 4u:
*(_DWORD *)v6 = v7;
break;
case 8u:
*(_QWORD *)v6 = v7;
break;
}
v4 -= v8;
v6 += v8;
}
}
else
{
memmove((UINT8 *)UntrustedDestination, (UINT8 *)Source, (unsigned int)NumberOfBytes);
}
}Referenced by:
MiDbgCopyMemory
MiDbgCopyMemoryTarget