NtAlpcSendWaitReceivePort
INT64 __fastcall NtAlpcSendWaitReceivePort(
HANDLE Handle,
INT64 a2,
__m256i *a3,
INT64 *a4,
UINT64 a5,
INT64 *BufferLength,
INT64 *MessageAttributes,
LARGE_INTEGER *Timeout){
int v8;
_ETHREAD *CurrentThread;
unsigned int v13;
char v14;
int v15;
_ALPC_PORT *v16;
_ETHREAD *v17;
bool v18;
POBJECT_HANDLE_INFORMATION HandleInformation;
volatile void *Address;
LARGE_INTEGER *v22;
PVOID Object;
_ALPC_DISPATCH_CONTEXT result;
v8 = a2;
memset((INT64)&result, 0i64);
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
--*((_WORD *)CurrentThread + 242);
v13 = v8 & 0xFFFF0000;
Object = 0i64;
v14 = *((_BYTE *)KeGetCurrentThread() + 562);
v15 = ObReferenceObjectByHandle(Handle, 1u, AlpcPortObjectType, v14, &Object, 0i64);
if( v15 >= 0 )
{
v16 = (_ALPC_PORT *)Object;
if( (v13 & 0x40000) != 0 )
AlpcpTrackPortReferences((INT64)Object);
if( (v13 & 0x20000) != 0 )
{
if( a3 )
{
if( (v13 & 0x10000) != 0 )
{
v15 = -1073741584;
}
else if( (v13 & 0x1000000) != 0 )
{
v15 = -1073741584;
}
else if( a5 )
{
v15 = AlpcpProcessSynchronousRequest(
(INT64)v16,
v13,
a3,
a4,
a5,
BufferLength,
MessageAttributes,
Timeout,
v14);
}
else
{
v15 = -1073740027;
}
}
else
{
v15 = -1073741584;
}
}
else
{
result.PortObject = v16;
result.Flags = v13;
if( !a3 )
{
LABEL_6:
if( a5 )
v15 = AlpcpReceiveMessage(
&result,
(_PORT_MESSAGE *)a5,
(UINT64 *)BufferLength,
(_ALPC_MESSAGE_ATTRIBUTES *)MessageAttributes,
Timeout,
(INT64)HandleInformation,
(INT64)Address,
(INT64)v22);
if( _bittestandreset((signed __int32 *)&result.Flags, 2u) )
{
AlpcpSignal(&result, 0, 0);
if( result.TargetPort )
HalPutDmaAdapter((PADAPTER_OBJECT)result.TargetPort);
}
goto LABEL_9;
}
if( (v13 & 0x1000000) != 0 )
{
v15 = -1073741584;
}
else
{
result.Flags = v13 | 4;
memset(&result.TargetThread, 0, 24);
v15 = AlpcpSendMessage(&result, (_PORT_MESSAGE *)a3, (_ALPC_MESSAGE_ATTRIBUTES *)a4, v14);
if( v15 >= 0 )
goto LABEL_6;
}
}
LABEL_9:
HalPutDmaAdapter((PADAPTER_OBJECT)v16);
}
v17 = (_ETHREAD *)KeGetCurrentThread();
v18 = (*((_WORD *)v17 + 242))++ == 0xFFFF;
if( v18 && *((_ETHREAD **)v17 + 19) != (_ETHREAD *)((char *)v17 + 152) && !*((_WORD *)v17 + 243) )
KiCheckForKernelApcDelivery();
return(unsigned int)v15;
}Referenced by:
NtWaitForWorkViaWorkerFactory