- Timestamp:
- Oct 21, 2000, 4:30:47 PM (25 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 4 edited
-
initsystem.cpp (modified) (30 diffs)
-
initterm.cpp (modified) (2 diffs)
-
initterm.h (modified) (2 diffs)
-
registry.cpp (modified) (12 diffs)
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 * - WINDOWSDIR\SYSTEM10 * - WINDOWSDIR\SYSTEM 11 11 * - WINDOWSDIR\AppData 12 12 * - WINDOWSDIR\Cache 13 13 * - WINDOWSDIR\Cookies 14 * - WINDOWSDIR\Desktop15 * - WINDOWSDIR\Favorites16 * - WINDOWSDIR\Fonts14 * - WINDOWSDIR\Desktop 15 * - WINDOWSDIR\Favorites 16 * - WINDOWSDIR\Fonts 17 17 * - WINDOWSDIR\History 18 * - WINDOWSDIR\NetHood19 * - WINDOWSDIR\My Documents20 * - WINDOWSDIR\PrintHood21 * - WINDOWSDIR\Recent22 * - WINDOWSDIR\SendTo23 * - WINDOWSDIR\Start Menu24 * - WINDOWSDIR\Start Menu\Programs25 * - WINDOWSDIR\Start Menu\Programs\Startup26 * - WINDOWSDIR\ShellNew18 * - 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 * - and a minimal system registry29 * - 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 DBG_initsystem50 #define DBG_LOCALLOG DBG_initsystem 51 51 #include "dbglocal.h" 52 52 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"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 "Desktop"68 #define CLASS_DESKTOP "Desktop" 69 69 #define CLASS_SHORTCUT "Shortcut" 70 #define CLASS_SHELL32DLL "shell32.dll"71 #define COM_CLASS_ID "CLSID"70 #define CLASS_SHELL32DLL "shell32.dll" 71 #define COM_CLASS_ID "CLSID" 72 72 #define COM_INPROCSERVER "InprocServer32" 73 #define COM_THREADMODEL "ThreadingModel"73 #define COM_THREADMODEL "ThreadingModel" 74 74 #define COM_THREAD_APARTMENT "Apartment" 75 #define THREAD_BOTH "Both"76 #define INITREG_ERROR "InitRegistry: Unable to register system information"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 "CommonFilesDir"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 "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"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 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\RunOnce138 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 Manager145 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 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 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) 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 strcpy(shellpath, InternalGetSystemDirectoryA());204 strcat(shellpath, "\\Drivers");205 CreateDirectoryA(shellpath, NULL);206 207 //SYSTEM dir208 strcpy(shellpath, InternalGetWindowsDirectoryA());209 strcat(shellpath, "\\SYSTEM");210 CreateDirectoryA(shellpath, NULL);211 212 //AppData213 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 //Cache218 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 //Cookies223 strcpy(shellpath, InternalGetWindowsDirectoryA());224 strcat(shellpath, "\\Cookies");225 CreateDirectoryA(shellpath, NULL);226 RegSetValueExA(hkey,"Cookies",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);227 //Desktop228 strcpy(shellpath, InternalGetWindowsDirectoryA());229 strcat(shellpath, "\\Desktop");230 CreateDirectoryA(shellpath, NULL);231 RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);232 //Favorites233 strcpy(shellpath, InternalGetWindowsDirectoryA());234 strcat(shellpath, "\\Favorites");235 CreateDirectoryA(shellpath, NULL);236 RegSetValueExA(hkey,"Favorites",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);237 //Fonts238 strcpy(shellpath, InternalGetWindowsDirectoryA());239 strcat(shellpath, "\\Fonts");240 CreateDirectoryA(shellpath, NULL);241 RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);242 //History243 strcpy(shellpath, InternalGetWindowsDirectoryA());244 strcat(shellpath, "\\History");245 CreateDirectoryA(shellpath, NULL);246 RegSetValueExA(hkey,"History",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);247 //NetHood248 strcpy(shellpath, InternalGetWindowsDirectoryA());249 strcat(shellpath, "\\NetHood");250 CreateDirectoryA(shellpath, NULL);251 RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);252 //Personal253 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 //PrintHood258 strcpy(shellpath, InternalGetWindowsDirectoryA());259 strcat(shellpath, "\\PrintHood");260 CreateDirectoryA(shellpath, NULL);261 RegSetValueExA(hkey,"PrintHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);262 //Recent263 strcpy(shellpath, InternalGetWindowsDirectoryA());264 strcat(shellpath, "\\Recent");265 CreateDirectoryA(shellpath, NULL);266 RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);267 //SendTo268 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 Menu273 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 //Programs278 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 //Startup283 strcat(shellpath, "\\Startup");284 CreateDirectoryA(shellpath, NULL);285 RegSetValueExA(hkey,"Startup",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);286 //ShellNew287 strcpy(shellpath, InternalGetWindowsDirectoryA());288 strcat(shellpath, "\\ShellNew");289 CreateDirectoryA(shellpath, NULL);290 RegSetValueExA(hkey,"Templates",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 RegCloseKey(hkey);346 goto initreg_error;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 goto initreg_error;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 RegCloseKey(hkey);358 goto initreg_error;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 goto initreg_error;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 RegCloseKey(hkey);375 goto initreg_error;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 goto initreg_error;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 RegCloseKey(hkey);387 goto initreg_error;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 goto initreg_error;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 RegCloseKey(hkey);404 goto initreg_error;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 goto initreg_error;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 RegCloseKey(hkey);416 goto initreg_error;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 goto initreg_error;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 RegCloseKey(hkey);430 goto initreg_error;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 goto initreg_error;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 RegCloseKey(hkey);444 goto initreg_error;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 goto initreg_error;457 goto initreg_error; 458 458 } 459 459 //Create x:\Program Files directory 460 460 strcpy(shellpath, InternalGetWindowsDirectoryA()); 461 shellpath[2] = 0; //get drive461 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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 goto initreg_error;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 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=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 -
trunk/src/kernel32/initterm.cpp
r4474 r4510 1 /* $Id: initterm.cpp,v 1.4 8 2000-10-10 17:14:04sandervl Exp $ */1 /* $Id: initterm.cpp,v 1.49 2000-10-21 14:30:47 sandervl Exp $ */ 2 2 3 3 /* … … 183 183 //Set up environment as found in NT 184 184 InitEnvironment(ulSysinfo); 185 186 //InitDynamicRegistry creates/changes keys that may change (i.e. odin.ini 187 //keys that affect windows version) 188 InitDynamicRegistry(); 185 189 break; 186 190 } -
trunk/src/kernel32/initterm.h
r3740 r4510 1 /* $Id: initterm.h,v 1. 5 2000-06-21 20:51:52sandervl Exp $ */1 /* $Id: initterm.h,v 1.6 2000-10-21 14:30:47 sandervl Exp $ */ 2 2 /* 3 3 * KERNEL32 DLL entry point header … … 39 39 void InitEnvironment(int nrcpus); //initsystem.cpp 40 40 41 //InitDynamicRegistry creates/changes keys that may change (i.e. odin.ini 42 //keys that affect windows version) 43 void InitDynamicRegistry(); //initsystem.cpp 44 41 45 #endif -
trunk/src/kernel32/registry.cpp
r4496 r4510 1 /* $Id: registry.cpp,v 1. 5 2000-10-18 17:09:33sandervl Exp $ */1 /* $Id: registry.cpp,v 1.6 2000-10-21 14:30:47 sandervl Exp $ */ 2 2 3 3 /* … … 30 30 #include "unicode.h" 31 31 #include <winreg.h> 32 33 #define DBG_LOCALLOG DBG_registry 32 #include <heapstring.h> 33 34 #define DBG_LOCALLOG DBG_registry 34 35 #include "dbglocal.h" 35 36 … … 644 645 LONG rc; 645 646 646 rc = CALL_ODINFUNC(RegOpenKeyExA)( ConvertKey(arg1),647 rc = CALL_ODINFUNC(RegOpenKeyExA)(arg1, 647 648 astring, 648 649 arg3, … … 741 742 if(rc == ERROR_SUCCESS) 742 743 { 743 if(*arg3) {744 astring = (char *)malloc(*arg3);745 strcpy(astring, (char *)arg2);746 AsciiToUnicode(astring, arg2);747 free(astring);748 }749 else*arg2 = 0;744 if(*arg3) { 745 astring = (char *)malloc(*arg3); 746 strcpy(astring, (char *)arg2); 747 AsciiToUnicode(astring, arg2); 748 free(astring); 749 } 750 else *arg2 = 0; 750 751 } 751 752 return(rc); … … 800 801 LONG rc; 801 802 802 rc = CALL_ODINFUNC(RegQueryValueA)( ConvertKey(hkey),803 rc = CALL_ODINFUNC(RegQueryValueA)(hkey, 803 804 astring1, 804 805 (char *)lpszValue, … … 806 807 if(rc == ERROR_SUCCESS) 807 808 { 808 if(pcbValue) {809 astring2 = (char *)malloc(*pcbValue);810 strcpy(astring2, (char *)lpszValue);811 AsciiToUnicode(astring2, lpszValue);812 free(astring2);813 }809 if(pcbValue) { 810 astring2 = (char *)malloc(*pcbValue); 811 strcpy(astring2, (char *)lpszValue); 812 AsciiToUnicode(astring2, lpszValue); 813 free(astring2); 814 } 814 815 } 815 816 FreeAsciiString(astring1); … … 830 831 *****************************************************************************/ 831 832 832 ODINFUNCTION6(LONG,RegQueryValueExA,HKEY, arg1,833 LPSTR, arg2,834 LPDWORD, arg3,835 LPDWORD, arg4,836 LPBYTE, arg5,837 LPDWORD, arg6)838 { 839 dprintf(("ADVAPI32:Registry key=%s", arg2));840 841 return O32_RegQueryValueEx(ConvertKey( arg1),842 arg2,843 arg3,844 arg4,845 arg5,846 arg6);833 ODINFUNCTION6(LONG,RegQueryValueExA,HKEY, hkey, 834 LPSTR, lpszValueName, 835 LPDWORD,lpdwType, 836 LPDWORD,lpdwReserved, 837 LPBYTE, lpbData, 838 LPDWORD,lpcbData) 839 { 840 dprintf(("ADVAPI32:Registry key=%s", lpszValueName)); 841 842 return O32_RegQueryValueEx(ConvertKey(hkey), 843 lpszValueName, 844 lpdwType, 845 lpdwReserved, 846 lpbData, 847 lpcbData); 847 848 } 848 849 … … 860 861 *****************************************************************************/ 861 862 862 ODINFUNCTION6(LONG,RegQueryValueExW,HKEY, arg1, 863 LPWSTR, arg2, 864 LPDWORD,arg3, 865 LPDWORD,arg4, 866 LPBYTE, arg5, 867 LPDWORD,arg6) 868 { 869 char *astring = UnicodeToAsciiString(arg2); 863 ODINFUNCTION6(LONG,RegQueryValueExW,HKEY, hkey, 864 LPWSTR, lpszValueName, 865 LPDWORD,lpdwType, 866 LPDWORD,lpdwReserved, 867 LPBYTE, lpbData, 868 LPDWORD,lpcbData) 869 { 870 char *astring = UnicodeToAsciiString(lpszValueName); 871 char *akeydata = NULL; 870 872 LONG rc; 871 873 872 rc = CALL_ODINFUNC(RegQueryValueExA)(ConvertKey(arg1), 874 if(lpbData && lpcbData) 875 { 876 akeydata = (char *)malloc(*lpcbData+1); 877 akeydata[*lpcbData] = 0; 878 } 879 880 rc = CALL_ODINFUNC(RegQueryValueExA)(hkey, 873 881 astring, 874 arg3, 875 arg4, 876 arg5, 877 arg6); 882 lpdwType, 883 lpdwReserved, 884 (LPBYTE)akeydata, 885 lpcbData); 886 //could also query key type (without returning data), call it again and only allocate translation 887 //buffer if string type 888 if(rc == ERROR_SUCCESS && lpbData && lpcbData) 889 { 890 if(lpdwType == NULL) {//NULL apparently means REG_SZ 891 lstrcpyAtoW((LPWSTR)lpcbData, akeydata); 892 } 893 else { 894 switch(*lpdwType) { 895 case REG_SZ: 896 case REG_EXPAND_SZ: 897 lstrcpyAtoW((LPWSTR)lpcbData, akeydata); 898 break; 899 case REG_MULTI_SZ: 900 case REG_LINK: //??? 901 dprintf(("ERROR: key data must be translated from Unicode to Ascii!!")); 902 break; 903 default: 904 memcpy(lpbData, akeydata, *lpcbData); 905 break; 906 } 907 } 908 } 878 909 FreeAsciiString(astring); 910 if(akeydata) { 911 free(akeydata); 912 } 879 913 return(rc); 880 914 } … … 910 944 lpData, 911 945 cbData); 912 if(rc == ERROR_NOT_ENOUGH_MEMORY && cbData == 0 && dwType == REG_SZ) 946 if(rc == ERROR_NOT_ENOUGH_MEMORY && cbData == 0 && dwType == REG_SZ) 913 947 { 914 948 char regdata = 0; 915 //SvL: Netscape sets an empty string key this way; Open32 doesn't like it916 rc = O32_RegSetValue(ConvertKey(hkey),949 //SvL: Netscape sets an empty string key this way; Open32 doesn't like it 950 rc = O32_RegSetValue(ConvertKey(hkey), 917 951 lpSubKey, 918 952 dwType, … … 946 980 LONG rc; 947 981 948 //SvL: 8-11-'97: Bugfix: crash in pmwinx if size == 0 and string is large 949 if(cbData == 0) 950 cbData = strlen(astring2); 951 952 rc = O32_RegSetValue(ConvertKey(hkey), 953 astring1, 954 dwType, 955 astring2, 956 cbData); 982 rc = CALL_ODINFUNC(RegSetValueA)(hkey, 983 astring1, 984 dwType, 985 astring2, 986 cbData); 957 987 958 988 FreeAsciiString(astring1); … … 974 1004 *****************************************************************************/ 975 1005 976 ODINFUNCTION6(LONG,RegSetValueExA,HKEY, arg1, 977 LPSTR, arg2, 978 DWORD, arg3, 979 DWORD, arg4, 980 BYTE*, arg5, 981 DWORD, arg6) 982 { 983 return O32_RegSetValueEx(ConvertKey(arg1), 984 arg2, 985 arg3, 986 arg4, 987 arg5, 988 arg6); 1006 ODINFUNCTION6(LONG,RegSetValueExA,HKEY, hkey, 1007 LPSTR, lpszValueName, 1008 DWORD, dwReserved, 1009 DWORD, fdwType, 1010 BYTE*, lpbData, 1011 DWORD, cbData) 1012 { 1013 if(fdwType == REG_SZ) { 1014 dprintf(("ADVAPI32: RegSetValueExA)%08xh,%s,%08xh,%08xh,%s,%08xh)", 1015 hkey, 1016 lpszValueName, 1017 dwReserved, 1018 fdwType, 1019 lpbData, 1020 cbData)); 1021 } 1022 else { 1023 dprintf(("ADVAPI32: RegSetValueExA)%08xh,%s,%08xh,%08xh,%08xh,%08xh)", 1024 hkey, 1025 lpszValueName, 1026 dwReserved, 1027 fdwType, 1028 lpbData, 1029 cbData)); 1030 } 1031 1032 return O32_RegSetValueEx(ConvertKey(hkey), 1033 lpszValueName, 1034 dwReserved, 1035 fdwType, 1036 lpbData, 1037 cbData); 989 1038 } 990 1039 … … 1002 1051 *****************************************************************************/ 1003 1052 1004 ODINFUNCTION6(LONG,RegSetValueExW,HKEY, arg1, 1005 LPWSTR,arg2, 1006 DWORD, arg3, 1007 DWORD, arg4, 1008 BYTE*, arg5, 1009 DWORD, arg6) 1010 { 1011 char *astring = UnicodeToAsciiString(arg2); 1053 ODINFUNCTION6(LONG,RegSetValueExW,HKEY, hkey, 1054 LPWSTR,lpszValueName, 1055 DWORD, dwReserved, 1056 DWORD, fdwType, 1057 BYTE*, lpbData, 1058 DWORD, cbData) 1059 { 1060 char *astring = UnicodeToAsciiString(lpszValueName); 1061 char *akeydata = NULL; 1012 1062 LONG rc; 1013 1063 1014 dprintf(("ADVAPI32: RegSetValueExW(%08xh,%s,%08xh,%08xh,%08xh,%08xh)\n", 1015 arg1, 1016 astring, 1017 arg3, 1018 arg4, 1019 arg5, 1020 arg6)); 1021 1022 rc = O32_RegSetValueEx(ConvertKey(arg1), 1023 astring, 1024 arg3, 1025 arg4, 1026 arg5, 1027 arg6); 1064 switch(fdwType) { 1065 case REG_SZ: 1066 case REG_EXPAND_SZ: 1067 akeydata = UnicodeToAsciiString((LPWSTR)lpbData); 1068 lpbData = (BYTE *)akeydata; 1069 break; 1070 case REG_MULTI_SZ: 1071 case REG_LINK: //??? 1072 dprintf(("ERROR: key data must be translated from Unicode to Ascii!!")); 1073 break; 1074 } 1075 rc = CALL_ODINFUNC(RegSetValueExA)(hkey, 1076 astring, 1077 dwReserved, 1078 fdwType, 1079 lpbData, 1080 cbData); 1081 if(akeydata) 1082 FreeAsciiString(akeydata); 1083 1028 1084 FreeAsciiString(astring); 1029 1085 return(rc);
Note:
See TracChangeset
for help on using the changeset viewer.
