AlpcpExposeHandleAttribute
__int64 __fastcall AlpcpExposeHandleAttribute(__int64 a1, __int64 a2, __int64 a3, _DWORD *a4){
char *v7;
unsigned __int8 v9;
int v10;
struct _DMA_ADAPTER *v11;
int v12;
int v13;
_ALPC_PORT *v14;
_EPROCESS *v15;
VOID *TargetHandle[2];
UINT GrantedAccess[2];
v7 = *(char **)(a2 + 152);
if( !v7 )
return 0i64;
v9 = *((_BYTE *)KeGetCurrentThread() + 562);
v10 = 0;
v11 = 0i64;
if( (*(_DWORD *)(a1 + 416) & 6) == 2 )
{
v14 = AlpcpReferenceConnectedPort(*(_ALPC_PORT **)(a2 + 24));
v11 = (struct _DMA_ADAPTER *)v14;
if( !v14 )
{
v13 = -1073741769;
goto LABEL_8;
}
a1 = (__int64)v14;
}
v12 = *(_DWORD *)(a1 + 256);
if( (v12 & 0x80000) == 0 )
goto LABEL_22;
*(_OWORD *)TargetHandle = 0i64;
*(_QWORD *)GrantedAccess = 0i64;
if( (v12 & 0x2000000) == 0 )
{
if( *((_DWORD *)v7 + 1) <= 1u )
{
if( (*(_DWORD *)v7 & *(_DWORD *)(a1 + 320)) == 0 )
{
v13 = -1073741788;
goto LABEL_8;
}
v15 = *(_EPROCESS **)(a1 + 24);
if( ((unsigned __int8)v15 & 1) != 0 )
v15 = 0i64;
if( v15 )
{
GrantedAccess[0] = *(_DWORD *)v7 & *(_DWORD *)(a1 + 320);
v13 = ObCompleteObjectDuplication(
(_OB_DUPLICATE_OBJECT_STATE *)(v7 + 8),
v15,
v9,
&TargetHandle[1],
&GrantedAccess[1]);
if( v13 < 0 )
goto LABEL_8;
goto LABEL_7;
}
}
LABEL_22:
v13 = -1073741790;
goto LABEL_8;
}
LODWORD(TargetHandle[0]) = 0x40000;
GrantedAccess[0] = *((_DWORD *)v7 + 1);
v10 = 1;
LABEL_7:
v13 = 0;
*(_OWORD *)a3 = *(_OWORD *)TargetHandle;
*(_QWORD *)(a3 + 16) = *(_QWORD *)GrantedAccess;
*a4 |= 0x10000000u;
LABEL_8:
if( v11 )
HalPutDmaAdapter(v11);
if( !v10 )
{
AlpcpDereferenceBlobEx(v7, 1i64);
*(_QWORD *)(a2 + 152) = 0i64;
}
return(unsigned int)v13;
}Referenced by:
AlpcpExposeAttributes
AlpcpExposeHandleAttribute32