[ros-diffs] [cfinck] 39305: Merge 39294, 39295, 39304 Now ScummVM and probably some more apps work under ReactOS 0.3.8 :-)

cfinck at svn.reactos.org cfinck at svn.reactos.org
Tue Feb 3 11:03:25 CET 2009


Author: cfinck
Date: Tue Feb  3 04:03:24 2009
New Revision: 39305

URL: http://svn.reactos.org/svn/reactos?rev=39305&view=rev
Log:
Merge 39294, 39295, 39304
Now ScummVM and probably some more apps work under ReactOS 0.3.8 :-)

Modified:
    branches/ros-branch-0_3_8/reactos/base/system/winlogon/sas.c
    branches/ros-branch-0_3_8/reactos/base/system/winlogon/winlogon.h
    branches/ros-branch-0_3_8/reactos/base/system/winlogon/winlogon.rbuild
    branches/ros-branch-0_3_8/reactos/dll/win32/shell32/precomp.h
    branches/ros-branch-0_3_8/reactos/dll/win32/shell32/shellpath.c

Modified: branches/ros-branch-0_3_8/reactos/base/system/winlogon/sas.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_8/reactos/base/system/winlogon/sas.c?rev=39305&r1=39304&r2=39305&view=diff
==============================================================================
--- branches/ros-branch-0_3_8/reactos/base/system/winlogon/sas.c [iso-8859-1] (original)
+++ branches/ros-branch-0_3_8/reactos/base/system/winlogon/sas.c [iso-8859-1] Tue Feb  3 04:03:24 2009
@@ -175,6 +175,9 @@
 	SIZE_T EnvBlockSize = 0, ProfileSize = 0;
 	BOOLEAN Old;
 	BOOL ret = FALSE;
+	UNICODE_STRING VariableName;
+	UNICODE_STRING VariableValue;
+	WCHAR AppDataPath[MAX_PATH];
 
 	/* Loading personal settings */
 	DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_LOADINGYOURPERSONALSETTINGS);
@@ -218,6 +221,18 @@
 		WARN("WL: CreateEnvironmentBlock() failed\n");
 		goto cleanup;
 	}
+
+	/* Use SHGetFolderPathW for getting the AppData path */
+	if(SHGetFolderPathW(NULL, CSIDL_APPDATA, Session->UserToken, SHGFP_TYPE_CURRENT, AppDataPath) == E_FAIL)
+	{
+		WARN("WL: SHGetFolderPathW() failed\n");
+		goto cleanup;
+	}
+
+	/* Some environment variables need to be set by winlogon (verified against Windows XP winlogon) */
+	RtlInitUnicodeString(&VariableName, L"APPDATA");
+	RtlInitUnicodeString(&VariableValue, AppDataPath);
+	RtlSetEnvironmentVariable((PWSTR*)&lpEnvironment, &VariableName, &VariableValue);
 
 	if (Session->Profile->dwType == WLX_PROFILE_TYPE_V2_0 && Session->Profile->pszEnvironment)
 	{
@@ -263,6 +278,8 @@
 
 	DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS);
 	UpdatePerUserSystemParameters(0, TRUE);
+
+	/* FIXME: Set the "Volatile Environment" key for the new user */
 
 	/* Set default language */
 	if (!SetDefaultLanguage(TRUE))

Modified: branches/ros-branch-0_3_8/reactos/base/system/winlogon/winlogon.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_8/reactos/base/system/winlogon/winlogon.h?rev=39305&r1=39304&r2=39305&view=diff
==============================================================================
--- branches/ros-branch-0_3_8/reactos/base/system/winlogon/winlogon.h [iso-8859-1] (original)
+++ branches/ros-branch-0_3_8/reactos/base/system/winlogon/winlogon.h [iso-8859-1] Tue Feb  3 04:03:24 2009
@@ -39,6 +39,7 @@
 #include <ntsecapi.h>
 #include <accctrl.h>
 #include <aclapi.h>
+#include <shlobj.h>
 
 #include <reactos/winlogon.h>
 

Modified: branches/ros-branch-0_3_8/reactos/base/system/winlogon/winlogon.rbuild
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_8/reactos/base/system/winlogon/winlogon.rbuild?rev=39305&r1=39304&r2=39305&view=diff
==============================================================================
--- branches/ros-branch-0_3_8/reactos/base/system/winlogon/winlogon.rbuild [iso-8859-1] (original)
+++ branches/ros-branch-0_3_8/reactos/base/system/winlogon/winlogon.rbuild [iso-8859-1] Tue Feb  3 04:03:24 2009
@@ -9,6 +9,7 @@
 	<library>advapi32</library>
 	<library>userenv</library>
 	<library>secur32</library>
+	<library>shell32</library>
 	<file>sas.c</file>
 	<file>screensaver.c</file>
 	<file>setup.c</file>

Modified: branches/ros-branch-0_3_8/reactos/dll/win32/shell32/precomp.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_8/reactos/dll/win32/shell32/precomp.h?rev=39305&r1=39304&r2=39305&view=diff
==============================================================================
--- branches/ros-branch-0_3_8/reactos/dll/win32/shell32/precomp.h [iso-8859-1] (original)
+++ branches/ros-branch-0_3_8/reactos/dll/win32/shell32/precomp.h [iso-8859-1] Tue Feb  3 04:03:24 2009
@@ -45,7 +45,7 @@
 #include <ndk/ntndk.h>
 #include <fmifs/fmifs.h>
 #include <largeint.h>
-
+#include <sddl.h>
 
 #include "base/shell/explorer-new/todo.h"
 #include "dlgs.h"

Modified: branches/ros-branch-0_3_8/reactos/dll/win32/shell32/shellpath.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_8/reactos/dll/win32/shell32/shellpath.c?rev=39305&r1=39304&r2=39305&view=diff
==============================================================================
--- branches/ros-branch-0_3_8/reactos/dll/win32/shell32/shellpath.c [iso-8859-1] (original)
+++ branches/ros-branch-0_3_8/reactos/dll/win32/shell32/shellpath.c [iso-8859-1] Tue Feb  3 04:03:24 2009
@@ -1355,47 +1355,75 @@
 
     if (folder >= sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]))
         return E_INVALIDARG;
+
     if (CSIDL_Data[folder].type != CSIDL_Type_User)
         return E_INVALIDARG;
+
     if (!pszPath)
         return E_INVALIDARG;
 
-    /* Only the current user and the default user are supported right now
-     * I'm afraid.
-     * FIXME: should be able to call GetTokenInformation on the token,
-     * then call ConvertSidToStringSidW on it to get the user prefix.
-     * But Wine's registry doesn't store user info by sid, it stores it
-     * by user name (and I don't know how to convert from a token to a
-     * user name).
-     */
-    if (hToken != NULL && hToken != (HANDLE)-1)
-    {
-        FIXME("unsupported for user other than current or default\n");
-        return E_FAIL;
-    }
-
     if (dwFlags & SHGFP_TYPE_DEFAULT)
+    {
         hr = _SHGetDefaultValue(folder, pszPath);
+    }
     else
     {
-        LPCWSTR userPrefix = NULL;
+        LPWSTR userPrefix;
         HKEY hRootKey;
 
         if (hToken == (HANDLE)-1)
         {
+            /* Get the folder of the default user */
             hRootKey = HKEY_USERS;
-            userPrefix = DefaultW;
-        }
-        else /* hToken == NULL, other values disallowed above */
+            userPrefix = (LPWSTR)DefaultW;
+        }
+        else if(!hToken)
+        {
+            /* Get the folder of the current user */
             hRootKey = HKEY_CURRENT_USER;
-        hr = _SHGetUserShellFolderPath(hRootKey, userPrefix,
-         CSIDL_Data[folder].szValueName, pszPath);
+            userPrefix = NULL;
+        }
+        else
+        {
+            /* Get the folder of the specified user */
+            DWORD InfoLength;
+            PTOKEN_USER UserInfo;
+
+            hRootKey = HKEY_USERS;
+
+            GetTokenInformation(hToken, TokenUser, NULL, 0, &InfoLength);
+            UserInfo = (PTOKEN_USER)HeapAlloc(GetProcessHeap(), 0, InfoLength);
+
+            if(!GetTokenInformation(hToken, TokenUser, UserInfo, InfoLength, &InfoLength))
+            {
+                WARN("GetTokenInformation failed for %x!\n", hToken);
+                HeapFree(GetProcessHeap(), 0, UserInfo);
+                return E_FAIL;
+            }
+
+            if(!ConvertSidToStringSidW(UserInfo->User.Sid, &userPrefix))
+            {
+                WARN("ConvertSidToStringSidW failed for %x!\n", hToken);
+                HeapFree(GetProcessHeap(), 0, UserInfo);
+                return E_FAIL;
+            }
+
+            HeapFree(GetProcessHeap(), 0, UserInfo);
+        }
+
+        hr = _SHGetUserShellFolderPath(hRootKey, userPrefix, CSIDL_Data[folder].szValueName, pszPath);
+
+        /* Free the memory allocated by ConvertSidToStringSidW */
+        if(hToken && hToken != (HANDLE)-1)
+            LocalFree(userPrefix);
+
         if (FAILED(hr) && hRootKey != HKEY_LOCAL_MACHINE)
-            hr = _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE, NULL,
-             CSIDL_Data[folder].szValueName, pszPath);
+            hr = _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE, NULL, CSIDL_Data[folder].szValueName, pszPath);
+
         if (FAILED(hr))
             hr = _SHGetDefaultValue(folder, pszPath);
     }
+
     TRACE("returning 0x%08x (output path is %s)\n", hr, debugstr_w(pszPath));
     return hr;
 }



More information about the Ros-diffs mailing list