1 | /** @file
|
---|
2 | *
|
---|
3 | * delinvalid - remove "InvalidDisplay" key on NT4
|
---|
4 | *
|
---|
5 | * Copyright (C) 2006-2007 Oracle Corporation
|
---|
6 | *
|
---|
7 | * Oracle Corporation confidential
|
---|
8 | * All rights reserved
|
---|
9 | */
|
---|
10 |
|
---|
11 | /*
|
---|
12 | Purpose:
|
---|
13 |
|
---|
14 | Delete the "InvalidDisplay" key which causes the display
|
---|
15 | applet to be started on every boot. For some reason this key
|
---|
16 | isn't removed after setting the proper resolution and even not when
|
---|
17 | doing a driver reinstall. Removing it doesn't seem to do any harm.
|
---|
18 | The key is inserted by windows on first reboot after installing
|
---|
19 | the VBox video driver using the VirtualBox utility.
|
---|
20 | It's not inserted when using the Display applet for installation.
|
---|
21 | There seems to be a subtle problem with the VirtualBox util.
|
---|
22 | */
|
---|
23 |
|
---|
24 | //#define _UNICODE
|
---|
25 |
|
---|
26 | #include <windows.h>
|
---|
27 | #include <setupapi.h>
|
---|
28 | #include <regstr.h>
|
---|
29 | #include <DEVGUID.h>
|
---|
30 | #include <stdio.h>
|
---|
31 |
|
---|
32 | #include "tchar.h"
|
---|
33 | #include "string.h"
|
---|
34 |
|
---|
35 | /*******************************************************************************
|
---|
36 | * Defined Constants And Macros *
|
---|
37 | *******************************************************************************/
|
---|
38 |
|
---|
39 | /////////////////////////////////////////////////////////////////////////////
|
---|
40 |
|
---|
41 |
|
---|
42 | BOOL isNT4 (void)
|
---|
43 | {
|
---|
44 | OSVERSIONINFO OSversion;
|
---|
45 |
|
---|
46 | OSversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
---|
47 | ::GetVersionEx(&OSversion);
|
---|
48 |
|
---|
49 | switch (OSversion.dwPlatformId)
|
---|
50 | {
|
---|
51 | case VER_PLATFORM_WIN32s:
|
---|
52 | case VER_PLATFORM_WIN32_WINDOWS:
|
---|
53 | return FALSE;
|
---|
54 | case VER_PLATFORM_WIN32_NT:
|
---|
55 | if (OSversion.dwMajorVersion == 4)
|
---|
56 | return TRUE;
|
---|
57 | else return FALSE;
|
---|
58 | default:
|
---|
59 | break;
|
---|
60 | }
|
---|
61 | return FALSE;
|
---|
62 | }
|
---|
63 |
|
---|
64 | int main (int argc, char **argv)
|
---|
65 | {
|
---|
66 | int rc = 0;
|
---|
67 |
|
---|
68 | /* This program is only for installing drivers on NT4 */
|
---|
69 | if (!isNT4())
|
---|
70 | {
|
---|
71 | printf("This program only runs on NT4\n");
|
---|
72 | return -1;
|
---|
73 | }
|
---|
74 |
|
---|
75 | /* Delete the "InvalidDisplay" key which causes the display
|
---|
76 | applet to be started on every boot. For some reason this key
|
---|
77 | isn't removed after setting the proper resolution and even not when
|
---|
78 | doing a driverreinstall. */
|
---|
79 | RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\GraphicsDrivers\\InvalidDisplay"));
|
---|
80 | RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\GraphicsDrivers\\NewDisplay"));
|
---|
81 |
|
---|
82 | return rc;
|
---|
83 | }
|
---|