RtlCreateRetpolineRelocationInformation
INT64 __fastcall RtlCreateRetpolineRelocationInformation(
UINT64 a1,
UINT64 a2,
INT64 a3,
INT64 a4,
INT64 arg20,
CHAR *result,
UINT64 a5,
INT64 a8,
UINT64 a9){
unsigned __int64 v11;
int v12;
UINT8 *v13;
unsigned int v14;
unsigned __int8 v15;
UINT8 *v16;
unsigned __int64 v17;
UINT8 *v18;
unsigned __int64 v19;
_DWORD *v20;
unsigned __int64 v21;
unsigned int v22;
unsigned int v23;
unsigned int v24;
__int64 v26;
CHAR *v27;
UINT8 *v28;
CHAR *v29;
__int16 v30;
UINT16 *v31;
UINT16 *v32;
UINT16 *v33;
unsigned int v34;
__int64 v35;
__int64 v36;
int v37;
_WORD *v38;
unsigned int v39;
unsigned int v40;
_DWORD *v41;
UINT8 *v42;
UINT8 *v43;
UINT8 *v44;
unsigned __int64 v45;
unsigned __int64 v46;
unsigned __int64 v47;
unsigned int v48;
INT64 v49;
v48 = a1;
v11 = (unsigned __int64)(unsigned int)a1 >> 12;
v12 = a1;
if( (unsigned int)a5 < 4 * ((unsigned int)a2 + 3 * v11) || (unsigned int)a9 < 8 * v11 )
return 3221225507i64;
memset((INT64)result, 0i64);
memset(a8, 0i64);
v13 = 0i64;
v14 = 0;
v44 = 0i64;
v15 = 0;
v40 = 0;
if( a3 )
{
v16 = (UINT8 *)(a3 + 12);
v17 = a3 + 12 + *(unsigned int *)(a3 + 8);
}
else
{
v16 = 0i64;
v17 = 0i64;
}
v45 = v17;
if( a4 )
{
v18 = (UINT8 *)(a4 + 12);
v19 = a4 + 12 + *(unsigned int *)(a4 + 8);
}
else
{
v18 = 0i64;
v19 = 0i64;
}
v46 = v19;
if( arg20 )
{
v20 = (_DWORD *)(arg20 + 12);
v21 = arg20 + 12 + *(unsigned int *)(arg20 + 8);
}
else
{
v20 = 0i64;
v21 = 0i64;
}
v47 = v21;
v41 = v20;
if( v12 )
{
do
{
if( (unsigned __int64)v16 < v17 && *(_DWORD *)v16 == v14 )
{
v26 = *((unsigned int *)v16 + 1);
v42 = v16;
v16 += v26;
v22 = v26 - 8;
}
else
{
v42 = 0i64;
v22 = 0;
}
LODWORD(a5) = v22;
if( (unsigned __int64)v18 < v19 && *(_DWORD *)v18 == v14 )
{
v35 = *((unsigned int *)v18 + 1);
v43 = v18;
v18 += v35;
v23 = v35 - 8;
}
else
{
v43 = 0i64;
v23 = 0;
}
LODWORD(v49) = v23;
if( (unsigned __int64)v20 < v21 && *v20 == v14 )
{
v36 = (unsigned int)v20[1];
v44 = (UINT8 *)v20;
v20 = (_DWORD *)((char *)v20 + v36);
v41 = v20;
v24 = v36 - 8;
}
else
{
v24 = 0;
}
v39 = v24;
if( v15 || v22 || v23 || v24 )
{
v27 = result;
*((_WORD *)result + 3) = v15;
if( v15 )
{
v34 = RtlSizeOfRetpolineRelocationEntry(v15);
memmove((UINT8 *)v27 + 8, v13, v34);
}
v13 = (UINT8 *)(v27 + 12);
v28 = (UINT8 *)(v27 + 12);
if( v22 )
{
RtlpCopyRetpolineRelocationBlockEntryArray(v13, 3ui64, v42 + 8, v22, (INT64)&a5);
LOWORD(v22) = a5;
v28 += (unsigned int)a5;
}
if( v23 )
{
RtlpCopyRetpolineRelocationBlockEntryArray(v28, 4ui64, v43 + 8, v23, (INT64)&v49);
LOWORD(v23) = v49;
v28 += (unsigned int)v49;
}
if( v24 )
{
RtlpCopyRetpolineRelocationBlockEntryArray(v28, 5ui64, v44 + 8, v24, (INT64)&v39);
LOWORD(v24) = v39;
v28 += v39;
}
v29 = result;
result = (CHAR *)v28;
*(_WORD *)v29 = v22;
*((_WORD *)v29 + 1) = v23;
*((_WORD *)v29 + 2) = v24;
v30 = 4095;
v31 = (UINT16 *)&v29[(unsigned __int16)v22 + 12 + (unsigned __int16)v23];
v32 = (UINT16 *)&v29[(unsigned __int16)v22 + 12];
v33 = (UINT16 *)((char *)v31 + (unsigned __int16)v24);
while( v13 < (UINT8 *)v32 )
{
if( (*(_DWORD *)v13 & 0xFFFu) + 12 > 0x1000 )
{
v15 = 3;
goto LABEL_39;
}
v13 += 4;
}
while( v32 < v31 )
{
v37 = RtlSizeOfRetpolineIndirectFixup(v32);
if( (unsigned int)(unsigned __int16)(v30 & *v38) + v37 > 0x1000 )
{
v15 = 4;
v13 = (UINT8 *)v38;
goto LABEL_39;
}
v32 = v38 + 1;
}
while( 1 )
{
if( v31 >= v33 )
{
v15 = 0;
v13 = 0i64;
goto LABEL_39;
}
if( (unsigned int)(unsigned __int16)(v30 & *v31) + 6 > 0x1000 )
break;
++v31;
}
v15 = 5;
v13 = (UINT8 *)v31;
LABEL_39:
v14 = v40;
v17 = v45;
v21 = v47;
*(_QWORD *)(a8 + 8 * ((unsigned __int64)v40 >> 12)) = v29;
v20 = v41;
v19 = v46;
}
v14 += 4096;
v40 = v14;
}
while( v14 < v48 );
}
return 0i64;
}Referenced by:
MiCreateRetpolineRelocationInformation