AlpcpPrepareViewForDelivery
__int64 __fastcall AlpcpPrepareViewForDelivery(ULONG_PTR BugCheckParameter2, char a2, unsigned __int8 a3){
__int64 v3;
int v5;
__int64 v7;
int v8;
unsigned int v9;
unsigned int v10;
_QWORD *v12;
int v13;
__int64 v14;
_KAPC_STATE ApcState;
v5 = a3;
v3 = *(_QWORD *)(BugCheckParameter2 + 16);
memset(&ApcState, 0, sizeof(ApcState));
v7 = 0i64;
AlpcpLockForCachedReferenceBlob((PVOID)v3);
v8 = *(_DWORD *)(v3 + 48);
if( (v8 & 1) == 0 )
{
if( !a2 )
goto LABEL_7;
if( *(_DWORD *)(BugCheckParameter2 + 76) )
goto LABEL_7;
v9 = *(_DWORD *)(v3 + 52);
if( v9 > 2 )
goto LABEL_7;
if( v9 != 1 )
{
v12 = *(_QWORD **)(v3 + 56);
if( v12 == (_QWORD *)BugCheckParameter2 )
v12 = (_QWORD *)*v12;
v13 = *(_DWORD *)(BugCheckParameter2 + 72);
if( (v13 & 8) == 0 )
{
LODWORD(v14) = MmSecureVirtualMemoryAgainstWrites(
*(_EPROCESS **)(BugCheckParameter2 + 32),
*(PVOID *)(BugCheckParameter2 + 40),
*(_QWORD *)(BugCheckParameter2 + 48));
if( !v14 )
goto LABEL_7;
*(_QWORD *)(BugCheckParameter2 + 64) = v14;
v13 = *(_DWORD *)(BugCheckParameter2 + 72);
}
*(_DWORD *)(BugCheckParameter2 + 72) = v13 & 0xFFFFFFFE;
AlpcpReferenceBlob((PVOID)BugCheckParameter2);
*(_DWORD *)(v3 + 48) |= 1u;
*(_QWORD *)(v3 + 72) = BugCheckParameter2;
*(_QWORD *)(v3 + 80) = v12;
goto LABEL_7;
}
*(_QWORD *)(v3 + 80) = BugCheckParameter2;
*(_DWORD *)(v3 + 48) = v8 | 1;
LABEL_7:
++*(_DWORD *)(BugCheckParameter2 + 76);
v10 = 0;
goto LABEL_8;
}
if( BugCheckParameter2 == *(_QWORD *)(v3 + 80) )
{
if( !a2 )
{
v7 = *(_QWORD *)(v3 + 72);
if( v7 )
{
if( *(_QWORD *)(v7 + 64) )
{
KiStackAttachProcess(*(_KPROCESS **)(v7 + 32), 0i64, &ApcState);
MmUnsecureVirtualMemory(*(PVOID *)(v7 + 64));
KiUnstackDetachProcess(&ApcState, 0i64);
*(_QWORD *)(v7 + 64) = 0i64;
}
*(_DWORD *)(v7 + 72) |= 1u;
*(_QWORD *)(v3 + 72) = 0i64;
}
*(_QWORD *)(v3 + 80) = 0i64;
*(_DWORD *)(v3 + 48) &= ~1u;
goto LABEL_7;
}
if( !*(_DWORD *)(BugCheckParameter2 + 76) )
goto LABEL_7;
}
v10 = -1073741790;
LABEL_8:
*(_DWORD *)(BugCheckParameter2 + 72) ^= (*(_DWORD *)(BugCheckParameter2 + 72) ^ (2 * v5)) & 2;
AlpcpUnlockBlob((PVOID)v3);
if( v7 )
AlpcpDereferenceBlobEx((PVOID)v7, 1i64);
return v10;
}Referenced by:
AlpcpCaptureViewAttributeInternal