Commit 8b5c8f6d authored by Felix Nawothnig's avatar Felix Nawothnig Committed by Alexandre Julliard

Add a workaround for Win9x apps which pass the parameters for

GetCurrentDirectoryA in wrong order.
parent db134ece
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment