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

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

MultiByteToWideChar & lstrcpynA bugfixes; added cdaudio system.ini section

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