semevent-r0drv-nt.cpp revision 67c26773eca4a576449ffa8f289fa344fc7b8176
/* $Id$ */
/** @file
* innotek Portable Runtime - Single Release Event Semaphores, Ring-0 Driver, NT.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "the-nt-kernel.h"
#include <iprt/semaphore.h>
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/**
* NT event semaphore.
*/
typedef struct RTSEMEVENTINTERNAL
{
/** Magic value (RTSEMEVENT_MAGIC). */
/** The NT Event object. */
{
Assert(sizeof(RTSEMEVENTINTERNAL) > sizeof(void *));
if (pEventInt)
{
return VINF_SUCCESS;
}
return VERR_NO_MEMORY;
}
{
/*
* Validate input.
*/
if (!pEventInt)
return VERR_INVALID_PARAMETER;
{
return VERR_INVALID_PARAMETER;
}
/*
* Invalidate it and signal the object just in case.
*/
return VINF_SUCCESS;
}
{
/*
* Validate input.
*/
if (!pEventInt)
return VERR_INVALID_PARAMETER;
if ( !pEventInt
{
AssertMsgFailed(("pEventInt->u32Magic=%RX32 pEventInt=%p\n", pEventInt ? pEventInt->u32Magic : 0, pEventInt));
return VERR_INVALID_PARAMETER;
}
/*
* Signal the event object.
*/
return VINF_SUCCESS;
}
{
/*
* Validate input.
*/
if (!pEventInt)
return VERR_INVALID_PARAMETER;
if ( !pEventInt
{
AssertMsgFailed(("pEventInt->u32Magic=%RX32 pEventInt=%p\n", pEventInt ? pEventInt->u32Magic : 0, pEventInt));
return VERR_INVALID_PARAMETER;
}
/*
* Wait for it.
*/
if (cMillies == RT_INDEFINITE_WAIT)
else
{
}
switch (rcNt)
{
case STATUS_SUCCESS:
return VINF_SUCCESS;
return VERR_SEM_DESTROYED;
case STATUS_ALERTED:
return VERR_INTERRUPTED;
case STATUS_USER_APC:
return VERR_INTERRUPTED;
case STATUS_TIMEOUT:
return VERR_TIMEOUT;
default:
AssertMsgFailed(("pEventInt->u32Magic=%RX32 pEventInt=%p: wait returned %lx!\n",
return VERR_INTERNAL_ERROR;
}
}
{
}
{
}