NtAlpcCancelMessage

NTSTATUS __stdcall NtAlpcCancelMessage(VOID *PortHandle, UINT64 Flags, _ALPC_CONTEXT_ATTR *MessageContext){
  unsigned int v3; 
  _ETHREAD *CurrentThread; 
  char PreviousMode; 
  unsigned int v6; 
  unsigned int v7; 
  unsigned __int64 v8; 
  int v9; 
  _KALPC_MESSAGE **v10; 
  UINT64 v11; 
  _ALPC_PORT *v12; 
  PVOID Object[6]; 

  v3 = Flags;
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --CurrentThread->Tcb.KernelApcDisable;
  if( (Flags & 0xFFFFFFF0) != 0 )
  {
    v9 = -1073741811;
    goto LABEL_17;
  }
  PreviousMode = KeGetCurrentThread()->PreviousMode;
  if( PreviousMode )
  {
    if( (Flags & 4) != 0 )
    {
      if( ((unsigned __int8)MessageContext & 3) == 0 )
      {
        v6 = MessageContext[3];
        v7 = MessageContext[4];
        v8 = (unsigned int)MessageContext[1];
        goto LABEL_9;
      }
    }
    else if( ((unsigned __int8)MessageContext & 3) == 0 )
    {
      v6 = MessageContext[5];
      v7 = MessageContext[6];
      v8 = *((_QWORD *)MessageContext + 1);
LABEL_9:
      Object[1] = (PVOID)v8;
      goto LABEL_10;
    }
    ExRaiseDatatypeMisalignment();
  }
  v6 = MessageContext[5];
  v7 = MessageContext[6];
  v8 = *((_QWORD *)MessageContext + 1);
LABEL_10:
  if( !v6 )
  {
    v9 = -1073741559;
    goto LABEL_17;
  }
  Object[0] = 0i64;
  v9 = ObReferenceObjectByHandle(PortHandle, 1ui64, AlpcPortObjectType, PreviousMode, Object, 0i64);
  if( v9 >= 0 )
  {
    v11 = v6;
    v12 = (_ALPC_PORT *)Object[0];
    v9 = AlpcpLookupMessage((_ALPC_PORT *)Object[0], v11, v7, v10);
    if( v9 >= 0 )
    {
      if( (v3 & 8) == 0 )
        goto LABEL_14;
      if( (v12->u1.State & 6) == 4 )
      {
        if( v8 == MEMORY[0x68] )
        {
LABEL_14:
          if( MEMORY[0x28] < 0 )
          {
            AlpcpUnlockMessage(0i64);
            v9 = -1073740029;
          }
          else
          {
            v9 = AlpcpCancelMessage(v12, 0, v3);
          }
          goto LABEL_16;
        }
      }
      else if( v8 == MEMORY[0x70] )
      {
        goto LABEL_14;
      }
      AlpcpUnlockMessage(0i64);
      v9 = -1073740007;
    }
LABEL_16:
    HalPutDmaAdapter((PADAPTER_OBJECT)v12);
  }
LABEL_17:
  KeLeaveCriticalRegionThread(KeGetCurrentThread());
  return v9;
}

Referenced by:

No references.