VirtualBox

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

Last change on this file since 76934 was 76553, checked in by vboxsync, 5 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1/* $Id: RegCleanup.cpp 76553 2019-01-01 01:45:53Z vboxsync $ */
2/** @file
3 * delinvalid - remove "InvalidDisplay" key on NT4
4 */
5
6/*
7 * Copyright (C) 2006-2019 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
18/*
19 Purpose:
20
21 Delete the "InvalidDisplay" key which causes the display
22 applet to be started on every boot. For some reason this key
23 isn't removed after setting the proper resolution and even not when
24 doing a driver reinstall. Removing it doesn't seem to do any harm.
25 The key is inserted by windows on first reboot after installing
26 the VBox video driver using the VirtualBox utility.
27 It's not inserted when using the Display applet for installation.
28 There seems to be a subtle problem with the VirtualBox util.
29 */
30
31
32/*********************************************************************************************************************************
33* Header Files *
34*********************************************************************************************************************************/
35//#define _UNICODE
36
37#include <iprt/win/windows.h>
38#include <iprt/win/setupapi.h>
39#include <regstr.h>
40#include <DEVGUID.h>
41#include <stdio.h>
42
43#include "tchar.h"
44#include "string.h"
45
46
47BOOL isNT4(void)
48{
49 OSVERSIONINFO OSversion;
50
51 OSversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
52 ::GetVersionEx(&OSversion);
53
54 switch (OSversion.dwPlatformId)
55 {
56 case VER_PLATFORM_WIN32s:
57 case VER_PLATFORM_WIN32_WINDOWS:
58 return FALSE;
59 case VER_PLATFORM_WIN32_NT:
60 if (OSversion.dwMajorVersion == 4)
61 return TRUE;
62 else return FALSE;
63 default:
64 break;
65 }
66 return FALSE;
67}
68
69int main()
70{
71 int rc = 0;
72
73 /* This program is only for installing drivers on NT4 */
74 if (!isNT4())
75 {
76 printf("This program only runs on NT4\n");
77 return -1;
78 }
79
80 /* Delete the "InvalidDisplay" key which causes the display
81 applet to be started on every boot. For some reason this key
82 isn't removed after setting the proper resolution and even not when
83 doing a driverreinstall. */
84 RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\GraphicsDrivers\\InvalidDisplay"));
85 RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\GraphicsDrivers\\NewDisplay"));
86
87 return rc;
88}
89
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use