From 1df23470e362acae62adc0a2198b7fa199f8973b Mon Sep 17 00:00:00 2001 From: Tester <66121918+TesterTesterov@users.noreply.github.com> Date: Thu, 30 Dec 2021 11:09:35 +0000 Subject: [PATCH] Bugfix Incorrect handling of the archives with a long namespace fixed. --- ai5win_arc.py | 13 +++++++++++++ setup.py | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ai5win_arc.py b/ai5win_arc.py index b63ad5b..b8161c1 100644 --- a/ai5win_arc.py +++ b/ai5win_arc.py @@ -203,6 +203,19 @@ def hack_size_and_crypto_keys(input_file) -> tuple: good_size = next_offset - start_offset second_key = bad_size ^ good_size + try: + for entry in range(entry_count): + starter = 4 + entry*(8 + bytes_for_name) + input_file.seek(starter, 0) + new_bytes = input_file.read(bytes_for_name) + tester = b'' + for i in new_bytes: + tester += struct.pack('B', i ^ first_key) + tester = tester.rstrip(b'\x00') + tester.decode(SilkyArc.name_encoding) + except UnicodeDecodeError: + continue + if good_size <= 0: continue diff --git a/setup.py b/setup.py index e3e3dc1..c499eea 100644 --- a/setup.py +++ b/setup.py @@ -14,8 +14,8 @@ )] cx_Freeze.setup( - name="SilkyArcTool", - version="1.0", + name="AI5WINArcTool", + version="2.1", description="Dual languaged (rus+eng) tool for packing and unpacking archives of Silky Engine.\n" "Двуязычное средство (рус+англ) для распаковки и запаковки архивов Silky Engine.", options={"build_exe": {"packages": []}},