You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previous issue: #57
PR which was intending to fix that issue: #59
@apolukhin I believe this fix is incorrect. Per the documentation from GetModuleFileNameW (emphasis mine):
If the function succeeds, the return value is the length of the string that is copied to the buffer, in characters, not including the terminating null character. If the buffer is too small to hold the module name, the string is truncated to nSize characters including the terminating null character, the function returns nSize, and the function sets the last error to ERROR_INSUFFICIENT_BUFFER.
The important thing to note here is that the returned size can be non-zero even in failure cases. This appears to not be handled any more, which is the entire purpose of that loop which grows the buffer on each iteration afaict.
Likely the original structure of the code was correct, but what it meant to do instead of calling GetLastError was this: SetLastError(0);
The text was updated successfully, but these errors were encountered:
Previous issue: #57
PR which was intending to fix that issue: #59
@apolukhin I believe this fix is incorrect. Per the documentation from GetModuleFileNameW (emphasis mine):
The important thing to note here is that the returned size can be non-zero even in failure cases. This appears to not be handled any more, which is the entire purpose of that loop which grows the buffer on each iteration afaict.
Likely the original structure of the code was correct, but what it meant to do instead of calling GetLastError was this:
SetLastError(0);
The text was updated successfully, but these errors were encountered: