* 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.9 2004/09/30 20:23:00 ekohl Exp $
+/* $Id: internal.h,v 1.10 2004/10/03 09:27:22 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
/* registry.c */
BOOL
-CreateUserHive (LPCWSTR lpKeyName);
+CreateUserHive (LPCWSTR lpKeyName,
+ LPCWSTR lpProfilePath);
+
+/* setup.c */
+BOOL
+UpdateUsersShellFolderSettings(LPCWSTR lpUserProfilePath,
+ HKEY hUserKey);
#endif /* _INTERNAL_H */
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: profile.c,v 1.13 2004/09/30 20:23:00 ekohl Exp $
+/* $Id: profile.c,v 1.14 2004/10/03 09:27:22 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
HKEY hKey;
NTSTATUS Status;
- DPRINT ("CreateUserProfileW() called\n");
+ DPRINT("CreateUserProfileW() called\n");
if (RegOpenKeyExW (HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
RegCloseKey (hKey);
/* Create user hive name */
- wcscat (szUserProfilePath, L"\\ntuser.dat");
+ wcscpy (szBuffer, szUserProfilePath);
+ wcscat (szBuffer, L"\\ntuser.dat");
/* Create new user hive */
if (RegLoadKeyW (HKEY_USERS,
SidString.Buffer,
- szUserProfilePath))
+ szBuffer))
{
DPRINT1("Error: %lu\n", GetLastError());
RtlFreeUnicodeString (&SidString);
}
/* Initialize user hive */
- if (!CreateUserHive (SidString.Buffer))
+ if (!CreateUserHive (SidString.Buffer, szUserProfilePath))
{
DPRINT1("Error: %lu\n", GetLastError());
RtlFreeUnicodeString (&SidString);
RtlFreeUnicodeString (&SidString);
- DPRINT ("CreateUserProfileW() done\n");
+ DPRINT("CreateUserProfileW() done\n");
return TRUE;
}
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: registry.c,v 1.6 2004/09/30 20:23:00 ekohl Exp $
+/* $Id: registry.c,v 1.7 2004/10/03 09:27:22 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
BOOL
-CreateUserHive (LPCWSTR lpKeyName)
+CreateUserHive (LPCWSTR lpKeyName,
+ LPCWSTR lpProfilePath)
{
HKEY hDefaultKey;
HKEY hUserKey;
- BOOL bResult;
DPRINT ("CreateUserHive(%S) called\n", lpKeyName);
return FALSE;
}
- bResult = CopyKey (hUserKey,
- hDefaultKey);
+ if (!CopyKey(hUserKey, hDefaultKey))
+ {
+ DPRINT1 ("Error: %lu\n", GetLastError());
+ RegCloseKey (hUserKey);
+ RegCloseKey (hDefaultKey);
+ return FALSE;
+ }
+
+ if (!UpdateUsersShellFolderSettings(lpProfilePath,
+ hUserKey))
+ {
+ DPRINT1("Error: %lu\n", GetLastError());
+ RegCloseKey (hUserKey);
+ RegCloseKey (hDefaultKey);
+ return FALSE;
+ }
RegFlushKey (hUserKey);
DPRINT ("CreateUserHive() done\n");
- return bResult;
+ return TRUE;
}
/* EOF */
* 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.8 2004/10/02 12:31:28 ekohl Exp $
+/* $Id: setup.c,v 1.9 2004/10/03 09:27:22 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
RegCloseKey(hKey);
- DPRINT1("Success\n");
+ DPRINT("Success\n");
+
+ return TRUE;
+}
+
+
+BOOL
+UpdateUsersShellFolderSettings(LPCWSTR lpUserProfilePath,
+ HKEY hUserKey)
+{
+ WCHAR szBuffer[MAX_PATH];
+ DWORD dwLength;
+ PFOLDERDATA lpFolderData;
+ HKEY hFoldersKey;
+
+ DPRINT("UpdateUsersShellFolderSettings() called\n");
+
+ DPRINT("User profile path: %S\n", lpUserProfilePath);
+
+ if (RegOpenKeyExW(hUserKey,
+ L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
+ 0,
+ KEY_ALL_ACCESS,
+ &hFoldersKey))
+ {
+ DPRINT1("Error: %lu\n", GetLastError());
+ return FALSE;
+ }
+
+ lpFolderData = &UserShellFolders[0];
+ while (lpFolderData->ValueName != NULL)
+ {
+ if (lpFolderData->bShellFolder)
+ {
+ wcscpy(szBuffer, lpUserProfilePath);
+ wcscat(szBuffer, L"\\");
+ wcscat(szBuffer, lpFolderData->Path);
+
+ DPRINT("%S: %S\n", lpFolderData->ValueName, szBuffer);
+
+ dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR);
+ if (RegSetValueExW(hFoldersKey,
+ lpFolderData->ValueName,
+ 0,
+ REG_SZ,
+ (LPBYTE)szBuffer,
+ dwLength))
+ {
+ DPRINT1("Error: %lu\n", GetLastError());
+ RegCloseKey(hFoldersKey);
+ return FALSE;
+ }
+ }
+
+ lpFolderData++;
+ }
+
+ RegCloseKey(hFoldersKey);
+
+ DPRINT("UpdateUsersShellFolderSettings() done\n");
return TRUE;
}