1 | /** @file
|
---|
2 | *
|
---|
3 | * VBoxGuestLib - A support library for VirtualBox guest additions:
|
---|
4 | * System dependent helpers internal header
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __SYSHLP__H
|
---|
24 | #define __SYSHLP__H
|
---|
25 |
|
---|
26 | #ifdef RT_OS_WINDOWS
|
---|
27 | # if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
|
---|
28 | # include <iprt/asm.h>
|
---|
29 | # define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
|
---|
30 | # define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
|
---|
31 | # define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
|
---|
32 | # define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
|
---|
33 | # pragma warning(disable : 4163)
|
---|
34 | RT_BEGIN_DECLS
|
---|
35 | # include <ntddk.h>
|
---|
36 | RT_END_DECLS
|
---|
37 | # pragma warning(default : 4163)
|
---|
38 | # undef _InterlockedExchange
|
---|
39 | # undef _InterlockedExchangeAdd
|
---|
40 | # undef _InterlockedCompareExchange
|
---|
41 | # undef _InterlockedAddLargeStatistic
|
---|
42 | # else
|
---|
43 | RT_BEGIN_DECLS
|
---|
44 | # include <ntddk.h>
|
---|
45 | RT_END_DECLS
|
---|
46 | # endif
|
---|
47 | /* XP DDK #defines ExFreePool to ExFreePoolWithTag. The latter does not exist on NT4, so...
|
---|
48 | * The same for ExAllocatePool.
|
---|
49 | */
|
---|
50 | #undef ExAllocatePool
|
---|
51 | #undef ExFreePool
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | typedef struct _VBGLDRIVER
|
---|
55 | {
|
---|
56 | #ifdef RT_OS_WINDOWS
|
---|
57 | PDEVICE_OBJECT pDeviceObject;
|
---|
58 | PFILE_OBJECT pFileObject;
|
---|
59 | #elif defined (RT_OS_LINUX)
|
---|
60 | void *opaque;
|
---|
61 | #elif defined (RT_OS_OS2)
|
---|
62 | uint32_t u32Session; /**< just for sanity checking. */
|
---|
63 | #elif defined (RT_OS_SOLARIS)
|
---|
64 | void *pvOpaque;
|
---|
65 | #elif defined (RT_OS_FREEBSD)
|
---|
66 | void *pvOpaque;
|
---|
67 | #else
|
---|
68 | # error "Port me"
|
---|
69 | #endif
|
---|
70 | } VBGLDRIVER;
|
---|
71 |
|
---|
72 | int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess);
|
---|
73 | void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size);
|
---|
74 |
|
---|
75 |
|
---|
76 | #ifndef VBGL_VBOXGUEST
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Open VBoxGuest driver.
|
---|
80 | *
|
---|
81 | * @param pDriver Pointer to the driver structure.
|
---|
82 | *
|
---|
83 | * @return VBox error code
|
---|
84 | */
|
---|
85 | int vbglDriverOpen (VBGLDRIVER *pDriver);
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Call VBoxGuest driver.
|
---|
89 | *
|
---|
90 | * @param pDriver Pointer to the driver structure.
|
---|
91 | * @param u32Function Function code.
|
---|
92 | * @param pvData Pointer to supplied in/out data buffer.
|
---|
93 | * @param cbData Size of data buffer.
|
---|
94 | *
|
---|
95 | * @return VBox error code
|
---|
96 | */
|
---|
97 | int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData);
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * Close VBoxGuest driver.
|
---|
101 | *
|
---|
102 | * @param pDriver Pointer to the driver structure.
|
---|
103 | *
|
---|
104 | * @return VBox error code
|
---|
105 | */
|
---|
106 | void vbglDriverClose (VBGLDRIVER *pDriver);
|
---|
107 |
|
---|
108 | #endif
|
---|
109 |
|
---|
110 | #endif /* __SYSHLP__H */
|
---|