VirtualBox

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

Last change on this file since 63450 was 63090, checked in by vboxsync, 9 years ago

GA/NT/Installer: warnings

  • 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 63090 2016-08-06 15:07:45Z vboxsync $ */
2/** @file
3 * delinvalid - remove "InvalidDisplay" key on NT4
4 */
5
6/*
7 * Copyright (C) 2006-2016 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* Header Files *
33*********************************************************************************************************************************/
34//#define _UNICODE
35
36#include <iprt/win/windows.h>
37#include <iprt/win/setupapi.h>
38#include <regstr.h>
39#include <DEVGUID.h>
40#include <stdio.h>
41
42#include "tchar.h"
43#include "string.h"
44
45
46BOOL isNT4(void)
47{
48 OSVERSIONINFO OSversion;
49
50 OSversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
51 ::GetVersionEx(&OSversion);
52
53 switch (OSversion.dwPlatformId)
54 {
55 case VER_PLATFORM_WIN32s:
56 case VER_PLATFORM_WIN32_WINDOWS:
57 return FALSE;
58 case VER_PLATFORM_WIN32_NT:
59 if (OSversion.dwMajorVersion == 4)
60 return TRUE;
61 else return FALSE;
62 default:
63 break;
64 }
65 return FALSE;
66}
67
68int main()
69{
70 int rc = 0;
71
72 /* This program is only for installing drivers on NT4 */
73 if (!isNT4())
74 {
75 printf("This program only runs on NT4\n");
76 return -1;
77 }
78
79 /* Delete the "InvalidDisplay" key which causes the display
80 applet to be started on every boot. For some reason this key
81 isn't removed after setting the proper resolution and even not when
82 doing a driverreinstall. */
83 RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\GraphicsDrivers\\InvalidDisplay"));
84 RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\GraphicsDrivers\\NewDisplay"));
85
86 return rc;
87}
88
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette