1 | /* $Id: VBGLR3Internal.h 18451 2009-03-28 04:04:18Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxGuestR3Lib - Ring-3 support library for the guest additions, Internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef ___VBGLR3Internal_h
|
---|
23 | #define ___VBGLR3Internal_h
|
---|
24 |
|
---|
25 | #if defined(RT_OS_WINDOWS)
|
---|
26 | # include <Windows.h>
|
---|
27 | #endif
|
---|
28 | #include <VBox/VBoxGuest.h>
|
---|
29 |
|
---|
30 | __BEGIN_DECLS
|
---|
31 |
|
---|
32 | int vbglR3DoIOCtl(unsigned iFunction, void *pvData, size_t cbData);
|
---|
33 | int vbglR3GRAlloc(VMMDevRequestHeader **ppReq, uint32_t cb, VMMDevRequestType enmReqType);
|
---|
34 | int vbglR3GRPerform(VMMDevRequestHeader *pReq);
|
---|
35 | void vbglR3GRFree(VMMDevRequestHeader *pReq);
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 | DECLINLINE(void) VbglHGCMParmUInt32Set(HGCMFunctionParameter *pParm, uint32_t u32)
|
---|
40 | {
|
---|
41 | pParm->type = VMMDevHGCMParmType_32bit;
|
---|
42 | pParm->u.value64 = 0; /* init unused bits to 0 */
|
---|
43 | pParm->u.value32 = u32;
|
---|
44 | }
|
---|
45 |
|
---|
46 |
|
---|
47 | DECLINLINE(int) VbglHGCMParmUInt32Get(HGCMFunctionParameter *pParm, uint32_t *pu32)
|
---|
48 | {
|
---|
49 | if (pParm->type == VMMDevHGCMParmType_32bit)
|
---|
50 | {
|
---|
51 | *pu32 = pParm->u.value32;
|
---|
52 | return VINF_SUCCESS;
|
---|
53 | }
|
---|
54 | return VERR_INVALID_PARAMETER;
|
---|
55 | }
|
---|
56 |
|
---|
57 |
|
---|
58 | DECLINLINE(void) VbglHGCMParmUInt64Set(HGCMFunctionParameter *pParm, uint64_t u64)
|
---|
59 | {
|
---|
60 | pParm->type = VMMDevHGCMParmType_64bit;
|
---|
61 | pParm->u.value64 = u64;
|
---|
62 | }
|
---|
63 |
|
---|
64 |
|
---|
65 | DECLINLINE(int) VbglHGCMParmUInt64Get(HGCMFunctionParameter *pParm, uint64_t *pu64)
|
---|
66 | {
|
---|
67 | if (pParm->type == VMMDevHGCMParmType_64bit)
|
---|
68 | {
|
---|
69 | *pu64 = pParm->u.value64;
|
---|
70 | return VINF_SUCCESS;
|
---|
71 | }
|
---|
72 | return VERR_INVALID_PARAMETER;
|
---|
73 | }
|
---|
74 |
|
---|
75 |
|
---|
76 | DECLINLINE(void) VbglHGCMParmPtrSet(HGCMFunctionParameter *pParm, void *pv, uint32_t cb)
|
---|
77 | {
|
---|
78 | pParm->type = VMMDevHGCMParmType_LinAddr;
|
---|
79 | pParm->u.Pointer.size = cb;
|
---|
80 | pParm->u.Pointer.u.linearAddr = (uintptr_t)pv;
|
---|
81 | }
|
---|
82 |
|
---|
83 |
|
---|
84 | #ifdef ___iprt_string_h
|
---|
85 |
|
---|
86 | DECLINLINE(void) VbglHGCMParmPtrSetString(HGCMFunctionParameter *pParm, const char *psz)
|
---|
87 | {
|
---|
88 | pParm->type = VMMDevHGCMParmType_LinAddr;
|
---|
89 | pParm->u.Pointer.size = (uint32_t)strlen(psz) + 1;
|
---|
90 | pParm->u.Pointer.u.linearAddr = (uintptr_t)psz;
|
---|
91 | }
|
---|
92 |
|
---|
93 | #endif /* ___iprt_string_h */
|
---|
94 |
|
---|
95 | __END_DECLS
|
---|
96 |
|
---|
97 | #endif
|
---|