diff --git a/reactos/lib/userenv/De.rc b/reactos/lib/userenv/De.rc new file mode 100644 index 00000000000..c6d12ff1909 --- /dev/null +++ b/reactos/lib/userenv/De.rc @@ -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 diff --git a/reactos/lib/userenv/En.rc b/reactos/lib/userenv/En.rc new file mode 100644 index 00000000000..79b9a1bcb94 --- /dev/null +++ b/reactos/lib/userenv/En.rc @@ -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 diff --git a/reactos/lib/userenv/internal.h b/reactos/lib/userenv/internal.h index 9e62905f315..8f821fd660e 100644 --- a/reactos/lib/userenv/internal.h +++ b/reactos/lib/userenv/internal.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * PROJECT: ReactOS system libraries @@ -106,6 +106,9 @@ BOOL UpdateUsersShellFolderSettings(LPCWSTR lpUserProfilePath, HKEY hUserKey); +/* userenv.c */ +extern HINSTANCE hInstance; + #endif /* _INTERNAL_H */ /* EOF */ diff --git a/reactos/lib/userenv/makefile b/reactos/lib/userenv/makefile index c43a986a9b2..aecd6a5f9fd 100644 --- a/reactos/lib/userenv/makefile +++ b/reactos/lib/userenv/makefile @@ -15,7 +15,7 @@ TARGET_CFLAGS += -DUNICODE -D_UNICODE -Wall -Werror 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 \ registry.o setup.o userenv.o diff --git a/reactos/lib/userenv/precomp.h b/reactos/lib/userenv/precomp.h index 0c579e8840c..8a240cc49f9 100644 --- a/reactos/lib/userenv/precomp.h +++ b/reactos/lib/userenv/precomp.h @@ -6,4 +6,6 @@ #define NTOS_MODE_USER #include #include + #include "internal.h" +#include "resources.h" diff --git a/reactos/lib/userenv/resources.h b/reactos/lib/userenv/resources.h new file mode 100644 index 00000000000..4cc5d6d4137 --- /dev/null +++ b/reactos/lib/userenv/resources.h @@ -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 */ diff --git a/reactos/lib/userenv/setup.c b/reactos/lib/userenv/setup.c index 8e792ad71b3..c0a4d9e7f9d 100644 --- a/reactos/lib/userenv/setup.c +++ b/reactos/lib/userenv/setup.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * PROJECT: ReactOS system libraries @@ -29,9 +29,10 @@ typedef struct _FOLDERDATA { - LPWSTR ValueName; - LPWSTR Path; - BOOL Hidden; + LPWSTR lpValueName; + LPWSTR lpPath; + UINT uId; + BOOL bHidden; BOOL bShellFolder; BOOL bUserShellFolder; } FOLDERDATA, *PFOLDERDATA; @@ -40,40 +41,47 @@ typedef struct _FOLDERDATA static FOLDERDATA UserShellFolders[] = { - {L"AppData", L"Application Data", TRUE, TRUE, TRUE}, - {L"Desktop", L"Desktop", FALSE, TRUE, TRUE}, - {L"Favorites", L"Favorites", FALSE, TRUE, TRUE}, - {L"Personal", L"My Documents", FALSE, TRUE, TRUE}, - {L"PrintHood", L"PrintHood", TRUE, TRUE, TRUE}, - {L"Recent", L"Recent", TRUE, TRUE, TRUE}, - {L"SendTo", L"SendTo", FALSE, TRUE, TRUE}, - {L"Templates", L"Templates", FALSE, TRUE, TRUE}, - {L"Start Menu", L"Start Menu", FALSE, TRUE, TRUE}, - {L"Programs", L"Start Menu\\Programs", FALSE, TRUE, TRUE}, - {L"Startup", L"Start Menu\\Programs\\Startup", FALSE, TRUE, TRUE}, - {L"Local Settings", L"Local Settings", TRUE, TRUE, TRUE}, - {L"Local AppData", L"Local Settings\\Application Data", TRUE, TRUE, TRUE}, - {L"Temp", L"Local Settings\\Temp", FALSE, FALSE, FALSE}, - {NULL, NULL, FALSE, FALSE, FALSE} + {L"AppData", L"Application Data", IDS_APPDATA, TRUE, TRUE, TRUE}, + {L"Desktop", L"Desktop", IDS_DESKTOP, FALSE, TRUE, TRUE}, + {L"Favorites", L"Favorites", IDS_FAVORITES, FALSE, TRUE, TRUE}, + {L"Personal", L"My Documents", IDS_MYDOCUMENTS, FALSE, TRUE, TRUE}, + {L"My Pictures", L"My Documents\\My Pictures", IDS_MYPICTURES, FALSE, TRUE, TRUE}, + {L"My Music", L"My Documents\\My Music", IDS_MYMUSIC, FALSE, TRUE, TRUE}, + {L"My Video", L"My Documents\\My Videos", IDS_MYVIDEOS, FALSE, TRUE, TRUE}, + {L"NetHood", L"NetHood", IDS_NETHOOD, TRUE, TRUE, TRUE}, /* hidden ??*/ + {L"PrintHood", L"PrintHood", IDS_PRINTHOOD, TRUE, TRUE, TRUE}, + {L"Recent", L"Recent", IDS_RECENT, TRUE, TRUE, TRUE}, + {L"SendTo", L"SendTo", IDS_SENDTO, FALSE, TRUE, TRUE}, + {L"Templates", L"Templates", IDS_TEMPLATES, FALSE, TRUE, TRUE}, + {L"Start Menu", L"Start Menu", IDS_STARTMENU, FALSE, TRUE, TRUE}, + {L"Programs", L"Start Menu\\Programs", IDS_PROGRAMS, FALSE, TRUE, TRUE}, + {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 CommonShellFolders[] = { - {L"Common AppData", L"Application Data", TRUE, TRUE, TRUE}, - {L"Common Desktop", L"Desktop", FALSE, TRUE, TRUE}, - {L"Common Favorites", L"Favorites", FALSE, TRUE, TRUE}, - {L"Common Start Menu", L"Start Menu", FALSE, TRUE, TRUE}, - {L"Common Programs", L"Start Menu\\Programs", FALSE, TRUE, TRUE}, - {L"Common Administrative Tools", L"Start Menu\\Programs\\Administrative Tools", FALSE, TRUE, FALSE}, - {L"Common Startup", L"Start Menu\\Programs\\Startup", FALSE, TRUE, TRUE}, - {L"Common Templates", L"Templates", TRUE, TRUE, TRUE}, - {L"Common Documents", L"My Documents", FALSE, TRUE, TRUE}, - {L"CommonPictures", L"My Documents\\My Pictures", FALSE, TRUE, TRUE}, - {L"CommonMusic", L"My Documents\\My Music", FALSE, TRUE, TRUE}, - {L"CommonVideo", L"My Documents\\My Videos", FALSE, TRUE, TRUE}, - {NULL, NULL, FALSE, FALSE, FALSE} + {L"Common AppData", L"Application Data", IDS_APPDATA, TRUE, TRUE, TRUE}, + {L"Common Desktop", L"Desktop", IDS_DESKTOP, FALSE, TRUE, TRUE}, + {L"Common Favorites", L"Favorites", IDS_FAVORITES, FALSE, TRUE, TRUE}, + {L"Common Start Menu", L"Start Menu", IDS_STARTMENU, 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", IDS_ADMINTOOLS, FALSE, TRUE, FALSE}, + {L"Common Startup", L"Start Menu\\Programs\\Startup", IDS_STARTUP, FALSE, TRUE, TRUE}, + {L"Common Templates", L"Templates", IDS_TEMPLATES, TRUE, TRUE, TRUE}, + {L"Common Documents", L"My Documents", IDS_MYDOCUMENTS, FALSE, TRUE, TRUE}, + {L"CommonPictures", L"My Documents\\My Pictures", IDS_MYPICTURES, FALSE, TRUE, TRUE}, + {L"CommonMusic", L"My Documents\\My Music", IDS_MYMUSIC, FALSE, TRUE, TRUE}, + {L"CommonVideo", L"My Documents\\My Videos", IDS_MYVIDEOS, FALSE, TRUE, TRUE}, + {NULL, NULL, -1, FALSE, FALSE, FALSE} }; @@ -101,6 +109,16 @@ InitializeProfiles (VOID) PFOLDERDATA lpFolderData; 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, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", 0, @@ -111,14 +129,14 @@ InitializeProfiles (VOID) return FALSE; } - /* Get profiles path */ - dwLength = MAX_PATH * sizeof(WCHAR); - if (RegQueryValueExW (hKey, - L"ProfilesDirectory", - NULL, - NULL, - (LPBYTE)szBuffer, - &dwLength)) + /* Store profiles directory path */ + dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); + if (RegSetValueExW (hKey, + L"ProfilesDirectory", + 0, + REG_EXPAND_SZ, + (LPBYTE)szBuffer, + dwLength)) { DPRINT1("Error: %lu\n", GetLastError()); RegCloseKey (hKey); @@ -184,30 +202,40 @@ InitializeProfiles (VOID) } /* Set current user profile */ - SetEnvironmentVariableW (L"USERPROFILE", szProfilePath); + SetEnvironmentVariableW(L"USERPROFILE", szProfilePath); /* Create 'Default User' subdirectories */ /* FIXME: Get these paths from the registry */ lpFolderData = &UserShellFolders[0]; - while (lpFolderData->ValueName != NULL) + while (lpFolderData->lpValueName != NULL) { wcscpy(szBuffer, szProfilePath); 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 (GetLastError () != ERROR_ALREADY_EXISTS) + if (GetLastError() != ERROR_ALREADY_EXISTS) { DPRINT1("Error: %lu\n", GetLastError()); return FALSE; } } - if (lpFolderData->Hidden == TRUE) + if (lpFolderData->bHidden == TRUE) { - SetFileAttributesW (szBuffer, - FILE_ATTRIBUTE_HIDDEN); + SetFileAttributesW(szBuffer, + FILE_ATTRIBUTE_HIDDEN); } lpFolderData++; @@ -225,17 +253,27 @@ InitializeProfiles (VOID) } lpFolderData = &UserShellFolders[0]; - while (lpFolderData->ValueName != NULL) + while (lpFolderData->lpValueName != NULL) { if (lpFolderData->bShellFolder) { wcscpy(szBuffer, szProfilePath); 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, - lpFolderData->ValueName, + lpFolderData->lpValueName, 0, REG_SZ, (LPBYTE)szBuffer, @@ -254,7 +292,7 @@ InitializeProfiles (VOID) GetWindowsDirectory(szBuffer, MAX_PATH); wcscat(szBuffer, L"\\media\\fonts"); - dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); + dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR); if (RegSetValueExW(hKey, L"Fonts", 0, @@ -281,16 +319,26 @@ InitializeProfiles (VOID) } lpFolderData = &UserShellFolders[0]; - while (lpFolderData->ValueName != NULL) + while (lpFolderData->lpValueName != NULL) { if (lpFolderData->bUserShellFolder) { 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, - lpFolderData->ValueName, + lpFolderData->lpValueName, 0, REG_EXPAND_SZ, (LPBYTE)szBuffer, @@ -309,46 +357,46 @@ InitializeProfiles (VOID) /* Set 'AllUsersProfile' value */ - wcscpy (szBuffer, L"All Users"); - if (!AppendSystemPostfix (szBuffer, MAX_PATH)) + wcscpy(szBuffer, L"All Users"); + if (!AppendSystemPostfix(szBuffer, MAX_PATH)) { DPRINT1("AppendSystemPostfix() failed\n", GetLastError()); return FALSE; } - if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, - L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", - 0, - KEY_ALL_ACCESS, - &hKey)) + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", + 0, + KEY_ALL_ACCESS, + &hKey)) { DPRINT1("Error: %lu\n", GetLastError()); return FALSE; } - dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); - if (RegSetValueExW (hKey, - L"AllUsersProfile", - 0, - REG_SZ, - (LPBYTE)szBuffer, - dwLength)) + dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR); + if (RegSetValueExW(hKey, + L"AllUsersProfile", + 0, + REG_SZ, + (LPBYTE)szBuffer, + dwLength)) { DPRINT1("Error: %lu\n", GetLastError()); RegCloseKey (hKey); return FALSE; } - RegCloseKey (hKey); + RegCloseKey(hKey); /* Create 'All Users' profile directory */ - wcscpy (szProfilePath, szProfilesPath); - wcscat (szProfilePath, L"\\"); - wcscat (szProfilePath, szBuffer); - if (!CreateDirectoryW (szProfilePath, NULL)) + wcscpy(szProfilePath, szProfilesPath); + wcscat(szProfilePath, L"\\"); + wcscat(szProfilePath, szBuffer); + if (!CreateDirectoryW(szProfilePath, NULL)) { - if (GetLastError () != ERROR_ALREADY_EXISTS) + if (GetLastError() != ERROR_ALREADY_EXISTS) { DPRINT1("Error: %lu\n", GetLastError()); return FALSE; @@ -356,27 +404,37 @@ InitializeProfiles (VOID) } /* Set 'All Users' profile */ - SetEnvironmentVariableW (L"ALLUSERSPROFILE", szProfilePath); + SetEnvironmentVariableW(L"ALLUSERSPROFILE", szProfilePath); /* Create 'All Users' subdirectories */ /* FIXME: Take these paths from the registry */ lpFolderData = &CommonShellFolders[0]; - while (lpFolderData->ValueName != NULL) + while (lpFolderData->lpValueName != NULL) { wcscpy(szBuffer, szProfilePath); 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 (GetLastError () != ERROR_ALREADY_EXISTS) + if (GetLastError() != ERROR_ALREADY_EXISTS) { DPRINT1("Error: %lu\n", GetLastError()); return FALSE; } } - if (lpFolderData->Hidden) + if (lpFolderData->bHidden) { SetFileAttributesW(szBuffer, FILE_ATTRIBUTE_HIDDEN); @@ -397,17 +455,27 @@ InitializeProfiles (VOID) } lpFolderData = &CommonShellFolders[0]; - while (lpFolderData->ValueName != NULL) + while (lpFolderData->lpValueName != NULL) { if (lpFolderData->bShellFolder) { wcscpy(szBuffer, szProfilePath); 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, - lpFolderData->ValueName, + lpFolderData->lpValueName, 0, REG_SZ, (LPBYTE)szBuffer, @@ -436,16 +504,26 @@ InitializeProfiles (VOID) } lpFolderData = &CommonShellFolders[0]; - while (lpFolderData->ValueName != NULL) + while (lpFolderData->lpValueName != NULL) { if (lpFolderData->bUserShellFolder) { 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, - lpFolderData->ValueName, + lpFolderData->lpValueName, 0, REG_EXPAND_SZ, (LPBYTE)szBuffer, @@ -493,19 +571,29 @@ UpdateUsersShellFolderSettings(LPCWSTR lpUserProfilePath, } lpFolderData = &UserShellFolders[0]; - while (lpFolderData->ValueName != NULL) + while (lpFolderData->lpValueName != NULL) { if (lpFolderData->bShellFolder) { wcscpy(szBuffer, lpUserProfilePath); 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, - lpFolderData->ValueName, + lpFolderData->lpValueName, 0, REG_SZ, (LPBYTE)szBuffer, diff --git a/reactos/lib/userenv/userenv.c b/reactos/lib/userenv/userenv.c index 8a74d607e10..5d77a3a812e 100644 --- a/reactos/lib/userenv/userenv.c +++ b/reactos/lib/userenv/userenv.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * PROJECT: ReactOS system libraries @@ -27,6 +27,7 @@ #include "precomp.h" +HINSTANCE hInstance = NULL; BOOL WINAPI DllMain (HINSTANCE hinstDLL, @@ -35,6 +36,7 @@ DllMain (HINSTANCE hinstDLL, { if (fdwReason == DLL_PROCESS_ATTACH) { + hInstance = hinstDLL; } else if (fdwReason == DLL_PROCESS_DETACH) { diff --git a/reactos/lib/userenv/userenv.rc b/reactos/lib/userenv/userenv.rc index 97e26fb53f7..2dfde2ac0d4 100644 --- a/reactos/lib/userenv/userenv.rc +++ b/reactos/lib/userenv/userenv.rc @@ -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 #include -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#include "resources.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL VS_VERSION_INFO VERSIONINFO FILEVERSION 5,1,2600,0 @@ -35,3 +56,13 @@ BEGIN VALUE "Translation", 0x409, 1200 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"