semmutex-r0drv-nt.cpp revision 67c26773eca4a576449ffa8f289fa344fc7b8176
af062818b47340eef15700d2f0211576ba3506eevboxsync * innotek Portable Runtime - Mutex Semaphores, Ring-0 Driver, NT.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright (C) 2006-2007 innotek GmbH
af062818b47340eef15700d2f0211576ba3506eevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
af062818b47340eef15700d2f0211576ba3506eevboxsync * available from http://www.virtualbox.org. This file is free software;
af062818b47340eef15700d2f0211576ba3506eevboxsync * you can redistribute it and/or modify it under the terms of the GNU
af062818b47340eef15700d2f0211576ba3506eevboxsync * General Public License as published by the Free Software Foundation,
af062818b47340eef15700d2f0211576ba3506eevboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
af062818b47340eef15700d2f0211576ba3506eevboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
af062818b47340eef15700d2f0211576ba3506eevboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync/*******************************************************************************
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync* Header Files *
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync*******************************************************************************/
af062818b47340eef15700d2f0211576ba3506eevboxsync/*******************************************************************************
af062818b47340eef15700d2f0211576ba3506eevboxsync* Structures and Typedefs *
af062818b47340eef15700d2f0211576ba3506eevboxsync*******************************************************************************/
af062818b47340eef15700d2f0211576ba3506eevboxsync * NT mutex semaphore.
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Magic value (RTSEMMUTEX_MAGIC). */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The fast mutex object. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The NT Mutex object. */
114410893548b9522c46fdcbd8f63385eb8bfb68vboxsync Assert(sizeof(RTSEMMUTEXINTERNAL) > sizeof(void *));
af062818b47340eef15700d2f0211576ba3506eevboxsync PRTSEMMUTEXINTERNAL pMutexInt = (PRTSEMMUTEXINTERNAL)RTMemAlloc(sizeof(*pMutexInt));
if (!pMutexInt)
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
return VINF_SUCCESS;
if (!pMutexInt)
return VERR_INVALID_PARAMETER;
if ( !pMutexInt
AssertMsgFailed(("pMutexInt->u32Magic=%RX32 pMutexInt=%p\n", pMutexInt ? pMutexInt->u32Magic : 0, pMutexInt));
return VERR_INVALID_PARAMETER;
#ifdef RT_USE_FAST_MUTEX
AssertMsg(cMillies == RT_INDEFINITE_WAIT, ("timeouts are not supported when using fast mutexes!\n"));
switch (rcNt)
case STATUS_SUCCESS:
return VINF_SUCCESS;
return VERR_SEM_DESTROYED;
case STATUS_ALERTED:
return VERR_INTERRUPTED; /** @todo VERR_INTERRUPTED isn't correct anylonger. please fix r0drv stuff! */
case STATUS_USER_APC:
return VERR_INTERRUPTED; /** @todo VERR_INTERRUPTED isn't correct anylonger. please fix r0drv stuff! */
case STATUS_TIMEOUT:
return VERR_TIMEOUT;
return VERR_INTERNAL_ERROR;
return VINF_SUCCESS;
if (!pMutexInt)
return VERR_INVALID_PARAMETER;
if ( !pMutexInt
AssertMsgFailed(("pMutexInt->u32Magic=%RX32 pMutexInt=%p\n", pMutexInt ? pMutexInt->u32Magic : 0, pMutexInt));
return VERR_INVALID_PARAMETER;
#ifdef RT_USE_FAST_MUTEX
return VINF_SUCCESS;