VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuestLib/SysHlp.h@ 52002

Last change on this file since 52002 was 44528, checked in by vboxsync, 12 years ago

header (C) fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Revision: 44528 $ */
2/** @file
3 * VBoxGuestLibR0 - System dependent helpers internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef __VBoxGuestLib_SysHlp_h
28#define __VBoxGuestLib_SysHlp_h
29
30#include <iprt/types.h>
31
32#ifdef RT_OS_WINDOWS
33# undef PAGE_SIZE
34# undef PAGE_SHIFT
35# if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
36# include <iprt/asm.h>
37# define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
38# define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
39# define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
40# define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
41# pragma warning(disable : 4163)
42RT_C_DECLS_BEGIN
43# include <ntddk.h>
44RT_C_DECLS_END
45# pragma warning(default : 4163)
46# undef _InterlockedExchange
47# undef _InterlockedExchangeAdd
48# undef _InterlockedCompareExchange
49# undef _InterlockedAddLargeStatistic
50# else
51RT_C_DECLS_BEGIN
52# include <ntddk.h>
53RT_C_DECLS_END
54# endif
55/* XP DDK #defines ExFreePool to ExFreePoolWithTag. The latter does not exist on NT4, so...
56 * The same for ExAllocatePool.
57 */
58#undef ExAllocatePool
59#undef ExFreePool
60#endif
61
62typedef struct _VBGLDRIVER
63{
64#ifdef RT_OS_WINDOWS
65 PDEVICE_OBJECT pDeviceObject;
66 PFILE_OBJECT pFileObject;
67#elif defined (RT_OS_OS2)
68 uint32_t u32Session; /**< just for sanity checking. */
69#else /* PORTME */
70 void *pvOpaque;
71#endif
72} VBGLDRIVER;
73
74int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess, uint32_t fFlags);
75void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size);
76
77
78#ifndef VBGL_VBOXGUEST
79
80/**
81 * Open VBoxGuest driver.
82 *
83 * @param pDriver Pointer to the driver structure.
84 *
85 * @return VBox error code
86 */
87int vbglDriverOpen (VBGLDRIVER *pDriver);
88
89/**
90 * Answers whether the VBoxGuest driver is opened
91 *
92 * @param pDriver Pointer to the driver structure.
93 *
94 * @return true - if opened, false - otherwise
95 */
96bool vbglDriverIsOpened (VBGLDRIVER *pDriver);
97
98/**
99 * Call VBoxGuest driver.
100 *
101 * @param pDriver Pointer to the driver structure.
102 * @param u32Function Function code.
103 * @param pvData Pointer to supplied in/out data buffer.
104 * @param cbData Size of data buffer.
105 *
106 * @return VBox error code
107 */
108int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData);
109
110/**
111 * Close VBoxGuest driver.
112 *
113 * @param pDriver Pointer to the driver structure.
114 *
115 * @return VBox error code
116 */
117void vbglDriverClose (VBGLDRIVER *pDriver);
118
119#endif
120
121#endif /* !__VBoxGuestLib_SysHlp_h */
122
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette