Small fix for GetCurrentDirectoryA() (resend)
Felix Nawothnig
felix.nawothnig at t-online.de
Fri Jun 10 09:27:15 CDT 2005
Oops - this time a correct patch including a testcase (tested on Win98 &
WinXP).
ChangeLog:
When emulating Win9x return ERROR_INVALID_PARAMETER if a bad buffer is
passed to GetCurrentDirectoryA() and include a testcase.
-------------- next part --------------
Index: path.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/path.c,v
retrieving revision 1.19
diff -u -r1.19 path.c
--- path.c 1 Mar 2005 10:42:22 -0000 1.19
+++ path.c 10 Jun 2005 14:24:29 -0000
@@ -1313,6 +1313,13 @@
WCHAR bufferW[MAX_PATH];
DWORD ret;
+ /* WaveMix v1.72 depends on this. */
+ if ((GetVersion() & 0x80000000) && IsBadWritePtr(buf, buflen))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
+
ret = GetCurrentDirectoryW(MAX_PATH, bufferW);
if (!ret) return 0;
Index: tests/path.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/path.c,v
retrieving revision 1.29
diff -u -r1.29 path.c
--- tests/path.c 31 May 2005 09:30:45 -0000 1.29
+++ tests/path.c 10 Jun 2005 14:24:32 -0000
@@ -389,6 +389,12 @@
{
CHAR tmpstr[MAX_PATH],tmpstr1[MAX_PATH];
DWORD len,len1;
+
+/* Win9x's GetCurrentDirectoryA checks if the given buffer is writable */
+ if( GetVersion() & 0x80000000 )
+ ok(!GetCurrentDirectoryA(1234, (PCHAR)0xdeadbeef) &&
+ GetLastError() == ERROR_INVALID_PARAMETER,
+ "GetCurrentDirectoryA on Win9x should fail with ERROR_INVALID_PARAMETER when a bad buffer is given");
/* Save the original directory, so that we can return to it at the end
of the test
*/
More information about the wine-patches
mailing list