DbgkOpenProcessDebugPort

__int64 __fastcall DbgkOpenProcessDebugPort(__int64 a1, char a2, void **a3){
  NTSTATUS v6; 
  struct _DMA_ADAPTER *v7; 
  UINT64 v8; 
  v6 = -1073740973;
  if( *(_QWORD *)(a1 + 1400) )
  {
    ExAcquireFastMutex(&DbgkpProcessDebugPortMutex);
    v7 = *(struct _DMA_ADAPTER **)(a1 + 1400);
    if( v7 )
      ObfReferenceObject(*(PVOID *)(a1 + 1400));
    KeReleaseGuardedMutex(&DbgkpProcessDebugPortMutex);
    if( v7 )
    {
      LOBYTE(v8) = a2;
      if( PsTestProtectedProcessIncompatibility(v8, *((_QWORD *)KeGetCurrentThread() + 23), a1) )
      {
        v6 = -1073740014;
LABEL_8:
        HalPutDmaAdapter(v7);
        return(unsigned int)v6;
      }
      v6 = ObOpenObjectByPointer(v7, a2 == 0 ? 0x200 : 0, 0i64, 0x2000000u, DbgkDebugObjectType, a2, a3);
      if( v6 < 0 )
        goto LABEL_8;
    }
  }
  return(unsigned int)v6;
}

Referenced by:

NtQueryInformationProcess