- User resource strings instead of constant strings for folder names.

- Add english and german resource strings.

svn path=/trunk/; revision=11228
This commit is contained in:
Eric Kohl 2004-10-08 11:52:30 +00:00
parent 475d618db9
commit 4d19c5066a
9 changed files with 368 additions and 98 deletions

46
reactos/lib/userenv/De.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* Copyright (C) 2004 Eric Kohl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT
STRINGTABLE
BEGIN
IDS_PROFILEPATH "%SystemDrive%\\Dokumente und Einstellungen"
IDS_APPDATA "Anwendungsdaten"
IDS_DESKTOP "Desktop"
IDS_FAVORITES "Favoriten"
IDS_STARTMENU "Startmenü"
IDS_PROGRAMS "Startmenü\\Programme"
IDS_ADMINTOOLS "Startmenü\\Programme\\Verwaltung"
IDS_STARTUP "Startmenü\\Programme\\Autostart"
IDS_MYDOCUMENTS "Eigene Dateien"
IDS_MYPICTURES "Eigene Dateien\\Eigene Bilder"
IDS_MYMUSIC "Eigene Dateien\\Eigene Musik"
IDS_MYVIDEOS "Eigene Dateien\\Eigene Videos"
IDS_TEMPLATES "Vorlagen"
IDS_RECENT "Recent"
IDS_SENDTO "SendTo"
IDS_PRINTHOOD "Druckumgebung"
IDS_NETHOOD "Netzwerkumgebung"
IDS_LOCALSETTINGS "Lokale Einstellungen"
IDS_LOCALAPPDATA "Lokale Einstellungen\\Anwendungsdaten"
IDS_TEMP "Lokale Einstellungen\\Temp"
IDS_CACHE "Lokale Einstellungen\\Temporary Internet Files"
IDS_HISTORY "Lokale Einstellungen\\Verlauf"
IDS_COOKIES "Cookies"
END

46
reactos/lib/userenv/En.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* Copyright (C) 2004 Eric Kohl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE
BEGIN
IDS_PROFILEPATH "%SystemDrive%\\Documents and Settings"
IDS_APPDATA "Application Data"
IDS_DESKTOP "Desktop"
IDS_FAVORITES "Favorites"
IDS_STARTMENU "Start Menu"
IDS_PROGRAMS "Start Menu\\Programs"
IDS_ADMINTOOLS "Start Menu\\Programs\\Administrative Tools"
IDS_STARTUP "Start Menu\\Programs\\Startup"
IDS_MYDOCUMENTS "My Documents"
IDS_MYPICTURES "My Documents\\My Pictures"
IDS_MYMUSIC "My Documents\\My Music"
IDS_MYVIDEOS "My Documents\\My Videos"
IDS_TEMPLATES "Templates"
IDS_RECENT "Recent"
IDS_SENDTO "SendTo"
IDS_PRINTHOOD "PrintHood"
IDS_NETHOOD "NetHood"
IDS_LOCALSETTINGS "Local Settings"
IDS_LOCALAPPDATA "Local Settings\\Application Data"
IDS_TEMP "Local Settings\\Temp"
IDS_CACHE "Local Settings\\Temporary Internet Files"
IDS_HISTORY "Local Settings\\History"
IDS_COOKIES "Cookies"
END

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: internal.h,v 1.10 2004/10/03 09:27:22 ekohl Exp $ /* $Id: internal.h,v 1.11 2004/10/08 11:52:30 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -106,6 +106,9 @@ BOOL
UpdateUsersShellFolderSettings(LPCWSTR lpUserProfilePath, UpdateUsersShellFolderSettings(LPCWSTR lpUserProfilePath,
HKEY hUserKey); HKEY hUserKey);
/* userenv.c */
extern HINSTANCE hInstance;
#endif /* _INTERNAL_H */ #endif /* _INTERNAL_H */
/* EOF */ /* EOF */

View file

@ -15,7 +15,7 @@ TARGET_CFLAGS += -DUNICODE -D_UNICODE -Wall -Werror
TARGET_LFLAGS = -nostdlib -nostartfiles TARGET_LFLAGS = -nostdlib -nostartfiles
TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a wine_uuid.a TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a user32.a wine_uuid.a
TARGET_OBJECTS = desktop.o directory.o environment.o profile.o misc.o \ TARGET_OBJECTS = desktop.o directory.o environment.o profile.o misc.o \
registry.o setup.o userenv.o registry.o setup.o userenv.o

View file

@ -6,4 +6,6 @@
#define NTOS_MODE_USER #define NTOS_MODE_USER
#include <ntos.h> #include <ntos.h>
#include <userenv.h> #include <userenv.h>
#include "internal.h" #include "internal.h"
#include "resources.h"

View file

@ -0,0 +1,52 @@
/*
* ReactOS kernel
* Copyright (C) 2004 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: resources.h,v 1.1 2004/10/08 11:52:30 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/userenv/resource.h
* PURPOSE: Resource IDs
* PROGRAMMER: Eric Kohl
*/
#define IDS_PROFILEPATH 1
#define IDS_APPDATA 2
#define IDS_DESKTOP 3
#define IDS_FAVORITES 4
#define IDS_STARTMENU 5
#define IDS_PROGRAMS 6
#define IDS_ADMINTOOLS 7
#define IDS_STARTUP 8
#define IDS_MYDOCUMENTS 9
#define IDS_MYPICTURES 10
#define IDS_MYMUSIC 11
#define IDS_MYVIDEOS 12
#define IDS_TEMPLATES 13
#define IDS_RECENT 14
#define IDS_SENDTO 15
#define IDS_PRINTHOOD 16
#define IDS_NETHOOD 17
#define IDS_LOCALSETTINGS 18
#define IDS_LOCALAPPDATA 19
#define IDS_TEMP 20
#define IDS_CACHE 21
#define IDS_HISTORY 22
#define IDS_COOKIES 23
/* EOF */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: setup.c,v 1.9 2004/10/03 09:27:22 ekohl Exp $ /* $Id: setup.c,v 1.10 2004/10/08 11:52:30 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -29,9 +29,10 @@
typedef struct _FOLDERDATA typedef struct _FOLDERDATA
{ {
LPWSTR ValueName; LPWSTR lpValueName;
LPWSTR Path; LPWSTR lpPath;
BOOL Hidden; UINT uId;
BOOL bHidden;
BOOL bShellFolder; BOOL bShellFolder;
BOOL bUserShellFolder; BOOL bUserShellFolder;
} FOLDERDATA, *PFOLDERDATA; } FOLDERDATA, *PFOLDERDATA;
@ -40,40 +41,47 @@ typedef struct _FOLDERDATA
static FOLDERDATA static FOLDERDATA
UserShellFolders[] = UserShellFolders[] =
{ {
{L"AppData", L"Application Data", TRUE, TRUE, TRUE}, {L"AppData", L"Application Data", IDS_APPDATA, TRUE, TRUE, TRUE},
{L"Desktop", L"Desktop", FALSE, TRUE, TRUE}, {L"Desktop", L"Desktop", IDS_DESKTOP, FALSE, TRUE, TRUE},
{L"Favorites", L"Favorites", FALSE, TRUE, TRUE}, {L"Favorites", L"Favorites", IDS_FAVORITES, FALSE, TRUE, TRUE},
{L"Personal", L"My Documents", FALSE, TRUE, TRUE}, {L"Personal", L"My Documents", IDS_MYDOCUMENTS, FALSE, TRUE, TRUE},
{L"PrintHood", L"PrintHood", TRUE, TRUE, TRUE}, {L"My Pictures", L"My Documents\\My Pictures", IDS_MYPICTURES, FALSE, TRUE, TRUE},
{L"Recent", L"Recent", TRUE, TRUE, TRUE}, {L"My Music", L"My Documents\\My Music", IDS_MYMUSIC, FALSE, TRUE, TRUE},
{L"SendTo", L"SendTo", FALSE, TRUE, TRUE}, {L"My Video", L"My Documents\\My Videos", IDS_MYVIDEOS, FALSE, TRUE, TRUE},
{L"Templates", L"Templates", FALSE, TRUE, TRUE}, {L"NetHood", L"NetHood", IDS_NETHOOD, TRUE, TRUE, TRUE}, /* hidden ??*/
{L"Start Menu", L"Start Menu", FALSE, TRUE, TRUE}, {L"PrintHood", L"PrintHood", IDS_PRINTHOOD, TRUE, TRUE, TRUE},
{L"Programs", L"Start Menu\\Programs", FALSE, TRUE, TRUE}, {L"Recent", L"Recent", IDS_RECENT, TRUE, TRUE, TRUE},
{L"Startup", L"Start Menu\\Programs\\Startup", FALSE, TRUE, TRUE}, {L"SendTo", L"SendTo", IDS_SENDTO, FALSE, TRUE, TRUE},
{L"Local Settings", L"Local Settings", TRUE, TRUE, TRUE}, {L"Templates", L"Templates", IDS_TEMPLATES, FALSE, TRUE, TRUE},
{L"Local AppData", L"Local Settings\\Application Data", TRUE, TRUE, TRUE}, {L"Start Menu", L"Start Menu", IDS_STARTMENU, FALSE, TRUE, TRUE},
{L"Temp", L"Local Settings\\Temp", FALSE, FALSE, FALSE}, {L"Programs", L"Start Menu\\Programs", IDS_PROGRAMS, FALSE, TRUE, TRUE},
{NULL, NULL, FALSE, FALSE, FALSE} {L"Startup", L"Start Menu\\Programs\\Startup", IDS_STARTUP, FALSE, TRUE, TRUE},
{L"Local Settings", L"Local Settings", IDS_LOCALSETTINGS, TRUE, TRUE, TRUE},
{L"Local AppData", L"Local Settings\\Application Data", IDS_LOCALAPPDATA, TRUE, TRUE, TRUE},
{L"Temp", L"Local Settings\\Temp", IDS_TEMP, FALSE, FALSE, FALSE},
{L"Cache", L"Local Settings\\Temporary Internet Files", IDS_CACHE, FALSE, TRUE, TRUE}, /* hidden ??*/
{L"History", L"Local Settings\\History", IDS_HISTORY, FALSE, TRUE, TRUE}, /* hidden ??*/
{L"Cookies", L"Cookies", IDS_COOKIES, FALSE, TRUE, TRUE}, /* hidden ??*/
{NULL, NULL, -1, FALSE, FALSE, FALSE}
}; };
static FOLDERDATA static FOLDERDATA
CommonShellFolders[] = CommonShellFolders[] =
{ {
{L"Common AppData", L"Application Data", TRUE, TRUE, TRUE}, {L"Common AppData", L"Application Data", IDS_APPDATA, TRUE, TRUE, TRUE},
{L"Common Desktop", L"Desktop", FALSE, TRUE, TRUE}, {L"Common Desktop", L"Desktop", IDS_DESKTOP, FALSE, TRUE, TRUE},
{L"Common Favorites", L"Favorites", FALSE, TRUE, TRUE}, {L"Common Favorites", L"Favorites", IDS_FAVORITES, FALSE, TRUE, TRUE},
{L"Common Start Menu", L"Start Menu", FALSE, TRUE, TRUE}, {L"Common Start Menu", L"Start Menu", IDS_STARTMENU, FALSE, TRUE, TRUE},
{L"Common Programs", L"Start Menu\\Programs", FALSE, TRUE, TRUE}, {L"Common Programs", L"Start Menu\\Programs", IDS_PROGRAMS, FALSE, TRUE, TRUE},
{L"Common Administrative Tools", L"Start Menu\\Programs\\Administrative Tools", FALSE, TRUE, FALSE}, {L"Common Administrative Tools", L"Start Menu\\Programs\\Administrative Tools", IDS_ADMINTOOLS, FALSE, TRUE, FALSE},
{L"Common Startup", L"Start Menu\\Programs\\Startup", FALSE, TRUE, TRUE}, {L"Common Startup", L"Start Menu\\Programs\\Startup", IDS_STARTUP, FALSE, TRUE, TRUE},
{L"Common Templates", L"Templates", TRUE, TRUE, TRUE}, {L"Common Templates", L"Templates", IDS_TEMPLATES, TRUE, TRUE, TRUE},
{L"Common Documents", L"My Documents", FALSE, TRUE, TRUE}, {L"Common Documents", L"My Documents", IDS_MYDOCUMENTS, FALSE, TRUE, TRUE},
{L"CommonPictures", L"My Documents\\My Pictures", FALSE, TRUE, TRUE}, {L"CommonPictures", L"My Documents\\My Pictures", IDS_MYPICTURES, FALSE, TRUE, TRUE},
{L"CommonMusic", L"My Documents\\My Music", FALSE, TRUE, TRUE}, {L"CommonMusic", L"My Documents\\My Music", IDS_MYMUSIC, FALSE, TRUE, TRUE},
{L"CommonVideo", L"My Documents\\My Videos", FALSE, TRUE, TRUE}, {L"CommonVideo", L"My Documents\\My Videos", IDS_MYVIDEOS, FALSE, TRUE, TRUE},
{NULL, NULL, FALSE, FALSE, FALSE} {NULL, NULL, -1, FALSE, FALSE, FALSE}
}; };
@ -101,6 +109,16 @@ InitializeProfiles (VOID)
PFOLDERDATA lpFolderData; PFOLDERDATA lpFolderData;
HKEY hKey; HKEY hKey;
/* Load profiles directory path */
if (!LoadString(hInstance,
IDS_PROFILEPATH,
szBuffer,
MAX_PATH))
{
DPRINT1("Error: %lu\n", GetLastError());
return FALSE;
}
if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, if (RegOpenKeyExW (HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
0, 0,
@ -111,14 +129,14 @@ InitializeProfiles (VOID)
return FALSE; return FALSE;
} }
/* Get profiles path */ /* Store profiles directory path */
dwLength = MAX_PATH * sizeof(WCHAR); dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR);
if (RegQueryValueExW (hKey, if (RegSetValueExW (hKey,
L"ProfilesDirectory", L"ProfilesDirectory",
NULL, 0,
NULL, REG_EXPAND_SZ,
(LPBYTE)szBuffer, (LPBYTE)szBuffer,
&dwLength)) dwLength))
{ {
DPRINT1("Error: %lu\n", GetLastError()); DPRINT1("Error: %lu\n", GetLastError());
RegCloseKey (hKey); RegCloseKey (hKey);
@ -184,30 +202,40 @@ InitializeProfiles (VOID)
} }
/* Set current user profile */ /* Set current user profile */
SetEnvironmentVariableW (L"USERPROFILE", szProfilePath); SetEnvironmentVariableW(L"USERPROFILE", szProfilePath);
/* Create 'Default User' subdirectories */ /* Create 'Default User' subdirectories */
/* FIXME: Get these paths from the registry */ /* FIXME: Get these paths from the registry */
lpFolderData = &UserShellFolders[0]; lpFolderData = &UserShellFolders[0];
while (lpFolderData->ValueName != NULL) while (lpFolderData->lpValueName != NULL)
{ {
wcscpy(szBuffer, szProfilePath); wcscpy(szBuffer, szProfilePath);
wcscat(szBuffer, L"\\"); wcscat(szBuffer, L"\\");
wcscat(szBuffer, lpFolderData->Path);
/* Append the folder name */
dwLength = wcslen(szBuffer);
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
MAX_PATH - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
}
if (!CreateDirectoryW(szBuffer, NULL)) if (!CreateDirectoryW(szBuffer, NULL))
{ {
if (GetLastError () != ERROR_ALREADY_EXISTS) if (GetLastError() != ERROR_ALREADY_EXISTS)
{ {
DPRINT1("Error: %lu\n", GetLastError()); DPRINT1("Error: %lu\n", GetLastError());
return FALSE; return FALSE;
} }
} }
if (lpFolderData->Hidden == TRUE) if (lpFolderData->bHidden == TRUE)
{ {
SetFileAttributesW (szBuffer, SetFileAttributesW(szBuffer,
FILE_ATTRIBUTE_HIDDEN); FILE_ATTRIBUTE_HIDDEN);
} }
lpFolderData++; lpFolderData++;
@ -225,17 +253,27 @@ InitializeProfiles (VOID)
} }
lpFolderData = &UserShellFolders[0]; lpFolderData = &UserShellFolders[0];
while (lpFolderData->ValueName != NULL) while (lpFolderData->lpValueName != NULL)
{ {
if (lpFolderData->bShellFolder) if (lpFolderData->bShellFolder)
{ {
wcscpy(szBuffer, szProfilePath); wcscpy(szBuffer, szProfilePath);
wcscat(szBuffer, L"\\"); wcscat(szBuffer, L"\\");
wcscat(szBuffer, lpFolderData->Path);
dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); /* Append the folder name */
dwLength = wcslen(szBuffer);
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
MAX_PATH - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
}
dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
if (RegSetValueExW(hKey, if (RegSetValueExW(hKey,
lpFolderData->ValueName, lpFolderData->lpValueName,
0, 0,
REG_SZ, REG_SZ,
(LPBYTE)szBuffer, (LPBYTE)szBuffer,
@ -254,7 +292,7 @@ InitializeProfiles (VOID)
GetWindowsDirectory(szBuffer, MAX_PATH); GetWindowsDirectory(szBuffer, MAX_PATH);
wcscat(szBuffer, L"\\media\\fonts"); wcscat(szBuffer, L"\\media\\fonts");
dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
if (RegSetValueExW(hKey, if (RegSetValueExW(hKey,
L"Fonts", L"Fonts",
0, 0,
@ -281,16 +319,26 @@ InitializeProfiles (VOID)
} }
lpFolderData = &UserShellFolders[0]; lpFolderData = &UserShellFolders[0];
while (lpFolderData->ValueName != NULL) while (lpFolderData->lpValueName != NULL)
{ {
if (lpFolderData->bUserShellFolder) if (lpFolderData->bUserShellFolder)
{ {
wcscpy(szBuffer, L"%USERPROFILE%\\"); wcscpy(szBuffer, L"%USERPROFILE%\\");
wcscat(szBuffer, lpFolderData->Path);
dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); /* Append the folder name */
dwLength = wcslen(szBuffer);
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
MAX_PATH - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
}
dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
if (RegSetValueExW(hKey, if (RegSetValueExW(hKey,
lpFolderData->ValueName, lpFolderData->lpValueName,
0, 0,
REG_EXPAND_SZ, REG_EXPAND_SZ,
(LPBYTE)szBuffer, (LPBYTE)szBuffer,
@ -309,46 +357,46 @@ InitializeProfiles (VOID)
/* Set 'AllUsersProfile' value */ /* Set 'AllUsersProfile' value */
wcscpy (szBuffer, L"All Users"); wcscpy(szBuffer, L"All Users");
if (!AppendSystemPostfix (szBuffer, MAX_PATH)) if (!AppendSystemPostfix(szBuffer, MAX_PATH))
{ {
DPRINT1("AppendSystemPostfix() failed\n", GetLastError()); DPRINT1("AppendSystemPostfix() failed\n", GetLastError());
return FALSE; return FALSE;
} }
if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
0, 0,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&hKey)) &hKey))
{ {
DPRINT1("Error: %lu\n", GetLastError()); DPRINT1("Error: %lu\n", GetLastError());
return FALSE; return FALSE;
} }
dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
if (RegSetValueExW (hKey, if (RegSetValueExW(hKey,
L"AllUsersProfile", L"AllUsersProfile",
0, 0,
REG_SZ, REG_SZ,
(LPBYTE)szBuffer, (LPBYTE)szBuffer,
dwLength)) dwLength))
{ {
DPRINT1("Error: %lu\n", GetLastError()); DPRINT1("Error: %lu\n", GetLastError());
RegCloseKey (hKey); RegCloseKey (hKey);
return FALSE; return FALSE;
} }
RegCloseKey (hKey); RegCloseKey(hKey);
/* Create 'All Users' profile directory */ /* Create 'All Users' profile directory */
wcscpy (szProfilePath, szProfilesPath); wcscpy(szProfilePath, szProfilesPath);
wcscat (szProfilePath, L"\\"); wcscat(szProfilePath, L"\\");
wcscat (szProfilePath, szBuffer); wcscat(szProfilePath, szBuffer);
if (!CreateDirectoryW (szProfilePath, NULL)) if (!CreateDirectoryW(szProfilePath, NULL))
{ {
if (GetLastError () != ERROR_ALREADY_EXISTS) if (GetLastError() != ERROR_ALREADY_EXISTS)
{ {
DPRINT1("Error: %lu\n", GetLastError()); DPRINT1("Error: %lu\n", GetLastError());
return FALSE; return FALSE;
@ -356,27 +404,37 @@ InitializeProfiles (VOID)
} }
/* Set 'All Users' profile */ /* Set 'All Users' profile */
SetEnvironmentVariableW (L"ALLUSERSPROFILE", szProfilePath); SetEnvironmentVariableW(L"ALLUSERSPROFILE", szProfilePath);
/* Create 'All Users' subdirectories */ /* Create 'All Users' subdirectories */
/* FIXME: Take these paths from the registry */ /* FIXME: Take these paths from the registry */
lpFolderData = &CommonShellFolders[0]; lpFolderData = &CommonShellFolders[0];
while (lpFolderData->ValueName != NULL) while (lpFolderData->lpValueName != NULL)
{ {
wcscpy(szBuffer, szProfilePath); wcscpy(szBuffer, szProfilePath);
wcscat(szBuffer, L"\\"); wcscat(szBuffer, L"\\");
wcscat(szBuffer, lpFolderData->Path);
/* Append the folder name */
dwLength = wcslen(szBuffer);
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
MAX_PATH - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
}
if (!CreateDirectoryW(szBuffer, NULL)) if (!CreateDirectoryW(szBuffer, NULL))
{ {
if (GetLastError () != ERROR_ALREADY_EXISTS) if (GetLastError() != ERROR_ALREADY_EXISTS)
{ {
DPRINT1("Error: %lu\n", GetLastError()); DPRINT1("Error: %lu\n", GetLastError());
return FALSE; return FALSE;
} }
} }
if (lpFolderData->Hidden) if (lpFolderData->bHidden)
{ {
SetFileAttributesW(szBuffer, SetFileAttributesW(szBuffer,
FILE_ATTRIBUTE_HIDDEN); FILE_ATTRIBUTE_HIDDEN);
@ -397,17 +455,27 @@ InitializeProfiles (VOID)
} }
lpFolderData = &CommonShellFolders[0]; lpFolderData = &CommonShellFolders[0];
while (lpFolderData->ValueName != NULL) while (lpFolderData->lpValueName != NULL)
{ {
if (lpFolderData->bShellFolder) if (lpFolderData->bShellFolder)
{ {
wcscpy(szBuffer, szProfilePath); wcscpy(szBuffer, szProfilePath);
wcscat(szBuffer, L"\\"); wcscat(szBuffer, L"\\");
wcscat(szBuffer, lpFolderData->Path);
dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); /* Append the folder name */
dwLength = wcslen(szBuffer);
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
MAX_PATH - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
}
dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
if (RegSetValueExW(hKey, if (RegSetValueExW(hKey,
lpFolderData->ValueName, lpFolderData->lpValueName,
0, 0,
REG_SZ, REG_SZ,
(LPBYTE)szBuffer, (LPBYTE)szBuffer,
@ -436,16 +504,26 @@ InitializeProfiles (VOID)
} }
lpFolderData = &CommonShellFolders[0]; lpFolderData = &CommonShellFolders[0];
while (lpFolderData->ValueName != NULL) while (lpFolderData->lpValueName != NULL)
{ {
if (lpFolderData->bUserShellFolder) if (lpFolderData->bUserShellFolder)
{ {
wcscpy(szBuffer, L"%ALLUSERSPROFILE%\\"); wcscpy(szBuffer, L"%ALLUSERSPROFILE%\\");
wcscat(szBuffer, lpFolderData->Path);
dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); /* Append the folder name */
dwLength = wcslen(szBuffer);
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
MAX_PATH - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
}
dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
if (RegSetValueExW(hKey, if (RegSetValueExW(hKey,
lpFolderData->ValueName, lpFolderData->lpValueName,
0, 0,
REG_EXPAND_SZ, REG_EXPAND_SZ,
(LPBYTE)szBuffer, (LPBYTE)szBuffer,
@ -493,19 +571,29 @@ UpdateUsersShellFolderSettings(LPCWSTR lpUserProfilePath,
} }
lpFolderData = &UserShellFolders[0]; lpFolderData = &UserShellFolders[0];
while (lpFolderData->ValueName != NULL) while (lpFolderData->lpValueName != NULL)
{ {
if (lpFolderData->bShellFolder) if (lpFolderData->bShellFolder)
{ {
wcscpy(szBuffer, lpUserProfilePath); wcscpy(szBuffer, lpUserProfilePath);
wcscat(szBuffer, L"\\"); wcscat(szBuffer, L"\\");
wcscat(szBuffer, lpFolderData->Path);
DPRINT("%S: %S\n", lpFolderData->ValueName, szBuffer); /* Append the folder name */
dwLength = wcslen(szBuffer);
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
MAX_PATH - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
}
dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); DPRINT("%S: %S\n", lpFolderData->lpValueName, szBuffer);
dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
if (RegSetValueExW(hFoldersKey, if (RegSetValueExW(hFoldersKey,
lpFolderData->ValueName, lpFolderData->lpValueName,
0, 0,
REG_SZ, REG_SZ,
(LPBYTE)szBuffer, (LPBYTE)szBuffer,

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: userenv.c,v 1.4 2004/09/30 20:23:00 ekohl Exp $ /* $Id: userenv.c,v 1.5 2004/10/08 11:52:30 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -27,6 +27,7 @@
#include "precomp.h" #include "precomp.h"
HINSTANCE hInstance = NULL;
BOOL WINAPI BOOL WINAPI
DllMain (HINSTANCE hinstDLL, DllMain (HINSTANCE hinstDLL,
@ -35,6 +36,7 @@ DllMain (HINSTANCE hinstDLL,
{ {
if (fdwReason == DLL_PROCESS_ATTACH) if (fdwReason == DLL_PROCESS_ATTACH)
{ {
hInstance = hinstDLL;
} }
else if (fdwReason == DLL_PROCESS_DETACH) else if (fdwReason == DLL_PROCESS_DETACH)
{ {

View file

@ -1,7 +1,28 @@
/*
* Copyright (C) 2004 Eric Kohl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <windows.h> #include <windows.h>
#include <reactos/resource.h> #include <reactos/resource.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #include "resources.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 5,1,2600,0 FILEVERSION 5,1,2600,0
@ -35,3 +56,13 @@ BEGIN
VALUE "Translation", 0x409, 1200 VALUE "Translation", 0x409, 1200
END END
END END
/*
* Everything specific to any language goes in one of the specific
* files. Note that you can and may override resources which also have
* a neutral version. This is to get localized bitmaps for example.
*/
#include "En.rc"
#include "De.rc"