Skip to content

Commit

Permalink
Fix the crashdump() function in win32 when not compiled with UNICODE
Browse files Browse the repository at this point in the history
`wsprintf` is an hybrid function (a macro) for
- either `char*` version `wsprintfA`
- either `wchar_t*` version `wsprintfW`

depending on `#define UNICODE` or not define UNICODE...

If we use `wsprintf`, then we must use the `TEXT` macro for passing the format literal, and declare filename as `TCHAR*` which also is a macro.<br>
https://docs.microsoft.com/en-us/windows/win32/intl/windows-data-types-for-strings

Here we explicitily use a `wchar_t*`filename and a `wchar_t*`literal format specification, so we want to bypass UNICODE macro and explicitely use `wsprintfW`
  • Loading branch information
nicolas-cellier-aka-nice committed Aug 23, 2022
1 parent 27b3409 commit 1f1edcb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Main.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ crashDumpFile( /* OUT */ WCHAR fileName[])
else
// fall through to dump to vmLogDir
# endif
wsprintf(fileName,L"%s%s",vmLogDirW,L"crash.dmp");
wsprintfW(fileName,L"%s%s",vmLogDirW,L"crash.dmp");
#endif
return fopen_for_append(fileName);
}
Expand Down

1 comment on commit 1f1edcb

@krono
Copy link
Member

@krono krono commented on 1f1edcb Aug 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I should really revisit my windows stuff from pre-2017

Please sign in to comment.