From 1b93551a419a24cdc3e386236f45d6c9b706aa3f Mon Sep 17 00:00:00 2001 From: Tau Date: Tue, 14 May 2019 11:15:20 -0400 Subject: [PATCH] hooklib: Split out of util This is distinct from capnhook's hooklib, although the intent is the same. Hopefully these two libraries sharing a name won't get too confusing... --- amex/ds.c | 3 ++- amex/eeprom.c | 3 ++- amex/gpio.c | 3 ++- amex/jvs.c | 3 ++- amex/sram.c | 3 ++- cardhook/dllmain.c | 2 +- cardhook/meson.build | 1 + chunihook/dllmain.c | 6 +++--- chunihook/meson.build | 1 + divahook/dllmain.c | 6 +++--- divahook/meson.build | 1 + {util => hooklib}/clock.c | 0 {util => hooklib}/clock.h | 0 {util => hooklib}/fdshark.c | 3 ++- {util => hooklib}/fdshark.h | 0 {util => hooklib}/gfx.c | 2 ++ {util => hooklib}/gfx.h | 0 hooklib/meson.build | 21 +++++++++++++++++++++ {util => hooklib}/setupapi.c | 3 ++- {util => hooklib}/setupapi.h | 0 {util => hooklib}/spike.c | 3 ++- {util => hooklib}/spike.h | 0 idzhook/dllmain.c | 6 +++--- idzhook/meson.build | 1 + meson.build | 1 + minihook/dllmain.c | 5 +++-- minihook/meson.build | 1 + platform/hwmon.c | 3 +-- util/meson.build | 10 ---------- 29 files changed, 59 insertions(+), 32 deletions(-) rename {util => hooklib}/clock.c (100%) rename {util => hooklib}/clock.h (100%) rename {util => hooklib}/fdshark.c (99%) rename {util => hooklib}/fdshark.h (100%) rename {util => hooklib}/gfx.c (98%) rename {util => hooklib}/gfx.h (100%) create mode 100644 hooklib/meson.build rename {util => hooklib}/setupapi.c (99%) rename {util => hooklib}/setupapi.h (100%) rename {util => hooklib}/spike.c (99%) rename {util => hooklib}/spike.h (100%) diff --git a/amex/ds.c b/amex/ds.c index ee605ff..7553fa7 100644 --- a/amex/ds.c +++ b/amex/ds.c @@ -13,9 +13,10 @@ #include "hook/iobuf.h" #include "hook/iohook.h" +#include "hooklib/setupapi.h" + #include "util/crc.h" #include "util/dprintf.h" -#include "util/setupapi.h" #include "util/str.h" #pragma pack(push, 1) diff --git a/amex/eeprom.c b/amex/eeprom.c index a3ad22a..69849b3 100644 --- a/amex/eeprom.c +++ b/amex/eeprom.c @@ -16,8 +16,9 @@ #include "hook/iohook.h" +#include "hooklib/setupapi.h" + #include "util/dprintf.h" -#include "util/setupapi.h" #include "util/str.h" static HRESULT eeprom_handle_irp(struct irp *irp); diff --git a/amex/gpio.c b/amex/gpio.c index 16162d9..182b3ee 100644 --- a/amex/gpio.c +++ b/amex/gpio.c @@ -8,8 +8,9 @@ #include "hook/iohook.h" +#include "hooklib/setupapi.h" + #include "util/dprintf.h" -#include "util/setupapi.h" #include "util/str.h" enum { diff --git a/amex/jvs.c b/amex/jvs.c index d93eb34..ad181b9 100644 --- a/amex/jvs.c +++ b/amex/jvs.c @@ -13,11 +13,12 @@ #include "hook/iobuf.h" #include "hook/iohook.h" +#include "hooklib/setupapi.h" + #include "jvs/jvs-bus.h" #include "util/dprintf.h" #include "util/dump.h" -#include "util/setupapi.h" #include "util/str.h" enum { diff --git a/amex/sram.c b/amex/sram.c index 87aa3a6..0de2806 100644 --- a/amex/sram.c +++ b/amex/sram.c @@ -15,8 +15,9 @@ #include "hook/iohook.h" +#include "hooklib/setupapi.h" + #include "util/dprintf.h" -#include "util/setupapi.h" #include "util/str.h" static HRESULT sram_handle_irp(struct irp *irp); diff --git a/cardhook/dllmain.c b/cardhook/dllmain.c index d6ec832..ef73638 100644 --- a/cardhook/dllmain.c +++ b/cardhook/dllmain.c @@ -5,9 +5,9 @@ #include "hook/process.h" #include "hooklib/serial.h" +#include "hooklib/spike.h" #include "util/dprintf.h" -#include "util/spike.h" static process_entry_t app_startup; diff --git a/cardhook/meson.build b/cardhook/meson.build index eb43917..6573f7a 100644 --- a/cardhook/meson.build +++ b/cardhook/meson.build @@ -11,6 +11,7 @@ shared_library( link_with : [ aimeio_dll, board_lib, + hooklib_lib, util_lib, ], sources : [ diff --git a/chunihook/dllmain.c b/chunihook/dllmain.c index dcbea40..b59e4e0 100644 --- a/chunihook/dllmain.c +++ b/chunihook/dllmain.c @@ -13,15 +13,15 @@ #include "hook/process.h" +#include "hooklib/clock.h" +#include "hooklib/gfx.h" #include "hooklib/serial.h" +#include "hooklib/spike.h" #include "platform/hwmon.h" #include "platform/nusec.h" -#include "util/clock.h" #include "util/dprintf.h" -#include "util/gfx.h" -#include "util/spike.h" static process_entry_t chuni_startup; diff --git a/chunihook/meson.build b/chunihook/meson.build index 357c336..b450f89 100644 --- a/chunihook/meson.build +++ b/chunihook/meson.build @@ -12,6 +12,7 @@ shared_library( amex_lib, board_lib, chuniio_dll, + hooklib_lib, jvs_lib, platform_lib, util_lib, diff --git a/divahook/dllmain.c b/divahook/dllmain.c index 77c8c03..c03942d 100644 --- a/divahook/dllmain.c +++ b/divahook/dllmain.c @@ -13,15 +13,15 @@ #include "hook/process.h" +#include "hooklib/clock.h" +#include "hooklib/gfx.h" #include "hooklib/serial.h" +#include "hooklib/spike.h" #include "platform/hwmon.h" #include "platform/nusec.h" -#include "util/clock.h" #include "util/dprintf.h" -#include "util/gfx.h" -#include "util/spike.h" static process_entry_t diva_startup; diff --git a/divahook/meson.build b/divahook/meson.build index b392e0b..d401470 100644 --- a/divahook/meson.build +++ b/divahook/meson.build @@ -14,6 +14,7 @@ shared_library( amex_lib, board_lib, divaio_dll, + hooklib_lib, jvs_lib, platform_lib, util_lib, diff --git a/util/clock.c b/hooklib/clock.c similarity index 100% rename from util/clock.c rename to hooklib/clock.c diff --git a/util/clock.h b/hooklib/clock.h similarity index 100% rename from util/clock.h rename to hooklib/clock.h diff --git a/util/fdshark.c b/hooklib/fdshark.c similarity index 99% rename from util/fdshark.c rename to hooklib/fdshark.c index e97663e..e33e9e2 100644 --- a/util/fdshark.c +++ b/hooklib/fdshark.c @@ -8,9 +8,10 @@ #include "hook/iobuf.h" #include "hook/iohook.h" +#include "hooklib/fdshark.h" + #include "util/dprintf.h" #include "util/dump.h" -#include "util/fdshark.h" static const wchar_t *fdshark_path; static HANDLE fdshark_target_fd; diff --git a/util/fdshark.h b/hooklib/fdshark.h similarity index 100% rename from util/fdshark.h rename to hooklib/fdshark.h diff --git a/util/gfx.c b/hooklib/gfx.c similarity index 98% rename from util/gfx.c rename to hooklib/gfx.c index 7b138b3..185798e 100644 --- a/util/gfx.c +++ b/hooklib/gfx.c @@ -7,6 +7,8 @@ #include "hook/com-proxy.h" #include "hook/table.h" +#include "hooklib/gfx.h" + #include "util/dprintf.h" static HRESULT STDMETHODCALLTYPE my_CreateDevice( diff --git a/util/gfx.h b/hooklib/gfx.h similarity index 100% rename from util/gfx.h rename to hooklib/gfx.h diff --git a/hooklib/meson.build b/hooklib/meson.build new file mode 100644 index 0000000..ed7bae5 --- /dev/null +++ b/hooklib/meson.build @@ -0,0 +1,21 @@ +hooklib_lib = static_library( + 'hooklib', + include_directories : inc, + implicit_include_directories : false, + c_pch : '../precompiled.h', + dependencies : [ + capnhook.get_variable('hook_dep'), + ], + sources : [ + 'clock.c', + 'clock.h', + 'fdshark.c', + 'fdshark.h', + 'gfx.c', + 'gfx.h', + 'setupapi.c', + 'setupapi.h', + 'spike.c', + 'spike.h', + ], +) diff --git a/util/setupapi.c b/hooklib/setupapi.c similarity index 99% rename from util/setupapi.c rename to hooklib/setupapi.c index dac5fca..dac66ba 100644 --- a/util/setupapi.c +++ b/hooklib/setupapi.c @@ -9,8 +9,9 @@ #include "hook/table.h" +#include "hooklib/setupapi.h" + #include "util/dprintf.h" -#include "util/setupapi.h" struct setupapi_class { const GUID *guid; diff --git a/util/setupapi.h b/hooklib/setupapi.h similarity index 100% rename from util/setupapi.h rename to hooklib/setupapi.h diff --git a/util/spike.c b/hooklib/spike.c similarity index 99% rename from util/spike.c rename to hooklib/spike.c index 820c519..09a64d4 100644 --- a/util/spike.c +++ b/hooklib/spike.c @@ -7,8 +7,9 @@ #include "hook/pe.h" +#include "hooklib/spike.h" + #include "util/dprintf.h" -#include "util/spike.h" /* Spike functions. Their "style" is named after the libc function they bear the closest resemblance to. */ diff --git a/util/spike.h b/hooklib/spike.h similarity index 100% rename from util/spike.h rename to hooklib/spike.h diff --git a/idzhook/dllmain.c b/idzhook/dllmain.c index ef53537..d6aa45e 100644 --- a/idzhook/dllmain.c +++ b/idzhook/dllmain.c @@ -10,17 +10,17 @@ #include "hook/process.h" +#include "hooklib/clock.h" +#include "hooklib/gfx.h" #include "hooklib/serial.h" +#include "hooklib/spike.h" #include "idzhook/jvs.h" #include "platform/hwmon.h" #include "platform/nusec.h" -#include "util/clock.h" #include "util/dprintf.h" -#include "util/gfx.h" -#include "util/spike.h" static process_entry_t idz_startup; diff --git a/idzhook/meson.build b/idzhook/meson.build index e330b9a..ac6e857 100644 --- a/idzhook/meson.build +++ b/idzhook/meson.build @@ -14,6 +14,7 @@ shared_library( aimeio_dll, amex_lib, board_lib, + hooklib_lib, idzio_dll, jvs_lib, platform_lib, diff --git a/meson.build b/meson.build index 66fdb8a..f3b2d53 100644 --- a/meson.build +++ b/meson.build @@ -32,6 +32,7 @@ capnhook = subproject('capnhook') subdir('amex') subdir('board') +subdir('hooklib') subdir('jvs') subdir('platform') subdir('util') diff --git a/minihook/dllmain.c b/minihook/dllmain.c index 6ca7062..40f9471 100644 --- a/minihook/dllmain.c +++ b/minihook/dllmain.c @@ -5,11 +5,12 @@ #include "hook/process.h" +#include "hooklib/clock.h" +#include "hooklib/spike.h" + #include "platform/nusec.h" -#include "util/clock.h" #include "util/dprintf.h" -#include "util/spike.h" static process_entry_t app_startup; diff --git a/minihook/meson.build b/minihook/meson.build index 661c2d0..8acbf1e 100644 --- a/minihook/meson.build +++ b/minihook/meson.build @@ -9,6 +9,7 @@ shared_library( ], link_with : [ amex_lib, + hooklib_lib, platform_lib, util_lib, ], diff --git a/platform/hwmon.c b/platform/hwmon.c index 763afd1..15e5da9 100644 --- a/platform/hwmon.c +++ b/platform/hwmon.c @@ -3,12 +3,11 @@ #include #include -#include "util/dprintf.h" - #include "hook/iohook.h" #include "platform/hwmon.h" +#include "util/dprintf.h" #include "util/str.h" enum { diff --git a/util/meson.build b/util/meson.build index 6cb0c9f..0b76284 100644 --- a/util/meson.build +++ b/util/meson.build @@ -9,22 +9,12 @@ util_lib = static_library( sources : [ 'async.c', 'async.h', - 'clock.c', - 'clock.h', 'crc.c', 'crc.h', 'dprintf.c', 'dprintf.h', 'dump.c', 'dump.h', - 'fdshark.c', - 'fdshark.h', - 'gfx.c', - 'gfx.h', - 'setupapi.c', - 'setupapi.h', - 'spike.c', - 'spike.h', 'str.c', 'str.h', ],