├── .gitignore ├── Gal汉化入门 ├── [Gal汉化入门]#18 内存补丁 │ ├── README.md │ ├── Source.cpp │ ├── Tools.h │ └── get.c └── [Gal汉化入门]#20 HOOK任意位置 │ └── 2.HOOK任意位置 │ ├── 2.HOOK任意位置.sln │ └── 2.HOOK任意位置 │ ├── 2.HOOK任意位置.cpp │ ├── 2.HOOK任意位置.vcxproj │ ├── 2.HOOK任意位置.vcxproj.filters │ ├── 2.HOOK任意位置.vcxproj.user │ └── test.h ├── Gal汉化分析 ├── CMVS引擎 │ ├── cmvs32.exe.idb │ └── libamatsutsumi.so.idb ├── PJADV引擎 │ ├── font_size_table.txt │ └── idb │ │ ├── KURU2PSS.exe.idb │ │ └── KURU2PSS.exe.json ├── 封包结构逆向 │ └── [Gal汉化分析] 封包逆向初步.pptx └── 文件系统初探 │ ├── R_Pack.zip │ └── [Gal汉化分析] 文件系统初探.pptx ├── Gal汉化实例 └── [Gal汉化实例] YU-RIS引擎 │ ├── Tools │ ├── EnigmaVBUnpacker_v0.61.zip │ ├── HookFont.zip │ ├── RangTable │ │ ├── GBK_Rang_Table.bin │ │ └── SJIS_Rang_Table.bin │ ├── Replace_RangTable.exe │ ├── YSCFG_Editor.exe │ ├── YSCM_Parse.exe │ ├── YSTBV2TextEditor.exe │ ├── YSTB_GuessXorKey.exe │ ├── YSTB_Xor.exe │ ├── YSTL_Parse.exe │ ├── ae_20170405_nosrc.7z │ ├── extYbn.zip │ ├── lneditor_2_1_2.7z │ ├── 人名括号问题.png │ ├── 人名括号问题.txt │ └── 工具链接.txt │ └── [Gal汉化实例] YU-RIS引擎.pptx ├── README.md └── 其它 ├── Hook字体 ├── HookFont.dll ├── HookFont.exe ├── HookFont.ini ├── src │ └── HookFont.zip └── 使用说明.txt ├── Triangle Complete Disc Crack └── Triangle Complete Disc Crack.7z ├── eden_pm_en ├── EdenPMHook │ ├── Detours │ │ ├── creatwth.cpp │ │ ├── detours.cpp │ │ ├── detours.h │ │ ├── detver.h │ │ ├── disasm.cpp │ │ ├── disolarm.cpp │ │ ├── disolarm64.cpp │ │ ├── disolia64.cpp │ │ ├── disolx64.cpp │ │ ├── disolx86.cpp │ │ ├── image.cpp │ │ ├── modules.cpp │ │ └── uimports.cpp │ ├── EdenPMHook.sln │ └── EdenPMHook │ │ ├── EdenPMHook.vcxproj │ │ ├── EdenPMHook.vcxproj.filters │ │ ├── EdenPMHook.vcxproj.user │ │ ├── Tools.cpp │ │ ├── Tools.h │ │ └── dllmain.cpp └── image │ ├── Check1-1.png │ ├── Check1-2.png │ ├── Check1-3.png │ └── Check2-1.png └── 现妹Bypass ├── README.md ├── scr ├── Imasugu_crack.c ├── file.zip └── imaimo_cn_fix.c ├── 中文 ├── imaimo_cn_fix.cpk └── imaimo_cn_fix.exe └── 日文 └── Imasugu_crack.exe /.gitignore: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio. 3 | ################################################################################ 4 | 5 | /.vs 6 | -------------------------------------------------------------------------------- /Gal汉化入门/[Gal汉化入门]#18 内存补丁/README.md: -------------------------------------------------------------------------------- 1 | # Compiler 2 | Tiny C Compiler 3 | http://download.savannah.gnu.org/releases/tinycc/ 4 | Viusal Studio 2022 5 | https://visualstudio.microsoft.com/vs/ 6 | 7 | # TestGame 8 | 月の彼方で逢いましょう PKG 9 | https://vndb.org/v24803 10 | -------------------------------------------------------------------------------- /Gal汉化入门/[Gal汉化入门]#18 内存补丁/Source.cpp: -------------------------------------------------------------------------------- 1 | #include "Tools.h" 2 | 3 | //#pragma comment(linker,"/subsystem:\"Windows\" /entry:\"mainCRTStartup\"") 4 | 5 | 6 | int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 7 | { 8 | 9 | if (!GetStart(L"C:\\Users\\Dir-A\\Desktop\\1\\SiglusEngine.exe")) 10 | { 11 | ExitProcess(0); 12 | } 13 | 14 | DWORD my_ImageBase = GetImageBase(); 15 | 16 | BYTE my_fix[] = { 0x11,0xD1 }; 17 | WriteMemory((LPVOID)(my_ImageBase + 0x3489AE), my_fix, sizeof(my_fix)); 18 | 19 | //getchar(); 20 | BYTE write_Bytes[] = { 0xB0,0x01,0xC3 }; 21 | WriteMemory((LPVOID)(my_ImageBase + 0x22B8E0), write_Bytes, sizeof(write_Bytes)); 22 | 23 | BYTE write_Bytes1[] = { 0x90,0x90 }; 24 | WriteMemory((LPVOID)(my_ImageBase + 0x21FB8C), write_Bytes1, sizeof(write_Bytes1)); 25 | 26 | //BYTE read_Bytes[7] = {0}; 27 | //ReadMemory((LPCVOID)(my_ImageBase + 0x29366B), read_Bytes,sizeof(read_Bytes)); 28 | 29 | //CmpMemory(write_Bytes, read_Bytes, 7); 30 | 31 | 32 | 33 | ResumeThread(pi.hThread); 34 | CloseHandle(pi.hProcess); 35 | CloseHandle(pi.hThread); 36 | 37 | } 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Gal汉化入门/[Gal汉化入门]#18 内存补丁/Tools.h: -------------------------------------------------------------------------------- 1 | #include 2 | STARTUPINFOW si; 3 | PROCESS_INFORMATION pi; 4 | 5 | 6 | BOOL GetStart(LPCWSTR lpApplicationName) 7 | { 8 | ZeroMemory(&si, sizeof(si)); 9 | si.cb = sizeof(si); 10 | ZeroMemory(&pi, sizeof(pi)); 11 | if (!CreateProcessW(lpApplicationName, NULL, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &si, &pi)) 12 | { 13 | MessageBoxW(NULL, L"Get Start Failed!!", NULL, MB_OK); 14 | return FALSE; 15 | } 16 | 17 | return TRUE; 18 | } 19 | 20 | DWORD GetImageBase() 21 | { 22 | DWORD dwImageBase = 0; 23 | 24 | CONTEXT Regs{}; 25 | Regs.ContextFlags = CONTEXT_ALL; 26 | GetThreadContext(pi.hThread, &Regs); 27 | 28 | if (!ReadProcessMemory(pi.hProcess, (LPCVOID)(Regs.Ebx + 0x8), &dwImageBase, sizeof(DWORD), NULL)) 29 | { 30 | MessageBoxW(NULL, L"Get BaseImage Failed!!", NULL, MB_OK); 31 | return FALSE; 32 | } 33 | return dwImageBase; 34 | } 35 | 36 | void WriteMemory(LPVOID lpAddress, LPCVOID lpBuffer, SIZE_T nSize) 37 | { 38 | DWORD oldProtect; 39 | 40 | if (!VirtualProtectEx(pi.hProcess, lpAddress, nSize, PAGE_EXECUTE_READWRITE, &oldProtect)) 41 | { 42 | MessageBoxW(NULL, L"VirtualProtectEx Failed!!", NULL, MB_OK); 43 | } 44 | else if (!WriteProcessMemory(pi.hProcess, lpAddress, lpBuffer, nSize, NULL)) 45 | { 46 | MessageBoxW(NULL, L"WriteProcessMemory Failed!!", NULL, MB_OK); 47 | } 48 | } 49 | 50 | void ReadMemory(LPCVOID lpAddress, LPVOID lpBuffer, SIZE_T nSize) 51 | { 52 | 53 | if (!ReadProcessMemory(pi.hProcess, lpAddress, lpBuffer, nSize, NULL)) 54 | { 55 | MessageBoxW(NULL, L"ReadMemory Failed!!", NULL, MB_OK); 56 | } 57 | } 58 | 59 | BOOL CmpMemory(LPCVOID Buffer1, LPCVOID Buffer2, SIZE_T nSize) 60 | { 61 | if (!memcmp(Buffer1, Buffer2, nSize)) 62 | { 63 | MessageBoxW(NULL, L"identical", NULL, MB_OK); 64 | return TRUE; 65 | } 66 | else 67 | { 68 | MessageBoxW(NULL, L"inequality", NULL, MB_OK); 69 | return FALSE; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Gal汉化入门/[Gal汉化入门]#18 内存补丁/get.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | STARTUPINFOW si; 4 | PROCESS_INFORMATION pi; 5 | 6 | 7 | BOOL GetStart(LPCWSTR lpApplicationName) 8 | { 9 | ZeroMemory(&si, sizeof(si)); 10 | si.cb = sizeof(si); 11 | ZeroMemory(&pi, sizeof(pi)); 12 | if (!CreateProcessW(lpApplicationName, NULL, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &si, &pi)) 13 | { 14 | MessageBoxW(NULL, L"Get Start Failed!!", NULL, MB_OK); 15 | return FALSE; 16 | } 17 | 18 | return TRUE; 19 | } 20 | 21 | DWORD GetImageBase() 22 | { 23 | DWORD dwImageBase = 0; 24 | 25 | CONTEXT Regs = {}; 26 | Regs.ContextFlags = CONTEXT_ALL; 27 | GetThreadContext(pi.hThread, &Regs); 28 | 29 | if (!ReadProcessMemory(pi.hProcess, (LPCVOID)(Regs.Ebx + 0x8), &dwImageBase, sizeof(DWORD), NULL)) 30 | { 31 | MessageBoxW(NULL, L"Get BaseImage Failed!!", NULL, MB_OK); 32 | return FALSE; 33 | } 34 | return dwImageBase; 35 | } 36 | 37 | VOID WriteMemory(LPVOID lpAddress, LPCVOID lpBuffer, SIZE_T nSize) 38 | { 39 | DWORD oldProtect; 40 | 41 | if (!VirtualProtectEx(pi.hProcess, lpAddress, nSize, PAGE_EXECUTE_READWRITE, &oldProtect)) 42 | { 43 | MessageBoxW(NULL, L"VirtualProtectEx Failed!!", NULL, MB_OK); 44 | } 45 | else if (!WriteProcessMemory(pi.hProcess, lpAddress, lpBuffer, nSize, NULL)) 46 | { 47 | MessageBoxW(NULL, L"WriteProcessMemory Failed!!", NULL, MB_OK); 48 | } 49 | } 50 | 51 | VOID ReadMemory(LPCVOID lpAddress, LPVOID lpBuffer, SIZE_T nSize) 52 | { 53 | 54 | if (!ReadProcessMemory(pi.hProcess, lpAddress, lpBuffer, nSize, NULL)) 55 | { 56 | MessageBoxW(NULL, L"ReadMemory Failed!!", NULL, MB_OK); 57 | } 58 | } 59 | 60 | BOOL CmpMemory(LPCVOID Buffer1, LPCVOID Buffer2, SIZE_T nSize) 61 | { 62 | if (!memcmp(Buffer1, Buffer2, nSize)) 63 | { 64 | MessageBoxW(NULL, L"identical", NULL, MB_OK); 65 | return TRUE; 66 | } 67 | else 68 | { 69 | MessageBoxW(NULL, L"inequality", NULL, MB_OK); 70 | return FALSE; 71 | } 72 | } 73 | 74 | 75 | INT APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 76 | { 77 | if (!GetStart(L"SiglusEngine.exe")) 78 | { 79 | ExitProcess(0); 80 | } 81 | 82 | DWORD my_ImageBase = GetImageBase(); 83 | 84 | //BYTE my_fix[] = { 0x11,0xD1 }; 85 | //WriteMemory((LPVOID)(my_ImageBase + 0x3489AE), my_fix, sizeof(my_fix)); 86 | 87 | BYTE write_Bytes[] = { 0xB0,0x01,0xC3 }; 88 | WriteMemory((LPVOID)(my_ImageBase + 0x22B8E0), write_Bytes, sizeof(write_Bytes)); 89 | 90 | BYTE write_Bytes1[] = { 0x90,0x90 }; 91 | WriteMemory((LPVOID)(my_ImageBase + 0x21FB8C), write_Bytes1, sizeof(write_Bytes1)); 92 | 93 | //BYTE read_Bytes[7] = {0}; 94 | //ReadMemory((LPCVOID)(my_ImageBase + 0x29366B), read_Bytes,sizeof(read_Bytes)); 95 | 96 | //CmpMemory(write_Bytes, read_Bytes, 7); 97 | 98 | ResumeThread(pi.hThread); 99 | CloseHandle(pi.hProcess); 100 | CloseHandle(pi.hThread); 101 | } 102 | -------------------------------------------------------------------------------- /Gal汉化入门/[Gal汉化入门]#20 HOOK任意位置/2.HOOK任意位置/2.HOOK任意位置.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.2.32616.157 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2.HOOK任意位置", "2.HOOK任意位置\2.HOOK任意位置.vcxproj", "{A6F03D7F-EB46-46E6-97EF-D89F9BEF6F34}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {A6F03D7F-EB46-46E6-97EF-D89F9BEF6F34}.Debug|x64.ActiveCfg = Debug|x64 17 | {A6F03D7F-EB46-46E6-97EF-D89F9BEF6F34}.Debug|x64.Build.0 = Debug|x64 18 | {A6F03D7F-EB46-46E6-97EF-D89F9BEF6F34}.Debug|x86.ActiveCfg = Debug|Win32 19 | {A6F03D7F-EB46-46E6-97EF-D89F9BEF6F34}.Debug|x86.Build.0 = Debug|Win32 20 | {A6F03D7F-EB46-46E6-97EF-D89F9BEF6F34}.Release|x64.ActiveCfg = Release|x64 21 | {A6F03D7F-EB46-46E6-97EF-D89F9BEF6F34}.Release|x64.Build.0 = Release|x64 22 | {A6F03D7F-EB46-46E6-97EF-D89F9BEF6F34}.Release|x86.ActiveCfg = Release|Win32 23 | {A6F03D7F-EB46-46E6-97EF-D89F9BEF6F34}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {CB9640E2-96CE-481E-AA9B-2C7153DE226C} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Gal汉化入门/[Gal汉化入门]#20 HOOK任意位置/2.HOOK任意位置/2.HOOK任意位置/2.HOOK任意位置.cpp: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | 4 | DWORD orgAddr = 0x00493ED3; 5 | DWORD retAddr = orgAddr + 0x5; 6 | LPCWSTR str = L"Dir-A"; 7 | 8 | VOID __declspec(naked) MyHook() 9 | { 10 | __asm 11 | { 12 | pushad 13 | pushfd 14 | } 15 | 16 | __asm 17 | { 18 | push 0x3F4 19 | push 0x0 20 | push 0x0 21 | push str 22 | push str 23 | push 0x0 24 | call dword ptr ds : [0x005D1214] 25 | } 26 | MessageBoxW(NULL, L"Dir-A", NULL, MB_OK); 27 | __asm 28 | { 29 | popfd 30 | popad 31 | } 32 | __asm call dword ptr ds : [0x005D1214] 33 | __asm jmp retAddr 34 | } 35 | 36 | VOID WriteHookCode(DWORD tarAddr,DWORD orgAddr) 37 | { 38 | DWORD oldProtect = 0; 39 | VirtualProtect((LPVOID)orgAddr, 0x6, PAGE_EXECUTE_READWRITE, &oldProtect); 40 | 41 | DWORD rvaAddr = tarAddr - orgAddr - 0x5; 42 | 43 | BYTE code[] = { 0xE9,0x90,0x90,0x90,0x90,0x90 }; 44 | 45 | memcpy(&code[1], &rvaAddr, 0x4); 46 | 47 | memcpy((void*)orgAddr, code, 0x6); 48 | } 49 | 50 | int main() 51 | { 52 | WriteHookCode((DWORD)MyHook, orgAddr); 53 | RunMethod1(); 54 | std::cout << "Hello World!\n"; 55 | } 56 | -------------------------------------------------------------------------------- /Gal汉化入门/[Gal汉化入门]#20 HOOK任意位置/2.HOOK任意位置/2.HOOK任意位置/2.HOOK任意位置.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {a6f03d7f-eb46-46e6-97ef-d89f9bef6f34} 25 | My2HOOK任意位置 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | true 77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 78 | true 79 | MultiThreadedDebug 80 | 81 | 82 | Console 83 | true 84 | false 85 | 86 | 87 | 88 | 89 | Level3 90 | true 91 | true 92 | true 93 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 94 | true 95 | MultiThreaded 96 | 97 | 98 | Console 99 | true 100 | true 101 | true 102 | false 103 | 104 | 105 | 106 | 107 | Level3 108 | true 109 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 110 | true 111 | 112 | 113 | Console 114 | true 115 | 116 | 117 | 118 | 119 | Level3 120 | true 121 | true 122 | true 123 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 124 | true 125 | 126 | 127 | Console 128 | true 129 | true 130 | true 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /Gal汉化入门/[Gal汉化入门]#20 HOOK任意位置/2.HOOK任意位置/2.HOOK任意位置/2.HOOK任意位置.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /Gal汉化入门/[Gal汉化入门]#20 HOOK任意位置/2.HOOK任意位置/2.HOOK任意位置/2.HOOK任意位置.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Gal汉化入门/[Gal汉化入门]#20 HOOK任意位置/2.HOOK任意位置/2.HOOK任意位置/test.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | typedef int (WINAPI* pMessageBoxTimeoutA)( 5 | IN HWND hWnd, 6 | IN LPCSTR lpText, 7 | IN LPCSTR lpCaption, 8 | IN UINT uType, 9 | IN WORD wLanguageId, 10 | IN DWORD dwMilliseconds); 11 | pMessageBoxTimeoutA MessageBoxTimeoutA; 12 | 13 | typedef int(WINAPI* pMessageBoxTimeoutW)( 14 | IN HWND hWnd, 15 | IN LPCWSTR lpText, 16 | IN LPCWSTR lpCaption, 17 | IN UINT uType, 18 | IN WORD wLanguageId, 19 | IN DWORD dwMilliseconds); 20 | pMessageBoxTimeoutW MessageBoxTimeoutW; 21 | 22 | VOID ConvertStr(CHAR* procName) 23 | { 24 | for (size_t i = 0; i < 19; i++) 25 | { 26 | procName[i] = ~procName[i]; 27 | } 28 | } 29 | 30 | FARPROC GetFuncAddress(CHAR* procName) 31 | { 32 | ConvertStr(procName); 33 | 34 | HMODULE hDll = LoadLibraryW(L"user32.dll"); 35 | if (hDll == NULL) 36 | { 37 | ExitProcess(0); 38 | } 39 | 40 | FARPROC procAddr = GetProcAddress(hDll, procName); 41 | FreeLibrary(hDll); 42 | 43 | return procAddr; 44 | } 45 | 46 | VOID RunMethod1() 47 | { 48 | CHAR strW[] = { 0xb2,0x9a,0x8c,0x8c,0x9e,0x98,0x9a,0xbd,0x90,0x87,0xab,0x96,0x92,0x9a,0x90,0x8a,0x8b,0xa8,0xff }; 49 | 50 | MessageBoxTimeoutW = (pMessageBoxTimeoutW)GetFuncAddress(strW); 51 | MessageBoxTimeoutW(NULL, L"Test this BoxW", L"Method1", MB_OK, NULL, 500); 52 | 53 | //MessageBoxTimeoutA = (pMessageBoxTimeoutA)GetFuncAddress(strW); 54 | //MessageBoxTimeoutA(NULL, "Test this BoxA", "Method1", MB_OK, NULL, 500); 55 | } -------------------------------------------------------------------------------- /Gal汉化分析/CMVS引擎/cmvs32.exe.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化分析/CMVS引擎/cmvs32.exe.idb -------------------------------------------------------------------------------- /Gal汉化分析/CMVS引擎/libamatsutsumi.so.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化分析/CMVS引擎/libamatsutsumi.so.idb -------------------------------------------------------------------------------- /Gal汉化分析/PJADV引擎/font_size_table.txt: -------------------------------------------------------------------------------- 1 | 人妻天国2 ~繁殖マンション、人妻の子宮を子種で満たす~ DL版 (files) 2 | 3 | dlscenario.dat:offset:0x4FAA8 -> Msg Character Name Font 4 | 0B000003 5 | 00000000 6 | F1000000 7 | 04020000 8 | 2C010000 9 | 1E000000 -> per line max len 10 | 1E000000 -> heigh 11 | 1E000000 -> width 12 | 1E000000 -> line space 13 | FFFFFF00 14 | 01000000 15 | 16 | dlscenario.dat:offset:0x4FAD4 -> Msg Text Font 17 | 0B000003 18 | 01000000 19 | F1000000 20 | 36020000 21 | 0A030000 22 | 73000000 -> per line max len 23 | 1C000000 -> heigh 24 | 1E000000 -> width 25 | 2B000000 -> line space 26 | FFFFFF00 27 | 01000000 28 | 29 | 30 | dlscenario.dat:offset:0x4FB00 -> 31 | 0B000003 32 | 02000000 33 | F1000000 34 | 36020000 35 | 0A030000 36 | 73000000 37 | 2D000000 38 | 2D000000 39 | 37000000 40 | FFFFFF00 41 | 01000000 42 | 43 | 44 | dlscenario.dat:offset:0x4FB2C -> 45 | 0B000003 46 | 03000000 47 | F1000000 48 | 36020000 49 | 0A030000 50 | 73000000 51 | 46000000 52 | 46000000 53 | 46000000 54 | FFFFFF00 55 | 01000000 56 | 57 | dlscenario.dat:offset:0x4FB58 -> 58 | 0B000003 59 | 04000000 60 | F1000000 61 | 36020000 62 | 0A030000 63 | 73000000 64 | 14000000 65 | 14000000 66 | 1E000000 67 | FFFFFF00 68 | 01000000 69 | 70 | dlscenario.dat:offset:0x5482C -> Config Font 71 | 0B000003 72 | 06000000 73 | 15030000 74 | F1000000 75 | 3E010000 76 | 1E000000 77 | 1E000000 78 | 20000000 79 | 1E000000 80 | FFFFFF00 81 | 01000000 82 | 83 | 84 | dlscenario.dat:offset:0x4FBC0 -> Ruby Font 85 | 04180003 86 | 01000000 87 | 0C000000 -> heigh 88 | 0E000000 -> distance to target text 89 | 90 | dlscenario.dat:offset:0x4FBD0 -> 91 | 04180003 92 | 02000000 93 | 10000000 94 | 12000000 95 | 96 | dlscenario.dat:offset:0x4FBE0 -> 97 | 04180003 98 | 03000000 99 | 14000000 100 | 16000000 101 | 102 | dlscenario.dat:offset:0x4FBF0 -> 103 | 04180003 104 | 04000000 105 | 08000000 106 | 09000000 107 | 108 | 109 | dlscenario.dat:offset:0x4FCA8 / 0x509E4 / 0x50C2C -> Log Font 110 | 1B0103F0 111 | 7A000000 112 | 12000000 113 | 14040000 114 | AA000000 115 | 04000000 116 | AD000000 117 | 76000000 118 | 0B000000 119 | 1C000000 -> character name heigh 120 | 1E000000 -> character name width 121 | 1E000000 -> 122 | 0AAAFF00 123 | 0AAAFF00 124 | 01000100 125 | FFFF1000 126 | 76000000 127 | 36000000 128 | 1C000000 -> msg text heigh 129 | 1E000000 -> msg text width 130 | 2B000000 -> msg text line space 131 | FFFFFF00 132 | FFFFFF00 133 | 01000100 134 | 00001000 135 | 00000000 136 | 00000000 -------------------------------------------------------------------------------- /Gal汉化分析/PJADV引擎/idb/KURU2PSS.exe.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化分析/PJADV引擎/idb/KURU2PSS.exe.idb -------------------------------------------------------------------------------- /Gal汉化分析/PJADV引擎/idb/KURU2PSS.exe.json: -------------------------------------------------------------------------------- 1 | { 2 | "game_title": "ティンクル☆くるせいだーすPSS PKG", 3 | "game_version": "1.19", 4 | "game_engine": "PJADV", 5 | "export_time": "2024-01-09 01:18:45.700599", 6 | "func_list": [ 7 | { 8 | "name": "PAJ::VM::Stack::Get", 9 | "addr": "0x401020" 10 | }, 11 | { 12 | "name": "PAJ::Dat::FileName::Get", 13 | "addr": "0x4022f0" 14 | }, 15 | { 16 | "name": "PAJ::Dat::Textdata::Get", 17 | "addr": "0x402310" 18 | }, 19 | { 20 | "name": "PAJ::Dat::Scenario::GetCodePtr", 21 | "addr": "0x402330" 22 | }, 23 | { 24 | "name": "PAJ::Dat::Scenario::FindInChapter", 25 | "addr": "0x402340" 26 | }, 27 | { 28 | "name": "PAJ::VM::Ctor", 29 | "addr": "0x402380" 30 | }, 31 | { 32 | "name": "PAJ::CheckCtrlKey", 33 | "addr": "0x4041c0" 34 | }, 35 | { 36 | "name": "PAJ::VM::404340", 37 | "addr": "0x404340" 38 | }, 39 | { 40 | "name": "PAJ::Timer::Wait", 41 | "addr": "0x405130" 42 | }, 43 | { 44 | "name": "PAJ::SetWindowFront", 45 | "addr": "0x4053e0" 46 | }, 47 | { 48 | "name": "PAJ::VM::Dtor", 49 | "addr": "0x405a70" 50 | }, 51 | { 52 | "name": "PAJ::VM::Dispatch", 53 | "addr": "0x405e10" 54 | }, 55 | { 56 | "name": "PAJ::VM::418740", 57 | "addr": "0x418740" 58 | }, 59 | { 60 | "name": "PAJ::VM::Execute", 61 | "addr": "0x4192a0" 62 | }, 63 | { 64 | "name": "PAJ::INI::NextToken", 65 | "addr": "0x419320" 66 | }, 67 | { 68 | "name": "PAJ::INI::GetValueStart", 69 | "addr": "0x419380" 70 | }, 71 | { 72 | "name": "PAJ::INI::Skip", 73 | "addr": "0x419400" 74 | }, 75 | { 76 | "name": "PAJ::INI::Skip_", 77 | "addr": "0x419470" 78 | }, 79 | { 80 | "name": "PAJ::INI::GetType", 81 | "addr": "0x4194a0" 82 | }, 83 | { 84 | "name": "PAJ::INI::ParseStr", 85 | "addr": "0x419dc0" 86 | }, 87 | { 88 | "name": "PAJ::INI::ReadGameTitle", 89 | "addr": "0x41bd50" 90 | }, 91 | { 92 | "name": "PAJ::STD::Str::Copy", 93 | "addr": "0x41c210" 94 | }, 95 | { 96 | "name": "PAJ::STD::Str::Ctor_T0", 97 | "addr": "0x41c2f0" 98 | }, 99 | { 100 | "name": "PAJ::STD::Str::Copy_T1", 101 | "addr": "0x41c3c0" 102 | }, 103 | { 104 | "name": "PAJ::INI::List::SetValue", 105 | "addr": "0x41c3f0" 106 | }, 107 | { 108 | "name": "PAJ::STD::Str::Ctor_T1", 109 | "addr": "0x41c520" 110 | }, 111 | { 112 | "name": "PAJ::INI::List::AddSize", 113 | "addr": "0x41c560" 114 | }, 115 | { 116 | "name": "PAJ::INI::List::Append", 117 | "addr": "0x41c6a0" 118 | }, 119 | { 120 | "name": "PAJ::INI::Parse", 121 | "addr": "0x41c740" 122 | }, 123 | { 124 | "name": "PAJ::ANM::Load", 125 | "addr": "0x41d010" 126 | }, 127 | { 128 | "name": "PAJ::Str::Cmp", 129 | "addr": "0x420560" 130 | }, 131 | { 132 | "name": "PAJ::ArchiveManager::Dtor", 133 | "addr": "0x4205f0" 134 | }, 135 | { 136 | "name": "PAJ::STD::Str::Cmp", 137 | "addr": "0x420760" 138 | }, 139 | { 140 | "name": "PAJ::INI::List::NewNode", 141 | "addr": "0x420910" 142 | }, 143 | { 144 | "name": "PAJ::ArchiveManager::Map::NewHeader", 145 | "addr": "0x420930" 146 | }, 147 | { 148 | "name": "PAJ::ArchiveManager::Map::Tree::Find", 149 | "addr": "0x420970" 150 | }, 151 | { 152 | "name": "PAJ::STD::Str::Dtor", 153 | "addr": "0x420a00" 154 | }, 155 | { 156 | "name": "PAJ::ArchiveManager::Key::Find", 157 | "addr": "0x420a30" 158 | }, 159 | { 160 | "name": "PAJ::ArchiveManager::Vector::Exception", 161 | "addr": "0x420b60" 162 | }, 163 | { 164 | "name": "PAJ::ArchiveManager::Vector::420C40", 165 | "addr": "0x420c40" 166 | }, 167 | { 168 | "name": "PAJ::ArchiveManager::Vector::Value::Free", 169 | "addr": "0x420ca0" 170 | }, 171 | { 172 | "name": "PAJ::ArchiveManager::FindPath_Imp", 173 | "addr": "0x420ce0" 174 | }, 175 | { 176 | "name": "PAJ::ArchiveManager::FindPath", 177 | "addr": "0x420ed0" 178 | }, 179 | { 180 | "name": "PAJ::INI::List::Dtor", 181 | "addr": "0x420f90" 182 | }, 183 | { 184 | "name": "PAJ::ArchiveManager::Vector::Append::Direct", 185 | "addr": "0x421330" 186 | }, 187 | { 188 | "name": "PAJ::ArchiveManager::Map::Free", 189 | "addr": "0x4215c0" 190 | }, 191 | { 192 | "name": "PAJ::ArchiveManager::Vector::Free", 193 | "addr": "0x4219f0" 194 | }, 195 | { 196 | "name": "PAJ::ArchiveManager::AddFileName", 197 | "addr": "0x421bd0" 198 | }, 199 | { 200 | "name": "PAJ::ArchiveManager::Clear", 201 | "addr": "0x422170" 202 | }, 203 | { 204 | "name": "PAJ::ArchiveManager::Vector::Append::Realloc", 205 | "addr": "0x4221e0" 206 | }, 207 | { 208 | "name": "PAJ::ArchiveManager::Vector::Append", 209 | "addr": "0x4222e0" 210 | }, 211 | { 212 | "name": "PAJ::ArchiveManager::Ctor", 213 | "addr": "0x422390" 214 | }, 215 | { 216 | "name": "PAJ::ArchiveManager::AddPackName", 217 | "addr": "0x4224f0" 218 | }, 219 | { 220 | "name": "PAJ::ArchiveManager::LoadPack", 221 | "addr": "0x4225c0" 222 | }, 223 | { 224 | "name": "PAJ::ArchiveManager::Init", 225 | "addr": "0x422710" 226 | }, 227 | { 228 | "name": "PAJ::DrawText_T2_Imp", 229 | "addr": "0x4267c0" 230 | }, 231 | { 232 | "name": "PAJ::DrawText_T2", 233 | "addr": "0x4268c0" 234 | }, 235 | { 236 | "name": "PAJ::Image::EPA::Init", 237 | "addr": "0x42d420" 238 | }, 239 | { 240 | "name": "PAJ::EAP::Decompress", 241 | "addr": "0x42d540" 242 | }, 243 | { 244 | "name": "PAJ::Font::D3D9::UpdateTexture", 245 | "addr": "0x42f180" 246 | }, 247 | { 248 | "name": "PAJ::Font::Render::Get", 249 | "addr": "0x42f240" 250 | }, 251 | { 252 | "name": "PAJ::CreateProcess", 253 | "addr": "0x4318b0" 254 | }, 255 | { 256 | "name": "PAJ::OpenExplorerFile", 257 | "addr": "0x431a20" 258 | }, 259 | { 260 | "name": "PAJ::OpenVolumeMixer", 261 | "addr": "0x431aa0" 262 | }, 263 | { 264 | "name": "PAJ::ReStart", 265 | "addr": "0x431ad0" 266 | }, 267 | { 268 | "name": "PAJ::DirectoryManager::Map::NotSame", 269 | "addr": "0x431d00" 270 | }, 271 | { 272 | "name": "PAJ::DirectoryManager::Folder::Map::431F20", 273 | "addr": "0x431f20" 274 | }, 275 | { 276 | "name": "PAJ::DirectoryManager::Path::Map::NewHeader", 277 | "addr": "0x431fb0" 278 | }, 279 | { 280 | "name": "PAJ::DirectoryManager::Folder::Map::NewHeader", 281 | "addr": "0x431ff0" 282 | }, 283 | { 284 | "name": "PAJ::DirectoryManager::Tree::Find", 285 | "addr": "0x432030" 286 | }, 287 | { 288 | "name": "PAJ::DirectoryManager::Folder::Map::Find_", 289 | "addr": "0x4320c0" 290 | }, 291 | { 292 | "name": "PAJ::STD::Str::Append", 293 | "addr": "0x432150" 294 | }, 295 | { 296 | "name": "PAJ::STD::Str::Ctor_T3", 297 | "addr": "0x432250" 298 | }, 299 | { 300 | "name": "PAJ::DirectoryManager::Key::Find", 301 | "addr": "0x432390" 302 | }, 303 | { 304 | "name": "PAJ::DirectoryManager::Folder::Map::Find", 305 | "addr": "0x432490" 306 | }, 307 | { 308 | "name": "PAJ::STD::Str::Ctor_T2", 309 | "addr": "0x432590" 310 | }, 311 | { 312 | "name": "PAJ::STD::Str::Append_T0", 313 | "addr": "0x432960" 314 | }, 315 | { 316 | "name": "PAJ::STD::Str::Merge", 317 | "addr": "0x432a20" 318 | }, 319 | { 320 | "name": "PAJ::STD::Str::ToUpper", 321 | "addr": "0x432ae0" 322 | }, 323 | { 324 | "name": "PAJ::DirectoryManager::FindPath", 325 | "addr": "0x432bd0" 326 | }, 327 | { 328 | "name": "PAJ::DirectoryManager::Folder::Map::Free", 329 | "addr": "0x432d70" 330 | }, 331 | { 332 | "name": "PAJ::DirectoryManager::Folder::Map::Insert", 333 | "addr": "0x433380" 334 | }, 335 | { 336 | "name": "PAJ::DirectoryManager::Path::Map::Free", 337 | "addr": "0x4334b0" 338 | }, 339 | { 340 | "name": "PAJ::DirectoryManager::Folder::Map::MakeTree", 341 | "addr": "0x433730" 342 | }, 343 | { 344 | "name": "PAJ::DirectoryManager::Path::Map::MakeTree", 345 | "addr": "0x433930" 346 | }, 347 | { 348 | "name": "PAJ::DirectoryManager::AddPath", 349 | "addr": "0x433a00" 350 | }, 351 | { 352 | "name": "PAJ::DirectoryManager::AddFolder", 353 | "addr": "0x433ef0" 354 | }, 355 | { 356 | "name": "PAJ::DirectoryManager::Dtor", 357 | "addr": "0x434120" 358 | }, 359 | { 360 | "name": "PAJ::DirectoryManager::Ctor", 361 | "addr": "0x434210" 362 | }, 363 | { 364 | "name": "PAJ::InitializeCriticalSection", 365 | "addr": "0x434340" 366 | }, 367 | { 368 | "name": "PAJ::VFS::Pack::ReadEntry", 369 | "addr": "0x434360" 370 | }, 371 | { 372 | "name": "PAJ::VFS::ReadData", 373 | "addr": "0x434560" 374 | }, 375 | { 376 | "name": "PAJ::VFS::ReadViaSize", 377 | "addr": "0x434590" 378 | }, 379 | { 380 | "name": "PAJ::VFS::GetSize", 381 | "addr": "0x4345e0" 382 | }, 383 | { 384 | "name": "PAJ::VFS::Wait::ReadFinish", 385 | "addr": "0x4345f0" 386 | }, 387 | { 388 | "name": "PAJ::VFS::Dtor", 389 | "addr": "0x434630" 390 | }, 391 | { 392 | "name": "PAJ::Save::WriteData", 393 | "addr": "0x4347a0" 394 | }, 395 | { 396 | "name": "PAJ::OpenSysSaveData", 397 | "addr": "0x434840" 398 | }, 399 | { 400 | "name": "PAJ::VFS::Open", 401 | "addr": "0x434a20" 402 | }, 403 | { 404 | "name": "PAJ::OpenFile", 405 | "addr": "0x434af0" 406 | }, 407 | { 408 | "name": "PAJ::Paint", 409 | "addr": "0x435b90" 410 | }, 411 | { 412 | "name": "PAJ::Image::Coder", 413 | "addr": "0x445440" 414 | }, 415 | { 416 | "name": "PAJ::Dat::Graphic::Dtor", 417 | "addr": "0x446ce0" 418 | }, 419 | { 420 | "name": "PAJ::Dat::Graphic::Ctor", 421 | "addr": "0x446d30" 422 | }, 423 | { 424 | "name": "PAJ::DEF::Load", 425 | "addr": "0x446da0" 426 | }, 427 | { 428 | "name": "PAJ::Dat::Graphic::Load", 429 | "addr": "0x446f40" 430 | }, 431 | { 432 | "name": "PAJ::Image::Load", 433 | "addr": "0x447050" 434 | }, 435 | { 436 | "name": "PAJ::Font::Cache::Dtor_", 437 | "addr": "0x44a1b0" 438 | }, 439 | { 440 | "name": "PAJ::DrawChar", 441 | "addr": "0x45c950" 442 | }, 443 | { 444 | "name": "PAJ::DrawString", 445 | "addr": "0x45cc10" 446 | }, 447 | { 448 | "name": "PAJ::Exception", 449 | "addr": "0x460ec0" 450 | }, 451 | { 452 | "name": "PAJ::WndProc", 453 | "addr": "0x461110" 454 | }, 455 | { 456 | "name": "PAJ::VFS::Decode", 457 | "addr": "0x462700" 458 | }, 459 | { 460 | "name": "PAJ::DrawText::MsgBox_T1_Imp", 461 | "addr": "0x463ff0" 462 | }, 463 | { 464 | "name": "PAJ::DrawText_T1_Imp", 465 | "addr": "0x464110" 466 | }, 467 | { 468 | "name": "PAJ::Font::Select", 469 | "addr": "0x464220" 470 | }, 471 | { 472 | "name": "PAJ::DrawText::MsgBox_T1", 473 | "addr": "0x464930" 474 | }, 475 | { 476 | "name": "PAJ::DrawText_T1", 477 | "addr": "0x464960" 478 | }, 479 | { 480 | "name": "PAJ::OpenMovie", 481 | "addr": "0x466350" 482 | }, 483 | { 484 | "name": "PAJ::Font::Select_", 485 | "addr": "0x467840" 486 | }, 487 | { 488 | "name": "PAJ::Font::SetIndex", 489 | "addr": "0x470fa0" 490 | }, 491 | { 492 | "name": "PAJ::ReadWindowTitleStr", 493 | "addr": "0x486380" 494 | }, 495 | { 496 | "name": "PAJ::Save::Path::Init", 497 | "addr": "0x4864a0" 498 | }, 499 | { 500 | "name": "PAJ::VM::Dtor::SysDat::Free", 501 | "addr": "0x486840" 502 | }, 503 | { 504 | "name": "PAJ::Save::GenName", 505 | "addr": "0x486a00" 506 | }, 507 | { 508 | "name": "PAJ::Save::Check", 509 | "addr": "0x486c50" 510 | }, 511 | { 512 | "name": "PAJ::Save::GetTime", 513 | "addr": "0x487180" 514 | }, 515 | { 516 | "name": "PAJ::Save::Read_", 517 | "addr": "0x487240" 518 | }, 519 | { 520 | "name": "PAJ::Save::Copy", 521 | "addr": "0x4873f0" 522 | }, 523 | { 524 | "name": "PAJ::Save::Delete", 525 | "addr": "0x4874b0" 526 | }, 527 | { 528 | "name": "PAJ::VM::Load", 529 | "addr": "0x488a80" 530 | }, 531 | { 532 | "name": "PAJ::Save::Write", 533 | "addr": "0x4896d0" 534 | }, 535 | { 536 | "name": "PAJ::Save::Load", 537 | "addr": "0x4897b0" 538 | }, 539 | { 540 | "name": "PAJ::Save::Read", 541 | "addr": "0x489d40" 542 | }, 543 | { 544 | "name": "PAJ::DrawChar_T0", 545 | "addr": "0x489e20" 546 | }, 547 | { 548 | "name": "PAJ::Font::RenderTarget::48A050", 549 | "addr": "0x48a050" 550 | }, 551 | { 552 | "name": "PAJ::Str::CheckRange", 553 | "addr": "0x48a0b0" 554 | }, 555 | { 556 | "name": "PAJ::Font::Create", 557 | "addr": "0x48a0e0" 558 | }, 559 | { 560 | "name": "PAJ::Font::RenderTarget::Global::Create", 561 | "addr": "0x48a1e0" 562 | }, 563 | { 564 | "name": "PAJ::Font::GDI::Dtor", 565 | "addr": "0x48a260" 566 | }, 567 | { 568 | "name": "PAJ::Font::GDI::GetGlyphData", 569 | "addr": "0x48a2a0" 570 | }, 571 | { 572 | "name": "PAJ::Font::RenderTarget::List::Get", 573 | "addr": "0x48a440" 574 | }, 575 | { 576 | "name": "PAJ::Font::ReCreate", 577 | "addr": "0x48a470" 578 | }, 579 | { 580 | "name": "PAJ::Font::RenderTarget::48A4F0", 581 | "addr": "0x48a4f0" 582 | }, 583 | { 584 | "name": "PAJ::Font::RenderTarget::List::48AF20", 585 | "addr": "0x48af20" 586 | }, 587 | { 588 | "name": "PAJ::Font::FontData::File::Ctor", 589 | "addr": "0x48b620" 590 | }, 591 | { 592 | "name": "PAJ::Font::FontData::Free", 593 | "addr": "0x48b630" 594 | }, 595 | { 596 | "name": "PAJ::Font::FontData::File::Read", 597 | "addr": "0x48b690" 598 | }, 599 | { 600 | "name": "PAJ::Font::FontData::NewNode", 601 | "addr": "0x48b7b0" 602 | }, 603 | { 604 | "name": "PAJ::Font::FontData::GetGlyphPtr", 605 | "addr": "0x48b7e0" 606 | }, 607 | { 608 | "name": "PAJ::Font::FontData::Load", 609 | "addr": "0x48b810" 610 | }, 611 | { 612 | "name": "PAJ::Font::FontData::GetGlyph", 613 | "addr": "0x48b8e0" 614 | }, 615 | { 616 | "name": "PAJ::Font::FontData::FontExist", 617 | "addr": "0x48b9a0" 618 | }, 619 | { 620 | "name": "PAJ::Font::RenderTarget::Create", 621 | "addr": "0x48ba30" 622 | }, 623 | { 624 | "name": "PAJ::DrawText_T0", 625 | "addr": "0x48c9b0" 626 | }, 627 | { 628 | "name": "PAJ::Font::FontData::Dtor", 629 | "addr": "0x48da20" 630 | }, 631 | { 632 | "name": "PAJ::Font::RenderTarget::Free", 633 | "addr": "0x48dbe0" 634 | }, 635 | { 636 | "name": "PAJ::Font::RenderTarget::List::Set", 637 | "addr": "0x48dd30" 638 | }, 639 | { 640 | "name": "PAJ::Font::RenderTarget::List::Node::Free", 641 | "addr": "0x48ddc0" 642 | }, 643 | { 644 | "name": "PAJ::Font::RenderTarget::List::Free", 645 | "addr": "0x48de70" 646 | }, 647 | { 648 | "name": "PAJ::Font::RenderTarget::List::Clear", 649 | "addr": "0x48dea0" 650 | }, 651 | { 652 | "name": "PAJ::Font::Dtor_", 653 | "addr": "0x48e0b0" 654 | }, 655 | { 656 | "name": "PAJ::Font::Ctor", 657 | "addr": "0x48e100" 658 | }, 659 | { 660 | "name": "PAJ::Font::Cache0::Alloc", 661 | "addr": "0x48e180" 662 | }, 663 | { 664 | "name": "PAJ::Font::Cache0::Mem::Free", 665 | "addr": "0x48e1d0" 666 | }, 667 | { 668 | "name": "PAJ::Font::GDI::MakeGlyph", 669 | "addr": "0x48e2d0" 670 | }, 671 | { 672 | "name": "PAJ::Font::FontData::MakeGlyph", 673 | "addr": "0x48e410" 674 | }, 675 | { 676 | "name": "PAJ::Font::Dtor", 677 | "addr": "0x48e760" 678 | }, 679 | { 680 | "name": "PAJ::Font::Render", 681 | "addr": "0x48e960" 682 | }, 683 | { 684 | "name": "PAJ::Font::Cache0::Mem::Dtor", 685 | "addr": "0x48f5d0" 686 | }, 687 | { 688 | "name": "PAJ::Font::FontData::Draw", 689 | "addr": "0x48fa60" 690 | }, 691 | { 692 | "name": "PAJ::DrawChar_T1_Imp", 693 | "addr": "0x48fbf0" 694 | }, 695 | { 696 | "name": "PAJ::Font::Cache0::Dtor", 697 | "addr": "0x48fda0" 698 | }, 699 | { 700 | "name": "PAJ::DrawChar_T1", 701 | "addr": "0x48fdc0" 702 | }, 703 | { 704 | "name": "PAJ::Font::Cache0::Init", 705 | "addr": "0x48fe60" 706 | }, 707 | { 708 | "name": "PAJ::DrawChar_T2_Imp", 709 | "addr": "0x48ff20" 710 | }, 711 | { 712 | "name": "PAJ::Font::Cache1::Mem::Free", 713 | "addr": "0x4900e0" 714 | }, 715 | { 716 | "name": "PAJ::Font::Cache1::Dtor", 717 | "addr": "0x490650" 718 | }, 719 | { 720 | "name": "PAJ::DrawChar_T2", 721 | "addr": "0x490670" 722 | }, 723 | { 724 | "name": "PAJ::Font::Cache1::Int", 725 | "addr": "0x490760" 726 | }, 727 | { 728 | "name": "PAJ::Timer::Init", 729 | "addr": "0x490790" 730 | }, 731 | { 732 | "name": "PAJ::Timer::4907C0", 733 | "addr": "0x4907c0" 734 | }, 735 | { 736 | "name": "PAJ::Timer::4907D0", 737 | "addr": "0x4907d0" 738 | }, 739 | { 740 | "name": "PAJ::Timer::Get", 741 | "addr": "0x4907e0" 742 | }, 743 | { 744 | "name": "PAJ::Timer::490840", 745 | "addr": "0x490840" 746 | }, 747 | { 748 | "name": "PAJ::Timer::490850", 749 | "addr": "0x490850" 750 | }, 751 | { 752 | "name": "PAJ::Timer::4908A0", 753 | "addr": "0x4908a0" 754 | }, 755 | { 756 | "name": "PAJ::Timer::4908F0", 757 | "addr": "0x4908f0" 758 | }, 759 | { 760 | "name": "PAJ::GetTextXX", 761 | "addr": "0x4bc080" 762 | } 763 | ] 764 | } -------------------------------------------------------------------------------- /Gal汉化分析/封包结构逆向/[Gal汉化分析] 封包逆向初步.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化分析/封包结构逆向/[Gal汉化分析] 封包逆向初步.pptx -------------------------------------------------------------------------------- /Gal汉化分析/文件系统初探/R_Pack.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化分析/文件系统初探/R_Pack.zip -------------------------------------------------------------------------------- /Gal汉化分析/文件系统初探/[Gal汉化分析] 文件系统初探.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化分析/文件系统初探/[Gal汉化分析] 文件系统初探.pptx -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/EnigmaVBUnpacker_v0.61.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/EnigmaVBUnpacker_v0.61.zip -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/HookFont.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/HookFont.zip -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/RangTable/GBK_Rang_Table.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/RangTable/SJIS_Rang_Table.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/Replace_RangTable.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/Replace_RangTable.exe -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSCFG_Editor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSCFG_Editor.exe -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSCM_Parse.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSCM_Parse.exe -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSTBV2TextEditor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSTBV2TextEditor.exe -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSTB_GuessXorKey.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSTB_GuessXorKey.exe -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSTB_Xor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSTB_Xor.exe -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSTL_Parse.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/YSTL_Parse.exe -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/ae_20170405_nosrc.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/ae_20170405_nosrc.7z -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/extYbn.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/extYbn.zip -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/lneditor_2_1_2.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/lneditor_2_1_2.7z -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/人名括号问题.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/人名括号问题.png -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/人名括号问题.txt: -------------------------------------------------------------------------------- 1 | 【 -> 81 79 -> A1BE 2 | 】 -> 81 7A -> A1BF 3 | 「 -> 81 75 -> A1B8 4 | 『 -> 81 77 -> A1BA 5 | ( -> 81 69 -> A3A8 6 | ) -> 81 6A -> A3A9 -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/Tools/工具链接.txt: -------------------------------------------------------------------------------- 1 | x64dbg https://github.com/x64dbg/x64dbg 2 | WinHex https://www.x-ways.net/winhex 3 | YurisTools https://github.com/Dir-A/YurisTools 4 | extYbn https://github.com/regomne/chinesize 5 | Enigma Virtual Box unpacker https://lifeinhex.com/tag/enigma-virtual-box 6 | lneditor https://github.com/regomne/lneditor/releases 7 | AE VN Tools http://wks.arai-kibou.ru/ae.php 8 | HookFont https://github.com/Dir-A/VN_Localization_Tutorials -------------------------------------------------------------------------------- /Gal汉化实例/[Gal汉化实例] YU-RIS引擎/[Gal汉化实例] YU-RIS引擎.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/Gal汉化实例/[Gal汉化实例] YU-RIS引擎/[Gal汉化实例] YU-RIS引擎.pptx -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VN_Localization_Tutorials 2 | Galgames汉化教程 3 | 4 | ## Galgames 汉化实例 5 | https://www.youtube.com/@dir-a 6 | https://space.bilibili.com/8144708 7 | 8 | ## Galgames 汉化入门 9 | https://www.youtube.com/@dir-a 10 | https://space.bilibili.com/8144708 11 | 12 | ## Galgames 汉化分析 13 | https://www.youtube.com/@dir-a 14 | https://space.bilibili.com/685540771 15 | 16 | -------------------------------------------------------------------------------- /其它/Hook字体/HookFont.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/Hook字体/HookFont.dll -------------------------------------------------------------------------------- /其它/Hook字体/HookFont.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/Hook字体/HookFont.exe -------------------------------------------------------------------------------- /其它/Hook字体/HookFont.ini: -------------------------------------------------------------------------------- 1 | # 本文件(ini) 编码始终保持UTF8,文件名与HookFont.dll保持同名 2 | # 比如修改成 sorakoi_cn_font.dll 则本文件改名为 sorakoi_cn_font.ini 3 | # TargetEXE 游戏的主程序文件名 4 | # TargetDLLCount 需要注入DLL的数量 5 | # TargetDLLName_0 TargetDLLName_1 TargetDLLName_2 TargetDLLName_X 需要注入DLL的文件名 6 | 7 | [RiaLoader] 8 | TargetEXE = sorakoi.exe 9 | TargetDLLCount = 1 10 | TargetDLLName_0 = HookFont.dll 11 | TargetDLLName_1 = mydll.dll 12 | TargetDLLName_2 = myhook.dll 13 | 14 | [HookFont] 15 | Charset = 0x86 16 | FontName = 黑体 17 | HookCreateFontA = true 18 | HookCreateFontIndirectA = true 19 | -------------------------------------------------------------------------------- /其它/Hook字体/src/HookFont.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/Hook字体/src/HookFont.zip -------------------------------------------------------------------------------- /其它/Hook字体/使用说明.txt: -------------------------------------------------------------------------------- 1 | HookFont.dll 2 | HookFont.exe 3 | HookFont.ini 4 | 5 | 三个文件复制到游戏目录下 6 | 打开INI文件进行配置 -------------------------------------------------------------------------------- /其它/Triangle Complete Disc Crack/Triangle Complete Disc Crack.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/Triangle Complete Disc Crack/Triangle Complete Disc Crack.7z -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/Detours/detours.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Core Detours Functionality (detours.h of detours.lib) 4 | // 5 | // Microsoft Research Detours Package, Version 4.0.1 6 | // 7 | // Copyright (c) Microsoft Corporation. All rights reserved. 8 | // 9 | 10 | #pragma once 11 | #ifndef _DETOURS_H_ 12 | #define _DETOURS_H_ 13 | 14 | #define DETOURS_VERSION 0x4c0c1 // 0xMAJORcMINORcPATCH 15 | 16 | ////////////////////////////////////////////////////////////////////////////// 17 | // 18 | 19 | #ifdef DETOURS_INTERNAL 20 | 21 | #define _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS 1 22 | #define _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE 1 23 | 24 | #pragma warning(disable:4068) // unknown pragma (suppress) 25 | 26 | #if _MSC_VER >= 1900 27 | #pragma warning(push) 28 | #pragma warning(disable:4091) // empty typedef 29 | #endif 30 | 31 | // Suppress declspec(dllimport) for the sake of Detours 32 | // users that provide kernel32 functionality themselves. 33 | // This is ok in the mainstream case, it will just cost 34 | // an extra instruction calling some functions, which 35 | // LTCG optimizes away. 36 | // 37 | #define _KERNEL32_ 1 38 | #define _USER32_ 1 39 | 40 | #include 41 | #if (_MSC_VER < 1310) 42 | #else 43 | #pragma warning(push) 44 | #if _MSC_VER > 1400 45 | #pragma warning(disable:6102 6103) // /analyze warnings 46 | #endif 47 | #include 48 | #include 49 | #pragma warning(pop) 50 | #endif 51 | #include 52 | 53 | // Allow Detours to cleanly compile with the MingW toolchain. 54 | // 55 | #ifdef __GNUC__ 56 | #define __try 57 | #define __except(x) if (0) 58 | #include 59 | #include 60 | #endif 61 | 62 | // From winerror.h, as this error isn't found in some SDKs: 63 | // 64 | // MessageId: ERROR_DYNAMIC_CODE_BLOCKED 65 | // 66 | // MessageText: 67 | // 68 | // The operation was blocked as the process prohibits dynamic code generation. 69 | // 70 | #define ERROR_DYNAMIC_CODE_BLOCKED 1655L 71 | 72 | #endif // DETOURS_INTERNAL 73 | 74 | ////////////////////////////////////////////////////////////////////////////// 75 | // 76 | 77 | #undef DETOURS_X64 78 | #undef DETOURS_X86 79 | #undef DETOURS_IA64 80 | #undef DETOURS_ARM 81 | #undef DETOURS_ARM64 82 | #undef DETOURS_BITS 83 | #undef DETOURS_32BIT 84 | #undef DETOURS_64BIT 85 | 86 | #if defined(_X86_) 87 | #define DETOURS_X86 88 | #define DETOURS_OPTION_BITS 64 89 | 90 | #elif defined(_AMD64_) 91 | #define DETOURS_X64 92 | #define DETOURS_OPTION_BITS 32 93 | 94 | #elif defined(_IA64_) 95 | #define DETOURS_IA64 96 | #define DETOURS_OPTION_BITS 32 97 | 98 | #elif defined(_ARM_) 99 | #define DETOURS_ARM 100 | 101 | #elif defined(_ARM64_) 102 | #define DETOURS_ARM64 103 | 104 | #else 105 | #error Unknown architecture (x86, amd64, ia64, arm, arm64) 106 | #endif 107 | 108 | #ifdef _WIN64 109 | #undef DETOURS_32BIT 110 | #define DETOURS_64BIT 1 111 | #define DETOURS_BITS 64 112 | // If all 64bit kernels can run one and only one 32bit architecture. 113 | //#define DETOURS_OPTION_BITS 32 114 | #else 115 | #define DETOURS_32BIT 1 116 | #undef DETOURS_64BIT 117 | #define DETOURS_BITS 32 118 | // If all 64bit kernels can run one and only one 32bit architecture. 119 | //#define DETOURS_OPTION_BITS 32 120 | #endif 121 | 122 | /////////////////////////////////////////////////////////////// Helper Macros. 123 | // 124 | #define DETOURS_STRINGIFY_(x) #x 125 | #define DETOURS_STRINGIFY(x) DETOURS_STRINGIFY_(x) 126 | 127 | #define VER_DETOURS_BITS DETOURS_STRINGIFY(DETOURS_BITS) 128 | 129 | ////////////////////////////////////////////////////////////////////////////// 130 | // 131 | 132 | #if (_MSC_VER < 1299) && !defined(__MINGW32__) 133 | typedef LONG LONG_PTR; 134 | typedef ULONG ULONG_PTR; 135 | #endif 136 | 137 | ///////////////////////////////////////////////// SAL 2.0 Annotations w/o SAL. 138 | // 139 | // These definitions are include so that Detours will build even if the 140 | // compiler doesn't have full SAL 2.0 support. 141 | // 142 | #ifndef DETOURS_DONT_REMOVE_SAL_20 143 | 144 | #ifdef DETOURS_TEST_REMOVE_SAL_20 145 | #undef _Analysis_assume_ 146 | #undef _Benign_race_begin_ 147 | #undef _Benign_race_end_ 148 | #undef _Field_range_ 149 | #undef _Field_size_ 150 | #undef _In_ 151 | #undef _In_bytecount_ 152 | #undef _In_count_ 153 | #undef __in_ecount 154 | #undef _In_opt_ 155 | #undef _In_opt_bytecount_ 156 | #undef _In_opt_count_ 157 | #undef _In_opt_z_ 158 | #undef _In_range_ 159 | #undef _In_reads_ 160 | #undef _In_reads_bytes_ 161 | #undef _In_reads_opt_ 162 | #undef _In_reads_opt_bytes_ 163 | #undef _In_reads_or_z_ 164 | #undef _In_z_ 165 | #undef _Inout_ 166 | #undef _Inout_opt_ 167 | #undef _Inout_z_count_ 168 | #undef _Out_ 169 | #undef _Out_opt_ 170 | #undef _Out_writes_ 171 | #undef _Outptr_result_maybenull_ 172 | #undef _Readable_bytes_ 173 | #undef _Success_ 174 | #undef _Writable_bytes_ 175 | #undef _Pre_notnull_ 176 | #endif 177 | 178 | #if defined(_Deref_out_opt_z_) && !defined(_Outptr_result_maybenull_) 179 | #define _Outptr_result_maybenull_ _Deref_out_opt_z_ 180 | #endif 181 | 182 | #if defined(_In_count_) && !defined(_In_reads_) 183 | #define _In_reads_(x) _In_count_(x) 184 | #endif 185 | 186 | #if defined(_In_opt_count_) && !defined(_In_reads_opt_) 187 | #define _In_reads_opt_(x) _In_opt_count_(x) 188 | #endif 189 | 190 | #if defined(_In_opt_bytecount_) && !defined(_In_reads_opt_bytes_) 191 | #define _In_reads_opt_bytes_(x) _In_opt_bytecount_(x) 192 | #endif 193 | 194 | #if defined(_In_bytecount_) && !defined(_In_reads_bytes_) 195 | #define _In_reads_bytes_(x) _In_bytecount_(x) 196 | #endif 197 | 198 | #ifndef _In_ 199 | #define _In_ 200 | #endif 201 | 202 | #ifndef _In_bytecount_ 203 | #define _In_bytecount_(x) 204 | #endif 205 | 206 | #ifndef _In_count_ 207 | #define _In_count_(x) 208 | #endif 209 | 210 | #ifndef __in_ecount 211 | #define __in_ecount(x) 212 | #endif 213 | 214 | #ifndef _In_opt_ 215 | #define _In_opt_ 216 | #endif 217 | 218 | #ifndef _In_opt_bytecount_ 219 | #define _In_opt_bytecount_(x) 220 | #endif 221 | 222 | #ifndef _In_opt_count_ 223 | #define _In_opt_count_(x) 224 | #endif 225 | 226 | #ifndef _In_opt_z_ 227 | #define _In_opt_z_ 228 | #endif 229 | 230 | #ifndef _In_range_ 231 | #define _In_range_(x,y) 232 | #endif 233 | 234 | #ifndef _In_reads_ 235 | #define _In_reads_(x) 236 | #endif 237 | 238 | #ifndef _In_reads_bytes_ 239 | #define _In_reads_bytes_(x) 240 | #endif 241 | 242 | #ifndef _In_reads_opt_ 243 | #define _In_reads_opt_(x) 244 | #endif 245 | 246 | #ifndef _In_reads_opt_bytes_ 247 | #define _In_reads_opt_bytes_(x) 248 | #endif 249 | 250 | #ifndef _In_reads_or_z_ 251 | #define _In_reads_or_z_ 252 | #endif 253 | 254 | #ifndef _In_z_ 255 | #define _In_z_ 256 | #endif 257 | 258 | #ifndef _Inout_ 259 | #define _Inout_ 260 | #endif 261 | 262 | #ifndef _Inout_opt_ 263 | #define _Inout_opt_ 264 | #endif 265 | 266 | #ifndef _Inout_z_count_ 267 | #define _Inout_z_count_(x) 268 | #endif 269 | 270 | #ifndef _Out_ 271 | #define _Out_ 272 | #endif 273 | 274 | #ifndef _Out_opt_ 275 | #define _Out_opt_ 276 | #endif 277 | 278 | #ifndef _Out_writes_ 279 | #define _Out_writes_(x) 280 | #endif 281 | 282 | #ifndef _Outptr_result_maybenull_ 283 | #define _Outptr_result_maybenull_ 284 | #endif 285 | 286 | #ifndef _Writable_bytes_ 287 | #define _Writable_bytes_(x) 288 | #endif 289 | 290 | #ifndef _Readable_bytes_ 291 | #define _Readable_bytes_(x) 292 | #endif 293 | 294 | #ifndef _Success_ 295 | #define _Success_(x) 296 | #endif 297 | 298 | #ifndef _Pre_notnull_ 299 | #define _Pre_notnull_ 300 | #endif 301 | 302 | #ifdef DETOURS_INTERNAL 303 | 304 | #pragma warning(disable:4615) // unknown warning type (suppress with older compilers) 305 | 306 | #ifndef _Benign_race_begin_ 307 | #define _Benign_race_begin_ 308 | #endif 309 | 310 | #ifndef _Benign_race_end_ 311 | #define _Benign_race_end_ 312 | #endif 313 | 314 | #ifndef _Field_size_ 315 | #define _Field_size_(x) 316 | #endif 317 | 318 | #ifndef _Field_range_ 319 | #define _Field_range_(x,y) 320 | #endif 321 | 322 | #ifndef _Analysis_assume_ 323 | #define _Analysis_assume_(x) 324 | #endif 325 | 326 | #endif // DETOURS_INTERNAL 327 | #endif // DETOURS_DONT_REMOVE_SAL_20 328 | 329 | ////////////////////////////////////////////////////////////////////////////// 330 | // 331 | #ifndef GUID_DEFINED 332 | #define GUID_DEFINED 333 | typedef struct _GUID 334 | { 335 | DWORD Data1; 336 | WORD Data2; 337 | WORD Data3; 338 | BYTE Data4[ 8 ]; 339 | } GUID; 340 | 341 | #ifdef INITGUID 342 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ 343 | const GUID name \ 344 | = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } 345 | #else 346 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ 347 | const GUID name 348 | #endif // INITGUID 349 | #endif // !GUID_DEFINED 350 | 351 | #if defined(__cplusplus) 352 | #ifndef _REFGUID_DEFINED 353 | #define _REFGUID_DEFINED 354 | #define REFGUID const GUID & 355 | #endif // !_REFGUID_DEFINED 356 | #else // !__cplusplus 357 | #ifndef _REFGUID_DEFINED 358 | #define _REFGUID_DEFINED 359 | #define REFGUID const GUID * const 360 | #endif // !_REFGUID_DEFINED 361 | #endif // !__cplusplus 362 | 363 | #ifndef ARRAYSIZE 364 | #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0])) 365 | #endif 366 | 367 | // 368 | ////////////////////////////////////////////////////////////////////////////// 369 | 370 | #ifdef __cplusplus 371 | extern "C" { 372 | #endif // __cplusplus 373 | 374 | /////////////////////////////////////////////////// Instruction Target Macros. 375 | // 376 | #define DETOUR_INSTRUCTION_TARGET_NONE ((PVOID)0) 377 | #define DETOUR_INSTRUCTION_TARGET_DYNAMIC ((PVOID)(LONG_PTR)-1) 378 | #define DETOUR_SECTION_HEADER_SIGNATURE 0x00727444 // "Dtr\0" 379 | 380 | extern const GUID DETOUR_EXE_RESTORE_GUID; 381 | extern const GUID DETOUR_EXE_HELPER_GUID; 382 | 383 | #define DETOUR_TRAMPOLINE_SIGNATURE 0x21727444 // Dtr! 384 | typedef struct _DETOUR_TRAMPOLINE DETOUR_TRAMPOLINE, *PDETOUR_TRAMPOLINE; 385 | 386 | /////////////////////////////////////////////////////////// Binary Structures. 387 | // 388 | #pragma pack(push, 8) 389 | typedef struct _DETOUR_SECTION_HEADER 390 | { 391 | DWORD cbHeaderSize; 392 | DWORD nSignature; 393 | DWORD nDataOffset; 394 | DWORD cbDataSize; 395 | 396 | DWORD nOriginalImportVirtualAddress; 397 | DWORD nOriginalImportSize; 398 | DWORD nOriginalBoundImportVirtualAddress; 399 | DWORD nOriginalBoundImportSize; 400 | 401 | DWORD nOriginalIatVirtualAddress; 402 | DWORD nOriginalIatSize; 403 | DWORD nOriginalSizeOfImage; 404 | DWORD cbPrePE; 405 | 406 | DWORD nOriginalClrFlags; 407 | DWORD reserved1; 408 | DWORD reserved2; 409 | DWORD reserved3; 410 | 411 | // Followed by cbPrePE bytes of data. 412 | } DETOUR_SECTION_HEADER, *PDETOUR_SECTION_HEADER; 413 | 414 | typedef struct _DETOUR_SECTION_RECORD 415 | { 416 | DWORD cbBytes; 417 | DWORD nReserved; 418 | GUID guid; 419 | } DETOUR_SECTION_RECORD, *PDETOUR_SECTION_RECORD; 420 | 421 | typedef struct _DETOUR_CLR_HEADER 422 | { 423 | // Header versioning 424 | ULONG cb; 425 | USHORT MajorRuntimeVersion; 426 | USHORT MinorRuntimeVersion; 427 | 428 | // Symbol table and startup information 429 | IMAGE_DATA_DIRECTORY MetaData; 430 | ULONG Flags; 431 | 432 | // Followed by the rest of the IMAGE_COR20_HEADER 433 | } DETOUR_CLR_HEADER, *PDETOUR_CLR_HEADER; 434 | 435 | typedef struct _DETOUR_EXE_RESTORE 436 | { 437 | DWORD cb; 438 | DWORD cbidh; 439 | DWORD cbinh; 440 | DWORD cbclr; 441 | 442 | PBYTE pidh; 443 | PBYTE pinh; 444 | PBYTE pclr; 445 | 446 | IMAGE_DOS_HEADER idh; 447 | union { 448 | IMAGE_NT_HEADERS inh; // all environments have this 449 | #ifdef IMAGE_NT_OPTIONAL_HDR32_MAGIC // some environments do not have this 450 | IMAGE_NT_HEADERS32 inh32; 451 | #endif 452 | #ifdef IMAGE_NT_OPTIONAL_HDR64_MAGIC // some environments do not have this 453 | IMAGE_NT_HEADERS64 inh64; 454 | #endif 455 | #ifdef IMAGE_NT_OPTIONAL_HDR64_MAGIC // some environments do not have this 456 | BYTE raw[sizeof(IMAGE_NT_HEADERS64) + 457 | sizeof(IMAGE_SECTION_HEADER) * 32]; 458 | #else 459 | BYTE raw[0x108 + sizeof(IMAGE_SECTION_HEADER) * 32]; 460 | #endif 461 | }; 462 | DETOUR_CLR_HEADER clr; 463 | 464 | } DETOUR_EXE_RESTORE, *PDETOUR_EXE_RESTORE; 465 | 466 | #ifdef IMAGE_NT_OPTIONAL_HDR64_MAGIC 467 | C_ASSERT(sizeof(IMAGE_NT_HEADERS64) == 0x108); 468 | #endif 469 | 470 | // The size can change, but assert for clarity due to the muddying #ifdefs. 471 | #ifdef _WIN64 472 | C_ASSERT(sizeof(DETOUR_EXE_RESTORE) == 0x688); 473 | #else 474 | C_ASSERT(sizeof(DETOUR_EXE_RESTORE) == 0x678); 475 | #endif 476 | 477 | typedef struct _DETOUR_EXE_HELPER 478 | { 479 | DWORD cb; 480 | DWORD pid; 481 | DWORD nDlls; 482 | CHAR rDlls[4]; 483 | } DETOUR_EXE_HELPER, *PDETOUR_EXE_HELPER; 484 | 485 | #pragma pack(pop) 486 | 487 | #define DETOUR_SECTION_HEADER_DECLARE(cbSectionSize) \ 488 | { \ 489 | sizeof(DETOUR_SECTION_HEADER),\ 490 | DETOUR_SECTION_HEADER_SIGNATURE,\ 491 | sizeof(DETOUR_SECTION_HEADER),\ 492 | (cbSectionSize),\ 493 | \ 494 | 0,\ 495 | 0,\ 496 | 0,\ 497 | 0,\ 498 | \ 499 | 0,\ 500 | 0,\ 501 | 0,\ 502 | 0,\ 503 | } 504 | 505 | ///////////////////////////////////////////////////////////// Binary Typedefs. 506 | // 507 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_BYWAY_CALLBACK)( 508 | _In_opt_ PVOID pContext, 509 | _In_opt_ LPCSTR pszFile, 510 | _Outptr_result_maybenull_ LPCSTR *ppszOutFile); 511 | 512 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_FILE_CALLBACK)( 513 | _In_opt_ PVOID pContext, 514 | _In_ LPCSTR pszOrigFile, 515 | _In_ LPCSTR pszFile, 516 | _Outptr_result_maybenull_ LPCSTR *ppszOutFile); 517 | 518 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_SYMBOL_CALLBACK)( 519 | _In_opt_ PVOID pContext, 520 | _In_ ULONG nOrigOrdinal, 521 | _In_ ULONG nOrdinal, 522 | _Out_ ULONG *pnOutOrdinal, 523 | _In_opt_ LPCSTR pszOrigSymbol, 524 | _In_opt_ LPCSTR pszSymbol, 525 | _Outptr_result_maybenull_ LPCSTR *ppszOutSymbol); 526 | 527 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_COMMIT_CALLBACK)( 528 | _In_opt_ PVOID pContext); 529 | 530 | typedef BOOL (CALLBACK *PF_DETOUR_ENUMERATE_EXPORT_CALLBACK)(_In_opt_ PVOID pContext, 531 | _In_ ULONG nOrdinal, 532 | _In_opt_ LPCSTR pszName, 533 | _In_opt_ PVOID pCode); 534 | 535 | typedef BOOL (CALLBACK *PF_DETOUR_IMPORT_FILE_CALLBACK)(_In_opt_ PVOID pContext, 536 | _In_opt_ HMODULE hModule, 537 | _In_opt_ LPCSTR pszFile); 538 | 539 | typedef BOOL (CALLBACK *PF_DETOUR_IMPORT_FUNC_CALLBACK)(_In_opt_ PVOID pContext, 540 | _In_ DWORD nOrdinal, 541 | _In_opt_ LPCSTR pszFunc, 542 | _In_opt_ PVOID pvFunc); 543 | 544 | // Same as PF_DETOUR_IMPORT_FUNC_CALLBACK but extra indirection on last parameter. 545 | typedef BOOL (CALLBACK *PF_DETOUR_IMPORT_FUNC_CALLBACK_EX)(_In_opt_ PVOID pContext, 546 | _In_ DWORD nOrdinal, 547 | _In_opt_ LPCSTR pszFunc, 548 | _In_opt_ PVOID* ppvFunc); 549 | 550 | typedef VOID * PDETOUR_BINARY; 551 | typedef VOID * PDETOUR_LOADED_BINARY; 552 | 553 | //////////////////////////////////////////////////////////// Transaction APIs. 554 | // 555 | LONG WINAPI DetourTransactionBegin(VOID); 556 | LONG WINAPI DetourTransactionAbort(VOID); 557 | LONG WINAPI DetourTransactionCommit(VOID); 558 | LONG WINAPI DetourTransactionCommitEx(_Out_opt_ PVOID **pppFailedPointer); 559 | 560 | LONG WINAPI DetourUpdateThread(_In_ HANDLE hThread); 561 | 562 | LONG WINAPI DetourAttach(_Inout_ PVOID *ppPointer, 563 | _In_ PVOID pDetour); 564 | 565 | LONG WINAPI DetourAttachEx(_Inout_ PVOID *ppPointer, 566 | _In_ PVOID pDetour, 567 | _Out_opt_ PDETOUR_TRAMPOLINE *ppRealTrampoline, 568 | _Out_opt_ PVOID *ppRealTarget, 569 | _Out_opt_ PVOID *ppRealDetour); 570 | 571 | LONG WINAPI DetourDetach(_Inout_ PVOID *ppPointer, 572 | _In_ PVOID pDetour); 573 | 574 | BOOL WINAPI DetourSetIgnoreTooSmall(_In_ BOOL fIgnore); 575 | BOOL WINAPI DetourSetRetainRegions(_In_ BOOL fRetain); 576 | PVOID WINAPI DetourSetSystemRegionLowerBound(_In_ PVOID pSystemRegionLowerBound); 577 | PVOID WINAPI DetourSetSystemRegionUpperBound(_In_ PVOID pSystemRegionUpperBound); 578 | 579 | ////////////////////////////////////////////////////////////// Code Functions. 580 | // 581 | PVOID WINAPI DetourFindFunction(_In_ LPCSTR pszModule, 582 | _In_ LPCSTR pszFunction); 583 | PVOID WINAPI DetourCodeFromPointer(_In_ PVOID pPointer, 584 | _Out_opt_ PVOID *ppGlobals); 585 | PVOID WINAPI DetourCopyInstruction(_In_opt_ PVOID pDst, 586 | _Inout_opt_ PVOID *ppDstPool, 587 | _In_ PVOID pSrc, 588 | _Out_opt_ PVOID *ppTarget, 589 | _Out_opt_ LONG *plExtra); 590 | BOOL WINAPI DetourSetCodeModule(_In_ HMODULE hModule, 591 | _In_ BOOL fLimitReferencesToModule); 592 | PVOID WINAPI DetourAllocateRegionWithinJumpBounds(_In_ LPCVOID pbTarget, 593 | _Out_ PDWORD pcbAllocatedSize); 594 | 595 | ///////////////////////////////////////////////////// Loaded Binary Functions. 596 | // 597 | HMODULE WINAPI DetourGetContainingModule(_In_ PVOID pvAddr); 598 | HMODULE WINAPI DetourEnumerateModules(_In_opt_ HMODULE hModuleLast); 599 | PVOID WINAPI DetourGetEntryPoint(_In_opt_ HMODULE hModule); 600 | ULONG WINAPI DetourGetModuleSize(_In_opt_ HMODULE hModule); 601 | BOOL WINAPI DetourEnumerateExports(_In_ HMODULE hModule, 602 | _In_opt_ PVOID pContext, 603 | _In_ PF_DETOUR_ENUMERATE_EXPORT_CALLBACK pfExport); 604 | BOOL WINAPI DetourEnumerateImports(_In_opt_ HMODULE hModule, 605 | _In_opt_ PVOID pContext, 606 | _In_opt_ PF_DETOUR_IMPORT_FILE_CALLBACK pfImportFile, 607 | _In_opt_ PF_DETOUR_IMPORT_FUNC_CALLBACK pfImportFunc); 608 | 609 | BOOL WINAPI DetourEnumerateImportsEx(_In_opt_ HMODULE hModule, 610 | _In_opt_ PVOID pContext, 611 | _In_opt_ PF_DETOUR_IMPORT_FILE_CALLBACK pfImportFile, 612 | _In_opt_ PF_DETOUR_IMPORT_FUNC_CALLBACK_EX pfImportFuncEx); 613 | 614 | _Writable_bytes_(*pcbData) 615 | _Readable_bytes_(*pcbData) 616 | _Success_(return != NULL) 617 | PVOID WINAPI DetourFindPayload(_In_opt_ HMODULE hModule, 618 | _In_ REFGUID rguid, 619 | _Out_opt_ DWORD *pcbData); 620 | 621 | _Writable_bytes_(*pcbData) 622 | _Readable_bytes_(*pcbData) 623 | _Success_(return != NULL) 624 | PVOID WINAPI DetourFindPayloadEx(_In_ REFGUID rguid, 625 | _Out_opt_ DWORD *pcbData); 626 | 627 | DWORD WINAPI DetourGetSizeOfPayloads(_In_opt_ HMODULE hModule); 628 | 629 | BOOL WINAPI DetourFreePayload(_In_ PVOID pvData); 630 | ///////////////////////////////////////////////// Persistent Binary Functions. 631 | // 632 | 633 | PDETOUR_BINARY WINAPI DetourBinaryOpen(_In_ HANDLE hFile); 634 | 635 | _Writable_bytes_(*pcbData) 636 | _Readable_bytes_(*pcbData) 637 | _Success_(return != NULL) 638 | PVOID WINAPI DetourBinaryEnumeratePayloads(_In_ PDETOUR_BINARY pBinary, 639 | _Out_opt_ GUID *pGuid, 640 | _Out_ DWORD *pcbData, 641 | _Inout_ DWORD *pnIterator); 642 | 643 | _Writable_bytes_(*pcbData) 644 | _Readable_bytes_(*pcbData) 645 | _Success_(return != NULL) 646 | PVOID WINAPI DetourBinaryFindPayload(_In_ PDETOUR_BINARY pBinary, 647 | _In_ REFGUID rguid, 648 | _Out_ DWORD *pcbData); 649 | 650 | PVOID WINAPI DetourBinarySetPayload(_In_ PDETOUR_BINARY pBinary, 651 | _In_ REFGUID rguid, 652 | _In_reads_opt_(cbData) PVOID pData, 653 | _In_ DWORD cbData); 654 | BOOL WINAPI DetourBinaryDeletePayload(_In_ PDETOUR_BINARY pBinary, _In_ REFGUID rguid); 655 | BOOL WINAPI DetourBinaryPurgePayloads(_In_ PDETOUR_BINARY pBinary); 656 | BOOL WINAPI DetourBinaryResetImports(_In_ PDETOUR_BINARY pBinary); 657 | BOOL WINAPI DetourBinaryEditImports(_In_ PDETOUR_BINARY pBinary, 658 | _In_opt_ PVOID pContext, 659 | _In_opt_ PF_DETOUR_BINARY_BYWAY_CALLBACK pfByway, 660 | _In_opt_ PF_DETOUR_BINARY_FILE_CALLBACK pfFile, 661 | _In_opt_ PF_DETOUR_BINARY_SYMBOL_CALLBACK pfSymbol, 662 | _In_opt_ PF_DETOUR_BINARY_COMMIT_CALLBACK pfCommit); 663 | BOOL WINAPI DetourBinaryWrite(_In_ PDETOUR_BINARY pBinary, _In_ HANDLE hFile); 664 | BOOL WINAPI DetourBinaryClose(_In_ PDETOUR_BINARY pBinary); 665 | 666 | /////////////////////////////////////////////////// Create Process & Load Dll. 667 | // 668 | _Success_(return != NULL) 669 | PVOID WINAPI DetourFindRemotePayload(_In_ HANDLE hProcess, 670 | _In_ REFGUID rguid, 671 | _Out_opt_ DWORD *pcbData); 672 | 673 | typedef BOOL (WINAPI *PDETOUR_CREATE_PROCESS_ROUTINEA)( 674 | _In_opt_ LPCSTR lpApplicationName, 675 | _Inout_opt_ LPSTR lpCommandLine, 676 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, 677 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, 678 | _In_ BOOL bInheritHandles, 679 | _In_ DWORD dwCreationFlags, 680 | _In_opt_ LPVOID lpEnvironment, 681 | _In_opt_ LPCSTR lpCurrentDirectory, 682 | _In_ LPSTARTUPINFOA lpStartupInfo, 683 | _Out_ LPPROCESS_INFORMATION lpProcessInformation); 684 | 685 | typedef BOOL (WINAPI *PDETOUR_CREATE_PROCESS_ROUTINEW)( 686 | _In_opt_ LPCWSTR lpApplicationName, 687 | _Inout_opt_ LPWSTR lpCommandLine, 688 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, 689 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, 690 | _In_ BOOL bInheritHandles, 691 | _In_ DWORD dwCreationFlags, 692 | _In_opt_ LPVOID lpEnvironment, 693 | _In_opt_ LPCWSTR lpCurrentDirectory, 694 | _In_ LPSTARTUPINFOW lpStartupInfo, 695 | _Out_ LPPROCESS_INFORMATION lpProcessInformation); 696 | 697 | BOOL WINAPI DetourCreateProcessWithDllA(_In_opt_ LPCSTR lpApplicationName, 698 | _Inout_opt_ LPSTR lpCommandLine, 699 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, 700 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, 701 | _In_ BOOL bInheritHandles, 702 | _In_ DWORD dwCreationFlags, 703 | _In_opt_ LPVOID lpEnvironment, 704 | _In_opt_ LPCSTR lpCurrentDirectory, 705 | _In_ LPSTARTUPINFOA lpStartupInfo, 706 | _Out_ LPPROCESS_INFORMATION lpProcessInformation, 707 | _In_ LPCSTR lpDllName, 708 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA); 709 | 710 | BOOL WINAPI DetourCreateProcessWithDllW(_In_opt_ LPCWSTR lpApplicationName, 711 | _Inout_opt_ LPWSTR lpCommandLine, 712 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, 713 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, 714 | _In_ BOOL bInheritHandles, 715 | _In_ DWORD dwCreationFlags, 716 | _In_opt_ LPVOID lpEnvironment, 717 | _In_opt_ LPCWSTR lpCurrentDirectory, 718 | _In_ LPSTARTUPINFOW lpStartupInfo, 719 | _Out_ LPPROCESS_INFORMATION lpProcessInformation, 720 | _In_ LPCSTR lpDllName, 721 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW); 722 | 723 | #ifdef UNICODE 724 | #define DetourCreateProcessWithDll DetourCreateProcessWithDllW 725 | #define PDETOUR_CREATE_PROCESS_ROUTINE PDETOUR_CREATE_PROCESS_ROUTINEW 726 | #else 727 | #define DetourCreateProcessWithDll DetourCreateProcessWithDllA 728 | #define PDETOUR_CREATE_PROCESS_ROUTINE PDETOUR_CREATE_PROCESS_ROUTINEA 729 | #endif // !UNICODE 730 | 731 | BOOL WINAPI DetourCreateProcessWithDllExA(_In_opt_ LPCSTR lpApplicationName, 732 | _Inout_opt_ LPSTR lpCommandLine, 733 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, 734 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, 735 | _In_ BOOL bInheritHandles, 736 | _In_ DWORD dwCreationFlags, 737 | _In_opt_ LPVOID lpEnvironment, 738 | _In_opt_ LPCSTR lpCurrentDirectory, 739 | _In_ LPSTARTUPINFOA lpStartupInfo, 740 | _Out_ LPPROCESS_INFORMATION lpProcessInformation, 741 | _In_ LPCSTR lpDllName, 742 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA); 743 | 744 | BOOL WINAPI DetourCreateProcessWithDllExW(_In_opt_ LPCWSTR lpApplicationName, 745 | _Inout_opt_ LPWSTR lpCommandLine, 746 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, 747 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, 748 | _In_ BOOL bInheritHandles, 749 | _In_ DWORD dwCreationFlags, 750 | _In_opt_ LPVOID lpEnvironment, 751 | _In_opt_ LPCWSTR lpCurrentDirectory, 752 | _In_ LPSTARTUPINFOW lpStartupInfo, 753 | _Out_ LPPROCESS_INFORMATION lpProcessInformation, 754 | _In_ LPCSTR lpDllName, 755 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW); 756 | 757 | #ifdef UNICODE 758 | #define DetourCreateProcessWithDllEx DetourCreateProcessWithDllExW 759 | #else 760 | #define DetourCreateProcessWithDllEx DetourCreateProcessWithDllExA 761 | #endif // !UNICODE 762 | 763 | BOOL WINAPI DetourCreateProcessWithDllsA(_In_opt_ LPCSTR lpApplicationName, 764 | _Inout_opt_ LPSTR lpCommandLine, 765 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, 766 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, 767 | _In_ BOOL bInheritHandles, 768 | _In_ DWORD dwCreationFlags, 769 | _In_opt_ LPVOID lpEnvironment, 770 | _In_opt_ LPCSTR lpCurrentDirectory, 771 | _In_ LPSTARTUPINFOA lpStartupInfo, 772 | _Out_ LPPROCESS_INFORMATION lpProcessInformation, 773 | _In_ DWORD nDlls, 774 | _In_reads_(nDlls) LPCSTR *rlpDlls, 775 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA); 776 | 777 | BOOL WINAPI DetourCreateProcessWithDllsW(_In_opt_ LPCWSTR lpApplicationName, 778 | _Inout_opt_ LPWSTR lpCommandLine, 779 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, 780 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, 781 | _In_ BOOL bInheritHandles, 782 | _In_ DWORD dwCreationFlags, 783 | _In_opt_ LPVOID lpEnvironment, 784 | _In_opt_ LPCWSTR lpCurrentDirectory, 785 | _In_ LPSTARTUPINFOW lpStartupInfo, 786 | _Out_ LPPROCESS_INFORMATION lpProcessInformation, 787 | _In_ DWORD nDlls, 788 | _In_reads_(nDlls) LPCSTR *rlpDlls, 789 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW); 790 | 791 | #ifdef UNICODE 792 | #define DetourCreateProcessWithDlls DetourCreateProcessWithDllsW 793 | #else 794 | #define DetourCreateProcessWithDlls DetourCreateProcessWithDllsA 795 | #endif // !UNICODE 796 | 797 | BOOL WINAPI DetourProcessViaHelperA(_In_ DWORD dwTargetPid, 798 | _In_ LPCSTR lpDllName, 799 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA); 800 | 801 | BOOL WINAPI DetourProcessViaHelperW(_In_ DWORD dwTargetPid, 802 | _In_ LPCSTR lpDllName, 803 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW); 804 | 805 | #ifdef UNICODE 806 | #define DetourProcessViaHelper DetourProcessViaHelperW 807 | #else 808 | #define DetourProcessViaHelper DetourProcessViaHelperA 809 | #endif // !UNICODE 810 | 811 | BOOL WINAPI DetourProcessViaHelperDllsA(_In_ DWORD dwTargetPid, 812 | _In_ DWORD nDlls, 813 | _In_reads_(nDlls) LPCSTR *rlpDlls, 814 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA); 815 | 816 | BOOL WINAPI DetourProcessViaHelperDllsW(_In_ DWORD dwTargetPid, 817 | _In_ DWORD nDlls, 818 | _In_reads_(nDlls) LPCSTR *rlpDlls, 819 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW); 820 | 821 | #ifdef UNICODE 822 | #define DetourProcessViaHelperDlls DetourProcessViaHelperDllsW 823 | #else 824 | #define DetourProcessViaHelperDlls DetourProcessViaHelperDllsA 825 | #endif // !UNICODE 826 | 827 | BOOL WINAPI DetourUpdateProcessWithDll(_In_ HANDLE hProcess, 828 | _In_reads_(nDlls) LPCSTR *rlpDlls, 829 | _In_ DWORD nDlls); 830 | 831 | BOOL WINAPI DetourUpdateProcessWithDllEx(_In_ HANDLE hProcess, 832 | _In_ HMODULE hImage, 833 | _In_ BOOL bIs32Bit, 834 | _In_reads_(nDlls) LPCSTR *rlpDlls, 835 | _In_ DWORD nDlls); 836 | 837 | BOOL WINAPI DetourCopyPayloadToProcess(_In_ HANDLE hProcess, 838 | _In_ REFGUID rguid, 839 | _In_reads_bytes_(cbData) LPCVOID pvData, 840 | _In_ DWORD cbData); 841 | _Success_(return != NULL) 842 | PVOID WINAPI DetourCopyPayloadToProcessEx(_In_ HANDLE hProcess, 843 | _In_ REFGUID rguid, 844 | _In_reads_bytes_(cbData) LPCVOID pvData, 845 | _In_ DWORD cbData); 846 | 847 | BOOL WINAPI DetourRestoreAfterWith(VOID); 848 | BOOL WINAPI DetourRestoreAfterWithEx(_In_reads_bytes_(cbData) PVOID pvData, 849 | _In_ DWORD cbData); 850 | BOOL WINAPI DetourIsHelperProcess(VOID); 851 | VOID CALLBACK DetourFinishHelperProcess(_In_ HWND, 852 | _In_ HINSTANCE, 853 | _In_ LPSTR, 854 | _In_ INT); 855 | 856 | // 857 | ////////////////////////////////////////////////////////////////////////////// 858 | #ifdef __cplusplus 859 | } 860 | #endif // __cplusplus 861 | 862 | /////////////////////////////////////////////////// Type-safe overloads for C++ 863 | // 864 | #if __cplusplus >= 201103L || _MSVC_LANG >= 201103L 865 | #include 866 | 867 | template 868 | struct DetoursIsFunctionPointer : std::false_type {}; 869 | 870 | template 871 | struct DetoursIsFunctionPointer : std::is_function::type> {}; 872 | 873 | template< 874 | typename T, 875 | typename std::enable_if::value, int>::type = 0> 876 | LONG DetourAttach(_Inout_ T *ppPointer, 877 | _In_ T pDetour) noexcept 878 | { 879 | return DetourAttach( 880 | reinterpret_cast(ppPointer), 881 | reinterpret_cast(pDetour)); 882 | } 883 | 884 | template< 885 | typename T, 886 | typename std::enable_if::value, int>::type = 0> 887 | LONG DetourAttachEx(_Inout_ T *ppPointer, 888 | _In_ T pDetour, 889 | _Out_opt_ PDETOUR_TRAMPOLINE *ppRealTrampoline, 890 | _Out_opt_ T *ppRealTarget, 891 | _Out_opt_ T *ppRealDetour) noexcept 892 | { 893 | return DetourAttachEx( 894 | reinterpret_cast(ppPointer), 895 | reinterpret_cast(pDetour), 896 | ppRealTrampoline, 897 | reinterpret_cast(ppRealTarget), 898 | reinterpret_cast(ppRealDetour)); 899 | } 900 | 901 | template< 902 | typename T, 903 | typename std::enable_if::value, int>::type = 0> 904 | LONG DetourDetach(_Inout_ T *ppPointer, 905 | _In_ T pDetour) noexcept 906 | { 907 | return DetourDetach( 908 | reinterpret_cast(ppPointer), 909 | reinterpret_cast(pDetour)); 910 | } 911 | 912 | #endif // __cplusplus >= 201103L || _MSVC_LANG >= 201103L 913 | // 914 | ////////////////////////////////////////////////////////////////////////////// 915 | 916 | //////////////////////////////////////////////// Detours Internal Definitions. 917 | // 918 | #ifdef __cplusplus 919 | #ifdef DETOURS_INTERNAL 920 | 921 | #define NOTHROW 922 | // #define NOTHROW (nothrow) 923 | 924 | ////////////////////////////////////////////////////////////////////////////// 925 | // 926 | #if (_MSC_VER < 1299) && !defined(__GNUC__) 927 | #include 928 | typedef IMAGEHLP_MODULE IMAGEHLP_MODULE64; 929 | typedef PIMAGEHLP_MODULE PIMAGEHLP_MODULE64; 930 | typedef IMAGEHLP_SYMBOL SYMBOL_INFO; 931 | typedef PIMAGEHLP_SYMBOL PSYMBOL_INFO; 932 | 933 | static inline 934 | LONG InterlockedCompareExchange(_Inout_ LONG *ptr, _In_ LONG nval, _In_ LONG oval) 935 | { 936 | return (LONG)::InterlockedCompareExchange((PVOID*)ptr, (PVOID)nval, (PVOID)oval); 937 | } 938 | #else 939 | #pragma warning(push) 940 | #pragma warning(disable:4091) // empty typedef 941 | #include 942 | #pragma warning(pop) 943 | #endif 944 | 945 | #ifdef IMAGEAPI // defined by DBGHELP.H 946 | typedef LPAPI_VERSION (NTAPI *PF_ImagehlpApiVersionEx)(_In_ LPAPI_VERSION AppVersion); 947 | 948 | typedef BOOL (NTAPI *PF_SymInitialize)(_In_ HANDLE hProcess, 949 | _In_opt_ LPCSTR UserSearchPath, 950 | _In_ BOOL fInvadeProcess); 951 | typedef DWORD (NTAPI *PF_SymSetOptions)(_In_ DWORD SymOptions); 952 | typedef DWORD (NTAPI *PF_SymGetOptions)(VOID); 953 | typedef DWORD64 (NTAPI *PF_SymLoadModule64)(_In_ HANDLE hProcess, 954 | _In_opt_ HANDLE hFile, 955 | _In_opt_ LPSTR ImageName, 956 | _In_opt_ LPSTR ModuleName, 957 | _In_ DWORD64 BaseOfDll, 958 | _In_ DWORD SizeOfDll); 959 | typedef BOOL (NTAPI *PF_SymGetModuleInfo64)(_In_ HANDLE hProcess, 960 | _In_ DWORD64 qwAddr, 961 | _Out_ PIMAGEHLP_MODULE64 ModuleInfo); 962 | typedef BOOL (NTAPI *PF_SymFromName)(_In_ HANDLE hProcess, 963 | _In_ LPSTR Name, 964 | _Out_ PSYMBOL_INFO Symbol); 965 | 966 | typedef struct _DETOUR_SYM_INFO 967 | { 968 | HANDLE hProcess; 969 | HMODULE hDbgHelp; 970 | PF_ImagehlpApiVersionEx pfImagehlpApiVersionEx; 971 | PF_SymInitialize pfSymInitialize; 972 | PF_SymSetOptions pfSymSetOptions; 973 | PF_SymGetOptions pfSymGetOptions; 974 | PF_SymLoadModule64 pfSymLoadModule64; 975 | PF_SymGetModuleInfo64 pfSymGetModuleInfo64; 976 | PF_SymFromName pfSymFromName; 977 | } DETOUR_SYM_INFO, *PDETOUR_SYM_INFO; 978 | 979 | PDETOUR_SYM_INFO DetourLoadImageHlp(VOID); 980 | 981 | #endif // IMAGEAPI 982 | 983 | #if defined(_INC_STDIO) && !defined(_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS) 984 | #error detours.h must be included before stdio.h (or at least define _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS earlier) 985 | #endif 986 | #define _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS 1 987 | 988 | #ifdef _DEBUG 989 | 990 | int Detour_AssertExprWithFunctionName(int reportType, const char* filename, int linenumber, const char* FunctionName, const char* msg); 991 | 992 | #define DETOUR_ASSERT_EXPR_WITH_FUNCTION(expr, msg) \ 993 | (void) ((expr) || \ 994 | (1 != Detour_AssertExprWithFunctionName(_CRT_ASSERT, __FILE__, __LINE__,__FUNCTION__, msg)) || \ 995 | (_CrtDbgBreak(), 0)) 996 | 997 | #define DETOUR_ASSERT(expr) DETOUR_ASSERT_EXPR_WITH_FUNCTION((expr), #expr) 998 | 999 | #else// _DEBUG 1000 | #define DETOUR_ASSERT(expr) 1001 | #endif// _DEBUG 1002 | 1003 | #ifndef DETOUR_TRACE 1004 | #if DETOUR_DEBUG 1005 | #define DETOUR_TRACE(x) printf x 1006 | #define DETOUR_BREAK() __debugbreak() 1007 | #include 1008 | #include 1009 | #else 1010 | #define DETOUR_TRACE(x) 1011 | #define DETOUR_BREAK() 1012 | #endif 1013 | #endif 1014 | 1015 | #if 1 || defined(DETOURS_IA64) 1016 | 1017 | // 1018 | // IA64 instructions are 41 bits, 3 per bundle, plus 5 bit bundle template => 128 bits per bundle. 1019 | // 1020 | 1021 | #define DETOUR_IA64_INSTRUCTIONS_PER_BUNDLE (3) 1022 | 1023 | #define DETOUR_IA64_TEMPLATE_OFFSET (0) 1024 | #define DETOUR_IA64_TEMPLATE_SIZE (5) 1025 | 1026 | #define DETOUR_IA64_INSTRUCTION_SIZE (41) 1027 | #define DETOUR_IA64_INSTRUCTION0_OFFSET (DETOUR_IA64_TEMPLATE_SIZE) 1028 | #define DETOUR_IA64_INSTRUCTION1_OFFSET (DETOUR_IA64_TEMPLATE_SIZE + DETOUR_IA64_INSTRUCTION_SIZE) 1029 | #define DETOUR_IA64_INSTRUCTION2_OFFSET (DETOUR_IA64_TEMPLATE_SIZE + DETOUR_IA64_INSTRUCTION_SIZE + DETOUR_IA64_INSTRUCTION_SIZE) 1030 | 1031 | C_ASSERT(DETOUR_IA64_TEMPLATE_SIZE + DETOUR_IA64_INSTRUCTIONS_PER_BUNDLE * DETOUR_IA64_INSTRUCTION_SIZE == 128); 1032 | 1033 | __declspec(align(16)) struct DETOUR_IA64_BUNDLE 1034 | { 1035 | public: 1036 | union 1037 | { 1038 | BYTE data[16]; 1039 | UINT64 wide[2]; 1040 | }; 1041 | 1042 | enum { 1043 | A_UNIT = 1u, 1044 | I_UNIT = 2u, 1045 | M_UNIT = 3u, 1046 | B_UNIT = 4u, 1047 | F_UNIT = 5u, 1048 | L_UNIT = 6u, 1049 | X_UNIT = 7u, 1050 | }; 1051 | struct DETOUR_IA64_METADATA 1052 | { 1053 | ULONG nTemplate : 8; // Instruction template. 1054 | ULONG nUnit0 : 4; // Unit for slot 0 1055 | ULONG nUnit1 : 4; // Unit for slot 1 1056 | ULONG nUnit2 : 4; // Unit for slot 2 1057 | }; 1058 | 1059 | protected: 1060 | static const DETOUR_IA64_METADATA s_rceCopyTable[33]; 1061 | 1062 | UINT RelocateBundle(_Inout_ DETOUR_IA64_BUNDLE* pDst, _Inout_opt_ DETOUR_IA64_BUNDLE* pBundleExtra) const; 1063 | 1064 | bool RelocateInstruction(_Inout_ DETOUR_IA64_BUNDLE* pDst, 1065 | _In_ BYTE slot, 1066 | _Inout_opt_ DETOUR_IA64_BUNDLE* pBundleExtra) const; 1067 | 1068 | // 120 112 104 96 88 80 72 64 56 48 40 32 24 16 8 0 1069 | // f. e. d. c. b. a. 9. 8. 7. 6. 5. 4. 3. 2. 1. 0. 1070 | 1071 | // 00 1072 | // f.e. d.c. b.a. 9.8. 7.6. 5.4. 3.2. 1.0. 1073 | // 0000 0000 0000 0000 0000 0000 0000 001f : Template [4..0] 1074 | // 0000 0000 0000 0000 0000 03ff ffff ffe0 : Zero [ 41.. 5] 1075 | // 0000 0000 0000 0000 0000 3c00 0000 0000 : Zero [ 45.. 42] 1076 | // 0000 0000 0007 ffff ffff c000 0000 0000 : One [ 82.. 46] 1077 | // 0000 0000 0078 0000 0000 0000 0000 0000 : One [ 86.. 83] 1078 | // 0fff ffff ff80 0000 0000 0000 0000 0000 : Two [123.. 87] 1079 | // f000 0000 0000 0000 0000 0000 0000 0000 : Two [127..124] 1080 | BYTE GetTemplate() const; 1081 | // Get 4 bit opcodes. 1082 | BYTE GetInst0() const; 1083 | BYTE GetInst1() const; 1084 | BYTE GetInst2() const; 1085 | BYTE GetUnit(BYTE slot) const; 1086 | BYTE GetUnit0() const; 1087 | BYTE GetUnit1() const; 1088 | BYTE GetUnit2() const; 1089 | // Get 37 bit data. 1090 | UINT64 GetData0() const; 1091 | UINT64 GetData1() const; 1092 | UINT64 GetData2() const; 1093 | 1094 | // Get/set the full 41 bit instructions. 1095 | UINT64 GetInstruction(BYTE slot) const; 1096 | UINT64 GetInstruction0() const; 1097 | UINT64 GetInstruction1() const; 1098 | UINT64 GetInstruction2() const; 1099 | void SetInstruction(BYTE slot, UINT64 instruction); 1100 | void SetInstruction0(UINT64 instruction); 1101 | void SetInstruction1(UINT64 instruction); 1102 | void SetInstruction2(UINT64 instruction); 1103 | 1104 | // Get/set bitfields. 1105 | static UINT64 GetBits(UINT64 Value, UINT64 Offset, UINT64 Count); 1106 | static UINT64 SetBits(UINT64 Value, UINT64 Offset, UINT64 Count, UINT64 Field); 1107 | 1108 | // Get specific read-only fields. 1109 | static UINT64 GetOpcode(UINT64 instruction); // 4bit opcode 1110 | static UINT64 GetX(UINT64 instruction); // 1bit opcode extension 1111 | static UINT64 GetX3(UINT64 instruction); // 3bit opcode extension 1112 | static UINT64 GetX6(UINT64 instruction); // 6bit opcode extension 1113 | 1114 | // Get/set specific fields. 1115 | static UINT64 GetImm7a(UINT64 instruction); 1116 | static UINT64 SetImm7a(UINT64 instruction, UINT64 imm7a); 1117 | static UINT64 GetImm13c(UINT64 instruction); 1118 | static UINT64 SetImm13c(UINT64 instruction, UINT64 imm13c); 1119 | static UINT64 GetSignBit(UINT64 instruction); 1120 | static UINT64 SetSignBit(UINT64 instruction, UINT64 signBit); 1121 | static UINT64 GetImm20a(UINT64 instruction); 1122 | static UINT64 SetImm20a(UINT64 instruction, UINT64 imm20a); 1123 | static UINT64 GetImm20b(UINT64 instruction); 1124 | static UINT64 SetImm20b(UINT64 instruction, UINT64 imm20b); 1125 | 1126 | static UINT64 SignExtend(UINT64 Value, UINT64 Offset); 1127 | 1128 | BOOL IsMovlGp() const; 1129 | 1130 | VOID SetInst(BYTE Slot, BYTE nInst); 1131 | VOID SetInst0(BYTE nInst); 1132 | VOID SetInst1(BYTE nInst); 1133 | VOID SetInst2(BYTE nInst); 1134 | VOID SetData(BYTE Slot, UINT64 nData); 1135 | VOID SetData0(UINT64 nData); 1136 | VOID SetData1(UINT64 nData); 1137 | VOID SetData2(UINT64 nData); 1138 | BOOL SetNop(BYTE Slot); 1139 | BOOL SetNop0(); 1140 | BOOL SetNop1(); 1141 | BOOL SetNop2(); 1142 | 1143 | public: 1144 | BOOL IsBrl() const; 1145 | VOID SetBrl(); 1146 | VOID SetBrl(UINT64 target); 1147 | UINT64 GetBrlTarget() const; 1148 | VOID SetBrlTarget(UINT64 target); 1149 | VOID SetBrlImm(UINT64 imm); 1150 | UINT64 GetBrlImm() const; 1151 | 1152 | UINT64 GetMovlGp() const; 1153 | VOID SetMovlGp(UINT64 gp); 1154 | 1155 | VOID SetStop(); 1156 | 1157 | UINT Copy(_Out_ DETOUR_IA64_BUNDLE *pDst, _Inout_opt_ DETOUR_IA64_BUNDLE* pBundleExtra = NULL) const; 1158 | }; 1159 | #endif // DETOURS_IA64 1160 | 1161 | #ifdef DETOURS_ARM 1162 | 1163 | #define DETOURS_PFUNC_TO_PBYTE(p) ((PBYTE)(((ULONG_PTR)(p)) & ~(ULONG_PTR)1)) 1164 | #define DETOURS_PBYTE_TO_PFUNC(p) ((PBYTE)(((ULONG_PTR)(p)) | (ULONG_PTR)1)) 1165 | 1166 | #endif // DETOURS_ARM 1167 | 1168 | ////////////////////////////////////////////////////////////////////////////// 1169 | 1170 | #ifdef __cplusplus 1171 | extern "C" { 1172 | #endif // __cplusplus 1173 | 1174 | #define DETOUR_OFFLINE_LIBRARY(x) \ 1175 | PVOID WINAPI DetourCopyInstruction##x(_In_opt_ PVOID pDst, \ 1176 | _Inout_opt_ PVOID *ppDstPool, \ 1177 | _In_ PVOID pSrc, \ 1178 | _Out_opt_ PVOID *ppTarget, \ 1179 | _Out_opt_ LONG *plExtra); \ 1180 | \ 1181 | BOOL WINAPI DetourSetCodeModule##x(_In_ HMODULE hModule, \ 1182 | _In_ BOOL fLimitReferencesToModule); \ 1183 | 1184 | DETOUR_OFFLINE_LIBRARY(X86) 1185 | DETOUR_OFFLINE_LIBRARY(X64) 1186 | DETOUR_OFFLINE_LIBRARY(ARM) 1187 | DETOUR_OFFLINE_LIBRARY(ARM64) 1188 | DETOUR_OFFLINE_LIBRARY(IA64) 1189 | 1190 | #undef DETOUR_OFFLINE_LIBRARY 1191 | 1192 | ////////////////////////////////////////////////////////////////////////////// 1193 | // 1194 | // Helpers for manipulating page protection. 1195 | // 1196 | 1197 | _Success_(return != FALSE) 1198 | BOOL WINAPI DetourVirtualProtectSameExecuteEx(_In_ HANDLE hProcess, 1199 | _In_ PVOID pAddress, 1200 | _In_ SIZE_T nSize, 1201 | _In_ DWORD dwNewProtect, 1202 | _Out_ PDWORD pdwOldProtect); 1203 | 1204 | _Success_(return != FALSE) 1205 | BOOL WINAPI DetourVirtualProtectSameExecute(_In_ PVOID pAddress, 1206 | _In_ SIZE_T nSize, 1207 | _In_ DWORD dwNewProtect, 1208 | _Out_ PDWORD pdwOldProtect); 1209 | 1210 | // Detours must depend only on kernel32.lib, so we cannot use IsEqualGUID 1211 | BOOL WINAPI DetourAreSameGuid(_In_ REFGUID left, _In_ REFGUID right); 1212 | #ifdef __cplusplus 1213 | } 1214 | #endif // __cplusplus 1215 | 1216 | ////////////////////////////////////////////////////////////////////////////// 1217 | 1218 | #define MM_ALLOCATION_GRANULARITY 0x10000 1219 | 1220 | ////////////////////////////////////////////////////////////////////////////// 1221 | 1222 | #endif // DETOURS_INTERNAL 1223 | #endif // __cplusplus 1224 | 1225 | #endif // _DETOURS_H_ 1226 | // 1227 | //////////////////////////////////////////////////////////////// End of File. 1228 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/Detours/detver.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Common version parameters. 4 | // 5 | // Microsoft Research Detours Package, Version 4.0.1 6 | // 7 | // Copyright (c) Microsoft Corporation. All rights reserved. 8 | // 9 | 10 | #define _USING_V110_SDK71_ 1 11 | #include "winver.h" 12 | #if 0 13 | #include 14 | #include 15 | #else 16 | #ifndef DETOURS_STRINGIFY 17 | #define DETOURS_STRINGIFY_(x) #x 18 | #define DETOURS_STRINGIFY(x) DETOURS_STRINGIFY_(x) 19 | #endif 20 | 21 | #define VER_FILEFLAGSMASK 0x3fL 22 | #define VER_FILEFLAGS 0x0L 23 | #define VER_FILEOS 0x00040004L 24 | #define VER_FILETYPE 0x00000002L 25 | #define VER_FILESUBTYPE 0x00000000L 26 | #endif 27 | #define VER_DETOURS_BITS DETOURS_STRINGIFY(DETOURS_BITS) 28 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/Detours/disolarm.cpp: -------------------------------------------------------------------------------- 1 | #define DETOURS_ARM_OFFLINE_LIBRARY 2 | #include "disasm.cpp" 3 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/Detours/disolarm64.cpp: -------------------------------------------------------------------------------- 1 | #define DETOURS_ARM64_OFFLINE_LIBRARY 2 | #include "disasm.cpp" 3 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/Detours/disolia64.cpp: -------------------------------------------------------------------------------- 1 | #define DETOURS_IA64_OFFLINE_LIBRARY 2 | #include "disasm.cpp" 3 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/Detours/disolx64.cpp: -------------------------------------------------------------------------------- 1 | #define DETOURS_X64_OFFLINE_LIBRARY 2 | #include "disasm.cpp" 3 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/Detours/disolx86.cpp: -------------------------------------------------------------------------------- 1 | #define DETOURS_X86_OFFLINE_LIBRARY 2 | #include "disasm.cpp" 3 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/Detours/modules.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Enumeration Functions (modules.cpp of detours.lib) 4 | // 5 | // Microsoft Research Detours Package, Version 4.0.1 6 | // 7 | // Copyright (c) Microsoft Corporation. All rights reserved. 8 | // 9 | // Module enumeration functions. 10 | // 11 | 12 | // #define DETOUR_DEBUG 1 13 | #define DETOURS_INTERNAL 14 | #include "detours.h" 15 | 16 | #if DETOURS_VERSION != 0x4c0c1 // 0xMAJORcMINORcPATCH 17 | #error detours.h version mismatch 18 | #endif 19 | 20 | #define CLR_DIRECTORY OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR] 21 | #define IAT_DIRECTORY OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IAT] 22 | 23 | ////////////////////////////////////////////////////////////////////////////// 24 | // 25 | const GUID DETOUR_EXE_RESTORE_GUID = { 26 | 0xbda26f34, 0xbc82, 0x4829, 27 | { 0x9e, 0x64, 0x74, 0x2c, 0x4, 0xc8, 0x4f, 0xa0 } }; 28 | 29 | ////////////////////////////////////////////////////////////////////////////// 30 | // 31 | PDETOUR_SYM_INFO DetourLoadImageHlp(VOID) 32 | { 33 | static DETOUR_SYM_INFO symInfo; 34 | static PDETOUR_SYM_INFO pSymInfo = NULL; 35 | static BOOL failed = false; 36 | 37 | if (failed) { 38 | return NULL; 39 | } 40 | if (pSymInfo != NULL) { 41 | return pSymInfo; 42 | } 43 | 44 | ZeroMemory(&symInfo, sizeof(symInfo)); 45 | // Create a real handle to the process. 46 | #if 0 47 | DuplicateHandle(GetCurrentProcess(), 48 | GetCurrentProcess(), 49 | GetCurrentProcess(), 50 | &symInfo.hProcess, 51 | 0, 52 | FALSE, 53 | DUPLICATE_SAME_ACCESS); 54 | #else 55 | symInfo.hProcess = GetCurrentProcess(); 56 | #endif 57 | 58 | symInfo.hDbgHelp = LoadLibraryExW(L"dbghelp.dll", NULL, 0); 59 | if (symInfo.hDbgHelp == NULL) { 60 | abort: 61 | failed = true; 62 | if (symInfo.hDbgHelp != NULL) { 63 | FreeLibrary(symInfo.hDbgHelp); 64 | } 65 | symInfo.pfImagehlpApiVersionEx = NULL; 66 | symInfo.pfSymInitialize = NULL; 67 | symInfo.pfSymSetOptions = NULL; 68 | symInfo.pfSymGetOptions = NULL; 69 | symInfo.pfSymLoadModule64 = NULL; 70 | symInfo.pfSymGetModuleInfo64 = NULL; 71 | symInfo.pfSymFromName = NULL; 72 | return NULL; 73 | } 74 | 75 | symInfo.pfImagehlpApiVersionEx 76 | = (PF_ImagehlpApiVersionEx)GetProcAddress(symInfo.hDbgHelp, 77 | "ImagehlpApiVersionEx"); 78 | symInfo.pfSymInitialize 79 | = (PF_SymInitialize)GetProcAddress(symInfo.hDbgHelp, "SymInitialize"); 80 | symInfo.pfSymSetOptions 81 | = (PF_SymSetOptions)GetProcAddress(symInfo.hDbgHelp, "SymSetOptions"); 82 | symInfo.pfSymGetOptions 83 | = (PF_SymGetOptions)GetProcAddress(symInfo.hDbgHelp, "SymGetOptions"); 84 | symInfo.pfSymLoadModule64 85 | = (PF_SymLoadModule64)GetProcAddress(symInfo.hDbgHelp, "SymLoadModule64"); 86 | symInfo.pfSymGetModuleInfo64 87 | = (PF_SymGetModuleInfo64)GetProcAddress(symInfo.hDbgHelp, "SymGetModuleInfo64"); 88 | symInfo.pfSymFromName 89 | = (PF_SymFromName)GetProcAddress(symInfo.hDbgHelp, "SymFromName"); 90 | 91 | API_VERSION av; 92 | ZeroMemory(&av, sizeof(av)); 93 | av.MajorVersion = API_VERSION_NUMBER; 94 | 95 | if (symInfo.pfImagehlpApiVersionEx == NULL || 96 | symInfo.pfSymInitialize == NULL || 97 | symInfo.pfSymLoadModule64 == NULL || 98 | symInfo.pfSymGetModuleInfo64 == NULL || 99 | symInfo.pfSymFromName == NULL) { 100 | goto abort; 101 | } 102 | 103 | symInfo.pfImagehlpApiVersionEx(&av); 104 | if (av.MajorVersion < API_VERSION_NUMBER) { 105 | goto abort; 106 | } 107 | 108 | if (!symInfo.pfSymInitialize(symInfo.hProcess, NULL, FALSE)) { 109 | // We won't retry the initialize if it fails. 110 | goto abort; 111 | } 112 | 113 | if (symInfo.pfSymGetOptions != NULL && symInfo.pfSymSetOptions != NULL) { 114 | DWORD dw = symInfo.pfSymGetOptions(); 115 | 116 | dw &= ~(SYMOPT_CASE_INSENSITIVE | 117 | SYMOPT_UNDNAME | 118 | SYMOPT_DEFERRED_LOADS | 119 | 0); 120 | dw |= ( 121 | #if defined(SYMOPT_EXACT_SYMBOLS) 122 | SYMOPT_EXACT_SYMBOLS | 123 | #endif 124 | #if defined(SYMOPT_NO_UNQUALIFIED_LOADS) 125 | SYMOPT_NO_UNQUALIFIED_LOADS | 126 | #endif 127 | SYMOPT_DEFERRED_LOADS | 128 | #if defined(SYMOPT_FAIL_CRITICAL_ERRORS) 129 | SYMOPT_FAIL_CRITICAL_ERRORS | 130 | #endif 131 | #if defined(SYMOPT_INCLUDE_32BIT_MODULES) 132 | SYMOPT_INCLUDE_32BIT_MODULES | 133 | #endif 134 | 0); 135 | symInfo.pfSymSetOptions(dw); 136 | } 137 | 138 | pSymInfo = &symInfo; 139 | return pSymInfo; 140 | } 141 | 142 | PVOID WINAPI DetourFindFunction(_In_ LPCSTR pszModule, 143 | _In_ LPCSTR pszFunction) 144 | { 145 | if (pszFunction == NULL) { 146 | SetLastError(ERROR_INVALID_PARAMETER); 147 | return NULL; 148 | } 149 | 150 | /////////////////////////////////////////////// First, try GetProcAddress. 151 | // 152 | #pragma prefast(suppress:28752, "We don't do the unicode conversion for LoadLibraryExA.") 153 | HMODULE hModule = LoadLibraryExA(pszModule, NULL, 0); 154 | if (hModule == NULL) { 155 | return NULL; 156 | } 157 | 158 | PBYTE pbCode = (PBYTE)GetProcAddress(hModule, pszFunction); 159 | if (pbCode) { 160 | return pbCode; 161 | } 162 | 163 | ////////////////////////////////////////////////////// Then try ImageHelp. 164 | // 165 | DETOUR_TRACE(("DetourFindFunction(%hs, %hs)\n", pszModule, pszFunction)); 166 | PDETOUR_SYM_INFO pSymInfo = DetourLoadImageHlp(); 167 | if (pSymInfo == NULL) { 168 | DETOUR_TRACE(("DetourLoadImageHlp failed: %lu\n", 169 | GetLastError())); 170 | return NULL; 171 | } 172 | 173 | if (pSymInfo->pfSymLoadModule64(pSymInfo->hProcess, NULL, 174 | (PCHAR)pszModule, NULL, 175 | (DWORD64)hModule, 0) == 0) { 176 | if (ERROR_SUCCESS != GetLastError()) { 177 | DETOUR_TRACE(("SymLoadModule64(%p) failed: %lu\n", 178 | pSymInfo->hProcess, GetLastError())); 179 | return NULL; 180 | } 181 | } 182 | 183 | HRESULT hrRet; 184 | CHAR szFullName[512]; 185 | IMAGEHLP_MODULE64 modinfo; 186 | ZeroMemory(&modinfo, sizeof(modinfo)); 187 | modinfo.SizeOfStruct = sizeof(modinfo); 188 | if (!pSymInfo->pfSymGetModuleInfo64(pSymInfo->hProcess, (DWORD64)hModule, &modinfo)) { 189 | DETOUR_TRACE(("SymGetModuleInfo64(%p, %p) failed: %lu\n", 190 | pSymInfo->hProcess, hModule, GetLastError())); 191 | return NULL; 192 | } 193 | 194 | hrRet = StringCchCopyA(szFullName, sizeof(szFullName)/sizeof(CHAR), modinfo.ModuleName); 195 | if (FAILED(hrRet)) { 196 | DETOUR_TRACE(("StringCchCopyA failed: %08lx\n", hrRet)); 197 | return NULL; 198 | } 199 | hrRet = StringCchCatA(szFullName, sizeof(szFullName)/sizeof(CHAR), "!"); 200 | if (FAILED(hrRet)) { 201 | DETOUR_TRACE(("StringCchCatA failed: %08lx\n", hrRet)); 202 | return NULL; 203 | } 204 | hrRet = StringCchCatA(szFullName, sizeof(szFullName)/sizeof(CHAR), pszFunction); 205 | if (FAILED(hrRet)) { 206 | DETOUR_TRACE(("StringCchCatA failed: %08lx\n", hrRet)); 207 | return NULL; 208 | } 209 | 210 | struct CFullSymbol : SYMBOL_INFO { 211 | CHAR szRestOfName[512]; 212 | } symbol; 213 | ZeroMemory(&symbol, sizeof(symbol)); 214 | //symbol.ModBase = (ULONG64)hModule; 215 | symbol.SizeOfStruct = sizeof(SYMBOL_INFO); 216 | #ifdef DBHLPAPI 217 | symbol.MaxNameLen = sizeof(symbol.szRestOfName)/sizeof(symbol.szRestOfName[0]); 218 | #else 219 | symbol.MaxNameLength = sizeof(symbol.szRestOfName)/sizeof(symbol.szRestOfName[0]); 220 | #endif 221 | 222 | if (!pSymInfo->pfSymFromName(pSymInfo->hProcess, szFullName, &symbol)) { 223 | DETOUR_TRACE(("SymFromName(%hs) failed: %lu\n", szFullName, GetLastError())); 224 | return NULL; 225 | } 226 | 227 | #if defined(DETOURS_IA64) 228 | // On the IA64, we get a raw code pointer from the symbol engine 229 | // and have to convert it to a wrapped [code pointer, global pointer]. 230 | // 231 | PPLABEL_DESCRIPTOR pldEntry = (PPLABEL_DESCRIPTOR)DetourGetEntryPoint(hModule); 232 | PPLABEL_DESCRIPTOR pldSymbol = new PLABEL_DESCRIPTOR; 233 | 234 | pldSymbol->EntryPoint = symbol.Address; 235 | pldSymbol->GlobalPointer = pldEntry->GlobalPointer; 236 | return (PBYTE)pldSymbol; 237 | #elif defined(DETOURS_ARM) 238 | // On the ARM, we get a raw code pointer, which we must convert into a 239 | // valied Thumb2 function pointer. 240 | return DETOURS_PBYTE_TO_PFUNC(symbol.Address); 241 | #else 242 | return (PBYTE)symbol.Address; 243 | #endif 244 | } 245 | 246 | //////////////////////////////////////////////////// Module Image Functions. 247 | // 248 | 249 | HMODULE WINAPI DetourEnumerateModules(_In_opt_ HMODULE hModuleLast) 250 | { 251 | PBYTE pbLast = (PBYTE)hModuleLast + MM_ALLOCATION_GRANULARITY; 252 | 253 | MEMORY_BASIC_INFORMATION mbi; 254 | ZeroMemory(&mbi, sizeof(mbi)); 255 | 256 | // Find the next memory region that contains a mapped PE image. 257 | // 258 | for (;; pbLast = (PBYTE)mbi.BaseAddress + mbi.RegionSize) { 259 | if (VirtualQuery(pbLast, &mbi, sizeof(mbi)) <= 0) { 260 | break; 261 | } 262 | 263 | // Skip uncommitted regions and guard pages. 264 | // 265 | if ((mbi.State != MEM_COMMIT) || 266 | ((mbi.Protect & 0xff) == PAGE_NOACCESS) || 267 | (mbi.Protect & PAGE_GUARD)) { 268 | continue; 269 | } 270 | 271 | __try { 272 | PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)pbLast; 273 | if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE || 274 | (DWORD)pDosHeader->e_lfanew > mbi.RegionSize || 275 | (DWORD)pDosHeader->e_lfanew < sizeof(*pDosHeader)) { 276 | continue; 277 | } 278 | 279 | PIMAGE_NT_HEADERS pNtHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDosHeader + 280 | pDosHeader->e_lfanew); 281 | if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) { 282 | continue; 283 | } 284 | 285 | SetLastError(NO_ERROR); 286 | return (HMODULE)pDosHeader; 287 | } 288 | #pragma prefast(suppress:28940, "A bad pointer means this probably isn't a PE header.") 289 | __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? 290 | EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { 291 | continue; 292 | } 293 | } 294 | return NULL; 295 | } 296 | 297 | PVOID WINAPI DetourGetEntryPoint(_In_opt_ HMODULE hModule) 298 | { 299 | PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)hModule; 300 | if (hModule == NULL) { 301 | pDosHeader = (PIMAGE_DOS_HEADER)GetModuleHandleW(NULL); 302 | } 303 | 304 | __try { 305 | #pragma warning(suppress:6011) // GetModuleHandleW(NULL) never returns NULL. 306 | if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) { 307 | SetLastError(ERROR_BAD_EXE_FORMAT); 308 | return NULL; 309 | } 310 | 311 | PIMAGE_NT_HEADERS pNtHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDosHeader + 312 | pDosHeader->e_lfanew); 313 | if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) { 314 | SetLastError(ERROR_INVALID_EXE_SIGNATURE); 315 | return NULL; 316 | } 317 | if (pNtHeader->FileHeader.SizeOfOptionalHeader == 0) { 318 | SetLastError(ERROR_EXE_MARKED_INVALID); 319 | return NULL; 320 | } 321 | 322 | PDETOUR_CLR_HEADER pClrHeader = NULL; 323 | if (pNtHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) { 324 | if (((PIMAGE_NT_HEADERS32)pNtHeader)->CLR_DIRECTORY.VirtualAddress != 0 && 325 | ((PIMAGE_NT_HEADERS32)pNtHeader)->CLR_DIRECTORY.Size != 0) { 326 | pClrHeader = (PDETOUR_CLR_HEADER) 327 | (((PBYTE)pDosHeader) 328 | + ((PIMAGE_NT_HEADERS32)pNtHeader)->CLR_DIRECTORY.VirtualAddress); 329 | } 330 | } 331 | else if (pNtHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) { 332 | if (((PIMAGE_NT_HEADERS64)pNtHeader)->CLR_DIRECTORY.VirtualAddress != 0 && 333 | ((PIMAGE_NT_HEADERS64)pNtHeader)->CLR_DIRECTORY.Size != 0) { 334 | pClrHeader = (PDETOUR_CLR_HEADER) 335 | (((PBYTE)pDosHeader) 336 | + ((PIMAGE_NT_HEADERS64)pNtHeader)->CLR_DIRECTORY.VirtualAddress); 337 | } 338 | } 339 | 340 | if (pClrHeader != NULL) { 341 | // For MSIL assemblies, we want to use the _Cor entry points. 342 | 343 | HMODULE hClr = GetModuleHandleW(L"MSCOREE.DLL"); 344 | if (hClr == NULL) { 345 | return NULL; 346 | } 347 | 348 | SetLastError(NO_ERROR); 349 | return (PVOID)GetProcAddress(hClr, "_CorExeMain"); 350 | } 351 | 352 | SetLastError(NO_ERROR); 353 | 354 | // Pure resource DLLs have neither an entry point nor CLR information 355 | // so handle them by returning NULL (LastError is NO_ERROR) 356 | if (pNtHeader->OptionalHeader.AddressOfEntryPoint == 0) { 357 | return NULL; 358 | } 359 | 360 | return ((PBYTE)pDosHeader) + 361 | pNtHeader->OptionalHeader.AddressOfEntryPoint; 362 | } 363 | __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? 364 | EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { 365 | SetLastError(ERROR_EXE_MARKED_INVALID); 366 | return NULL; 367 | } 368 | } 369 | 370 | ULONG WINAPI DetourGetModuleSize(_In_opt_ HMODULE hModule) 371 | { 372 | PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)hModule; 373 | if (hModule == NULL) { 374 | pDosHeader = (PIMAGE_DOS_HEADER)GetModuleHandleW(NULL); 375 | } 376 | 377 | __try { 378 | #pragma warning(suppress:6011) // GetModuleHandleW(NULL) never returns NULL. 379 | if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) { 380 | SetLastError(ERROR_BAD_EXE_FORMAT); 381 | return NULL; 382 | } 383 | 384 | PIMAGE_NT_HEADERS pNtHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDosHeader + 385 | pDosHeader->e_lfanew); 386 | if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) { 387 | SetLastError(ERROR_INVALID_EXE_SIGNATURE); 388 | return NULL; 389 | } 390 | if (pNtHeader->FileHeader.SizeOfOptionalHeader == 0) { 391 | SetLastError(ERROR_EXE_MARKED_INVALID); 392 | return NULL; 393 | } 394 | SetLastError(NO_ERROR); 395 | 396 | return (pNtHeader->OptionalHeader.SizeOfImage); 397 | } 398 | __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? 399 | EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { 400 | SetLastError(ERROR_EXE_MARKED_INVALID); 401 | return NULL; 402 | } 403 | } 404 | 405 | HMODULE WINAPI DetourGetContainingModule(_In_ PVOID pvAddr) 406 | { 407 | MEMORY_BASIC_INFORMATION mbi; 408 | ZeroMemory(&mbi, sizeof(mbi)); 409 | 410 | __try { 411 | if (VirtualQuery(pvAddr, &mbi, sizeof(mbi)) <= 0) { 412 | SetLastError(ERROR_BAD_EXE_FORMAT); 413 | return NULL; 414 | } 415 | 416 | // Skip uncommitted regions and guard pages. 417 | // 418 | if ((mbi.State != MEM_COMMIT) || 419 | ((mbi.Protect & 0xff) == PAGE_NOACCESS) || 420 | (mbi.Protect & PAGE_GUARD)) { 421 | SetLastError(ERROR_BAD_EXE_FORMAT); 422 | return NULL; 423 | } 424 | 425 | PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)mbi.AllocationBase; 426 | if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) { 427 | SetLastError(ERROR_BAD_EXE_FORMAT); 428 | return NULL; 429 | } 430 | 431 | PIMAGE_NT_HEADERS pNtHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDosHeader + 432 | pDosHeader->e_lfanew); 433 | if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) { 434 | SetLastError(ERROR_INVALID_EXE_SIGNATURE); 435 | return NULL; 436 | } 437 | if (pNtHeader->FileHeader.SizeOfOptionalHeader == 0) { 438 | SetLastError(ERROR_EXE_MARKED_INVALID); 439 | return NULL; 440 | } 441 | SetLastError(NO_ERROR); 442 | 443 | return (HMODULE)pDosHeader; 444 | } 445 | __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? 446 | EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { 447 | SetLastError(ERROR_INVALID_EXE_SIGNATURE); 448 | return NULL; 449 | } 450 | } 451 | 452 | 453 | static inline PBYTE RvaAdjust(_Pre_notnull_ PIMAGE_DOS_HEADER pDosHeader, _In_ DWORD raddr) 454 | { 455 | if (raddr != NULL) { 456 | return ((PBYTE)pDosHeader) + raddr; 457 | } 458 | return NULL; 459 | } 460 | 461 | BOOL WINAPI DetourEnumerateExports(_In_ HMODULE hModule, 462 | _In_opt_ PVOID pContext, 463 | _In_ PF_DETOUR_ENUMERATE_EXPORT_CALLBACK pfExport) 464 | { 465 | if (pfExport == NULL) { 466 | SetLastError(ERROR_INVALID_PARAMETER); 467 | return FALSE; 468 | } 469 | 470 | PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)hModule; 471 | if (hModule == NULL) { 472 | pDosHeader = (PIMAGE_DOS_HEADER)GetModuleHandleW(NULL); 473 | } 474 | 475 | __try { 476 | #pragma warning(suppress:6011) // GetModuleHandleW(NULL) never returns NULL. 477 | if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) { 478 | SetLastError(ERROR_BAD_EXE_FORMAT); 479 | return NULL; 480 | } 481 | 482 | PIMAGE_NT_HEADERS pNtHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDosHeader + 483 | pDosHeader->e_lfanew); 484 | if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) { 485 | SetLastError(ERROR_INVALID_EXE_SIGNATURE); 486 | return FALSE; 487 | } 488 | if (pNtHeader->FileHeader.SizeOfOptionalHeader == 0) { 489 | SetLastError(ERROR_EXE_MARKED_INVALID); 490 | return FALSE; 491 | } 492 | 493 | PIMAGE_EXPORT_DIRECTORY pExportDir 494 | = (PIMAGE_EXPORT_DIRECTORY) 495 | RvaAdjust(pDosHeader, 496 | pNtHeader->OptionalHeader 497 | .DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress); 498 | 499 | if (pExportDir == NULL) { 500 | SetLastError(ERROR_EXE_MARKED_INVALID); 501 | return FALSE; 502 | } 503 | 504 | PBYTE pExportDirEnd = (PBYTE)pExportDir + pNtHeader->OptionalHeader 505 | .DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size; 506 | PDWORD pdwFunctions = (PDWORD)RvaAdjust(pDosHeader, pExportDir->AddressOfFunctions); 507 | PDWORD pdwNames = (PDWORD)RvaAdjust(pDosHeader, pExportDir->AddressOfNames); 508 | PWORD pwOrdinals = (PWORD)RvaAdjust(pDosHeader, pExportDir->AddressOfNameOrdinals); 509 | 510 | for (DWORD nFunc = 0; nFunc < pExportDir->NumberOfFunctions; nFunc++) { 511 | PBYTE pbCode = (pdwFunctions != NULL) 512 | ? (PBYTE)RvaAdjust(pDosHeader, pdwFunctions[nFunc]) : NULL; 513 | PCHAR pszName = NULL; 514 | 515 | // if the pointer is in the export region, then it is a forwarder. 516 | if (pbCode > (PBYTE)pExportDir && pbCode < pExportDirEnd) { 517 | pbCode = NULL; 518 | } 519 | 520 | for (DWORD n = 0; n < pExportDir->NumberOfNames; n++) { 521 | if (pwOrdinals[n] == nFunc) { 522 | pszName = (pdwNames != NULL) 523 | ? (PCHAR)RvaAdjust(pDosHeader, pdwNames[n]) : NULL; 524 | break; 525 | } 526 | } 527 | ULONG nOrdinal = pExportDir->Base + nFunc; 528 | 529 | if (!pfExport(pContext, nOrdinal, pszName, pbCode)) { 530 | break; 531 | } 532 | } 533 | SetLastError(NO_ERROR); 534 | return TRUE; 535 | } 536 | __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? 537 | EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { 538 | SetLastError(ERROR_EXE_MARKED_INVALID); 539 | return NULL; 540 | } 541 | } 542 | 543 | BOOL WINAPI DetourEnumerateImportsEx(_In_opt_ HMODULE hModule, 544 | _In_opt_ PVOID pContext, 545 | _In_opt_ PF_DETOUR_IMPORT_FILE_CALLBACK pfImportFile, 546 | _In_opt_ PF_DETOUR_IMPORT_FUNC_CALLBACK_EX pfImportFunc) 547 | { 548 | PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)hModule; 549 | if (hModule == NULL) { 550 | pDosHeader = (PIMAGE_DOS_HEADER)GetModuleHandleW(NULL); 551 | } 552 | 553 | __try { 554 | #pragma warning(suppress:6011) // GetModuleHandleW(NULL) never returns NULL. 555 | if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) { 556 | SetLastError(ERROR_BAD_EXE_FORMAT); 557 | return FALSE; 558 | } 559 | 560 | PIMAGE_NT_HEADERS pNtHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDosHeader + 561 | pDosHeader->e_lfanew); 562 | if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) { 563 | SetLastError(ERROR_INVALID_EXE_SIGNATURE); 564 | return FALSE; 565 | } 566 | if (pNtHeader->FileHeader.SizeOfOptionalHeader == 0) { 567 | SetLastError(ERROR_EXE_MARKED_INVALID); 568 | return FALSE; 569 | } 570 | 571 | PIMAGE_IMPORT_DESCRIPTOR iidp 572 | = (PIMAGE_IMPORT_DESCRIPTOR) 573 | RvaAdjust(pDosHeader, 574 | pNtHeader->OptionalHeader 575 | .DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); 576 | 577 | if (iidp == NULL) { 578 | SetLastError(ERROR_EXE_MARKED_INVALID); 579 | return FALSE; 580 | } 581 | 582 | for (; iidp->OriginalFirstThunk != 0; iidp++) { 583 | 584 | PCSTR pszName = (PCHAR)RvaAdjust(pDosHeader, iidp->Name); 585 | if (pszName == NULL) { 586 | SetLastError(ERROR_EXE_MARKED_INVALID); 587 | return FALSE; 588 | } 589 | 590 | PIMAGE_THUNK_DATA pThunks = (PIMAGE_THUNK_DATA) 591 | RvaAdjust(pDosHeader, iidp->OriginalFirstThunk); 592 | PVOID * pAddrs = (PVOID *) 593 | RvaAdjust(pDosHeader, iidp->FirstThunk); 594 | 595 | HMODULE hFile = DetourGetContainingModule(pAddrs[0]); 596 | 597 | if (pfImportFile != NULL) { 598 | if (!pfImportFile(pContext, hFile, pszName)) { 599 | break; 600 | } 601 | } 602 | 603 | DWORD nNames = 0; 604 | if (pThunks) { 605 | for (; pThunks[nNames].u1.Ordinal; nNames++) { 606 | DWORD nOrdinal = 0; 607 | PCSTR pszFunc = NULL; 608 | 609 | if (IMAGE_SNAP_BY_ORDINAL(pThunks[nNames].u1.Ordinal)) { 610 | nOrdinal = (DWORD)IMAGE_ORDINAL(pThunks[nNames].u1.Ordinal); 611 | } 612 | else { 613 | pszFunc = (PCSTR)RvaAdjust(pDosHeader, 614 | (DWORD)pThunks[nNames].u1.AddressOfData + 2); 615 | } 616 | 617 | if (pfImportFunc != NULL) { 618 | if (!pfImportFunc(pContext, 619 | nOrdinal, 620 | pszFunc, 621 | &pAddrs[nNames])) { 622 | break; 623 | } 624 | } 625 | } 626 | if (pfImportFunc != NULL) { 627 | pfImportFunc(pContext, 0, NULL, NULL); 628 | } 629 | } 630 | } 631 | if (pfImportFile != NULL) { 632 | pfImportFile(pContext, NULL, NULL); 633 | } 634 | SetLastError(NO_ERROR); 635 | return TRUE; 636 | } 637 | __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? 638 | EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { 639 | SetLastError(ERROR_EXE_MARKED_INVALID); 640 | return FALSE; 641 | } 642 | } 643 | 644 | // Context for DetourEnumerateImportsThunk, which adapts "regular" callbacks for use with "Ex". 645 | struct _DETOUR_ENUMERATE_IMPORTS_THUNK_CONTEXT 646 | { 647 | PVOID pContext; 648 | PF_DETOUR_IMPORT_FUNC_CALLBACK pfImportFunc; 649 | }; 650 | 651 | // Callback for DetourEnumerateImportsEx that adapts DetourEnumerateImportsEx 652 | // for use with a DetourEnumerateImports callback -- derefence the IAT and pass the value on. 653 | 654 | static 655 | BOOL 656 | CALLBACK 657 | DetourEnumerateImportsThunk(_In_ PVOID VoidContext, 658 | _In_ DWORD nOrdinal, 659 | _In_opt_ PCSTR pszFunc, 660 | _In_opt_ PVOID* ppvFunc) 661 | { 662 | _DETOUR_ENUMERATE_IMPORTS_THUNK_CONTEXT const * const 663 | pContext = (_DETOUR_ENUMERATE_IMPORTS_THUNK_CONTEXT*)VoidContext; 664 | return pContext->pfImportFunc(pContext->pContext, nOrdinal, pszFunc, ppvFunc ? *ppvFunc : NULL); 665 | } 666 | 667 | BOOL WINAPI DetourEnumerateImports(_In_opt_ HMODULE hModule, 668 | _In_opt_ PVOID pContext, 669 | _In_opt_ PF_DETOUR_IMPORT_FILE_CALLBACK pfImportFile, 670 | _In_opt_ PF_DETOUR_IMPORT_FUNC_CALLBACK pfImportFunc) 671 | { 672 | if (pfImportFile == NULL || pfImportFunc == NULL) { 673 | SetLastError(ERROR_INVALID_PARAMETER); 674 | return FALSE; 675 | } 676 | 677 | _DETOUR_ENUMERATE_IMPORTS_THUNK_CONTEXT const context = { pContext, pfImportFunc }; 678 | 679 | return DetourEnumerateImportsEx(hModule, 680 | (PVOID)&context, 681 | pfImportFile, 682 | &DetourEnumerateImportsThunk); 683 | } 684 | 685 | static PDETOUR_LOADED_BINARY WINAPI GetPayloadSectionFromModule(HMODULE hModule) 686 | { 687 | PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)hModule; 688 | if (hModule == NULL) { 689 | pDosHeader = (PIMAGE_DOS_HEADER)GetModuleHandleW(NULL); 690 | } 691 | 692 | __try { 693 | #pragma warning(suppress:6011) // GetModuleHandleW(NULL) never returns NULL. 694 | if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) { 695 | SetLastError(ERROR_BAD_EXE_FORMAT); 696 | return NULL; 697 | } 698 | 699 | PIMAGE_NT_HEADERS pNtHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDosHeader + 700 | pDosHeader->e_lfanew); 701 | if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) { 702 | SetLastError(ERROR_INVALID_EXE_SIGNATURE); 703 | return NULL; 704 | } 705 | if (pNtHeader->FileHeader.SizeOfOptionalHeader == 0) { 706 | SetLastError(ERROR_EXE_MARKED_INVALID); 707 | return NULL; 708 | } 709 | 710 | PIMAGE_SECTION_HEADER pSectionHeaders 711 | = (PIMAGE_SECTION_HEADER)((PBYTE)pNtHeader 712 | + sizeof(pNtHeader->Signature) 713 | + sizeof(pNtHeader->FileHeader) 714 | + pNtHeader->FileHeader.SizeOfOptionalHeader); 715 | 716 | for (DWORD n = 0; n < pNtHeader->FileHeader.NumberOfSections; n++) { 717 | if (strcmp((PCHAR)pSectionHeaders[n].Name, ".detour") == 0) { 718 | if (pSectionHeaders[n].VirtualAddress == 0 || 719 | pSectionHeaders[n].SizeOfRawData == 0) { 720 | 721 | break; 722 | } 723 | 724 | PBYTE pbData = (PBYTE)pDosHeader + pSectionHeaders[n].VirtualAddress; 725 | DETOUR_SECTION_HEADER *pHeader = (DETOUR_SECTION_HEADER *)pbData; 726 | if (pHeader->cbHeaderSize < sizeof(DETOUR_SECTION_HEADER) || 727 | pHeader->nSignature != DETOUR_SECTION_HEADER_SIGNATURE) { 728 | 729 | break; 730 | } 731 | 732 | if (pHeader->nDataOffset == 0) { 733 | pHeader->nDataOffset = pHeader->cbHeaderSize; 734 | } 735 | SetLastError(NO_ERROR); 736 | return (PBYTE)pHeader; 737 | } 738 | } 739 | SetLastError(ERROR_EXE_MARKED_INVALID); 740 | return NULL; 741 | } 742 | __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? 743 | EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { 744 | SetLastError(ERROR_EXE_MARKED_INVALID); 745 | return NULL; 746 | } 747 | } 748 | 749 | DWORD WINAPI DetourGetSizeOfPayloads(_In_opt_ HMODULE hModule) 750 | { 751 | PDETOUR_LOADED_BINARY pBinary = GetPayloadSectionFromModule(hModule); 752 | if (pBinary == NULL) { 753 | // Error set by GetPayloadSectionFromModule. 754 | return 0; 755 | } 756 | 757 | __try { 758 | DETOUR_SECTION_HEADER *pHeader = (DETOUR_SECTION_HEADER *)pBinary; 759 | if (pHeader->cbHeaderSize < sizeof(DETOUR_SECTION_HEADER) || 760 | pHeader->nSignature != DETOUR_SECTION_HEADER_SIGNATURE) { 761 | 762 | SetLastError(ERROR_INVALID_HANDLE); 763 | return 0; 764 | } 765 | SetLastError(NO_ERROR); 766 | return pHeader->cbDataSize; 767 | } 768 | __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? 769 | EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { 770 | SetLastError(ERROR_INVALID_HANDLE); 771 | return 0; 772 | } 773 | } 774 | 775 | _Writable_bytes_(*pcbData) 776 | _Readable_bytes_(*pcbData) 777 | _Success_(return != NULL) 778 | PVOID WINAPI DetourFindPayload(_In_opt_ HMODULE hModule, 779 | _In_ REFGUID rguid, 780 | _Out_opt_ DWORD *pcbData) 781 | { 782 | PBYTE pbData = NULL; 783 | if (pcbData) { 784 | *pcbData = 0; 785 | } 786 | 787 | PDETOUR_LOADED_BINARY pBinary = GetPayloadSectionFromModule(hModule); 788 | if (pBinary == NULL) { 789 | // Error set by GetPayloadSectionFromModule. 790 | return NULL; 791 | } 792 | 793 | __try { 794 | DETOUR_SECTION_HEADER *pHeader = (DETOUR_SECTION_HEADER *)pBinary; 795 | if (pHeader->cbHeaderSize < sizeof(DETOUR_SECTION_HEADER) || 796 | pHeader->nSignature != DETOUR_SECTION_HEADER_SIGNATURE) { 797 | 798 | SetLastError(ERROR_INVALID_EXE_SIGNATURE); 799 | return NULL; 800 | } 801 | 802 | PBYTE pbBeg = ((PBYTE)pHeader) + pHeader->nDataOffset; 803 | PBYTE pbEnd = ((PBYTE)pHeader) + pHeader->cbDataSize; 804 | 805 | for (pbData = pbBeg; pbData < pbEnd;) { 806 | DETOUR_SECTION_RECORD *pSection = (DETOUR_SECTION_RECORD *)pbData; 807 | 808 | if (DetourAreSameGuid(pSection->guid, rguid)) { 809 | if (pcbData) { 810 | *pcbData = pSection->cbBytes - sizeof(*pSection); 811 | } 812 | SetLastError(NO_ERROR); 813 | return (PBYTE)(pSection + 1); 814 | } 815 | 816 | pbData = (PBYTE)pSection + pSection->cbBytes; 817 | } 818 | SetLastError(ERROR_INVALID_HANDLE); 819 | return NULL; 820 | } 821 | __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? 822 | EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { 823 | SetLastError(ERROR_INVALID_HANDLE); 824 | return NULL; 825 | } 826 | } 827 | 828 | _Writable_bytes_(*pcbData) 829 | _Readable_bytes_(*pcbData) 830 | _Success_(return != NULL) 831 | PVOID WINAPI DetourFindPayloadEx(_In_ REFGUID rguid, 832 | _Out_opt_ DWORD *pcbData) 833 | { 834 | for (HMODULE hMod = NULL; (hMod = DetourEnumerateModules(hMod)) != NULL;) { 835 | PVOID pvData; 836 | 837 | pvData = DetourFindPayload(hMod, rguid, pcbData); 838 | if (pvData != NULL) { 839 | return pvData; 840 | } 841 | } 842 | SetLastError(ERROR_MOD_NOT_FOUND); 843 | return NULL; 844 | } 845 | 846 | BOOL WINAPI DetourFreePayload(_In_ PVOID pvData) 847 | { 848 | BOOL fSucceeded = FALSE; 849 | 850 | // If you have any doubts about the following code, please refer to the comments in DetourCopyPayloadToProcess. 851 | HMODULE hModule = DetourGetContainingModule(pvData); 852 | DETOUR_ASSERT(hModule != NULL); 853 | if (hModule != NULL) { 854 | fSucceeded = VirtualFree(hModule, 0, MEM_RELEASE); 855 | DETOUR_ASSERT(fSucceeded); 856 | if (fSucceeded) { 857 | hModule = NULL; 858 | } 859 | } 860 | 861 | return fSucceeded; 862 | } 863 | 864 | BOOL WINAPI DetourRestoreAfterWithEx(_In_reads_bytes_(cbData) PVOID pvData, 865 | _In_ DWORD cbData) 866 | { 867 | PDETOUR_EXE_RESTORE pder = (PDETOUR_EXE_RESTORE)pvData; 868 | 869 | if (pder->cb != sizeof(*pder) || pder->cb > cbData) { 870 | SetLastError(ERROR_BAD_EXE_FORMAT); 871 | return FALSE; 872 | } 873 | 874 | DWORD dwPermIdh = ~0u; 875 | DWORD dwPermInh = ~0u; 876 | DWORD dwPermClr = ~0u; 877 | DWORD dwIgnore; 878 | BOOL fSucceeded = FALSE; 879 | BOOL fUpdated32To64 = FALSE; 880 | 881 | if (pder->pclr != NULL && pder->clr.Flags != ((PDETOUR_CLR_HEADER)pder->pclr)->Flags) { 882 | // If we had to promote the 32/64-bit agnostic IL to 64-bit, we can't restore 883 | // that. 884 | fUpdated32To64 = TRUE; 885 | } 886 | 887 | if (DetourVirtualProtectSameExecute(pder->pidh, pder->cbidh, 888 | PAGE_EXECUTE_READWRITE, &dwPermIdh)) { 889 | if (DetourVirtualProtectSameExecute(pder->pinh, pder->cbinh, 890 | PAGE_EXECUTE_READWRITE, &dwPermInh)) { 891 | 892 | CopyMemory(pder->pidh, &pder->idh, pder->cbidh); 893 | CopyMemory(pder->pinh, &pder->inh, pder->cbinh); 894 | 895 | if (pder->pclr != NULL && !fUpdated32To64) { 896 | if (DetourVirtualProtectSameExecute(pder->pclr, pder->cbclr, 897 | PAGE_EXECUTE_READWRITE, &dwPermClr)) { 898 | CopyMemory(pder->pclr, &pder->clr, pder->cbclr); 899 | VirtualProtect(pder->pclr, pder->cbclr, dwPermClr, &dwIgnore); 900 | fSucceeded = TRUE; 901 | } 902 | } 903 | else { 904 | fSucceeded = TRUE; 905 | } 906 | VirtualProtect(pder->pinh, pder->cbinh, dwPermInh, &dwIgnore); 907 | } 908 | VirtualProtect(pder->pidh, pder->cbidh, dwPermIdh, &dwIgnore); 909 | } 910 | // Delete the payload after successful recovery to prevent repeated restore 911 | if (fSucceeded) { 912 | DetourFreePayload(pder); 913 | pder = NULL; 914 | } 915 | return fSucceeded; 916 | } 917 | 918 | BOOL WINAPI DetourRestoreAfterWith() 919 | { 920 | PVOID pvData; 921 | DWORD cbData; 922 | 923 | pvData = DetourFindPayloadEx(DETOUR_EXE_RESTORE_GUID, &cbData); 924 | 925 | if (pvData != NULL && cbData != 0) { 926 | return DetourRestoreAfterWithEx(pvData, cbData); 927 | } 928 | SetLastError(ERROR_MOD_NOT_FOUND); 929 | return FALSE; 930 | } 931 | 932 | // End of File 933 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/Detours/uimports.cpp: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Add DLLs to a module import table (uimports.cpp of detours.lib) 4 | // 5 | // Microsoft Research Detours Package, Version 4.0.1 6 | // 7 | // Copyright (c) Microsoft Corporation. All rights reserved. 8 | // 9 | // Note that this file is included into creatwth.cpp one or more times 10 | // (once for each supported module format). 11 | // 12 | 13 | #if DETOURS_VERSION != 0x4c0c1 // 0xMAJORcMINORcPATCH 14 | #error detours.h version mismatch 15 | #endif 16 | 17 | // UpdateImports32 aka UpdateImports64 18 | static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess, 19 | HMODULE hModule, 20 | __in_ecount(nDlls) LPCSTR *plpDlls, 21 | DWORD nDlls) 22 | { 23 | BOOL fSucceeded = FALSE; 24 | DWORD cbNew = 0; 25 | 26 | BYTE * pbNew = NULL; 27 | DWORD i; 28 | SIZE_T cbRead; 29 | DWORD n; 30 | 31 | PBYTE pbModule = (PBYTE)hModule; 32 | 33 | IMAGE_DOS_HEADER idh; 34 | ZeroMemory(&idh, sizeof(idh)); 35 | if (!ReadProcessMemory(hProcess, pbModule, &idh, sizeof(idh), &cbRead) 36 | || cbRead < sizeof(idh)) { 37 | 38 | DETOUR_TRACE(("ReadProcessMemory(idh@%p..%p) failed: %lu\n", 39 | pbModule, pbModule + sizeof(idh), GetLastError())); 40 | 41 | finish: 42 | if (pbNew != NULL) { 43 | delete[] pbNew; 44 | pbNew = NULL; 45 | } 46 | return fSucceeded; 47 | } 48 | 49 | IMAGE_NT_HEADERS_XX inh; 50 | ZeroMemory(&inh, sizeof(inh)); 51 | 52 | if (!ReadProcessMemory(hProcess, pbModule + idh.e_lfanew, &inh, sizeof(inh), &cbRead) 53 | || cbRead < sizeof(inh)) { 54 | DETOUR_TRACE(("ReadProcessMemory(inh@%p..%p) failed: %lu\n", 55 | pbModule + idh.e_lfanew, 56 | pbModule + idh.e_lfanew + sizeof(inh), 57 | GetLastError())); 58 | goto finish; 59 | } 60 | 61 | if (inh.OptionalHeader.Magic != IMAGE_NT_OPTIONAL_HDR_MAGIC_XX) { 62 | DETOUR_TRACE(("Wrong size image (%04x != %04x).\n", 63 | inh.OptionalHeader.Magic, IMAGE_NT_OPTIONAL_HDR_MAGIC_XX)); 64 | SetLastError(ERROR_INVALID_BLOCK); 65 | goto finish; 66 | } 67 | 68 | // Zero out the bound table so loader doesn't use it instead of our new table. 69 | inh.BOUND_DIRECTORY.VirtualAddress = 0; 70 | inh.BOUND_DIRECTORY.Size = 0; 71 | 72 | // Find the size of the mapped file. 73 | DWORD dwSec = idh.e_lfanew + 74 | FIELD_OFFSET(IMAGE_NT_HEADERS_XX, OptionalHeader) + 75 | inh.FileHeader.SizeOfOptionalHeader; 76 | 77 | for (i = 0; i < inh.FileHeader.NumberOfSections; i++) { 78 | IMAGE_SECTION_HEADER ish; 79 | ZeroMemory(&ish, sizeof(ish)); 80 | 81 | if (!ReadProcessMemory(hProcess, pbModule + dwSec + sizeof(ish) * i, &ish, 82 | sizeof(ish), &cbRead) 83 | || cbRead < sizeof(ish)) { 84 | 85 | DETOUR_TRACE(("ReadProcessMemory(ish@%p..%p) failed: %lu\n", 86 | pbModule + dwSec + sizeof(ish) * i, 87 | pbModule + dwSec + sizeof(ish) * (i + 1), 88 | GetLastError())); 89 | goto finish; 90 | } 91 | 92 | DETOUR_TRACE(("ish[%lu] : va=%08lx sr=%lu\n", i, ish.VirtualAddress, ish.SizeOfRawData)); 93 | 94 | // If the linker didn't suggest an IAT in the data directories, the 95 | // loader will look for the section of the import directory to be used 96 | // for this instead. Since we put out new IMPORT_DIRECTORY outside any 97 | // section boundary, the loader will not find it. So we provide one 98 | // explicitly to avoid the search. 99 | // 100 | if (inh.IAT_DIRECTORY.VirtualAddress == 0 && 101 | inh.IMPORT_DIRECTORY.VirtualAddress >= ish.VirtualAddress && 102 | inh.IMPORT_DIRECTORY.VirtualAddress < ish.VirtualAddress + ish.SizeOfRawData) { 103 | 104 | inh.IAT_DIRECTORY.VirtualAddress = ish.VirtualAddress; 105 | inh.IAT_DIRECTORY.Size = ish.SizeOfRawData; 106 | } 107 | } 108 | 109 | if (inh.IMPORT_DIRECTORY.VirtualAddress != 0 && inh.IMPORT_DIRECTORY.Size == 0) { 110 | 111 | // Don't worry about changing the PE file, 112 | // because the load information of the original PE header has been saved and will be restored. 113 | // The change here is just for the following code to work normally 114 | 115 | PIMAGE_IMPORT_DESCRIPTOR pImageImport = (PIMAGE_IMPORT_DESCRIPTOR)(pbModule + inh.IMPORT_DIRECTORY.VirtualAddress); 116 | 117 | do { 118 | IMAGE_IMPORT_DESCRIPTOR ImageImport; 119 | if (!ReadProcessMemory(hProcess, pImageImport, &ImageImport, sizeof(ImageImport), NULL)) { 120 | DETOUR_TRACE(("ReadProcessMemory failed: %lu\n", GetLastError())); 121 | goto finish; 122 | } 123 | inh.IMPORT_DIRECTORY.Size += sizeof(IMAGE_IMPORT_DESCRIPTOR); 124 | if (!ImageImport.Name) { 125 | break; 126 | } 127 | ++pImageImport; 128 | } while (TRUE); 129 | 130 | DWORD dwLastError = GetLastError(); 131 | OutputDebugString(TEXT("[This PE file has an import table, but the import table size is marked as 0. This is an error.") 132 | TEXT("If it is not repaired, the launched program will not work properly, Detours has automatically repaired its import table size for you! ! !]\r\n")); 133 | if (GetLastError() != dwLastError) { 134 | SetLastError(dwLastError); 135 | } 136 | } 137 | 138 | DETOUR_TRACE((" Imports: %p..%p\n", 139 | pbModule + inh.IMPORT_DIRECTORY.VirtualAddress, 140 | pbModule + inh.IMPORT_DIRECTORY.VirtualAddress + 141 | inh.IMPORT_DIRECTORY.Size)); 142 | 143 | // Calculate new import directory size. Note that since inh is from another 144 | // process, inh could have been corrupted. We need to protect against 145 | // integer overflow in allocation calculations. 146 | DWORD nOldDlls = inh.IMPORT_DIRECTORY.Size / sizeof(IMAGE_IMPORT_DESCRIPTOR); 147 | DWORD obRem; 148 | if (DWordMult(sizeof(IMAGE_IMPORT_DESCRIPTOR), nDlls, &obRem) != S_OK) { 149 | DETOUR_TRACE(("too many new DLLs.\n")); 150 | goto finish; 151 | } 152 | DWORD obOld; 153 | if (DWordAdd(obRem, sizeof(IMAGE_IMPORT_DESCRIPTOR) * nOldDlls, &obOld) != S_OK) { 154 | DETOUR_TRACE(("DLL entries overflow.\n")); 155 | goto finish; 156 | } 157 | DWORD obTab = PadToDwordPtr(obOld); 158 | // Check for integer overflow. 159 | if (obTab < obOld) { 160 | DETOUR_TRACE(("DLL entries padding overflow.\n")); 161 | goto finish; 162 | } 163 | DWORD stSize; 164 | if (DWordMult(sizeof(DWORD_XX) * 4, nDlls, &stSize) != S_OK) { 165 | DETOUR_TRACE(("String table overflow.\n")); 166 | goto finish; 167 | } 168 | DWORD obDll; 169 | if (DWordAdd(obTab, stSize, &obDll) != S_OK) { 170 | DETOUR_TRACE(("Import table size overflow\n")); 171 | goto finish; 172 | } 173 | DWORD obStr = obDll; 174 | cbNew = obStr; 175 | for (n = 0; n < nDlls; n++) { 176 | if (DWordAdd(cbNew, PadToDword((DWORD)strlen(plpDlls[n]) + 1), &cbNew) != S_OK) { 177 | DETOUR_TRACE(("Overflow adding string table entry\n")); 178 | goto finish; 179 | } 180 | } 181 | pbNew = new BYTE [cbNew]; 182 | if (pbNew == NULL) { 183 | DETOUR_TRACE(("new BYTE [cbNew] failed.\n")); 184 | goto finish; 185 | } 186 | ZeroMemory(pbNew, cbNew); 187 | 188 | PBYTE pbBase = pbModule; 189 | PBYTE pbNext = pbBase 190 | + inh.OptionalHeader.BaseOfCode 191 | + inh.OptionalHeader.SizeOfCode 192 | + inh.OptionalHeader.SizeOfInitializedData 193 | + inh.OptionalHeader.SizeOfUninitializedData; 194 | if (pbBase < pbNext) { 195 | pbBase = pbNext; 196 | } 197 | DETOUR_TRACE(("pbBase = %p\n", pbBase)); 198 | 199 | PBYTE pbNewIid = FindAndAllocateNearBase(hProcess, pbModule, pbBase, cbNew); 200 | if (pbNewIid == NULL) { 201 | DETOUR_TRACE(("FindAndAllocateNearBase failed.\n")); 202 | goto finish; 203 | } 204 | 205 | PIMAGE_IMPORT_DESCRIPTOR piid = (PIMAGE_IMPORT_DESCRIPTOR)pbNew; 206 | IMAGE_THUNK_DATAXX *pt = NULL; 207 | 208 | DWORD obBase = (DWORD)(pbNewIid - pbModule); 209 | DWORD dwProtect = 0; 210 | 211 | if (inh.IMPORT_DIRECTORY.VirtualAddress != 0) { 212 | // Read the old import directory if it exists. 213 | DETOUR_TRACE(("IMPORT_DIRECTORY perms=%lx\n", dwProtect)); 214 | 215 | if (!ReadProcessMemory(hProcess, 216 | pbModule + inh.IMPORT_DIRECTORY.VirtualAddress, 217 | &piid[nDlls], 218 | nOldDlls * sizeof(IMAGE_IMPORT_DESCRIPTOR), &cbRead) 219 | || cbRead < nOldDlls * sizeof(IMAGE_IMPORT_DESCRIPTOR)) { 220 | 221 | DETOUR_TRACE(("ReadProcessMemory(imports) failed: %lu\n", GetLastError())); 222 | goto finish; 223 | } 224 | } 225 | 226 | for (n = 0; n < nDlls; n++) { 227 | HRESULT hrRet = StringCchCopyA((char*)pbNew + obStr, cbNew - obStr, plpDlls[n]); 228 | if (FAILED(hrRet)) { 229 | DETOUR_TRACE(("StringCchCopyA failed: %08lx\n", hrRet)); 230 | goto finish; 231 | } 232 | 233 | // After copying the string, we patch up the size "??" bits if any. 234 | hrRet = ReplaceOptionalSizeA((char*)pbNew + obStr, 235 | cbNew - obStr, 236 | DETOURS_STRINGIFY(DETOURS_BITS_XX)); 237 | if (FAILED(hrRet)) { 238 | DETOUR_TRACE(("ReplaceOptionalSizeA failed: %08lx\n", hrRet)); 239 | goto finish; 240 | } 241 | 242 | DWORD nOffset = obTab + (sizeof(IMAGE_THUNK_DATAXX) * (4 * n)); 243 | piid[n].OriginalFirstThunk = obBase + nOffset; 244 | 245 | // We need 2 thunks for the import table and 2 thunks for the IAT. 246 | // One for an ordinal import and one to mark the end of the list. 247 | pt = ((IMAGE_THUNK_DATAXX*)(pbNew + nOffset)); 248 | pt[0].u1.Ordinal = IMAGE_ORDINAL_FLAG_XX + 1; 249 | pt[1].u1.Ordinal = 0; 250 | 251 | nOffset = obTab + (sizeof(IMAGE_THUNK_DATAXX) * ((4 * n) + 2)); 252 | piid[n].FirstThunk = obBase + nOffset; 253 | pt = ((IMAGE_THUNK_DATAXX*)(pbNew + nOffset)); 254 | pt[0].u1.Ordinal = IMAGE_ORDINAL_FLAG_XX + 1; 255 | pt[1].u1.Ordinal = 0; 256 | piid[n].TimeDateStamp = 0; 257 | piid[n].ForwarderChain = 0; 258 | piid[n].Name = obBase + obStr; 259 | 260 | obStr += PadToDword((DWORD)strlen(plpDlls[n]) + 1); 261 | } 262 | _Analysis_assume_(obStr <= cbNew); 263 | 264 | #if 0 265 | for (i = 0; i < nDlls + nOldDlls; i++) { 266 | DETOUR_TRACE(("%8d. Look=%08x Time=%08x Fore=%08x Name=%08x Addr=%08x\n", 267 | i, 268 | piid[i].OriginalFirstThunk, 269 | piid[i].TimeDateStamp, 270 | piid[i].ForwarderChain, 271 | piid[i].Name, 272 | piid[i].FirstThunk)); 273 | if (piid[i].OriginalFirstThunk == 0 && piid[i].FirstThunk == 0) { 274 | break; 275 | } 276 | } 277 | #endif 278 | 279 | if (!WriteProcessMemory(hProcess, pbNewIid, pbNew, obStr, NULL)) { 280 | DETOUR_TRACE(("WriteProcessMemory(iid) failed: %lu\n", GetLastError())); 281 | goto finish; 282 | } 283 | 284 | DETOUR_TRACE(("obBaseBef = %08lx..%08lx\n", 285 | inh.IMPORT_DIRECTORY.VirtualAddress, 286 | inh.IMPORT_DIRECTORY.VirtualAddress + inh.IMPORT_DIRECTORY.Size)); 287 | DETOUR_TRACE(("obBaseAft = %08lx..%08lx\n", obBase, obBase + obStr)); 288 | 289 | // In this case the file didn't have an import directory in first place, 290 | // so we couldn't fix the missing IAT above. We still need to explicitly 291 | // provide an IAT to prevent to loader from looking for one. 292 | // 293 | if (inh.IAT_DIRECTORY.VirtualAddress == 0) { 294 | inh.IAT_DIRECTORY.VirtualAddress = obBase; 295 | inh.IAT_DIRECTORY.Size = cbNew; 296 | } 297 | 298 | inh.IMPORT_DIRECTORY.VirtualAddress = obBase; 299 | inh.IMPORT_DIRECTORY.Size = cbNew; 300 | 301 | /////////////////////// Update the NT header for the new import directory. 302 | // 303 | if (!DetourVirtualProtectSameExecuteEx(hProcess, pbModule, inh.OptionalHeader.SizeOfHeaders, 304 | PAGE_EXECUTE_READWRITE, &dwProtect)) { 305 | DETOUR_TRACE(("VirtualProtectEx(inh) write failed: %lu\n", GetLastError())); 306 | goto finish; 307 | } 308 | 309 | inh.OptionalHeader.CheckSum = 0; 310 | 311 | if (!WriteProcessMemory(hProcess, pbModule, &idh, sizeof(idh), NULL)) { 312 | DETOUR_TRACE(("WriteProcessMemory(idh) failed: %lu\n", GetLastError())); 313 | goto finish; 314 | } 315 | DETOUR_TRACE(("WriteProcessMemory(idh:%p..%p)\n", pbModule, pbModule + sizeof(idh))); 316 | 317 | if (!WriteProcessMemory(hProcess, pbModule + idh.e_lfanew, &inh, sizeof(inh), NULL)) { 318 | DETOUR_TRACE(("WriteProcessMemory(inh) failed: %lu\n", GetLastError())); 319 | goto finish; 320 | } 321 | DETOUR_TRACE(("WriteProcessMemory(inh:%p..%p)\n", 322 | pbModule + idh.e_lfanew, 323 | pbModule + idh.e_lfanew + sizeof(inh))); 324 | 325 | if (!VirtualProtectEx(hProcess, pbModule, inh.OptionalHeader.SizeOfHeaders, 326 | dwProtect, &dwProtect)) { 327 | DETOUR_TRACE(("VirtualProtectEx(idh) restore failed: %lu\n", GetLastError())); 328 | goto finish; 329 | } 330 | 331 | fSucceeded = TRUE; 332 | goto finish; 333 | } 334 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/EdenPMHook.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.5.33424.131 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EdenPMHook", "EdenPMHook\EdenPMHook.vcxproj", "{65661795-3454-4864-8DB5-DC5F1BEEEFB2}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {65661795-3454-4864-8DB5-DC5F1BEEEFB2}.Debug|x64.ActiveCfg = Debug|x64 17 | {65661795-3454-4864-8DB5-DC5F1BEEEFB2}.Debug|x64.Build.0 = Debug|x64 18 | {65661795-3454-4864-8DB5-DC5F1BEEEFB2}.Debug|x86.ActiveCfg = Debug|Win32 19 | {65661795-3454-4864-8DB5-DC5F1BEEEFB2}.Debug|x86.Build.0 = Debug|Win32 20 | {65661795-3454-4864-8DB5-DC5F1BEEEFB2}.Release|x64.ActiveCfg = Release|x64 21 | {65661795-3454-4864-8DB5-DC5F1BEEEFB2}.Release|x64.Build.0 = Release|x64 22 | {65661795-3454-4864-8DB5-DC5F1BEEEFB2}.Release|x86.ActiveCfg = Release|Win32 23 | {65661795-3454-4864-8DB5-DC5F1BEEEFB2}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {6D7FFF93-A3BF-4A3B-A8B1-A47D03F96966} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/EdenPMHook/EdenPMHook.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {65661795-3454-4864-8db5-dc5f1beeefb2} 25 | EdenPMHook 26 | 10.0 27 | 28 | 29 | 30 | DynamicLibrary 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | DynamicLibrary 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | DynamicLibrary 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | DynamicLibrary 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | true 77 | WIN32;_DEBUG;EDENPMHOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 78 | true 79 | NotUsing 80 | pch.h 81 | $(SolutionDir)Detours 82 | 83 | 84 | Windows 85 | true 86 | false 87 | 88 | 89 | 90 | 91 | Level3 92 | true 93 | true 94 | true 95 | WIN32;NDEBUG;EDENPMHOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 96 | true 97 | NotUsing 98 | pch.h 99 | $(SolutionDir)Detours;%(AdditionalIncludeDirectories) 100 | 101 | 102 | Windows 103 | true 104 | true 105 | true 106 | false 107 | 108 | 109 | 110 | 111 | Level3 112 | true 113 | _DEBUG;EDENPMHOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 114 | true 115 | Use 116 | pch.h 117 | 118 | 119 | Windows 120 | true 121 | false 122 | 123 | 124 | 125 | 126 | Level3 127 | true 128 | true 129 | true 130 | NDEBUG;EDENPMHOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 131 | true 132 | Use 133 | pch.h 134 | 135 | 136 | Windows 137 | true 138 | true 139 | true 140 | false 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/EdenPMHook/EdenPMHook.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 10 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 11 | 12 | 13 | {c752578e-d748-44de-86be-ef3abb4a54c0} 14 | 15 | 16 | {3bf2c788-f34c-4505-a41a-dbbf2cceccd2} 17 | 18 | 19 | 20 | 21 | Source Files 22 | 23 | 24 | Detours 25 | 26 | 27 | Detours 28 | 29 | 30 | Detours 31 | 32 | 33 | Detours 34 | 35 | 36 | Detours 37 | 38 | 39 | Tools 40 | 41 | 42 | 43 | 44 | Detours 45 | 46 | 47 | Tools 48 | 49 | 50 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/EdenPMHook/EdenPMHook.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/EdenPMHook/Tools.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/eden_pm_en/EdenPMHook/EdenPMHook/Tools.cpp -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/EdenPMHook/Tools.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "detours.h" 4 | 5 | #define Hook_CreateFontA_Func 6 | 7 | 8 | BOOL WriteMemory(LPVOID lpAddress, LPCVOID lpBuffer, SIZE_T nSize); 9 | BOOL WriteHookCode(DWORD dwRawAddress, DWORD dwNewAddress, SIZE_T szHookCode); 10 | BOOL HookCreateFontA(DWORD dwCharSet, LPCSTR lpFontName); -------------------------------------------------------------------------------- /其它/eden_pm_en/EdenPMHook/EdenPMHook/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include "Tools.h" 2 | 3 | 4 | DWORD g_dwExeBase = (DWORD)GetModuleHandleW(NULL); 5 | 6 | 7 | DWORD g_dwReadChar = 0x0050F227; 8 | DWORD g_dwRetAddre = g_dwReadChar + 0x6; 9 | VOID __declspec(naked) ProcDBCS_0() 10 | { 11 | _asm 12 | { 13 | movzx esi, byte ptr[eax]; 14 | cmp esi, 0x81; 15 | jb not_DBCS; 16 | 17 | //is_DBCS 18 | movzx esi, word ptr[eax]; 19 | inc eax; 20 | 21 | not_DBCS: 22 | mov dword ptr[ebp - 0x10], esi; 23 | jmp g_dwRetAddre; 24 | } 25 | } 26 | 27 | VOID StartHook() 28 | { 29 | //Step1: 30 | //Hook CreateFontA 替换字体和字符集 31 | HookCreateFontA(0x86, "黑体"); 32 | 33 | //Step2: 34 | //0050F227 | 0FB630 | movzx esi, byte ptr ds : [eax] | eax为指向当前脚本字符的指针,随着读取的字符数移动 35 | //0050F22A | 8975 F0 | mov dword ptr ss : [ebp - 10] , esi | 什么的代码将读取一个字节,即单字节到esi,此处把读取的数据放到ebp-10处 36 | //0050F22D | 85F6 | test esi, esi | 判断esi是否为0,即空字符 37 | //0050F22F | 0F84 4C050000 | je eden_pm_en.50F781 | 为0则跳出处理 38 | //0050F235 | 40 | inc eax | 不为0则表示正常读取,并给eax加一,即指向脚本中下一个字节 39 | // 40 | // 所以我们Hook这个位置,判断eax读到esi的一个字节是否大于等于0x81,如果是则认为这个是属于DBCS(GBK,SJIS)即是双字节组成一个字符的,那么读取两个字节放到esi中 41 | // 如果是小于0x81的那么说明是单字节组成一个字符的,比如英文字母阿拉伯数字这种,按照正常逻辑读取就行了。 42 | // 这得注意的是eax如果判断为当前读取的字符是双字节得再加1才行。 43 | // 44 | //HooK读取脚本字符串 始终单字节读取 转为 判断单双字节读取 45 | WriteHookCode(g_dwReadChar, (DWORD)ProcDBCS_0, 0x6); 46 | 47 | //Step3: 48 | //00568DEC 人物名 括号 49 | // 50 | //00598720 人物名 英日对照 表 [存储游戏所有 英文人物名 对应的 日文人物名] 51 | //004B7530 人物名 英日对照 初始化函数 [用于初始化遍历人物名表] 52 | // 53 | //005D0C08 人物名 英日对照 缓冲区 [存储当前读取到的 英文人物名 对应的 日文人物名] 54 | //004B7340 人物名 对比对照 处理函数 [用于显示文字过程中对比当前 英文人物名 找出 日文人物名] 55 | // 56 | //人物名括号修正 英文版本用的一种单字节字符集拓展,会大于7F,游戏的括号两个分别是0xAB,0xBB均超出了0x7F 57 | //一般我们只判断单字节是否大于0x81,如果是则认为是DBCS,如果游戏保持这种括号,那么单双字节读取判断会混乱。 58 | //所以这里我们把 0xAB ,0xBB这种单字节的括号改成中文的 【】 让其符合DBCS逻辑,防止单双字节判断混乱。 59 | static BYTE aCharacterName0[] = { 0x20,0xA1,0xBF }; 60 | static BYTE aCharacterName1[] = { 0xA1,0xBE,0x20 }; 61 | WriteMemory((LPVOID)(g_dwExeBase + 0x168DF4), aCharacterName0, sizeof(aCharacterName0)); 62 | WriteMemory((LPVOID)(g_dwExeBase + 0x168DF8), aCharacterName1, sizeof(aCharacterName1)); 63 | 64 | //此处Path人物名 ,在人物名 英日对照 表 里可以找到地址 65 | UCHAR** pTable = (UCHAR**)(g_dwExeBase + 0x198720); 66 | //00 "Elica" -> 艾丽卡 67 | //01 "エリカ" 68 | //02 "General" -> 总部部长 69 | //03 "本部長" 70 | //04 "Inaba" -> 稻叶 71 | //05 "稲葉" 72 | //06 "Lavie" -> 拉维 73 | //07 "ラヴィ" 74 | //08 "Maya" -> 真夜 75 | //09 "真夜" 76 | //10 "Natsume" -> 夏目 77 | //11 "ナツメ" 78 | //12 "Ryou" -> 亮 79 | //13 "亮" 80 | //14 "Sion" -> 诗音 81 | //15 "シオン" 82 | //16 "Soldier" -> 士兵 83 | //17 "兵士" 84 | static UCHAR aElica[] = { 0xB0, 0xAC, 0xC0, 0xF6, 0xBF, 0xA8, 0x00 }; 85 | pTable[0] = aElica; 86 | 87 | static UCHAR aGeneral[] = { 0xD7, 0xDC, 0xB2, 0xBF, 0xB2, 0xBF, 0xB3, 0xA4, 0x00 }; 88 | pTable[2] = aGeneral; 89 | 90 | static UCHAR aInaba[] = { 0xB5, 0xBE, 0xD2, 0xB6, 0x0 }; 91 | pTable[4] = aInaba; 92 | 93 | static UCHAR aLavie[] = { 0xC0, 0xAD, 0xCE, 0xAC,0x00 }; 94 | pTable[6] = aLavie; 95 | 96 | static UCHAR aMaya[] = { 0xD5, 0xE6, 0xD2, 0xB9, 0x00 }; 97 | pTable[8] = aMaya; 98 | 99 | static UCHAR aNatsume[] = { 0xCF, 0xC4, 0xC4, 0xBF, 0x00 }; 100 | pTable[10] = aNatsume; 101 | 102 | static UCHAR aRyou[] = { 0xC1, 0xC1, 0x00 }; 103 | pTable[12] = aRyou; 104 | 105 | static UCHAR aSion[] = { 0xCA, 0xAB, 0xD2, 0xF4, 0x00 }; 106 | pTable[14] = aSion; 107 | 108 | static UCHAR aSoldier[] = { 0xCA, 0xBF, 0xB1, 0xF8, 0x00 }; 109 | pTable[16] = aSoldier; 110 | 111 | //Step4: 112 | //0050F084 113 | //004C293D 114 | //处理常见的0x81 0x9F 0xE0边界 115 | static BYTE aSJISRange[] = { 0xFE }; 116 | WriteMemory((LPVOID)(g_dwExeBase + 0xC293F), aSJISRange, sizeof(aSJISRange)); 117 | WriteMemory((LPVOID)(g_dwExeBase + 0x10F08E), aSJISRange, sizeof(aSJISRange)); 118 | WriteMemory((LPVOID)(g_dwExeBase + 0x10F09E), aSJISRange, sizeof(aSJISRange)); 119 | 120 | //Step5: 121 | //004C2971 122 | //此处为游戏脚本的初始化过滤,这个步骤发生在游戏读取脚本打印之前,可以理解为脚本的预处理 123 | //这个步骤进行了一些字符串的替换,比如这个游戏的脚本里虽然对话都是英文,但是有一部分日文的标点符号 124 | //比如双引号,游戏脚本里其实还是日文的,但是显示出来就成了正常的双引号,这个原因是游戏在脚本预处理阶段 125 | //把这些日文的双引号替换掉了。 126 | //游戏替换的逻辑是,如果定义了 A 替换为 B 输入的是 A 则替换成 B 127 | //如果输入的是双字节字符,但是并没有预定义该字符应该替换成什么,那么游戏就会统一把该双字节字符替换成单字节0xB6 128 | //其实游戏里把日文的符号替换也是从双字节改成单字节,比如0x8168改成0x94 129 | //此处为防止游戏把没有预定义的双字节字符替换成0xB6 130 | static BYTE aProcDBCS_1_ASM[] = { 0x66, 0x89, 0x5D, 0x0C, 0x90, 0x90, 0x90 }; 131 | WriteMemory((LPVOID)(g_dwExeBase + 0xC2971), aProcDBCS_1_ASM, sizeof(aProcDBCS_1_ASM)); 132 | 133 | //004C299B 134 | //替换MAP一些符号,比如把日文的引号MAP成0x91,0x92最后在MultiByteToWideChar之前替换回来 135 | //游戏会把一些日文的双字节标点符号给替换成单字节的,并在MultiByteToWideChar之前替换为Unicode编码的字符 136 | //这个游戏最终输出是通过MultiByteToWideChar转换成宽字节调用GetGlyphOutlineW输出的 137 | //Patch把日文的标点符号转换成GBK的 138 | static BYTE aMapCharASM[] = 139 | { 140 | 0x3D, 0x65, 0x81, 0x00, 0x00, // cmp eax,8165 --> ‘ SJIS 141 | 0x75, 0x07, // jne eden_pm_en.4C29A9 142 | 0xBB, 0xA1, 0xAE, 0x00, 0x00, // mov ebx,AEA1 --> ‘ GBK 143 | 0xEB, 0xC8, // jmp eden_pm_en.4C2971 144 | 0x3D, 0x66, 0x81, 0x00, 0x00, // cmp eax,8166 --> ’ SJIS 145 | 0x75, 0x07, // jne eden_pm_en.4C29B7 146 | 0xBB, 0xA1, 0xAF, 0x00, 0x00, // mov ebx,AFA1 --> ’ GBK 147 | 0xEB, 0xBA, // jmp eden_pm_en.4C2971 148 | 149 | 0x3D, 0x67, 0x81, 0x00, 0x00, // cmp eax,8167 --> “ SJIS 150 | 0x75, 0x07, // jne eden_pm_en.4C29C5 151 | 0xBB, 0xA1, 0xBA, 0x00, 0x00, // mov ebx,BAA1 --> 『 GBK 152 | 0xEB, 0xAC, // jmp eden_pm_en.4C2971 153 | 0x3D, 0x68, 0x81, 0x00, 0x00, // cmp eax,8168 --> ” SJIS 154 | 0x75, 0x07, // jne eden_pm_en.4C29D3 155 | 0xBB, 0xA1, 0xBB, 0x00, 0x00, // mov ebx,BBA1 --> 』 GBK 156 | 0xEB, 0x9E, // jmp eden_pm_en.4C2971 157 | 158 | 0x3D, 0x5C, 0x81, 0x00, 0x00, // cmp eax,815C --> ― SJIS 159 | 0x75, 0x07, // jne eden_pm_en.4C29E1 160 | 0xBB, 0xA8, 0x44, 0x00, 0x00, // mov ebx,44A8 --> ― GBK 161 | 0xEB, 0x90, // jmp eden_pm_en.4C2971 162 | 163 | 0x3D, 0x96, 0x81, 0x00, 0x00, // cmp eax,8196 --> * SJIS 164 | 0x75, 0x07, // jne eden_pm_en.4C29EF 165 | 0xBB, 0xA3, 0xAA, 0x00, 0x00, // mov ebx,AAA3 --> * GBK 166 | 0xEB, 0x82, // jmp eden_pm_en.4C2971 167 | 168 | 0x3D, 0x60, 0x81, 0x00, 0x00, // cmp eax,8160 --> 〜 SJIS 169 | 0x75, 0x0A, // jne eden_pm_en.4C2A00 170 | 0xBB, 0x7E, 0x00, 0x00, 0x00, // mov ebx,7E --> ~ ASCII 171 | 0xE9, 0x71, 0xFF, 0xFF, 0xFF, // jmp eden_pm_en.4C2971 172 | 173 | 0x3D, 0xE1, 0x81, 0x00, 0x00, // cmp eax,81E1 --> ≪ SJIS 174 | 0x75, 0x0A, // jne eden_pm_en.4C2A11 175 | 0xBB, 0x3C, 0x00, 0x00, 0x00, // mov ebx,3F --> < ASCII 176 | 0xE9, 0x60, 0xFF, 0xFF, 0xFF, // jmp eden_pm_en.4C2971 177 | 178 | 0x3D, 0xE2, 0x81, 0x00, 0x00, // cmp eax,81E2 --> ≫ SJIS 179 | 0x75, 0x0A, // jne eden_pm_en.4C2A22 180 | 0xBB, 0x3E, 0x00, 0x00, 0x00, // mov ebx,3F --> > ASCII 181 | 0xE9, 0x4F, 0xFF, 0xFF, 0xFF, // jmp eden_pm_en.4C2971 182 | 183 | //处理不在预定义替换字符内的双字节字符 184 | 0x89, 0xC3, // mov ebx,eax 185 | 0xC1, 0xEB, 0x08, // shr ebx,8 186 | 0xC1, 0xE0, 0x08, // shl eax,8 187 | 0x09, 0xC3, // or ebx,eax 188 | 0x90, 0x90, 0x90, 0x90, // NOP 189 | 0x90, 0x90, 0x90, 0x90 190 | }; 191 | WriteMemory((LPVOID)(g_dwExeBase + 0xC299B), aMapCharASM, sizeof(aMapCharASM)); 192 | 193 | //Step6: 194 | //0051A22F 195 | //游戏在调用 GetGlyphOutlineW 输出字形之前通过MultiByteToWideChar进行的窄字节转宽字节, 196 | //MultiByteToWideChar的参数需要修改,让其从单字节读取转换成双字节读取。该函数返回值也会影响单双字节读取需要修改判断返回值的代码 197 | //处理MultiByteToWideChar转换输入的字节从单字节转换到双字节 转换宽度改为2,CodePage改为0x3A8。 198 | static BYTE aProcDBCS_2_ASM[] = 199 | { 200 | 0x6A, 0x02, // push 0x2 201 | 0x66, 0x89, 0x45, 0xF8, // mov word ptr ss:[ebp-0x8], ax 202 | 0x8D, 0x45, 0xF4, // lea eax, ss:[ebp-0xC] 203 | 0x50, // push eax 204 | 0x6A, 0x02, // push 0x2 205 | 0x8D, 0x4D, 0xF8, // lea ecx, ss:[ebp-0x8] 206 | 0x51, // push ecx 207 | 0x6A, 0x01, // push 0x1 208 | 0x68, 0xA8, 0x03, 0x00, 0x00, // push 0x3A8 209 | 0x89, 0x55, 0xF4, // mov dword ptr ss:[ebp-0xC], edx 210 | 0xFF, 0x15, 0x10, 0x92, 0x54, 0x00, // call dword ptr ds:[%MulitiByteToWideChar] 211 | 0x83, 0xF8, 0x01, // cmp eax, 1 212 | 0x75, 0x06, // jne 213 | 0x8B, 0x55, 0xF4, // mov edx, dword ptr ss:[ebp-0xC] 214 | 0x89, 0x55, 0xFC, // mov dword ptr ss:[ebp-0x4], edx 215 | 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 // NOP 216 | }; 217 | WriteMemory((LPVOID)(g_dwExeBase + 0x11A22F), aProcDBCS_2_ASM, sizeof(aProcDBCS_2_ASM)); 218 | } 219 | 220 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) 221 | { 222 | switch (ul_reason_for_call) 223 | { 224 | case DLL_PROCESS_ATTACH: 225 | 226 | StartHook(); 227 | break; 228 | case DLL_THREAD_ATTACH: 229 | case DLL_THREAD_DETACH: 230 | case DLL_PROCESS_DETACH: 231 | break; 232 | } 233 | return TRUE; 234 | } 235 | 236 | VOID __declspec(dllexport) DirA() {} 237 | -------------------------------------------------------------------------------- /其它/eden_pm_en/image/Check1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/eden_pm_en/image/Check1-1.png -------------------------------------------------------------------------------- /其它/eden_pm_en/image/Check1-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/eden_pm_en/image/Check1-2.png -------------------------------------------------------------------------------- /其它/eden_pm_en/image/Check1-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/eden_pm_en/image/Check1-3.png -------------------------------------------------------------------------------- /其它/eden_pm_en/image/Check2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/eden_pm_en/image/Check2-1.png -------------------------------------------------------------------------------- /其它/现妹Bypass/README.md: -------------------------------------------------------------------------------- 1 | # 旧补丁会随机崩溃请更新! 2 | 船新版本,之前的问题应该都好了 也不用挂镜像辣:P 3 | 4 | 日文版: 5 | 下载以下文件 放入游戏目录 6 | **.\日文\Imasugu_crack.exe**(运行这个) 7 | 第一次会弹出一个密钥验证的框框,点确认就行了 8 | 当然你要输入的话也可以(反正输啥都一样 9 | 10 | 汉化版: 11 | 下载以下文件 放入游戏目录 12 | **.\中文\imaimo_cn_fix.cpk** 13 | **.\中文\imaimo_cn_fix.exe**(运行这个) 14 | 第一次会弹出一个密钥验证的框框,点确认就行了 15 | 当然你要输入的话也可以(反正输啥都一样 16 | 17 | # .bp 反编译 18 | https://github.com/arcusmaximus/EthornellTools 19 | -------------------------------------------------------------------------------- /其它/现妹Bypass/scr/Imasugu_crack.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | BYTE driveType[] = { 0x03 }; 4 | 5 | BYTE langPass[] = { 0xB0,0x01,0xC3 }; 6 | 7 | BYTE evb[] = { 8 | 0x2A,0x00,0x2E,0x00, 9 | 0x63,0x00,0x70,0x00, 10 | 0x6B,0x00,0x00,0x00, 11 | 0x00,0x00,0x00,0x00, 12 | 0x00,0x00,0x00,0x00, 13 | 0x00,0x00,0x00,0x00, 14 | 0x00,0x00 }; 15 | 16 | BYTE keyPass[] = { 17 | 0x8B,0x15,0x7C,0xFD,0x4C, 18 | 0x00,0xC7,0x02,0x4D,0x55, 19 | 0x47,0x36,0xC7,0x42,0x04, 20 | 0x2D,0x37,0x57,0x36,0xC7, 21 | 0x42,0x08,0x53,0x2D,0x52, 22 | 0x44,0xC7,0x42,0x0C,0x54, 23 | 0x5A,0x2D,0x33,0xC7,0x42, 24 | 0x10,0x32,0x45,0x4D,0x2D, 25 | 0xC3 }; 26 | 27 | BYTE keyPassCall[] = { 0xE8,0x7B,0x7F,0x06,0x00,0x90 }; 28 | 29 | 30 | STARTUPINFOW si; 31 | PROCESS_INFORMATION pi; 32 | 33 | BOOL GetStart(LPCWSTR lpApplicationName) 34 | { 35 | ZeroMemory(&si, sizeof(si)); 36 | si.cb = sizeof(si); 37 | ZeroMemory(&pi, sizeof(pi)); 38 | if (!CreateProcessW(lpApplicationName, NULL, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &si, &pi)) 39 | { 40 | MessageBoxW(NULL, L"Get Start Failed!!", NULL, MB_OK); 41 | return FALSE; 42 | } 43 | 44 | return TRUE; 45 | } 46 | 47 | DWORD GetImageBase() 48 | { 49 | DWORD dwImageBase = 0; 50 | 51 | CONTEXT Regs = {}; 52 | Regs.ContextFlags = CONTEXT_ALL; 53 | GetThreadContext(pi.hThread, &Regs); 54 | 55 | if (!ReadProcessMemory(pi.hProcess, (LPCVOID)(Regs.Ebx + 0x8), &dwImageBase, sizeof(DWORD), NULL)) 56 | { 57 | MessageBoxW(NULL, L"Get BaseImage Failed!!", NULL, MB_OK); 58 | return FALSE; 59 | } 60 | return dwImageBase; 61 | } 62 | 63 | VOID WriteMemory(LPVOID lpAddress, LPCVOID lpBuffer, SIZE_T nSize) 64 | { 65 | DWORD oldProtect; 66 | 67 | if (!VirtualProtectEx(pi.hProcess, lpAddress, nSize, PAGE_EXECUTE_READWRITE, &oldProtect)) 68 | { 69 | MessageBoxW(NULL, L"VirtualProtectEx Failed!!", NULL, MB_OK); 70 | } 71 | else if (!WriteProcessMemory(pi.hProcess, lpAddress, lpBuffer, nSize, NULL)) 72 | { 73 | MessageBoxW(NULL, L"WriteProcessMemory Failed!!", NULL, MB_OK); 74 | } 75 | } 76 | 77 | INT APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 78 | { 79 | if (!GetStart(L"いますぐお兄ちゃんに妹だっていいたい!.exe")) 80 | { 81 | ExitProcess(0); 82 | } 83 | 84 | DWORD my_ImageBase = GetImageBase(); 85 | 86 | WriteMemory((LPVOID)(my_ImageBase + 0x4E9F0), driveType, sizeof(driveType)); 87 | WriteMemory((LPVOID)(my_ImageBase + 0x56C58), langPass, sizeof(langPass)); 88 | WriteMemory((LPVOID)(my_ImageBase + 0xAFC90), keyPass, sizeof(keyPass)); 89 | WriteMemory((LPVOID)(my_ImageBase + 0x47D10), keyPassCall, sizeof(keyPassCall)); 90 | 91 | 92 | ResumeThread(pi.hThread); 93 | CloseHandle(pi.hProcess); 94 | CloseHandle(pi.hThread); 95 | } 96 | -------------------------------------------------------------------------------- /其它/现妹Bypass/scr/file.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/现妹Bypass/scr/file.zip -------------------------------------------------------------------------------- /其它/现妹Bypass/scr/imaimo_cn_fix.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | BYTE driveType[] = { 0x03 }; 4 | 5 | BYTE langPass[] = {0xB0,0x01,0xC3}; 6 | 7 | BYTE evb[] = { 8 | 0x2A,0x00,0x2E,0x00, 9 | 0x63,0x00,0x70,0x00, 10 | 0x6B,0x00,0x00,0x00, 11 | 0x00,0x00,0x00,0x00, 12 | 0x00,0x00,0x00,0x00, 13 | 0x00,0x00,0x00,0x00, 14 | 0x00,0x00 }; 15 | 16 | BYTE keyPass[] = { 17 | 0x8B,0x15,0x7C,0xFD,0x4C, 18 | 0x00,0xC7,0x02,0x4D,0x55, 19 | 0x47,0x36,0xC7,0x42,0x04, 20 | 0x2D,0x37,0x57,0x36,0xC7, 21 | 0x42,0x08,0x53,0x2D,0x52, 22 | 0x44,0xC7,0x42,0x0C,0x54, 23 | 0x5A,0x2D,0x33,0xC7,0x42, 24 | 0x10,0x32,0x45,0x4D,0x2D, 25 | 0xC3 }; 26 | 27 | BYTE keyPassCall[] = { 0xE8,0x7B,0x7F,0x06,0x00,0x90 }; 28 | 29 | 30 | STARTUPINFOW si; 31 | PROCESS_INFORMATION pi; 32 | 33 | BOOL GetStart(LPCWSTR lpApplicationName) 34 | { 35 | ZeroMemory(&si, sizeof(si)); 36 | si.cb = sizeof(si); 37 | ZeroMemory(&pi, sizeof(pi)); 38 | if (!CreateProcessW(lpApplicationName, NULL, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &si, &pi)) 39 | { 40 | MessageBoxW(NULL, L"Get Start Failed!!", NULL, MB_OK); 41 | return FALSE; 42 | } 43 | 44 | return TRUE; 45 | } 46 | 47 | DWORD GetImageBase() 48 | { 49 | DWORD dwImageBase = 0; 50 | 51 | CONTEXT Regs = {}; 52 | Regs.ContextFlags = CONTEXT_ALL; 53 | GetThreadContext(pi.hThread, &Regs); 54 | 55 | if (!ReadProcessMemory(pi.hProcess, (LPCVOID)(Regs.Ebx + 0x8), &dwImageBase, sizeof(DWORD), NULL)) 56 | { 57 | MessageBoxW(NULL, L"Get BaseImage Failed!!", NULL, MB_OK); 58 | return FALSE; 59 | } 60 | return dwImageBase; 61 | } 62 | 63 | VOID WriteMemory(LPVOID lpAddress, LPCVOID lpBuffer, SIZE_T nSize) 64 | { 65 | DWORD oldProtect; 66 | 67 | if (!VirtualProtectEx(pi.hProcess, lpAddress, nSize, PAGE_EXECUTE_READWRITE, &oldProtect)) 68 | { 69 | MessageBoxW(NULL, L"VirtualProtectEx Failed!!", NULL, MB_OK); 70 | } 71 | else if (!WriteProcessMemory(pi.hProcess, lpAddress, lpBuffer, nSize, NULL)) 72 | { 73 | MessageBoxW(NULL, L"WriteProcessMemory Failed!!", NULL, MB_OK); 74 | } 75 | } 76 | 77 | INT APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 78 | { 79 | if (!GetStart(L"いますぐお兄ちゃんに妹だっていいたい!.exe")) 80 | { 81 | ExitProcess(0); 82 | } 83 | 84 | DWORD my_ImageBase = GetImageBase(); 85 | 86 | WriteMemory((LPVOID)(my_ImageBase + 0x4E9F0), driveType, sizeof(driveType)); 87 | WriteMemory((LPVOID)(my_ImageBase + 0x1EC0F6), evb, sizeof(evb)); 88 | WriteMemory((LPVOID)(my_ImageBase + 0xAFC90), keyPass, sizeof(keyPass)); 89 | WriteMemory((LPVOID)(my_ImageBase + 0x47D10), keyPassCall, sizeof(keyPassCall)); 90 | 91 | 92 | ResumeThread(pi.hThread); 93 | CloseHandle(pi.hProcess); 94 | CloseHandle(pi.hThread); 95 | } 96 | -------------------------------------------------------------------------------- /其它/现妹Bypass/中文/imaimo_cn_fix.cpk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/现妹Bypass/中文/imaimo_cn_fix.cpk -------------------------------------------------------------------------------- /其它/现妹Bypass/中文/imaimo_cn_fix.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/现妹Bypass/中文/imaimo_cn_fix.exe -------------------------------------------------------------------------------- /其它/现妹Bypass/日文/Imasugu_crack.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZQF-ReVN/VN_Localization_Tutorials/ea8eda7d7924a70d46265daca757b64d0a361035/其它/现妹Bypass/日文/Imasugu_crack.exe --------------------------------------------------------------------------------