From 46ec16032e23a617ab9b0050a0c04f12478f1204 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Jul 2019 15:10:37 +0200 Subject: [PATCH] - removed fixrtext tool. This is no longer needed, because it was used to create self-modifiable code from assembly source, which no longer exists. --- tools/CMakeLists.txt | 4 -- tools/fixrtext/CMakeLists.txt | 6 --- tools/fixrtext/fixrtext.c | 88 ----------------------------------- 3 files changed, 98 deletions(-) delete mode 100644 tools/fixrtext/CMakeLists.txt delete mode 100644 tools/fixrtext/fixrtext.c diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 8a97243bb8..2a0dfecbc5 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,10 +1,6 @@ cmake_minimum_required( VERSION 2.8.7 ) add_subdirectory( lemon ) -add_subdirectory( re2c ) -if( WIN32 AND NOT CMAKE_SIZEOF_VOID_P MATCHES "8" ) - add_subdirectory( fixrtext ) -endif() add_subdirectory( updaterevision ) add_subdirectory( zipdir ) diff --git a/tools/fixrtext/CMakeLists.txt b/tools/fixrtext/CMakeLists.txt deleted file mode 100644 index 7485425007..0000000000 --- a/tools/fixrtext/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -cmake_minimum_required( VERSION 2.8.7 ) - -if( NOT CMAKE_CROSSCOMPILING ) - add_executable( fixrtext fixrtext.c ) - set( CROSS_EXPORTS ${CROSS_EXPORTS} fixrtext PARENT_SCOPE ) -endif() diff --git a/tools/fixrtext/fixrtext.c b/tools/fixrtext/fixrtext.c deleted file mode 100644 index a44cfede8a..0000000000 --- a/tools/fixrtext/fixrtext.c +++ /dev/null @@ -1,88 +0,0 @@ -/* fixrtext.c -** -** Given a coff-win32 object file, search for an .rtext section header and -** set its IMAGE_SCN_MEM_WRITE flag if it isn't already set. This gets -** around an NASM deficiency that prevents creating such files with -** "execute read write" sections. -** -** The author of this program disclaims copyright. -*/ - -#define WIN32_LEAN_AND_MEAN -#include -#include - -#ifndef _MSC_VER -#include - -int fopen_s (FILE **pFile, const char *filename, const char *mode) -{ - if ((*pFile = fopen (filename, mode)) == NULL) - { - return errno; - } - return 0; -} -#endif - -int main (int argc, char **argv) -{ - FILE *f; - IMAGE_FILE_HEADER filehead; - IMAGE_SECTION_HEADER secthead; - int i; - - if (argc != 2) - return 1; - - if (fopen_s (&f, argv[1], "r+b")) - { - fprintf (stderr, "Could not open %s\n", argv[1]); - return 1; - } - - if (fread (&filehead, sizeof filehead, 1, f) != 1 || - filehead.Machine != IMAGE_FILE_MACHINE_I386) - { - fprintf (stderr, "%s is not an x86 object file\n", argv[1]); - fclose (f); - return 1; - } - - for (i = 0; i < filehead.NumberOfSections; ++i) - { - if (fread (§head, sizeof secthead, 1, f) != 1) - { - fprintf (stderr, "Could not read section header %d\n", i + 1); - fclose (f); - return 1; - } - if (memcmp (secthead.Name, ".rtext\0", IMAGE_SIZEOF_SHORT_NAME) == 0) - { - if (secthead.Characteristics & IMAGE_SCN_MEM_WRITE) - { - fprintf (stderr, "The .rtext section in %s is already writeable\n", argv[1]); - fclose (f); - return 0; - } - secthead.Characteristics |= IMAGE_SCN_MEM_WRITE; - if (fseek (f, -(long)sizeof secthead, SEEK_CUR)) - { - fprintf (stderr, "Failed to seek back to start of .rtext section header\n"); - fclose (f); - return 1; - } - if (fwrite (§head, sizeof secthead, 1, f) != 1) - { - fprintf (stderr, "Failed to rewrite .rtext section header\n"); - fclose (f); - return 1; - } -/* fprintf (stderr, "The .rtext section in %s was successfully made writeable\n", argv[1]); */ - fclose (f); - return 0; - } - } - fclose (f); - return 0; -}