windows: Workaround for WinXP systems.
This commit is contained in:
parent
fa34bb479d
commit
81bb11ddbc
|
@ -572,11 +572,20 @@ char *__PHYSFS_platformCalcUserDir(void)
|
||||||
/*
|
/*
|
||||||
* Should fail. Will write the size of the profile path in
|
* Should fail. Will write the size of the profile path in
|
||||||
* psize. Also note that the second parameter can't be
|
* psize. Also note that the second parameter can't be
|
||||||
* NULL or the function fails.
|
* NULL or the function fails on Windows XP, but has to be NULL on
|
||||||
|
* Windows 10 or it will fail. :(
|
||||||
*/
|
*/
|
||||||
rc = pGetDir(accessToken, NULL, &psize);
|
rc = pGetDir(accessToken, NULL, &psize);
|
||||||
GOTO_IF(rc, PHYSFS_ERR_OS_ERROR, done); /* should have failed! */
|
GOTO_IF(rc, PHYSFS_ERR_OS_ERROR, done); /* should have failed! */
|
||||||
|
|
||||||
|
if (psize == 0) /* probably on Windows XP, try a different way. */
|
||||||
|
{
|
||||||
|
char x = 0;
|
||||||
|
rc = pGetDir(accessToken, &x, &psize);
|
||||||
|
GOTO_IF(rc, PHYSFS_ERR_OS_ERROR, done); /* should have failed! */
|
||||||
|
GOTO_IF(!psize, PHYSFS_ERR_OS_ERROR, done); /* Uhoh... */
|
||||||
|
} /* if */
|
||||||
|
|
||||||
/* Allocate memory for the profile directory */
|
/* Allocate memory for the profile directory */
|
||||||
wstr = (LPWSTR) __PHYSFS_smallAlloc((psize + 1) * sizeof (WCHAR));
|
wstr = (LPWSTR) __PHYSFS_smallAlloc((psize + 1) * sizeof (WCHAR));
|
||||||
if (wstr != NULL)
|
if (wstr != NULL)
|
||||||
|
|
Loading…
Reference in New Issue