VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibCrOgl.cpp@ 44824

Last change on this file since 44824 was 40483, checked in by vboxsync, 13 years ago

crOpenGL/wddm: don't use VBoxGuest device to comply woth Metro apps security

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/** @file
2 * VBoxGuestLib - Central calls header.
3 */
4
5/*
6 * Copyright (C) 2012 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26/* Entire file is ifdef'ed with !VBGL_VBOXGUEST */
27#ifdef VBGL_VBOXGUEST
28# error "VBGL_VBOXGUEST should not be defined"
29#else
30#include "VBoxGuestR0LibCrOgl.h"
31
32#include <iprt/string.h>
33
34#include "VBGLInternal.h"
35
36struct VBGLHGCMHANDLEDATA *vbglHGCMHandleAlloc (void);
37void vbglHGCMHandleFree (struct VBGLHGCMHANDLEDATA *pHandle);
38
39DECLVBGL(int) vboxCrCtlCreate(HVBOXCRCTL *phCtl)
40{
41 int rc;
42 struct VBGLHGCMHANDLEDATA *pHandleData;
43
44 if (!phCtl)
45 return VERR_INVALID_PARAMETER;
46
47 pHandleData = vbglHGCMHandleAlloc ();
48
49 rc = VINF_SUCCESS;
50
51 if (!pHandleData)
52 {
53 rc = VERR_NO_MEMORY;
54 }
55 else
56 {
57 rc = vbglDriverOpen (&pHandleData->driver);
58
59 if (RT_SUCCESS(rc))
60 {
61 *phCtl = pHandleData;
62 return VINF_SUCCESS;
63 }
64
65 vbglHGCMHandleFree (pHandleData);
66 }
67
68 *phCtl = NULL;
69 return rc;
70}
71
72DECLVBGL(int) vboxCrCtlDestroy(HVBOXCRCTL hCtl)
73{
74 vbglDriverClose(&hCtl->driver);
75
76 vbglHGCMHandleFree(hCtl);
77
78 return VINF_SUCCESS;
79}
80
81DECLVBGL(int) vboxCrCtlConConnect(HVBOXCRCTL hCtl, uint32_t *pu32ClientID)
82{
83 VBoxGuestHGCMConnectInfo info;
84 int rc;
85
86 if (!hCtl || !pu32ClientID)
87 return VERR_INVALID_PARAMETER;
88
89 memset(&info, 0, sizeof (info));
90 info.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
91 RTStrCopy(info.Loc.u.host.achName, sizeof (info.Loc.u.host.achName), "VBoxSharedCrOpenGL");
92 rc = vbglDriverIOCtl (&hCtl->driver, VBOXGUEST_IOCTL_HGCM_CONNECT, &info, sizeof (info));
93 if (RT_SUCCESS(rc))
94 *pu32ClientID = info.u32ClientID;
95 else
96 *pu32ClientID = 0;
97 return rc;
98}
99
100DECLVBGL(int) vboxCrCtlConDisconnect(HVBOXCRCTL hCtl, uint32_t u32ClientID)
101{
102 VBoxGuestHGCMDisconnectInfo info;
103 memset (&info, 0, sizeof (info));
104 info.u32ClientID = u32ClientID;
105 return vbglDriverIOCtl (&hCtl->driver, VBOXGUEST_IOCTL_HGCM_DISCONNECT, &info, sizeof (info));
106}
107
108DECLVBGL(int) vboxCrCtlConCall(HVBOXCRCTL hCtl, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo)
109{
110 return vbglDriverIOCtl (&hCtl->driver, VBOXGUEST_IOCTL_HGCM_CALL(cbCallInfo), pCallInfo, cbCallInfo);
111}
112
113DECLVBGL(int) vboxCrCtlConCallUserData(HVBOXCRCTL hCtl, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo)
114{
115 return vbglDriverIOCtl (&hCtl->driver, VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(cbCallInfo), pCallInfo, cbCallInfo);
116}
117
118#endif /* #ifndef VBGL_VBOXGUEST */
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