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

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

added program files & common files registry keys + dir creation for odininst

File size: 16.8 KB
Line 
1/* $Id: initsystem.cpp,v 1.11 2000-08-01 23:20:29 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 * - WINDOWSDIR\SYSTEM
10 * - WINDOWSDIR\AppData
11 * - WINDOWSDIR\Cache
12 * - WINDOWSDIR\Cookies
13 * - WINDOWSDIR\Desktop
14 * - WINDOWSDIR\Favorites
15 * - WINDOWSDIR\Fonts
16 * - WINDOWSDIR\History
17 * - WINDOWSDIR\NetHood
18 * - WINDOWSDIR\My Documents
19 * - WINDOWSDIR\PrintHood
20 * - WINDOWSDIR\Recent
21 * - WINDOWSDIR\SendTo
22 * - WINDOWSDIR\Start Menu
23 * - WINDOWSDIR\Start Menu\Programs
24 * - WINDOWSDIR\Start Menu\Programs\Startup
25 * - WINDOWSDIR\ShellNew
26 * - x:\Program Files
27 * - x:\Program Files\Common Files
28 * - and a minimal system registry
29 *
30 * Copyright 1999-2000 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 <ctype.h>
37#include <string.h>
38#include "winreg.h"
39#include "global.h"
40#include "winnt.h"
41#include "winerror.h"
42#include "winreg.h"
43#include "debugtools.h"
44#include "cpuhlp.h"
45#include <odininst.h>
46#include "directory.h"
47#include <versionos2.h>
48
49#define DBG_LOCALLOG DBG_initsystem
50#include "dbglocal.h"
51
52#define DDRAW_CLASSID "{D7B70EE0-4340-11CF-B063-0020AFC2CD35}"
53#define DDRAW_DEFAULT "DirectDraw Object"
54#define DDRAW_CLIPPER_CLASSID "{593817A0-7DB3-11CF-A2DE-00AA00B93356}"
55#define DDRAW_CLIPPER_DEFAULT "DirectDraw Clipper Object"
56#define DDRAW_DLL "ddraw.dll"
57#define DSOUND_CLASSID "{47D4D946-62E8-11cf-93BC-444553540000}"
58#define DSOUND_DEFAULT "DirectSound Object"
59#define DSOUND_DLL "dsound.dll"
60#define COM_CLASS_ID "CLSID"
61#define COM_INPROCSERVER "InprocServer32"
62#define COM_THREADMODEL "ThreadingModel"
63#define THREAD_BOTH "Both"
64#define INITREG_ERROR "InitRegistry: Unable to register system information"
65#define DIR_PROGRAM "ProgramFilesDir"
66#define DIR_PROGRAM_COMMON "CommonFilesDir"
67#define DIR_SHARED "SharedDir"
68
69//******************************************************************************
70//******************************************************************************
71//******************************************************************************
72//[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows]
73//"Directory"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,00
74//"SystemDirectory"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,\
75// 6d,33,32,00
76//"ErrorMode"=dword:00000000
77//"NoInteractiveServices"=dword:00000000
78//"CSDVersion"=dword:00000300
79BYTE ShutdownTime[] = {0x44,0x5e,0xf2,0xbb,0x84,0x41,0xbf,0x01};
80//******************************************************************************
81BOOL InitSystemAndRegistry()
82{
83 HKEY hkey, hkey1;
84 char *buf;
85 DWORD val;
86 char digbuf[16];
87
88 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Windows",&hkey)!=ERROR_SUCCESS) {
89 dprintf(("InitRegistry: Unable to register system information\n"));
90 return FALSE;
91 }
92 buf = InternalGetWindowsDirectoryA();
93 RegSetValueExA(hkey,"Directory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
94 buf = InternalGetSystemDirectoryA();
95 RegSetValueExA(hkey,"SystemDirectory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
96 val = 0;
97 RegSetValueExA(hkey,"ErrorMode",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
98 val = 0;
99 RegSetValueExA(hkey,"NoInteractiveServices",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
100 val = ODINNT_BUILD_NR;
101 RegSetValueExA(hkey,"CSDVersion",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
102 RegSetValueExA(hkey,"ShutdownTime",0,REG_DWORD, (LPBYTE)ShutdownTime, sizeof(ShutdownTime));
103 RegCloseKey(hkey);
104
105 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
106 dprintf(("InitRegistry: Unable to register system information (2)"));
107 return FALSE;
108 }
109 buf = InternalGetSystemDirectoryA();
110 RegSetValueExA(hkey,"SystemRoot",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
111 RegSetValueExA(hkey,"PathName",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
112 sprintf(digbuf, "%d", ODINNT_BUILD_NR);
113 RegSetValueExA(hkey,"CurrentBuildNumber",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
114 RegSetValueExA(hkey,"CurrentType",0,REG_SZ, (LPBYTE)ODINNT_OSTYPE_UNI, sizeof(ODINNT_OSTYPE_UNI));
115 RegSetValueExA(hkey,"CSDVersion",0,REG_SZ, (LPBYTE)ODINNT_CSDVERSION, sizeof(ODINNT_CSDVERSION));
116 RegSetValueExA(hkey,"SoftwareType",0,REG_SZ, (LPBYTE)ODINNT_SOFTWARE_TYPE, sizeof(ODINNT_SOFTWARE_TYPE));
117
118 sprintf(digbuf, "%d.%d", ODINNT_MAJOR_VERSION, ODINNT_MINOR_VERSION);
119 RegSetValueExA(hkey,"CurrentVersion",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
120
121 val = (DWORD)time(NULL); //todo: Correct format???
122 RegSetValueExA(hkey,"InstallDate",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
123
124 RegCloseKey(hkey);
125 //todo: productid, registered org/owner, sourcepath,
126
127 //Create Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders keys
128 //"Favorites"="C:\WINDOWS\Favorites"
129 //"StartUp"="C:\WINDOWS\Start Menu\Programs\Startup"
130 //"Desktop"="C:\WINDOWS\Desktop"
131 //"Programs"="C:\WINDOWS\Start Menu\Programs"
132 //"Fonts"="C:\WINDOWS\Fonts"
133 //"SendTo"="C:\WINDOWS\SendTo"
134 //"Start Menu"="C:\WINDOWS\Start Menu"
135 //"Templates"="C:\WINDOWS\ShellNew"
136 //"Recent"="C:\WINDOWS\Recent"
137 //"NetHood"="C:\WINDOWS\NetHood"
138 //"Personal"="C:\My Documents"
139
140 char shellpath[260];
141
142 if(RegCreateKeyA(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",&hkey)!=ERROR_SUCCESS) {
143 dprintf(("InitRegistry: Unable to register system information (3)"));
144 return FALSE;
145 }
146// if(RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey) != ERROR_SUCCESS)
147// {
148 //SYSTEM dir
149 strcpy(shellpath, InternalGetWindowsDirectoryA());
150 strcat(shellpath, "\\SYSTEM");
151 CreateDirectoryA(shellpath, NULL);
152
153 //AppData
154 strcpy(shellpath, InternalGetWindowsDirectoryA());
155 strcat(shellpath, "\\Application Data");
156 CreateDirectoryA(shellpath, NULL);
157 RegSetValueExA(hkey,"AppData",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
158 //Cache
159 strcpy(shellpath, InternalGetWindowsDirectoryA());
160 strcat(shellpath, "\\Temporary Internet Files");
161 CreateDirectoryA(shellpath, NULL);
162 RegSetValueExA(hkey,"Cache",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
163 //Cookies
164 strcpy(shellpath, InternalGetWindowsDirectoryA());
165 strcat(shellpath, "\\Cookies");
166 CreateDirectoryA(shellpath, NULL);
167 RegSetValueExA(hkey,"Cookies",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
168 //Desktop
169 strcpy(shellpath, InternalGetWindowsDirectoryA());
170 strcat(shellpath, "\\Desktop");
171 CreateDirectoryA(shellpath, NULL);
172 RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
173 //Favorites
174 strcpy(shellpath, InternalGetWindowsDirectoryA());
175 strcat(shellpath, "\\Favorites");
176 CreateDirectoryA(shellpath, NULL);
177 RegSetValueExA(hkey,"Favorites",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
178 //Fonts
179 strcpy(shellpath, InternalGetWindowsDirectoryA());
180 strcat(shellpath, "\\Fonts");
181 CreateDirectoryA(shellpath, NULL);
182 RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
183 //History
184 strcpy(shellpath, InternalGetWindowsDirectoryA());
185 strcat(shellpath, "\\History");
186 CreateDirectoryA(shellpath, NULL);
187 RegSetValueExA(hkey,"History",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
188 //NetHood
189 strcpy(shellpath, InternalGetWindowsDirectoryA());
190 strcat(shellpath, "\\NetHood");
191 CreateDirectoryA(shellpath, NULL);
192 RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
193 //Personal
194 strcpy(shellpath, InternalGetWindowsDirectoryA());
195 strcat(shellpath, "\\My Documents");
196 CreateDirectoryA(shellpath, NULL);
197 RegSetValueExA(hkey,"Personal",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
198 //PrintHood
199 strcpy(shellpath, InternalGetWindowsDirectoryA());
200 strcat(shellpath, "\\PrintHood");
201 CreateDirectoryA(shellpath, NULL);
202 RegSetValueExA(hkey,"PrintHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
203 //Recent
204 strcpy(shellpath, InternalGetWindowsDirectoryA());
205 strcat(shellpath, "\\Recent");
206 CreateDirectoryA(shellpath, NULL);
207 RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
208 //SendTo
209 strcpy(shellpath, InternalGetWindowsDirectoryA());
210 strcat(shellpath, "\\SendTo");
211 CreateDirectoryA(shellpath, NULL);
212 RegSetValueExA(hkey,"SendTo",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
213 //Start Menu
214 strcpy(shellpath, InternalGetWindowsDirectoryA());
215 strcat(shellpath, "\\Start Menu");
216 CreateDirectoryA(shellpath, NULL);
217 RegSetValueExA(hkey,"Start Menu",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
218 //Programs
219 strcpy(shellpath, InternalGetWindowsDirectoryA());
220 strcat(shellpath, "\\Start Menu\\Programs");
221 CreateDirectoryA(shellpath, NULL);
222 RegSetValueExA(hkey,"Programs",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
223 //Startup
224 strcat(shellpath, "\\Startup");
225 CreateDirectoryA(shellpath, NULL);
226 RegSetValueExA(hkey,"Startup",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
227 //ShellNew
228 strcpy(shellpath, InternalGetWindowsDirectoryA());
229 strcat(shellpath, "\\ShellNew");
230 CreateDirectoryA(shellpath, NULL);
231 RegSetValueExA(hkey,"Templates",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
232// }
233 RegCloseKey(hkey);
234
235 //Now the Ddraw & dsound registry keys:
236 //HKEY_CLASSES_ROOT\DirectDraw = DirectDraw Object
237 //HKEY_CLASSES_ROOT\DirectDraw\CLSID = {D7B70EE0-4340-11CF-B063-0020AFC2CD35}
238 //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35} = DirectDraw Object
239 //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35}\InprocServer32 = ddraw.dll
240 if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectDraw",&hkey)!=ERROR_SUCCESS) {
241 goto initreg_error;
242 }
243 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
244 if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
245 RegCloseKey(hkey);
246 goto initreg_error;
247 }
248 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLASSID, sizeof(DDRAW_CLASSID));
249 RegCloseKey(hkey1);
250 RegCloseKey(hkey);
251
252 if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLASSID ,&hkey)!=ERROR_SUCCESS) {
253 goto initreg_error;
254 }
255 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
256 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
257 RegCloseKey(hkey);
258 goto initreg_error;
259 }
260 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
261 RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
262 RegCloseKey(hkey1);
263 RegCloseKey(hkey);
264
265 //HKEY_CLASSES_ROOT\DirectDrawClipper = DirectDraw Clipper Object
266 //HKEY_CLASSES_ROOT\DirectDrawClipper\CLSID = {593817A0-7DB3-11CF-A2DE-00AA00B93356}
267 //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356} = DirectDraw Clipper Object
268 //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356}\InprocServer32 = ddraw.dll
269 if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectDrawClipper",&hkey)!=ERROR_SUCCESS) {
270 goto initreg_error;
271 }
272 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
273 if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
274 RegCloseKey(hkey);
275 goto initreg_error;
276 }
277 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_CLASSID, sizeof(DDRAW_CLIPPER_CLASSID));
278 RegCloseKey(hkey1);
279 RegCloseKey(hkey);
280
281 if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLIPPER_CLASSID,&hkey)!=ERROR_SUCCESS) {
282 goto initreg_error;
283 }
284 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
285 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
286 RegCloseKey(hkey);
287 goto initreg_error;
288 }
289 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
290 RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
291 RegCloseKey(hkey1);
292 RegCloseKey(hkey);
293
294 //HKEY_CLASSES_ROOT\DirectSound = DirectSound Object
295 //HKEY_CLASSES_ROOT\DirectSound\CLSID = {47D4D946-62E8-11cf-93BC-444553540000}
296 //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000} = DirectSound Object
297 //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000}\InprocServer32 = dsound.dll
298 if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectSound",&hkey)!=ERROR_SUCCESS) {
299 goto initreg_error;
300 }
301 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
302 if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
303 RegCloseKey(hkey);
304 goto initreg_error;
305 }
306 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_CLASSID, sizeof(DSOUND_CLASSID));
307 RegCloseKey(hkey1);
308 RegCloseKey(hkey);
309
310 if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DSOUND_CLASSID ,&hkey)!=ERROR_SUCCESS) {
311 goto initreg_error;
312 }
313 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
314 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
315 RegCloseKey(hkey);
316 goto initreg_error;
317 }
318 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_DLL, sizeof(DSOUND_DLL));
319 RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
320 RegCloseKey(hkey1);
321 RegCloseKey(hkey);
322
323 //[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion]
324 //"ProgramFilesDir"="C:\Program Files"
325 //"CommonFilesDir"="C:\Program Files\Common Files"
326 //# 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.
327 //"SharedDir"="C:\WINDOWS"
328 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
329 goto initreg_error;
330 }
331 //Create x:\Program Files directory
332 strcpy(shellpath, InternalGetWindowsDirectoryA());
333 shellpath[2] = 0; //get drive
334 strcat(shellpath, "\\Program Files");
335 CreateDirectoryA(shellpath, NULL);
336 RegSetValueExA(hkey, DIR_PROGRAM, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
337
338 //Create x:\Program Files\Common Files directory
339 strcat(shellpath, "\\Common Files");
340 CreateDirectoryA(shellpath, NULL);
341 RegSetValueExA(hkey, DIR_PROGRAM_COMMON, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
342
343 strcpy(shellpath, InternalGetWindowsDirectoryA());
344 RegSetValueExA(hkey, DIR_SHARED, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
345
346 RegCloseKey(hkey);
347
348 return TRUE;
349
350initreg_error:
351 dprintf((INITREG_ERROR));
352 return FALSE;
353}
354//******************************************************************************
355//Environment variables created by Windows NT:
356//
357//COMPUTERNAME=NTBAK
358//ComSpec=E:\WINNT\system32\cmd.exe
359//CPU=i386
360//HOMEDRIVE=E:
361//HOMEPATH=\
362//LOGONSERVER=\\NTBAK
363//NUMBER_OF_PROCESSORS=2
364//OS=Windows_NT
365//PATHEXT=.COM;.EXE;.BAT;.CMD
366//PROCESSOR_ARCHITECTURE=x86
367//PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 5, GenuineIntel
368//PROCESSOR_LEVEL=6
369//PROCESSOR_REVISION=0605
370//SystemDrive=E:
371//SystemRoot=E:\WINNT
372//USERDOMAIN=NTBAK
373//USERNAME=Sander
374//USERPROFILE=E:\WINNT\Profiles\Sander
375//windir=E:\WINNT
376//******************************************************************************
377void InitEnvironment(int nrcpus)
378{
379 char buffer[64];
380 char buffer1[32];
381 char *windir;
382 DWORD signature;
383
384 SetEnvironmentVariableA("CPU", "i386");
385 SetEnvironmentVariableA("PROCESSOR_ARCHITECTURE", "x86");
386 if(SupportsCPUID()) {
387 GetCPUVendorString(buffer1);
388 buffer1[12] = 0;
389 signature = GetCPUSignature();
390 sprintf(buffer, "x86 Family %x Model %x Stepping %x, %s", (signature >> 8)&0xf, signature & 0xf, (signature >> 4)&0xf, buffer1);
391 SetEnvironmentVariableA("PROCESSOR_IDENTIFIER", buffer);
392 sprintf(buffer, "%x", (signature >> 8)&0xf);
393 SetEnvironmentVariableA("PROCESSOR_LEVEL", buffer);
394 sprintf(buffer, "%02x%02x", (signature >> 4)&0xf, signature & 0xf);
395 SetEnvironmentVariableA("PROCESSOR_REVISION", buffer);
396 }
397 sprintf(buffer, "%d", nrcpus);
398 SetEnvironmentVariableA("NUMBER_OF_PROCESSORS", buffer);
399 SetEnvironmentVariableA("OS", "Windows_NT");
400 SetEnvironmentVariableA("PATHEXT", ".COM;.EXE;.BAT;.CMD");
401 windir = InternalGetWindowsDirectoryA();
402 SetEnvironmentVariableA("windir", windir);
403 SetEnvironmentVariableA("SystemRoot", windir);
404 buffer[0] = windir[0];
405 buffer[1] = windir[1];
406 buffer[2] = 0;
407 SetEnvironmentVariableA("SystemDrive", buffer);
408 SetEnvironmentVariableA("HOMEDRIVE", buffer);
409 SetEnvironmentVariableA("HOMEPATH", "\\");
410
411//TODO:
412//COMPUTERNAME=NTBAK
413//ComSpec=E:\WINNT\system32\cmd.exe
414//LOGONSERVER=\\NTBAK
415//USERDOMAIN=NTBAK
416//USERNAME=Sander
417//USERPROFILE=E:\WINNT\Profiles\Sander
418}
Note: See TracBrowser for help on using the repository browser.