Changeset 5425


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

moved initsystem code to odininst

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/KERNEL32.DEF

    r5386 r5425  
    1 ; $Id: KERNEL32.DEF,v 1.99 2001-03-27 16:18:26 sandervl Exp $
     1; $Id: KERNEL32.DEF,v 1.100 2001-04-01 14:33:49 sandervl Exp $
    22
    33;Basis is Windows95 KERNEL32
     
    11451145    _GetCPUFeatures                                               @2004 NONAME
    11461146    CPUFeatures                                                   @2005 NONAME
    1147     InitSystemAndRegistry__Fv                                     @2006 NONAME
    11481147
    11491148    _InitializeTIB@4                                              @2010 NONAME
  • trunk/src/kernel32/initsystem.cpp

    r4964 r5425  
    1 /* $Id: initsystem.cpp,v 1.26 2001-01-18 18:14:16 sandervl Exp $ */
     1/* $Id: initsystem.cpp,v 1.27 2001-04-01 14:33:50 sandervl Exp $ */
    22/*
    33 * Odin system initialization (registry, directories & environment)
     
    55 * Called from the WarpIn install program to create the desktop directories and
    66 * to setup the registry
    7  *
    8  * InitSystemAndRegistry creates:
    9  *      - SYSTEMDIR\drivers
    10  *      - SYSTEMDIR\drivers\etc
    11  *  - WINDOWSDIR\SYSTEM
    12  *      - WINDOWSDIR\AppData
    13  *      - WINDOWSDIR\Cache
    14  *      - WINDOWSDIR\Cookies
    15  *  - WINDOWSDIR\Desktop
    16  *  - WINDOWSDIR\Favorites
    17  *  - WINDOWSDIR\Fonts
    18  *      - WINDOWSDIR\History
    19  *  - WINDOWSDIR\NetHood
    20  *  - WINDOWSDIR\My Documents
    21  *  - WINDOWSDIR\PrintHood
    22  *  - WINDOWSDIR\Recent
    23  *  - WINDOWSDIR\SendTo
    24  *  - WINDOWSDIR\Start Menu
    25  *  - WINDOWSDIR\Start Menu\Programs
    26  *  - WINDOWSDIR\Start Menu\Programs\Startup
    27  *  - WINDOWSDIR\ShellNew
    28  *      - x:\Program Files
    29  *      - x:\Program Files\Common Files
    30  *  - and a minimal system registry
    317 *
    328 * Copyright 1999-2000 Sander van Leeuwen (sandervl@xs4all.nl)
     
    5329#include "dbglocal.h"
    5430
    55 #define DDRAW_CLASSID       "{D7B70EE0-4340-11CF-B063-0020AFC2CD35}"
    56 #define DDRAW_DEFAULT       "DirectDraw Object"
    57 #define DDRAW_CLIPPER_CLASSID   "{593817A0-7DB3-11CF-A2DE-00AA00B93356}"
    58 #define DDRAW_CLIPPER_DEFAULT   "DirectDraw Clipper Object"
    59 #define DDRAW_DLL       "ddraw.dll"
    60 #define DSOUND_CLASSID      "{47D4D946-62E8-11cf-93BC-444553540000}"
    61 #define DSOUND_DEFAULT      "DirectSound Object"
    62 #define DSOUND_DLL      "dsound.dll"
    63 #define DPLAYX_CLASSID          "{D1EB6D20-8923-11d0-9D97-00A0C90A43CB}"
    64 #define DPLAYX_DEFAULT          "DirectPlay Object"
    65 #define DPLAYX_DLL              "dplayx.dll"
    66 #define DPLAYX_LOBBY_CLASSID    "{2FE8F810-B2A5-11d0-A787-0000F803ABFC}"
    67 #define DPLAYX_LOBBY_DEFAULT    "DirectPlayLobby Object"
    68 #define DPLAYX_LOBBY_DLL        DPLAYX_DLL
    69 
    70 #define CLASS_DESKTOP       "Desktop"
    71 #define CLASS_SHORTCUT          "Shortcut"
    72 #define CLASS_SHELL32DLL    "shell32.dll"
    73 #define CLASS_SHDOCVW       "shdocvw.dll"
    74 #define COM_CLASS_ID        "CLSID"
    75 #define COM_INPROCSERVER        "InprocServer32"
    76 #define COM_THREADMODEL     "ThreadingModel"
    77 #define COM_THREAD_APARTMENT    "Apartment"
    78 #define THREAD_BOTH     "Both"
    79 #define INITREG_ERROR       "InitRegistry: Unable to register system information"
    80 #define DIR_PROGRAM             "ProgramFilesDir"
    81 #define DIR_PROGRAM_COMMON  "CommonFilesDir"
    82 #define DIR_SHARED              "SharedDir"
    83 #define HARDWARE_VIDEO_GRADD    "\\REGISTRY\\Machine\\System\\CurrentControlSet\\Services\\Gradd\\Device0"
    84 #define HARDWARE_VIDEO_GRADD_DESCRIPTION "OS/2 Display driver"
    85 #define HARDWARE_VIDEO_VGA      "\\REGISTRY\\Machine\\System\\CurrentControlSet\\Services\\VgaSave\\Device0"
    86 #define HARDWARE_VIDEO_VGA_DESCRIPTION   "OS/2 VGA Display driver"
    87 #define HARDWARE_VIDEO_COMPATIBLE "\\Device\\Video1"
    88 #define DIRECTX_RC              "0"
    89 #define DIRECTX_VERSION         "4.04.1381.276"
    90 #define DIRECTX_INSTALLED_VERSION 0x0004
    91 #define ODIN_WINMM_PLAYBACK     "OS/2 Dart Audio Playback"
    92 #define ODIN_WINMM_RECORD   "OS/2 Dart Audio Record"
    93 
    94 #define KEY_DEVICE_TYPE     "Type"
    95 #define KEY_DEVICE_START    "Start"
    96 #define KEY_DEVICE_GROUP        "Group"
    97 #define KEY_DEVICE_ERRORCONTROL "ErrorControl"
    98 #define KEY_DEVICE_AUTORUN      "Autorun"
    99 #define KEY_DEVICE_TAG          "Tag"
    100 #define DEVICE_GROUP_FILESYSTEM "File system"
    101 #define DEVICE_GROUP_SCSICDROM  "SCSI CDROM Class"
    102 
    103 const char szMci[] = "mci";
    104 const char szCDAudio[] = "cdaudio";
    105 const char szMciCDA[] = "mcicda.drv";
    10631
    10732//******************************************************************************
    108 //******************************************************************************
    109 //******************************************************************************
    110 //[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows]
    111 //"Directory"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,00
    112 //"SystemDirectory"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,\
    113 //  6d,33,32,00
    114 //"ErrorMode"=dword:00000000
    115 //"NoInteractiveServices"=dword:00000000
    116 //"CSDVersion"=dword:00000300
    117 BYTE ShutdownTime[] = {0x44,0x5e,0xf2,0xbb,0x84,0x41,0xbf,0x01};
    118 //******************************************************************************
    119 BOOL InitSystemAndRegistry()
    120 {
    121  HKEY hkey, hkey1;
    122  char *buf;
    123  DWORD val;
    124  char  digbuf[16];
    125  char  shellpath[260];
    126 
    127     if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Windows",&hkey)!=ERROR_SUCCESS) {
    128         dprintf(("InitRegistry: Unable to register system information\n"));
    129         return FALSE;
    130     }
    131     buf = InternalGetWindowsDirectoryA();
    132     RegSetValueExA(hkey,"Directory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
    133     buf = InternalGetSystemDirectoryA();
    134     RegSetValueExA(hkey,"SystemDirectory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
    135     val = 0;
    136     RegSetValueExA(hkey,"ErrorMode",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    137     val = 0;
    138     RegSetValueExA(hkey,"NoInteractiveServices",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    139     val = ODINNT_BUILD_NR;
    140     RegSetValueExA(hkey,"CSDVersion",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    141     RegSetValueExA(hkey,"ShutdownTime",0,REG_DWORD, (LPBYTE)ShutdownTime, sizeof(ShutdownTime));
    142     RegCloseKey(hkey);
    143 
    144     //Software\Microsoft\Windows\CurrentVersion\RunOnce
    145     if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce",&hkey)!=ERROR_SUCCESS) {
    146         dprintf(("InitRegistry: Unable to register system information (2)"));
    147         return FALSE;
    148     }
    149     RegCloseKey(hkey);
    150 
    151     //System\CurrentControlSet\Control\Session Manager
    152     if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\Session Manager",&hkey)!=ERROR_SUCCESS) {
    153         dprintf(("InitRegistry: Unable to register system information (2)"));
    154         return FALSE;
    155     }
    156     RegCloseKey(hkey);
    157 
    158     if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\iexplore.exe",&hkey)!=ERROR_SUCCESS) {
    159         dprintf(("InitRegistry: Unable to register system information (2)"));
    160         return FALSE;
    161     }
    162     strcpy(shellpath, InternalGetWindowsDirectoryA());
    163     strcat(shellpath, "\\IEXPLORE.EXE");
    164     RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    165     RegCloseKey(hkey);
    166 
    167 
    168     if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
    169         dprintf(("InitRegistry: Unable to register system information (2)"));
    170         return FALSE;
    171     }
    172     buf = InternalGetSystemDirectoryA();
    173     RegSetValueExA(hkey,"SystemRoot",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
    174     RegSetValueExA(hkey,"PathName",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
    175     sprintf(digbuf, "%d", ODINNT_BUILD_NR);
    176     RegSetValueExA(hkey,"CurrentBuildNumber",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
    177     RegSetValueExA(hkey,"CurrentType",0,REG_SZ, (LPBYTE)ODINNT_OSTYPE_UNI, sizeof(ODINNT_OSTYPE_UNI));
    178     RegSetValueExA(hkey,"CSDVersion",0,REG_SZ, (LPBYTE)ODINNT_CSDVERSION, sizeof(ODINNT_CSDVERSION));
    179     RegSetValueExA(hkey,"SoftwareType",0,REG_SZ, (LPBYTE)ODINNT_SOFTWARE_TYPE, sizeof(ODINNT_SOFTWARE_TYPE));
    180 
    181     sprintf(digbuf, "%d.%d", ODINNT_MAJOR_VERSION, ODINNT_MINOR_VERSION);
    182     RegSetValueExA(hkey,"CurrentVersion",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
    183 
    184     val = (DWORD)time(NULL); //todo: Correct format???
    185     RegSetValueExA(hkey,"InstallDate",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    186 
    187     RegCloseKey(hkey);
    188     //todo: productid, registered org/owner, sourcepath,
    189 
    190     //Create Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders keys
    191     //"Favorites"="C:\WINDOWS\Favorites"
    192     //"StartUp"="C:\WINDOWS\Start Menu\Programs\Startup"
    193     //"Desktop"="C:\WINDOWS\Desktop"
    194     //"Programs"="C:\WINDOWS\Start Menu\Programs"
    195     //"Fonts"="C:\WINDOWS\Fonts"
    196     //"SendTo"="C:\WINDOWS\SendTo"
    197     //"Start Menu"="C:\WINDOWS\Start Menu"
    198     //"Templates"="C:\WINDOWS\ShellNew"
    199     //"Recent"="C:\WINDOWS\Recent"
    200     //"NetHood"="C:\WINDOWS\NetHood"
    201     //"Personal"="C:\My Documents"
    202 
    203    if(RegCreateKeyA(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",&hkey)!=ERROR_SUCCESS) {
    204     dprintf(("InitRegistry: Unable to register system information (3)"));
    205     return FALSE;
    206    }
    207 //   if(RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey) != ERROR_SUCCESS)
    208 //   {
    209         //system32\drivers dir
    210     strcpy(shellpath, InternalGetSystemDirectoryA());
    211     strcat(shellpath, "\\Drivers");
    212     CreateDirectoryA(shellpath, NULL);
    213     strcat(shellpath, "\\etc");
    214     CreateDirectoryA(shellpath, NULL);
    215 
    216     //SYSTEM dir
    217     strcpy(shellpath, InternalGetWindowsDirectoryA());
    218     strcat(shellpath, "\\SYSTEM");
    219     CreateDirectoryA(shellpath, NULL);
    220 
    221     //AppData
    222     strcpy(shellpath, InternalGetWindowsDirectoryA());
    223     strcat(shellpath, "\\Application Data");
    224     CreateDirectoryA(shellpath, NULL);
    225     RegSetValueExA(hkey,"AppData",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    226     //Cache
    227     strcpy(shellpath, InternalGetWindowsDirectoryA());
    228     strcat(shellpath, "\\Temporary Internet Files");
    229     CreateDirectoryA(shellpath, NULL);
    230     RegSetValueExA(hkey,"Cache",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    231     //Cookies
    232     strcpy(shellpath, InternalGetWindowsDirectoryA());
    233     strcat(shellpath, "\\Cookies");
    234     CreateDirectoryA(shellpath, NULL);
    235     RegSetValueExA(hkey,"Cookies",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    236     //Desktop
    237     strcpy(shellpath, InternalGetWindowsDirectoryA());
    238     strcat(shellpath, "\\Desktop");
    239     CreateDirectoryA(shellpath, NULL);
    240     RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    241     //Favorites
    242     strcpy(shellpath, InternalGetWindowsDirectoryA());
    243     strcat(shellpath, "\\Favorites");
    244     CreateDirectoryA(shellpath, NULL);
    245     RegSetValueExA(hkey,"Favorites",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    246     //Fonts
    247     strcpy(shellpath, InternalGetWindowsDirectoryA());
    248     strcat(shellpath, "\\Fonts");
    249     CreateDirectoryA(shellpath, NULL);
    250     RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    251     //History
    252     strcpy(shellpath, InternalGetWindowsDirectoryA());
    253     strcat(shellpath, "\\History");
    254     CreateDirectoryA(shellpath, NULL);
    255     RegSetValueExA(hkey,"History",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    256     //NetHood
    257     strcpy(shellpath, InternalGetWindowsDirectoryA());
    258     strcat(shellpath, "\\NetHood");
    259     CreateDirectoryA(shellpath, NULL);
    260     RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    261     //Personal
    262     strcpy(shellpath, InternalGetWindowsDirectoryA());
    263     strcat(shellpath, "\\My Documents");
    264     CreateDirectoryA(shellpath, NULL);
    265     RegSetValueExA(hkey,"Personal",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    266     //PrintHood
    267     strcpy(shellpath, InternalGetWindowsDirectoryA());
    268     strcat(shellpath, "\\PrintHood");
    269     CreateDirectoryA(shellpath, NULL);
    270     RegSetValueExA(hkey,"PrintHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    271     //Recent
    272     strcpy(shellpath, InternalGetWindowsDirectoryA());
    273     strcat(shellpath, "\\Recent");
    274     CreateDirectoryA(shellpath, NULL);
    275     RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    276     //SendTo
    277     strcpy(shellpath, InternalGetWindowsDirectoryA());
    278     strcat(shellpath, "\\SendTo");
    279     CreateDirectoryA(shellpath, NULL);
    280     RegSetValueExA(hkey,"SendTo",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    281     //Start Menu
    282     strcpy(shellpath, InternalGetWindowsDirectoryA());
    283     strcat(shellpath, "\\Start Menu");
    284     CreateDirectoryA(shellpath, NULL);
    285     RegSetValueExA(hkey,"Start Menu",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    286     //Programs
    287     strcpy(shellpath, InternalGetWindowsDirectoryA());
    288     strcat(shellpath, "\\Start Menu\\Programs");
    289     CreateDirectoryA(shellpath, NULL);
    290     RegSetValueExA(hkey,"Programs",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    291     //Startup
    292     strcat(shellpath, "\\Startup");
    293     CreateDirectoryA(shellpath, NULL);
    294     RegSetValueExA(hkey,"Startup",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    295     //ShellNew
    296     strcpy(shellpath, InternalGetWindowsDirectoryA());
    297     strcat(shellpath, "\\ShellNew");
    298     CreateDirectoryA(shellpath, NULL);
    299     RegSetValueExA(hkey,"Templates",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    300 //   }
    301    RegCloseKey(hkey);
    302 
    303    //Shell32 & IE related keys
    304    //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021400-0000-0000-C000-000000000046}]
    305    //@="Desktop"
    306    //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021400-0000-0000-C000-000000000046}\InProcServer32]
    307    //@="shell32.dll"
    308    //ThreadingModel="Apartment"
    309    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
    310     goto initreg_error;
    311    }
    312    RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_DESKTOP, sizeof(CLASS_DESKTOP));
    313    RegCloseKey(hkey);
    314    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
    315     goto initreg_error;
    316    }
    317    RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL));
    318    RegSetValueExA(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
    319    RegCloseKey(hkey);
    320    //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}]
    321    //@="Shortcut"
    322    //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}\InProcServer32]
    323    //@="shell32.dll"
    324    //"ThreadingModel"="Apartment"
    325    //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{00021401-0000-0000-C000-000000000046}\shellex\MayChangeDefaultMenu]
    326    //@=""
    327    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
    328     goto initreg_error;
    329    }
    330    RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHORTCUT, sizeof(CLASS_SHORTCUT));
    331    RegCloseKey(hkey);
    332    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
    333     goto initreg_error;
    334    }
    335    RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL));
    336    RegSetValueExA(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
    337    RegCloseKey(hkey);
    338    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\shellex\\MayChangeDefaultMenu",&hkey)!=ERROR_SUCCESS) {
    339     goto initreg_error;
    340    }
    341    RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)"", 0);
    342    RegCloseKey(hkey);
    343 
    344    //# Entries for IWebBrowser
    345    //# Used by Internet Explorer HTML-rendering control
    346    //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}]
    347    //@="Shortcut"
    348    //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\InProcServer32]
    349    //@="shdocvw.dll"
    350    //"ThreadingModel"="Apartment"
    351    //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\shellex\MayChangeDefaultMenu]
    352    //@=""
    353 
    354    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}",&hkey)!=ERROR_SUCCESS) {
    355     goto initreg_error;
    356    }
    357    RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHORTCUT, sizeof(CLASS_SHORTCUT));
    358    RegCloseKey(hkey);
    359 
    360    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
    361     goto initreg_error;
    362    }
    363    RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHDOCVW, sizeof(CLASS_SHDOCVW));
    364    RegSetValueExA(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
    365    RegCloseKey(hkey);
    366 
    367    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}\\shellex\\MayChangeDefaultMenu",&hkey)!=ERROR_SUCCESS) {
    368     goto initreg_error;
    369    }
    370    RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)"", 1);
    371    RegCloseKey(hkey);
    372 
    373    //Now the Ddraw & dsound registry keys:
    374    //HKEY_CLASSES_ROOT\DirectDraw = DirectDraw Object
    375    //HKEY_CLASSES_ROOT\DirectDraw\CLSID = {D7B70EE0-4340-11CF-B063-0020AFC2CD35}
    376    //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35} = DirectDraw Object
    377    //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35}\InprocServer32 = ddraw.dll
    378    if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectDraw",&hkey)!=ERROR_SUCCESS) {
    379     goto initreg_error;
    380    }
    381    RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
    382    if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
    383     RegCloseKey(hkey);
    384     goto initreg_error;
    385    }
    386    RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLASSID, sizeof(DDRAW_CLASSID));
    387    RegCloseKey(hkey1);
    388    RegCloseKey(hkey);
    389 
    390    if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLASSID ,&hkey)!=ERROR_SUCCESS) {
    391     goto initreg_error;
    392    }
    393    RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
    394    if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
    395     RegCloseKey(hkey);
    396     goto initreg_error;
    397    }
    398    RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
    399    RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
    400    RegCloseKey(hkey1);
    401    RegCloseKey(hkey);
    402 
    403    //HKEY_CLASSES_ROOT\DirectDrawClipper = DirectDraw Clipper Object
    404    //HKEY_CLASSES_ROOT\DirectDrawClipper\CLSID = {593817A0-7DB3-11CF-A2DE-00AA00B93356}
    405    //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356} = DirectDraw Clipper Object
    406    //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356}\InprocServer32 = ddraw.dll
    407    if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectDrawClipper",&hkey)!=ERROR_SUCCESS) {
    408     goto initreg_error;
    409    }
    410    RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
    411    if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
    412     RegCloseKey(hkey);
    413     goto initreg_error;
    414    }
    415    RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_CLASSID, sizeof(DDRAW_CLIPPER_CLASSID));
    416    RegCloseKey(hkey1);
    417    RegCloseKey(hkey);
    418 
    419    if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLIPPER_CLASSID,&hkey)!=ERROR_SUCCESS) {
    420     goto initreg_error;
    421    }
    422    RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
    423    if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
    424     RegCloseKey(hkey);
    425     goto initreg_error;
    426    }
    427    RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
    428    RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
    429    RegCloseKey(hkey1);
    430    RegCloseKey(hkey);
    431 
    432    //HKEY_CLASSES_ROOT\DirectSound = DirectSound Object
    433    //HKEY_CLASSES_ROOT\DirectSound\CLSID = {47D4D946-62E8-11cf-93BC-444553540000}
    434    //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000} = DirectSound Object
    435    //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000}\InprocServer32 = dsound.dll
    436    if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectSound",&hkey)!=ERROR_SUCCESS) {
    437     goto initreg_error;
    438    }
    439    RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
    440    if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
    441     RegCloseKey(hkey);
    442     goto initreg_error;
    443    }
    444    RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_CLASSID, sizeof(DSOUND_CLASSID));
    445    RegCloseKey(hkey1);
    446    RegCloseKey(hkey);
    447 
    448    if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DSOUND_CLASSID ,&hkey)!=ERROR_SUCCESS) {
    449     goto initreg_error;
    450    }
    451    RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
    452    if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
    453     RegCloseKey(hkey);
    454     goto initreg_error;
    455    }
    456    RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_DLL, sizeof(DSOUND_DLL));
    457    RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
    458    RegCloseKey(hkey1);
    459    RegCloseKey(hkey);
    460 
    461    //DirectPlay
    462    if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_CLASSID ,&hkey)!=ERROR_SUCCESS) {
    463     goto initreg_error;
    464    }
    465    RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_DEFAULT, sizeof(DPLAYX_DEFAULT));
    466    if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
    467     RegCloseKey(hkey);
    468     goto initreg_error;
    469    }
    470    RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_DLL, sizeof(DPLAYX_DLL));
    471    RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
    472    RegCloseKey(hkey1);
    473    RegCloseKey(hkey);
    474 
    475    //DirectPlay Lobby
    476    if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_LOBBY_CLASSID ,&hkey)!=ERROR_SUCCESS) {
    477     goto initreg_error;
    478    }
    479    RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DEFAULT, sizeof(DPLAYX_LOBBY_DEFAULT));
    480    if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
    481     RegCloseKey(hkey);
    482     goto initreg_error;
    483    }
    484    RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DLL, sizeof(DPLAYX_LOBBY_DLL));
    485    RegSetValueExA(hkey1, COM_THREADMODEL, 0,REG_SZ, (LPBYTE)THREAD_BOTH, sizeof(THREAD_BOTH));
    486    RegCloseKey(hkey1);
    487    RegCloseKey(hkey);
    488 
    489    //[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion]
    490    //"ProgramFilesDir"="C:\Program Files"
    491    //"CommonFilesDir"="C:\Program Files\Common Files"
    492    //# This is intended for a centrally managed (server) directory where system files and e.g. fonts can reside. Most installs have this set to C:\WINDOWS, though.
    493    //"SharedDir"="C:\WINDOWS"
    494    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
    495     goto initreg_error;
    496    }
    497    //Create x:\Program Files directory
    498    strcpy(shellpath, InternalGetWindowsDirectoryA());
    499    shellpath[2] = 0;    //get drive
    500    strcat(shellpath, "\\Program Files");
    501    CreateDirectoryA(shellpath, NULL);
    502    RegSetValueExA(hkey, DIR_PROGRAM, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    503 
    504    //Create x:\Program Files\Common Files directory
    505    strcat(shellpath, "\\Common Files");
    506    CreateDirectoryA(shellpath, NULL);
    507    RegSetValueExA(hkey, DIR_PROGRAM_COMMON, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    508 
    509    strcpy(shellpath, InternalGetWindowsDirectoryA());
    510    RegSetValueExA(hkey, DIR_SHARED, 0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    511 
    512    RegCloseKey(hkey);
    513 
    514    //[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\VIDEO]
    515    //"\\Device\\Video0"="\\REGISTRY\\Machine\\System\\ControlSet001\\Services\\mga64\\Device0"
    516    //"\\Device\\Video1"="\\REGISTRY\\Machine\\System\\ControlSet001\\Services\\VgaSave\\Device0"
    517    //"VgaCompatible"="\\Device\\Video1"
    518    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\VIDEO",&hkey)!=ERROR_SUCCESS) {
    519     goto initreg_error;
    520    }
    521    RegSetValueExA(hkey,"\\Device\\Video0",0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD, sizeof(HARDWARE_VIDEO_GRADD));
    522    RegSetValueExA(hkey,"\\Device\\Video1",0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_VGA, sizeof(HARDWARE_VIDEO_VGA));
    523    RegSetValueExA(hkey, "VgaCompatible", 0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_COMPATIBLE, sizeof(HARDWARE_VIDEO_COMPATIBLE));
    524    RegCloseKey(hkey);
    525 
    526    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Gradd\\Device0",&hkey)!=ERROR_SUCCESS) {
    527     goto initreg_error;
    528    }
    529    RegSetValueExA(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD_DESCRIPTION, sizeof(HARDWARE_VIDEO_GRADD_DESCRIPTION));
    530    RegCloseKey(hkey);
    531 
    532    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\VgaSave\\Device0",&hkey)!=ERROR_SUCCESS) {
    533     goto initreg_error;
    534    }
    535    RegSetValueExA(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_VGA_DESCRIPTION, sizeof(HARDWARE_VIDEO_VGA_DESCRIPTION));
    536    RegCloseKey(hkey);
    537 
    538    //Software\Microsoft\Multimedia\Sound Mapper
    539    if(RegCreateKeyA(HKEY_CURRENT_USER,"Software\\Microsoft\\Multimedia\\Sound Mapper",&hkey)!=ERROR_SUCCESS) {
    540     goto initreg_error;
    541    }
    542    RegSetValueExA(hkey,"Playback", 0, REG_SZ, (LPBYTE)ODIN_WINMM_PLAYBACK, sizeof(ODIN_WINMM_PLAYBACK));
    543    RegSetValueExA(hkey,"Record", 0, REG_SZ, (LPBYTE)ODIN_WINMM_RECORD, sizeof(ODIN_WINMM_RECORD));
    544    RegCloseKey(hkey);
    545 
    546    //Software\Microsoft\DirectX
    547    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectX",&hkey)!=ERROR_SUCCESS) {
    548     goto initreg_error;
    549    }
    550    RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)"", 0);
    551    RegSetValueExA(hkey, "RC", 0,REG_SZ, (LPBYTE)DIRECTX_RC, sizeof(DIRECTX_RC));
    552    RegSetValueExA(hkey, "Version", 0,REG_SZ, (LPBYTE)DIRECTX_VERSION, sizeof(DIRECTX_VERSION));
    553    val = DIRECTX_INSTALLED_VERSION;
    554    RegSetValueExA(hkey, "InstalledVersion", 0,REG_BINARY, (LPBYTE)&val, sizeof(DWORD));
    555    RegCloseKey(hkey);
    556 
    557    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectDraw",&hkey)!=ERROR_SUCCESS) {
    558     goto initreg_error;
    559    }
    560    //todo
    561    RegCloseKey(hkey);
    562 
    563    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Direct3D",&hkey)!=ERROR_SUCCESS) {
    564     goto initreg_error;
    565    }
    566    //todo
    567    RegCloseKey(hkey);
    568 
    569    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectPlay",&hkey)!=ERROR_SUCCESS) {
    570     goto initreg_error;
    571    }
    572    //todo
    573    RegCloseKey(hkey);
    574 
    575 #if 0
    576    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectMusic",&hkey)!=ERROR_SUCCESS) {
    577     goto initreg_error;
    578    }
    579    //todo
    580    RegCloseKey(hkey);
    581 #endif
    582 
    583 // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs]
    584 // "Type"=dword:00000002
    585 // "Start"=dword:00000004
    586 // "Group"="File system"
    587 // "ErrorControl"=dword:00000001
    588 // "DependOnGroup"=hex(7):53,43,53,49,20,43,44,52,4f,4d,20,43,6c,61,73,73,00,00
    589 
    590    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdfs",&hkey)!=ERROR_SUCCESS) {
    591     goto initreg_error;
    592    }
    593    val = 0x2;
    594    RegSetValueExA(hkey, KEY_DEVICE_TYPE,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    595    val = 0x4;
    596    RegSetValueExA(hkey, KEY_DEVICE_START,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    597    val = 0x1;
    598    RegSetValueExA(hkey, KEY_DEVICE_ERRORCONTROL,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    599    RegSetValueExA(hkey, KEY_DEVICE_GROUP,0,REG_SZ, (LPBYTE)DEVICE_GROUP_FILESYSTEM, sizeof(DEVICE_GROUP_FILESYSTEM));
    600    //todo dependongroup
    601    RegCloseKey(hkey);
    602 
    603 
    604 /*
    605 // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs\Enum]
    606 // "0"="Root\\LEGACY_CDFS\\0000"
    607 // "Count"=dword:00000001
    608 // "NextInstance"=dword:00000001
    609 */
    610 // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom]
    611 // "Type"=dword:00000001
    612 // "Start"=dword:00000001
    613 // "Group"="SCSI CDROM Class"
    614 // "ErrorControl"=dword:00000000
    615 // "Tag"=dword:00000002
    616 // "DependOnGroup"=hex(7):53,43,53,49,20,6d,69,6e,69,70,6f,72,74,00,00
    617 // "Autorun"=dword:00000001
    618 
    619    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdrom",&hkey)!=ERROR_SUCCESS) {
    620     goto initreg_error;
    621    }
    622    val = 0x1;
    623    RegSetValueExA(hkey, KEY_DEVICE_TYPE,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    624    val = 0x1;
    625    RegSetValueExA(hkey, KEY_DEVICE_START,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    626    val = 0x0;
    627    RegSetValueExA(hkey, KEY_DEVICE_ERRORCONTROL,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    628    val = 0x2;
    629    RegSetValueExA(hkey, KEY_DEVICE_TAG,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    630    val = 0x0;
    631    RegSetValueExA(hkey, KEY_DEVICE_AUTORUN,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    632    RegSetValueExA(hkey, KEY_DEVICE_GROUP,0,REG_SZ, (LPBYTE)DEVICE_GROUP_SCSICDROM, sizeof(DEVICE_GROUP_SCSICDROM));
    633    //todo dependongroup
    634    RegCloseKey(hkey);
    635 
    636 /*
    637 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom\Enum]
    638 "0"="Root\\LEGACY_CDROM\\0000"
    639 "Count"=dword:00000001
    640 "NextInstance"=dword:00000001
    641 */
    642 
    643    //[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\FileSystem]
    644    //"Win31FileSystem"=dword:00000000
    645    //"NtfsDisable8dot3NameCreation"=dword:00000000
    646    //"Win95TruncatedExtensions"=dword:00000001
    647    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\FileSystem",&hkey)!=ERROR_SUCCESS) {
    648     goto initreg_error;
    649    }
    650    val = 0x0;
    651    RegSetValueExA(hkey, "Win31FileSystem",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    652    val = 0x0;
    653    RegSetValueExA(hkey, "NtfsDisable8dot3NameCreation",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    654    val = 0x1;
    655    RegSetValueExA(hkey, "Win95TruncatedExtensions",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    656    RegCloseKey(hkey);
    657 
    658 
    659 //[HKEY_LOCAL_MACHINE\Software\Microsoft\OLE]
    660 //# allow cross-machine calls (RPC) (default Y)
    661 //"EnableDCOM"="Y"
    662 //# allow incoming connections ? (def. N)
    663 //"EnableRemoteConnect"="N"
    664    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\OLE",&hkey)!=ERROR_SUCCESS) {
    665     goto initreg_error;
    666    }
    667    digbuf[0] = 'Y';
    668    digbuf[1] = 0;
    669    RegSetValueExA(hkey, "EnableDCOM",0,REG_SZ, (LPBYTE)digbuf, 2);
    670    digbuf[0] = 'N';
    671    digbuf[1] = 0;
    672    RegSetValueExA(hkey, "EnableRemoteConnect",0,REG_SZ, (LPBYTE)digbuf, 2);
    673    RegCloseKey(hkey);
    674 
    675    //Add MS Sans Serif to WarpSans font conversion entry
    676    char temp;
    677    if(PROFILE_GetOdinIniString(ODINFONTSECTION, "MS Sans Serif", "", &temp,
    678                                0) <= 1)
    679    {
    680        PROFILE_SetOdinIniString(ODINFONTSECTION, "MS Sans Serif", "WarpSans");
    681    }
    682    //Create system.ini with [mci] section
    683    strcpy(shellpath, InternalGetWindowsDirectoryA());
    684    strcat(shellpath, "\\system.ini");
    685    
    686    if(GetPrivateProfileStringA(szMci, szCDAudio, szMciCDA, &temp, 0, shellpath) <= 1) {
    687       WritePrivateProfileStringA(szMci, szCDAudio, szMciCDA, shellpath);
    688    }
    689    return TRUE;
    690 
    691 initreg_error:
    692    dprintf((INITREG_ERROR));
    693    return FALSE;
    694 }
    69533//******************************************************************************
    69634//Environment variables created by Windows NT:
  • trunk/tools/install/makefile

    r4736 r5425  
    1 # $Id: makefile,v 1.6 2000-12-03 08:13:39 bird Exp $
     1# $Id: makefile,v 1.7 2001-04-01 14:34:19 sandervl Exp $
    22
    33#
     
    1111# Tell that we're producing an executable.
    1212#
     13USERAPP = 1
    1314EXETARGET = 1
    1415VIO = 1
     
    3738os2386.lib \
    3839$(RTLLIB) \
     40$(ODIN32_LIB)\advapi32.lib \
     41$(ODIN32_LIB)\user32.lib \
    3942$(ODIN32_LIB)\kernel32.lib
    4043
  • 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.