在 2025-11-25 01:48, Pali Rohár 写道:
Use the correct structure for passing 64-bit offset: LARGE_INTEGER. --- mingw-w64-crt/testcases/t_fseeko64.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)diff --git a/mingw-w64-crt/testcases/t_fseeko64.c b/mingw-w64-crt/testcases/t_fseeko64.c index d33cb12e37e4..28801def2c35 100644 --- a/mingw-w64-crt/testcases/t_fseeko64.c +++ b/mingw-w64-crt/testcases/t_fseeko64.c @@ -8,14 +8,11 @@ static const char *writebuf = "TESTVECTORSTRING"; static char szPath[MAX_PATH];static int writefile(const char *path){- OVERLAPPED ov; + LARGE_INTEGER li = { .QuadPart = 0x10000 }; DWORD dwResult; - memset(&ov,0,sizeof(OVERLAPPED)); - ov.Offset = 0x0; - ov.OffsetHigh = 0x1; HANDLE fd = CreateFileA(path,GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (fd == INVALID_HANDLE_VALUE) return 1; - if (SetFilePointer(fd, ov.Offset, &ov.OffsetHigh, FILE_BEGIN) == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) { + if (SetFilePointer(fd, li.LowPart, &li.HighPart, FILE_BEGIN) == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) { printf("writefile: seek failed: winerror=%lu\n", GetLastError()); CloseHandle(fd); return 1;
This changes the file pointer and causes `fread()` later to fail. I think you meant `.QuadPart = 0x100000000`?
If the file pointer is represented as a `LARGE_INTEGER`, it's probably better to call `SetFilePointerEx()`. -- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
