From c5059231dc30eaafdbfd830289d6643f92d3d659 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Sun, 12 Feb 2023 18:58:11 +0100 Subject: [PATCH] all: rename win32/arm back to wince/arm --- NEWS | 4 +- src/conf.h | 2 +- src/{p_w32pe_arm.cpp => p_wince_arm.cpp} | 50 +++++++++---------- src/{p_w32pe_arm.h => p_wince_arm.h} | 14 +++--- src/packmast.cpp | 4 +- src/pefile.cpp | 6 +-- src/pefile.h | 9 ++-- src/stub/Makefile | 22 ++++---- ...{arm.v4a-win32.pe.h => arm.v4a-wince.pe.h} | 12 ++--- ...{arm.v4t-win32.pe.h => arm.v4t-wince.pe.h} | 12 ++--- ...{arm.v4a-win32.pe.S => arm.v4a-wince.pe.S} | 2 +- ...{arm.v4t-win32.pe.S => arm.v4t-wince.pe.S} | 2 +- ....pe.bin.dump => arm.v4a-wince.pe.bin.dump} | 0 ....pe.bin.dump => arm.v4t-wince.pe.bin.dump} | 0 14 files changed, 70 insertions(+), 69 deletions(-) rename src/{p_w32pe_arm.cpp => p_wince_arm.cpp} (84%) rename src/{p_w32pe_arm.h => p_wince_arm.h} (90%) rename src/stub/{arm.v4a-win32.pe.h => arm.v4a-wince.pe.h} (99%) rename src/stub/{arm.v4t-win32.pe.h => arm.v4t-wince.pe.h} (99%) rename src/stub/src/{arm.v4a-win32.pe.S => arm.v4a-wince.pe.S} (99%) rename src/stub/src/{arm.v4t-win32.pe.S => arm.v4t-wince.pe.S} (99%) rename src/stub/tmp/{arm.v4a-win32.pe.bin.dump => arm.v4a-wince.pe.bin.dump} (100%) rename src/stub/tmp/{arm.v4t-win32.pe.bin.dump => arm.v4t-wince.pe.bin.dump} (100%) diff --git a/NEWS b/NEWS index 6c80e6f7..22d3947a 100644 --- a/NEWS +++ b/NEWS @@ -152,7 +152,7 @@ Changes in 2.92 beta (23 Jan 2007): Changes in 2.91 beta (29 Nov 2006): * assorted bug fixes - * win32/arm: fix "missing" icon & version info resource problem for WinCE 5 + * wince/arm: fix "missing" icon & version info resource problem for WinCE 5 * win32/pe & arm/pe: added option --compress-icons=3 to compress all icons Changes in 2.90 beta (08 Oct 2006): @@ -206,7 +206,7 @@ Changes in 1.95 beta (09 Apr 2006): * win32/pe: really worked around R6002 runtime errors Changes in 1.94 beta (11 Mar 2006): - * new format: added support for win32/arm (ARM executables running on WinCE) + * new format: added support for wince/arm (ARM executables running on WinCE) * new format: added support for linux elf/amd64 * new format: added support for linux elf/ppc32 * new format: added support for mach/ppc32 (Apple Mac OS X) diff --git a/src/conf.h b/src/conf.h index 43c8f30f..ec46e8a1 100644 --- a/src/conf.h +++ b/src/conf.h @@ -539,7 +539,7 @@ constexpr bool string_ge(const char *a, const char *b) { #define UPX_F_PS1_EXE 18 #define UPX_F_VMLINUX_i386 19 #define UPX_F_LINUX_ELFI_i386 20 -#define UPX_F_W32PE_ARM 21 +#define UPX_F_WINCE_ARM 21 // Windows CE #define UPX_F_LINUX_ELF64_AMD64 22 #define UPX_F_LINUX_ELF32_ARM 23 #define UPX_F_BSD_i386 24 diff --git a/src/p_w32pe_arm.cpp b/src/p_wince_arm.cpp similarity index 84% rename from src/p_w32pe_arm.cpp rename to src/p_wince_arm.cpp index d15ce71a..e12f0296 100644 --- a/src/p_w32pe_arm.cpp +++ b/src/p_wince_arm.cpp @@ -1,4 +1,4 @@ -/* p_w32pe_arm.cpp -- +/* p_wince_arm.cpp -- This file is part of the UPX executable compressor. @@ -30,25 +30,25 @@ #include "filter.h" #include "packer.h" #include "pefile.h" -#include "p_w32pe_arm.h" +#include "p_wince_arm.h" #include "linker.h" static const CLANG_FORMAT_DUMMY_STATEMENT -#include "stub/arm.v4a-win32.pe.h" +#include "stub/arm.v4a-wince.pe.h" static const CLANG_FORMAT_DUMMY_STATEMENT -#include "stub/arm.v4t-win32.pe.h" +#include "stub/arm.v4t-wince.pe.h" /************************************************************************* // **************************************************************************/ -PackW32PeArm::PackW32PeArm(InputFile *f) : super(f) {} +PackWinCeArm::PackWinCeArm(InputFile *f) : super(f) {} -PackW32PeArm::~PackW32PeArm() {} +PackWinCeArm::~PackWinCeArm() {} -Linker *PackW32PeArm::newLinker() const { return new ElfLinkerArmLE; } +Linker *PackWinCeArm::newLinker() const { return new ElfLinkerArmLE; } -const int *PackW32PeArm::getCompressionMethods(int method, int level) const { +const int *PackWinCeArm::getCompressionMethods(int method, int level) const { static const int m_all[] = {M_NRV2B_8, M_NRV2E_8, M_LZMA, M_END}; static const int m_lzma[] = {M_LZMA, M_END}; static const int m_nrv2b[] = {M_NRV2B_8, M_END}; @@ -68,7 +68,7 @@ const int *PackW32PeArm::getCompressionMethods(int method, int level) const { return m_nrv2e; } -const int *PackW32PeArm::getFilters() const { +const int *PackWinCeArm::getFilters() const { static const int filters[] = {0x50, FT_END}; return filters; } @@ -77,7 +77,7 @@ const int *PackW32PeArm::getFilters() const { // import handling **************************************************************************/ -void PackW32PeArm::processImports2(unsigned myimport, unsigned iat_off) // pass 2 +void PackWinCeArm::processImports2(unsigned myimport, unsigned iat_off) // pass 2 { PeFile::processImports2(myimport, iat_off); @@ -89,7 +89,7 @@ void PackW32PeArm::processImports2(unsigned myimport, unsigned iat_off) // pass } } -void PackW32PeArm::addStubImports() { +void PackWinCeArm::addStubImports() { // the order of procedure names below should match the // assumptions of the assembly stubs // WARNING! these names are sorted alphanumerically by the ImportLinker @@ -98,12 +98,12 @@ void PackW32PeArm::addStubImports() { addKernelImport("LoadLibraryW"); } -void PackW32PeArm::processTls(Interval *) // pass 1 +void PackWinCeArm::processTls(Interval *) // pass 1 { if ((sotls = ALIGN_UP(IDSIZE(PEDIR_TLS), 4u)) == 0) return; - // never should happen on win32/arm + // never should happen on wince/arm throwCantPack("Static TLS entries found. Send a report please."); } @@ -111,7 +111,7 @@ void PackW32PeArm::processTls(Interval *) // pass 1 // pack **************************************************************************/ -bool PackW32PeArm::canPack() { +bool PackWinCeArm::canPack() { if (!readFileHeader()) return false; if (ih.cpu != IMAGE_FILE_MACHINE_ARM && ih.cpu != IMAGE_FILE_MACHINE_THUMB) @@ -121,9 +121,9 @@ bool PackW32PeArm::canPack() { return true; } -void PackW32PeArm::buildLoader(const Filter *ft) { - const unsigned char *loader = use_thumb_stub ? stub_arm_v4t_win32_pe : stub_arm_v4a_win32_pe; - unsigned size = use_thumb_stub ? sizeof(stub_arm_v4t_win32_pe) : sizeof(stub_arm_v4a_win32_pe); +void PackWinCeArm::buildLoader(const Filter *ft) { + const unsigned char *loader = use_thumb_stub ? stub_arm_v4t_wince_pe : stub_arm_v4a_wince_pe; + unsigned size = use_thumb_stub ? sizeof(stub_arm_v4t_wince_pe) : sizeof(stub_arm_v4a_wince_pe); // prepare loader initLoader(loader, size); @@ -162,7 +162,7 @@ void PackW32PeArm::buildLoader(const Filter *ft) { addLoader("IDENTSTR,UPX1HEAD"); } -bool PackW32PeArm::needForceOption() const { +bool PackWinCeArm::needForceOption() const { // return true if we need `--force` to pack this file bool r = false; r |= (ih.opthdrsize != 0xe0); @@ -174,7 +174,7 @@ bool PackW32PeArm::needForceOption() const { return r; } -void PackW32PeArm::callCompressWithFilters(Filter &ft, int filter_strategy, unsigned ih_codebase) { +void PackWinCeArm::callCompressWithFilters(Filter &ft, int filter_strategy, unsigned ih_codebase) { // limit stack size needed for runtime decompression upx_compress_config_t cconf; cconf.reset(); @@ -182,7 +182,7 @@ void PackW32PeArm::callCompressWithFilters(Filter &ft, int filter_strategy, unsi compressWithFilters(&ft, 2048, &cconf, filter_strategy, ih_codebase, rvamin, 0, nullptr, 0); } -void PackW32PeArm::addNewRelocations(Reloc &rel, unsigned upxsection) { +void PackWinCeArm::addNewRelocations(Reloc &rel, unsigned upxsection) { static const char *const symbols_to_relocate[] = {"ONAM", "BIMP", "BREL", "FIBE", "FIBS", "ENTR", "DST0", "SRC0"}; for (unsigned s2r = 0; s2r < TABLESIZE(symbols_to_relocate); s2r++) { @@ -192,11 +192,11 @@ void PackW32PeArm::addNewRelocations(Reloc &rel, unsigned upxsection) { } } -unsigned PackW32PeArm::getProcessImportParam(unsigned upxsection) { +unsigned PackWinCeArm::getProcessImportParam(unsigned upxsection) { return linker->getSymbolOffset("IATT") + upxsection; } -void PackW32PeArm::defineSymbols(unsigned ncsection, unsigned, unsigned, unsigned ic, +void PackWinCeArm::defineSymbols(unsigned ncsection, unsigned, unsigned, unsigned ic, unsigned s1addr) { const unsigned onam = ncsection + soxrelocs + ih.imagebase; linker->defineSymbol("start_of_dll_names", onam); @@ -212,13 +212,13 @@ void PackW32PeArm::defineSymbols(unsigned ncsection, unsigned, unsigned, unsigne defineDecompressorSymbols(); } -void PackW32PeArm::setOhDataBase(const pe_section_t *osection) { oh.database = osection[2].vaddr; } +void PackWinCeArm::setOhDataBase(const pe_section_t *osection) { oh.database = osection[2].vaddr; } -void PackW32PeArm::setOhHeaderSize(const pe_section_t *osection) { +void PackWinCeArm::setOhHeaderSize(const pe_section_t *osection) { oh.headersize = osection[1].rawdataptr; } -void PackW32PeArm::pack(OutputFile *fo) { +void PackWinCeArm::pack(OutputFile *fo) { super::pack0(fo, (1u << IMAGE_SUBSYSTEM_WINDOWS_CE_GUI), 0x10000, true); } diff --git a/src/p_w32pe_arm.h b/src/p_wince_arm.h similarity index 90% rename from src/p_w32pe_arm.h rename to src/p_wince_arm.h index 1e2b7c48..94de79ec 100644 --- a/src/p_w32pe_arm.h +++ b/src/p_wince_arm.h @@ -1,4 +1,4 @@ -/* p_w32pe_arm.h -- +/* p_wince_arm.h -- This file is part of the UPX executable compressor. @@ -31,15 +31,15 @@ // **************************************************************************/ -class PackW32PeArm final : public PeFile32 { +class PackWinCeArm final : public PeFile32 { typedef PeFile32 super; public: - PackW32PeArm(InputFile *f); - virtual ~PackW32PeArm(); - virtual int getFormat() const override { return UPX_F_W32PE_ARM; } - virtual const char *getName() const override { return "win32/arm"; } - virtual const char *getFullName(const options_t *) const override { return "arm-win32.pe"; } + PackWinCeArm(InputFile *f); + virtual ~PackWinCeArm(); + virtual int getFormat() const override { return UPX_F_WINCE_ARM; } + virtual const char *getName() const override { return "wince/arm"; } + virtual const char *getFullName(const options_t *) const override { return "arm-wince.pe"; } virtual const int *getCompressionMethods(int method, int level) const override; virtual const int *getFilters() const override; virtual void defineFilterSymbols(const Filter *) override {} diff --git a/src/packmast.cpp b/src/packmast.cpp index d8eea307..4fa7d61e 100644 --- a/src/packmast.cpp +++ b/src/packmast.cpp @@ -49,10 +49,10 @@ #include "p_tos.h" #include "p_vmlinx.h" #include "p_vmlinz.h" -#include "p_w32pe_arm.h" #include "p_w32pe_i386.h" #include "p_w64pe_amd64.h" #include "p_w64pe_arm64.h" +#include "p_wince_arm.h" #include "p_wcle.h" /************************************************************************* @@ -161,7 +161,7 @@ Packer *PackMaster::visitAllPackers(visit_func_t func, InputFile *f, const optio D(PackW64PeAmd64); D(PackW32PeI386); } - D(PackW32PeArm); + D(PackWinCeArm); // D(PackW64PeArm64EC); // NOT YET IMPLEMENTED // D(PackW64PeArm64); // NOT YET IMPLEMENTED D(PackExe); diff --git a/src/pefile.cpp b/src/pefile.cpp index 844c2b97..54469505 100644 --- a/src/pefile.cpp +++ b/src/pefile.cpp @@ -2275,7 +2275,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask, // section 0 : bss // 1 : [ident + header] + packed_data + unpacker + tls + loadconf // 2 : not compressed data - // 3 : resource data -- win32/arm 5 needs a new section for this + // 3 : resource data -- wince/arm 5 needs a new section for this // the last section should start with the resource data, because lots of lame // windoze codes assume that resources starts on the beginning of a section @@ -2963,14 +2963,14 @@ void PeFile32::pack0(OutputFile *fo, unsigned subsystem_mask, upx_uint64_t defau } void PeFile32::unpack(OutputFile *fo) { - bool set_oft = getFormat() == UPX_F_W32PE_ARM; + bool set_oft = getFormat() == UPX_F_WINCE_ARM; unpack0(fo, ih, oh, 1U << 31, set_oft); } int PeFile32::canUnpack() { if (!canPack()) // this calls readFileHeader() and readPeHeader() return false; - return canUnpack0(getFormat() == UPX_F_W32PE_ARM ? 4 : 3, ih.objects, ih.entry, sizeof(ih)); + return canUnpack0(getFormat() == UPX_F_WINCE_ARM ? 4 : 3, ih.objects, ih.entry, sizeof(ih)); } unsigned PeFile32::processImports() // pass 1 diff --git a/src/pefile.h b/src/pefile.h index 39c95f82..69513fb0 100644 --- a/src/pefile.h +++ b/src/pefile.h @@ -211,13 +211,14 @@ protected: unsigned tryremove(unsigned, unsigned); enum { - IMAGE_FILE_MACHINE_UNKNOWN = 0x0, + IMAGE_FILE_MACHINE_UNKNOWN = 0, IMAGE_FILE_MACHINE_AMD64 = 0x8664, // win64/pe (amd64) - IMAGE_FILE_MACHINE_ARM = 0x1c0, // win32/arm + IMAGE_FILE_MACHINE_ARM = 0x01c0, // wince/arm (Windows CE) IMAGE_FILE_MACHINE_ARM64 = 0xaa64, // win64/arm64 IMAGE_FILE_MACHINE_ARM64EC = 0xa641, // win64/arm64ec - IMAGE_FILE_MACHINE_I386 = 0x14c, // win32/pe (i386) - IMAGE_FILE_MACHINE_THUMB = 0x1c2, // win32/arm + IMAGE_FILE_MACHINE_ARMNT = 0x01c4, // win32/arm + IMAGE_FILE_MACHINE_I386 = 0x014c, // win32/pe (i386) + IMAGE_FILE_MACHINE_THUMB = 0x01c2, // wince/arm (Windows CE) }; enum { diff --git a/src/stub/Makefile b/src/stub/Makefile index 9fdc958d..ecd1de75 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -64,8 +64,8 @@ STUBS += amd64-linux.shlib-init.h STUBS += amd64-win64.pe.h STUBS += arm.v4a-linux.elf-entry.h STUBS += arm.v4a-linux.elf-fold.h -STUBS += arm.v4a-win32.pe.h -STUBS += arm.v4t-win32.pe.h +STUBS += arm.v4a-wince.pe.h +STUBS += arm.v4t-wince.pe.h STUBS += arm.v5a-darwin.macho-entry.h STUBS += arm.v5a-darwin.macho-fold.h STUBS += arm.v5a-linux.elf-entry.h @@ -764,23 +764,23 @@ armeb.v5a-linux.kernel.vmlinux-head.h : $(srcdir)/src/$$T.S # /*********************************************************************** -# // arm.v4a-win32.pe (arm.v4a) -# // arm.v4t-win32.pe (arm.v4t) +# // arm.v4a-wince.pe (arm.v4a) +# // arm.v4t-wince.pe (arm.v4t) # ************************************************************************/ # info: we use the tc settings from arm.v4a-linux.elf -arm.v4a-win32.pe.h : tc_list = arm.v4a-linux.elf default -arm.v4t-win32.pe.h : tc_list = arm.v4a-linux.elf default -arm.v4a-win32.pe.h : tc_bfdname = elf32-littlearm -arm.v4t-win32.pe.h : tc_bfdname = elf32-littlearm -arm.v4t-win32.pe.h : tc_objdump_disasm_options = -M force-thumb +arm.v4a-wince.pe.h : tc_list = arm.v4a-linux.elf default +arm.v4t-wince.pe.h : tc_list = arm.v4a-linux.elf default +arm.v4a-wince.pe.h : tc_bfdname = elf32-littlearm +arm.v4t-wince.pe.h : tc_bfdname = elf32-littlearm +arm.v4t-wince.pe.h : tc_objdump_disasm_options = -M force-thumb -arm.v4a-win32.pe.h : $(srcdir)/src/$$T.S +arm.v4a-wince.pe.h : $(srcdir)/src/$$T.S $(call tc,gcc) -march=armv4 -c $< -o tmp/$T.bin $(call tc,f-embed_objinfo,tmp/$T.bin) $(call tc,bin2h-c) tmp/$T.bin $@ -arm.v4t-win32.pe.h : $(srcdir)/src/$$T.S +arm.v4t-wince.pe.h : $(srcdir)/src/$$T.S $(call tc,gcc) -march=armv4t -c $< -o tmp/$T.bin $(call tc,f-embed_objinfo,tmp/$T.bin) $(call tc,bin2h-c) tmp/$T.bin $@ diff --git a/src/stub/arm.v4a-win32.pe.h b/src/stub/arm.v4a-wince.pe.h similarity index 99% rename from src/stub/arm.v4a-win32.pe.h rename to src/stub/arm.v4a-wince.pe.h index 03cc3a16..a7df9409 100644 --- a/src/stub/arm.v4a-win32.pe.h +++ b/src/stub/arm.v4a-wince.pe.h @@ -1,5 +1,5 @@ -/* arm.v4a-win32.pe.h - created from arm.v4a-win32.pe.bin, 14676 (0x3954) bytes +/* arm.v4a-wince.pe.h + created from arm.v4a-wince.pe.bin, 14676 (0x3954) bytes This file is part of the UPX executable compressor. @@ -31,11 +31,11 @@ */ -#define STUB_ARM_V4A_WIN32_PE_SIZE 14676 -#define STUB_ARM_V4A_WIN32_PE_ADLER32 0x3e1886fc -#define STUB_ARM_V4A_WIN32_PE_CRC32 0x3d92a84f +#define STUB_ARM_V4A_WINCE_PE_SIZE 14676 +#define STUB_ARM_V4A_WINCE_PE_ADLER32 0x3e1886fc +#define STUB_ARM_V4A_WINCE_PE_CRC32 0x3d92a84f -unsigned char stub_arm_v4a_win32_pe[14676] = { +unsigned char stub_arm_v4a_wince_pe[14676] = { /* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 97, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0010 */ 1, 0, 40, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0020 */ 156, 15, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 40, 0, diff --git a/src/stub/arm.v4t-win32.pe.h b/src/stub/arm.v4t-wince.pe.h similarity index 99% rename from src/stub/arm.v4t-win32.pe.h rename to src/stub/arm.v4t-wince.pe.h index a1a2670f..59bbb811 100644 --- a/src/stub/arm.v4t-win32.pe.h +++ b/src/stub/arm.v4t-wince.pe.h @@ -1,5 +1,5 @@ -/* arm.v4t-win32.pe.h - created from arm.v4t-win32.pe.bin, 6742 (0x1a56) bytes +/* arm.v4t-wince.pe.h + created from arm.v4t-wince.pe.bin, 6742 (0x1a56) bytes This file is part of the UPX executable compressor. @@ -31,11 +31,11 @@ */ -#define STUB_ARM_V4T_WIN32_PE_SIZE 6742 -#define STUB_ARM_V4T_WIN32_PE_ADLER32 0xd74653e1 -#define STUB_ARM_V4T_WIN32_PE_CRC32 0xbafe943f +#define STUB_ARM_V4T_WINCE_PE_SIZE 6742 +#define STUB_ARM_V4T_WINCE_PE_ADLER32 0xd74653e1 +#define STUB_ARM_V4T_WINCE_PE_CRC32 0xbafe943f -unsigned char stub_arm_v4t_win32_pe[6742] = { +unsigned char stub_arm_v4t_wince_pe[6742] = { /* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 97, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0010 */ 1, 0, 40, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0020 */ 132, 11, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 40, 0, diff --git a/src/stub/src/arm.v4a-win32.pe.S b/src/stub/src/arm.v4a-wince.pe.S similarity index 99% rename from src/stub/src/arm.v4a-win32.pe.S rename to src/stub/src/arm.v4a-wince.pe.S index 2f613149..daa74964 100644 --- a/src/stub/src/arm.v4a-win32.pe.S +++ b/src/stub/src/arm.v4a-wince.pe.S @@ -1,4 +1,4 @@ -/* arm.v4a-win32.pe.S -- ARM/PE decompressor assembly startup (arm mode) +/* arm.v4a-wince.pe.S -- ARM/PE decompressor assembly startup (arm mode) This file is part of the UPX executable compressor. diff --git a/src/stub/src/arm.v4t-win32.pe.S b/src/stub/src/arm.v4t-wince.pe.S similarity index 99% rename from src/stub/src/arm.v4t-win32.pe.S rename to src/stub/src/arm.v4t-wince.pe.S index 8aa82269..e611882d 100644 --- a/src/stub/src/arm.v4t-win32.pe.S +++ b/src/stub/src/arm.v4t-wince.pe.S @@ -1,4 +1,4 @@ -/* arm.v4t-win32.pe.S -- ARM/PE decompressor assembly startup (thumb mode) +/* arm.v4t-wince.pe.S -- ARM/PE decompressor assembly startup (thumb mode) This file is part of the UPX executable compressor. diff --git a/src/stub/tmp/arm.v4a-win32.pe.bin.dump b/src/stub/tmp/arm.v4a-wince.pe.bin.dump similarity index 100% rename from src/stub/tmp/arm.v4a-win32.pe.bin.dump rename to src/stub/tmp/arm.v4a-wince.pe.bin.dump diff --git a/src/stub/tmp/arm.v4t-win32.pe.bin.dump b/src/stub/tmp/arm.v4t-wince.pe.bin.dump similarity index 100% rename from src/stub/tmp/arm.v4t-win32.pe.bin.dump rename to src/stub/tmp/arm.v4t-wince.pe.bin.dump