source: trunk/tools/install/odininst.cpp@ 5729

Last change on this file since 5729 was 5729, checked in by sandervl, 24 years ago

added serial registry key

File size: 33.7 KB
Line 
1/* $Id: odininst.cpp,v 1.5 2001-05-17 11:26:29 sandervl Exp $ */
2/*
3 * Odin WarpIn installation app
4 *
5 * Creates:
6 * - SYSTEMDIR\drivers
7 * - SYSTEMDIR\drivers\etc
8 * - WINDOWSDIR\SYSTEM
9 * - WINDOWSDIR\AppData
10 * - WINDOWSDIR\Cache
11 * - WINDOWSDIR\Cookies
12 * - WINDOWSDIR\Desktop
13 * - WINDOWSDIR\Favorites
14 * - WINDOWSDIR\Fonts
15 * - WINDOWSDIR\History
16 * - WINDOWSDIR\NetHood
17 * - WINDOWSDIR\My Documents
18 * - WINDOWSDIR\PrintHood
19 * - WINDOWSDIR\Recent
20 * - WINDOWSDIR\SendTo
21 * - WINDOWSDIR\Start Menu
22 * - WINDOWSDIR\Start Menu\Programs
23 * - WINDOWSDIR\Start Menu\Programs\Startup
24 * - WINDOWSDIR\ShellNew
25 * - x:\Program Files
26 * - x:\Program Files\Common Files
27 * - and a minimal system registry
28 *
29 * Copyright 1999-2001 Sander van Leeuwen (sandervl@xs4all.nl)
30 *
31 * Project Odin Software License can be found in LICENSE.TXT
32 *
33 */
34#include <os2win.h>
35#include <string.h>
36#include <stdio.h>
37#include <ctype.h>
38#include "winreg.h"
39#include "global.h"
40#include "winnt.h"
41#include "winerror.h"
42#include "winreg.h"
43#include "winnls.h"
44#include "debugtools.h"
45#include <odininst.h>
46#include <win\options.h>
47#include <versionos2.h>
48#include <time.h>
49
50BOOL CreateSystemDirectories();
51BOOL SetupControlPanelKeys();
52BOOL InitSystemAndRegistry();
53
54//******************************************************************************
55//******************************************************************************
56//[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows]
57//"Directory"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,00
58//"SystemDirectory"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,\
59// 6d,33,32,00
60//"ErrorMode"=dword:00000000
61//"NoInteractiveServices"=dword:00000000
62//"CSDVersion"=dword:00000300
63BYTE ShutdownTime[] = {0x44,0x5e,0xf2,0xbb,0x84,0x41,0xbf,0x01};
64
65static char DIR_Windows[260];
66static char DIR_System[260];
67
68//******************************************************************************
69//******************************************************************************
70int main(int argc, char *argv[])
71{
72 InitSystemAndRegistry();
73 CreateSystemDirectories();
74 SetupControlPanelKeys();
75 return 0;
76}
77//******************************************************************************
78//******************************************************************************
79char *InternalGetWindowsDirectory()
80{
81 static char fInit = FALSE;
82
83 if(fInit == FALSE) {
84 GetWindowsDirectory(DIR_Windows, sizeof(DIR_Windows)-1);
85 fInit = TRUE;
86 }
87 return DIR_Windows;
88}
89//******************************************************************************
90//******************************************************************************
91char *InternalGetSystemDirectory()
92{
93 static char fInit = FALSE;
94
95 if(fInit == FALSE) {
96 GetSystemDirectory(DIR_System, sizeof(DIR_System)-1);
97 fInit = TRUE;
98 }
99 return DIR_System;
100}
101//******************************************************************************
102//******************************************************************************
103BOOL InitSystemAndRegistry()
104{
105 HKEY hkey, hkey1;
106 char *buf;
107 DWORD val;
108 char digbuf[16];
109 char shellpath[260];
110
111 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Windows",&hkey)!=ERROR_SUCCESS) {
112 dprintf(("InitRegistry: Unable to register system information\n"));
113 return FALSE;
114 }
115 buf = InternalGetWindowsDirectory();
116 RegSetValueEx(hkey,"Directory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
117 buf = InternalGetSystemDirectory();
118 RegSetValueEx(hkey,"SystemDirectory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
119 val = 0;
120 RegSetValueEx(hkey,"ErrorMode",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
121 val = 0;
122 RegSetValueEx(hkey,"NoInteractiveServices",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
123 val = ODINNT_BUILD_NR;
124 RegSetValueEx(hkey,"CSDVersion",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
125 RegSetValueEx(hkey,"ShutdownTime",0,REG_DWORD, (LPBYTE)ShutdownTime, sizeof(ShutdownTime));
126 RegCloseKey(hkey);
127
128 //Software\Microsoft\Windows\CurrentVersion\RunOnce
129 if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce",&hkey)!=ERROR_SUCCESS) {
130 dprintf(("InitRegistry: Unable to register system information (2)"));
131 return FALSE;
132 }
133 RegCloseKey(hkey);
134
135 //System\CurrentControlSet\Control\Session Manager
136 if(RegCreateKey(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\Session Manager",&hkey)!=ERROR_SUCCESS) {
137 dprintf(("InitRegistry: Unable to register system information (2)"));
138 return FALSE;
139 }
140 RegCloseKey(hkey);
141
142 if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\iexplore.exe",&hkey)!=ERROR_SUCCESS) {
143 dprintf(("InitRegistry: Unable to register system information (2)"));
144 return FALSE;
145 }
146 strcpy(shellpath, InternalGetWindowsDirectory());
147 strcat(shellpath, "\\IEXPLORE.EXE");
148 RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
149 RegCloseKey(hkey);
150
151
152 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
153 dprintf(("InitRegistry: Unable to register system information (2)"));
154 return FALSE;
155 }
156 buf = InternalGetSystemDirectory();
157 RegSetValueEx(hkey,"SystemRoot",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
158 RegSetValueEx(hkey,"PathName",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
159 sprintf(digbuf, "%d", ODINNT_BUILD_NR);
160 RegSetValueEx(hkey,"CurrentBuildNumber",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
161 RegSetValueEx(hkey,"CurrentType",0,REG_SZ, (LPBYTE)ODINNT_OSTYPE_UNI, sizeof(ODINNT_OSTYPE_UNI));
162 RegSetValueEx(hkey,"CSDVersion",0,REG_SZ, (LPBYTE)ODINNT_CSDVERSION, sizeof(ODINNT_CSDVERSION));
163 RegSetValueEx(hkey,"SoftwareType",0,REG_SZ, (LPBYTE)ODINNT_SOFTWARE_TYPE, sizeof(ODINNT_SOFTWARE_TYPE));
164
165 sprintf(digbuf, "%d.%d", ODINNT_MAJOR_VERSION, ODINNT_MINOR_VERSION);
166 RegSetValueEx(hkey,"CurrentVersion",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
167
168 val = (DWORD)time(NULL); //todo: Correct format???
169 RegSetValueEx(hkey,"InstallDate",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
170
171 RegCloseKey(hkey);
172 //todo: productid, registered org/owner, sourcepath,
173
174 //Shell32 & IE related keys
175 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021400-0000-0000-C000-000000000046}]
176 //@="Desktop"
177 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021400-0000-0000-C000-000000000046}\InProcServer32]
178 //@="shell32.dll"
179 //ThreadingModel="Apartment"
180 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
181 goto initreg_error;
182 }
183 RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_DESKTOP, sizeof(CLASS_DESKTOP));
184 RegCloseKey(hkey);
185 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
186 goto initreg_error;
187 }
188 RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL));
189 RegSetValueEx(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
190 RegCloseKey(hkey);
191 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}]
192 //@="Shortcut"
193 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}\InProcServer32]
194 //@="shell32.dll"
195 //"ThreadingModel"="Apartment"
196 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}\shellex\MayChangeDefaultMenu]
197 //@=""
198 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
199 goto initreg_error;
200 }
201 RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHORTCUT, sizeof(CLASS_SHORTCUT));
202 RegCloseKey(hkey);
203 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
204 goto initreg_error;
205 }
206 RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL));
207 RegSetValueEx(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
208 RegCloseKey(hkey);
209 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\shellex\\MayChangeDefaultMenu",&hkey)!=ERROR_SUCCESS) {
210 goto initreg_error;
211 }
212 RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)"", 0);
213 RegCloseKey(hkey);
214
215 //# Entries for IWebBrowser
216 //# Used by Internet Explorer HTML-rendering control
217 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}]
218 //@="Shortcut"
219 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\InProcServer32]
220 //@="shdocvw.dll"
221 //"ThreadingModel"="Apartment"
222 //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\shellex\MayChangeDefaultMenu]
223 //@=""
224
225 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}",&hkey)!=ERROR_SUCCESS) {
226 goto initreg_error;
227 }
228 RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHORTCUT, sizeof(CLASS_SHORTCUT));
229 RegCloseKey(hkey);
230
231 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
232 goto initreg_error;
233 }
234 RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHDOCVW, sizeof(CLASS_SHDOCVW));
235 RegSetValueEx(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
236 RegCloseKey(hkey);
237
238 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}\\shellex\\MayChangeDefaultMenu",&hkey)!=ERROR_SUCCESS) {
239 goto initreg_error;
240 }
241 RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)"", 1);
242 RegCloseKey(hkey);
243
244 //Now the Ddraw & dsound registry keys:
245 //HKEY_CLASSES_ROOT\DirectDraw = DirectDraw Object
246 //HKEY_CLASSES_ROOT\DirectDraw\CLSID = {D7B70EE0-4340-11CF-B063-0020AFC2CD35}
247 //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35} = DirectDraw Object
248 //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35}\InprocServer32 = ddraw.dll
249 if(RegCreateKey(HKEY_CLASSES_ROOT,"DirectDraw",&hkey)!=ERROR_SUCCESS) {
250 goto initreg_error;
251 }
252 RegSetValueEx(hkey, "", 0, REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
253 if(RegCreateKey(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
254 RegCloseKey(hkey);
255 goto initreg_error;
256 }
257 RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLASSID, sizeof(DDRAW_CLASSID));
258 RegCloseKey(hkey1);
259 RegCloseKey(hkey);
260
261 if(RegCreateKey(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLASSID ,&hkey)!=ERROR_SUCCESS) {
262 goto initreg_error;
263 }
264 RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
265 if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
266 RegCloseKey(hkey);
267 goto initreg_error;
268 }
269 RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
270 RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
271 RegCloseKey(hkey1);
272 RegCloseKey(hkey);
273
274 //HKEY_CLASSES_ROOT\DirectDrawClipper = DirectDraw Clipper Object
275 //HKEY_CLASSES_ROOT\DirectDrawClipper\CLSID = {593817A0-7DB3-11CF-A2DE-00AA00B93356}
276 //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356} = DirectDraw Clipper Object
277 //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356}\InprocServer32 = ddraw.dll
278 if(RegCreateKey(HKEY_CLASSES_ROOT,"DirectDrawClipper",&hkey)!=ERROR_SUCCESS) {
279 goto initreg_error;
280 }
281 RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
282 if(RegCreateKey(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
283 RegCloseKey(hkey);
284 goto initreg_error;
285 }
286 RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_CLASSID, sizeof(DDRAW_CLIPPER_CLASSID));
287 RegCloseKey(hkey1);
288 RegCloseKey(hkey);
289
290 if(RegCreateKey(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLIPPER_CLASSID,&hkey)!=ERROR_SUCCESS) {
291 goto initreg_error;
292 }
293 RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
294 if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
295 RegCloseKey(hkey);
296 goto initreg_error;
297 }
298 RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
299 RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
300 RegCloseKey(hkey1);
301 RegCloseKey(hkey);
302
303 //HKEY_CLASSES_ROOT\DirectSound = DirectSound Object
304 //HKEY_CLASSES_ROOT\DirectSound\CLSID = {47D4D946-62E8-11cf-93BC-444553540000}
305 //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000} = DirectSound Object
306 //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000}\InprocServer32 = dsound.dll
307 if(RegCreateKey(HKEY_CLASSES_ROOT,"DirectSound",&hkey)!=ERROR_SUCCESS) {
308 goto initreg_error;
309 }
310 RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
311 if(RegCreateKey(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
312 RegCloseKey(hkey);
313 goto initreg_error;
314 }
315 RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_CLASSID, sizeof(DSOUND_CLASSID));
316 RegCloseKey(hkey1);
317 RegCloseKey(hkey);
318
319 if(RegCreateKey(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DSOUND_CLASSID ,&hkey)!=ERROR_SUCCESS) {
320 goto initreg_error;
321 }
322 RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
323 if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
324 RegCloseKey(hkey);
325 goto initreg_error;
326 }
327 RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_DLL, sizeof(DSOUND_DLL));
328 RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
329 RegCloseKey(hkey1);
330 RegCloseKey(hkey);
331
332 //DirectPlay
333 if(RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_CLASSID ,&hkey)!=ERROR_SUCCESS) {
334 goto initreg_error;
335 }
336 RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_DEFAULT, sizeof(DPLAYX_DEFAULT));
337 if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
338 RegCloseKey(hkey);
339 goto initreg_error;
340 }
341 RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_DLL, sizeof(DPLAYX_DLL));
342 RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
343 RegCloseKey(hkey1);
344 RegCloseKey(hkey);
345
346 //DirectPlay Lobby
347 if(RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_LOBBY_CLASSID ,&hkey)!=ERROR_SUCCESS) {
348 goto initreg_error;
349 }
350 RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DEFAULT, sizeof(DPLAYX_LOBBY_DEFAULT));
351 if(RegCreateKey(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
352 RegCloseKey(hkey);
353 goto initreg_error;
354 }
355 RegSetValueEx(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DLL, sizeof(DPLAYX_LOBBY_DLL));
356 RegSetValueEx(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
357 RegCloseKey(hkey1);
358 RegCloseKey(hkey);
359
360 //[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion]
361 //"ProgramFilesDir"="C:\Program Files"
362 //"CommonFilesDir"="C:\Program Files\Common Files"
363 //# 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.
364 //"SharedDir"="C:\WINDOWS"
365 if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
366 goto initreg_error;
367 }
368 //Create x:\Program Files directory
369 strcpy(shellpath, InternalGetWindowsDirectory());
370 shellpath[2] = 0; //get drive
371 strcat(shellpath, "\\Program Files");
372 CreateDirectory(shellpath, NULL);
373 RegSetValueEx(hkey, DIR_PROGRAM, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
374
375 //Create x:\Program Files\Common Files directory
376 strcat(shellpath, "\\Common Files");
377 CreateDirectory(shellpath, NULL);
378 RegSetValueEx(hkey, DIR_PROGRAM_COMMON, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
379
380 strcpy(shellpath, InternalGetWindowsDirectory());
381 RegSetValueEx(hkey, DIR_SHARED, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
382
383 RegCloseKey(hkey);
384
385 //[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\VIDEO]
386 //"\\Device\\Video0"="\\REGISTRY\\Machine\\System\\ControlSet001\\Services\\mga64\\Device0"
387 //"\\Device\\Video1"="\\REGISTRY\\Machine\\System\\ControlSet001\\Services\\VgaSave\\Device0"
388 //"VgaCompatible"="\\Device\\Video1"
389 if(RegCreateKey(HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\VIDEO",&hkey)!=ERROR_SUCCESS) {
390 goto initreg_error;
391 }
392 RegSetValueEx(hkey,"\\Device\\Video0",0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD, sizeof(HARDWARE_VIDEO_GRADD));
393 RegSetValueEx(hkey,"\\Device\\Video1",0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_VGA, sizeof(HARDWARE_VIDEO_VGA));
394 RegSetValueEx(hkey, "VgaCompatible", 0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_COMPATIBLE, sizeof(HARDWARE_VIDEO_COMPATIBLE));
395 RegCloseKey(hkey);
396
397 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Gradd\\Device0",&hkey)!=ERROR_SUCCESS) {
398 goto initreg_error;
399 }
400 RegSetValueEx(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD_DESCRIPTION, sizeof(HARDWARE_VIDEO_GRADD_DESCRIPTION));
401 RegCloseKey(hkey);
402
403 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\VgaSave\\Device0",&hkey)!=ERROR_SUCCESS) {
404 goto initreg_error;
405 }
406 RegSetValueEx(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_VGA_DESCRIPTION, sizeof(HARDWARE_VIDEO_VGA_DESCRIPTION));
407 RegCloseKey(hkey);
408
409 //Software\Microsoft\Multimedia\Sound Mapper
410 if(RegCreateKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Multimedia\\Sound Mapper",&hkey)!=ERROR_SUCCESS) {
411 goto initreg_error;
412 }
413 RegSetValueEx(hkey,"Playback", 0, REG_SZ, (LPBYTE)ODIN_WINMM_PLAYBACK, sizeof(ODIN_WINMM_PLAYBACK));
414 RegSetValueEx(hkey,"Record", 0, REG_SZ, (LPBYTE)ODIN_WINMM_RECORD, sizeof(ODIN_WINMM_RECORD));
415 RegCloseKey(hkey);
416
417 //Software\Microsoft\DirectX
418 if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectX",&hkey)!=ERROR_SUCCESS) {
419 goto initreg_error;
420 }
421 RegSetValueEx(hkey,"",0,REG_SZ, (LPBYTE)"", 0);
422 RegSetValueEx(hkey, "RC", 0,REG_SZ, (LPBYTE)DIRECTX_RC, sizeof(DIRECTX_RC));
423 RegSetValueEx(hkey, "Version", 0,REG_SZ, (LPBYTE)DIRECTX_VERSION, sizeof(DIRECTX_VERSION));
424 val = DIRECTX_INSTALLED_VERSION;
425 RegSetValueEx(hkey, "InstalledVersion", 0,REG_BINARY, (LPBYTE)&val, sizeof(DWORD));
426 RegCloseKey(hkey);
427
428 if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectDraw",&hkey)!=ERROR_SUCCESS) {
429 goto initreg_error;
430 }
431 //todo
432 RegCloseKey(hkey);
433
434 if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Direct3D",&hkey)!=ERROR_SUCCESS) {
435 goto initreg_error;
436 }
437 //todo
438 RegCloseKey(hkey);
439
440 if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectPlay",&hkey)!=ERROR_SUCCESS) {
441 goto initreg_error;
442 }
443 //todo
444 RegCloseKey(hkey);
445
446#if 0
447 if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectMusic",&hkey)!=ERROR_SUCCESS) {
448 goto initreg_error;
449 }
450 //todo
451 RegCloseKey(hkey);
452#endif
453
454// [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs]
455// "Type"=dword:00000002
456// "Start"=dword:00000004
457// "Group"="File system"
458// "ErrorControl"=dword:00000001
459// "DependOnGroup"=hex(7):53,43,53,49,20,43,44,52,4f,4d,20,43,6c,61,73,73,00,00
460
461 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdfs",&hkey)!=ERROR_SUCCESS) {
462 goto initreg_error;
463 }
464 val = 0x2;
465 RegSetValueEx(hkey, KEY_DEVICE_TYPE,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
466 val = 0x4;
467 RegSetValueEx(hkey, KEY_DEVICE_START,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
468 val = 0x1;
469 RegSetValueEx(hkey, KEY_DEVICE_ERRORCONTROL,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
470 RegSetValueEx(hkey, KEY_DEVICE_GROUP,0,REG_SZ, (LPBYTE)DEVICE_GROUP_FILESYSTEM, sizeof(DEVICE_GROUP_FILESYSTEM));
471 //todo dependongroup
472 RegCloseKey(hkey);
473
474
475/*
476// [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs\Enum]
477// "0"="Root\\LEGACY_CDFS\\0000"
478// "Count"=dword:00000001
479// "NextInstance"=dword:00000001
480*/
481// [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom]
482// "Type"=dword:00000001
483// "Start"=dword:00000001
484// "Group"="SCSI CDROM Class"
485// "ErrorControl"=dword:00000000
486// "Tag"=dword:00000002
487// "DependOnGroup"=hex(7):53,43,53,49,20,6d,69,6e,69,70,6f,72,74,00,00
488// "Autorun"=dword:00000001
489
490 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdrom",&hkey)!=ERROR_SUCCESS) {
491 goto initreg_error;
492 }
493 val = 0x1;
494 RegSetValueEx(hkey, KEY_DEVICE_TYPE,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
495 val = 0x1;
496 RegSetValueEx(hkey, KEY_DEVICE_START,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
497 val = 0x0;
498 RegSetValueEx(hkey, KEY_DEVICE_ERRORCONTROL,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
499 val = 0x2;
500 RegSetValueEx(hkey, KEY_DEVICE_TAG,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
501 val = 0x0;
502 RegSetValueEx(hkey, KEY_DEVICE_AUTORUN,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
503 RegSetValueEx(hkey, KEY_DEVICE_GROUP,0,REG_SZ, (LPBYTE)DEVICE_GROUP_SCSICDROM, sizeof(DEVICE_GROUP_SCSICDROM));
504 //todo dependongroup
505 RegCloseKey(hkey);
506
507/*
508[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom\Enum]
509"0"="Root\\LEGACY_CDROM\\0000"
510"Count"=dword:00000001
511"NextInstance"=dword:00000001
512*/
513
514 //[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\FileSystem]
515 //"Win31FileSystem"=dword:00000000
516 //"NtfsDisable8dot3NameCreation"=dword:00000000
517 //"Win95TruncatedExtensions"=dword:00000001
518 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\FileSystem",&hkey)!=ERROR_SUCCESS) {
519 goto initreg_error;
520 }
521 val = 0x0;
522 RegSetValueEx(hkey, "Win31FileSystem",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
523 val = 0x0;
524 RegSetValueEx(hkey, "NtfsDisable8dot3NameCreation",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
525 val = 0x1;
526 RegSetValueEx(hkey, "Win95TruncatedExtensions",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
527 RegCloseKey(hkey);
528
529//[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM]
530//"Serial1"="COM2"
531 if(RegCreateKey(HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\SERIALCOMM",&hkey)!=ERROR_SUCCESS) {
532 goto initreg_error;
533 }
534 RegSetValueEx(hkey, "Serial1",0,REG_SZ, (LPBYTE)"COM2", 5);
535 RegCloseKey(hkey);
536
537
538//[HKEY_LOCAL_MACHINE\Software\Microsoft\OLE]
539//# allow cross-machine calls (RPC) (default Y)
540//"EnableDCOM"="Y"
541//# allow incoming connections ? (def. N)
542//"EnableRemoteConnect"="N"
543 if(RegCreateKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\OLE",&hkey)!=ERROR_SUCCESS) {
544 goto initreg_error;
545 }
546 digbuf[0] = 'Y';
547 digbuf[1] = 0;
548 RegSetValueEx(hkey, "EnableDCOM",0,REG_SZ, (LPBYTE)digbuf, 2);
549 digbuf[0] = 'N';
550 digbuf[1] = 0;
551 RegSetValueEx(hkey, "EnableRemoteConnect",0,REG_SZ, (LPBYTE)digbuf, 2);
552 RegCloseKey(hkey);
553
554 //Add MS Sans Serif to WarpSans font conversion entry
555 char temp;
556 if(PROFILE_GetOdinIniString(ODINFONTSECTION, "MS Sans Serif", "", &temp,
557 0) <= 1)
558 {
559 PROFILE_SetOdinIniString(ODINFONTSECTION, "MS Sans Serif", "WarpSans");
560 }
561 //Create system.ini with [mci] section
562 strcpy(shellpath, InternalGetWindowsDirectory());
563 strcat(shellpath, "\\system.ini");
564
565 if(GetPrivateProfileStringA(szMci, szCDAudio, szMciCDA, &temp, 0, shellpath) <= 1) {
566 WritePrivateProfileStringA(szMci, szCDAudio, szMciCDA, shellpath);
567 }
568
569 //Font registry keys (not complete)
570 //[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
571 //"Courier 10,12,15 (VGA res)"="COURE.FON"
572 //"MS Sans Serif 8,10,12,14,18,24 (VGA res)"="SSERIFE.FON"
573 //"MS Serif 8,10,12,14,18,24 (VGA res)"="SERIFE.FON"
574
575
576 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts",&hkey)!=ERROR_SUCCESS) {
577 goto initreg_error;
578 }
579 #define FONT_COURIER "COURE.FON"
580 #define FONT_SANSSERIF "SSERIFE.FON"
581 #define FONT_SERIF "SERIFE.FON"
582 RegSetValueEx(hkey, "Courier 10,12,15 (VGA res)",0,REG_SZ, (LPBYTE)FONT_COURIER, sizeof(FONT_COURIER));
583 RegSetValueEx(hkey, "MS Sans Serif 8,10,12,14,18,24 (VGA res)",0,REG_SZ, (LPBYTE)FONT_SANSSERIF, sizeof(FONT_SANSSERIF));
584 RegSetValueEx(hkey, "MS Serif 8,10,12,14,18,24 (VGA res)",0,REG_SZ, (LPBYTE)FONT_SERIF, sizeof(FONT_SERIF));
585 RegCloseKey(hkey);
586
587 if(RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts",&hkey)!=ERROR_SUCCESS) {
588 goto initreg_error;
589 }
590 RegSetValueEx(hkey, "Courier 10,12,15 (VGA res)",0,REG_SZ, (LPBYTE)FONT_COURIER, sizeof(FONT_COURIER));
591 RegSetValueEx(hkey, "MS Sans Serif 8,10,12,14,18,24 (VGA res)",0,REG_SZ, (LPBYTE)FONT_SANSSERIF, sizeof(FONT_SANSSERIF));
592 RegSetValueEx(hkey, "MS Serif 8,10,12,14,18,24 (VGA res)",0,REG_SZ, (LPBYTE)FONT_SERIF, sizeof(FONT_SERIF));
593 RegCloseKey(hkey);
594 return TRUE;
595
596initreg_error:
597 dprintf((INITREG_ERROR));
598 return FALSE;
599}
600//******************************************************************************
601//******************************************************************************
602BOOL CreateSystemDirectories()
603{
604 char dirname[260];
605 HKEY hkey;
606
607 //Create Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders keys
608 //"Favorites"="C:\WINDOWS\Favorites"
609 //"StartUp"="C:\WINDOWS\Start Menu\Programs\Startup"
610 //"Desktop"="C:\WINDOWS\Desktop"
611 //"Programs"="C:\WINDOWS\Start Menu\Programs"
612 //"Fonts"="C:\WINDOWS\Fonts"
613 //"SendTo"="C:\WINDOWS\SendTo"
614 //"Start Menu"="C:\WINDOWS\Start Menu"
615 //"Templates"="C:\WINDOWS\ShellNew"
616 //"Recent"="C:\WINDOWS\Recent"
617 //"NetHood"="C:\WINDOWS\NetHood"
618 //"Personal"="C:\My Documents"
619
620 if(RegCreateKey(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",&hkey)!=ERROR_SUCCESS) {
621 dprintf(("InitRegistry: Unable to register system information (3)"));
622 return FALSE;
623 }
624 //system32\drivers dir
625 strcpy(dirname, InternalGetSystemDirectory());
626 strcat(dirname, "\\Drivers");
627 CreateDirectory(dirname, NULL);
628 strcat(dirname, "\\etc");
629 CreateDirectory(dirname, NULL);
630
631 //SYSTEM dir
632 strcpy(dirname, InternalGetWindowsDirectory());
633 strcat(dirname, "\\SYSTEM");
634 CreateDirectory(dirname, NULL);
635
636 //AppData
637 strcpy(dirname, InternalGetWindowsDirectory());
638 strcat(dirname, "\\Application Data");
639 CreateDirectory(dirname, NULL);
640 RegSetValueEx(hkey,"AppData",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
641 //Cache
642 strcpy(dirname, InternalGetWindowsDirectory());
643 strcat(dirname, "\\Temporary Internet Files");
644 CreateDirectory(dirname, NULL);
645 RegSetValueEx(hkey,"Cache",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
646 //Cookies
647 strcpy(dirname, InternalGetWindowsDirectory());
648 strcat(dirname, "\\Cookies");
649 CreateDirectory(dirname, NULL);
650 RegSetValueEx(hkey,"Cookies",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
651 //Desktop
652 strcpy(dirname, InternalGetWindowsDirectory());
653 strcat(dirname, "\\Desktop");
654 CreateDirectory(dirname, NULL);
655 RegSetValueEx(hkey,"Desktop",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
656 //Favorites
657 strcpy(dirname, InternalGetWindowsDirectory());
658 strcat(dirname, "\\Favorites");
659 CreateDirectory(dirname, NULL);
660 RegSetValueEx(hkey,"Favorites",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
661 //Fonts
662 strcpy(dirname, InternalGetWindowsDirectory());
663 strcat(dirname, "\\Fonts");
664 CreateDirectory(dirname, NULL);
665 RegSetValueEx(hkey,"Fonts",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
666 //History
667 strcpy(dirname, InternalGetWindowsDirectory());
668 strcat(dirname, "\\History");
669 CreateDirectory(dirname, NULL);
670 RegSetValueEx(hkey,"History",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
671 //NetHood
672 strcpy(dirname, InternalGetWindowsDirectory());
673 strcat(dirname, "\\NetHood");
674 CreateDirectory(dirname, NULL);
675 RegSetValueEx(hkey,"NetHood",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
676 //Personal
677 strcpy(dirname, InternalGetWindowsDirectory());
678 strcat(dirname, "\\My Documents");
679 CreateDirectory(dirname, NULL);
680 RegSetValueEx(hkey,"Personal",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
681 //PrintHood
682 strcpy(dirname, InternalGetWindowsDirectory());
683 strcat(dirname, "\\PrintHood");
684 CreateDirectory(dirname, NULL);
685 RegSetValueEx(hkey,"PrintHood",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
686 //Recent
687 strcpy(dirname, InternalGetWindowsDirectory());
688 strcat(dirname, "\\Recent");
689 CreateDirectory(dirname, NULL);
690 RegSetValueEx(hkey,"Recent",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
691 //SendTo
692 strcpy(dirname, InternalGetWindowsDirectory());
693 strcat(dirname, "\\SendTo");
694 CreateDirectory(dirname, NULL);
695 RegSetValueEx(hkey,"SendTo",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
696 //Start Menu
697 strcpy(dirname, InternalGetWindowsDirectory());
698 strcat(dirname, "\\Start Menu");
699 CreateDirectory(dirname, NULL);
700 RegSetValueEx(hkey,"Start Menu",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
701 //Programs
702 strcpy(dirname, InternalGetWindowsDirectory());
703 strcat(dirname, "\\Start Menu\\Programs");
704 CreateDirectory(dirname, NULL);
705 RegSetValueEx(hkey,"Programs",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
706 //Startup
707 strcat(dirname, "\\Startup");
708 CreateDirectory(dirname, NULL);
709 RegSetValueEx(hkey,"Startup",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
710 //ShellNew
711 strcpy(dirname, InternalGetWindowsDirectory());
712 strcat(dirname, "\\ShellNew");
713 CreateDirectory(dirname, NULL);
714 RegSetValueEx(hkey,"Templates",0,REG_SZ, (LPBYTE)dirname, strlen(dirname)+1);
715 RegCloseKey(hkey);
716
717 return TRUE;
718}
719//******************************************************************************
720//Example:
721//[HKEY_USERS\.DEFAULT\Control Panel\International]
722//"Locale"="00000409"
723//"sLanguage"="ENU"
724//"sCountry"="United States"
725//"iCountry"="1"
726//"sList"=","
727//"iMeasure"="1"
728//"sDecimal"="."
729//"sThousand"=","
730//"iDigits"="2"
731//"iLZero"="1"
732//"sCurrency"="$"
733//"iCurrDigits"="2"
734//"iCurrency"="0"
735//"iNegCurr"="0"
736//"sDate"="/"
737//"sTime"=":"
738//"sShortDate"="M/d/yy"
739//"sLongDate"="dddd, MMMM dd, yyyy"
740//"iDate"="0"
741//"iTime"="0"
742//"iTLZero"="0"
743//"s1159"="AM"
744//"s2359"="PM"
745//******************************************************************************
746BOOL SetupControlPanelKeys()
747{
748 HKEY hkey;
749 LCID lcid;
750 char tmp[128];
751
752 if(RegCreateKey(HKEY_CURRENT_USER,"Control Panel\\International",&hkey)!=ERROR_SUCCESS) {
753 dprintf(("SetupControlPanelKeys: Unable to create key"));
754 return FALSE;
755 }
756 lcid = GetUserDefaultLCID();
757 sprintf(tmp, "%08X", lcid);
758 RegSetValueEx(hkey,"Locale",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
759
760 GetLocaleInfo(lcid, LOCALE_SLANGUAGE, tmp, sizeof(tmp)-1);
761 RegSetValueEx(hkey,"sLanguage",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
762
763 GetLocaleInfo(lcid, LOCALE_SCOUNTRY, tmp, sizeof(tmp)-1);
764 RegSetValueEx(hkey,"sCountry",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
765
766 GetLocaleInfo(lcid, LOCALE_ICOUNTRY, tmp, sizeof(tmp)-1);
767 RegSetValueEx(hkey,"iCountry",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
768
769 GetLocaleInfo(lcid, LOCALE_SLIST, tmp, sizeof(tmp)-1);
770 RegSetValueEx(hkey,"sList",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
771
772 GetLocaleInfo(lcid, LOCALE_IMEASURE, tmp, sizeof(tmp)-1);
773 RegSetValueEx(hkey,"sMeasure",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
774
775 GetLocaleInfo(lcid, LOCALE_SDECIMAL, tmp, sizeof(tmp)-1);
776 RegSetValueEx(hkey,"sDecimal",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
777
778 GetLocaleInfo(lcid, LOCALE_STHOUSAND, tmp, sizeof(tmp)-1);
779 RegSetValueEx(hkey,"sThousand",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
780
781 GetLocaleInfo(lcid, LOCALE_IDIGITS, tmp, sizeof(tmp)-1);
782 RegSetValueEx(hkey,"iDigits",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
783
784 GetLocaleInfo(lcid, LOCALE_ILZERO, tmp, sizeof(tmp)-1);
785 RegSetValueEx(hkey,"iLZero",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
786
787 GetLocaleInfo(lcid, LOCALE_SCURRENCY, tmp, sizeof(tmp)-1);
788 RegSetValueEx(hkey,"sCurrency",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
789
790 GetLocaleInfo(lcid, LOCALE_ICURRDIGITS, tmp, sizeof(tmp)-1);
791 RegSetValueEx(hkey,"iCurrDigits",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
792
793 GetLocaleInfo(lcid, LOCALE_ICURRENCY, tmp, sizeof(tmp)-1);
794 RegSetValueEx(hkey,"iCurrency",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
795
796 GetLocaleInfo(lcid, LOCALE_INEGCURR, tmp, sizeof(tmp)-1);
797 RegSetValueEx(hkey,"iNegCurr",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
798
799 GetLocaleInfo(lcid, LOCALE_SDATE, tmp, sizeof(tmp)-1);
800 RegSetValueEx(hkey,"sDate",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
801
802 GetLocaleInfo(lcid, LOCALE_STIME, tmp, sizeof(tmp)-1);
803 RegSetValueEx(hkey,"sTime",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
804
805 GetLocaleInfo(lcid, LOCALE_SSHORTDATE, tmp, sizeof(tmp)-1);
806 RegSetValueEx(hkey,"sShortDate",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
807
808 GetLocaleInfo(lcid, LOCALE_SLONGDATE, tmp, sizeof(tmp)-1);
809 RegSetValueEx(hkey,"sLongDate",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
810
811 GetLocaleInfo(lcid, LOCALE_IDATE, tmp, sizeof(tmp)-1);
812 RegSetValueEx(hkey,"iDate",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
813
814 GetLocaleInfo(lcid, LOCALE_ITIME, tmp, sizeof(tmp)-1);
815 RegSetValueEx(hkey,"iTime",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
816
817 GetLocaleInfo(lcid, LOCALE_ITLZERO, tmp, sizeof(tmp)-1);
818 RegSetValueEx(hkey,"iTLZero",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
819
820 GetLocaleInfo(lcid, LOCALE_S1159, tmp, sizeof(tmp)-1);
821 RegSetValueEx(hkey,"s1159",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
822
823 GetLocaleInfo(lcid, LOCALE_S2359, tmp, sizeof(tmp)-1);
824 RegSetValueEx(hkey,"s2359",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
825
826 GetLocaleInfo(lcid, LOCALE_ICALENDARTYPE, tmp, sizeof(tmp)-1);
827 RegSetValueEx(hkey,"iCalendarType",0,REG_SZ, (LPBYTE)tmp, strlen(tmp)+1);
828
829 RegCloseKey(hkey);
830
831 if(RegCreateKey(HKEY_CURRENT_USER,"Control Panel\\International\\Sorting Order",&hkey)!=ERROR_SUCCESS) {
832 dprintf(("SetupControlPanelKeys: Unable to create key"));
833 return FALSE;
834 }
835 RegCloseKey(hkey);
836 return TRUE;
837}
Note: See TracBrowser for help on using the repository browser.