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 innotek GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
14 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef __SYSHLP__H
|
---|
20 | #define __SYSHLP__H
|
---|
21 |
|
---|
22 | #ifdef RT_OS_WINDOWS
|
---|
23 | # if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
|
---|
24 | # include <iprt/asm.h>
|
---|
25 | # define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
|
---|
26 | # define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
|
---|
27 | # define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
|
---|
28 | # define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
|
---|
29 | __BEGIN_DECLS
|
---|
30 | # include <ntddk.h>
|
---|
31 | __END_DECLS
|
---|
32 | # undef _InterlockedExchange
|
---|
33 | # undef _InterlockedExchangeAdd
|
---|
34 | # undef _InterlockedCompareExchange
|
---|
35 | # undef _InterlockedAddLargeStatistic
|
---|
36 | # else
|
---|
37 | __BEGIN_DECLS
|
---|
38 | # include <ntddk.h>
|
---|
39 | __END_DECLS
|
---|
40 | # endif
|
---|
41 | /* XP DDK #defines ExFreePool to ExFreePoolWithTag. The latter does not exist on NT4, so...
|
---|
42 | * The same for ExAllocatePool.
|
---|
43 | */
|
---|
44 | #undef ExAllocatePool
|
---|
45 | #undef ExFreePool
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | typedef struct _VBGLDRIVER
|
---|
49 | {
|
---|
50 | #ifdef RT_OS_WINDOWS
|
---|
51 | PDEVICE_OBJECT pDeviceObject;
|
---|
52 | PFILE_OBJECT pFileObject;
|
---|
53 | #elif defined (RT_OS_LINUX)
|
---|
54 | void *opaque;
|
---|
55 | #elif defined (RT_OS_OS2)
|
---|
56 | uint32_t u32Session; /**< just for sanity checking. */
|
---|
57 | #else
|
---|
58 | # error "Port me"
|
---|
59 | #endif
|
---|
60 | } VBGLDRIVER;
|
---|
61 |
|
---|
62 | int vbglLockLinear (void **ppvCtx, void *pv, uint32_t u32Size, bool fWriteAccess);
|
---|
63 | void vbglUnlockLinear (void *pvCtx, void *pv, uint32_t u32Size);
|
---|
64 |
|
---|
65 |
|
---|
66 | #ifndef VBGL_VBOXGUEST
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Open VBoxGuest driver.
|
---|
70 | *
|
---|
71 | * @param pDriver Pointer to the driver structure.
|
---|
72 | *
|
---|
73 | * @return VBox error code
|
---|
74 | */
|
---|
75 | int vbglDriverOpen (VBGLDRIVER *pDriver);
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Call VBoxGuest driver.
|
---|
79 | *
|
---|
80 | * @param pDriver Pointer to the driver structure.
|
---|
81 | * @param u32Function Function code.
|
---|
82 | * @param pvData Pointer to supplied in/out data buffer.
|
---|
83 | * @param cbData Size of data buffer.
|
---|
84 | *
|
---|
85 | * @return VBox error code
|
---|
86 | */
|
---|
87 | int vbglDriverIOCtl (VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData);
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Close VBoxGuest driver.
|
---|
91 | *
|
---|
92 | * @param pDriver Pointer to the driver structure.
|
---|
93 | *
|
---|
94 | * @return VBox error code
|
---|
95 | */
|
---|
96 | void vbglDriverClose (VBGLDRIVER *pDriver);
|
---|
97 |
|
---|
98 | #endif
|
---|
99 |
|
---|
100 | #endif /* __SYSHLP__H */
|
---|