From cd662ceb54a2638dbc43031347402a7139621907 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sat, 1 Jul 2023 00:30:23 -0400
Subject: [PATCH] rwops: Use SetFilePointerEx on Windows for appending writes.
Fixes #7900.
(cherry picked from commit 769bf2ebcca8f0cbcde4ec50008942f4eda57f4a)
---
src/file/SDL_rwops.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c
index e5a16743b373..87307ab8ab7d 100644
--- a/src/file/SDL_rwops.c
+++ b/src/file/SDL_rwops.c
@@ -277,8 +277,9 @@ windows_file_write(SDL_RWops *context, const void *ptr, size_t size,
/* if in append mode, we must go to the EOF before write */
if (context->hidden.windowsio.append) {
- if (SetFilePointer(context->hidden.windowsio.h, 0L, NULL, FILE_END) ==
- INVALID_SET_FILE_POINTER) {
+ LARGE_INTEGER windowsoffset;
+ windowsoffset.QuadPart = 0;
+ if (!SetFilePointerEx(context->hidden.windowsio.h, windowsoffset, &windowsoffset, FILE_END)) {
SDL_Error(SDL_EFWRITE);
return 0;
}