mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 04:37:15 +00:00
Take care of lpProfileInfo->lpProfilePath in LoadUserProfileW
Return required size in GetUserProfileDirectoryW if buffer is too small svn path=/trunk/; revision=28314
This commit is contained in:
parent
e78d113358
commit
c13edbee03
1 changed files with 12 additions and 4 deletions
|
@ -766,7 +766,7 @@ GetUserProfileDirectoryW (HANDLE hToken,
|
||||||
dwLength = wcslen (szImagePath) + 1;
|
dwLength = wcslen (szImagePath) + 1;
|
||||||
if (*lpcchSize < dwLength)
|
if (*lpcchSize < dwLength)
|
||||||
{
|
{
|
||||||
DPRINT1 ("Buffer too small\n");
|
*lpcchSize = dwLength;
|
||||||
SetLastError (ERROR_INSUFFICIENT_BUFFER);
|
SetLastError (ERROR_INSUFFICIENT_BUFFER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -859,10 +859,18 @@ LoadUserProfileW(
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GetProfilesDirectoryW(szUserHivePath, &dwLength))
|
if (lpProfileInfo->lpProfilePath)
|
||||||
{
|
{
|
||||||
DPRINT1("GetProfilesDirectoryW() failed (error %ld)\n", GetLastError());
|
wcscpy(szUserHivePath, lpProfileInfo->lpProfilePath);
|
||||||
return FALSE;
|
}
|
||||||
|
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"\\");
|
wcscat(szUserHivePath, L"\\");
|
||||||
|
|
Loading…
Reference in a new issue