VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp@ 52002

Last change on this file since 52002 was 50523, checked in by vboxsync, 11 years ago

Addiitions/common/VBoxGuest, VBoxGuestLibR3: add mediation in the guest driver for guest capabilities, mouse status and event filtering.

  • Property svn:eol-style set to native
  • Property svn:keyword set to Id
  • Property svn:keywords set to Id Revision
File size: 3.1 KB
Line 
1/* $Id: VBoxGuestR3LibMisc.cpp 50523 2014-02-20 12:00:58Z vboxsync $ */
2/** @file
3 * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Misc.
4 */
5
6/*
7 * Copyright (C) 2007-2010 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
28/*******************************************************************************
29* Header Files *
30*******************************************************************************/
31#include <VBox/log.h>
32#include "VBGLR3Internal.h"
33
34
35/**
36 * Change the IRQ filter mask.
37 *
38 * @returns IPRT status code.
39 * @param fOr The OR mask.
40 * @param fNo The NOT mask.
41 */
42VBGLR3DECL(int) VbglR3CtlFilterMask(uint32_t fOr, uint32_t fNot)
43{
44 VBoxGuestFilterMaskInfo Info;
45 Info.u32OrMask = fOr;
46 Info.u32NotMask = fNot;
47 return vbglR3DoIOCtl(VBOXGUEST_IOCTL_CTL_FILTER_MASK, &Info, sizeof(Info));
48}
49
50
51/**
52 * Report a change in the capabilities that we support to the host.
53 *
54 * @returns IPRT status code.
55 * @param fOr Capabilities which have been added.
56 * @param fNot Capabilities which have been removed.
57 *
58 * @todo Move to a different file.
59 */
60VBGLR3DECL(int) VbglR3SetGuestCaps(uint32_t fOr, uint32_t fNot)
61{
62 VBoxGuestSetCapabilitiesInfo Info;
63 Info.u32OrMask = fOr;
64 Info.u32NotMask = fNot;
65 return vbglR3DoIOCtl(VBOXGUEST_IOCTL_SET_GUEST_CAPABILITIES, &Info,
66 sizeof(Info));
67}
68
69
70/**
71 * Query the session ID of this VM.
72 *
73 * The session id is an unique identifier that gets changed for each VM start,
74 * reset or restore. Useful for detection a VM restore.
75 *
76 * @returns IPRT status code.
77 * @param pu64IdSession Session id (out). This is NOT changed on
78 * failure, so the caller can depend on this to
79 * deal with backward compatibility (see
80 * VBoxServiceVMInfoWorker() for an example.)
81 */
82VBGLR3DECL(int) VbglR3GetSessionId(uint64_t *pu64IdSession)
83{
84 VMMDevReqSessionId Req;
85
86 vmmdevInitRequest(&Req.header, VMMDevReq_GetSessionId);
87 Req.idSession = 0;
88 int rc = vbglR3GRPerform(&Req.header);
89 if (RT_SUCCESS(rc))
90 *pu64IdSession = Req.idSession;
91
92 return rc;
93}
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