From bb48b1e64ba8827801c4777fecb7ba7481b7f227 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Mon, 17 Sep 2018 21:40:54 -0400 Subject: [PATCH] reorganize and add v8 skeleton --- vnrhook/CMakeLists.txt | 2 +- vnrhook/engine/match.cc | 3 ++- vnrhook/engine/{ => native}/pchooks.cc | 2 +- vnrhook/engine/{ => native}/pchooks.h | 0 vnrhook/engine/v8/v8.h | 33 ++++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 3 deletions(-) rename vnrhook/engine/{ => native}/pchooks.cc (99%) rename vnrhook/engine/{ => native}/pchooks.h (100%) create mode 100644 vnrhook/engine/v8/v8.h diff --git a/vnrhook/CMakeLists.txt b/vnrhook/CMakeLists.txt index d3f2fe9..abed544 100644 --- a/vnrhook/CMakeLists.txt +++ b/vnrhook/CMakeLists.txt @@ -13,7 +13,7 @@ set(vnrhook_src pipe.cc engine/engine.cc engine/match.cc - engine/pchooks.cc + engine/native/pchooks.cc hijack/texthook.cc util/util.cc util/ithsys/ithsys.cc diff --git a/vnrhook/engine/match.cc b/vnrhook/engine/match.cc index 87bfc60..69c6833 100644 --- a/vnrhook/engine/match.cc +++ b/vnrhook/engine/match.cc @@ -9,7 +9,8 @@ #include "engine/match.h" #include "engine/engine.h" -#include "engine/pchooks.h" +#include "engine/native/pchooks.h" +#include "engine/v8/v8.h" #include "util/growl.h" #include "util/util.h" #include "main.h" diff --git a/vnrhook/engine/pchooks.cc b/vnrhook/engine/native/pchooks.cc similarity index 99% rename from vnrhook/engine/pchooks.cc rename to vnrhook/engine/native/pchooks.cc index b5f5a00..2936c06 100644 --- a/vnrhook/engine/pchooks.cc +++ b/vnrhook/engine/native/pchooks.cc @@ -1,7 +1,7 @@ // pchooks.cc // 8/1/2014 jichi -#include "engine/pchooks.h" +#include "pchooks.h" #include "main.h" //#include diff --git a/vnrhook/engine/pchooks.h b/vnrhook/engine/native/pchooks.h similarity index 100% rename from vnrhook/engine/pchooks.h rename to vnrhook/engine/native/pchooks.h diff --git a/vnrhook/engine/v8/v8.h b/vnrhook/engine/v8/v8.h new file mode 100644 index 0000000..151143b --- /dev/null +++ b/vnrhook/engine/v8/v8.h @@ -0,0 +1,33 @@ +#pragma once + +// v8.h +// 9/17/2018 Artikash +// Hooks for V8 JavaScript runtime +#include "common.h" +#include "types.h" + +namespace V8 +{ +#pragma pack(1) + struct V8String + { + BYTE filler[7]; + int length; + wchar_t string[1]; + }; + void SpecialHookV8String(DWORD dwDatabase, HookParam* hp, BYTE, DWORD* data, DWORD* split, DWORD* len) + { + V8String* str = *(V8String**)data; + *data = (DWORD)str->string; + *len = str->length; + if (hp->type & USING_SPLIT) *split = *(DWORD*)((BYTE*)hp->split + dwDatabase); + } + void HookV8Functions(HMODULE hModule) + { + const std::string V8_FUNCTIONS[] = + { + "", + "" + }; + } +} \ No newline at end of file