VirtualBox

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

Last change on this file since 58029 was 56294, checked in by vboxsync, 10 years ago

Additions/common,Additions/os2: Updated (C) year.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/* $Id: VBGLR3Internal.h 56294 2015-06-09 14:26:20Z vboxsync $ */
2/** @file
3 * VBoxGuestR3Lib - Ring-3 support library for the guest additions, Internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2015 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 ___VBGLR3Internal_h
28#define ___VBGLR3Internal_h
29
30#if defined(RT_OS_WINDOWS) /** @todo explain why this is here. */
31# include <Windows.h>
32#endif
33#include <VBox/VMMDev.h>
34#include <VBox/VBoxGuest.h>
35#include <VBox/VBoxGuestLib.h>
36
37#ifdef VBOX_VBGLR3_XFREE86
38/* Rather than try to resolve all the header file conflicts, I will just
39 prototype what we need here. */
40typedef unsigned long xf86size_t;
41extern "C" xf86size_t xf86strlen(const char*);
42# undef strlen
43# define strlen xf86strlen
44#endif /* VBOX_VBGLR3_XFREE86 */
45
46RT_C_DECLS_BEGIN
47
48int vbglR3DoIOCtl(unsigned iFunction, void *pvData, size_t cbData);
49int vbglR3GRAlloc(VMMDevRequestHeader **ppReq, uint32_t cb, VMMDevRequestType enmReqType);
50int vbglR3GRPerform(VMMDevRequestHeader *pReq);
51void vbglR3GRFree(VMMDevRequestHeader *pReq);
52
53
54
55DECLINLINE(void) VbglHGCMParmUInt32Set(HGCMFunctionParameter *pParm, uint32_t u32)
56{
57 pParm->type = VMMDevHGCMParmType_32bit;
58 pParm->u.value64 = 0; /* init unused bits to 0 */
59 pParm->u.value32 = u32;
60}
61
62
63DECLINLINE(int) VbglHGCMParmUInt32Get(HGCMFunctionParameter *pParm, uint32_t *pu32)
64{
65 if (pParm->type == VMMDevHGCMParmType_32bit)
66 {
67 *pu32 = pParm->u.value32;
68 return VINF_SUCCESS;
69 }
70 return VERR_INVALID_PARAMETER;
71}
72
73
74DECLINLINE(void) VbglHGCMParmUInt64Set(HGCMFunctionParameter *pParm, uint64_t u64)
75{
76 pParm->type = VMMDevHGCMParmType_64bit;
77 pParm->u.value64 = u64;
78}
79
80
81DECLINLINE(int) VbglHGCMParmUInt64Get(HGCMFunctionParameter *pParm, uint64_t *pu64)
82{
83 if (pParm->type == VMMDevHGCMParmType_64bit)
84 {
85 *pu64 = pParm->u.value64;
86 return VINF_SUCCESS;
87 }
88 return VERR_INVALID_PARAMETER;
89}
90
91
92DECLINLINE(void) VbglHGCMParmPtrSet(HGCMFunctionParameter *pParm, void *pv, uint32_t cb)
93{
94 pParm->type = VMMDevHGCMParmType_LinAddr;
95 pParm->u.Pointer.size = cb;
96 pParm->u.Pointer.u.linearAddr = (uintptr_t)pv;
97}
98
99
100#ifdef ___iprt_string_h
101
102DECLINLINE(void) VbglHGCMParmPtrSetString(HGCMFunctionParameter *pParm, const char *psz)
103{
104 pParm->type = VMMDevHGCMParmType_LinAddr_In;
105 pParm->u.Pointer.size = (uint32_t)strlen(psz) + 1;
106 pParm->u.Pointer.u.linearAddr = (uintptr_t)psz;
107}
108
109#endif /* ___iprt_string_h */
110
111#ifdef VBOX_VBGLR3_XFREE86
112# undef strlen
113#endif /* VBOX_VBGLR3_XFREE86 */
114
115RT_C_DECLS_END
116
117#endif
118
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