Skip to content

Commit

Permalink
support makefile for xp
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriSizuku committed Apr 5, 2024
1 parent 15347ca commit f45a5b8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/yurisizuku/reversetool?color=green&label=ReverseTool)![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/YuriSizuku/ReverseTool/build_wintools.yml?label=build_wintools)

Some libraries (single header) for my reverse projects.
In `project`, `Makefile` for `gcc` (llvm-mingw or mingw-w64), `tcc` (not support inline) and `sln` for `msvc`.

🍀 Libraries (single header file) for my reverse projects.
Scripts for localization are moved to [LocalizationTool](https://github.com/YuriSizuku/LocalizationTool).

Projects based on this repo:
Expand All @@ -13,13 +11,18 @@ Projects based on this repo:
- [MiniVFS](https://github.com/YuriSizuku/MiniVFS)
- [GalgameReverse](https://github.com/YuriSizuku/GalgameReverse)

## Windows scripts and libraries
## Components

### cross platform libraries

- `windllin.py`, staticly inject `dll` to a `exe`
- `wincoff.py`, method for parsing `coff` object file

- `winhook.h`, single file for dynamic hook functions, such as IAT hook, inline hook
- `winpe.h`, single file for parsing windows PE structure, adjust RELOC, ADDRS, or IAT
- `windllin.py` , pre inject `dll` to a `exe`
- `wincoff.py`, some method for generating shellcode, such as parsing `coff` object file
### windows platform libraries

## Windows Useful tools
In `project`, `Makefile` for `gcc` (llvm-mingw or mingw-w64), `tcc` (not support inline) and `sln` for `msvc`. All of them are compatible for `win xp` and above.

- `winloader.c`, a tool to start a exe with a `dll` injected, see [Release](https://github.com/YuriSizuku/ReverseUtil/releases)
- `winhook.h`, single header file for dynamic hook functions, such as IAT hook, inline hook
- `winpe.h`, single header file for parsing windows PE structure, adjust RELOC, ADDRS, or IAT
- `windyn.h`, single header file for dynamic binding windows system api without IAT.
- `winloader.c`, start a exe with a `dll` injected, see [Release](https://github.com/YuriSizuku/ReverseUtil/releases)
4 changes: 3 additions & 1 deletion project/windll_winhook/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ CFLAGS:=-fPIC -std=c99 \
-ffunction-sections -fdata-sections
LDFLAGS:=-Wl,--enable-stdcall-fixup \
-Wl,--kill-at \
-Wl,--gc-sections
-Wl,--gc-sections \
-D_WIN32_WINNT=0X0400 \
-Wl,--subsystem,console:4.0 # compatible for xp

# build config
ifneq (,$(findstring 64, $(BUILD_TYPE)))
Expand Down
4 changes: 3 additions & 1 deletion project/windll_winpe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ CFLAGS:=-fPIC -std=gnu99 \
-ffunction-sections -fdata-sections
LDFLAGS:=-Wl,--enable-stdcall-fixup \
-Wl,--kill-at \
-Wl,--gc-sections
-Wl,--gc-sections \
-D_WIN32_WINNT=0X0400 \
-Wl,--subsystem,console:4.0 # compatible for xp

# build config
ifneq (,$(findstring 64, $(BUILD_TYPE)))
Expand Down
4 changes: 3 additions & 1 deletion project/winexe_winloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ CFLAGS:=-fPIC -std=c99 \
-ffunction-sections -fdata-sections
LDFLAGS:=-Wl,--enable-stdcall-fixup \
-Wl,--kill-at \
-Wl,--gc-sections
-Wl,--gc-sections \
-D_WIN32_WINNT=0X0400 \
-Wl,--subsystem,console:4.0 # compatible for xp

# build config
ifneq (,$(findstring 64, $(BUILD_TYPE)))
Expand Down
7 changes: 6 additions & 1 deletion src/winpe.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,15 @@ size_t STDCALL winpe_appendsecth(void *mempe, PIMAGE_SECTION_HEADER psecth);
#endif

#include <stdio.h>
#include <assert.h>
#include <windows.h>
#include <winternl.h>

#ifdef _DEBUG
#include <assert.h>
#else
#define assert(x)
#endif

// util INLINE functions
INLINE size_t _winpeinl_strlen(const char* str1)
{
Expand Down

0 comments on commit f45a5b8

Please sign in to comment.