mirror of
https://github.com/LisherSong/ps5-web-file-manager.git
synced 2026-10-06 07:00:28 +02:00
Host-side verification that the ZIP engine can extract a >4GiB zip64 entry end to end (4.7 GiB fixture, content byte-compared): - tests/compat/sys/statvfs.h: resolve the path before taking the drive letter (relative paths used to fail) and scale f_bavail by 4096 since `unsigned long` is 32-bit on Windows and silently truncated ~250GB down to ~2.3GB; real 64-bit hosts and the PS5 (LP64) are unaffected. - tests/bigfile_e2e.c: standalone driver to extract one large archive and print the engine result (verification via cmp/sha256 by caller). - tests/run-tests.sh: incremental clean instead of `rm -rf` of the whole build tree. - Makefile: force -DHAVE_FSEEKO so minizip uses fseeko/ftello instead of falling back to fseek/ftell on libcs without the probe. Result: 4.7 GiB zip64 extracts OK on host in ~6s, output identical to source. Engine 64-bit write path confirmed clean; PS5 failure needs the strerror passthrough build for real-machine errno capture.
45 lines
1.2 KiB
C
45 lines
1.2 KiB
C
/* Host test shim: provides <sys/statvfs.h> for MinGW hosts.
|
|
Only used when building the test suite (see run-tests.sh). */
|
|
|
|
#ifndef WFM_TEST_SYS_STATVFS_H
|
|
#define WFM_TEST_SYS_STATVFS_H
|
|
|
|
#include <windows.h>
|
|
|
|
struct statvfs {
|
|
unsigned long f_bsize;
|
|
unsigned long f_frsize;
|
|
unsigned long f_blocks;
|
|
unsigned long f_bfree;
|
|
unsigned long f_bavail;
|
|
};
|
|
|
|
static int
|
|
statvfs(const char *path, struct statvfs *buf) {
|
|
ULARGE_INTEGER total;
|
|
ULARGE_INTEGER free_bytes;
|
|
char full[MAX_PATH];
|
|
char root[8];
|
|
|
|
/* Resolve to an absolute path first: the drive-letter extraction below
|
|
only works for "X:\..." style paths, and callers may pass relative
|
|
paths (e.g. the standalone bigfile_e2e driver). */
|
|
if(!GetFullPathNameA(path, (DWORD)sizeof(full), full, NULL)) {
|
|
return -1;
|
|
}
|
|
snprintf(root, sizeof(root), "%.3s", full);
|
|
if(!GetDiskFreeSpaceExA(root, &free_bytes, &total, NULL)) {
|
|
return -1;
|
|
}
|
|
memset(buf, 0, sizeof(*buf));
|
|
/* `unsigned long` is 32-bit on Windows: store free space scaled by 4096
|
|
so archives up to 16 TiB don't overflow (real 64-bit hosts are LP64
|
|
and unaffected; PS5 SDK is LP64 too). */
|
|
buf->f_bsize = 4096;
|
|
buf->f_frsize = 4096;
|
|
buf->f_bavail = free_bytes.QuadPart / 4096;
|
|
return 0;
|
|
}
|
|
|
|
#endif
|