shell32: Check if token references the current user
Juan Lang
juan.lang at gmail.com
Wed Jan 9 16:21:41 CST 2008
Hi Ge, sorry I missed this. I have some stylistic quibbles with your patch:
+static PSID GetUserFromToken(HANDLE Token)
shellpath.c uses the _ prefix for static functions. It's not pretty,
perhaps, but please be consistent.
@@ -1371,6 +1417,9 @@ static HRESULT _SHGetUserProfilePath(HANDLE
hToken, DWORD dwFlags, BYTE folder,
LPWSTR pszPath)
{
HRESULT hr;
+ PSID UserFromToken;
+ HANDLE ProcessToken;
+ PSID CurrentUser;
These have the wrong scope, as they're only used...
@@ -1391,6 +1441,37 @@ static HRESULT _SHGetUserProfilePath(HANDLE
hToken, DWORD dwFlags, BYTE folder,
*/
if (hToken != NULL && hToken != (HANDLE)-1)
{
+ UserFromToken = GetUserFromToken(hToken);
within this block.
But even fixing this, I think it'd be clearer to do something like the
following:
- if (hToken != NULL && hToken != (HANDLE)-1)
+ if (hToken != NULL && hToken != (HANDLE)-1 &&
!_IsCurrentUserToken(hToken))
That is, make a function that checks whether the token represents the
current user, and returns TRUE if so/FALSE if not.
--Juan
More information about the wine-devel
mailing list