[ros-diffs] [hpoussin] 28314: Take care of lpProfileInfo->lpProfilePath in LoadUserProfileW Return required size in GetUserProfileDirectoryW if buffer is too small
hpoussin at svn.reactos.org
hpoussin at svn.reactos.org
Mon Aug 13 16:18:49 CEST 2007
Author: hpoussin
Date: Mon Aug 13 18:18:49 2007
New Revision: 28314
URL: http://svn.reactos.org/svn/reactos?rev=28314&view=rev
Log:
Take care of lpProfileInfo->lpProfilePath in LoadUserProfileW
Return required size in GetUserProfileDirectoryW if buffer is too small
Modified:
trunk/reactos/dll/win32/userenv/profile.c
Modified: trunk/reactos/dll/win32/userenv/profile.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/userenv/profile.c?rev=28314&r1=28313&r2=28314&view=diff
==============================================================================
--- trunk/reactos/dll/win32/userenv/profile.c (original)
+++ trunk/reactos/dll/win32/userenv/profile.c Mon Aug 13 18:18:49 2007
@@ -766,7 +766,7 @@
dwLength = wcslen (szImagePath) + 1;
if (*lpcchSize < dwLength)
{
- DPRINT1 ("Buffer too small\n");
+ *lpcchSize = dwLength;
SetLastError (ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
@@ -859,10 +859,18 @@
return TRUE;
}
- if (!GetProfilesDirectoryW(szUserHivePath, &dwLength))
- {
- DPRINT1("GetProfilesDirectoryW() failed (error %ld)\n", GetLastError());
- return FALSE;
+ if (lpProfileInfo->lpProfilePath)
+ {
+ wcscpy(szUserHivePath, lpProfileInfo->lpProfilePath);
+ }
+ else
+ {
+ /* FIXME: check if MS Windows allows lpProfileInfo->lpProfilePath to be NULL */
+ if (!GetProfilesDirectoryW(szUserHivePath, &dwLength))
+ {
+ DPRINT1("GetProfilesDirectoryW() failed (error %ld)\n", GetLastError());
+ return FALSE;
+ }
}
wcscat(szUserHivePath, L"\\");
More information about the Ros-diffs
mailing list