http://bugs.winehq.org/show_bug.cgi?id=59449 Bug ID: 59449 Summary: FormatMessageW fails for well-formed function call and crashes application Product: Wine Version: 11.1 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@list.winehq.org Reporter: and44more@gmail.com Distribution: --- Created attachment 80433 --> http://bugs.winehq.org/attachment.cgi?id=80433 C++ code to demonstrate it This isn't really a bug, but more a missing error message. The FormatMessageW (winbase.h) function fails if given the valid error code CRYPT_E_NO_MATCH as an argument (see attached code snippet). It returns 0 indicating an error and does not modify the lpBuffer pointer argument. Applications that assume that FormatMessageW will allocate the error message at the memory address lpBuffer is pointing to will crash (like in my case) if they initalized lpBuffer with 0 before. Technically, this is the fault of the application since it assumed that FormatMessageW will not return an error if given a well-formed function call, but wine is missing the error message in the first place and that should be fixed. I'd also like to propose setting lpBuffer to a pointer to an empty string (null character) instead of not modifying it when FormatMessageW fails. (Create a global empty string variable instead of allocating memory each time). This behavior would adhere to the FormatMessageW documentation and would make applications with missing error checks more fail safe in this case. I'm using linux mint 22.1 with wine 9.0, but I also tested the attached code snippet in linux arch with wine 11.1. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.