VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPRegistry.cpp

Last change on this file was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/* $Id: VBoxMPRegistry.cpp 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * VBox WDDM Miniport registry related functions
4 */
5
6/*
7 * Copyright (C) 2011-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#include "common/VBoxMPCommon.h"
29
30VP_STATUS VBoxMPCmnRegInit(IN PVBOXMP_DEVEXT pExt, OUT VBOXMPCMNREGISTRY *pReg)
31{
32 WCHAR Buf[512];
33 ULONG cbBuf = sizeof(Buf);
34 NTSTATUS Status = vboxWddmRegQueryDrvKeyName(pExt, cbBuf, Buf, &cbBuf);
35 AssertNtStatusSuccess(Status);
36 if (Status == STATUS_SUCCESS)
37 {
38 Status = vboxWddmRegOpenKey(pReg, Buf, GENERIC_READ | GENERIC_WRITE);
39 AssertNtStatusSuccess(Status);
40 if(Status == STATUS_SUCCESS)
41 return NO_ERROR;
42 }
43
44 /* fall-back to make the subsequent VBoxVideoCmnRegXxx calls treat the fail accordingly
45 * basically needed to make as less modifications to the current XPDM code as possible */
46 *pReg = NULL;
47
48 return ERROR_INVALID_PARAMETER;
49}
50
51VP_STATUS VBoxMPCmnRegFini(IN VBOXMPCMNREGISTRY Reg)
52{
53 if (!Reg)
54 return ERROR_INVALID_PARAMETER;
55
56 NTSTATUS Status = ZwClose(Reg);
57 return Status == STATUS_SUCCESS ? NO_ERROR : ERROR_INVALID_PARAMETER;
58}
59
60VP_STATUS VBoxMPCmnRegQueryDword(IN VBOXMPCMNREGISTRY Reg, PCWSTR pName, uint32_t *pVal)
61{
62 /* seems like the new code assumes the Reg functions zeroes up the value on failure */
63 *pVal = 0;
64
65 if (!Reg)
66 return ERROR_INVALID_PARAMETER;
67
68 NTSTATUS Status = vboxWddmRegQueryValueDword(Reg, pName, (PDWORD)pVal);
69 return Status == STATUS_SUCCESS ? NO_ERROR : ERROR_INVALID_PARAMETER;
70}
71
72VP_STATUS VBoxMPCmnRegSetDword(IN VBOXMPCMNREGISTRY Reg, PCWSTR pName, uint32_t Val)
73{
74 if (!Reg)
75 {
76 return ERROR_INVALID_PARAMETER;
77 }
78
79 NTSTATUS Status = vboxWddmRegSetValueDword(Reg, pName, Val);
80 return Status == STATUS_SUCCESS ? NO_ERROR : ERROR_INVALID_PARAMETER;
81}
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