VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuestLib/VBGLR3Internal.h@ 21211

Last change on this file since 21211 was 21211, checked in by vboxsync, 15 years ago

VBoxGuest.h,VBoxGuestLib: Moved the VbglR3 API out of VBoxGuest.h and did some cleanup.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1/* $Id: VBGLR3Internal.h 21211 2009-07-03 15:12:24Z 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) /** @todo explain why this is here. */
26# include <Windows.h>
27#endif
28#include <VBox/VBoxGuest.h>
29#include <VBox/VBoxGuestLib.h>
30
31RT_C_DECLS_BEGIN
32
33int vbglR3DoIOCtl(unsigned iFunction, void *pvData, size_t cbData);
34int vbglR3GRAlloc(VMMDevRequestHeader **ppReq, uint32_t cb, VMMDevRequestType enmReqType);
35int vbglR3GRPerform(VMMDevRequestHeader *pReq);
36void vbglR3GRFree(VMMDevRequestHeader *pReq);
37
38
39
40DECLINLINE(void) VbglHGCMParmUInt32Set(HGCMFunctionParameter *pParm, uint32_t u32)
41{
42 pParm->type = VMMDevHGCMParmType_32bit;
43 pParm->u.value64 = 0; /* init unused bits to 0 */
44 pParm->u.value32 = u32;
45}
46
47
48DECLINLINE(int) VbglHGCMParmUInt32Get(HGCMFunctionParameter *pParm, uint32_t *pu32)
49{
50 if (pParm->type == VMMDevHGCMParmType_32bit)
51 {
52 *pu32 = pParm->u.value32;
53 return VINF_SUCCESS;
54 }
55 return VERR_INVALID_PARAMETER;
56}
57
58
59DECLINLINE(void) VbglHGCMParmUInt64Set(HGCMFunctionParameter *pParm, uint64_t u64)
60{
61 pParm->type = VMMDevHGCMParmType_64bit;
62 pParm->u.value64 = u64;
63}
64
65
66DECLINLINE(int) VbglHGCMParmUInt64Get(HGCMFunctionParameter *pParm, uint64_t *pu64)
67{
68 if (pParm->type == VMMDevHGCMParmType_64bit)
69 {
70 *pu64 = pParm->u.value64;
71 return VINF_SUCCESS;
72 }
73 return VERR_INVALID_PARAMETER;
74}
75
76
77DECLINLINE(void) VbglHGCMParmPtrSet(HGCMFunctionParameter *pParm, void *pv, uint32_t cb)
78{
79 pParm->type = VMMDevHGCMParmType_LinAddr;
80 pParm->u.Pointer.size = cb;
81 pParm->u.Pointer.u.linearAddr = (uintptr_t)pv;
82}
83
84
85#ifdef ___iprt_string_h
86
87DECLINLINE(void) VbglHGCMParmPtrSetString(HGCMFunctionParameter *pParm, const char *psz)
88{
89 pParm->type = VMMDevHGCMParmType_LinAddr;
90 pParm->u.Pointer.size = (uint32_t)strlen(psz) + 1;
91 pParm->u.Pointer.u.linearAddr = (uintptr_t)psz;
92}
93
94#endif /* ___iprt_string_h */
95
96RT_C_DECLS_END
97
98#endif
99
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette