Ignore:
Timestamp:
Oct 21, 2000, 4:30:47 PM (25 years ago)
Author:
sandervl
Message:

registry api fixes + version keys added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/initsystem.cpp

    r4508 r4510  
    1 /* $Id: initsystem.cpp,v 1.20 2000-10-21 12:48:40 sandervl Exp $ */
     1/* $Id: initsystem.cpp,v 1.21 2000-10-21 14:30:46 sandervl Exp $ */
    22/*
    33 * Odin system initialization (registry, directories & environment)
    44 *
    5  * Called from the WarpIn install program to create the desktop directories and 
     5 * Called from the WarpIn install program to create the desktop directories and
    66 * to setup the registry
    77 *
    88 * InitSystemAndRegistry creates:
    99 *      - SYSTEMDIR\drivers
    10  *      - WINDOWSDIR\SYSTEM
     10 *  - WINDOWSDIR\SYSTEM
    1111 *      - WINDOWSDIR\AppData
    1212 *      - WINDOWSDIR\Cache
    1313 *      - WINDOWSDIR\Cookies
    14  *      - WINDOWSDIR\Desktop
    15  *      - WINDOWSDIR\Favorites
    16  *      - WINDOWSDIR\Fonts
     14 *  - WINDOWSDIR\Desktop
     15 *  - WINDOWSDIR\Favorites
     16 *  - WINDOWSDIR\Fonts
    1717 *      - WINDOWSDIR\History
    18  *      - WINDOWSDIR\NetHood
    19  *      - WINDOWSDIR\My Documents
    20  *      - WINDOWSDIR\PrintHood
    21  *      - WINDOWSDIR\Recent
    22  *      - WINDOWSDIR\SendTo
    23  *      - WINDOWSDIR\Start Menu
    24  *      - WINDOWSDIR\Start Menu\Programs
    25  *      - WINDOWSDIR\Start Menu\Programs\Startup
    26  *      - WINDOWSDIR\ShellNew
     18 *  - WINDOWSDIR\NetHood
     19 *  - WINDOWSDIR\My Documents
     20 *  - WINDOWSDIR\PrintHood
     21 *  - WINDOWSDIR\Recent
     22 *  - WINDOWSDIR\SendTo
     23 *  - WINDOWSDIR\Start Menu
     24 *  - WINDOWSDIR\Start Menu\Programs
     25 *  - WINDOWSDIR\Start Menu\Programs\Startup
     26 *  - WINDOWSDIR\ShellNew
    2727 *      - x:\Program Files
    2828 *      - x:\Program Files\Common Files
    29  *      - and a minimal system registry
     29 *  - and a minimal system registry
    3030 *
    3131 * Copyright 1999-2000 Sander van Leeuwen (sandervl@xs4all.nl)
     
    4848#include <versionos2.h>
    4949
    50 #define DBG_LOCALLOG    DBG_initsystem
     50#define DBG_LOCALLOG    DBG_initsystem
    5151#include "dbglocal.h"
    5252
    53 #define DDRAW_CLASSID           "{D7B70EE0-4340-11CF-B063-0020AFC2CD35}"
    54 #define DDRAW_DEFAULT           "DirectDraw Object"
    55 #define DDRAW_CLIPPER_CLASSID   "{593817A0-7DB3-11CF-A2DE-00AA00B93356}"
    56 #define DDRAW_CLIPPER_DEFAULT   "DirectDraw Clipper Object"
    57 #define DDRAW_DLL               "ddraw.dll"
    58 #define DSOUND_CLASSID          "{47D4D946-62E8-11cf-93BC-444553540000}"
    59 #define DSOUND_DEFAULT          "DirectSound Object"
    60 #define DSOUND_DLL              "dsound.dll"
     53#define DDRAW_CLASSID       "{D7B70EE0-4340-11CF-B063-0020AFC2CD35}"
     54#define DDRAW_DEFAULT       "DirectDraw Object"
     55#define DDRAW_CLIPPER_CLASSID   "{593817A0-7DB3-11CF-A2DE-00AA00B93356}"
     56#define DDRAW_CLIPPER_DEFAULT   "DirectDraw Clipper Object"
     57#define DDRAW_DLL       "ddraw.dll"
     58#define DSOUND_CLASSID      "{47D4D946-62E8-11cf-93BC-444553540000}"
     59#define DSOUND_DEFAULT      "DirectSound Object"
     60#define DSOUND_DLL      "dsound.dll"
    6161#define DPLAYX_CLASSID          "{D1EB6D20-8923-11d0-9D97-00A0C90A43CB}"
    6262#define DPLAYX_DEFAULT          "DirectPlay Object"
     
    6666#define DPLAYX_LOBBY_DLL        DPLAYX_DLL
    6767
    68 #define CLASS_DESKTOP           "Desktop"
     68#define CLASS_DESKTOP       "Desktop"
    6969#define CLASS_SHORTCUT          "Shortcut"
    70 #define CLASS_SHELL32DLL        "shell32.dll"
    71 #define COM_CLASS_ID            "CLSID"
     70#define CLASS_SHELL32DLL    "shell32.dll"
     71#define COM_CLASS_ID        "CLSID"
    7272#define COM_INPROCSERVER        "InprocServer32"
    73 #define COM_THREADMODEL         "ThreadingModel"
     73#define COM_THREADMODEL     "ThreadingModel"
    7474#define COM_THREAD_APARTMENT    "Apartment"
    75 #define THREAD_BOTH             "Both"
    76 #define INITREG_ERROR           "InitRegistry: Unable to register system information"
     75#define THREAD_BOTH     "Both"
     76#define INITREG_ERROR       "InitRegistry: Unable to register system information"
    7777#define DIR_PROGRAM             "ProgramFilesDir"
    78 #define DIR_PROGRAM_COMMON      "CommonFilesDir"
     78#define DIR_PROGRAM_COMMON  "CommonFilesDir"
    7979#define DIR_SHARED              "SharedDir"
    8080#define HARDWARE_VIDEO_GRADD    "\\REGISTRY\\Machine\\System\\CurrentControlSet\\Services\\Gradd\\Device0"
     
    8686#define DIRECTX_VERSION         "4.04.1381.276"
    8787#define DIRECTX_INSTALLED_VERSION 0x0004
    88 #define ODIN_WINMM_PLAYBACK     "OS/2 Dart Audio Playback"
    89 #define ODIN_WINMM_RECORD       "OS/2 Dart Audio Record"
    90 
    91 #define KEY_DEVICE_TYPE         "Type"
    92 #define KEY_DEVICE_START        "Start"
     88#define ODIN_WINMM_PLAYBACK     "OS/2 Dart Audio Playback"
     89#define ODIN_WINMM_RECORD   "OS/2 Dart Audio Record"
     90
     91#define KEY_DEVICE_TYPE     "Type"
     92#define KEY_DEVICE_START    "Start"
    9393#define KEY_DEVICE_GROUP        "Group"
    9494#define KEY_DEVICE_ERRORCONTROL "ErrorControl"
     
    118118 char  shellpath[260];
    119119
    120    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Windows",&hkey)!=ERROR_SUCCESS) {
    121         dprintf(("InitRegistry: Unable to register system information\n"));
    122         return FALSE;
    123    }
    124    buf = InternalGetWindowsDirectoryA();
    125    RegSetValueExA(hkey,"Directory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
    126    buf = InternalGetSystemDirectoryA();
    127    RegSetValueExA(hkey,"SystemDirectory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
    128    val = 0;
    129    RegSetValueExA(hkey,"ErrorMode",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    130    val = 0;
    131    RegSetValueExA(hkey,"NoInteractiveServices",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    132    val = ODINNT_BUILD_NR;
    133    RegSetValueExA(hkey,"CSDVersion",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    134    RegSetValueExA(hkey,"ShutdownTime",0,REG_DWORD, (LPBYTE)ShutdownTime, sizeof(ShutdownTime));
    135    RegCloseKey(hkey);
    136 
    137    //Software\Microsoft\Windows\CurrentVersion\RunOnce
    138    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce",&hkey)!=ERROR_SUCCESS) {
    139         dprintf(("InitRegistry: Unable to register system information (2)"));
    140         return FALSE;
    141    }
    142    RegCloseKey(hkey);
    143 
    144    //System\CurrentControlSet\Control\Session Manager
    145    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\Session Manager",&hkey)!=ERROR_SUCCESS) {
    146         dprintf(("InitRegistry: Unable to register system information (2)"));
    147         return FALSE;
    148    }
    149    RegCloseKey(hkey);
    150 
    151    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\iexplore.exe",&hkey)!=ERROR_SUCCESS) {
    152         dprintf(("InitRegistry: Unable to register system information (2)"));
    153         return FALSE;
    154    }
    155    strcpy(shellpath, InternalGetWindowsDirectoryA());
    156    strcat(shellpath, "\\IEXPLORE.EXE");
    157    RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    158    RegCloseKey(hkey);
    159 
    160 
    161    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
    162         dprintf(("InitRegistry: Unable to register system information (2)"));
    163         return FALSE;
    164    }
    165    buf = InternalGetSystemDirectoryA();
    166    RegSetValueExA(hkey,"SystemRoot",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
    167    RegSetValueExA(hkey,"PathName",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
    168    sprintf(digbuf, "%d", ODINNT_BUILD_NR);
    169    RegSetValueExA(hkey,"CurrentBuildNumber",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
    170    RegSetValueExA(hkey,"CurrentType",0,REG_SZ, (LPBYTE)ODINNT_OSTYPE_UNI, sizeof(ODINNT_OSTYPE_UNI));
    171    RegSetValueExA(hkey,"CSDVersion",0,REG_SZ, (LPBYTE)ODINNT_CSDVERSION, sizeof(ODINNT_CSDVERSION));
    172    RegSetValueExA(hkey,"SoftwareType",0,REG_SZ, (LPBYTE)ODINNT_SOFTWARE_TYPE, sizeof(ODINNT_SOFTWARE_TYPE));
    173 
    174    sprintf(digbuf, "%d.%d", ODINNT_MAJOR_VERSION, ODINNT_MINOR_VERSION);
    175    RegSetValueExA(hkey,"CurrentVersion",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
    176 
    177    val = (DWORD)time(NULL); //todo: Correct format???
    178    RegSetValueExA(hkey,"InstallDate",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
    179    
    180    RegCloseKey(hkey);
    181    //todo: productid, registered org/owner, sourcepath,   
    182 
    183    //Create Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders keys
    184    //"Favorites"="C:\WINDOWS\Favorites"
    185    //"StartUp"="C:\WINDOWS\Start Menu\Programs\Startup"
    186    //"Desktop"="C:\WINDOWS\Desktop"
    187    //"Programs"="C:\WINDOWS\Start Menu\Programs"
    188    //"Fonts"="C:\WINDOWS\Fonts"
    189    //"SendTo"="C:\WINDOWS\SendTo"
    190    //"Start Menu"="C:\WINDOWS\Start Menu"
    191    //"Templates"="C:\WINDOWS\ShellNew"
    192    //"Recent"="C:\WINDOWS\Recent"
    193    //"NetHood"="C:\WINDOWS\NetHood"
    194    //"Personal"="C:\My Documents"
     120    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Windows",&hkey)!=ERROR_SUCCESS) {
     121        dprintf(("InitRegistry: Unable to register system information\n"));
     122        return FALSE;
     123    }
     124    buf = InternalGetWindowsDirectoryA();
     125    RegSetValueExA(hkey,"Directory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
     126    buf = InternalGetSystemDirectoryA();
     127    RegSetValueExA(hkey,"SystemDirectory",0,REG_BINARY, (LPBYTE)buf, strlen(buf)+1);
     128    val = 0;
     129    RegSetValueExA(hkey,"ErrorMode",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     130    val = 0;
     131    RegSetValueExA(hkey,"NoInteractiveServices",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     132    val = ODINNT_BUILD_NR;
     133    RegSetValueExA(hkey,"CSDVersion",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     134    RegSetValueExA(hkey,"ShutdownTime",0,REG_DWORD, (LPBYTE)ShutdownTime, sizeof(ShutdownTime));
     135    RegCloseKey(hkey);
     136
     137    //Software\Microsoft\Windows\CurrentVersion\RunOnce
     138    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce",&hkey)!=ERROR_SUCCESS) {
     139        dprintf(("InitRegistry: Unable to register system information (2)"));
     140        return FALSE;
     141    }
     142    RegCloseKey(hkey);
     143
     144    //System\CurrentControlSet\Control\Session Manager
     145    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\Session Manager",&hkey)!=ERROR_SUCCESS) {
     146        dprintf(("InitRegistry: Unable to register system information (2)"));
     147        return FALSE;
     148    }
     149    RegCloseKey(hkey);
     150
     151    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\iexplore.exe",&hkey)!=ERROR_SUCCESS) {
     152        dprintf(("InitRegistry: Unable to register system information (2)"));
     153        return FALSE;
     154    }
     155    strcpy(shellpath, InternalGetWindowsDirectoryA());
     156    strcat(shellpath, "\\IEXPLORE.EXE");
     157    RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     158    RegCloseKey(hkey);
     159
     160
     161    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
     162        dprintf(("InitRegistry: Unable to register system information (2)"));
     163        return FALSE;
     164    }
     165    buf = InternalGetSystemDirectoryA();
     166    RegSetValueExA(hkey,"SystemRoot",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
     167    RegSetValueExA(hkey,"PathName",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
     168    sprintf(digbuf, "%d", ODINNT_BUILD_NR);
     169    RegSetValueExA(hkey,"CurrentBuildNumber",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
     170    RegSetValueExA(hkey,"CurrentType",0,REG_SZ, (LPBYTE)ODINNT_OSTYPE_UNI, sizeof(ODINNT_OSTYPE_UNI));
     171    RegSetValueExA(hkey,"CSDVersion",0,REG_SZ, (LPBYTE)ODINNT_CSDVERSION, sizeof(ODINNT_CSDVERSION));
     172    RegSetValueExA(hkey,"SoftwareType",0,REG_SZ, (LPBYTE)ODINNT_SOFTWARE_TYPE, sizeof(ODINNT_SOFTWARE_TYPE));
     173
     174    sprintf(digbuf, "%d.%d", ODINNT_MAJOR_VERSION, ODINNT_MINOR_VERSION);
     175    RegSetValueExA(hkey,"CurrentVersion",0,REG_SZ, (LPBYTE)digbuf, strlen(digbuf)+1);
     176
     177    val = (DWORD)time(NULL); //todo: Correct format???
     178    RegSetValueExA(hkey,"InstallDate",0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     179
     180    RegCloseKey(hkey);
     181    //todo: productid, registered org/owner, sourcepath,
     182
     183    //Create Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders keys
     184    //"Favorites"="C:\WINDOWS\Favorites"
     185    //"StartUp"="C:\WINDOWS\Start Menu\Programs\Startup"
     186    //"Desktop"="C:\WINDOWS\Desktop"
     187    //"Programs"="C:\WINDOWS\Start Menu\Programs"
     188    //"Fonts"="C:\WINDOWS\Fonts"
     189    //"SendTo"="C:\WINDOWS\SendTo"
     190    //"Start Menu"="C:\WINDOWS\Start Menu"
     191    //"Templates"="C:\WINDOWS\ShellNew"
     192    //"Recent"="C:\WINDOWS\Recent"
     193    //"NetHood"="C:\WINDOWS\NetHood"
     194    //"Personal"="C:\My Documents"
    195195
    196196   if(RegCreateKeyA(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",&hkey)!=ERROR_SUCCESS) {
    197         dprintf(("InitRegistry: Unable to register system information (3)"));
    198         return FALSE;
    199    }
    200 //   if(RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey) != ERROR_SUCCESS) 
     197    dprintf(("InitRegistry: Unable to register system information (3)"));
     198    return FALSE;
     199   }
     200//   if(RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey) != ERROR_SUCCESS)
    201201//   {
    202202        //system32\drivers dir
    203         strcpy(shellpath, InternalGetSystemDirectoryA());
    204         strcat(shellpath, "\\Drivers");
    205         CreateDirectoryA(shellpath, NULL);
    206 
    207         //SYSTEM dir
    208         strcpy(shellpath, InternalGetWindowsDirectoryA());
    209         strcat(shellpath, "\\SYSTEM");
    210         CreateDirectoryA(shellpath, NULL);
    211 
    212         //AppData
    213         strcpy(shellpath, InternalGetWindowsDirectoryA());
    214         strcat(shellpath, "\\Application Data");
    215         CreateDirectoryA(shellpath, NULL);
    216         RegSetValueExA(hkey,"AppData",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    217         //Cache
    218         strcpy(shellpath, InternalGetWindowsDirectoryA());
    219         strcat(shellpath, "\\Temporary Internet Files");
    220         CreateDirectoryA(shellpath, NULL);
    221         RegSetValueExA(hkey,"Cache",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    222         //Cookies
    223         strcpy(shellpath, InternalGetWindowsDirectoryA());
    224         strcat(shellpath, "\\Cookies");
    225         CreateDirectoryA(shellpath, NULL);
    226         RegSetValueExA(hkey,"Cookies",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    227         //Desktop
    228         strcpy(shellpath, InternalGetWindowsDirectoryA());
    229         strcat(shellpath, "\\Desktop");
    230         CreateDirectoryA(shellpath, NULL);
    231         RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    232         //Favorites
    233         strcpy(shellpath, InternalGetWindowsDirectoryA());
    234         strcat(shellpath, "\\Favorites");
    235         CreateDirectoryA(shellpath, NULL);
    236         RegSetValueExA(hkey,"Favorites",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    237         //Fonts
    238         strcpy(shellpath, InternalGetWindowsDirectoryA());
    239         strcat(shellpath, "\\Fonts");
    240         CreateDirectoryA(shellpath, NULL);
    241         RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    242         //History
    243         strcpy(shellpath, InternalGetWindowsDirectoryA());
    244         strcat(shellpath, "\\History");
    245         CreateDirectoryA(shellpath, NULL);
    246         RegSetValueExA(hkey,"History",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    247         //NetHood
    248         strcpy(shellpath, InternalGetWindowsDirectoryA());
    249         strcat(shellpath, "\\NetHood");
    250         CreateDirectoryA(shellpath, NULL);
    251         RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    252         //Personal
    253         strcpy(shellpath, InternalGetWindowsDirectoryA());
    254         strcat(shellpath, "\\My Documents");
    255         CreateDirectoryA(shellpath, NULL);
    256         RegSetValueExA(hkey,"Personal",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    257         //PrintHood
    258         strcpy(shellpath, InternalGetWindowsDirectoryA());
    259         strcat(shellpath, "\\PrintHood");
    260         CreateDirectoryA(shellpath, NULL);
    261         RegSetValueExA(hkey,"PrintHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    262         //Recent
    263         strcpy(shellpath, InternalGetWindowsDirectoryA());
    264         strcat(shellpath, "\\Recent");
    265         CreateDirectoryA(shellpath, NULL);
    266         RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    267         //SendTo
    268         strcpy(shellpath, InternalGetWindowsDirectoryA());
    269         strcat(shellpath, "\\SendTo");
    270         CreateDirectoryA(shellpath, NULL);
    271         RegSetValueExA(hkey,"SendTo",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    272         //Start Menu
    273         strcpy(shellpath, InternalGetWindowsDirectoryA());
    274         strcat(shellpath, "\\Start Menu");
    275         CreateDirectoryA(shellpath, NULL);
    276         RegSetValueExA(hkey,"Start Menu",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    277         //Programs
    278         strcpy(shellpath, InternalGetWindowsDirectoryA());
    279         strcat(shellpath, "\\Start Menu\\Programs");
    280         CreateDirectoryA(shellpath, NULL);
    281         RegSetValueExA(hkey,"Programs",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    282         //Startup
    283         strcat(shellpath, "\\Startup");
    284         CreateDirectoryA(shellpath, NULL);
    285         RegSetValueExA(hkey,"Startup",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    286         //ShellNew
    287         strcpy(shellpath, InternalGetWindowsDirectoryA());
    288         strcat(shellpath, "\\ShellNew");
    289         CreateDirectoryA(shellpath, NULL);
    290         RegSetValueExA(hkey,"Templates",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     203    strcpy(shellpath, InternalGetSystemDirectoryA());
     204    strcat(shellpath, "\\Drivers");
     205    CreateDirectoryA(shellpath, NULL);
     206
     207    //SYSTEM dir
     208    strcpy(shellpath, InternalGetWindowsDirectoryA());
     209    strcat(shellpath, "\\SYSTEM");
     210    CreateDirectoryA(shellpath, NULL);
     211
     212    //AppData
     213    strcpy(shellpath, InternalGetWindowsDirectoryA());
     214    strcat(shellpath, "\\Application Data");
     215    CreateDirectoryA(shellpath, NULL);
     216    RegSetValueExA(hkey,"AppData",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     217    //Cache
     218    strcpy(shellpath, InternalGetWindowsDirectoryA());
     219    strcat(shellpath, "\\Temporary Internet Files");
     220    CreateDirectoryA(shellpath, NULL);
     221    RegSetValueExA(hkey,"Cache",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     222    //Cookies
     223    strcpy(shellpath, InternalGetWindowsDirectoryA());
     224    strcat(shellpath, "\\Cookies");
     225    CreateDirectoryA(shellpath, NULL);
     226    RegSetValueExA(hkey,"Cookies",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     227    //Desktop
     228    strcpy(shellpath, InternalGetWindowsDirectoryA());
     229    strcat(shellpath, "\\Desktop");
     230    CreateDirectoryA(shellpath, NULL);
     231    RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     232    //Favorites
     233    strcpy(shellpath, InternalGetWindowsDirectoryA());
     234    strcat(shellpath, "\\Favorites");
     235    CreateDirectoryA(shellpath, NULL);
     236    RegSetValueExA(hkey,"Favorites",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     237    //Fonts
     238    strcpy(shellpath, InternalGetWindowsDirectoryA());
     239    strcat(shellpath, "\\Fonts");
     240    CreateDirectoryA(shellpath, NULL);
     241    RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     242    //History
     243    strcpy(shellpath, InternalGetWindowsDirectoryA());
     244    strcat(shellpath, "\\History");
     245    CreateDirectoryA(shellpath, NULL);
     246    RegSetValueExA(hkey,"History",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     247    //NetHood
     248    strcpy(shellpath, InternalGetWindowsDirectoryA());
     249    strcat(shellpath, "\\NetHood");
     250    CreateDirectoryA(shellpath, NULL);
     251    RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     252    //Personal
     253    strcpy(shellpath, InternalGetWindowsDirectoryA());
     254    strcat(shellpath, "\\My Documents");
     255    CreateDirectoryA(shellpath, NULL);
     256    RegSetValueExA(hkey,"Personal",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     257    //PrintHood
     258    strcpy(shellpath, InternalGetWindowsDirectoryA());
     259    strcat(shellpath, "\\PrintHood");
     260    CreateDirectoryA(shellpath, NULL);
     261    RegSetValueExA(hkey,"PrintHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     262    //Recent
     263    strcpy(shellpath, InternalGetWindowsDirectoryA());
     264    strcat(shellpath, "\\Recent");
     265    CreateDirectoryA(shellpath, NULL);
     266    RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     267    //SendTo
     268    strcpy(shellpath, InternalGetWindowsDirectoryA());
     269    strcat(shellpath, "\\SendTo");
     270    CreateDirectoryA(shellpath, NULL);
     271    RegSetValueExA(hkey,"SendTo",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     272    //Start Menu
     273    strcpy(shellpath, InternalGetWindowsDirectoryA());
     274    strcat(shellpath, "\\Start Menu");
     275    CreateDirectoryA(shellpath, NULL);
     276    RegSetValueExA(hkey,"Start Menu",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     277    //Programs
     278    strcpy(shellpath, InternalGetWindowsDirectoryA());
     279    strcat(shellpath, "\\Start Menu\\Programs");
     280    CreateDirectoryA(shellpath, NULL);
     281    RegSetValueExA(hkey,"Programs",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     282    //Startup
     283    strcat(shellpath, "\\Startup");
     284    CreateDirectoryA(shellpath, NULL);
     285    RegSetValueExA(hkey,"Startup",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     286    //ShellNew
     287    strcpy(shellpath, InternalGetWindowsDirectoryA());
     288    strcat(shellpath, "\\ShellNew");
     289    CreateDirectoryA(shellpath, NULL);
     290    RegSetValueExA(hkey,"Templates",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
    291291//   }
    292292   RegCloseKey(hkey);
     
    299299   //ThreadingModel="Apartment"
    300300   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
    301         goto initreg_error;
     301    goto initreg_error;
    302302   }
    303303   RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_DESKTOP, sizeof(CLASS_DESKTOP));
    304304   RegCloseKey(hkey);
    305305   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021400-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
    306         goto initreg_error;
     306    goto initreg_error;
    307307   }
    308308   RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL));
     
    317317   //@=""
    318318   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}",&hkey)!=ERROR_SUCCESS) {
    319         goto initreg_error;
     319    goto initreg_error;
    320320   }
    321321   RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHORTCUT, sizeof(CLASS_SHORTCUT));
    322322   RegCloseKey(hkey);
    323323   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
    324         goto initreg_error;
     324    goto initreg_error;
    325325   }
    326326   RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHELL32DLL, sizeof(CLASS_SHELL32DLL));
     
    328328   RegCloseKey(hkey);
    329329   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{00021401-0000-0000-C000-000000000046}\\shellex\\MayChangeDefaultMenu",&hkey)!=ERROR_SUCCESS) {
    330         goto initreg_error;
     330    goto initreg_error;
    331331   }
    332332   RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)"", 0);
     
    339339   //HKEY_CLASSES_ROOT\CLSID\{D7B70EE0-4340-11CF-B063-0020AFC2CD35}\InprocServer32 = ddraw.dll
    340340   if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectDraw",&hkey)!=ERROR_SUCCESS) {
    341         goto initreg_error;
     341    goto initreg_error;
    342342   }
    343343   RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
    344344   if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
    345         RegCloseKey(hkey);
    346         goto initreg_error;
     345    RegCloseKey(hkey);
     346    goto initreg_error;
    347347   }
    348348   RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLASSID, sizeof(DDRAW_CLASSID));
     
    351351
    352352   if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLASSID ,&hkey)!=ERROR_SUCCESS) {
    353         goto initreg_error;
     353    goto initreg_error;
    354354   }
    355355   RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_DEFAULT, sizeof(DDRAW_DEFAULT));
    356356   if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
    357         RegCloseKey(hkey);
    358         goto initreg_error;
     357    RegCloseKey(hkey);
     358    goto initreg_error;
    359359   }
    360360   RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
     
    368368   //HKEY_CLASSES_ROOT\CLSID\{593817A0-7DB3-11CF-A2DE-00AA00B93356}\InprocServer32 = ddraw.dll
    369369   if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectDrawClipper",&hkey)!=ERROR_SUCCESS) {
    370         goto initreg_error;
     370    goto initreg_error;
    371371   }
    372372   RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
    373373   if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
    374         RegCloseKey(hkey);
    375         goto initreg_error;
     374    RegCloseKey(hkey);
     375    goto initreg_error;
    376376   }
    377377   RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_CLASSID, sizeof(DDRAW_CLIPPER_CLASSID));
     
    380380
    381381   if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DDRAW_CLIPPER_CLASSID,&hkey)!=ERROR_SUCCESS) {
    382         goto initreg_error;
     382    goto initreg_error;
    383383   }
    384384   RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DDRAW_CLIPPER_DEFAULT, sizeof(DDRAW_CLIPPER_DEFAULT));
    385385   if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
    386         RegCloseKey(hkey);
    387         goto initreg_error;
     386    RegCloseKey(hkey);
     387    goto initreg_error;
    388388   }
    389389   RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DDRAW_DLL, sizeof(DDRAW_DLL));
     
    397397   //HKEY_CLASSES_ROOT\CLSID\{47D4D946-62E8-11cf-93BC-444553540000}\InprocServer32 = dsound.dll
    398398   if(RegCreateKeyA(HKEY_CLASSES_ROOT,"DirectSound",&hkey)!=ERROR_SUCCESS) {
    399         goto initreg_error;
     399    goto initreg_error;
    400400   }
    401401   RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
    402402   if(RegCreateKeyA(hkey,COM_CLASS_ID,&hkey1)!=ERROR_SUCCESS) {
    403         RegCloseKey(hkey);
    404         goto initreg_error;
     403    RegCloseKey(hkey);
     404    goto initreg_error;
    405405   }
    406406   RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_CLASSID, sizeof(DSOUND_CLASSID));
     
    409409
    410410   if(RegCreateKeyA(HKEY_CLASSES_ROOT, COM_CLASS_ID"\\"DSOUND_CLASSID ,&hkey)!=ERROR_SUCCESS) {
    411         goto initreg_error;
     411    goto initreg_error;
    412412   }
    413413   RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DSOUND_DEFAULT, sizeof(DSOUND_DEFAULT));
    414414   if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
    415         RegCloseKey(hkey);
    416         goto initreg_error;
     415    RegCloseKey(hkey);
     416    goto initreg_error;
    417417   }
    418418   RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DSOUND_DLL, sizeof(DSOUND_DLL));
     
    423423   //DirectPlay
    424424   if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_CLASSID ,&hkey)!=ERROR_SUCCESS) {
    425         goto initreg_error;
     425    goto initreg_error;
    426426   }
    427427   RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_DEFAULT, sizeof(DPLAYX_DEFAULT));
    428428   if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
    429         RegCloseKey(hkey);
    430         goto initreg_error;
     429    RegCloseKey(hkey);
     430    goto initreg_error;
    431431   }
    432432   RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_DLL, sizeof(DPLAYX_DLL));
     
    437437   //DirectPlay Lobby
    438438   if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\CLASSES\\CLSID\\"DPLAYX_LOBBY_CLASSID ,&hkey)!=ERROR_SUCCESS) {
    439         goto initreg_error;
     439    goto initreg_error;
    440440   }
    441441   RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DEFAULT, sizeof(DPLAYX_LOBBY_DEFAULT));
    442442   if(RegCreateKeyA(hkey,COM_INPROCSERVER, &hkey1)!=ERROR_SUCCESS) {
    443         RegCloseKey(hkey);
    444         goto initreg_error;
     443    RegCloseKey(hkey);
     444    goto initreg_error;
    445445   }
    446446   RegSetValueExA(hkey1,"",0,REG_SZ, (LPBYTE)DPLAYX_LOBBY_DLL, sizeof(DPLAYX_LOBBY_DLL));
     
    455455   //"SharedDir"="C:\WINDOWS"
    456456   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion",&hkey)!=ERROR_SUCCESS) {
    457         goto initreg_error;
     457    goto initreg_error;
    458458   }
    459459   //Create x:\Program Files directory
    460460   strcpy(shellpath, InternalGetWindowsDirectoryA());
    461    shellpath[2] = 0;    //get drive
     461   shellpath[2] = 0;    //get drive
    462462   strcat(shellpath, "\\Program Files");
    463463   CreateDirectoryA(shellpath, NULL);
     
    479479   //"VgaCompatible"="\\Device\\Video1"
    480480   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\VIDEO",&hkey)!=ERROR_SUCCESS) {
    481         goto initreg_error;
     481    goto initreg_error;
    482482   }
    483483   RegSetValueExA(hkey,"\\Device\\Video0",0,REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD, sizeof(HARDWARE_VIDEO_GRADD));
     
    487487
    488488   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Gradd\\Device0",&hkey)!=ERROR_SUCCESS) {
    489         goto initreg_error;
     489    goto initreg_error;
    490490   }
    491491   RegSetValueExA(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_GRADD_DESCRIPTION, sizeof(HARDWARE_VIDEO_GRADD_DESCRIPTION));
     
    493493
    494494   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\VgaSave\\Device0",&hkey)!=ERROR_SUCCESS) {
    495         goto initreg_error;
     495    goto initreg_error;
    496496   }
    497497   RegSetValueExA(hkey,"Device Description", 0, REG_SZ, (LPBYTE)HARDWARE_VIDEO_VGA_DESCRIPTION, sizeof(HARDWARE_VIDEO_VGA_DESCRIPTION));
     
    500500   //Software\Microsoft\Multimedia\Sound Mapper
    501501   if(RegCreateKeyA(HKEY_CURRENT_USER,"Software\\Microsoft\\Multimedia\\Sound Mapper",&hkey)!=ERROR_SUCCESS) {
    502         goto initreg_error;
     502    goto initreg_error;
    503503   }
    504504   RegSetValueExA(hkey,"Playback", 0, REG_SZ, (LPBYTE)ODIN_WINMM_PLAYBACK, sizeof(ODIN_WINMM_PLAYBACK));
     
    506506   RegCloseKey(hkey);
    507507
    508    //Software\Microsoft\DirectX 
     508   //Software\Microsoft\DirectX
    509509   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectX",&hkey)!=ERROR_SUCCESS) {
    510         goto initreg_error;
     510    goto initreg_error;
    511511   }
    512512   RegSetValueExA(hkey,"",0,REG_SZ, (LPBYTE)"", 0);
     
    518518
    519519   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectDraw",&hkey)!=ERROR_SUCCESS) {
    520         goto initreg_error;
     520    goto initreg_error;
    521521   }
    522522   //todo
     
    524524
    525525   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Direct3D",&hkey)!=ERROR_SUCCESS) {
    526         goto initreg_error;
     526    goto initreg_error;
    527527   }
    528528   //todo
     
    530530
    531531   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectPlay",&hkey)!=ERROR_SUCCESS) {
    532         goto initreg_error;
     532    goto initreg_error;
    533533   }
    534534   //todo
     
    537537#if 0
    538538   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\DirectMusic",&hkey)!=ERROR_SUCCESS) {
    539         goto initreg_error;
     539    goto initreg_error;
    540540   }
    541541   //todo
     
    551551
    552552   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdfs",&hkey)!=ERROR_SUCCESS) {
    553         goto initreg_error;
     553    goto initreg_error;
    554554   }
    555555   val = 0x2;
     
    580580
    581581   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdrom",&hkey)!=ERROR_SUCCESS) {
    582         goto initreg_error;
     582    goto initreg_error;
    583583   }
    584584   val = 0x1;
     
    608608   //"Win95TruncatedExtensions"=dword:00000001
    609609   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\FileSystem",&hkey)!=ERROR_SUCCESS) {
    610         goto initreg_error;
     610    goto initreg_error;
    611611   }
    612612   val = 0x0;
     
    654654 DWORD signature;
    655655
    656    SetEnvironmentVariableA("CPU", "i386");
    657    SetEnvironmentVariableA("PROCESSOR_ARCHITECTURE", "x86");
    658    if(SupportsCPUID()) {
    659         GetCPUVendorString(buffer1);
    660         buffer1[12] = 0;       
    661         signature = GetCPUSignature();
    662         sprintf(buffer, "x86 Family %x Model %x Stepping %x, %s", (signature >> 8)&0xf, signature & 0xf, (signature >> 4)&0xf, buffer1);
    663         SetEnvironmentVariableA("PROCESSOR_IDENTIFIER", buffer);
    664         sprintf(buffer, "%x", (signature >> 8)&0xf);
    665         SetEnvironmentVariableA("PROCESSOR_LEVEL", buffer);
    666         sprintf(buffer, "%02x%02x", (signature >> 4)&0xf, signature & 0xf);
    667         SetEnvironmentVariableA("PROCESSOR_REVISION", buffer);
    668    }
    669    sprintf(buffer, "%d", nrcpus);
    670    SetEnvironmentVariableA("NUMBER_OF_PROCESSORS", buffer);
    671    SetEnvironmentVariableA("OS", "Windows_NT");
    672    SetEnvironmentVariableA("PATHEXT", ".COM;.EXE;.BAT;.CMD");
    673    windir = InternalGetWindowsDirectoryA();
    674    SetEnvironmentVariableA("windir", windir);
    675    SetEnvironmentVariableA("SystemRoot", windir);
    676    buffer[0] = windir[0];
    677    buffer[1] = windir[1];
    678    buffer[2] = 0;
    679    SetEnvironmentVariableA("SystemDrive", buffer);
    680    SetEnvironmentVariableA("HOMEDRIVE", buffer);
    681    SetEnvironmentVariableA("HOMEPATH", "\\");
    682 
    683 //TODO:
    684 //COMPUTERNAME=NTBAK
    685 //ComSpec=E:\WINNT\system32\cmd.exe
    686 //LOGONSERVER=\\NTBAK
    687 //USERDOMAIN=NTBAK
    688 //USERNAME=Sander
    689 //USERPROFILE=E:\WINNT\Profiles\Sander
     656    SetEnvironmentVariableA("CPU", "i386");
     657    SetEnvironmentVariableA("PROCESSOR_ARCHITECTURE", "x86");
     658    if(SupportsCPUID()) {
     659        GetCPUVendorString(buffer1);
     660        buffer1[12] = 0;
     661        signature = GetCPUSignature();
     662        sprintf(buffer, "x86 Family %x Model %x Stepping %x, %s", (signature >> 8)&0xf, signature & 0xf, (signature >> 4)&0xf, buffer1);
     663        SetEnvironmentVariableA("PROCESSOR_IDENTIFIER", buffer);
     664        sprintf(buffer, "%x", (signature >> 8)&0xf);
     665        SetEnvironmentVariableA("PROCESSOR_LEVEL", buffer);
     666        sprintf(buffer, "%02x%02x", (signature >> 4)&0xf, signature & 0xf);
     667        SetEnvironmentVariableA("PROCESSOR_REVISION", buffer);
     668    }
     669    sprintf(buffer, "%d", nrcpus);
     670    SetEnvironmentVariableA("NUMBER_OF_PROCESSORS", buffer);
     671    SetEnvironmentVariableA("OS", "Windows_NT");
     672    SetEnvironmentVariableA("PATHEXT", ".COM;.EXE;.BAT;.CMD");
     673    windir = InternalGetWindowsDirectoryA();
     674    SetEnvironmentVariableA("windir", windir);
     675    SetEnvironmentVariableA("SystemRoot", windir);
     676    buffer[0] = windir[0];
     677    buffer[1] = windir[1];
     678    buffer[2] = 0;
     679    SetEnvironmentVariableA("SystemDrive", buffer);
     680    SetEnvironmentVariableA("HOMEDRIVE", buffer);
     681    SetEnvironmentVariableA("HOMEPATH", "\\");
     682
     683    //TODO:
     684    //COMPUTERNAME=NTBAK
     685    //ComSpec=E:\WINNT\system32\cmd.exe
     686    //LOGONSERVER=\\NTBAK
     687    //USERDOMAIN=NTBAK
     688    //USERNAME=Sander
     689    //USERPROFILE=E:\WINNT\Profiles\Sander
    690690}
     691//******************************************************************************
     692//Create/change keys that may change (i.e. odin.ini keys that affect windows version)
     693//******************************************************************************
     694void InitDynamicRegistry()
     695{
     696 OSVERSIONINFOA versioninfo;
     697 HKEY           hkey;
     698 char           buf[16] = "";
     699
     700    versioninfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
     701    GetVersionExA(&versioninfo);
     702
     703    //Set version key:
     704    // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions]
     705    // "ProductType"="WinNT"
     706    if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",&hkey)!=ERROR_SUCCESS) {
     707        dprintf(("InitRegistry: Unable to register system information (2)"));
     708            return;
     709    }
     710    switch(versioninfo.dwPlatformId) {
     711    case VER_PLATFORM_WIN32_WINDOWS:
     712        strcpy(buf, "Win98");    //TODO: Correct???????????
     713        break;
     714    case VER_PLATFORM_WIN32_NT:
     715        strcpy(buf, "WinNT");   //TODO: Also correct for Windows 2000???
     716        break;
     717    default:
     718        DebugInt3();
     719        break;
     720    }
     721    RegSetValueExA(hkey,"ProductType",0,REG_SZ, (LPBYTE)buf, strlen(buf)+1);
     722    RegCloseKey(hkey);
     723}
     724//******************************************************************************
     725//******************************************************************************
     726
Note: See TracChangeset for help on using the changeset viewer.