2
* VBoxGuestLib - Central calls header.
6
* Copyright (C) 2012 Oracle Corporation
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.
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.
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.
26
/* Entire file is ifdef'ed with !VBGL_VBOXGUEST */
28
# error "VBGL_VBOXGUEST should not be defined"
30
#include "VBoxGuestR0LibCrOgl.h"
32
#include <iprt/string.h>
34
#include "VBGLInternal.h"
36
struct VBGLHGCMHANDLEDATA *vbglHGCMHandleAlloc (void);
37
void vbglHGCMHandleFree (struct VBGLHGCMHANDLEDATA *pHandle);
39
DECLVBGL(int) vboxCrCtlCreate(HVBOXCRCTL *phCtl)
42
struct VBGLHGCMHANDLEDATA *pHandleData;
45
return VERR_INVALID_PARAMETER;
47
pHandleData = vbglHGCMHandleAlloc ();
57
rc = vbglDriverOpen (&pHandleData->driver);
65
vbglHGCMHandleFree (pHandleData);
72
DECLVBGL(int) vboxCrCtlDestroy(HVBOXCRCTL hCtl)
74
vbglDriverClose(&hCtl->driver);
76
vbglHGCMHandleFree(hCtl);
81
DECLVBGL(int) vboxCrCtlConConnect(HVBOXCRCTL hCtl, uint32_t *pu32ClientID)
83
VBoxGuestHGCMConnectInfo info;
86
if (!hCtl || !pu32ClientID)
87
return VERR_INVALID_PARAMETER;
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));
94
*pu32ClientID = info.u32ClientID;
100
DECLVBGL(int) vboxCrCtlConDisconnect(HVBOXCRCTL hCtl, uint32_t u32ClientID)
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));
108
DECLVBGL(int) vboxCrCtlConCall(HVBOXCRCTL hCtl, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo)
110
return vbglDriverIOCtl (&hCtl->driver, VBOXGUEST_IOCTL_HGCM_CALL(cbCallInfo), pCallInfo, cbCallInfo);
113
DECLVBGL(int) vboxCrCtlConCallUserData(HVBOXCRCTL hCtl, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo)
115
return vbglDriverIOCtl (&hCtl->driver, VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(cbCallInfo), pCallInfo, cbCallInfo);
118
#endif /* #ifndef VBGL_VBOXGUEST */