NtReplyWaitReceivePortEx

INT64 __fastcall NtReplyWaitReceivePortEx(
        VOID *PortHandle,
        VOID **PortContext,
        _PORT_MESSAGE *ReplyMessage,
        _PORT_MESSAGE *ReceiveMessage,
        _LARGE_INTEGER *Timeout,
        INT64 a6,
        INT64 a7,
        INT64 a8){
  _ETHREAD *CurrentThread; 
  KPROCESSOR_MODE v13; 
  int v14; 
  INT64 v15; 
  struct _DMA_ADAPTER *v16; 
  INT64 v17; 
  INT64 v18; 
  VOID *v19; 
  int v21; 
  PVOID *Object; 
  INT64 v23; 
  PVOID v24[2]; 
  _ALPC_DISPATCH_CONTEXT DispatchContext; 
  memset((INT64)&DispatchContext, 0i64);
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --*((_WORD *)CurrentThread + 242);
  v13 = *((_BYTE *)KeGetCurrentThread() + 562);
  if( v13 )
    AlpcpProbeForWriteMessageHeader((UINT64)ReceiveMessage, 0i64);
  v24[0] = 0i64;
  v14 = ObReferenceObjectByHandle(PortHandle, 1u, AlpcPortObjectType, v13, v24, 0i64);
  if( v14 >= 0 )
  {
    v16 = (struct _DMA_ADAPTER *)v24[0];
    DispatchContext.PortObject = (_ALPC_PORT *)v24[0];
    DispatchContext.Flags = 0;
    if( ReplyMessage
      && ((*((_DWORD *)v24[0] + 104) & 0x2000) == 0 ? (DispatchContext.Flags = 65541,
                                                       memset(&DispatchContext.TargetThread, 0, 24),
                                                       v21 = AlpcpSendMessage(&DispatchContext, ReplyMessage, 0i64, v13)) : (DispatchContext.Flags = 4, memset(&DispatchContext.TargetThread, 0, 24), LOBYTE(v15) = v13, v21 = AlpcpReplyLegacySynchronousRequest(&DispatchContext, ReplyMessage, v15)),
          v14 = v21,
          v21 < 0) )
    {
      HalPutDmaAdapter(v16);
      if( v14 == -1073740029 )
        v14 = -1073741769;
    }
    else
    {
      v14 = AlpcpReceiveLegacyMessage(
              &DispatchContext,
              ReceiveMessage,
              Timeout,
              PortContext,
              (INT64)Object,
              v23,
              (INT64)v24[0],
              (INT64)v24[1]);
      AlpcpCompleteDeferSignalRequest((INT64)&DispatchContext, v17, v18, v19);
      HalPutDmaAdapter(v16);
    }
  }
  KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
  return(unsigned int)v14;
}

Referenced by:

No references.