1 | /* $Id: odininst.cpp,v 1.13 2003-01-07 20:01:47 sandervl Exp $ */
|
---|
2 | /*
|
---|
3 | * Odin WarpIn installation app
|
---|
4 | *
|
---|
5 | * Creates:
|
---|
6 | * - SYSTEMDIR\drivers
|
---|
7 | * - SYSTEMDIR\drivers\etc
|
---|
8 | * - WINDOWSDIR\SYSTEM
|
---|
9 | * - WINDOWSDIR\AppData
|
---|
10 | * - WINDOWSDIR\Cache
|
---|
11 | * - WINDOWSDIR\Cookies
|
---|
12 | * - WINDOWSDIR\Desktop
|
---|
13 | * - WINDOWSDIR\Favorites
|
---|
14 | * - WINDOWSDIR\Fonts
|
---|
15 | * - WINDOWSDIR\History
|
---|
16 | * - WINDOWSDIR\NetHood
|
---|
17 | * - WINDOWSDIR\My Documents
|
---|
18 | * - WINDOWSDIR\PrintHood
|
---|
19 | * - WINDOWSDIR\Recent
|
---|
20 | * - WINDOWSDIR\SendTo
|
---|
21 | * - WINDOWSDIR\Start Menu
|
---|
22 | * - WINDOWSDIR\Start Menu\Programs
|
---|
23 | * - WINDOWSDIR\Start Menu\Programs\Startup
|
---|
24 | * - WINDOWSDIR\ShellNew
|
---|
25 | * - x:\Program Files
|
---|
26 | * - x:\Program Files\Common Files
|
---|
27 | * - WINDOWSDIR\Temp
|
---|
28 | * - and a minimal system registry
|
---|
29 | *
|
---|
30 | * Copyright 1999-2001 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
31 | *
|
---|
32 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
33 | *
|
---|
34 | */
|
---|
35 | #include <os2win.h>
|
---|
36 | #include <string.h>
|
---|
37 | #include <stdio.h>
|
---|
38 | #include <heapstring.h>
|
---|
39 | #include <ctype.h>
|
---|
40 | #include "winreg.h"
|
---|
41 | #include "global.h"
|
---|
42 | #include "winnt.h"
|
---|
43 | #include "winerror.h"
|
---|
44 | #include "winreg.h"
|
---|
45 | #include "winnls.h"
|
---|
46 | #include "debugtools.h"
|
---|
47 | #include <odininst.h>
|
---|
48 | #include <win\options.h>
|
---|
49 | #include <versionos2.h>
|
---|
50 | #include <time.h>
|
---|
51 |
|
---|
52 | BOOL CreateSystemDirectories();
|
---|
53 | BOOL SetupControlPanelKeys();
|
---|
54 | BOOL InitSystemAndRegistry();
|
---|
55 | void SetupTimeZoneInfo();
|
---|
56 |
|
---|
57 | //******************************************************************************
|
---|
58 | //******************************************************************************
|
---|
59 | //[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows]
|
---|
60 | //"Directory"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,00
|
---|
61 | //"SystemDirectory"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,\
|
---|
62 | // 6d,33,32,00
|
---|
63 | //"ErrorMode"=dword:00000000
|
---|
64 | //"NoInteractiveServices"=dword:00000000
|
---|
65 | //"CSDVersion"=dword:00000300
|
---|
66 | BYTE ShutdownTime[] = {0x44,0x5e,0xf2,0xbb,0x84,0x41,0xbf,0x01};
|
---|
67 |
|
---|
68 | static char DIR_Windows[260];
|
---|
69 | static char DIR_System[260];
|
---|
70 |
|
---|
71 | //******************************************************************************
|
---|
72 | //******************************************************************************
|
---|
73 | int main(int argc, char *argv[])
|
---|
74 | {
|
---|
75 | char *installdate;
|
---|
76 | time_t anytime;
|
---|
77 |
|
---|
78 | time(&anytime);
|
---|
79 | installdate = asctime(localtime(&anytime));
|
---|
80 | PROFILE_SetOdinIniString(ODINSYSTEM_SECTION, "INSTALLDATE", installdate);
|
---|
81 |
|
---|
82 | InitSystemAndRegistry();
|
---|
83 | CreateSystemDirectories();
|
---|
84 | SetupControlPanelKeys();
|
---|
85 |
|
---|
86 | SetupTimeZoneInfo();
|
---|
87 | return 0;
|
---|
88 | }
|
---|
89 | //******************************************************************************
|
---|
90 | //******************************************************************************
|
---|
91 | char *InternalGetWindowsDirectory()
|
---|
92 | {
|
---|
93 | static char fInit = FALSE;
|
---|
94 |
|
---|
95 | if(fInit == FALSE) {
|
---|
96 | GetWindowsDirectory(DIR_Windows, sizeof(DIR_Windows)-1);
|
---|
97 | fInit = TRUE;
|
---|
98 | }
|
---|
99 | return DIR_Windows;
|
---|
100 | }
|
---|
101 | //******************************************************************************
|
---|
102 | //******************************************************************************
|
---|
103 | char *InternalGetSystemDirectory()
|
---|
104 | {
|
---|
105 | static char fInit = FALSE;
|
---|
106 |
|
---|
107 | if(fInit == FALSE) {
|
---|
108 | GetSystemDirectory(DIR_System, sizeof(DIR_System)-1);
|
---|
109 | fInit = TRUE;
|
---|
110 | }
|
---|
111 | return DIR_System;
|
---|
112 | }
|
---|
113 | //******************************************************************************
|
---|
114 | //******************************************************************************
|
---|
115 | BOOL InitSystemAndRegistry()
|
---|
116 | {
|
---|
117 | HKEY hkey, hkey1;
|
---|
118 | char *buf;
|
---|
119 | DWORD val;
|
---|
120 | char digbuf[16];
|
---|
121 | char shellpath[260];
|
---|
122 |
|
---|
123 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Windows",&hkey)!=ERROR_SUCCESS) {
|
---|
124 | dprintf(("InitRegistry: Unable to register system information\n"));
|
---|
125 | return FALSE;
|
---|
126 | }
|
---|
127 | buf = InternalGetWindowsDirectory();
|
---|
128 | RegSetValueEx(hkey,"Directory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
|
---|
129 | buf = InternalGetSystemDirectory();
|
---|
130 | RegSetValueEx(hkey,"SystemDirectory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
|
---|
131 | val = 0;
|
---|
132 | RegSetValueEx(hkey,"ErrorMode",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
133 | val = 0;
|
---|
134 | RegSetValueEx(hkey,"NoInteractiveServices",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
135 | val = ODINNT_BUILD_NR;
|
---|
136 | RegSetValueEx(hkey,"CSDVersion",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
137 | RegSetValueEx(hkey,"ShutdownTime",0,REG_DWORD, (LPBYTE)ShutdownTime, sizeof(ShutdownTime));
|
---|
138 | RegCloseKey(hkey);
|
---|
139 |
|
---|
140 | //Software\Microsoft\Windows\CurrentVersion\RunOnce
|
---|
141 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce",&hkey)!=ERROR_SUCCESS) {
|
---|
142 | dprintf(("InitRegistry: Unable to register system information (2)"));
|
---|
143 | return FALSE;
|
---|
144 | }
|
---|
145 | RegCloseKey(hkey);
|
---|
146 |
|
---|
147 | //System\CurrentControlSet\Control\Session Manager
|
---|
148 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\Session Manager",&hkey)!=ERROR_SUCCESS) {
|
---|
149 | dprintf(("InitRegistry: Unable to register system information (2)"));
|
---|
150 | return FALSE;
|
---|
151 | }
|
---|
152 | RegCloseKey(hkey);
|
---|
153 |
|
---|
154 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\iexplore.exe",&hkey)!=ERROR_SUCCESS) {
|
---|
155 | dprintf(("InitRegistry: Unable to register system information (2)"));
|
---|
156 | return FALSE;
|
---|
157 | }
|
---|
158 | strcpy(shellpath, InternalGetWindowsDirectory());
|
---|
159 | strcat(shellpath, "\\IEXPLORE.EXE");
|
---|
160 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
|
---|
161 | RegCloseKey(hkey);
|
---|
162 |
|
---|
163 |
|
---|
164 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
|
---|
165 | dprintf(("InitRegistry: Unable to register system information (2)"));
|
---|
166 | return FALSE;
|
---|
167 | }
|
---|
168 | buf = InternalGetSystemDirectory();
|
---|
169 | RegSetValueEx(hkey,"SystemRoot",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
|
---|
170 | RegSetValueEx(hkey,"PathName",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
|
---|
171 | sprintf(digbuf, "%d", ODINNT_BUILD_NR);
|
---|
172 | RegSetValueEx(hkey,"CurrentBuildNumber",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
|
---|
173 | RegSetValueEx(hkey,"CurrentType",0,REG_SZ, (LPBYTE)ODINNT_OSTYPE_UNI, sizeof(ODINNT_OSTYPE_UNI));
|
---|
174 | RegSetValueEx(hkey,"CSDVersion",0,REG_SZ, (LPBYTE)ODINNT_CSDVERSION, sizeof(ODINNT_CSDVERSION));
|
---|
175 | RegSetValueEx(hkey,"SoftwareType",0,REG_SZ, (LPBYTE)ODINNT_SOFTWARE_TYPE, sizeof(ODINNT_SOFTWARE_TYPE));
|
---|
176 |
|
---|
177 | sprintf(digbuf, "%d.%d", ODINNT_MAJOR_VERSION, ODINNT_MINOR_VERSION);
|
---|
178 | RegSetValueEx(hkey,"CurrentVersion",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
|
---|
179 |
|
---|
180 | val = (DWORD)time(NULL); //todo: Correct format???
|
---|
181 | RegSetValueEx(hkey,"InstallDate",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
182 |
|
---|
183 | RegCloseKey(hkey);
|
---|
184 | //todo: productid, registered org/owner, sourcepath,
|
---|
185 |
|
---|
186 | //#
|
---|
187 | //# Entries for OLE32 (COM/OLE base)
|
---|
188 | //#
|
---|
189 | //
|
---|
190 | //# OLE32's built-in marshaler, handles standard interfaces such as IClassFactory.
|
---|
191 | //# (PSFactoryBuffer = Proxy/Stub factory)
|
---|
192 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00000320-0000-0000-C000-000000000046}]
|
---|
193 | //@="PSFactoryBuffer"
|
---|
194 | //
|
---|
195 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00000320-0000-0000-C000-000000000046}\InProcServer32]
|
---|
196 | //@="ole32.dll"
|
---|
197 | //"ThreadingModel"="Both"
|
---|
198 | #define PSFACTORYBUFFER "PSFactoryBuffer"
|
---|
199 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00000320-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
|
---|
200 | goto initreg_error;
|
---|
201 | }
|
---|
202 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)PSFACTORYBUFFER, sizeof(PSFACTORYBUFFER));
|
---|
203 | RegCloseKey(hkey);
|
---|
204 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00000320-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
|
---|
205 | goto initreg_error;
|
---|
206 | }
|
---|
207 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_OLE32DLL, sizeof(CLASS_OLE32DLL));
|
---|
208 | RegSetValueEx(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
209 | RegCloseKey(hkey);
|
---|
210 |
|
---|
211 | //# IUnknown, the superclass for everything COM/OLE.
|
---|
212 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{00000000-0000-0000-C000-000000000046}]
|
---|
213 | //@="IUnknown"
|
---|
214 | //
|
---|
215 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{00000000-0000-0000-C000-000000000046}\BaseInterface]
|
---|
216 | //@=""
|
---|
217 | //
|
---|
218 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{00000000-0000-0000-C000-000000000046}\NumMethods]
|
---|
219 | //@="3"
|
---|
220 | #define IUNKNOWN "IUnknown"
|
---|
221 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00000000-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
|
---|
222 | goto initreg_error;
|
---|
223 | }
|
---|
224 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)IUNKNOWN, sizeof(IUNKNOWN));
|
---|
225 | RegCloseKey(hkey);
|
---|
226 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00000000-0000-0000-C000-000000000046}\\BaseInterface",&hkey)!=ERROR_SUCCESS) {
|
---|
227 | goto initreg_error;
|
---|
228 | }
|
---|
229 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)"", 1);
|
---|
230 | RegCloseKey(hkey);
|
---|
231 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00000000-0000-0000-C000-000000000046}\\NumMethods",&hkey)!=ERROR_SUCCESS) {
|
---|
232 | goto initreg_error;
|
---|
233 | }
|
---|
234 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)"3", 2);
|
---|
235 | RegCloseKey(hkey);
|
---|
236 |
|
---|
237 | //# IClassFactory, standard interface for creating instances of classes.
|
---|
238 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{00000001-0000-0000-C000-000000000046}]
|
---|
239 | //@="IClassFactory"
|
---|
240 | //
|
---|
241 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{00000001-0000-0000-C000-000000000046}\NumMethods]
|
---|
242 | //@="5"
|
---|
243 | //
|
---|
244 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{00000001-0000-0000-C000-000000000046}\ProxyStubClsid32]
|
---|
245 | //@="{00000320-0000-0000-C000-000000000046}"
|
---|
246 | #define ICLASSFACTORY "IClassFactory"
|
---|
247 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00000001-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
|
---|
248 | goto initreg_error;
|
---|
249 | }
|
---|
250 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)ICLASSFACTORY, sizeof(ICLASSFACTORY));
|
---|
251 | RegCloseKey(hkey);
|
---|
252 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00000001-0000-0000-C000-000000000046}\\NumMethods",&hkey)!=ERROR_SUCCESS) {
|
---|
253 | goto initreg_error;
|
---|
254 | }
|
---|
255 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)"5", 2);
|
---|
256 | RegCloseKey(hkey);
|
---|
257 | #define PSFACTORY_GUID "{00000320-0000-0000-C000-000000000046}"
|
---|
258 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00000001-0000-0000-C000-000000000046}\\ProxyStubClsid32",&hkey)!=ERROR_SUCCESS) {
|
---|
259 | goto initreg_error;
|
---|
260 | }
|
---|
261 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)PSFACTORY_GUID, sizeof(PSFACTORY_GUID));
|
---|
262 | RegCloseKey(hkey);
|
---|
263 |
|
---|
264 | //#
|
---|
265 | //# Entries for OLEAUT32 (OLE Automation)
|
---|
266 | //#
|
---|
267 | //
|
---|
268 | //# The Universal Marshaler, also known as the Type Library Marshaler.
|
---|
269 | //# (PSOAInterface = Proxy/Stub OLE Automation interface)
|
---|
270 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00020424-0000-0000-C000-000000000046}]
|
---|
271 | //@="PSOAInterface"
|
---|
272 | //
|
---|
273 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00020424-0000-0000-C000-000000000046}\InProcServer32]
|
---|
274 | //@="oleaut32.dll"
|
---|
275 | //"ThreadingModel"="Both"
|
---|
276 | #define PSOAINTERFACE "PSOAInterface"
|
---|
277 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00020424-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
|
---|
278 | goto initreg_error;
|
---|
279 | }
|
---|
280 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)PSOAINTERFACE, sizeof(PSOAINTERFACE));
|
---|
281 | RegCloseKey(hkey);
|
---|
282 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00020424-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
|
---|
283 | goto initreg_error;
|
---|
284 | }
|
---|
285 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_OLEAUT32DLL, sizeof(CLASS_OLEAUT32DLL));
|
---|
286 | RegSetValueEx(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
287 | RegCloseKey(hkey);
|
---|
288 |
|
---|
289 |
|
---|
290 | //Shell32 & IE related keys
|
---|
291 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021400-0000-0000-C000-000000000046}]
|
---|
292 | //@="Desktop"
|
---|
293 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021400-0000-0000-C000-000000000046}\InProcServer32]
|
---|
294 | //@="shell32.dll"
|
---|
295 | //ThreadingModel="Apartment"
|
---|
296 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
|
---|
297 | goto initreg_error;
|
---|
298 | }
|
---|
299 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_DESKTOP, sizeof(CLASS_DESKTOP));
|
---|
300 | RegCloseKey(hkey);
|
---|
301 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
|
---|
302 | goto initreg_error;
|
---|
303 | }
|
---|
304 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL));
|
---|
305 | RegSetValueEx(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
|
---|
306 | RegCloseKey(hkey);
|
---|
307 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}]
|
---|
308 | //@="Shortcut"
|
---|
309 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}\InProcServer32]
|
---|
310 | //@="shell32.dll"
|
---|
311 | //"ThreadingModel"="Apartment"
|
---|
312 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}\shellex\MayChangeDefaultMenu]
|
---|
313 | //@=""
|
---|
314 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
|
---|
315 | goto initreg_error;
|
---|
316 | }
|
---|
317 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHORTCUT, sizeof(CLASS_SHORTCUT));
|
---|
318 | RegCloseKey(hkey);
|
---|
319 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
|
---|
320 | goto initreg_error;
|
---|
321 | }
|
---|
322 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL));
|
---|
323 | RegSetValueEx(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
|
---|
324 | RegCloseKey(hkey);
|
---|
325 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\shellex\\MayChangeDefaultMenu",&hkey)!=ERROR_SUCCESS) {
|
---|
326 | goto initreg_error;
|
---|
327 | }
|
---|
328 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)"", 0);
|
---|
329 | RegCloseKey(hkey);
|
---|
330 |
|
---|
331 | //# Entries for IWebBrowser
|
---|
332 | //# Used by Internet Explorer HTML-rendering control
|
---|
333 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}]
|
---|
334 | //@="Shortcut"
|
---|
335 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\InProcServer32]
|
---|
336 | //@="shdocvw.dll"
|
---|
337 | //"ThreadingModel"="Apartment"
|
---|
338 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\shellex\MayChangeDefaultMenu]
|
---|
339 | //@=""
|
---|
340 |
|
---|
341 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}",&hkey)!=ERROR_SUCCESS) {
|
---|
342 | goto initreg_error;
|
---|
343 | }
|
---|
344 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHORTCUT, sizeof(CLASS_SHORTCUT));
|
---|
345 | RegCloseKey(hkey);
|
---|
346 |
|
---|
347 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
|
---|
348 | goto initreg_error;
|
---|
349 | }
|
---|
350 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHDOCVW, sizeof(CLASS_SHDOCVW));
|
---|
351 | RegSetValueEx(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
|
---|
352 | RegCloseKey(hkey);
|
---|
353 |
|
---|
354 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}\\shellex\\MayChangeDefaultMenu",&hkey)!=ERROR_SUCCESS) {
|
---|
355 | goto initreg_error;
|
---|
356 | }
|
---|
357 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)"", 1);
|
---|
358 | RegCloseKey(hkey);
|
---|
359 |
|
---|
360 | //Now the Ddraw & dsound registry keys:
|
---|
361 | //HKEY_CLASSES_ROOT\DirectDraw = DirectDraw Object
|
---|
362 | //HKEY_CLASSES_ROOT\DirectDraw\CLSID = {D7B70EE0-4340-11CF-B063-0020AFC2CD35}
|
---|
363 | //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35} = DirectDraw Object
|
---|
364 | //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35}\InprocServer32 = ddraw.dll
|
---|
365 | if(RegCreateKey(HKEY_CLASSES_ROOT,"DirectDraw",&hkey)!=ERROR_SUCCESS) {
|
---|
366 | goto initreg_error;
|
---|
367 | }
|
---|
368 | RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
|
---|
369 | if(RegCreateKey(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
|
---|
370 | RegCloseKey(hkey);
|
---|
371 | goto initreg_error;
|
---|
372 | }
|
---|
373 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLASSID, sizeof(DDRAW_CLASSID));
|
---|
374 | RegCloseKey(hkey1);
|
---|
375 | RegCloseKey(hkey);
|
---|
376 |
|
---|
377 | if(RegCreateKey(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLASSID ,&hkey)!=ERROR_SUCCESS) {
|
---|
378 | goto initreg_error;
|
---|
379 | }
|
---|
380 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
|
---|
381 | if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
|
---|
382 | RegCloseKey(hkey);
|
---|
383 | goto initreg_error;
|
---|
384 | }
|
---|
385 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
|
---|
386 | RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
387 | RegCloseKey(hkey1);
|
---|
388 | RegCloseKey(hkey);
|
---|
389 |
|
---|
390 | //HKEY_CLASSES_ROOT\DirectDrawClipper = DirectDraw Clipper Object
|
---|
391 | //HKEY_CLASSES_ROOT\DirectDrawClipper\CLSID = {593817A0-7DB3-11CF-A2DE-00AA00B93356}
|
---|
392 | //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356} = DirectDraw Clipper Object
|
---|
393 | //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356}\InprocServer32 = ddraw.dll
|
---|
394 | if(RegCreateKey(HKEY_CLASSES_ROOT,"DirectDrawClipper",&hkey)!=ERROR_SUCCESS) {
|
---|
395 | goto initreg_error;
|
---|
396 | }
|
---|
397 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
|
---|
398 | if(RegCreateKey(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
|
---|
399 | RegCloseKey(hkey);
|
---|
400 | goto initreg_error;
|
---|
401 | }
|
---|
402 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_CLASSID, sizeof(DDRAW_CLIPPER_CLASSID));
|
---|
403 | RegCloseKey(hkey1);
|
---|
404 | RegCloseKey(hkey);
|
---|
405 |
|
---|
406 | if(RegCreateKey(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLIPPER_CLASSID,&hkey)!=ERROR_SUCCESS) {
|
---|
407 | goto initreg_error;
|
---|
408 | }
|
---|
409 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
|
---|
410 | if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
|
---|
411 | RegCloseKey(hkey);
|
---|
412 | goto initreg_error;
|
---|
413 | }
|
---|
414 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
|
---|
415 | RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
416 | RegCloseKey(hkey1);
|
---|
417 | RegCloseKey(hkey);
|
---|
418 |
|
---|
419 | //HKEY_CLASSES_ROOT\DirectSound = DirectSound Object
|
---|
420 | //HKEY_CLASSES_ROOT\DirectSound\CLSID = {47D4D946-62E8-11cf-93BC-444553540000}
|
---|
421 | //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000} = DirectSound Object
|
---|
422 | //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000}\InprocServer32 = dsound.dll
|
---|
423 | if(RegCreateKey(HKEY_CLASSES_ROOT,"DirectSound",&hkey)!=ERROR_SUCCESS) {
|
---|
424 | goto initreg_error;
|
---|
425 | }
|
---|
426 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
|
---|
427 | if(RegCreateKey(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
|
---|
428 | RegCloseKey(hkey);
|
---|
429 | goto initreg_error;
|
---|
430 | }
|
---|
431 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_CLASSID, sizeof(DSOUND_CLASSID));
|
---|
432 | RegCloseKey(hkey1);
|
---|
433 | RegCloseKey(hkey);
|
---|
434 |
|
---|
435 | if(RegCreateKey(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DSOUND_CLASSID ,&hkey)!=ERROR_SUCCESS) {
|
---|
436 | goto initreg_error;
|
---|
437 | }
|
---|
438 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
|
---|
439 | if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
|
---|
440 | RegCloseKey(hkey);
|
---|
441 | goto initreg_error;
|
---|
442 | }
|
---|
443 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_DLL, sizeof(DSOUND_DLL));
|
---|
444 | RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
445 | RegCloseKey(hkey1);
|
---|
446 | RegCloseKey(hkey);
|
---|
447 |
|
---|
448 | //DirectPlay
|
---|
449 | if(RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_CLASSID ,&hkey)!=ERROR_SUCCESS) {
|
---|
450 | goto initreg_error;
|
---|
451 | }
|
---|
452 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_DEFAULT, sizeof(DPLAYX_DEFAULT));
|
---|
453 | if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
|
---|
454 | RegCloseKey(hkey);
|
---|
455 | goto initreg_error;
|
---|
456 | }
|
---|
457 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_DLL, sizeof(DPLAYX_DLL));
|
---|
458 | RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
459 | RegCloseKey(hkey1);
|
---|
460 | RegCloseKey(hkey);
|
---|
461 |
|
---|
462 | //DirectPlay Lobby
|
---|
463 | if(RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_LOBBY_CLASSID ,&hkey)!=ERROR_SUCCESS) {
|
---|
464 | goto initreg_error;
|
---|
465 | }
|
---|
466 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DEFAULT, sizeof(DPLAYX_LOBBY_DEFAULT));
|
---|
467 | if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
|
---|
468 | RegCloseKey(hkey);
|
---|
469 | goto initreg_error;
|
---|
470 | }
|
---|
471 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DLL, sizeof(DPLAYX_LOBBY_DLL));
|
---|
472 | RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
473 | RegCloseKey(hkey1);
|
---|
474 | RegCloseKey(hkey);
|
---|
475 |
|
---|
476 | //#
|
---|
477 | //# Entries for quartz.dll
|
---|
478 | //#
|
---|
479 |
|
---|
480 | //Quartz.dll keys
|
---|
481 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{CDA42200-BD88-11d0-BD4E-00A0C911CE86}]
|
---|
482 | //@="Filter Mapper2"
|
---|
483 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{CDA42200-BD88-11d0-BD4E-00A0C911CE86}\InprocServer32]
|
---|
484 | //@="G:\\WINNT\\System32\\quartz.dll"
|
---|
485 | //"ThreadingModel"="Both"
|
---|
486 | if(RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"QUARTZ_FILTER_CLASSID ,&hkey)!=ERROR_SUCCESS) {
|
---|
487 | goto initreg_error;
|
---|
488 | }
|
---|
489 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)QUARTZ_FILTER_DEFAULT, sizeof(QUARTZ_FILTER_DEFAULT));
|
---|
490 | if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
|
---|
491 | RegCloseKey(hkey);
|
---|
492 | goto initreg_error;
|
---|
493 | }
|
---|
494 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)QUARTZ_DLL, sizeof(QUARTZ_DLL));
|
---|
495 | RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
496 | RegCloseKey(hkey1);
|
---|
497 | RegCloseKey(hkey);
|
---|
498 |
|
---|
499 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{CDBD8D00-C193-11D0-BD4E-00A0C911CE86}]
|
---|
500 | //@="CMediaPropertyBag"
|
---|
501 | //
|
---|
502 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{CDBD8D00-C193-11D0-BD4E-00A0C911CE86}\InprocServer32]
|
---|
503 | //@="G:\\WINNT\\System32\\quartz.dll"
|
---|
504 | //"ThreadingModel"="Both"
|
---|
505 | if(RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"QUARTZ_MEDIAPROP_CLASSID ,&hkey)!=ERROR_SUCCESS) {
|
---|
506 | goto initreg_error;
|
---|
507 | }
|
---|
508 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)QUARTZ_MEDIAPROP_DEFAULT, sizeof(QUARTZ_MEDIAPROP_DEFAULT));
|
---|
509 | if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
|
---|
510 | RegCloseKey(hkey);
|
---|
511 | goto initreg_error;
|
---|
512 | }
|
---|
513 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)QUARTZ_DLL, sizeof(QUARTZ_DLL));
|
---|
514 | RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
515 | RegCloseKey(hkey1);
|
---|
516 | RegCloseKey(hkey);
|
---|
517 |
|
---|
518 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{79376820-07D0-11CF-A24D-0020AFD79767}]
|
---|
519 | //@="DirectSound Audio Renderer"
|
---|
520 | //
|
---|
521 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{79376820-07D0-11CF-A24D-0020AFD79767}\InprocServer32]
|
---|
522 | //@="G:\\WINNT\\System32\\quartz.dll"
|
---|
523 | //"ThreadingModel"="Both"
|
---|
524 | if(RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"QUARTZ_DSOUNDREND_CLASSID ,&hkey)!=ERROR_SUCCESS) {
|
---|
525 | goto initreg_error;
|
---|
526 | }
|
---|
527 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)QUARTZ_DSOUNDREND_DEFAULT, sizeof(QUARTZ_DSOUNDREND_DEFAULT));
|
---|
528 | if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
|
---|
529 | RegCloseKey(hkey);
|
---|
530 | goto initreg_error;
|
---|
531 | }
|
---|
532 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)QUARTZ_DLL, sizeof(QUARTZ_DLL));
|
---|
533 | RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
534 | RegCloseKey(hkey1);
|
---|
535 | RegCloseKey(hkey);
|
---|
536 |
|
---|
537 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{e436ebb4-524f-11ce-9f53-0020af0ba770}]
|
---|
538 | //@="Filter Graph Control Plug In Distributor"
|
---|
539 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{e436ebb4-524f-11ce-9f53-0020af0ba770}\InprocServer32]
|
---|
540 | //@="G:\\WINNT\\System32\\quartz.dll"
|
---|
541 | //"ThreadingModel"="Both"
|
---|
542 | if(RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"QUARTZ_FILTERGRAPHDIST_CLASSID ,&hkey)!=ERROR_SUCCESS) {
|
---|
543 | goto initreg_error;
|
---|
544 | }
|
---|
545 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)QUARTZ_FILTERGRAPHDIST_DEFAULT, sizeof(QUARTZ_FILTERGRAPHDIST_DEFAULT));
|
---|
546 | if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
|
---|
547 | RegCloseKey(hkey);
|
---|
548 | goto initreg_error;
|
---|
549 | }
|
---|
550 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)QUARTZ_DLL, sizeof(QUARTZ_DLL));
|
---|
551 | RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
552 | RegCloseKey(hkey1);
|
---|
553 | RegCloseKey(hkey);
|
---|
554 |
|
---|
555 |
|
---|
556 | #if 0
|
---|
557 | if(RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\E436EBB3-524F-11CE-9F53-0020AF0BA770" ,&hkey)!=ERROR_SUCCESS) {
|
---|
558 | goto initreg_error;
|
---|
559 | }
|
---|
560 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)QUARTZ_FILTERGRAPHDIST_DEFAULT, sizeof(QUARTZ_FILTERGRAPHDIST_DEFAULT));
|
---|
561 | if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
|
---|
562 | RegCloseKey(hkey);
|
---|
563 | goto initreg_error;
|
---|
564 | }
|
---|
565 | RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)QUARTZ_DLL, sizeof(QUARTZ_DLL));
|
---|
566 | RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
|
---|
567 | RegCloseKey(hkey1);
|
---|
568 | RegCloseKey(hkey);
|
---|
569 |
|
---|
570 | # CLSID_FilterGraph
|
---|
571 | [HKEY_CLASSES_ROOT\CLSID\{E436EBB3-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
|
---|
572 | @="quartz.dll"
|
---|
573 | "ThreadingModel"="Both"
|
---|
574 |
|
---|
575 | # CLSID_SystemClock
|
---|
576 | [HKEY_CLASSES_ROOT\CLSID\{E436EBB1-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
|
---|
577 | @="quartz.dll"
|
---|
578 | "ThreadingModel"="Both"
|
---|
579 |
|
---|
580 | # CLSID_MemoryAllocator
|
---|
581 | [HKEY_CLASSES_ROOT\CLSID\{1E651CC0-B199-11D0-8212-00C04FC32C45}\InprocServer32]
|
---|
582 | @="quartz.dll"
|
---|
583 | "ThreadingModel"="Both"
|
---|
584 | #endif
|
---|
585 |
|
---|
586 | //[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion]
|
---|
587 | //"ProgramFilesDir"="C:\Program Files"
|
---|
588 | //"CommonFilesDir"="C:\Program Files\Common Files"
|
---|
589 | //# This is intended for a centrally managed (server) directory where system files and e.g. fonts can reside. Most installs have this set to C:\WINDOWS, though.
|
---|
590 | //"SharedDir"="C:\WINDOWS"
|
---|
591 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
|
---|
592 | goto initreg_error;
|
---|
593 | }
|
---|
594 | //Create x:\Program Files directory
|
---|
595 | strcpy(shellpath, InternalGetWindowsDirectory());
|
---|
596 | shellpath[2] = 0; //get drive
|
---|
597 | strcat(shellpath, "\\Program Files");
|
---|
598 | CreateDirectory(shellpath, NULL);
|
---|
599 | RegSetValueEx(hkey, DIR_PROGRAM, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
|
---|
600 |
|
---|
601 | //Create x:\Program Files\Common Files directory
|
---|
602 | strcat(shellpath, "\\Common Files");
|
---|
603 | CreateDirectory(shellpath, NULL);
|
---|
604 | RegSetValueEx(hkey, DIR_PROGRAM_COMMON, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
|
---|
605 |
|
---|
606 | strcpy(shellpath, InternalGetWindowsDirectory());
|
---|
607 | RegSetValueEx(hkey, DIR_SHARED, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
|
---|
608 |
|
---|
609 | RegCloseKey(hkey);
|
---|
610 |
|
---|
611 | //[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\VIDEO]
|
---|
612 | //"\\Device\\Video0"="\\REGISTRY\\Machine\\System\\ControlSet001\\Services\\mga64\\Device0"
|
---|
613 | //"\\Device\\Video1"="\\REGISTRY\\Machine\\System\\ControlSet001\\Services\\VgaSave\\Device0"
|
---|
614 | //"VgaCompatible"="\\Device\\Video1"
|
---|
615 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\VIDEO",&hkey)!=ERROR_SUCCESS) {
|
---|
616 | goto initreg_error;
|
---|
617 | }
|
---|
618 | RegSetValueEx(hkey,"\\Device\\Video0",0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD, sizeof(HARDWARE_VIDEO_GRADD));
|
---|
619 | RegSetValueEx(hkey,"\\Device\\Video1",0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_VGA, sizeof(HARDWARE_VIDEO_VGA));
|
---|
620 | RegSetValueEx(hkey, "VgaCompatible", 0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_COMPATIBLE, sizeof(HARDWARE_VIDEO_COMPATIBLE));
|
---|
621 | RegCloseKey(hkey);
|
---|
622 |
|
---|
623 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Gradd\\Device0",&hkey)!=ERROR_SUCCESS) {
|
---|
624 | goto initreg_error;
|
---|
625 | }
|
---|
626 | RegSetValueEx(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD_DESCRIPTION, sizeof(HARDWARE_VIDEO_GRADD_DESCRIPTION));
|
---|
627 | RegCloseKey(hkey);
|
---|
628 |
|
---|
629 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\VgaSave\\Device0",&hkey)!=ERROR_SUCCESS) {
|
---|
630 | goto initreg_error;
|
---|
631 | }
|
---|
632 | RegSetValueEx(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_VGA_DESCRIPTION, sizeof(HARDWARE_VIDEO_VGA_DESCRIPTION));
|
---|
633 | RegCloseKey(hkey);
|
---|
634 |
|
---|
635 | //Software\Microsoft\Multimedia\Sound Mapper
|
---|
636 | if(RegCreateKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Multimedia\\Sound Mapper",&hkey)!=ERROR_SUCCESS) {
|
---|
637 | goto initreg_error;
|
---|
638 | }
|
---|
639 | RegSetValueEx(hkey,"Playback", 0, REG_SZ, (LPBYTE)ODIN_WINMM_PLAYBACK, sizeof(ODIN_WINMM_PLAYBACK));
|
---|
640 | RegSetValueEx(hkey,"Record", 0, REG_SZ, (LPBYTE)ODIN_WINMM_RECORD, sizeof(ODIN_WINMM_RECORD));
|
---|
641 | RegCloseKey(hkey);
|
---|
642 |
|
---|
643 | //Software\Microsoft\DirectX
|
---|
644 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectX",&hkey)!=ERROR_SUCCESS) {
|
---|
645 | goto initreg_error;
|
---|
646 | }
|
---|
647 | RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)"", 0);
|
---|
648 | RegSetValueEx(hkey, "RC", 0,REG_SZ, (LPBYTE)DIRECTX_RC, sizeof(DIRECTX_RC));
|
---|
649 | RegSetValueEx(hkey, "Version", 0,REG_SZ, (LPBYTE)DIRECTX_VERSION, sizeof(DIRECTX_VERSION));
|
---|
650 | val = DIRECTX_INSTALLED_VERSION;
|
---|
651 | RegSetValueEx(hkey, "InstalledVersion", 0,REG_BINARY, (LPBYTE)&val, sizeof(DWORD));
|
---|
652 | RegCloseKey(hkey);
|
---|
653 |
|
---|
654 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectDraw",&hkey)!=ERROR_SUCCESS) {
|
---|
655 | goto initreg_error;
|
---|
656 | }
|
---|
657 | //todo
|
---|
658 | RegCloseKey(hkey);
|
---|
659 |
|
---|
660 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Direct3D",&hkey)!=ERROR_SUCCESS) {
|
---|
661 | goto initreg_error;
|
---|
662 | }
|
---|
663 | //todo
|
---|
664 | RegCloseKey(hkey);
|
---|
665 |
|
---|
666 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectPlay",&hkey)!=ERROR_SUCCESS) {
|
---|
667 | goto initreg_error;
|
---|
668 | }
|
---|
669 | //todo
|
---|
670 | RegCloseKey(hkey);
|
---|
671 |
|
---|
672 | #if 0
|
---|
673 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectMusic",&hkey)!=ERROR_SUCCESS) {
|
---|
674 | goto initreg_error;
|
---|
675 | }
|
---|
676 | //todo
|
---|
677 | RegCloseKey(hkey);
|
---|
678 | #endif
|
---|
679 |
|
---|
680 | // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs]
|
---|
681 | // "Type"=dword:00000002
|
---|
682 | // "Start"=dword:00000004
|
---|
683 | // "Group"="File system"
|
---|
684 | // "ErrorControl"=dword:00000001
|
---|
685 | // "DependOnGroup"=hex(7):53,43,53,49,20,43,44,52,4f,4d,20,43,6c,61,73,73,00,00
|
---|
686 |
|
---|
687 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdfs",&hkey)!=ERROR_SUCCESS) {
|
---|
688 | goto initreg_error;
|
---|
689 | }
|
---|
690 | val = 0x2;
|
---|
691 | RegSetValueEx(hkey, KEY_DEVICE_TYPE,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
692 | val = 0x4;
|
---|
693 | RegSetValueEx(hkey, KEY_DEVICE_START,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
694 | val = 0x1;
|
---|
695 | RegSetValueEx(hkey, KEY_DEVICE_ERRORCONTROL,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
696 | RegSetValueEx(hkey, KEY_DEVICE_GROUP,0,REG_SZ, (LPBYTE)DEVICE_GROUP_FILESYSTEM, sizeof(DEVICE_GROUP_FILESYSTEM));
|
---|
697 | //todo dependongroup
|
---|
698 | RegCloseKey(hkey);
|
---|
699 |
|
---|
700 |
|
---|
701 | /*
|
---|
702 | // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs\Enum]
|
---|
703 | // "0"="Root\\LEGACY_CDFS\\0000"
|
---|
704 | // "Count"=dword:00000001
|
---|
705 | // "NextInstance"=dword:00000001
|
---|
706 | */
|
---|
707 | // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom]
|
---|
708 | // "Type"=dword:00000001
|
---|
709 | // "Start"=dword:00000001
|
---|
710 | // "Group"="SCSI CDROM Class"
|
---|
711 | // "ErrorControl"=dword:00000000
|
---|
712 | // "Tag"=dword:00000002
|
---|
713 | // "DependOnGroup"=hex(7):53,43,53,49,20,6d,69,6e,69,70,6f,72,74,00,00
|
---|
714 | // "Autorun"=dword:00000001
|
---|
715 |
|
---|
716 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdrom",&hkey)!=ERROR_SUCCESS) {
|
---|
717 | goto initreg_error;
|
---|
718 | }
|
---|
719 | val = 0x1;
|
---|
720 | RegSetValueEx(hkey, KEY_DEVICE_TYPE,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
721 | val = 0x1;
|
---|
722 | RegSetValueEx(hkey, KEY_DEVICE_START,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
723 | val = 0x0;
|
---|
724 | RegSetValueEx(hkey, KEY_DEVICE_ERRORCONTROL,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
725 | val = 0x2;
|
---|
726 | RegSetValueEx(hkey, KEY_DEVICE_TAG,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
727 | val = 0x0;
|
---|
728 | RegSetValueEx(hkey, KEY_DEVICE_AUTORUN,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
729 | RegSetValueEx(hkey, KEY_DEVICE_GROUP,0,REG_SZ, (LPBYTE)DEVICE_GROUP_SCSICDROM, sizeof(DEVICE_GROUP_SCSICDROM));
|
---|
730 | //todo dependongroup
|
---|
731 | RegCloseKey(hkey);
|
---|
732 |
|
---|
733 | /*
|
---|
734 | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom\Enum]
|
---|
735 | "0"="Root\\LEGACY_CDROM\\0000"
|
---|
736 | "Count"=dword:00000001
|
---|
737 | "NextInstance"=dword:00000001
|
---|
738 | */
|
---|
739 |
|
---|
740 | //[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\FileSystem]
|
---|
741 | //"Win31FileSystem"=dword:00000000
|
---|
742 | //"NtfsDisable8dot3NameCreation"=dword:00000000
|
---|
743 | //"Win95TruncatedExtensions"=dword:00000001
|
---|
744 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\FileSystem",&hkey)!=ERROR_SUCCESS) {
|
---|
745 | goto initreg_error;
|
---|
746 | }
|
---|
747 | val = 0x0;
|
---|
748 | RegSetValueEx(hkey, "Win31FileSystem",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
749 | val = 0x0;
|
---|
750 | RegSetValueEx(hkey, "NtfsDisable8dot3NameCreation",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
751 | val = 0x1;
|
---|
752 | RegSetValueEx(hkey, "Win95TruncatedExtensions",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
|
---|
753 | RegCloseKey(hkey);
|
---|
754 |
|
---|
755 | //[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM]
|
---|
756 | //"Serial1"="COM2"
|
---|
757 | //// if(RegCreateKey(HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\SERIALCOMM",&hkey)!=ERROR_SUCCESS) {
|
---|
758 | //// goto initreg_error;
|
---|
759 | //// }
|
---|
760 | //// RegSetValueEx(hkey, "Serial1",0,REG_SZ, (LPBYTE)"COM2", 5);
|
---|
761 | //// RegCloseKey(hkey);
|
---|
762 |
|
---|
763 |
|
---|
764 | //[HKEY_LOCAL_MACHINE\Software\Microsoft\OLE]
|
---|
765 | //# allow cross-machine calls (RPC) (default Y)
|
---|
766 | //"EnableDCOM"="Y"
|
---|
767 | //# allow incoming connections ? (def. N)
|
---|
768 | //"EnableRemoteConnect"="N"
|
---|
769 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\OLE",&hkey)!=ERROR_SUCCESS) {
|
---|
770 | goto initreg_error;
|
---|
771 | }
|
---|
772 | digbuf[0] = 'Y';
|
---|
773 | digbuf[1] = 0;
|
---|
774 | RegSetValueEx(hkey, "EnableDCOM",0,REG_SZ, (LPBYTE)digbuf, 2);
|
---|
775 | digbuf[0] = 'N';
|
---|
776 | digbuf[1] = 0;
|
---|
777 | RegSetValueEx(hkey, "EnableRemoteConnect",0,REG_SZ, (LPBYTE)digbuf, 2);
|
---|
778 | RegCloseKey(hkey);
|
---|
779 |
|
---|
780 | //Add MS Sans Serif to WarpSans font conversion entry
|
---|
781 | char temp;
|
---|
782 | if(PROFILE_GetOdinIniString(ODINFONTSECTION, "MS Sans Serif", "", &temp,
|
---|
783 | 0) <= 1)
|
---|
784 | {
|
---|
785 | PROFILE_SetOdinIniString(ODINFONTSECTION, "MS Sans Serif", "WarpSans");
|
---|
786 | }
|
---|
787 | //Add MS Shell Dlg
|
---|
788 | if(PROFILE_GetOdinIniString(ODINFONTSECTION, "MS Shell Dlg", "", &temp,
|
---|
789 | 0) <= 1)
|
---|
790 | {
|
---|
791 | PROFILE_SetOdinIniString(ODINFONTSECTION, "MS Shell Dlg", "WarpSans");
|
---|
792 | }
|
---|
793 | //Add MS Shell Dlg 2 (win2k and up) too
|
---|
794 | if(PROFILE_GetOdinIniString(ODINFONTSECTION, "MS Shell Dlg 2", "", &temp,
|
---|
795 | 0) <= 1)
|
---|
796 | {
|
---|
797 | PROFILE_SetOdinIniString(ODINFONTSECTION, "MS Shell Dlg 2", "WarpSans");
|
---|
798 | }
|
---|
799 |
|
---|
800 | //Create system.ini with [mci] section
|
---|
801 | strcpy(shellpath, InternalGetWindowsDirectory());
|
---|
802 | strcat(shellpath, "\\system.ini");
|
---|
803 |
|
---|
804 | if(GetPrivateProfileStringA(szMci, szCDAudio, szMciCDA, &temp, 0, shellpath) <= 1) {
|
---|
805 | WritePrivateProfileStringA(szMci, szCDAudio, szMciCDA, shellpath);
|
---|
806 | }
|
---|
807 |
|
---|
808 | //Font registry keys (not complete)
|
---|
809 | //[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
|
---|
810 | //"Courier 10,12,15 (VGA res)"="COURE.FON"
|
---|
811 | //"MS Sans Serif 8,10,12,14,18,24 (VGA res)"="SSERIFE.FON"
|
---|
812 | //"MS Serif 8,10,12,14,18,24 (VGA res)"="SERIFE.FON"
|
---|
813 |
|
---|
814 |
|
---|
815 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts",&hkey)!=ERROR_SUCCESS) {
|
---|
816 | goto initreg_error;
|
---|
817 | }
|
---|
818 | #define FONT_COURIER "COURE.FON"
|
---|
819 | #define FONT_SANSSERIF "SSERIFE.FON"
|
---|
820 | #define FONT_SERIF "SERIFE.FON"
|
---|
821 | RegSetValueEx(hkey, "Courier 10,12,15 (VGA res)",0,REG_SZ, (LPBYTE)FONT_COURIER, sizeof(FONT_COURIER));
|
---|
822 | RegSetValueEx(hkey, "MS Sans Serif 8,10,12,14,18,24 (VGA res)",0,REG_SZ, (LPBYTE)FONT_SANSSERIF, sizeof(FONT_SANSSERIF));
|
---|
823 | RegSetValueEx(hkey, "MS Serif 8,10,12,14,18,24 (VGA res)",0,REG_SZ, (LPBYTE)FONT_SERIF, sizeof(FONT_SERIF));
|
---|
824 | RegCloseKey(hkey);
|
---|
825 |
|
---|
826 | if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts",&hkey)!=ERROR_SUCCESS) {
|
---|
827 | goto initreg_error;
|
---|
828 | }
|
---|
829 | RegSetValueEx(hkey, "Courier 10,12,15 (VGA res)",0,REG_SZ, (LPBYTE)FONT_COURIER, sizeof(FONT_COURIER));
|
---|
830 | RegSetValueEx(hkey, "MS Sans Serif 8,10,12,14,18,24 (VGA res)",0,REG_SZ, (LPBYTE)FONT_SANSSERIF, sizeof(FONT_SANSSERIF));
|
---|
831 | RegSetValueEx(hkey, "MS Serif 8,10,12,14,18,24 (VGA res)",0,REG_SZ, (LPBYTE)FONT_SERIF, sizeof(FONT_SERIF));
|
---|
832 | RegCloseKey(hkey);
|
---|
833 | return TRUE;
|
---|
834 |
|
---|
835 | initreg_error:
|
---|
836 | dprintf((INITREG_ERROR));
|
---|
837 | return FALSE;
|
---|
838 | }
|
---|
839 | //******************************************************************************
|
---|
840 | //******************************************************************************
|
---|
841 | BOOL CreateSystemDirectories()
|
---|
842 | {
|
---|
843 | char dirname[260];
|
---|
844 | HKEY hkey;
|
---|
845 |
|
---|
846 | //Create Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders keys
|
---|
847 | //"Favorites"="C:\WINDOWS\Favorites"
|
---|
848 | //"StartUp"="C:\WINDOWS\Start Menu\Programs\Startup"
|
---|
849 | //"Desktop"="C:\WINDOWS\Desktop"
|
---|
850 | //"Programs"="C:\WINDOWS\Start Menu\Programs"
|
---|
851 | //"Fonts"="C:\WINDOWS\Fonts"
|
---|
852 | //"SendTo"="C:\WINDOWS\SendTo"
|
---|
853 | //"Start Menu"="C:\WINDOWS\Start Menu"
|
---|
854 | //"Templates"="C:\WINDOWS\ShellNew"
|
---|
855 | //"Recent"="C:\WINDOWS\Recent"
|
---|
856 | //"NetHood"="C:\WINDOWS\NetHood"
|
---|
857 | //"Personal"="C:\My Documents"
|
---|
858 |
|
---|
859 | if(RegCreateKey(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",&hkey)!=ERROR_SUCCESS) {
|
---|
860 | dprintf(("InitRegistry: Unable to register system information (3)"));
|
---|
861 | return FALSE;
|
---|
862 | }
|
---|
863 | //system32\drivers dir
|
---|
864 | strcpy(dirname, InternalGetSystemDirectory());
|
---|
865 | strcat(dirname, "\\Drivers");
|
---|
866 | CreateDirectory(dirname, NULL);
|
---|
867 | strcat(dirname, "\\etc");
|
---|
868 | CreateDirectory(dirname, NULL);
|
---|
869 |
|
---|
870 | //SYSTEM dir
|
---|
871 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
872 | strcat(dirname, "\\SYSTEM");
|
---|
873 | CreateDirectory(dirname, NULL);
|
---|
874 |
|
---|
875 | //AppData
|
---|
876 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
877 | strcat(dirname, "\\Application Data");
|
---|
878 | CreateDirectory(dirname, NULL);
|
---|
879 | RegSetValueEx(hkey,"AppData",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
880 | //Cache
|
---|
881 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
882 | strcat(dirname, "\\Temporary Internet Files");
|
---|
883 | CreateDirectory(dirname, NULL);
|
---|
884 | RegSetValueEx(hkey,"Cache",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
885 | //Cookies
|
---|
886 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
887 | strcat(dirname, "\\Cookies");
|
---|
888 | CreateDirectory(dirname, NULL);
|
---|
889 | RegSetValueEx(hkey,"Cookies",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
890 | //Desktop
|
---|
891 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
892 | strcat(dirname, "\\Desktop");
|
---|
893 | CreateDirectory(dirname, NULL);
|
---|
894 | RegSetValueEx(hkey,"Desktop",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
895 | //Favorites
|
---|
896 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
897 | strcat(dirname, "\\Favorites");
|
---|
898 | CreateDirectory(dirname, NULL);
|
---|
899 | RegSetValueEx(hkey,"Favorites",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
900 | //Fonts
|
---|
901 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
902 | strcat(dirname, "\\Fonts");
|
---|
903 | CreateDirectory(dirname, NULL);
|
---|
904 | RegSetValueEx(hkey,"Fonts",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
905 | //History
|
---|
906 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
907 | strcat(dirname, "\\History");
|
---|
908 | CreateDirectory(dirname, NULL);
|
---|
909 | RegSetValueEx(hkey,"History",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
910 | //NetHood
|
---|
911 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
912 | strcat(dirname, "\\NetHood");
|
---|
913 | CreateDirectory(dirname, NULL);
|
---|
914 | RegSetValueEx(hkey,"NetHood",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
915 | //Personal
|
---|
916 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
917 | strcat(dirname, "\\My Documents");
|
---|
918 | CreateDirectory(dirname, NULL);
|
---|
919 | RegSetValueEx(hkey,"Personal",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
920 | //PrintHood
|
---|
921 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
922 | strcat(dirname, "\\PrintHood");
|
---|
923 | CreateDirectory(dirname, NULL);
|
---|
924 | RegSetValueEx(hkey,"PrintHood",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
925 | //Recent
|
---|
926 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
927 | strcat(dirname, "\\Recent");
|
---|
928 | CreateDirectory(dirname, NULL);
|
---|
929 | RegSetValueEx(hkey,"Recent",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
930 | //SendTo
|
---|
931 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
932 | strcat(dirname, "\\SendTo");
|
---|
933 | CreateDirectory(dirname, NULL);
|
---|
934 | RegSetValueEx(hkey,"SendTo",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
935 | //Start Menu
|
---|
936 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
937 | strcat(dirname, "\\Start Menu");
|
---|
938 | CreateDirectory(dirname, NULL);
|
---|
939 | RegSetValueEx(hkey,"Start Menu",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
940 |
|
---|
941 | //Temp directory
|
---|
942 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
943 | strcat(dirname, "\\Temp");
|
---|
944 | CreateDirectory(dirname, NULL);
|
---|
945 |
|
---|
946 | //Programs
|
---|
947 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
948 | strcat(dirname, "\\Start Menu\\Programs");
|
---|
949 | CreateDirectory(dirname, NULL);
|
---|
950 | RegSetValueEx(hkey,"Programs",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
951 | //Startup
|
---|
952 | strcat(dirname, "\\Startup");
|
---|
953 | CreateDirectory(dirname, NULL);
|
---|
954 | RegSetValueEx(hkey,"Startup",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
955 | //ShellNew
|
---|
956 | strcpy(dirname, InternalGetWindowsDirectory());
|
---|
957 | strcat(dirname, "\\ShellNew");
|
---|
958 | CreateDirectory(dirname, NULL);
|
---|
959 | RegSetValueEx(hkey,"Templates",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
|
---|
960 | RegCloseKey(hkey);
|
---|
961 |
|
---|
962 | return TRUE;
|
---|
963 | }
|
---|
964 | //******************************************************************************
|
---|
965 | //Example:
|
---|
966 | //[HKEY_USERS\.DEFAULT\Control Panel\International]
|
---|
967 | //"Locale"="00000409"
|
---|
968 | //"sLanguage"="ENU"
|
---|
969 | //"sCountry"="United States"
|
---|
970 | //"iCountry"="1"
|
---|
971 | //"sList"=","
|
---|
972 | //"iMeasure"="1"
|
---|
973 | //"sDecimal"="."
|
---|
974 | //"sThousand"=","
|
---|
975 | //"iDigits"="2"
|
---|
976 | //"iLZero"="1"
|
---|
977 | //"sCurrency"="$"
|
---|
978 | //"iCurrDigits"="2"
|
---|
979 | //"iCurrency"="0"
|
---|
980 | //"iNegCurr"="0"
|
---|
981 | //"sDate"="/"
|
---|
982 | //"sTime"=":"
|
---|
983 | //"sShortDate"="M/d/yy"
|
---|
984 | //"sLongDate"="dddd, MMMM dd, yyyy"
|
---|
985 | //"iDate"="0"
|
---|
986 | //"iTime"="0"
|
---|
987 | //"iTLZero"="0"
|
---|
988 | //"s1159"="AM"
|
---|
989 | //"s2359"="PM"
|
---|
990 | //******************************************************************************
|
---|
991 | BOOL SetupControlPanelKeys()
|
---|
992 | {
|
---|
993 | HKEY hkey;
|
---|
994 | LCID lcid;
|
---|
995 | char tmp[128];
|
---|
996 |
|
---|
997 | if(RegCreateKey(HKEY_CURRENT_USER,"Control Panel\\International",&hkey)!=ERROR_SUCCESS) {
|
---|
998 | dprintf(("SetupControlPanelKeys: Unable to create key"));
|
---|
999 | return FALSE;
|
---|
1000 | }
|
---|
1001 | lcid = GetUserDefaultLCID();
|
---|
1002 | sprintf(tmp, "%08X", lcid);
|
---|
1003 | RegSetValueEx(hkey,"Locale",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1004 |
|
---|
1005 | GetLocaleInfo(lcid, LOCALE_SLANGUAGE, tmp, sizeof(tmp)-1);
|
---|
1006 | RegSetValueEx(hkey,"sLanguage",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1007 |
|
---|
1008 | GetLocaleInfo(lcid, LOCALE_SCOUNTRY, tmp, sizeof(tmp)-1);
|
---|
1009 | RegSetValueEx(hkey,"sCountry",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1010 |
|
---|
1011 | GetLocaleInfo(lcid, LOCALE_ICOUNTRY, tmp, sizeof(tmp)-1);
|
---|
1012 | RegSetValueEx(hkey,"iCountry",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1013 |
|
---|
1014 | GetLocaleInfo(lcid, LOCALE_SLIST, tmp, sizeof(tmp)-1);
|
---|
1015 | RegSetValueEx(hkey,"sList",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1016 |
|
---|
1017 | GetLocaleInfo(lcid, LOCALE_IMEASURE, tmp, sizeof(tmp)-1);
|
---|
1018 | RegSetValueEx(hkey,"sMeasure",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1019 |
|
---|
1020 | GetLocaleInfo(lcid, LOCALE_SDECIMAL, tmp, sizeof(tmp)-1);
|
---|
1021 | RegSetValueEx(hkey,"sDecimal",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1022 |
|
---|
1023 | GetLocaleInfo(lcid, LOCALE_STHOUSAND, tmp, sizeof(tmp)-1);
|
---|
1024 | RegSetValueEx(hkey,"sThousand",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1025 |
|
---|
1026 | GetLocaleInfo(lcid, LOCALE_IDIGITS, tmp, sizeof(tmp)-1);
|
---|
1027 | RegSetValueEx(hkey,"iDigits",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1028 |
|
---|
1029 | GetLocaleInfo(lcid, LOCALE_ILZERO, tmp, sizeof(tmp)-1);
|
---|
1030 | RegSetValueEx(hkey,"iLZero",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1031 |
|
---|
1032 | GetLocaleInfo(lcid, LOCALE_SCURRENCY, tmp, sizeof(tmp)-1);
|
---|
1033 | RegSetValueEx(hkey,"sCurrency",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1034 |
|
---|
1035 | GetLocaleInfo(lcid, LOCALE_ICURRDIGITS, tmp, sizeof(tmp)-1);
|
---|
1036 | RegSetValueEx(hkey,"iCurrDigits",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1037 |
|
---|
1038 | GetLocaleInfo(lcid, LOCALE_ICURRENCY, tmp, sizeof(tmp)-1);
|
---|
1039 | RegSetValueEx(hkey,"iCurrency",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1040 |
|
---|
1041 | GetLocaleInfo(lcid, LOCALE_INEGCURR, tmp, sizeof(tmp)-1);
|
---|
1042 | RegSetValueEx(hkey,"iNegCurr",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1043 |
|
---|
1044 | GetLocaleInfo(lcid, LOCALE_SDATE, tmp, sizeof(tmp)-1);
|
---|
1045 | RegSetValueEx(hkey,"sDate",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1046 |
|
---|
1047 | GetLocaleInfo(lcid, LOCALE_STIME, tmp, sizeof(tmp)-1);
|
---|
1048 | RegSetValueEx(hkey,"sTime",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1049 |
|
---|
1050 | GetLocaleInfo(lcid, LOCALE_SSHORTDATE, tmp, sizeof(tmp)-1);
|
---|
1051 | RegSetValueEx(hkey,"sShortDate",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1052 |
|
---|
1053 | GetLocaleInfo(lcid, LOCALE_SLONGDATE, tmp, sizeof(tmp)-1);
|
---|
1054 | RegSetValueEx(hkey,"sLongDate",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1055 |
|
---|
1056 | GetLocaleInfo(lcid, LOCALE_IDATE, tmp, sizeof(tmp)-1);
|
---|
1057 | RegSetValueEx(hkey,"iDate",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1058 |
|
---|
1059 | GetLocaleInfo(lcid, LOCALE_ITIME, tmp, sizeof(tmp)-1);
|
---|
1060 | RegSetValueEx(hkey,"iTime",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1061 |
|
---|
1062 | GetLocaleInfo(lcid, LOCALE_ITLZERO, tmp, sizeof(tmp)-1);
|
---|
1063 | RegSetValueEx(hkey,"iTLZero",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1064 |
|
---|
1065 | GetLocaleInfo(lcid, LOCALE_S1159, tmp, sizeof(tmp)-1);
|
---|
1066 | RegSetValueEx(hkey,"s1159",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1067 |
|
---|
1068 | GetLocaleInfo(lcid, LOCALE_S2359, tmp, sizeof(tmp)-1);
|
---|
1069 | RegSetValueEx(hkey,"s2359",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1070 |
|
---|
1071 | GetLocaleInfo(lcid, LOCALE_ICALENDARTYPE, tmp, sizeof(tmp)-1);
|
---|
1072 | RegSetValueEx(hkey,"iCalendarType",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
|
---|
1073 |
|
---|
1074 | RegCloseKey(hkey);
|
---|
1075 |
|
---|
1076 | if(RegCreateKey(HKEY_CURRENT_USER,"Control Panel\\International\\Sorting Order",&hkey)!=ERROR_SUCCESS) {
|
---|
1077 | dprintf(("SetupControlPanelKeys: Unable to create key"));
|
---|
1078 | return FALSE;
|
---|
1079 | }
|
---|
1080 | RegCloseKey(hkey);
|
---|
1081 | return TRUE;
|
---|
1082 | }
|
---|
1083 | //******************************************************************************
|
---|
1084 | //[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
|
---|
1085 | //"Bias"=dword:ffffffc4
|
---|
1086 | //"StandardName"="Romance Standard Time"
|
---|
1087 | //"StandardBias"=dword:00000000
|
---|
1088 | //"StandardStart"=hex:00,00,0a,00,05,00,03,00,00,00,00,00,00,00,00,00
|
---|
1089 | // typedef struct _SYSTEMTIME {
|
---|
1090 | // WORD wYear;
|
---|
1091 | // WORD wMonth;
|
---|
1092 | // WORD wDayOfWeek;
|
---|
1093 | // WORD wDay;
|
---|
1094 | // WORD wHour;
|
---|
1095 | // WORD wMinute;
|
---|
1096 | // WORD wSecond;
|
---|
1097 | // WORD wMilliseconds;
|
---|
1098 | //} SYSTEMTIME, *PSYSTEMTIME;
|
---|
1099 | //"DaylightName"="Romance Daylight Time"
|
---|
1100 | //"DaylightBias"=dword:ffffffc4
|
---|
1101 | //"DaylightStart"=hex:00,00,03,00,05,00,02,00,00,00,00,00,00,00,00,00
|
---|
1102 | //"ActiveTimeBias"=dword:ffffffc4
|
---|
1103 | //******************************************************************************
|
---|
1104 | void SetupTimeZoneInfo()
|
---|
1105 | {
|
---|
1106 | HKEY hkey;
|
---|
1107 | DWORD val = 0;
|
---|
1108 | char szTimeZoneStd[4];
|
---|
1109 | char szTimeZoneDay[4];
|
---|
1110 | int sign = FALSE;
|
---|
1111 | int bias;
|
---|
1112 | char *pszTZ = NULL;
|
---|
1113 | SYSTEMTIME stime = {0};
|
---|
1114 | SYSTEMTIME dtime = {0};
|
---|
1115 |
|
---|
1116 | if (RegCreateKey(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation", &hkey) != ERROR_SUCCESS)
|
---|
1117 | {
|
---|
1118 | dprintf(("SetupTimeZoneInfo: Unable to create key"));
|
---|
1119 | return;
|
---|
1120 | }
|
---|
1121 | //Little bit difficult to map the 3 letter timezone to a name
|
---|
1122 | //(duplicate values for different regions)
|
---|
1123 | //So we just copy that timezone string and hope the apps don't really
|
---|
1124 | //on hardcoded timezone names.
|
---|
1125 |
|
---|
1126 | //parse TZ environment variable
|
---|
1127 | pszTZ = getenv("TZ");
|
---|
1128 | if(pszTZ == NULL) {
|
---|
1129 | //default is Central European Time
|
---|
1130 | pszTZ = "CET-1CDT";
|
---|
1131 | }
|
---|
1132 | strncpy(szTimeZoneStd, pszTZ, 3);
|
---|
1133 | szTimeZoneStd[3] = 0;
|
---|
1134 | if(pszTZ[3] == '-') {
|
---|
1135 | sign = TRUE;
|
---|
1136 | pszTZ += 4;
|
---|
1137 | }
|
---|
1138 | else pszTZ += 3;
|
---|
1139 |
|
---|
1140 | if(isdigit(*pszTZ)) {
|
---|
1141 | bias = (int)(*pszTZ - '0') * 60;
|
---|
1142 | pszTZ++;
|
---|
1143 | if(isdigit(*pszTZ)) {//double digit hour difference
|
---|
1144 | bias *= 10;
|
---|
1145 | bias += (int)(*pszTZ - '0') * 60;
|
---|
1146 | pszTZ++;
|
---|
1147 | }
|
---|
1148 | }
|
---|
1149 | else bias = 0;
|
---|
1150 |
|
---|
1151 | if(sign) bias = -bias;
|
---|
1152 |
|
---|
1153 | if(isalpha(*pszTZ)) {//daylight timezone name follows
|
---|
1154 | strncpy(szTimeZoneDay, pszTZ, 3);
|
---|
1155 | szTimeZoneDay[3] = 0;
|
---|
1156 | }
|
---|
1157 | else szTimeZoneDay[0] = 0;
|
---|
1158 |
|
---|
1159 | RegSetValueEx(hkey, "Bias",0,REG_DWORD, (LPBYTE)&bias, sizeof(bias));
|
---|
1160 | RegSetValueEx(hkey, "ActiveTimeBias",0,REG_DWORD, (LPBYTE)&bias, sizeof(bias));
|
---|
1161 |
|
---|
1162 | RegSetValueEx(hkey, "StandardName", 0, REG_SZ, (LPBYTE)szTimeZoneStd, strlen(szTimeZoneStd));
|
---|
1163 | RegSetValueEx(hkey, "StandardBias",0,REG_DWORD, (LPBYTE)&bias, sizeof(bias));
|
---|
1164 | RegSetValueEx(hkey, "StandardStart",0,REG_BINARY, (LPBYTE)&stime, sizeof(stime));
|
---|
1165 | RegSetValueEx(hkey, "DaylightName", 0, REG_SZ, (LPBYTE)szTimeZoneDay, strlen(szTimeZoneDay));
|
---|
1166 | RegSetValueEx(hkey, "DaylightBias",0,REG_DWORD, (LPBYTE)&bias, sizeof(bias));
|
---|
1167 | RegSetValueEx(hkey, "DaylightStart",0,REG_BINARY, (LPBYTE)&dtime, sizeof(dtime));
|
---|
1168 | RegCloseKey(hkey);
|
---|
1169 |
|
---|
1170 | TIME_ZONE_INFORMATION tzinfo;
|
---|
1171 |
|
---|
1172 | tzinfo.Bias = bias;
|
---|
1173 | lstrcpynAtoW(tzinfo.StandardName, szTimeZoneStd, sizeof(tzinfo.StandardName)/sizeof(WCHAR));
|
---|
1174 | tzinfo.StandardDate = stime;
|
---|
1175 | tzinfo.StandardBias = bias;
|
---|
1176 | lstrcpynAtoW(tzinfo.DaylightName, szTimeZoneDay, sizeof(tzinfo.StandardName)/sizeof(WCHAR));
|
---|
1177 | tzinfo.DaylightDate = dtime;
|
---|
1178 | tzinfo.DaylightBias = bias;
|
---|
1179 |
|
---|
1180 | SetTimeZoneInformation(&tzinfo);
|
---|
1181 | }
|
---|
1182 | //******************************************************************************
|
---|
1183 | //******************************************************************************
|
---|
1184 |
|
---|