audit: EterBase CRC32/FileBase/MappedFile mapped, with port.utils checks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-30 12:46:43 +09:00
co-authored by Claude Opus 5.5
parent 290a331aef
commit f9b1044a4a
5 changed files with 308 additions and 62 deletions
+3
View File
@@ -603,3 +603,6 @@
{"date": "2026-09-30", "unit": "EterPythonLib/PythonGraphic.cpp", "action": "GenScreenShotTag/SaveJPEG PORTED, SaveScreenShot ADAPTED (next-frame readback via ScreenShotHost)", "evidence": "port.screenshot; desktop grp.SaveScreenShot() -> ~/Documents/METIN2/0930_124051.jpg, colours checked"}
{"date": "2026-09-30", "unit": "EterBase/error.cpp", "action": "N_A (Win32 SEH crash log)", "evidence": "no reader of ErrorLog.txt in source or root .py"}
{"date": "2026-09-30", "unit": "EterPythonLib/PythonGraphic.cpp", "action": "Destroy PORTED, GetD3D ADAPTED, SetOmniLight PORTED, RenderImage/RenderAlphaImage N_A", "evidence": "no callers of RenderImage/RenderAlphaImage; GetD3D covered by port.login_flow resolution check"}
{"date": "2026-09-30", "unit": "EterBase/CRC32.cpp", "action": "GetCaseCRC32 PORTED; GetHFILECRC32/GetFileCRC32/GetFileSize ADAPTED", "evidence": "port.utils CRC32/CFileBase/CMappedFile checks"}
{"date": "2026-09-30", "unit": "EterBase/FileBase.cpp", "action": "all units mapped (FILE* over Win32 HANDLE); stale fstream note corrected", "evidence": "port.utils CRC32/CFileBase/CMappedFile checks"}
{"date": "2026-09-30", "unit": "EterBase/MappedFile.cpp", "action": "Map/Unmap ADAPTED (mmap), rest PORTED verbatim; stale ifstream note corrected", "evidence": "port.utils CRC32/CFileBase/CMappedFile checks"}
+32 -4
View File
@@ -13,16 +13,44 @@
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
},
"GetCaseCRC32": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/CRC32.cpp:GetCaseCRC32"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250 loop (UPPER fold); CRCTable generated from 0xEDB88320, identical to the literal 40250 table."
},
"GetHFILECRC32": {
"status": "TODO"
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/CRC32.cpp:GetHFILECRC32"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "40250 maps the file (CreateFile + CreateFileMapping/MapViewOfFile from offset 0) and CRCs the whole view; the port reads the whole FILE* into a buffer. Invariant: same CRC of the full file, the handle's position is unchanged, 0 when the file cannot be opened."
},
"GetFileCRC32": {
"status": "TODO"
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/CRC32.cpp:GetFileCRC32"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "40250 maps the file (CreateFile + CreateFileMapping/MapViewOfFile from offset 0) and CRCs the whole view; the port reads the whole FILE* into a buffer. Invariant: same CRC of the full file, the handle's position is unchanged, 0 when the file cannot be opened. Callers: GuildMarkUploader/GuildMarkDownloader symbol CRC, root pack CRC report."
},
"GetFileSize": {
"status": "TODO"
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/CRC32.cpp:GetFileSize"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "CreateFile + GetFileSize -> fopen + ftell(SEEK_END); 0 when the file is missing (40250 returns 0 on INVALID_HANDLE_VALUE). Caller: GuildMarkDownloader symbol size."
}
}
}
+89 -23
View File
@@ -5,68 +5,134 @@
"contracts": [],
"functions": {
"CFileBase::CFileBase": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::CFileBase"
],
"status": "ADAPTED",
"note": "platform CFileBase over std::fstream; open falls back to a case-insensitive path match (NTFS spelling)",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Same member initialisation."
},
"CFileBase::~CFileBase": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::~CFileBase"
],
"status": "ADAPTED",
"note": "platform CFileBase over std::fstream; open falls back to a case-insensitive path match (NTFS spelling)",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Same (Destroy)."
},
"CFileBase::GetFileName": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::GetFileName"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim (m_filename)."
},
"CFileBase::Destroy": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::Destroy"
],
"status": "ADAPTED",
"note": "platform CFileBase over std::fstream; open falls back to a case-insensitive path match (NTFS spelling)",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Same (Close, m_dwSize = 0)."
},
"CFileBase::Close": {
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::Close"
],
"status": "ADAPTED",
"note": "platform CFileBase over std::fstream; open falls back to a case-insensitive path match (NTFS spelling)",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "40250 wraps a Win32 HANDLE; the port keeps a stdio FILE* in m_hFile. CloseHandle -> fclose."
},
"CFileBase::Create": {
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::Create"
],
"status": "ADAPTED",
"note": "platform CFileBase over std::fstream; open falls back to a case-insensitive path match (NTFS spelling)",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "40250 wraps a Win32 HANDLE; the port keeps a stdio FILE* in m_hFile. CreateFile modes kept: read = OPEN_EXISTING, write = OPEN_ALWAYS read/write (r+b, else w+b: no truncation). On POSIX a missing exact spelling falls back to a case-insensitive per-component match (NTFS names, e.g. pack/Index 'Etc' for ETC.eix)."
},
"CFileBase::Size": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::Size"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim (m_dwSize)."
},
"CFileBase::SeekCur": {
"status": "TODO"
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::SeekCur"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "40250 wraps a Win32 HANDLE; the port keeps a stdio FILE* in m_hFile. SetFilePointer(FILE_CURRENT) with a NULL high part takes the DWORD as a signed distance -> fseek(LONG(size), SEEK_CUR)."
},
"CFileBase::Seek": {
"status": "TODO"
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::Seek"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "40250 wraps a Win32 HANDLE; the port keeps a stdio FILE* in m_hFile. Clamp to m_dwSize verbatim; SetFilePointer(FILE_BEGIN) -> fseek(SEEK_SET)."
},
"CFileBase::GetPosition": {
"status": "TODO"
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::GetPosition"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "40250 wraps a Win32 HANDLE; the port keeps a stdio FILE* in m_hFile. SetFilePointer(0, FILE_CURRENT) -> ftell."
},
"CFileBase::Write": {
"status": "TODO"
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::Write"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "40250 wraps a Win32 HANDLE; the port keeps a stdio FILE* in m_hFile. WriteFile -> fwrite (false on a short write), then m_dwSize from the stream size as 40250 re-reads GetFileSize."
},
"CFileBase::Read": {
"status": "TODO"
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::Read"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "40250 wraps a Win32 HANDLE; the port keeps a stdio FILE* in m_hFile. ReadFile succeeds on a short read at end of file; fread + !ferror keeps that."
},
"CFileBase::IsNull": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/FileBase.cpp:CFileBase::IsNull"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim (!m_hFile)."
}
}
}
+109 -35
View File
@@ -5,100 +5,174 @@
"contracts": [],
"functions": {
"CMappedFile::CMappedFile": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::CMappedFile"
],
"status": "ADAPTED",
"note": "platform CMappedFile: std::ifstream read into an owned buffer instead of CreateFileMapping/MapViewOfFile; same Create/Map/Link/BindLZObject contract",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::~CMappedFile": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::~CMappedFile"
],
"status": "ADAPTED",
"note": "platform CMappedFile: std::ifstream read into an owned buffer instead of CreateFileMapping/MapViewOfFile; same Create/Map/Link/BindLZObject contract",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::Create": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::Create"
],
"status": "ADAPTED",
"note": "platform CMappedFile: std::ifstream read into an owned buffer instead of CreateFileMapping/MapViewOfFile; same Create/Map/Link/BindLZObject contract",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::Get": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::Get"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::Link": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::Link"
],
"status": "ADAPTED",
"note": "platform CMappedFile: std::ifstream read into an owned buffer instead of CreateFileMapping/MapViewOfFile; same Create/Map/Link/BindLZObject contract",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::BindLZObject": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::BindLZObject"
],
"status": "ADAPTED",
"note": "platform CMappedFile: std::ifstream read into an owned buffer instead of CreateFileMapping/MapViewOfFile; same Create/Map/Link/BindLZObject contract",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::BindLZObjectWithBufferedSize": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::BindLZObjectWithBufferedSize"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::AppendDataBlock": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::AppendDataBlock"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::Destroy": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::Destroy"
],
"status": "ADAPTED",
"note": "platform CMappedFile: std::ifstream read into an owned buffer instead of CreateFileMapping/MapViewOfFile; same Create/Map/Link/BindLZObject contract",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::Seek": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::Seek"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::Map": {
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::Map"
],
"status": "ADAPTED",
"note": "platform CMappedFile: std::ifstream read into an owned buffer instead of CreateFileMapping/MapViewOfFile; same Create/Map/Link/BindLZObject contract",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "CreateFileMapping/MapViewOfFile -> POSIX mmap of the CFileBase stream (Windows build keeps the Win32 calls), view start aligned down to the page size as 40250 aligns to the allocation granularity; a zero-length view maps 1 byte (mmap rejects 0). Invariant: *dest points at file offset `offset`, Size() == the mapped length, a view past the end returns 0."
},
"CMappedFile::GetCurrentSeekPoint": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::GetCurrentSeekPoint"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::Size": {
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::Size"
],
"status": "ADAPTED",
"note": "platform CMappedFile: std::ifstream read into an owned buffer instead of CreateFileMapping/MapViewOfFile; same Create/Map/Link/BindLZObject contract",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::GetPosition": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::GetPosition"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::Read": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::Read"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::GetSeekPosition": {
"status": "TODO"
"status": "PORTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::GetSeekPosition"
],
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "Verbatim 40250."
},
"CMappedFile::Unmap": {
"status": "ADAPTED",
"impl": [
"src/platform/EterBase/MappedFile.cpp:CMappedFile::Unmap"
],
"status": "ADAPTED",
"note": "platform CMappedFile: std::ifstream read into an owned buffer instead of CreateFileMapping/MapViewOfFile; same Create/Map/Link/BindLZObject contract",
"test": "tests/port/port_eterpack_test.cpp (103 packs, 54891 entries, first-registered wins, 4 SECURITY rejects)"
"test": [
"tests/port/port_utils_test.cpp"
],
"note": "CreateFileMapping/MapViewOfFile -> POSIX mmap of the CFileBase stream (Windows build keeps the Win32 calls), view start aligned down to the page size as 40250 aligns to the allocation granularity; a zero-length view maps 1 byte (mmap rejects 0). Invariant: *dest points at file offset `offset`, Size() == the mapped length, a view past the end returns 0."
}
}
}