Felix Nawothnig felix.nawothnig@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.