Changeset 4510 for trunk/src/kernel32/initsystem.cpp
- Timestamp:
- Oct 21, 2000, 4:30:47 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/initsystem.cpp
r4508 r4510 1 /* $Id: initsystem.cpp,v 1.2 0 2000-10-21 12:48:40sandervl Exp $ */1 /* $Id: initsystem.cpp,v 1.21 2000-10-21 14:30:46 sandervl Exp $ */ 2 2 /* 3 3 * Odin system initialization (registry, directories & environment) 4 4 * 5 * Called from the WarpIn install program to create the desktop directories and 5 * Called from the WarpIn install program to create the desktop directories and 6 6 * to setup the registry 7 7 * 8 8 * InitSystemAndRegistry creates: 9 9 * - SYSTEMDIR\drivers 10 * 10 * - WINDOWSDIR\SYSTEM 11 11 * - WINDOWSDIR\AppData 12 12 * - WINDOWSDIR\Cache 13 13 * - WINDOWSDIR\Cookies 14 * 15 * 16 * 14 * - WINDOWSDIR\Desktop 15 * - WINDOWSDIR\Favorites 16 * - WINDOWSDIR\Fonts 17 17 * - WINDOWSDIR\History 18 * 19 * 20 * 21 * 22 * 23 * 24 * 25 * 26 * 18 * - WINDOWSDIR\NetHood 19 * - WINDOWSDIR\My Documents 20 * - WINDOWSDIR\PrintHood 21 * - WINDOWSDIR\Recent 22 * - WINDOWSDIR\SendTo 23 * - WINDOWSDIR\Start Menu 24 * - WINDOWSDIR\Start Menu\Programs 25 * - WINDOWSDIR\Start Menu\Programs\Startup 26 * - WINDOWSDIR\ShellNew 27 27 * - x:\Program Files 28 28 * - x:\Program Files\Common Files 29 * 29 * - and a minimal system registry 30 30 * 31 31 * Copyright 1999-2000 Sander van Leeuwen (sandervl@xs4all.nl) … … 48 48 #include <versionos2.h> 49 49 50 #define DBG_LOCALLOG 50 #define DBG_LOCALLOG DBG_initsystem 51 51 #include "dbglocal.h" 52 52 53 #define DDRAW_CLASSID 54 #define DDRAW_DEFAULT 55 #define DDRAW_CLIPPER_CLASSID 56 #define DDRAW_CLIPPER_DEFAULT 57 #define DDRAW_DLL 58 #define DSOUND_CLASSID 59 #define DSOUND_DEFAULT 60 #define DSOUND_DLL 53 #define DDRAW_CLASSID "{D7B70EE0-4340-11CF-B063-0020AFC2CD35}" 54 #define DDRAW_DEFAULT "DirectDraw Object" 55 #define DDRAW_CLIPPER_CLASSID "{593817A0-7DB3-11CF-A2DE-00AA00B93356}" 56 #define DDRAW_CLIPPER_DEFAULT "DirectDraw Clipper Object" 57 #define DDRAW_DLL "ddraw.dll" 58 #define DSOUND_CLASSID "{47D4D946-62E8-11cf-93BC-444553540000}" 59 #define DSOUND_DEFAULT "DirectSound Object" 60 #define DSOUND_DLL "dsound.dll" 61 61 #define DPLAYX_CLASSID "{D1EB6D20-8923-11d0-9D97-00A0C90A43CB}" 62 62 #define DPLAYX_DEFAULT "DirectPlay Object" … … 66 66 #define DPLAYX_LOBBY_DLL DPLAYX_DLL 67 67 68 #define CLASS_DESKTOP 68 #define CLASS_DESKTOP "Desktop" 69 69 #define CLASS_SHORTCUT "Shortcut" 70 #define CLASS_SHELL32DLL 71 #define COM_CLASS_ID 70 #define CLASS_SHELL32DLL "shell32.dll" 71 #define COM_CLASS_ID "CLSID" 72 72 #define COM_INPROCSERVER "InprocServer32" 73 #define COM_THREADMODEL 73 #define COM_THREADMODEL "ThreadingModel" 74 74 #define COM_THREAD_APARTMENT "Apartment" 75 #define THREAD_BOTH 76 #define INITREG_ERROR 75 #define THREAD_BOTH "Both" 76 #define INITREG_ERROR "InitRegistry: Unable to register system information" 77 77 #define DIR_PROGRAM "ProgramFilesDir" 78 #define DIR_PROGRAM_COMMON 78 #define DIR_PROGRAM_COMMON "CommonFilesDir" 79 79 #define DIR_SHARED "SharedDir" 80 80 #define HARDWARE_VIDEO_GRADD "\\REGISTRY\\Machine\\System\\CurrentControlSet\\Services\\Gradd\\Device0" … … 86 86 #define DIRECTX_VERSION "4.04.1381.276" 87 87 #define DIRECTX_INSTALLED_VERSION 0x0004 88 #define ODIN_WINMM_PLAYBACK 89 #define ODIN_WINMM_RECORD 90 91 #define KEY_DEVICE_TYPE 92 #define KEY_DEVICE_START 88 #define ODIN_WINMM_PLAYBACK "OS/2 Dart Audio Playback" 89 #define ODIN_WINMM_RECORD "OS/2 Dart Audio Record" 90 91 #define KEY_DEVICE_TYPE "Type" 92 #define KEY_DEVICE_START "Start" 93 93 #define KEY_DEVICE_GROUP "Group" 94 94 #define KEY_DEVICE_ERRORCONTROL "ErrorControl" … … 118 118 char shellpath[260]; 119 119 120 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Windows",&hkey)!=ERROR_SUCCESS) {121 122 123 }124 buf = InternalGetWindowsDirectoryA();125 RegSetValueExA(hkey,"Directory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);126 buf = InternalGetSystemDirectoryA();127 RegSetValueExA(hkey,"SystemDirectory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);128 val = 0;129 RegSetValueExA(hkey,"ErrorMode",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));130 val = 0;131 RegSetValueExA(hkey,"NoInteractiveServices",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));132 val = ODINNT_BUILD_NR;133 RegSetValueExA(hkey,"CSDVersion",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));134 RegSetValueExA(hkey,"ShutdownTime",0,REG_DWORD, (LPBYTE)ShutdownTime, sizeof(ShutdownTime));135 RegCloseKey(hkey);136 137 //Software\Microsoft\Windows\CurrentVersion\RunOnce138 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce",&hkey)!=ERROR_SUCCESS) {139 140 141 }142 RegCloseKey(hkey);143 144 //System\CurrentControlSet\Control\Session Manager145 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\Session Manager",&hkey)!=ERROR_SUCCESS) {146 147 148 }149 RegCloseKey(hkey);150 151 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\iexplore.exe",&hkey)!=ERROR_SUCCESS) {152 153 154 }155 strcpy(shellpath, InternalGetWindowsDirectoryA());156 strcat(shellpath, "\\IEXPLORE.EXE");157 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);158 RegCloseKey(hkey);159 160 161 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {162 163 164 }165 buf = InternalGetSystemDirectoryA();166 RegSetValueExA(hkey,"SystemRoot",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);167 RegSetValueExA(hkey,"PathName",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);168 sprintf(digbuf, "%d", ODINNT_BUILD_NR);169 RegSetValueExA(hkey,"CurrentBuildNumber",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);170 RegSetValueExA(hkey,"CurrentType",0,REG_SZ, (LPBYTE)ODINNT_OSTYPE_UNI, sizeof(ODINNT_OSTYPE_UNI));171 RegSetValueExA(hkey,"CSDVersion",0,REG_SZ, (LPBYTE)ODINNT_CSDVERSION, sizeof(ODINNT_CSDVERSION));172 RegSetValueExA(hkey,"SoftwareType",0,REG_SZ, (LPBYTE)ODINNT_SOFTWARE_TYPE, sizeof(ODINNT_SOFTWARE_TYPE));173 174 sprintf(digbuf, "%d.%d", ODINNT_MAJOR_VERSION, ODINNT_MINOR_VERSION);175 RegSetValueExA(hkey,"CurrentVersion",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);176 177 val = (DWORD)time(NULL); //todo: Correct format???178 RegSetValueExA(hkey,"InstallDate",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));179 180 RegCloseKey(hkey);181 //todo: productid, registered org/owner, sourcepath,182 183 //Create Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders keys184 //"Favorites"="C:\WINDOWS\Favorites"185 //"StartUp"="C:\WINDOWS\Start Menu\Programs\Startup"186 //"Desktop"="C:\WINDOWS\Desktop"187 //"Programs"="C:\WINDOWS\Start Menu\Programs"188 //"Fonts"="C:\WINDOWS\Fonts"189 //"SendTo"="C:\WINDOWS\SendTo"190 //"Start Menu"="C:\WINDOWS\Start Menu"191 //"Templates"="C:\WINDOWS\ShellNew"192 //"Recent"="C:\WINDOWS\Recent"193 //"NetHood"="C:\WINDOWS\NetHood"194 //"Personal"="C:\My Documents"120 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Windows",&hkey)!=ERROR_SUCCESS) { 121 dprintf(("InitRegistry: Unable to register system information\n")); 122 return FALSE; 123 } 124 buf = InternalGetWindowsDirectoryA(); 125 RegSetValueExA(hkey,"Directory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1); 126 buf = InternalGetSystemDirectoryA(); 127 RegSetValueExA(hkey,"SystemDirectory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1); 128 val = 0; 129 RegSetValueExA(hkey,"ErrorMode",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD)); 130 val = 0; 131 RegSetValueExA(hkey,"NoInteractiveServices",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD)); 132 val = ODINNT_BUILD_NR; 133 RegSetValueExA(hkey,"CSDVersion",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD)); 134 RegSetValueExA(hkey,"ShutdownTime",0,REG_DWORD, (LPBYTE)ShutdownTime, sizeof(ShutdownTime)); 135 RegCloseKey(hkey); 136 137 //Software\Microsoft\Windows\CurrentVersion\RunOnce 138 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce",&hkey)!=ERROR_SUCCESS) { 139 dprintf(("InitRegistry: Unable to register system information (2)")); 140 return FALSE; 141 } 142 RegCloseKey(hkey); 143 144 //System\CurrentControlSet\Control\Session Manager 145 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\Session Manager",&hkey)!=ERROR_SUCCESS) { 146 dprintf(("InitRegistry: Unable to register system information (2)")); 147 return FALSE; 148 } 149 RegCloseKey(hkey); 150 151 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\iexplore.exe",&hkey)!=ERROR_SUCCESS) { 152 dprintf(("InitRegistry: Unable to register system information (2)")); 153 return FALSE; 154 } 155 strcpy(shellpath, InternalGetWindowsDirectoryA()); 156 strcat(shellpath, "\\IEXPLORE.EXE"); 157 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 158 RegCloseKey(hkey); 159 160 161 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",&hkey)!=ERROR_SUCCESS) { 162 dprintf(("InitRegistry: Unable to register system information (2)")); 163 return FALSE; 164 } 165 buf = InternalGetSystemDirectoryA(); 166 RegSetValueExA(hkey,"SystemRoot",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1); 167 RegSetValueExA(hkey,"PathName",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1); 168 sprintf(digbuf, "%d", ODINNT_BUILD_NR); 169 RegSetValueExA(hkey,"CurrentBuildNumber",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1); 170 RegSetValueExA(hkey,"CurrentType",0,REG_SZ, (LPBYTE)ODINNT_OSTYPE_UNI, sizeof(ODINNT_OSTYPE_UNI)); 171 RegSetValueExA(hkey,"CSDVersion",0,REG_SZ, (LPBYTE)ODINNT_CSDVERSION, sizeof(ODINNT_CSDVERSION)); 172 RegSetValueExA(hkey,"SoftwareType",0,REG_SZ, (LPBYTE)ODINNT_SOFTWARE_TYPE, sizeof(ODINNT_SOFTWARE_TYPE)); 173 174 sprintf(digbuf, "%d.%d", ODINNT_MAJOR_VERSION, ODINNT_MINOR_VERSION); 175 RegSetValueExA(hkey,"CurrentVersion",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1); 176 177 val = (DWORD)time(NULL); //todo: Correct format??? 178 RegSetValueExA(hkey,"InstallDate",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD)); 179 180 RegCloseKey(hkey); 181 //todo: productid, registered org/owner, sourcepath, 182 183 //Create Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders keys 184 //"Favorites"="C:\WINDOWS\Favorites" 185 //"StartUp"="C:\WINDOWS\Start Menu\Programs\Startup" 186 //"Desktop"="C:\WINDOWS\Desktop" 187 //"Programs"="C:\WINDOWS\Start Menu\Programs" 188 //"Fonts"="C:\WINDOWS\Fonts" 189 //"SendTo"="C:\WINDOWS\SendTo" 190 //"Start Menu"="C:\WINDOWS\Start Menu" 191 //"Templates"="C:\WINDOWS\ShellNew" 192 //"Recent"="C:\WINDOWS\Recent" 193 //"NetHood"="C:\WINDOWS\NetHood" 194 //"Personal"="C:\My Documents" 195 195 196 196 if(RegCreateKeyA(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",&hkey)!=ERROR_SUCCESS) { 197 198 199 } 200 // if(RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey) != ERROR_SUCCESS) 197 dprintf(("InitRegistry: Unable to register system information (3)")); 198 return FALSE; 199 } 200 // if(RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey) != ERROR_SUCCESS) 201 201 // { 202 202 //system32\drivers dir 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 203 strcpy(shellpath, InternalGetSystemDirectoryA()); 204 strcat(shellpath, "\\Drivers"); 205 CreateDirectoryA(shellpath, NULL); 206 207 //SYSTEM dir 208 strcpy(shellpath, InternalGetWindowsDirectoryA()); 209 strcat(shellpath, "\\SYSTEM"); 210 CreateDirectoryA(shellpath, NULL); 211 212 //AppData 213 strcpy(shellpath, InternalGetWindowsDirectoryA()); 214 strcat(shellpath, "\\Application Data"); 215 CreateDirectoryA(shellpath, NULL); 216 RegSetValueExA(hkey,"AppData",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 217 //Cache 218 strcpy(shellpath, InternalGetWindowsDirectoryA()); 219 strcat(shellpath, "\\Temporary Internet Files"); 220 CreateDirectoryA(shellpath, NULL); 221 RegSetValueExA(hkey,"Cache",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 222 //Cookies 223 strcpy(shellpath, InternalGetWindowsDirectoryA()); 224 strcat(shellpath, "\\Cookies"); 225 CreateDirectoryA(shellpath, NULL); 226 RegSetValueExA(hkey,"Cookies",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 227 //Desktop 228 strcpy(shellpath, InternalGetWindowsDirectoryA()); 229 strcat(shellpath, "\\Desktop"); 230 CreateDirectoryA(shellpath, NULL); 231 RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 232 //Favorites 233 strcpy(shellpath, InternalGetWindowsDirectoryA()); 234 strcat(shellpath, "\\Favorites"); 235 CreateDirectoryA(shellpath, NULL); 236 RegSetValueExA(hkey,"Favorites",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 237 //Fonts 238 strcpy(shellpath, InternalGetWindowsDirectoryA()); 239 strcat(shellpath, "\\Fonts"); 240 CreateDirectoryA(shellpath, NULL); 241 RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 242 //History 243 strcpy(shellpath, InternalGetWindowsDirectoryA()); 244 strcat(shellpath, "\\History"); 245 CreateDirectoryA(shellpath, NULL); 246 RegSetValueExA(hkey,"History",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 247 //NetHood 248 strcpy(shellpath, InternalGetWindowsDirectoryA()); 249 strcat(shellpath, "\\NetHood"); 250 CreateDirectoryA(shellpath, NULL); 251 RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 252 //Personal 253 strcpy(shellpath, InternalGetWindowsDirectoryA()); 254 strcat(shellpath, "\\My Documents"); 255 CreateDirectoryA(shellpath, NULL); 256 RegSetValueExA(hkey,"Personal",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 257 //PrintHood 258 strcpy(shellpath, InternalGetWindowsDirectoryA()); 259 strcat(shellpath, "\\PrintHood"); 260 CreateDirectoryA(shellpath, NULL); 261 RegSetValueExA(hkey,"PrintHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 262 //Recent 263 strcpy(shellpath, InternalGetWindowsDirectoryA()); 264 strcat(shellpath, "\\Recent"); 265 CreateDirectoryA(shellpath, NULL); 266 RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 267 //SendTo 268 strcpy(shellpath, InternalGetWindowsDirectoryA()); 269 strcat(shellpath, "\\SendTo"); 270 CreateDirectoryA(shellpath, NULL); 271 RegSetValueExA(hkey,"SendTo",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 272 //Start Menu 273 strcpy(shellpath, InternalGetWindowsDirectoryA()); 274 strcat(shellpath, "\\Start Menu"); 275 CreateDirectoryA(shellpath, NULL); 276 RegSetValueExA(hkey,"Start Menu",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 277 //Programs 278 strcpy(shellpath, InternalGetWindowsDirectoryA()); 279 strcat(shellpath, "\\Start Menu\\Programs"); 280 CreateDirectoryA(shellpath, NULL); 281 RegSetValueExA(hkey,"Programs",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 282 //Startup 283 strcat(shellpath, "\\Startup"); 284 CreateDirectoryA(shellpath, NULL); 285 RegSetValueExA(hkey,"Startup",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 286 //ShellNew 287 strcpy(shellpath, InternalGetWindowsDirectoryA()); 288 strcat(shellpath, "\\ShellNew"); 289 CreateDirectoryA(shellpath, NULL); 290 RegSetValueExA(hkey,"Templates",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1); 291 291 // } 292 292 RegCloseKey(hkey); … … 299 299 //ThreadingModel="Apartment" 300 300 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) { 301 301 goto initreg_error; 302 302 } 303 303 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_DESKTOP, sizeof(CLASS_DESKTOP)); 304 304 RegCloseKey(hkey); 305 305 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) { 306 306 goto initreg_error; 307 307 } 308 308 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL)); … … 317 317 //@="" 318 318 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) { 319 319 goto initreg_error; 320 320 } 321 321 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHORTCUT, sizeof(CLASS_SHORTCUT)); 322 322 RegCloseKey(hkey); 323 323 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) { 324 324 goto initreg_error; 325 325 } 326 326 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL)); … … 328 328 RegCloseKey(hkey); 329 329 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\shellex\\MayChangeDefaultMenu",&hkey)!=ERROR_SUCCESS) { 330 330 goto initreg_error; 331 331 } 332 332 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)"", 0); … … 339 339 //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35}\InprocServer32 = ddraw.dll 340 340 if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectDraw",&hkey)!=ERROR_SUCCESS) { 341 341 goto initreg_error; 342 342 } 343 343 RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT)); 344 344 if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) { 345 346 345 RegCloseKey(hkey); 346 goto initreg_error; 347 347 } 348 348 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLASSID, sizeof(DDRAW_CLASSID)); … … 351 351 352 352 if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLASSID ,&hkey)!=ERROR_SUCCESS) { 353 353 goto initreg_error; 354 354 } 355 355 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT)); 356 356 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) { 357 358 357 RegCloseKey(hkey); 358 goto initreg_error; 359 359 } 360 360 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL)); … … 368 368 //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356}\InprocServer32 = ddraw.dll 369 369 if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectDrawClipper",&hkey)!=ERROR_SUCCESS) { 370 370 goto initreg_error; 371 371 } 372 372 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT)); 373 373 if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) { 374 375 374 RegCloseKey(hkey); 375 goto initreg_error; 376 376 } 377 377 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_CLASSID, sizeof(DDRAW_CLIPPER_CLASSID)); … … 380 380 381 381 if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLIPPER_CLASSID,&hkey)!=ERROR_SUCCESS) { 382 382 goto initreg_error; 383 383 } 384 384 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT)); 385 385 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) { 386 387 386 RegCloseKey(hkey); 387 goto initreg_error; 388 388 } 389 389 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL)); … … 397 397 //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000}\InprocServer32 = dsound.dll 398 398 if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectSound",&hkey)!=ERROR_SUCCESS) { 399 399 goto initreg_error; 400 400 } 401 401 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT)); 402 402 if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) { 403 404 403 RegCloseKey(hkey); 404 goto initreg_error; 405 405 } 406 406 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_CLASSID, sizeof(DSOUND_CLASSID)); … … 409 409 410 410 if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DSOUND_CLASSID ,&hkey)!=ERROR_SUCCESS) { 411 411 goto initreg_error; 412 412 } 413 413 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT)); 414 414 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) { 415 416 415 RegCloseKey(hkey); 416 goto initreg_error; 417 417 } 418 418 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_DLL, sizeof(DSOUND_DLL)); … … 423 423 //DirectPlay 424 424 if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_CLASSID ,&hkey)!=ERROR_SUCCESS) { 425 425 goto initreg_error; 426 426 } 427 427 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_DEFAULT, sizeof(DPLAYX_DEFAULT)); 428 428 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) { 429 430 429 RegCloseKey(hkey); 430 goto initreg_error; 431 431 } 432 432 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_DLL, sizeof(DPLAYX_DLL)); … … 437 437 //DirectPlay Lobby 438 438 if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_LOBBY_CLASSID ,&hkey)!=ERROR_SUCCESS) { 439 439 goto initreg_error; 440 440 } 441 441 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DEFAULT, sizeof(DPLAYX_LOBBY_DEFAULT)); 442 442 if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) { 443 444 443 RegCloseKey(hkey); 444 goto initreg_error; 445 445 } 446 446 RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DLL, sizeof(DPLAYX_LOBBY_DLL)); … … 455 455 //"SharedDir"="C:\WINDOWS" 456 456 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion",&hkey)!=ERROR_SUCCESS) { 457 457 goto initreg_error; 458 458 } 459 459 //Create x:\Program Files directory 460 460 strcpy(shellpath, InternalGetWindowsDirectoryA()); 461 shellpath[2] = 0; 461 shellpath[2] = 0; //get drive 462 462 strcat(shellpath, "\\Program Files"); 463 463 CreateDirectoryA(shellpath, NULL); … … 479 479 //"VgaCompatible"="\\Device\\Video1" 480 480 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\VIDEO",&hkey)!=ERROR_SUCCESS) { 481 481 goto initreg_error; 482 482 } 483 483 RegSetValueExA(hkey,"\\Device\\Video0",0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD, sizeof(HARDWARE_VIDEO_GRADD)); … … 487 487 488 488 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Gradd\\Device0",&hkey)!=ERROR_SUCCESS) { 489 489 goto initreg_error; 490 490 } 491 491 RegSetValueExA(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD_DESCRIPTION, sizeof(HARDWARE_VIDEO_GRADD_DESCRIPTION)); … … 493 493 494 494 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\VgaSave\\Device0",&hkey)!=ERROR_SUCCESS) { 495 495 goto initreg_error; 496 496 } 497 497 RegSetValueExA(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_VGA_DESCRIPTION, sizeof(HARDWARE_VIDEO_VGA_DESCRIPTION)); … … 500 500 //Software\Microsoft\Multimedia\Sound Mapper 501 501 if(RegCreateKeyA(HKEY_CURRENT_USER,"Software\\Microsoft\\Multimedia\\Sound Mapper",&hkey)!=ERROR_SUCCESS) { 502 502 goto initreg_error; 503 503 } 504 504 RegSetValueExA(hkey,"Playback", 0, REG_SZ, (LPBYTE)ODIN_WINMM_PLAYBACK, sizeof(ODIN_WINMM_PLAYBACK)); … … 506 506 RegCloseKey(hkey); 507 507 508 //Software\Microsoft\DirectX 508 //Software\Microsoft\DirectX 509 509 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectX",&hkey)!=ERROR_SUCCESS) { 510 510 goto initreg_error; 511 511 } 512 512 RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)"", 0); … … 518 518 519 519 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectDraw",&hkey)!=ERROR_SUCCESS) { 520 520 goto initreg_error; 521 521 } 522 522 //todo … … 524 524 525 525 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Direct3D",&hkey)!=ERROR_SUCCESS) { 526 526 goto initreg_error; 527 527 } 528 528 //todo … … 530 530 531 531 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectPlay",&hkey)!=ERROR_SUCCESS) { 532 532 goto initreg_error; 533 533 } 534 534 //todo … … 537 537 #if 0 538 538 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectMusic",&hkey)!=ERROR_SUCCESS) { 539 539 goto initreg_error; 540 540 } 541 541 //todo … … 551 551 552 552 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdfs",&hkey)!=ERROR_SUCCESS) { 553 553 goto initreg_error; 554 554 } 555 555 val = 0x2; … … 580 580 581 581 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdrom",&hkey)!=ERROR_SUCCESS) { 582 582 goto initreg_error; 583 583 } 584 584 val = 0x1; … … 608 608 //"Win95TruncatedExtensions"=dword:00000001 609 609 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\FileSystem",&hkey)!=ERROR_SUCCESS) { 610 610 goto initreg_error; 611 611 } 612 612 val = 0x0; … … 654 654 DWORD signature; 655 655 656 SetEnvironmentVariableA("CPU", "i386");657 SetEnvironmentVariableA("PROCESSOR_ARCHITECTURE", "x86");658 if(SupportsCPUID()) {659 660 buffer1[12] = 0; 661 662 663 664 665 666 667 668 }669 sprintf(buffer, "%d", nrcpus);670 SetEnvironmentVariableA("NUMBER_OF_PROCESSORS", buffer);671 SetEnvironmentVariableA("OS", "Windows_NT");672 SetEnvironmentVariableA("PATHEXT", ".COM;.EXE;.BAT;.CMD");673 windir = InternalGetWindowsDirectoryA();674 SetEnvironmentVariableA("windir", windir);675 SetEnvironmentVariableA("SystemRoot", windir);676 buffer[0] = windir[0];677 buffer[1] = windir[1];678 buffer[2] = 0;679 SetEnvironmentVariableA("SystemDrive", buffer);680 SetEnvironmentVariableA("HOMEDRIVE", buffer);681 SetEnvironmentVariableA("HOMEPATH", "\\");682 683 //TODO:684 //COMPUTERNAME=NTBAK685 //ComSpec=E:\WINNT\system32\cmd.exe686 //LOGONSERVER=\\NTBAK687 //USERDOMAIN=NTBAK688 //USERNAME=Sander689 //USERPROFILE=E:\WINNT\Profiles\Sander656 SetEnvironmentVariableA("CPU", "i386"); 657 SetEnvironmentVariableA("PROCESSOR_ARCHITECTURE", "x86"); 658 if(SupportsCPUID()) { 659 GetCPUVendorString(buffer1); 660 buffer1[12] = 0; 661 signature = GetCPUSignature(); 662 sprintf(buffer, "x86 Family %x Model %x Stepping %x, %s", (signature >> 8)&0xf, signature & 0xf, (signature >> 4)&0xf, buffer1); 663 SetEnvironmentVariableA("PROCESSOR_IDENTIFIER", buffer); 664 sprintf(buffer, "%x", (signature >> 8)&0xf); 665 SetEnvironmentVariableA("PROCESSOR_LEVEL", buffer); 666 sprintf(buffer, "%02x%02x", (signature >> 4)&0xf, signature & 0xf); 667 SetEnvironmentVariableA("PROCESSOR_REVISION", buffer); 668 } 669 sprintf(buffer, "%d", nrcpus); 670 SetEnvironmentVariableA("NUMBER_OF_PROCESSORS", buffer); 671 SetEnvironmentVariableA("OS", "Windows_NT"); 672 SetEnvironmentVariableA("PATHEXT", ".COM;.EXE;.BAT;.CMD"); 673 windir = InternalGetWindowsDirectoryA(); 674 SetEnvironmentVariableA("windir", windir); 675 SetEnvironmentVariableA("SystemRoot", windir); 676 buffer[0] = windir[0]; 677 buffer[1] = windir[1]; 678 buffer[2] = 0; 679 SetEnvironmentVariableA("SystemDrive", buffer); 680 SetEnvironmentVariableA("HOMEDRIVE", buffer); 681 SetEnvironmentVariableA("HOMEPATH", "\\"); 682 683 //TODO: 684 //COMPUTERNAME=NTBAK 685 //ComSpec=E:\WINNT\system32\cmd.exe 686 //LOGONSERVER=\\NTBAK 687 //USERDOMAIN=NTBAK 688 //USERNAME=Sander 689 //USERPROFILE=E:\WINNT\Profiles\Sander 690 690 } 691 //****************************************************************************** 692 //Create/change keys that may change (i.e. odin.ini keys that affect windows version) 693 //****************************************************************************** 694 void InitDynamicRegistry() 695 { 696 OSVERSIONINFOA versioninfo; 697 HKEY hkey; 698 char buf[16] = ""; 699 700 versioninfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); 701 GetVersionExA(&versioninfo); 702 703 //Set version key: 704 // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions] 705 // "ProductType"="WinNT" 706 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",&hkey)!=ERROR_SUCCESS) { 707 dprintf(("InitRegistry: Unable to register system information (2)")); 708 return; 709 } 710 switch(versioninfo.dwPlatformId) { 711 case VER_PLATFORM_WIN32_WINDOWS: 712 strcpy(buf, "Win98"); //TODO: Correct??????????? 713 break; 714 case VER_PLATFORM_WIN32_NT: 715 strcpy(buf, "WinNT"); //TODO: Also correct for Windows 2000??? 716 break; 717 default: 718 DebugInt3(); 719 break; 720 } 721 RegSetValueExA(hkey,"ProductType",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1); 722 RegCloseKey(hkey); 723 } 724 //****************************************************************************** 725 //****************************************************************************** 726
Note:
See TracChangeset
for help on using the changeset viewer.