VirtualBox

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

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

VbglHGCMParmPtrSetString: Use VMMDevHGCMParmType_LinAddr_In.

  • 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 22970 2009-09-12 11:53:35Z 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/VMMDev.h>
29#include <VBox/VBoxGuest.h>
30#include <VBox/VBoxGuestLib.h>
31
32RT_C_DECLS_BEGIN
33
34int vbglR3DoIOCtl(unsigned iFunction, void *pvData, size_t cbData);
35int vbglR3GRAlloc(VMMDevRequestHeader **ppReq, uint32_t cb, VMMDevRequestType enmReqType);
36int vbglR3GRPerform(VMMDevRequestHeader *pReq);
37void vbglR3GRFree(VMMDevRequestHeader *pReq);
38
39
40
41DECLINLINE(void) VbglHGCMParmUInt32Set(HGCMFunctionParameter *pParm, uint32_t u32)
42{
43 pParm->type = VMMDevHGCMParmType_32bit;
44 pParm->u.value64 = 0; /* init unused bits to 0 */
45 pParm->u.value32 = u32;
46}
47
48
49DECLINLINE(int) VbglHGCMParmUInt32Get(HGCMFunctionParameter *pParm, uint32_t *pu32)
50{
51 if (pParm->type == VMMDevHGCMParmType_32bit)
52 {
53 *pu32 = pParm->u.value32;
54 return VINF_SUCCESS;
55 }
56 return VERR_INVALID_PARAMETER;
57}
58
59
60DECLINLINE(void) VbglHGCMParmUInt64Set(HGCMFunctionParameter *pParm, uint64_t u64)
61{
62 pParm->type = VMMDevHGCMParmType_64bit;
63 pParm->u.value64 = u64;
64}
65
66
67DECLINLINE(int) VbglHGCMParmUInt64Get(HGCMFunctionParameter *pParm, uint64_t *pu64)
68{
69 if (pParm->type == VMMDevHGCMParmType_64bit)
70 {
71 *pu64 = pParm->u.value64;
72 return VINF_SUCCESS;
73 }
74 return VERR_INVALID_PARAMETER;
75}
76
77
78DECLINLINE(void) VbglHGCMParmPtrSet(HGCMFunctionParameter *pParm, void *pv, uint32_t cb)
79{
80 pParm->type = VMMDevHGCMParmType_LinAddr;
81 pParm->u.Pointer.size = cb;
82 pParm->u.Pointer.u.linearAddr = (uintptr_t)pv;
83}
84
85
86#ifdef ___iprt_string_h
87
88DECLINLINE(void) VbglHGCMParmPtrSetString(HGCMFunctionParameter *pParm, const char *psz)
89{
90 pParm->type = VMMDevHGCMParmType_LinAddr_In;
91 pParm->u.Pointer.size = (uint32_t)strlen(psz) + 1;
92 pParm->u.Pointer.u.linearAddr = (uintptr_t)psz;
93}
94
95#endif /* ___iprt_string_h */
96
97RT_C_DECLS_END
98
99#endif
100
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