1 | /* $Id: SysHlp.h 62685 2016-07-29 13:18:33Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxGuestLibR0 - System dependent helpers internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2016 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 | # include <iprt/nt/ntddk.h>
|
---|
36 | /* XP DDK #defines ExFreePool to ExFreePoolWithTag. The latter does not exist on NT4, so...
|
---|
37 | * The same for ExAllocatePool.
|
---|
38 | */
|
---|
39 | # undef ExAllocatePool
|
---|
40 | # undef ExFreePool
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | typedef struct _VBGLDRIVER
|
---|
44 | {
|
---|
45 | #ifdef RT_OS_WINDOWS
|
---|
46 | PDEVICE_OBJECT pDeviceObject;
|
---|
47 | PFILE_OBJECT pFileObject;
|
---|
48 | #elif defined (RT_OS_OS2)
|
---|
49 | uint32_t u32Session; /**< just for sanity checking. */
|
---|
50 | #else /* PORTME */
|
---|
51 | void *pvOpaque;
|
---|
52 | #endif
|
---|
53 | } VBGLDRIVER;
|
---|
54 |
|
---|
55 | int vbglLockLinear(void **ppvCtx, void *pv, uint32_t cb, bool fWriteAccess, uint32_t fFlags);
|
---|
56 | void vbglUnlockLinear(void *pvCtx, void *pv, uint32_t cb);
|
---|
57 |
|
---|
58 |
|
---|
59 | #ifndef VBGL_VBOXGUEST
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Open VBoxGuest driver.
|
---|
63 | *
|
---|
64 | * @param pDriver Pointer to the driver structure.
|
---|
65 | *
|
---|
66 | * @return VBox status code
|
---|
67 | */
|
---|
68 | int vbglDriverOpen(VBGLDRIVER *pDriver);
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Answers whether the VBoxGuest driver is opened
|
---|
72 | *
|
---|
73 | * @param pDriver Pointer to the driver structure.
|
---|
74 | *
|
---|
75 | * @return true - if opened, false - otherwise
|
---|
76 | */
|
---|
77 | bool vbglDriverIsOpened(VBGLDRIVER *pDriver);
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Call VBoxGuest driver.
|
---|
81 | *
|
---|
82 | * @param pDriver Pointer to the driver structure.
|
---|
83 | * @param u32Function Function code.
|
---|
84 | * @param pvData Pointer to supplied in/out data buffer.
|
---|
85 | * @param cbData Size of data buffer.
|
---|
86 | *
|
---|
87 | * @returns VBox status code
|
---|
88 | */
|
---|
89 | int vbglDriverIOCtl(VBGLDRIVER *pDriver, uint32_t u32Function, void *pvData, uint32_t cbData);
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * Close VBoxGuest driver.
|
---|
93 | *
|
---|
94 | * @param pDriver Pointer to the driver structure.
|
---|
95 | *
|
---|
96 | * @returns VBox status code
|
---|
97 | */
|
---|
98 | void vbglDriverClose(VBGLDRIVER *pDriver);
|
---|
99 |
|
---|
100 | #endif
|
---|
101 |
|
---|
102 | #endif
|
---|
103 |
|
---|