ipodpatcher: Correct use of FormatMessageA() for windows builds

When called with FORMAT_MESSAGE_ALLOCATE_BUFFER you need to pass in
a pointer to an LPSTR, not the LPSTR itself.

Change-Id: Iecc6d79edceb2142d61034d61364262126957b46
This commit is contained in:
Solomon Peachy 2026-07-04 12:36:38 -04:00
parent 96f1b19149
commit aa4ea8e279

View file

@ -39,33 +39,34 @@
#include "ipodio.h"
static int lock_volume(HANDLE hDisk)
{
static int lock_volume(HANDLE hDisk)
{
DWORD dummy;
return DeviceIoControl(hDisk, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0,
&dummy, NULL);
&dummy, NULL);
}
static int unlock_volume(HANDLE hDisk)
{
static int unlock_volume(HANDLE hDisk)
{
DWORD dummy;
return DeviceIoControl(hDisk, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0,
&dummy, NULL);
}
&dummy, NULL);
}
void ipod_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 ipod_open(struct ipod_t* ipod, int silent)
@ -223,4 +224,3 @@ ssize_t ipod_write(struct ipod_t* ipod, int nbytes)
}
#endif