From b54b10dc6db2af78bb6aebfc1bfe541f98e68b70 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sat, 4 Jul 2026 13:04:05 -0400 Subject: [PATCH] sansapatcher: Correct use of FormatMessageA() for windows builds Change-Id: I3e026400fa0440221b4fd6d8c96f515737e36433 --- utils/sansapatcher/sansaio-win32.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/utils/sansapatcher/sansaio-win32.c b/utils/sansapatcher/sansaio-win32.c index 867c7c183d..6280e40911 100644 --- a/utils/sansapatcher/sansaio-win32.c +++ b/utils/sansapatcher/sansaio-win32.c @@ -60,12 +60,13 @@ void sansa_print_error(char* msg) LPSTR pMsgBuf = NULL; printf(msg); - FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | + if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), pMsgBuf, - 0, NULL); - printf(pMsgBuf); - LocalFree(pMsgBuf); + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&pMsgBuf, + 0, NULL)) { + printf(pMsgBuf); + LocalFree(pMsgBuf); + } } int sansa_open(struct sansa_t* sansa, int silent) @@ -214,4 +215,3 @@ int sansa_write(struct sansa_t* sansa, int nbytes) return count; } #endif -