diff --git a/pycdc/pyarmor-1shot.cpp b/pycdc/pyarmor-1shot.cpp index 6fc0eff..e0faf09 100644 --- a/pycdc/pyarmor-1shot.cpp +++ b/pycdc/pyarmor-1shot.cpp @@ -76,12 +76,15 @@ int main(int argc, char* argv[]) const char* dispname = strrchr(infile, PATHSEP); dispname = (dispname == NULL) ? infile : dispname + 1; + const char* disp_prefix = strrchr(prefix_name.c_str(), PATHSEP); + disp_prefix = (disp_prefix == NULL) ? prefix_name.c_str() : disp_prefix + 1; formatted_print( das_out_file, - R"(# Disassembly generated by Pyarmor-Static-Unpack-1shot (%s), powered by pycdas -# File: %s (Python %d.%d) + R"(# File: %s (Python %d.%d) +# Disassembly generated by Pyarmor-Static-Unpack-1shot (%s), powered by pycdas +# ================================ # Pyarmor notes: # - Pyarmor bytecode and code objects match standard Python, but special calls to Pyarmor runtime functions exist. # - Calls on strings are not mistakes but markers, which are processed by Pyarmor at runtime. @@ -89,18 +92,19 @@ int main(int argc, char* argv[]) # Decompilation guidance (without runtime): # 1. Ignore encrypted bytes after `#`; use only the string before `#`. # 2. Remove `"__pyarmor_enter_xxx__"(b"...")` and `"__pyarmor_leave_xxx__"(b"...")` (prologue/epilogue). -# 3. For `"__pyarmor_assert_xxx__"(A)`, it is not a real assert statement. +# 3. `"__pyarmor_assert_xxx__"(A)` is not a real assert statement. # - If `A` is a name or readable string: replace with `A`. # - If `A` is `(X, "Y")`: replace with `X.Y`. # - If `A` is `(X, "Y", Z)`: replace with `X.Y = Z`. # - Otherwise: choose the most reasonable replacement. # 4. `"__pyarmor_bcc_xxx__"(...)` indicates native code; function body is not available. Add a comment. +# ================================ )", - VERSION, dispname, mod.majorVer(), - mod.minorVer() + mod.minorVer(), + VERSION ); try { output_object(mod.code().try_cast(), &mod, 0, disasm_flags, @@ -115,18 +119,18 @@ int main(int argc, char* argv[]) formatted_print( dc_out_file, - R"(# Source generated by Pyarmor-Static-Unpack-1shot (%s), powered by Decompyle++ (pycdc) -# File: %s (Python %d.%d) + R"(# File: %s (Python %d.%d) +# Source generated by Pyarmor-Static-Unpack-1shot (%s), powered by Decompyle++ (pycdc) # Note: Decompiled code can be incomplete and incorrect. # Please also check the correct and complete disassembly file: %s.das )", - VERSION, dispname, mod.majorVer(), mod.minorVer(), - prefix_name.c_str() + VERSION, + disp_prefix ); try { decompyle(mod.code(), &mod, dc_out_file);