mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-24 21:11:52 +00:00
- removed fixrtext tool.
This is no longer needed, because it was used to create self-modifiable code from assembly source, which no longer exists.
This commit is contained in:
parent
ed6ab39b2d
commit
46ec16032e
3 changed files with 0 additions and 98 deletions
|
@ -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 )
|
||||
|
||||
|
|
|
@ -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()
|
|
@ -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 <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <errno.h>
|
||||
|
||||
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;
|
||||
}
|
Loading…
Reference in a new issue