source: trunk/src/kernel32/initsystem.cpp@ 4946

Last change on this file since 4946 was 4946, checked in by sandervl, 25 years ago

odininst update, CreateProcess fix & workaround for PM hang in WaitForSingleObject (process handle)

File size: 32.6 KB
Line 
1/* $Id: initsystem.cpp,v 1.25 2001-01-14 17:16:54 sandervl Exp $ */
2/*
3 * Odin system initialization (registry, directories & environment)
4 *
5 * Called from the WarpIn install program to create the desktop directories and
6 * to setup the registry
7 *
8 * InitSystemAndRegistry creates:
9 * - SYSTEMDIR\drivers
10 * - SYSTEMDIR\drivers\etc
11 * - WINDOWSDIR\SYSTEM
12 * - WINDOWSDIR\AppData
13 * - WINDOWSDIR\Cache
14 * - WINDOWSDIR\Cookies
15 * - WINDOWSDIR\Desktop
16 * - WINDOWSDIR\Favorites
17 * - WINDOWSDIR\Fonts
18 * - WINDOWSDIR\History
19 * - WINDOWSDIR\NetHood
20 * - WINDOWSDIR\My Documents
21 * - WINDOWSDIR\PrintHood
22 * - WINDOWSDIR\Recent
23 * - WINDOWSDIR\SendTo
24 * - WINDOWSDIR\Start Menu
25 * - WINDOWSDIR\Start Menu\Programs
26 * - WINDOWSDIR\Start Menu\Programs\Startup
27 * - WINDOWSDIR\ShellNew
28 * - x:\Program Files
29 * - x:\Program Files\Common Files
30 * - and a minimal system registry
31 *
32 * Copyright 1999-2000 Sander van Leeuwen (sandervl@xs4all.nl)
33 *
34 * Project Odin Software License can be found in LICENSE.TXT
35 */
36
37#include <os2win.h>
38#include <ctype.h>
39#include <string.h>
40#include "winreg.h"
41#include "global.h"
42#include "winnt.h"
43#include "winerror.h"
44#include "winreg.h"
45#include "debugtools.h"
46#include "cpuhlp.h"
47#include <odininst.h>
48#include <win\options.h>
49#include "directory.h"
50#include <versionos2.h>
51
52#define DBG_LOCALLOG DBG_initsystem
53#include "dbglocal.h"
54
55#define DDRAW_CLASSID "{D7B70EE0-4340-11CF-B063-0020AFC2CD35}"
56#define DDRAW_DEFAULT "DirectDraw Object"
57#define DDRAW_CLIPPER_CLASSID "{593817A0-7DB3-11CF-A2DE-00AA00B93356}"
58#define DDRAW_CLIPPER_DEFAULT "DirectDraw Clipper Object"
59#define DDRAW_DLL "ddraw.dll"
60#define DSOUND_CLASSID "{47D4D946-62E8-11cf-93BC-444553540000}"
61#define DSOUND_DEFAULT "DirectSound Object"
62#define DSOUND_DLL "dsound.dll"
63#define DPLAYX_CLASSID "{D1EB6D20-8923-11d0-9D97-00A0C90A43CB}"
64#define DPLAYX_DEFAULT "DirectPlay Object"
65#define DPLAYX_DLL "dplayx.dll"
66#define DPLAYX_LOBBY_CLASSID "{2FE8F810-B2A5-11d0-A787-0000F803ABFC}"
67#define DPLAYX_LOBBY_DEFAULT "DirectPlayLobby Object"
68#define DPLAYX_LOBBY_DLL DPLAYX_DLL
69
70#define CLASS_DESKTOP "Desktop"
71#define CLASS_SHORTCUT "Shortcut"
72#define CLASS_SHELL32DLL "shell32.dll"
73#define CLASS_SHDOCVW "shdocvw.dll"
74#define COM_CLASS_ID "CLSID"
75#define COM_INPROCSERVER "InprocServer32"
76#define COM_THREADMODEL "ThreadingModel"
77#define COM_THREAD_APARTMENT "Apartment"
78#define THREAD_BOTH "Both"
79#define INITREG_ERROR "InitRegistry: Unable to register system information"
80#define DIR_PROGRAM "ProgramFilesDir"
81#define DIR_PROGRAM_COMMON "CommonFilesDir"
82#define DIR_SHARED "SharedDir"
83#define HARDWARE_VIDEO_GRADD "\\REGISTRY\\Machine\\System\\CurrentControlSet\\Services\\Gradd\\Device0"
84#define HARDWARE_VIDEO_GRADD_DESCRIPTION "OS/2 Display driver"
85#define HARDWARE_VIDEO_VGA "\\REGISTRY\\Machine\\System\\CurrentControlSet\\Services\\VgaSave\\Device0"
86#define HARDWARE_VIDEO_VGA_DESCRIPTION "OS/2 VGA Display driver"
87#define HARDWARE_VIDEO_COMPATIBLE "\\Device\\Video1"
88#define DIRECTX_RC "0"
89#define DIRECTX_VERSION "4.04.1381.276"
90#define DIRECTX_INSTALLED_VERSION 0x0004
91#define ODIN_WINMM_PLAYBACK "OS/2 Dart Audio Playback"
92#define ODIN_WINMM_RECORD "OS/2 Dart Audio Record"
93
94#define KEY_DEVICE_TYPE "Type"
95#define KEY_DEVICE_START "Start"
96#define KEY_DEVICE_GROUP "Group"
97#define KEY_DEVICE_ERRORCONTROL "ErrorControl"
98#define KEY_DEVICE_AUTORUN "Autorun"
99#define KEY_DEVICE_TAG "Tag"
100#define DEVICE_GROUP_FILESYSTEM "File system"
101#define DEVICE_GROUP_SCSICDROM "SCSI CDROM Class"
102
103//******************************************************************************
104//******************************************************************************
105//******************************************************************************
106//[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows]
107//"Directory"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,00
108//"SystemDirectory"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,\
109// 6d,33,32,00
110//"ErrorMode"=dword:00000000
111//"NoInteractiveServices"=dword:00000000
112//"CSDVersion"=dword:00000300
113BYTE ShutdownTime[] = {0x44,0x5e,0xf2,0xbb,0x84,0x41,0xbf,0x01};
114//******************************************************************************
115BOOL InitSystemAndRegistry()
116{
117 HKEY hkey, hkey1;
118 char *buf;
119 DWORD val;
120 char digbuf[16];
121 char shellpath[260];
122
123 if(RegCreateKeyA(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 = InternalGetWindowsDirectoryA();
128 RegSetValueExA(hkey,"Directory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
129 buf = InternalGetSystemDirectoryA();
130 RegSetValueExA(hkey,"SystemDirectory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
131 val = 0;
132 RegSetValueExA(hkey,"ErrorMode",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
133 val = 0;
134 RegSetValueExA(hkey,"NoInteractiveServices",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
135 val = ODINNT_BUILD_NR;
136 RegSetValueExA(hkey,"CSDVersion",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
137 RegSetValueExA(hkey,"ShutdownTime",0,REG_DWORD, (LPBYTE)ShutdownTime, sizeof(ShutdownTime));
138 RegCloseKey(hkey);
139
140 //Software\Microsoft\Windows\CurrentVersion\RunOnce
141 if(RegCreateKeyA(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(RegCreateKeyA(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(RegCreateKeyA(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, InternalGetWindowsDirectoryA());
159 strcat(shellpath, "\\IEXPLORE.EXE");
160 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
161 RegCloseKey(hkey);
162
163
164 if(RegCreateKeyA(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 = InternalGetSystemDirectoryA();
169 RegSetValueExA(hkey,"SystemRoot",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
170 RegSetValueExA(hkey,"PathName",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
171 sprintf(digbuf, "%d", ODINNT_BUILD_NR);
172 RegSetValueExA(hkey,"CurrentBuildNumber",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
173 RegSetValueExA(hkey,"CurrentType",0,REG_SZ, (LPBYTE)ODINNT_OSTYPE_UNI, sizeof(ODINNT_OSTYPE_UNI));
174 RegSetValueExA(hkey,"CSDVersion",0,REG_SZ, (LPBYTE)ODINNT_CSDVERSION, sizeof(ODINNT_CSDVERSION));
175 RegSetValueExA(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 RegSetValueExA(hkey,"CurrentVersion",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
179
180 val = (DWORD)time(NULL); //todo: Correct format???
181 RegSetValueExA(hkey,"InstallDate",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
182
183 RegCloseKey(hkey);
184 //todo: productid, registered org/owner, sourcepath,
185
186 //Create Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders keys
187 //"Favorites"="C:\WINDOWS\Favorites"
188 //"StartUp"="C:\WINDOWS\Start Menu\Programs\Startup"
189 //"Desktop"="C:\WINDOWS\Desktop"
190 //"Programs"="C:\WINDOWS\Start Menu\Programs"
191 //"Fonts"="C:\WINDOWS\Fonts"
192 //"SendTo"="C:\WINDOWS\SendTo"
193 //"Start Menu"="C:\WINDOWS\Start Menu"
194 //"Templates"="C:\WINDOWS\ShellNew"
195 //"Recent"="C:\WINDOWS\Recent"
196 //"NetHood"="C:\WINDOWS\NetHood"
197 //"Personal"="C:\My Documents"
198
199 if(RegCreateKeyA(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",&hkey)!=ERROR_SUCCESS) {
200 dprintf(("InitRegistry: Unable to register system information (3)"));
201 return FALSE;
202 }
203// if(RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey) != ERROR_SUCCESS)
204// {
205 //system32\drivers dir
206 strcpy(shellpath, InternalGetSystemDirectoryA());
207 strcat(shellpath, "\\Drivers");
208 CreateDirectoryA(shellpath, NULL);
209 strcat(shellpath, "\\etc");
210 CreateDirectoryA(shellpath, NULL);
211
212 //SYSTEM dir
213 strcpy(shellpath, InternalGetWindowsDirectoryA());
214 strcat(shellpath, "\\SYSTEM");
215 CreateDirectoryA(shellpath, NULL);
216
217 //AppData
218 strcpy(shellpath, InternalGetWindowsDirectoryA());
219 strcat(shellpath, "\\Application Data");
220 CreateDirectoryA(shellpath, NULL);
221 RegSetValueExA(hkey,"AppData",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
222 //Cache
223 strcpy(shellpath, InternalGetWindowsDirectoryA());
224 strcat(shellpath, "\\Temporary Internet Files");
225 CreateDirectoryA(shellpath, NULL);
226 RegSetValueExA(hkey,"Cache",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
227 //Cookies
228 strcpy(shellpath, InternalGetWindowsDirectoryA());
229 strcat(shellpath, "\\Cookies");
230 CreateDirectoryA(shellpath, NULL);
231 RegSetValueExA(hkey,"Cookies",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
232 //Desktop
233 strcpy(shellpath, InternalGetWindowsDirectoryA());
234 strcat(shellpath, "\\Desktop");
235 CreateDirectoryA(shellpath, NULL);
236 RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
237 //Favorites
238 strcpy(shellpath, InternalGetWindowsDirectoryA());
239 strcat(shellpath, "\\Favorites");
240 CreateDirectoryA(shellpath, NULL);
241 RegSetValueExA(hkey,"Favorites",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
242 //Fonts
243 strcpy(shellpath, InternalGetWindowsDirectoryA());
244 strcat(shellpath, "\\Fonts");
245 CreateDirectoryA(shellpath, NULL);
246 RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
247 //History
248 strcpy(shellpath, InternalGetWindowsDirectoryA());
249 strcat(shellpath, "\\History");
250 CreateDirectoryA(shellpath, NULL);
251 RegSetValueExA(hkey,"History",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
252 //NetHood
253 strcpy(shellpath, InternalGetWindowsDirectoryA());
254 strcat(shellpath, "\\NetHood");
255 CreateDirectoryA(shellpath, NULL);
256 RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
257 //Personal
258 strcpy(shellpath, InternalGetWindowsDirectoryA());
259 strcat(shellpath, "\\My Documents");
260 CreateDirectoryA(shellpath, NULL);
261 RegSetValueExA(hkey,"Personal",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
262 //PrintHood
263 strcpy(shellpath, InternalGetWindowsDirectoryA());
264 strcat(shellpath, "\\PrintHood");
265 CreateDirectoryA(shellpath, NULL);
266 RegSetValueExA(hkey,"PrintHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
267 //Recent
268 strcpy(shellpath, InternalGetWindowsDirectoryA());
269 strcat(shellpath, "\\Recent");
270 CreateDirectoryA(shellpath, NULL);
271 RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
272 //SendTo
273 strcpy(shellpath, InternalGetWindowsDirectoryA());
274 strcat(shellpath, "\\SendTo");
275 CreateDirectoryA(shellpath, NULL);
276 RegSetValueExA(hkey,"SendTo",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
277 //Start Menu
278 strcpy(shellpath, InternalGetWindowsDirectoryA());
279 strcat(shellpath, "\\Start Menu");
280 CreateDirectoryA(shellpath, NULL);
281 RegSetValueExA(hkey,"Start Menu",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
282 //Programs
283 strcpy(shellpath, InternalGetWindowsDirectoryA());
284 strcat(shellpath, "\\Start Menu\\Programs");
285 CreateDirectoryA(shellpath, NULL);
286 RegSetValueExA(hkey,"Programs",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
287 //Startup
288 strcat(shellpath, "\\Startup");
289 CreateDirectoryA(shellpath, NULL);
290 RegSetValueExA(hkey,"Startup",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
291 //ShellNew
292 strcpy(shellpath, InternalGetWindowsDirectoryA());
293 strcat(shellpath, "\\ShellNew");
294 CreateDirectoryA(shellpath, NULL);
295 RegSetValueExA(hkey,"Templates",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
296// }
297 RegCloseKey(hkey);
298
299 //Shell32 & IE related keys
300 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021400-0000-0000-C000-000000000046}]
301 //@="Desktop"
302 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021400-0000-0000-C000-000000000046}\InProcServer32]
303 //@="shell32.dll"
304 //ThreadingModel="Apartment"
305 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
306 goto initreg_error;
307 }
308 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_DESKTOP, sizeof(CLASS_DESKTOP));
309 RegCloseKey(hkey);
310 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
311 goto initreg_error;
312 }
313 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL));
314 RegSetValueExA(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
315 RegCloseKey(hkey);
316 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}]
317 //@="Shortcut"
318 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}\InProcServer32]
319 //@="shell32.dll"
320 //"ThreadingModel"="Apartment"
321 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}\shellex\MayChangeDefaultMenu]
322 //@=""
323 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
324 goto initreg_error;
325 }
326 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHORTCUT, sizeof(CLASS_SHORTCUT));
327 RegCloseKey(hkey);
328 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
329 goto initreg_error;
330 }
331 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL));
332 RegSetValueExA(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
333 RegCloseKey(hkey);
334 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\shellex\\MayChangeDefaultMenu",&hkey)!=ERROR_SUCCESS) {
335 goto initreg_error;
336 }
337 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)"", 0);
338 RegCloseKey(hkey);
339
340 //# Entries for IWebBrowser
341 //# Used by Internet Explorer HTML-rendering control
342 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}]
343 //@="Shortcut"
344 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\InProcServer32]
345 //@="shdocvw.dll"
346 //"ThreadingModel"="Apartment"
347 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\shellex\MayChangeDefaultMenu]
348 //@=""
349
350 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}",&hkey)!=ERROR_SUCCESS) {
351 goto initreg_error;
352 }
353 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHORTCUT, sizeof(CLASS_SHORTCUT));
354 RegCloseKey(hkey);
355
356 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
357 goto initreg_error;
358 }
359 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHDOCVW, sizeof(CLASS_SHDOCVW));
360 RegSetValueExA(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
361 RegCloseKey(hkey);
362
363 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}\\shellex\\MayChangeDefaultMenu",&hkey)!=ERROR_SUCCESS) {
364 goto initreg_error;
365 }
366 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)"", 1);
367 RegCloseKey(hkey);
368
369 //Now the Ddraw & dsound registry keys:
370 //HKEY_CLASSES_ROOT\DirectDraw = DirectDraw Object
371 //HKEY_CLASSES_ROOT\DirectDraw\CLSID = {D7B70EE0-4340-11CF-B063-0020AFC2CD35}
372 //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35} = DirectDraw Object
373 //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35}\InprocServer32 = ddraw.dll
374 if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectDraw",&hkey)!=ERROR_SUCCESS) {
375 goto initreg_error;
376 }
377 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
378 if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
379 RegCloseKey(hkey);
380 goto initreg_error;
381 }
382 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLASSID, sizeof(DDRAW_CLASSID));
383 RegCloseKey(hkey1);
384 RegCloseKey(hkey);
385
386 if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLASSID ,&hkey)!=ERROR_SUCCESS) {
387 goto initreg_error;
388 }
389 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
390 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
391 RegCloseKey(hkey);
392 goto initreg_error;
393 }
394 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
395 RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
396 RegCloseKey(hkey1);
397 RegCloseKey(hkey);
398
399 //HKEY_CLASSES_ROOT\DirectDrawClipper = DirectDraw Clipper Object
400 //HKEY_CLASSES_ROOT\DirectDrawClipper\CLSID = {593817A0-7DB3-11CF-A2DE-00AA00B93356}
401 //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356} = DirectDraw Clipper Object
402 //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356}\InprocServer32 = ddraw.dll
403 if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectDrawClipper",&hkey)!=ERROR_SUCCESS) {
404 goto initreg_error;
405 }
406 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
407 if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
408 RegCloseKey(hkey);
409 goto initreg_error;
410 }
411 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_CLASSID, sizeof(DDRAW_CLIPPER_CLASSID));
412 RegCloseKey(hkey1);
413 RegCloseKey(hkey);
414
415 if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLIPPER_CLASSID,&hkey)!=ERROR_SUCCESS) {
416 goto initreg_error;
417 }
418 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
419 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
420 RegCloseKey(hkey);
421 goto initreg_error;
422 }
423 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
424 RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
425 RegCloseKey(hkey1);
426 RegCloseKey(hkey);
427
428 //HKEY_CLASSES_ROOT\DirectSound = DirectSound Object
429 //HKEY_CLASSES_ROOT\DirectSound\CLSID = {47D4D946-62E8-11cf-93BC-444553540000}
430 //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000} = DirectSound Object
431 //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000}\InprocServer32 = dsound.dll
432 if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectSound",&hkey)!=ERROR_SUCCESS) {
433 goto initreg_error;
434 }
435 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
436 if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
437 RegCloseKey(hkey);
438 goto initreg_error;
439 }
440 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_CLASSID, sizeof(DSOUND_CLASSID));
441 RegCloseKey(hkey1);
442 RegCloseKey(hkey);
443
444 if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DSOUND_CLASSID ,&hkey)!=ERROR_SUCCESS) {
445 goto initreg_error;
446 }
447 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
448 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
449 RegCloseKey(hkey);
450 goto initreg_error;
451 }
452 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_DLL, sizeof(DSOUND_DLL));
453 RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
454 RegCloseKey(hkey1);
455 RegCloseKey(hkey);
456
457 //DirectPlay
458 if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_CLASSID ,&hkey)!=ERROR_SUCCESS) {
459 goto initreg_error;
460 }
461 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_DEFAULT, sizeof(DPLAYX_DEFAULT));
462 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
463 RegCloseKey(hkey);
464 goto initreg_error;
465 }
466 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_DLL, sizeof(DPLAYX_DLL));
467 RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
468 RegCloseKey(hkey1);
469 RegCloseKey(hkey);
470
471 //DirectPlay Lobby
472 if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_LOBBY_CLASSID ,&hkey)!=ERROR_SUCCESS) {
473 goto initreg_error;
474 }
475 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DEFAULT, sizeof(DPLAYX_LOBBY_DEFAULT));
476 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
477 RegCloseKey(hkey);
478 goto initreg_error;
479 }
480 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DLL, sizeof(DPLAYX_LOBBY_DLL));
481 RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
482 RegCloseKey(hkey1);
483 RegCloseKey(hkey);
484
485 //[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion]
486 //"ProgramFilesDir"="C:\Program Files"
487 //"CommonFilesDir"="C:\Program Files\Common Files"
488 //# 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.
489 //"SharedDir"="C:\WINDOWS"
490 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
491 goto initreg_error;
492 }
493 //Create x:\Program Files directory
494 strcpy(shellpath, InternalGetWindowsDirectoryA());
495 shellpath[2] = 0; //get drive
496 strcat(shellpath, "\\Program Files");
497 CreateDirectoryA(shellpath, NULL);
498 RegSetValueExA(hkey, DIR_PROGRAM, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
499
500 //Create x:\Program Files\Common Files directory
501 strcat(shellpath, "\\Common Files");
502 CreateDirectoryA(shellpath, NULL);
503 RegSetValueExA(hkey, DIR_PROGRAM_COMMON, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
504
505 strcpy(shellpath, InternalGetWindowsDirectoryA());
506 RegSetValueExA(hkey, DIR_SHARED, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
507
508 RegCloseKey(hkey);
509
510 //[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\VIDEO]
511 //"\\Device\\Video0"="\\REGISTRY\\Machine\\System\\ControlSet001\\Services\\mga64\\Device0"
512 //"\\Device\\Video1"="\\REGISTRY\\Machine\\System\\ControlSet001\\Services\\VgaSave\\Device0"
513 //"VgaCompatible"="\\Device\\Video1"
514 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\VIDEO",&hkey)!=ERROR_SUCCESS) {
515 goto initreg_error;
516 }
517 RegSetValueExA(hkey,"\\Device\\Video0",0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD, sizeof(HARDWARE_VIDEO_GRADD));
518 RegSetValueExA(hkey,"\\Device\\Video1",0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_VGA, sizeof(HARDWARE_VIDEO_VGA));
519 RegSetValueExA(hkey, "VgaCompatible", 0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_COMPATIBLE, sizeof(HARDWARE_VIDEO_COMPATIBLE));
520 RegCloseKey(hkey);
521
522 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Gradd\\Device0",&hkey)!=ERROR_SUCCESS) {
523 goto initreg_error;
524 }
525 RegSetValueExA(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD_DESCRIPTION, sizeof(HARDWARE_VIDEO_GRADD_DESCRIPTION));
526 RegCloseKey(hkey);
527
528 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\VgaSave\\Device0",&hkey)!=ERROR_SUCCESS) {
529 goto initreg_error;
530 }
531 RegSetValueExA(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_VGA_DESCRIPTION, sizeof(HARDWARE_VIDEO_VGA_DESCRIPTION));
532 RegCloseKey(hkey);
533
534 //Software\Microsoft\Multimedia\Sound Mapper
535 if(RegCreateKeyA(HKEY_CURRENT_USER,"Software\\Microsoft\\Multimedia\\Sound Mapper",&hkey)!=ERROR_SUCCESS) {
536 goto initreg_error;
537 }
538 RegSetValueExA(hkey,"Playback", 0, REG_SZ, (LPBYTE)ODIN_WINMM_PLAYBACK, sizeof(ODIN_WINMM_PLAYBACK));
539 RegSetValueExA(hkey,"Record", 0, REG_SZ, (LPBYTE)ODIN_WINMM_RECORD, sizeof(ODIN_WINMM_RECORD));
540 RegCloseKey(hkey);
541
542 //Software\Microsoft\DirectX
543 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectX",&hkey)!=ERROR_SUCCESS) {
544 goto initreg_error;
545 }
546 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)"", 0);
547 RegSetValueExA(hkey, "RC", 0,REG_SZ, (LPBYTE)DIRECTX_RC, sizeof(DIRECTX_RC));
548 RegSetValueExA(hkey, "Version", 0,REG_SZ, (LPBYTE)DIRECTX_VERSION, sizeof(DIRECTX_VERSION));
549 val = DIRECTX_INSTALLED_VERSION;
550 RegSetValueExA(hkey, "InstalledVersion", 0,REG_BINARY, (LPBYTE)&val, sizeof(DWORD));
551 RegCloseKey(hkey);
552
553 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectDraw",&hkey)!=ERROR_SUCCESS) {
554 goto initreg_error;
555 }
556 //todo
557 RegCloseKey(hkey);
558
559 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Direct3D",&hkey)!=ERROR_SUCCESS) {
560 goto initreg_error;
561 }
562 //todo
563 RegCloseKey(hkey);
564
565 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectPlay",&hkey)!=ERROR_SUCCESS) {
566 goto initreg_error;
567 }
568 //todo
569 RegCloseKey(hkey);
570
571#if 0
572 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectMusic",&hkey)!=ERROR_SUCCESS) {
573 goto initreg_error;
574 }
575 //todo
576 RegCloseKey(hkey);
577#endif
578
579// [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs]
580// "Type"=dword:00000002
581// "Start"=dword:00000004
582// "Group"="File system"
583// "ErrorControl"=dword:00000001
584// "DependOnGroup"=hex(7):53,43,53,49,20,43,44,52,4f,4d,20,43,6c,61,73,73,00,00
585
586 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdfs",&hkey)!=ERROR_SUCCESS) {
587 goto initreg_error;
588 }
589 val = 0x2;
590 RegSetValueExA(hkey, KEY_DEVICE_TYPE,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
591 val = 0x4;
592 RegSetValueExA(hkey, KEY_DEVICE_START,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
593 val = 0x1;
594 RegSetValueExA(hkey, KEY_DEVICE_ERRORCONTROL,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
595 RegSetValueExA(hkey, KEY_DEVICE_GROUP,0,REG_SZ, (LPBYTE)DEVICE_GROUP_FILESYSTEM, sizeof(DEVICE_GROUP_FILESYSTEM));
596 //todo dependongroup
597 RegCloseKey(hkey);
598
599
600/*
601// [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs\Enum]
602// "0"="Root\\LEGACY_CDFS\\0000"
603// "Count"=dword:00000001
604// "NextInstance"=dword:00000001
605*/
606// [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom]
607// "Type"=dword:00000001
608// "Start"=dword:00000001
609// "Group"="SCSI CDROM Class"
610// "ErrorControl"=dword:00000000
611// "Tag"=dword:00000002
612// "DependOnGroup"=hex(7):53,43,53,49,20,6d,69,6e,69,70,6f,72,74,00,00
613// "Autorun"=dword:00000001
614
615 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdrom",&hkey)!=ERROR_SUCCESS) {
616 goto initreg_error;
617 }
618 val = 0x1;
619 RegSetValueExA(hkey, KEY_DEVICE_TYPE,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
620 val = 0x1;
621 RegSetValueExA(hkey, KEY_DEVICE_START,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
622 val = 0x0;
623 RegSetValueExA(hkey, KEY_DEVICE_ERRORCONTROL,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
624 val = 0x2;
625 RegSetValueExA(hkey, KEY_DEVICE_TAG,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
626 val = 0x0;
627 RegSetValueExA(hkey, KEY_DEVICE_AUTORUN,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
628 RegSetValueExA(hkey, KEY_DEVICE_GROUP,0,REG_SZ, (LPBYTE)DEVICE_GROUP_SCSICDROM, sizeof(DEVICE_GROUP_SCSICDROM));
629 //todo dependongroup
630 RegCloseKey(hkey);
631
632/*
633[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom\Enum]
634"0"="Root\\LEGACY_CDROM\\0000"
635"Count"=dword:00000001
636"NextInstance"=dword:00000001
637*/
638
639 //[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\FileSystem]
640 //"Win31FileSystem"=dword:00000000
641 //"NtfsDisable8dot3NameCreation"=dword:00000000
642 //"Win95TruncatedExtensions"=dword:00000001
643 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\FileSystem",&hkey)!=ERROR_SUCCESS) {
644 goto initreg_error;
645 }
646 val = 0x0;
647 RegSetValueExA(hkey, "Win31FileSystem",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
648 val = 0x0;
649 RegSetValueExA(hkey, "NtfsDisable8dot3NameCreation",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
650 val = 0x1;
651 RegSetValueExA(hkey, "Win95TruncatedExtensions",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
652 RegCloseKey(hkey);
653
654
655//[HKEY_LOCAL_MACHINE\Software\Microsoft\OLE]
656//# allow cross-machine calls (RPC) (default Y)
657//"EnableDCOM"="Y"
658//# allow incoming connections ? (def. N)
659//"EnableRemoteConnect"="N"
660 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\OLE",&hkey)!=ERROR_SUCCESS) {
661 goto initreg_error;
662 }
663 digbuf[0] = 'Y';
664 digbuf[1] = 0;
665 RegSetValueExA(hkey, "EnableDCOM",0,REG_SZ, (LPBYTE)digbuf, 2);
666 digbuf[0] = 'N';
667 digbuf[1] = 0;
668 RegSetValueExA(hkey, "EnableRemoteConnect",0,REG_SZ, (LPBYTE)digbuf, 2);
669 RegCloseKey(hkey);
670
671 //Add MS Sans Serif to WarpSans font conversion entry
672 char temp;
673 if(PROFILE_GetOdinIniString(ODINFONTSECTION, "MS Sans Serif", "", &temp,
674 0) <= 1)
675 {
676 PROFILE_SetOdinIniString(ODINFONTSECTION, "MS Sans Serif", "WarpSans");
677 }
678
679 return TRUE;
680
681initreg_error:
682 dprintf((INITREG_ERROR));
683 return FALSE;
684}
685//******************************************************************************
686//Environment variables created by Windows NT:
687//
688//COMPUTERNAME=NTBAK
689//ComSpec=E:\WINNT\system32\cmd.exe
690//CPU=i386
691//HOMEDRIVE=E:
692//HOMEPATH=\
693//LOGONSERVER=\\NTBAK
694//NUMBER_OF_PROCESSORS=2
695//OS=Windows_NT
696//PATHEXT=.COM;.EXE;.BAT;.CMD
697//PROCESSOR_ARCHITECTURE=x86
698//PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 5, GenuineIntel
699//PROCESSOR_LEVEL=6
700//PROCESSOR_REVISION=0605
701//SystemDrive=E:
702//SystemRoot=E:\WINNT
703//USERDOMAIN=NTBAK
704//USERNAME=Sander
705//USERPROFILE=E:\WINNT\Profiles\Sander
706//windir=E:\WINNT
707//******************************************************************************
708void InitEnvironment(int nrcpus)
709{
710 char buffer[64];
711 char buffer1[32];
712 char *windir;
713 DWORD signature;
714
715 SetEnvironmentVariableA("CPU", "i386");
716 SetEnvironmentVariableA("PROCESSOR_ARCHITECTURE", "x86");
717 if(SupportsCPUID()) {
718 GetCPUVendorString(buffer1);
719 buffer1[12] = 0;
720 signature = GetCPUSignature();
721 sprintf(buffer, "x86 Family %x Model %x Stepping %x, %s", (signature >> 8)&0xf, signature & 0xf, (signature >> 4)&0xf, buffer1);
722 SetEnvironmentVariableA("PROCESSOR_IDENTIFIER", buffer);
723 sprintf(buffer, "%x", (signature >> 8)&0xf);
724 SetEnvironmentVariableA("PROCESSOR_LEVEL", buffer);
725 sprintf(buffer, "%02x%02x", (signature >> 4)&0xf, signature & 0xf);
726 SetEnvironmentVariableA("PROCESSOR_REVISION", buffer);
727 }
728 sprintf(buffer, "%d", nrcpus);
729 SetEnvironmentVariableA("NUMBER_OF_PROCESSORS", buffer);
730 SetEnvironmentVariableA("OS", "Windows_NT");
731 SetEnvironmentVariableA("PATHEXT", ".COM;.EXE;.BAT;.CMD");
732 windir = InternalGetWindowsDirectoryA();
733 SetEnvironmentVariableA("windir", windir);
734 SetEnvironmentVariableA("SystemRoot", windir);
735 buffer[0] = windir[0];
736 buffer[1] = windir[1];
737 buffer[2] = 0;
738 SetEnvironmentVariableA("SystemDrive", buffer);
739 SetEnvironmentVariableA("HOMEDRIVE", buffer);
740 SetEnvironmentVariableA("HOMEPATH", "\\");
741
742 //TODO:
743 //COMPUTERNAME=NTBAK
744 //ComSpec=E:\WINNT\system32\cmd.exe
745 //LOGONSERVER=\\NTBAK
746 //USERDOMAIN=NTBAK
747 //USERNAME=Sander
748 //USERPROFILE=E:\WINNT\Profiles\Sander
749}
750//******************************************************************************
751//Create/change keys that may change (i.e. odin.ini keys that affect windows version)
752//******************************************************************************
753void InitDynamicRegistry()
754{
755 OSVERSIONINFOA versioninfo;
756 HKEY hkey;
757 char buf[16] = "";
758
759 versioninfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
760 GetVersionExA(&versioninfo);
761
762 //Set version key:
763 // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions]
764 // "ProductType"="WinNT"
765 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",&hkey)!=ERROR_SUCCESS) {
766 dprintf(("InitRegistry: Unable to register system information (2)"));
767 return;
768 }
769 switch(versioninfo.dwPlatformId) {
770 case VER_PLATFORM_WIN32_WINDOWS:
771 strcpy(buf, "Win98"); //TODO: Correct???????????
772 break;
773 case VER_PLATFORM_WIN32_NT:
774 strcpy(buf, "WinNT"); //TODO: Also correct for Windows 2000???
775 break;
776 default:
777 DebugInt3();
778 break;
779 }
780 RegSetValueExA(hkey,"ProductType",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
781 RegCloseKey(hkey);
782}
783//******************************************************************************
784//******************************************************************************
785
Note: See TracBrowser for help on using the repository browser.