Small fix for GetCurrentDirectoryA()

Alexandre Julliard julliard at winehq.org
Fri Jun 10 12:58:26 CDT 2005


Felix Nawothnig <felix.nawothnig at t-online.de> writes:

> >> (IsBadWritePtr isn't the fastest thing in the world...)
> 
> Just looked at the implementation -  it does at most
> (buflen-1)/pagesize+1 memory-references, and since buflen will be
> MAX_PATH in most cases this just costs us the calling-overhead - which
> is worth the increased readability.

IsBadWritePtr is pretty much always the wrong thing to use, because
it's not thread safe. The right approach is to add an exception
handler directly in the function. Though in this case you could simply
check that the buffer address is not a small integer, it will catch
all instances of that bug (which is probably quite common...) without
the overhead of an exception handler.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list