VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Installer/RegCleanup.cpp

Last change on this file was 98103, checked in by vboxsync, 16 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.9 KB
RevLine 
[63090]1/* $Id: RegCleanup.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
[31634]2/** @file
[96372]3 * RegCleanup - Remove "InvalidDisplay" and "NewDisplay" keys on NT4,
4 * run via HKLM/.../Windows/CurrentVersion/RunOnce.
5 *
6 * Delete the "InvalidDisplay" key which causes the display applet to be
7 * started on every boot. For some reason this key isn't removed after
8 * setting the proper resolution and even not when * doing a driver reinstall.
9 * Removing it doesn't seem to do any harm. The key is inserted by windows on
10 * first reboot after installing the VBox video driver using the VirtualBox
11 * utility. It's not inserted when using the Display applet for installation.
12 * There seems to be a subtle problem with the VirtualBox util.
[63090]13 */
14
15/*
[98103]16 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
[31634]17 *
[96407]18 * This file is part of VirtualBox base platform packages, as
19 * available from https://www.virtualbox.org.
20 *
21 * This program is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU General Public License
23 * as published by the Free Software Foundation, in version 3 of the
24 * License.
25 *
26 * This program is distributed in the hope that it will be useful, but
27 * WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * General Public License for more details.
30 *
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, see <https://www.gnu.org/licenses>.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only
[31634]35 */
36
37
[63090]38/*********************************************************************************************************************************
39* Header Files *
40*********************************************************************************************************************************/
[62679]41#include <iprt/win/windows.h>
[96375]42#include <iprt/cdefs.h> /* RT_STR_TUPLE */
[96389]43#include <iprt/types.h> /* RTEXITCODE_FAILURE */
[31634]44
45
[96387]46static bool IsNt4(void)
[31634]47{
[96387]48 OSVERSIONINFOW VerInfo = { sizeof(VerInfo), 0 };
49 GetVersionExW(&VerInfo);
50 return VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT
51 && VerInfo.dwMajorVersion == 4;
[31634]52}
53
[96372]54
[63090]55int main()
[31634]56{
[96387]57 if (!IsNt4())
[31634]58 {
[96372]59 DWORD cbIgn;
60 WriteFile(GetStdHandle(STD_ERROR_HANDLE), RT_STR_TUPLE("This program only runs on NT4\r\n"), &cbIgn, NULL);
[96387]61 return RTEXITCODE_FAILURE;
[31634]62 }
63
64 /* Delete the "InvalidDisplay" key which causes the display
[96372]65 applet to be started on every boot. For some reason this key
66 isn't removed after setting the proper resolution and even not when
67 doing a driverreinstall. */
68 RegDeleteKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\GraphicsDrivers\\InvalidDisplay");
69 RegDeleteKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\GraphicsDrivers\\NewDisplay");
[96387]70 return RTEXITCODE_SUCCESS;
[31634]71}
[63090]72
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use