diff --git a/README.md b/README.md index 418d276..5f21717 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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) diff --git a/project/windll_winhook/Makefile b/project/windll_winhook/Makefile index 8c8e6d2..86130b7 100644 --- a/project/windll_winhook/Makefile +++ b/project/windll_winhook/Makefile @@ -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))) diff --git a/project/windll_winpe/Makefile b/project/windll_winpe/Makefile index 2cfbcc3..d2e1bad 100644 --- a/project/windll_winpe/Makefile +++ b/project/windll_winpe/Makefile @@ -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))) diff --git a/project/winexe_winloader/Makefile b/project/winexe_winloader/Makefile index 648efb7..aa4db58 100644 --- a/project/winexe_winloader/Makefile +++ b/project/winexe_winloader/Makefile @@ -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))) diff --git a/src/winpe.h b/src/winpe.h index b68e884..dda12a4 100644 --- a/src/winpe.h +++ b/src/winpe.h @@ -197,7 +197,12 @@ void* winpe_findkernel32(); */ WINPE_API void* STDCALL winpe_findmoduleaex(PPEB peb, const char *modulename); -#define winpe_findmodulea(modulename) winpe_findmoduleaex(NULL, modulename) + +WINPE_API +void* STDCALL winpe_findmodulea(const char *modulename) +{ + return winpe_findmoduleaex(NULL, modulename); +} /** * @return LoadLibraryA func addr @@ -337,10 +342,15 @@ size_t STDCALL winpe_appendsecth(void *mempe, PIMAGE_SECTION_HEADER psecth); #endif #include -#include #include #include +#ifdef _DEBUG +#include +#else +#define assert(x) +#endif + // util INLINE functions INLINE size_t _winpeinl_strlen(const char* str1) {