VBoxGuestR3LibModule.cpp revision 8e9add8eb6b051d148d0e0d3c9153fed3b851269
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Shared modules.
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * Copyright (C) 2007-2010 Oracle Corporation
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * available from http://www.virtualbox.org. This file is free software;
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * General Public License (GPL) as published by the Free Software
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * The contents of this file may alternatively be used under the terms
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * of the Common Development and Distribution License Version 1.0
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * VirtualBox OSE distribution, in which case the provisions of the
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * CDDL are applicable instead of those of the GPL.
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * You may elect to license modified versions of this file under the
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * terms and conditions of either the GPL or the CDDL or both.
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync/*******************************************************************************
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync* Header Files *
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync*******************************************************************************/
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * Registers a new shared module for the VM
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @returns IPRT status code.
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @param pszModuleName Module name
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @param pszVersion Module version
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @param GCBaseAddr Module base address
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @param cbModule Module size
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @param cRegions Number of shared region descriptors
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @param pRegions Shared region(s)
f8df398d066204e2bf0ba209ea3554fc113fb484vboxsyncVBGLR3DECL(int) VbglR3RegisterSharedModule(char *pszModuleName, char *pszVersion,
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync unsigned cRegions, VMMDEVSHAREDREGIONDESC *pRegions)
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync /* Sanity check. */
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync AssertReturn(cRegions < VMMDEVSHAREDREGIONDESC_MAX, VERR_INVALID_PARAMETER);
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync pReq = (VMMDevSharedModuleRegistrationRequest *)RTMemAllocZ(RT_OFFSETOF(VMMDevSharedModuleRegistrationRequest, aRegions[cRegions]));
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync vmmdevInitRequest(&pReq->header, VMMDevReq_RegisterSharedModule);
a2269e19277f3a9d353323ea6cd8e14451323cd6vboxsync pReq->header.size = RT_OFFSETOF(VMMDevSharedModuleRegistrationRequest, aRegions[cRegions]);
4f4da0da54c6ffb166be2538d43cd0f79e0eb97cvboxsync /** todo */
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync for (unsigned i = 0; i < cRegions; i++)
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync if ( RTStrCopy(pReq->szName, sizeof(pReq->szName), pszModuleName) != VINF_SUCCESS
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync || RTStrCopy(pReq->szVersion, sizeof(pReq->szVersion), pszVersion) != VINF_SUCCESS)
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * Unregisters a shared module for the VM
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @returns IPRT status code.
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @param pszModuleName Module name
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @param pszVersion Module version
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @param GCBaseAddr Module base address
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @param cbModule Module size
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsyncVBGLR3DECL(int) VbglR3UnregisterSharedModule(char *pszModuleName, char *pszVersion, RTGCPTR64 GCBaseAddr, uint32_t cbModule)
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync vmmdevInitRequest(&Req.header, VMMDevReq_UnregisterSharedModule);
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync if ( RTStrCopy(Req.szName, sizeof(Req.szName), pszModuleName) != VINF_SUCCESS
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync || RTStrCopy(Req.szVersion, sizeof(Req.szVersion), pszVersion) != VINF_SUCCESS)
4f4da0da54c6ffb166be2538d43cd0f79e0eb97cvboxsync * Checks registered modules for shared pages
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync * @returns IPRT status code.
11cb3503f2fc9b6a75d10d35fe97886703c46dc9vboxsync vmmdevInitRequest(&Req.header, VMMDevReq_CheckSharedModules);
4f4da0da54c6ffb166be2538d43cd0f79e0eb97cvboxsync * Checks if page sharing is enabled.
4f4da0da54c6ffb166be2538d43cd0f79e0eb97cvboxsync vmmdevInitRequest(&Req.header, VMMDevReq_GetPageSharingStatus);
4f4da0da54c6ffb166be2538d43cd0f79e0eb97cvboxsync return false;