NtCreateMutant

NTSTATUS __stdcall NtCreateMutant(
        PVOID *MutantHandle,
        UINT64 DesiredAccess,
        OBJECT_ATTRIBUTES *ObjectAttributes,
        UINT8 InitialOwner){
  unsigned int v5; 
  char v7; 
  __int64 v8; 
  NTSTATUS inserted; 
  __int64 v11; 
  __int64 v12; 
  PADAPTER_OBJECT DmaAdapter; 
  PVOID Handle; 
  v5 = DesiredAccess;
  Handle = 0i64;
  DmaAdapter = 0i64;
  v7 = *((_BYTE *)KeGetCurrentThread() + 562);
  if( v7 )
  {
    v8 = 0x7FFFFFFF0000i64;
    if( (unsigned __int64)MutantHandle < 0x7FFFFFFF0000i64 )
      v8 = (__int64)MutantHandle;
    *(_QWORD *)v8 = *(_QWORD *)v8;
  }
  inserted = ObCreateObjectEx(v7, ExMutantObjectType, (__int64)ObjectAttributes, v7, v11, 56, 0, 0, &DmaAdapter, 0i64);
  if( inserted >= 0 )
  {
    KeInitializeMutantEx((KMUTANT *)DmaAdapter, InitialOwner);
    LODWORD(v12) = 0;
    inserted = ObInsertObjectEx(DmaAdapter, 0i64, v5, 0i64, v12, 0i64, &Handle);
    LODWORD(DmaAdapter) = inserted;
    if( inserted >= 0 )
      *MutantHandle = Handle;
  }
  return inserted;
}

Referenced by:

No references.