"Justin Santa Barbara" justinsb@hotmail.com writes:
As I see it, the advantage of a helper function is that for about the same amount of work of fixing GetSystemDirectory and GetCurrentDirectory, all the functions should work the same way meaning any bugs would quickly be found. It might also be possible to optimize the case where buflen=0, while this isn't practical per-function. Should I offer a patch only for wine/files/* ?
I'm afraid there are too many variations to make this useful. It would be nice if all APIs that return strings behaved the same way, but unfortunately this is not the case: some count the terminating null, some don't, some copy partial strings when the buffer is too small, some don't copy anything, etc. We would need about as many helpers as there are API functions. Also be aware that the MSDN doc cannot be trusted at all on this matter, the correct behavior needs to be verified for each function.