Andreas Mohr wrote:
Does Win9x GetCurrentDirectoryA() really use an IsBadWritePtr to protect
against invalid output buffers?
Somehow I slightly doubt it...
(IsBadWritePtr isn't the fastest thing in the world...)
Well, no. Looking at the disassembly it does about this:
static WINE_EXCEPTION_FILTER(foo)
{
if(GetExceptionCode() & 6)
return EXCEPTION_EXECUTE_HANDLER;
else
return EXCEPTION_CONTINUE_SEARCH;
}
UINT WINAPI GetCurrentDirectoryA( UINT buflen, LPSTR buf )
{
if(buflen > 0)
{
__TRY {
buf[0] += 0;
buf[buflen] += 0;
} __EXCEPT(foo) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
}
...
}
But does the speed-difference really matter for GetCurrentDirectoryA()?
Aren't you covering up a previous bug with buffer allocation or so?
No. WaveMix v1.72 tries to do:
CHAR buf[MAX_PATH];
lstrcpyA(buf + GetCurrentDirectoryA(buf, sizeof(buf)), "\WAVEMIX.INI");
/* sic, they got the argument order wrong */
and since GetCurrentDirectoryA() returns 0 on failure (on Win9x) they
end up with "\WAVEMIX.INI"...
On WinXP it crashes just as in Wine but since we strive for
bug-compatibility...
-flx