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 | __BEGIN_DECLS
|
---|
34 | # include <ntddk.h>
|
---|
35 | __END_DECLS
|
---|
36 | # undef _InterlockedExchange
|
---|
37 | # undef _InterlockedExchangeAdd
|
---|
38 | # undef _InterlockedCompareExchange
|
---|
39 | # undef _InterlockedAddLargeStatistic
|
---|
40 | # else
|
---|
41 | __BEGIN_DECLS
|
---|
42 | # include <ntddk.h>
|
---|
43 | __END_DECLS
|
---|
44 | # endif
|
---|
45 | /* XP DDK #defines ExFreePool to ExFreePoolWithTag. The latter does not exist on NT4, so...
|
---|
46 | * The same for ExAllocatePool.
|
---|
47 | */
|
---|
48 | #undef ExAllocatePool
|
---|
49 | #undef ExFreePool
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | typedef struct _VBGLDRIVER
|
---|
53 | {
|
---|
54 | #ifdef RT_OS_WINDOWS
|
---|
55 | PDEVICE_OBJECT pDeviceObject;
|
---|
56 | PFILE_OBJECT pFileObject;
|
---|
57 | #elif defined (RT_OS_LINUX)
|
---|
58 | void *opaque;
|
---|
59 | #elif defined (RT_OS_OS2)
|
---|
60 | uint32_t u32Session; /**< just for sanity checking. */
|
---|
61 | #elif defined (RT_OS_SOLARIS)
|
---|
62 | void *pvOpaque;
|
---|
63 | #elif defined (RT_OS_FREEBSD)
|
---|
64 | void *pvOpaque;
|
---|
65 | #else
|
---|
66 | # error "Port me"
|
---|
67 | #endif
|
---|
68 | } VBGLDRIVER;
|
---|
69 |
|
---|
70 | int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess);
|
---|
71 | void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size);
|
---|
72 |
|
---|
73 |
|
---|
74 | #ifndef VBGL_VBOXGUEST
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Open VBoxGuest driver.
|
---|
78 | *
|
---|
79 | * @param pDriver Pointer to the driver structure.
|
---|
80 | *
|
---|
81 | * @return VBox error code
|
---|
82 | */
|
---|
83 | int vbglDriverOpen (VBGLDRIVER *pDriver);
|
---|
84 |
|
---|
85 | /**
|
---|
86 | * Call VBoxGuest driver.
|
---|
87 | *
|
---|
88 | * @param pDriver Pointer to the driver structure.
|
---|
89 | * @param u32Function Function code.
|
---|
90 | * @param pvData Pointer to supplied in/out data buffer.
|
---|
91 | * @param cbData Size of data buffer.
|
---|
92 | *
|
---|
93 | * @return VBox error code
|
---|
94 | */
|
---|
95 | int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData);
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * Close VBoxGuest driver.
|
---|
99 | *
|
---|
100 | * @param pDriver Pointer to the driver structure.
|
---|
101 | *
|
---|
102 | * @return VBox error code
|
---|
103 | */
|
---|
104 | void vbglDriverClose (VBGLDRIVER *pDriver);
|
---|
105 |
|
---|
106 | #endif
|
---|
107 |
|
---|
108 | #endif /* __SYSHLP__H */
|
---|