Add a workaround for Win9x apps which pass the parameters for
GetCurrentDirectoryA in wrong order.
This commit is contained in:
parent
db134ece39
commit
8b5c8f6d7f
|
@ -1313,6 +1313,17 @@ UINT WINAPI GetCurrentDirectoryA( UINT buflen, LPSTR buf )
|
|||
WCHAR bufferW[MAX_PATH];
|
||||
DWORD ret;
|
||||
|
||||
if (buflen && buf && !HIWORD(buf))
|
||||
{
|
||||
/* Win9x catches access violations here, returning zero.
|
||||
* This behaviour resulted in some people not noticing
|
||||
* that they got the argument order wrong. So let's be
|
||||
* nice and fail gracefully if buf is invalid and looks
|
||||
* more like a buflen (which is probably MAX_PATH). */
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = GetCurrentDirectoryW(MAX_PATH, bufferW);
|
||||
|
||||
if (!ret) return 0;
|
||||
|
|
Loading…
Reference in New Issue