Ignore:
Timestamp:
Mar 2, 2000, 8:17:21 PM (25 years ago)
Author:
sandervl
Message:

setcurrentdir fix + create shell dirs + keys during kernel32 init

File:
1 edited

Legend:

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

    r2802 r2973  
    1 /* $Id: initsystem.cpp,v 1.4 2000-02-16 14:25:40 sandervl Exp $ */
     1/* $Id: initsystem.cpp,v 1.5 2000-03-02 19:17:21 sandervl Exp $ */
    22/*
    33 * Odin system initialization (registry & directories)
     4 *
     5 *
     6 * NOTE: Most of this has to be moved into the Odin install program!!!!!
    47 *
    58 * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
     
    2932
    3033LONG (WIN32API *ADVAPI32_RegCloseKey)(HKEY) = 0;
     34LONG (WIN32API *ADVAPI32_RegOpenKeyA)(HKEY,LPCSTR,LPHKEY) = 0;
    3135LONG (WIN32API *ADVAPI32_RegCreateKeyA)(HKEY,LPCSTR,LPHKEY) = 0;
    3236LONG (WIN32API *ADVAPI32_RegSetValueExA)(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD) = 0;
     
    3943   if(hInstance) {
    4044        *(VOID **)&ADVAPI32_RegCloseKey=(void*)GetProcAddress(hInstance, (LPCSTR)"RegCloseKey");
     45        *(VOID **)&ADVAPI32_RegOpenKeyA=(void*)GetProcAddress(hInstance, (LPCSTR)"RegOpenKeyA");
    4146        *(VOID **)&ADVAPI32_RegCreateKeyA=(void*)GetProcAddress(hInstance, (LPCSTR)"RegCreateKeyA");
    4247        *(VOID **)&ADVAPI32_RegSetValueExA=(void*)GetProcAddress(hInstance, (LPCSTR)"RegSetValueExA");
     
    100105   ADVAPI32_RegCloseKey(hkey);
    101106   //todo: productid, registered org/owner, sourcepath,   
     107
     108   //Create Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders keys
     109   //"Favorites"="C:\WINDOWS\Favorites"
     110   //"StartUp"="C:\WINDOWS\Start Menu\Programs\Startup"
     111   //"Desktop"="C:\WINDOWS\Desktop"
     112   //"Programs"="C:\WINDOWS\Start Menu\Programs"
     113   //"Fonts"="C:\WINDOWS\Fonts"
     114   //"SendTo"="C:\WINDOWS\SendTo"
     115   //"Start Menu"="C:\WINDOWS\Start Menu"
     116   //"Templates"="C:\WINDOWS\ShellNew"
     117   //"Recent"="C:\WINDOWS\Recent"
     118   //"NetHood"="C:\WINDOWS\NetHood"
     119   //"Personal"="C:\My Documents"
     120
     121   char shellpath[260];
     122
     123   if(ADVAPI32_RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey) != ERROR_SUCCESS)
     124   {
     125        if(ADVAPI32_RegCreateKeyA(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",&hkey)!=ERROR_SUCCESS) {
     126                dprintf(("InitRegistry: Unable to register system information (3)"));
     127                return FALSE;
     128        }
     129        strcpy(shellpath, InternalGetSystemDirectoryA());
     130        strcat(shellpath, "\\Favorites");
     131        CreateDirectoryA(shellpath, NULL);
     132        ADVAPI32_RegSetValueExA(hkey,"Favorites",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     133        strcpy(shellpath, InternalGetSystemDirectoryA());
     134        strcat(shellpath, "\\Programs\\Startup");
     135        CreateDirectoryA(shellpath, NULL);
     136        ADVAPI32_RegSetValueExA(hkey,"Startup",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     137        strcpy(shellpath, InternalGetSystemDirectoryA());
     138        strcat(shellpath, "\\Desktop");
     139        CreateDirectoryA(shellpath, NULL);
     140        ADVAPI32_RegSetValueExA(hkey,"Desktop",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     141        strcpy(shellpath, InternalGetSystemDirectoryA());
     142        strcat(shellpath, "\\Start Menu\\Programs");
     143        CreateDirectoryA(shellpath, NULL);
     144        ADVAPI32_RegSetValueExA(hkey,"Programs",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     145        strcpy(shellpath, InternalGetSystemDirectoryA());
     146        strcat(shellpath, "\\Fonts");
     147        CreateDirectoryA(shellpath, NULL);
     148        ADVAPI32_RegSetValueExA(hkey,"Fonts",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     149        strcpy(shellpath, InternalGetSystemDirectoryA());
     150        strcat(shellpath, "\\SendTo");
     151        CreateDirectoryA(shellpath, NULL);
     152        ADVAPI32_RegSetValueExA(hkey,"SendTo",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     153        strcpy(shellpath, InternalGetSystemDirectoryA());
     154        strcat(shellpath, "\\Start Menu");
     155        CreateDirectoryA(shellpath, NULL);
     156        ADVAPI32_RegSetValueExA(hkey,"Start Menu",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     157        strcpy(shellpath, InternalGetSystemDirectoryA());
     158        strcat(shellpath, "\\ShellNew");
     159        CreateDirectoryA(shellpath, NULL);
     160        ADVAPI32_RegSetValueExA(hkey,"Templates",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     161        strcpy(shellpath, InternalGetSystemDirectoryA());
     162        strcat(shellpath, "\\Recent");
     163        CreateDirectoryA(shellpath, NULL);
     164        ADVAPI32_RegSetValueExA(hkey,"Recent",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     165        strcpy(shellpath, InternalGetSystemDirectoryA());
     166        strcat(shellpath, "\\NetHood");
     167        CreateDirectoryA(shellpath, NULL);
     168        ADVAPI32_RegSetValueExA(hkey,"NetHood",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     169        strcpy(shellpath, InternalGetSystemDirectoryA());
     170        strcat(shellpath, "\\My Documents");
     171        CreateDirectoryA(shellpath, NULL);
     172        ADVAPI32_RegSetValueExA(hkey,"Personal",0,REG_SZ, (LPBYTE)shellpath, strlen(shellpath)+1);
     173   }
     174   ADVAPI32_RegCloseKey(hkey);
    102175   return TRUE;
    103176}
Note: See TracChangeset for help on using the changeset viewer.