Ignore:
Timestamp:
Apr 1, 2001, 4:34:19 PM (24 years ago)
Author:
sandervl
Message:

moved initsystem code to odininst

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/install/odininst.cpp

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