Rename project to cgss-dmm-hook

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-06-20 08:12:47 +08:00
parent 46c32e8be4
commit 18251a2814
8 changed files with 74 additions and 74 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
project(cgss_http_hook LANGUAGES C CXX RC ASM_MASM) project(cgss_dmm_hook LANGUAGES C CXX RC ASM_MASM)
set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
+3 -3
View File
@@ -1,4 +1,4 @@
# cgss-http-hook # cgss-dmm-hook
面向 Windows / DMM 版 CGSS 客户端的最小 `version.dll` 代理工程。 面向 Windows / DMM 版 CGSS 客户端的最小 `version.dll` 代理工程。
@@ -15,7 +15,7 @@
**说明** **说明**
- 本项目不依赖 `Il2CppDumper``script.json` - 本项目不依赖 `Il2CppDumper``script.json`
- `GameAssembly.dll` 出现时,IL2CPP runtime 可能还不能安全访问,因此 hook 线程会额外等待一小段时间 - `GameAssembly.dll` 出现时,IL2CPP runtime 可能还不能安全访问,因此 hook 线程会额外等待一小段时间
- 运行时日志会写到游戏目录下的 `cgss-http-hook.log` - 运行时日志会写到游戏目录下的 `cgss-dmm-hook.log`
- 生成的 DLL 包含 Windows 版本资源,定义在 `src/version.rc` - 生成的 DLL 包含 Windows 版本资源,定义在 `src/version.rc`
- 支持通过 `force_http` 控制是否 hook scheme,默认 `true` - 支持通过 `force_http` 控制是否 hook scheme,默认 `true`
- `config.json` 中的 URL 会自动规范化:若写了 `http://``https://` 会自动去掉,若末尾缺少 `/` 会自动补上 - `config.json` 中的 URL 会自动规范化:若写了 `http://``https://` 会自动去掉,若末尾缺少 `/` 会自动补上
@@ -49,7 +49,7 @@ cmake --build build
1.`build/version.dll` 复制到 `imascgstage.exe` 同目录 1.`build/version.dll` 复制到 `imascgstage.exe` 同目录
2. 如需覆盖地址,在同目录放置 `config.json` 2. 如需覆盖地址,在同目录放置 `config.json`
3. 启动游戏 3. 启动游戏
4. 如果 hook 未生效,查看 `cgss-http-hook.log` 4. 如果 hook 未生效,查看 `cgss-dmm-hook.log`
**致谢** **致谢**
- 本项目的 `version.dll` 代理注入思路与运行时 IL2CPP hook 方向,受 `gkms-localify-dmm` 项目启发。 - 本项目的 `version.dll` 代理注入思路与运行时 IL2CPP hook 方向,受 `gkms-localify-dmm` 项目启发。
+6 -6
View File
@@ -77,13 +77,13 @@ namespace config {
const auto config_path = get_config_path(); const auto config_path = get_config_path();
if (config_path.empty()) { if (config_path.empty()) {
hook_log("[cgss-http-hook] failed to resolve config.json path"); hook_log("[cgss-dmm-hook] failed to resolve config.json path");
return; return;
} }
std::ifstream config_stream(config_path); std::ifstream config_stream(config_path);
if (!config_stream.is_open()) { if (!config_stream.is_open()) {
hook_log("[cgss-http-hook] config.json not found, using defaults"); hook_log("[cgss-dmm-hook] config.json not found, using defaults");
return; return;
} }
@@ -91,7 +91,7 @@ namespace config {
rapidjson::Document document; rapidjson::Document document;
document.ParseStream(wrapper); document.ParseStream(wrapper);
if (document.HasParseError() || !document.IsObject()) { if (document.HasParseError() || !document.IsObject()) {
hook_log("[cgss-http-hook] failed to parse config.json"); hook_log("[cgss-dmm-hook] failed to parse config.json");
return; return;
} }
@@ -99,13 +99,13 @@ namespace config {
read_string(document, "api_url", g_urls.api_url); read_string(document, "api_url", g_urls.api_url);
read_string(document, "asset_url", g_urls.asset_url); read_string(document, "asset_url", g_urls.asset_url);
hook_logf("[cgss-http-hook] force_http=%s", g_urls.force_http ? "true" : "false"); hook_logf("[cgss-dmm-hook] force_http=%s", g_urls.force_http ? "true" : "false");
if (!g_urls.api_url.empty()) { if (!g_urls.api_url.empty()) {
hook_logf("[cgss-http-hook] normalized api_url=%s", g_urls.api_url.c_str()); hook_logf("[cgss-dmm-hook] normalized api_url=%s", g_urls.api_url.c_str());
} }
if (!g_urls.asset_url.empty()) { if (!g_urls.asset_url.empty()) {
hook_logf("[cgss-http-hook] normalized asset_url=%s", g_urls.asset_url.c_str()); hook_logf("[cgss-dmm-hook] normalized asset_url=%s", g_urls.asset_url.c_str());
} }
} }
+47 -47
View File
@@ -47,7 +47,7 @@ namespace {
int get_scheme_type_hook(const MethodInfo*) { int get_scheme_type_hook(const MethodInfo*) {
if (InterlockedCompareExchange(&g_scheme_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_scheme_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] GetSchemeType hook invoked"); hook_log("[cgss-dmm-hook] GetSchemeType hook invoked");
} }
return kHttpSchemeType; return kHttpSchemeType;
} }
@@ -55,7 +55,7 @@ namespace {
void* get_application_server_url_hook(const MethodInfo* method) { void* get_application_server_url_hook(const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_application_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_application_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] GetApplicationServerUrl hook invoked"); hook_log("[cgss-dmm-hook] GetApplicationServerUrl hook invoked");
} }
if (!urls.api_url.empty()) { if (!urls.api_url.empty()) {
return il2cpp_symbols::new_string(urls.api_url.c_str()); return il2cpp_symbols::new_string(urls.api_url.c_str());
@@ -66,7 +66,7 @@ namespace {
void* get_tele_scope_server_url_hook(const MethodInfo* method) { void* get_tele_scope_server_url_hook(const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_tele_scope_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_tele_scope_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] GetTeleScopeServerUrl hook invoked"); hook_log("[cgss-dmm-hook] GetTeleScopeServerUrl hook invoked");
} }
if (!urls.api_url.empty()) { if (!urls.api_url.empty()) {
return il2cpp_symbols::new_string(urls.api_url.c_str()); return il2cpp_symbols::new_string(urls.api_url.c_str());
@@ -77,7 +77,7 @@ namespace {
void* get_concert_server_url_hook(const MethodInfo* method) { void* get_concert_server_url_hook(const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_concert_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_concert_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] GetConcertServerUrl hook invoked"); hook_log("[cgss-dmm-hook] GetConcertServerUrl hook invoked");
} }
if (!urls.api_url.empty()) { if (!urls.api_url.empty()) {
return il2cpp_symbols::new_string(urls.api_url.c_str()); return il2cpp_symbols::new_string(urls.api_url.c_str());
@@ -88,7 +88,7 @@ namespace {
void* get_resource_server_url_hook(const MethodInfo* method) { void* get_resource_server_url_hook(const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_resource_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_resource_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] GetResourceServerUrl hook invoked"); hook_log("[cgss-dmm-hook] GetResourceServerUrl hook invoked");
} }
if (!urls.asset_url.empty()) { if (!urls.asset_url.empty()) {
return il2cpp_symbols::new_string(urls.asset_url.c_str()); return il2cpp_symbols::new_string(urls.asset_url.c_str());
@@ -99,7 +99,7 @@ namespace {
void* custom_preference_get_application_server_url_hook(const MethodInfo* method) { void* custom_preference_get_application_server_url_hook(const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_cp_application_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_cp_application_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] Cute.CustomPreference.GetApplicationServerURL hook invoked"); hook_log("[cgss-dmm-hook] Cute.CustomPreference.GetApplicationServerURL hook invoked");
} }
if (!urls.api_url.empty()) { if (!urls.api_url.empty()) {
return il2cpp_symbols::new_string(urls.api_url.c_str()); return il2cpp_symbols::new_string(urls.api_url.c_str());
@@ -112,7 +112,7 @@ namespace {
void* custom_preference_get_tele_scope_server_url_hook(const MethodInfo* method) { void* custom_preference_get_tele_scope_server_url_hook(const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_cp_tele_scope_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_cp_tele_scope_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] Cute.CustomPreference.GetTeleScopeServerURL hook invoked"); hook_log("[cgss-dmm-hook] Cute.CustomPreference.GetTeleScopeServerURL hook invoked");
} }
if (!urls.api_url.empty()) { if (!urls.api_url.empty()) {
return il2cpp_symbols::new_string(urls.api_url.c_str()); return il2cpp_symbols::new_string(urls.api_url.c_str());
@@ -125,7 +125,7 @@ namespace {
void* custom_preference_get_concert_server_url_hook(const MethodInfo* method) { void* custom_preference_get_concert_server_url_hook(const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_cp_concert_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_cp_concert_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] Cute.CustomPreference.GetConcertServerURL hook invoked"); hook_log("[cgss-dmm-hook] Cute.CustomPreference.GetConcertServerURL hook invoked");
} }
if (!urls.api_url.empty()) { if (!urls.api_url.empty()) {
return il2cpp_symbols::new_string(urls.api_url.c_str()); return il2cpp_symbols::new_string(urls.api_url.c_str());
@@ -138,7 +138,7 @@ namespace {
void* custom_preference_get_resource_server_url_hook(const MethodInfo* method) { void* custom_preference_get_resource_server_url_hook(const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_cp_resource_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_cp_resource_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] Cute.CustomPreference.GetResourceServerURL hook invoked"); hook_log("[cgss-dmm-hook] Cute.CustomPreference.GetResourceServerURL hook invoked");
} }
if (!urls.asset_url.empty()) { if (!urls.asset_url.empty()) {
return il2cpp_symbols::new_string(urls.asset_url.c_str()); return il2cpp_symbols::new_string(urls.asset_url.c_str());
@@ -151,7 +151,7 @@ namespace {
void custom_preference_set_application_server_url_hook(void* value, const MethodInfo* method) { void custom_preference_set_application_server_url_hook(void* value, const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_cp_set_application_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_cp_set_application_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] Cute.CustomPreference.SetApplicationServerURL hook invoked"); hook_log("[cgss-dmm-hook] Cute.CustomPreference.SetApplicationServerURL hook invoked");
} }
if (g_orig_custom_preference_set_application_server_url) { if (g_orig_custom_preference_set_application_server_url) {
if (!urls.api_url.empty()) { if (!urls.api_url.empty()) {
@@ -164,7 +164,7 @@ namespace {
void custom_preference_set_tele_scope_server_url_hook(void* value, const MethodInfo* method) { void custom_preference_set_tele_scope_server_url_hook(void* value, const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_cp_set_tele_scope_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_cp_set_tele_scope_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] Cute.CustomPreference.SetTeleScopeServerURL hook invoked"); hook_log("[cgss-dmm-hook] Cute.CustomPreference.SetTeleScopeServerURL hook invoked");
} }
if (g_orig_custom_preference_set_tele_scope_server_url) { if (g_orig_custom_preference_set_tele_scope_server_url) {
if (!urls.api_url.empty()) { if (!urls.api_url.empty()) {
@@ -177,7 +177,7 @@ namespace {
void custom_preference_set_concert_server_url_hook(void* value, const MethodInfo* method) { void custom_preference_set_concert_server_url_hook(void* value, const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_cp_set_concert_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_cp_set_concert_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] Cute.CustomPreference.SetConcertServerURL hook invoked"); hook_log("[cgss-dmm-hook] Cute.CustomPreference.SetConcertServerURL hook invoked");
} }
if (g_orig_custom_preference_set_concert_server_url) { if (g_orig_custom_preference_set_concert_server_url) {
if (!urls.api_url.empty()) { if (!urls.api_url.empty()) {
@@ -190,7 +190,7 @@ namespace {
void custom_preference_set_resource_server_url_hook(void* value, const MethodInfo* method) { void custom_preference_set_resource_server_url_hook(void* value, const MethodInfo* method) {
const auto& urls = config::get(); const auto& urls = config::get();
if (InterlockedCompareExchange(&g_cp_set_resource_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_cp_set_resource_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] Cute.CustomPreference.SetResourceServerURL hook invoked"); hook_log("[cgss-dmm-hook] Cute.CustomPreference.SetResourceServerURL hook invoked");
} }
if (g_orig_custom_preference_set_resource_server_url) { if (g_orig_custom_preference_set_resource_server_url) {
if (!urls.asset_url.empty()) { if (!urls.asset_url.empty()) {
@@ -202,7 +202,7 @@ namespace {
void custom_preference_set_scheme_mode_hook(int scheme_type, const MethodInfo* method) { void custom_preference_set_scheme_mode_hook(int scheme_type, const MethodInfo* method) {
if (InterlockedCompareExchange(&g_cp_set_scheme_hook_called, 1, 0) == 0) { if (InterlockedCompareExchange(&g_cp_set_scheme_hook_called, 1, 0) == 0) {
hook_log("[cgss-http-hook] Cute.CustomPreference.SetScemeMode hook invoked"); hook_log("[cgss-dmm-hook] Cute.CustomPreference.SetScemeMode hook invoked");
} }
if (g_orig_custom_preference_set_scheme_mode) { if (g_orig_custom_preference_set_scheme_mode) {
g_orig_custom_preference_set_scheme_mode( g_orig_custom_preference_set_scheme_mode(
@@ -214,7 +214,7 @@ namespace {
void patch_custom_preference_scheme() { void patch_custom_preference_scheme() {
const auto& urls = config::get(); const auto& urls = config::get();
if (!urls.force_http) { if (!urls.force_http) {
hook_log("[cgss-http-hook] force_http disabled, skipping CustomPreference scheme patch"); hook_log("[cgss-dmm-hook] force_http disabled, skipping CustomPreference scheme patch");
return; return;
} }
@@ -222,14 +222,14 @@ namespace {
"Assembly-CSharp.dll", "Cute", "CustomPreference" "Assembly-CSharp.dll", "Cute", "CustomPreference"
); );
if (!custom_preference) { if (!custom_preference) {
hook_log("[cgss-http-hook] failed to resolve Cute.CustomPreference"); hook_log("[cgss-dmm-hook] failed to resolve Cute.CustomPreference");
return; return;
} }
if (il2cpp_symbols::set_static_int_field(custom_preference, "_schemeType", kHttpSchemeType)) { if (il2cpp_symbols::set_static_int_field(custom_preference, "_schemeType", kHttpSchemeType)) {
hook_log("[cgss-http-hook] patched Cute.CustomPreference._schemeType=0"); hook_log("[cgss-dmm-hook] patched Cute.CustomPreference._schemeType=0");
} else { } else {
hook_log("[cgss-http-hook] failed to patch Cute.CustomPreference._schemeType"); hook_log("[cgss-dmm-hook] failed to patch Cute.CustomPreference._schemeType");
} }
} }
@@ -238,7 +238,7 @@ namespace {
"Assembly-CSharp.dll", "Cute", "CustomPreference" "Assembly-CSharp.dll", "Cute", "CustomPreference"
); );
if (!custom_preference) { if (!custom_preference) {
hook_log("[cgss-http-hook] failed to resolve Cute.CustomPreference for URL overrides"); hook_log("[cgss-dmm-hook] failed to resolve Cute.CustomPreference for URL overrides");
return; return;
} }
@@ -252,7 +252,7 @@ namespace {
if (set_scheme_mode_addr) { if (set_scheme_mode_addr) {
auto set_scheme_mode = reinterpret_cast<SetSchemeModeFn>(set_scheme_mode_addr); auto set_scheme_mode = reinterpret_cast<SetSchemeModeFn>(set_scheme_mode_addr);
set_scheme_mode(kHttpSchemeType, nullptr); set_scheme_mode(kHttpSchemeType, nullptr);
hook_log("[cgss-http-hook] applied Cute.CustomPreference.SetScemeMode(0)"); hook_log("[cgss-dmm-hook] applied Cute.CustomPreference.SetScemeMode(0)");
} }
} }
@@ -269,15 +269,15 @@ namespace {
auto api_value = il2cpp_symbols::new_string(urls.api_url.c_str()); auto api_value = il2cpp_symbols::new_string(urls.api_url.c_str());
if (set_application_addr && api_value) { if (set_application_addr && api_value) {
reinterpret_cast<SetStringFn>(set_application_addr)(api_value, nullptr); reinterpret_cast<SetStringFn>(set_application_addr)(api_value, nullptr);
hook_log("[cgss-http-hook] applied Cute.CustomPreference.SetApplicationServerURL"); hook_log("[cgss-dmm-hook] applied Cute.CustomPreference.SetApplicationServerURL");
} }
if (set_tele_scope_addr && api_value) { if (set_tele_scope_addr && api_value) {
reinterpret_cast<SetStringFn>(set_tele_scope_addr)(api_value, nullptr); reinterpret_cast<SetStringFn>(set_tele_scope_addr)(api_value, nullptr);
hook_log("[cgss-http-hook] applied Cute.CustomPreference.SetTeleScopeServerURL"); hook_log("[cgss-dmm-hook] applied Cute.CustomPreference.SetTeleScopeServerURL");
} }
if (set_concert_addr && api_value) { if (set_concert_addr && api_value) {
reinterpret_cast<SetStringFn>(set_concert_addr)(api_value, nullptr); reinterpret_cast<SetStringFn>(set_concert_addr)(api_value, nullptr);
hook_log("[cgss-http-hook] applied Cute.CustomPreference.SetConcertServerURL"); hook_log("[cgss-dmm-hook] applied Cute.CustomPreference.SetConcertServerURL");
} }
} }
@@ -288,7 +288,7 @@ namespace {
auto asset_value = il2cpp_symbols::new_string(urls.asset_url.c_str()); auto asset_value = il2cpp_symbols::new_string(urls.asset_url.c_str());
if (set_resource_addr && asset_value) { if (set_resource_addr && asset_value) {
reinterpret_cast<SetStringFn>(set_resource_addr)(asset_value, nullptr); reinterpret_cast<SetStringFn>(set_resource_addr)(asset_value, nullptr);
hook_log("[cgss-http-hook] applied Cute.CustomPreference.SetResourceServerURL"); hook_log("[cgss-dmm-hook] applied Cute.CustomPreference.SetResourceServerURL");
} }
} }
} }
@@ -303,7 +303,7 @@ namespace {
return; return;
} }
if (InterlockedCompareExchange(&g_logged_gameassembly, 1, 0) == 0) { if (InterlockedCompareExchange(&g_logged_gameassembly, 1, 0) == 0) {
hook_log("[cgss-http-hook] GameAssembly.dll loaded"); hook_log("[cgss-dmm-hook] GameAssembly.dll loaded");
g_gameassembly_seen_tick = GetTickCount64(); g_gameassembly_seen_tick = GetTickCount64();
} }
if (g_gameassembly_seen_tick != 0 && if (g_gameassembly_seen_tick != 0 &&
@@ -314,13 +314,13 @@ namespace {
il2cpp_symbols::init(game_assembly); il2cpp_symbols::init(game_assembly);
if (!il2cpp_symbols::ready()) { if (!il2cpp_symbols::ready()) {
if (InterlockedCompareExchange(&g_exports_state, 1, 0) == 0) { if (InterlockedCompareExchange(&g_exports_state, 1, 0) == 0) {
hook_log("[cgss-http-hook] il2cpp exports not ready"); hook_log("[cgss-dmm-hook] il2cpp exports not ready");
} }
return; return;
} }
LONG prev_exports_state = InterlockedExchange(&g_exports_state, 2); LONG prev_exports_state = InterlockedExchange(&g_exports_state, 2);
if (prev_exports_state != 2) { if (prev_exports_state != 2) {
hook_log("[cgss-http-hook] il2cpp exports ready"); hook_log("[cgss-dmm-hook] il2cpp exports ready");
} }
patch_custom_preference_scheme(); patch_custom_preference_scheme();
@@ -329,7 +329,7 @@ namespace {
"Assembly-CSharp.dll", "Stage", "NetworkUtil", "GetSchemeType", 0 "Assembly-CSharp.dll", "Stage", "NetworkUtil", "GetSchemeType", 0
); );
if (!addr) { if (!addr) {
hook_log("[cgss-http-hook] failed to resolve Stage.NetworkUtil.GetSchemeType"); hook_log("[cgss-dmm-hook] failed to resolve Stage.NetworkUtil.GetSchemeType");
return; return;
} }
@@ -375,7 +375,7 @@ namespace {
auto mh_status = MH_Initialize(); auto mh_status = MH_Initialize();
if (mh_status != MH_OK && mh_status != MH_ERROR_ALREADY_INITIALIZED) { if (mh_status != MH_OK && mh_status != MH_ERROR_ALREADY_INITIALIZED) {
hook_log("[cgss-http-hook] MH_Initialize failed"); hook_log("[cgss-dmm-hook] MH_Initialize failed");
return; return;
} }
@@ -387,17 +387,17 @@ namespace {
reinterpret_cast<void**>(&g_orig_get_scheme_type) reinterpret_cast<void**>(&g_orig_get_scheme_type)
); );
if (create_status != MH_OK && create_status != MH_ERROR_ALREADY_CREATED) { if (create_status != MH_OK && create_status != MH_ERROR_ALREADY_CREATED) {
hook_log("[cgss-http-hook] MH_CreateHook failed"); hook_log("[cgss-dmm-hook] MH_CreateHook failed");
return; return;
} }
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(addr));
if (enable_status != MH_OK && enable_status != MH_ERROR_ENABLED) { if (enable_status != MH_OK && enable_status != MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] MH_EnableHook failed"); hook_log("[cgss-dmm-hook] MH_EnableHook failed");
return; return;
} }
} else { } else {
hook_log("[cgss-http-hook] force_http disabled, keeping original scheme"); hook_log("[cgss-dmm-hook] force_http disabled, keeping original scheme");
} }
if (get_application_server_url_addr) { if (get_application_server_url_addr) {
@@ -409,7 +409,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(get_application_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(get_application_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Stage.NetworkUtil.GetApplicationServerUrl"); hook_log("[cgss-dmm-hook] hooked Stage.NetworkUtil.GetApplicationServerUrl");
} }
} }
} }
@@ -423,7 +423,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(get_resource_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(get_resource_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Stage.NetworkUtil.GetResourceServerUrl"); hook_log("[cgss-dmm-hook] hooked Stage.NetworkUtil.GetResourceServerUrl");
} }
} }
} }
@@ -437,7 +437,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(get_tele_scope_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(get_tele_scope_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Stage.NetworkUtil.GetTeleScopeServerUrl"); hook_log("[cgss-dmm-hook] hooked Stage.NetworkUtil.GetTeleScopeServerUrl");
} }
} }
} }
@@ -451,7 +451,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(get_concert_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(get_concert_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Stage.NetworkUtil.GetConcertServerUrl"); hook_log("[cgss-dmm-hook] hooked Stage.NetworkUtil.GetConcertServerUrl");
} }
} }
} }
@@ -465,7 +465,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_get_application_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_get_application_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Cute.CustomPreference.GetApplicationServerURL"); hook_log("[cgss-dmm-hook] hooked Cute.CustomPreference.GetApplicationServerURL");
} }
} }
} }
@@ -479,7 +479,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_get_tele_scope_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_get_tele_scope_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Cute.CustomPreference.GetTeleScopeServerURL"); hook_log("[cgss-dmm-hook] hooked Cute.CustomPreference.GetTeleScopeServerURL");
} }
} }
} }
@@ -493,7 +493,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_get_concert_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_get_concert_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Cute.CustomPreference.GetConcertServerURL"); hook_log("[cgss-dmm-hook] hooked Cute.CustomPreference.GetConcertServerURL");
} }
} }
} }
@@ -507,7 +507,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_get_resource_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_get_resource_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Cute.CustomPreference.GetResourceServerURL"); hook_log("[cgss-dmm-hook] hooked Cute.CustomPreference.GetResourceServerURL");
} }
} }
} }
@@ -521,7 +521,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_set_application_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_set_application_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Cute.CustomPreference.SetApplicationServerURL"); hook_log("[cgss-dmm-hook] hooked Cute.CustomPreference.SetApplicationServerURL");
} }
} }
} }
@@ -535,7 +535,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_set_tele_scope_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_set_tele_scope_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Cute.CustomPreference.SetTeleScopeServerURL"); hook_log("[cgss-dmm-hook] hooked Cute.CustomPreference.SetTeleScopeServerURL");
} }
} }
} }
@@ -549,7 +549,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_set_concert_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_set_concert_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Cute.CustomPreference.SetConcertServerURL"); hook_log("[cgss-dmm-hook] hooked Cute.CustomPreference.SetConcertServerURL");
} }
} }
} }
@@ -563,7 +563,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_set_resource_server_url_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_set_resource_server_url_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Cute.CustomPreference.SetResourceServerURL"); hook_log("[cgss-dmm-hook] hooked Cute.CustomPreference.SetResourceServerURL");
} }
} }
} }
@@ -577,7 +577,7 @@ namespace {
if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) { if (create_status == MH_OK || create_status == MH_ERROR_ALREADY_CREATED) {
auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_set_scheme_mode_addr)); auto enable_status = MH_EnableHook(reinterpret_cast<void*>(cp_set_scheme_mode_addr));
if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) { if (enable_status == MH_OK || enable_status == MH_ERROR_ENABLED) {
hook_log("[cgss-http-hook] hooked Cute.CustomPreference.SetScemeMode"); hook_log("[cgss-dmm-hook] hooked Cute.CustomPreference.SetScemeMode");
} }
} }
} }
@@ -586,7 +586,7 @@ namespace {
InterlockedExchange(&g_hook_installed, 1); InterlockedExchange(&g_hook_installed, 1);
if (urls.force_http) { if (urls.force_http) {
hook_log("[cgss-http-hook] hooked Stage.NetworkUtil.GetSchemeType"); hook_log("[cgss-dmm-hook] hooked Stage.NetworkUtil.GetSchemeType");
} }
} }
@@ -598,7 +598,7 @@ namespace {
} }
Sleep(kHookPollIntervalMs); Sleep(kHookPollIntervalMs);
} }
hook_log("[cgss-http-hook] timed out waiting for hook target"); hook_log("[cgss-dmm-hook] timed out waiting for hook target");
return 0; return 0;
} }
} }
+10 -10
View File
@@ -83,7 +83,7 @@ void* il2cpp_symbols::new_string(const char* value) {
void* il2cpp_symbols::get_class(const char* assembly_name, const char* namespaze, const char* klass_name) { void* il2cpp_symbols::get_class(const char* assembly_name, const char* namespaze, const char* klass_name) {
if (!attach_thread()) { if (!attach_thread()) {
hook_log("[cgss-http-hook] il2cpp domain not ready"); hook_log("[cgss-dmm-hook] il2cpp domain not ready");
return nullptr; return nullptr;
} }
if (!ready() || !il2cpp_domain) { if (!ready() || !il2cpp_domain) {
@@ -92,17 +92,17 @@ void* il2cpp_symbols::get_class(const char* assembly_name, const char* namespaze
auto assembly = il2cpp_domain_assembly_open(il2cpp_domain, assembly_name); auto assembly = il2cpp_domain_assembly_open(il2cpp_domain, assembly_name);
if (!assembly) { if (!assembly) {
hook_log("[cgss-http-hook] assembly not found"); hook_log("[cgss-dmm-hook] assembly not found");
return nullptr; return nullptr;
} }
auto image = il2cpp_assembly_get_image(assembly); auto image = il2cpp_assembly_get_image(assembly);
if (!image) { if (!image) {
hook_log("[cgss-http-hook] image not found"); hook_log("[cgss-dmm-hook] image not found");
return nullptr; return nullptr;
} }
auto klass = il2cpp_class_from_name(image, namespaze, klass_name); auto klass = il2cpp_class_from_name(image, namespaze, klass_name);
if (!klass) { if (!klass) {
hook_log("[cgss-http-hook] class not found"); hook_log("[cgss-dmm-hook] class not found");
return nullptr; return nullptr;
} }
return klass; return klass;
@@ -116,13 +116,13 @@ bool il2cpp_symbols::set_static_int_field(void* klass, const char* field_name, i
il2cpp_runtime_class_init(klass); il2cpp_runtime_class_init(klass);
auto field = il2cpp_class_get_field_from_name(klass, field_name); auto field = il2cpp_class_get_field_from_name(klass, field_name);
if (!field) { if (!field) {
hook_log("[cgss-http-hook] field not found"); hook_log("[cgss-dmm-hook] field not found");
return false; return false;
} }
auto flags = il2cpp_field_get_flags(field); auto flags = il2cpp_field_get_flags(field);
if ((flags & 0x10U) == 0) { if ((flags & 0x10U) == 0) {
hook_log("[cgss-http-hook] field is not static"); hook_log("[cgss-dmm-hook] field is not static");
return false; return false;
} }
@@ -138,19 +138,19 @@ bool il2cpp_symbols::set_static_string_field(void* klass, const char* field_name
il2cpp_runtime_class_init(klass); il2cpp_runtime_class_init(klass);
auto field = il2cpp_class_get_field_from_name(klass, field_name); auto field = il2cpp_class_get_field_from_name(klass, field_name);
if (!field) { if (!field) {
hook_log("[cgss-http-hook] field not found"); hook_log("[cgss-dmm-hook] field not found");
return false; return false;
} }
auto flags = il2cpp_field_get_flags(field); auto flags = il2cpp_field_get_flags(field);
if ((flags & 0x10U) == 0) { if ((flags & 0x10U) == 0) {
hook_log("[cgss-http-hook] field is not static"); hook_log("[cgss-dmm-hook] field is not static");
return false; return false;
} }
auto string_object = new_string(value); auto string_object = new_string(value);
if (!string_object) { if (!string_object) {
hook_log("[cgss-http-hook] failed to allocate il2cpp string"); hook_log("[cgss-dmm-hook] failed to allocate il2cpp string");
return false; return false;
} }
@@ -166,7 +166,7 @@ uintptr_t il2cpp_symbols::get_method_pointer(const char* assembly_name, const ch
} }
auto method = il2cpp_class_get_method_from_name(klass, method_name, args_count); auto method = il2cpp_class_get_method_from_name(klass, method_name, args_count);
if (!method) { if (!method) {
hook_log("[cgss-http-hook] method not found"); hook_log("[cgss-dmm-hook] method not found");
return 0; return 0;
} }
return method->methodPointer; return method->methodPointer;
+1 -1
View File
@@ -23,7 +23,7 @@ namespace {
} }
} }
*last_sep = '\0'; *last_sep = '\0';
lstrcatA(path, "\\cgss-http-hook.log"); lstrcatA(path, "\\cgss-dmm-hook.log");
g_log_file = CreateFileA( g_log_file = CreateFileA(
path, path,
+3 -3
View File
@@ -52,7 +52,7 @@ namespace {
g_original = LoadLibraryA(path); g_original = LoadLibraryA(path);
if (!g_original) { if (!g_original) {
hook_log("[cgss-http-hook] failed to load original version.dll"); hook_log("[cgss-dmm-hook] failed to load original version.dll");
return; return;
} }
@@ -61,11 +61,11 @@ namespace {
VerQueryValueA_Original = reinterpret_cast<void*>(GetProcAddress(g_original, "VerQueryValueA")); VerQueryValueA_Original = reinterpret_cast<void*>(GetProcAddress(g_original, "VerQueryValueA"));
if (!GetFileVersionInfoA_Original || !GetFileVersionInfoSizeA_Original || !VerQueryValueA_Original) { if (!GetFileVersionInfoA_Original || !GetFileVersionInfoSizeA_Original || !VerQueryValueA_Original) {
hook_log("[cgss-http-hook] failed to resolve version exports"); hook_log("[cgss-dmm-hook] failed to resolve version exports");
return; return;
} }
hook_log("[cgss-http-hook] version.dll initialized"); hook_log("[cgss-dmm-hook] version.dll initialized");
} }
DWORD WINAPI init_thread(void*) { DWORD WINAPI init_thread(void*) {
+3 -3
View File
@@ -23,11 +23,11 @@ BEGIN
BLOCK "040904B0" BLOCK "040904B0"
BEGIN BEGIN
VALUE "CompanyName", "YumeMichi\0" VALUE "CompanyName", "YumeMichi\0"
VALUE "FileDescription", "cgss-http-hook version.dll proxy\0" VALUE "FileDescription", "cgss-dmm-hook version.dll proxy\0"
VALUE "FileVersion", VER_FILEVERSION_STR VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "cgss-http-hook\0" VALUE "InternalName", "cgss-dmm-hook\0"
VALUE "OriginalFilename", "version.dll\0" VALUE "OriginalFilename", "version.dll\0"
VALUE "ProductName", "cgss-http-hook\0" VALUE "ProductName", "cgss-dmm-hook\0"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END END
END END