SysHlp.cpp revision 9413be9ca3bdc6836e954d07d4d17d08edf311e3
/** @file
*
* VBoxGuestLib - A support library for VirtualBox guest additions:
* Physical memory heap
*/
/*
* 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#define LOG_GROUP LOG_GROUP_HGCM
#include <VBox/VBoxGuestLib.h>
#include "SysHlp.h"
#if !defined(RT_OS_WINDOWS) && !defined(RT_OS_LINUX)
#endif
{
int rc = VINF_SUCCESS;
#ifdef RT_OS_WINDOWS
{
}
else
{
__try {
}
}
#elif defined(RT_OS_LINUX)
#else
/* Default to IPRT - this ASSUMES that it is USER addresses we're locking. */
if (RT_SUCCESS(rc))
else
*ppvCtx = NIL_RTR0MEMOBJ;
#endif
return rc;
}
{
#ifdef RT_OS_WINDOWS
{
}
#elif defined(RT_OS_LINUX)
#else
/* default to IPRT */
#endif
}
#ifndef VBGL_VBOXGUEST
#if defined (RT_OS_LINUX) && !defined (__KERNEL__)
# include <unistd.h>
# include <errno.h>
#endif
#ifdef RT_OS_LINUX
extern DECLVBGL(void *) vboxadd_cmc_open (void);
extern DECLVBGL(void) vboxadd_cmc_close (void *);
#endif /* RT_OS_LINUX */
#ifdef RT_OS_OS2
/*
* On OS/2 we'll do the connecting in the assembly code of the
* client driver, exporting a g_VBoxGuestIDC symbol containing
* the connection information obtained from the 16-bit IDC.
*/
extern VBOXGUESTOS2IDCCONNECT g_VBoxGuestIDC;
#endif
{
#ifdef RT_OS_WINDOWS
&pFileObject, &pDeviceObject);
if (NT_SUCCESS (rc))
{
return VINF_SUCCESS;
}
/** @todo return RTErrConvertFromNtStatus(rc)! */
return rc;
#elif defined (RT_OS_LINUX)
void *opaque;
opaque = (void *) vboxadd_cmc_open ();
if (!opaque)
{
return VERR_NOT_IMPLEMENTED;
}
return VINF_SUCCESS;
/*
* Just check whether the connection was made or not.
*/
{
return VINF_SUCCESS;
}
Log(("vbglDriverOpen: failed\n"));
return VERR_FILE_NOT_FOUND;
#else
# error "Port me"
#endif
}
{
#ifdef RT_OS_WINDOWS
FALSE, /* external */
&Event,
{
Log(("vbglDriverIOCtl: IoBuildDeviceIoControlRequest failed\n"));
return VERR_NO_MEMORY;
}
if (rc == STATUS_PENDING)
{
Log(("vbglDriverIOCtl: STATUS_PENDING\n"));
NULL);
}
if (!NT_SUCCESS(rc))
#elif defined (RT_OS_LINUX)
if ( pDriver->u32Session
Log(("vbglDriverIOCtl: No connection\n"));
return VERR_WRONG_ORDER;
#else
# error "Port me"
#endif
}
{
#ifdef RT_OS_WINDOWS
#elif defined (RT_OS_LINUX)
pDriver->u32Session = 0;
#else
# error "Port me"
#endif
}
#endif /* !VBGL_VBOXGUEST */