RtlpGenericInverseCouplingWorker
UINT8 __stdcall RtlpGenericInverseCouplingWorker(UINT64 Pattern, UINT64 Inverse, PVOID VirtualAddress){
_DWORD *v3;
__int64 v4;
unsigned __int64 v5;
unsigned int v6;
char v7;
unsigned __int64 v9;
int v10;
unsigned __int64 v11;
struct _KPRCB *CurrentPrcb;
__int64 v13;
char *i;
unsigned __int64 v15;
unsigned int v16;
struct _KPRCB *v17;
__int64 v18;
char *j;
unsigned __int64 v20;
int v21;
char *v22;
unsigned __int64 v23;
__int64 v24;
__int64 v25;
struct _KPRCB *v26;
__int64 v27;
char *k;
void *v29;
unsigned __int64 v30;
struct _KPRCB *v31;
__int64 v32;
char *m;
unsigned __int64 v34;
int v35;
void *v36;
struct _KPRCB *v37;
__int64 v38;
char *n;
_DWORD *v40;
struct _KPRCB *v41;
__int64 v42;
char *ii;
signed __int32 v45[14];
v3 = VirtualAddress;
v4 = (unsigned int)Inverse;
v5 = 1024i64;
v6 = Pattern;
v7 = (char)VirtualAddress;
v9 = 1024i64;
v10 = v7 & 4;
if( v10 )
{
*v3 = Pattern;
v9 = 1023i64;
++v3;
}
v11 = (unsigned int)Pattern | ((unsigned __int64)(unsigned int)Pattern << 32);
memset64(v3, v11, v9 >> 1);
if( (v9 & 1) != 0 )
v3[v9 - 1] = Pattern;
CurrentPrcb = KeGetCurrentPrcb();
v13 = *((unsigned int *)CurrentPrcb + 58);
if( *((_DWORD *)CurrentPrcb + 58) )
{
_InterlockedOr(v45, 0);
for( i = (char *)((unsigned __int64)VirtualAddress & ~(v13 - 1)); i < (char *)VirtualAddress + 4096; i += v13 )
_mm_clflush(i);
}
if( !RtlpTestAndFillMemoryUp(v6, v6, VirtualAddress) )
return 0;
v17 = KeGetCurrentPrcb();
v18 = *((unsigned int *)v17 + 58);
if( *((_DWORD *)v17 + 58) )
{
_InterlockedOr(v45, 0);
for( j = (char *)(v15 & ~(v18 - 1)); (unsigned __int64)j < v15 + 4096; j += v18 )
_mm_clflush(j);
}
if( !RtlpTestMemory(v16, (PVOID)v15) )
return 0;
v22 = (char *)v20;
if( v10 )
{
*(_DWORD *)v20 = v21;
v22 = (char *)(v20 + 4);
v23 = 511i64;
v24 = 1i64;
v25 = 4088i64;
}
else
{
v23 = 512i64;
v24 = 0i64;
v25 = 4092i64;
}
memset64(v22, v11, v23);
if( v24 )
*(_DWORD *)&v22[v25] = v21;
v26 = KeGetCurrentPrcb();
v27 = *((unsigned int *)v26 + 58);
if( *((_DWORD *)v26 + 58) )
{
_InterlockedOr(v45, 0);
for( k = (char *)(v20 & ~(v27 - 1)); (unsigned __int64)k < v20 + 4096; k += v27 )
_mm_clflush(k);
}
v29 = (void *)v20;
v30 = 1024i64;
if( v10 )
{
*(_DWORD *)v20 = v4;
v29 = (void *)(v20 + 4);
v30 = 1023i64;
}
memset64(v29, v4 | (v4 << 32), v30 >> 1);
if( (v30 & 1) != 0 )
*((_DWORD *)v29 + v30 - 1) = v4;
v31 = KeGetCurrentPrcb();
v32 = *((unsigned int *)v31 + 58);
if( *((_DWORD *)v31 + 58) )
{
_InterlockedOr(v45, 0);
for( m = (char *)(v20 & ~(v32 - 1)); (unsigned __int64)m < v20 + 4096; m += v32 )
_mm_clflush(m);
}
if( !RtlpTestMemory((unsigned int)v4, (PVOID)v20) )
return 0;
v36 = (void *)v34;
if( v10 )
{
*(_DWORD *)v34 = v35;
v36 = (void *)(v34 + 4);
v5 = 1023i64;
}
memset64(v36, v11, v5 >> 1);
if( (v5 & 1) != 0 )
*((_DWORD *)v36 + v5 - 1) = v35;
v37 = KeGetCurrentPrcb();
v38 = *((unsigned int *)v37 + 58);
if( *((_DWORD *)v37 + 58) )
{
_InterlockedOr(v45, 0);
for( n = (char *)(v34 & ~(v38 - 1)); (unsigned __int64)n < v34 + 4096; n += v38 )
_mm_clflush(n);
}
v40 = (_DWORD *)(v34 + 4096);
do
*--v40 = v4;
while( v40 != (_DWORD *)v34 );
v41 = KeGetCurrentPrcb();
v42 = *((unsigned int *)v41 + 58);
if( *((_DWORD *)v41 + 58) )
{
_InterlockedOr(v45, 0);
for( ii = (char *)(v34 & ~(v42 - 1)); (unsigned __int64)ii < v34 + 4096; ii += v42 )
_mm_clflush(ii);
}
return RtlpTestMemory((unsigned int)v4, (PVOID)v34);
}Referenced by:
RtlScrubMemory