Changeset 5425 for trunk/src/kernel32/initsystem.cpp
- Timestamp:
- Apr 1, 2001, 4:34:19 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/initsystem.cpp
r4964 r5425 1 /* $Id: initsystem.cpp,v 1.2 6 2001-01-18 18:14:16sandervl Exp $ */1 /* $Id: initsystem.cpp,v 1.27 2001-04-01 14:33:50 sandervl Exp $ */ 2 2 /* 3 3 * Odin system initialization (registry, directories & environment) … … 5 5 * Called from the WarpIn install program to create the desktop directories and 6 6 * to setup the registry 7 *8 * InitSystemAndRegistry creates:9 * - SYSTEMDIR\drivers10 * - SYSTEMDIR\drivers\etc11 * - WINDOWSDIR\SYSTEM12 * - WINDOWSDIR\AppData13 * - WINDOWSDIR\Cache14 * - WINDOWSDIR\Cookies15 * - WINDOWSDIR\Desktop16 * - WINDOWSDIR\Favorites17 * - WINDOWSDIR\Fonts18 * - WINDOWSDIR\History19 * - WINDOWSDIR\NetHood20 * - WINDOWSDIR\My Documents21 * - WINDOWSDIR\PrintHood22 * - WINDOWSDIR\Recent23 * - WINDOWSDIR\SendTo24 * - WINDOWSDIR\Start Menu25 * - WINDOWSDIR\Start Menu\Programs26 * - WINDOWSDIR\Start Menu\Programs\Startup27 * - WINDOWSDIR\ShellNew28 * - x:\Program Files29 * - x:\Program Files\Common Files30 * - and a minimal system registry31 7 * 32 8 * Copyright 1999-2000 Sander van Leeuwen (sandervl@xs4all.nl) … … 53 29 #include "dbglocal.h" 54 30 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_DLL69 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 0x000491 #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 const char szMci[] = "mci";104 const char szCDAudio[] = "cdaudio";105 const char szMciCDA[] = "mcicda.drv";106 31 107 32 //****************************************************************************** 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,00112 //"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,00114 //"ErrorMode"=dword:00000000115 //"NoInteractiveServices"=dword:00000000116 //"CSDVersion"=dword:00000300117 BYTE ShutdownTime[] = {0x44,0x5e,0xf2,0xbb,0x84,0x41,0xbf,0x01};118 //******************************************************************************119 BOOL 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\RunOnce145 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 Manager152 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 keys191 //"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 dir210 strcpy(shellpath, InternalGetSystemDirectoryA());211 strcat(shellpath, "\\Drivers");212 CreateDirectoryA(shellpath, NULL);213 strcat(shellpath, "\\etc");214 CreateDirectoryA(shellpath, NULL);215 216 //SYSTEM dir217 strcpy(shellpath, InternalGetWindowsDirectoryA());218 strcat(shellpath, "\\SYSTEM");219 CreateDirectoryA(shellpath, NULL);220 221 //AppData222 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 //Cache227 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 //Cookies232 strcpy(shellpath, InternalGetWindowsDirectoryA());233 strcat(shellpath, "\\Cookies");234 CreateDirectoryA(shellpath, NULL);235 RegSetValueExA(hkey,"Cookies",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);236 //Desktop237 strcpy(shellpath, InternalGetWindowsDirectoryA());238 strcat(shellpath, "\\Desktop");239 CreateDirectoryA(shellpath, NULL);240 RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);241 //Favorites242 strcpy(shellpath, InternalGetWindowsDirectoryA());243 strcat(shellpath, "\\Favorites");244 CreateDirectoryA(shellpath, NULL);245 RegSetValueExA(hkey,"Favorites",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);246 //Fonts247 strcpy(shellpath, InternalGetWindowsDirectoryA());248 strcat(shellpath, "\\Fonts");249 CreateDirectoryA(shellpath, NULL);250 RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);251 //History252 strcpy(shellpath, InternalGetWindowsDirectoryA());253 strcat(shellpath, "\\History");254 CreateDirectoryA(shellpath, NULL);255 RegSetValueExA(hkey,"History",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);256 //NetHood257 strcpy(shellpath, InternalGetWindowsDirectoryA());258 strcat(shellpath, "\\NetHood");259 CreateDirectoryA(shellpath, NULL);260 RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);261 //Personal262 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 //PrintHood267 strcpy(shellpath, InternalGetWindowsDirectoryA());268 strcat(shellpath, "\\PrintHood");269 CreateDirectoryA(shellpath, NULL);270 RegSetValueExA(hkey,"PrintHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);271 //Recent272 strcpy(shellpath, InternalGetWindowsDirectoryA());273 strcat(shellpath, "\\Recent");274 CreateDirectoryA(shellpath, NULL);275 RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);276 //SendTo277 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 Menu282 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 //Programs287 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 //Startup292 strcat(shellpath, "\\Startup");293 CreateDirectoryA(shellpath, NULL);294 RegSetValueExA(hkey,"Startup",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);295 //ShellNew296 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 keys304 //[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 IWebBrowser345 //# Used by Internet Explorer HTML-rendering control346 //[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 Object375 //HKEY_CLASSES_ROOT\DirectDraw\CLSID = {D7B70EE0-4340-11CF-B063-0020AFC2CD35}376 //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35} = DirectDraw Object377 //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35}\InprocServer32 = ddraw.dll378 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 Object404 //HKEY_CLASSES_ROOT\DirectDrawClipper\CLSID = {593817A0-7DB3-11CF-A2DE-00AA00B93356}405 //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356} = DirectDraw Clipper Object406 //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356}\InprocServer32 = ddraw.dll407 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 Object433 //HKEY_CLASSES_ROOT\DirectSound\CLSID = {47D4D946-62E8-11cf-93BC-444553540000}434 //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000} = DirectSound Object435 //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000}\InprocServer32 = dsound.dll436 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 //DirectPlay462 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 Lobby476 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 directory498 strcpy(shellpath, InternalGetWindowsDirectoryA());499 shellpath[2] = 0; //get drive500 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 directory505 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 Mapper539 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\DirectX547 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 //todo561 RegCloseKey(hkey);562 563 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Direct3D",&hkey)!=ERROR_SUCCESS) {564 goto initreg_error;565 }566 //todo567 RegCloseKey(hkey);568 569 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectPlay",&hkey)!=ERROR_SUCCESS) {570 goto initreg_error;571 }572 //todo573 RegCloseKey(hkey);574 575 #if 0576 if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectMusic",&hkey)!=ERROR_SUCCESS) {577 goto initreg_error;578 }579 //todo580 RegCloseKey(hkey);581 #endif582 583 // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs]584 // "Type"=dword:00000002585 // "Start"=dword:00000004586 // "Group"="File system"587 // "ErrorControl"=dword:00000001588 // "DependOnGroup"=hex(7):53,43,53,49,20,43,44,52,4f,4d,20,43,6c,61,73,73,00,00589 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 dependongroup601 RegCloseKey(hkey);602 603 604 /*605 // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs\Enum]606 // "0"="Root\\LEGACY_CDFS\\0000"607 // "Count"=dword:00000001608 // "NextInstance"=dword:00000001609 */610 // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom]611 // "Type"=dword:00000001612 // "Start"=dword:00000001613 // "Group"="SCSI CDROM Class"614 // "ErrorControl"=dword:00000000615 // "Tag"=dword:00000002616 // "DependOnGroup"=hex(7):53,43,53,49,20,6d,69,6e,69,70,6f,72,74,00,00617 // "Autorun"=dword:00000001618 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 dependongroup634 RegCloseKey(hkey);635 636 /*637 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom\Enum]638 "0"="Root\\LEGACY_CDROM\\0000"639 "Count"=dword:00000001640 "NextInstance"=dword:00000001641 */642 643 //[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\FileSystem]644 //"Win31FileSystem"=dword:00000000645 //"NtfsDisable8dot3NameCreation"=dword:00000000646 //"Win95TruncatedExtensions"=dword:00000001647 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 entry676 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] section683 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 691 initreg_error:692 dprintf((INITREG_ERROR));693 return FALSE;694 }695 33 //****************************************************************************** 696 34 //Environment variables created by Windows NT:
Note:
See TracChangeset
for help on using the changeset viewer.