├── .gitattributes ├── .gitignore ├── DllLoader ├── DllLoader.cpp ├── DllLoader.vcxproj └── DllLoader.vcxproj.filters ├── Hook ├── Hook.vcxproj ├── Hook.vcxproj.filters ├── Hook_BaseClass.cpp ├── Hook_BaseClass.h ├── Hook_Eject.cpp ├── Hook_Eject.h ├── Hook_RecvMsg.cpp ├── Hook_RecvMsg.h ├── Hook_SendMsg.cpp ├── Hook_SendMsg.h └── Offsets_2_6_8_51.h ├── HooksManager ├── HooksManager.cpp ├── HooksManager.h ├── HooksManager.vcxproj └── HooksManager.vcxproj.filters ├── MessageDispatcher ├── MessageDispatcher.cpp ├── MessageDispatcher.h ├── MessageDispatcher.vcxproj └── MessageDispatcher.vcxproj.filters ├── PythonClient └── testClient.py ├── README.md ├── Socket ├── Socket.cpp ├── Socket.h ├── Socket.vcxproj └── Socket.vcxproj.filters ├── TempTest ├── BaseTest.cpp ├── TempTest.cpp ├── TempTest.vcxproj ├── TempTest.vcxproj.filters └── json.hpp ├── UTF8UnicodeConverter ├── UTF8UnicodeConverter.cpp ├── UTF8UnicodeConverter.h ├── UTF8UnicodeConverter.vcxproj └── UTF8UnicodeConverter.vcxproj.filters ├── WeChook.sln ├── WeChook ├── WeChook.cpp ├── WeChook.vcxproj ├── WeChook.vcxproj.filters └── json.hpp ├── clean.bat └── compile.bat /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /DllLoader/DllLoader.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #define GetCurrentDir _getcwd 9 | 10 | #define WECHAT_PROCESS_NAME "WeChat.exe" 11 | #define Dll_NAME_2B_INJECTED "WeChook.dll" 12 | 13 | // 1. Get PID of WeChat. 14 | DWORD GetPidByProcessName(LPCSTR ProcessName) { 15 | // get a snapshot of all the process in the system. 16 | HANDLE ProcessAll = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL); 17 | // compare the process name in the snapshot to find pid 18 | PROCESSENTRY32 processInfo = { 0 }; 19 | processInfo.dwSize = sizeof(PROCESSENTRY32); 20 | while (Process32Next(ProcessAll, &processInfo)) { 21 | if (strcmp(ProcessName, processInfo.szExeFile) == 0) { 22 | return processInfo.th32ProcessID; 23 | } 24 | } 25 | return 0; 26 | } 27 | 28 | // 2. init a memory block in wechat to store the path to our dll, 29 | VOID InjectDll() { 30 | CHAR pathStr[0x200] = { 0 }; 31 | CHAR dllName[] = Dll_NAME_2B_INJECTED; 32 | if (!GetCurrentDir(pathStr, sizeof(pathStr))) 33 | { 34 | std::cout << "Can not get the current dir.\n"; 35 | return; 36 | } 37 | pathStr[sizeof(pathStr) - 1] = '\0'; 38 | strcat_s(pathStr, "\\"); 39 | strcat_s(pathStr, dllName); 40 | //printf("%s\n", pathStr); 41 | 42 | 43 | // get WeChat.exe's process handler 44 | DWORD PID = GetPidByProcessName(WECHAT_PROCESS_NAME); 45 | if (PID == 0) { 46 | std::cout << "Did not find the PID of " << WECHAT_PROCESS_NAME << "\n"; 47 | return; 48 | } 49 | std::cout << "PID of " << WECHAT_PROCESS_NAME << " is: " << PID << "\n"; 50 | HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, PID); 51 | if (hProcess == NULL) { 52 | std::cout << "Did not get the process handler of " << WECHAT_PROCESS_NAME << "\n"; 53 | return; 54 | } 55 | 56 | // init memory block 57 | LPVOID dllPathAddr = VirtualAllocEx(hProcess, NULL, strlen(pathStr), MEM_COMMIT, PAGE_READWRITE); 58 | if (dllPathAddr == NULL) { 59 | std::cout << "Failed to init memory block.\n"; 60 | return; 61 | } 62 | 63 | // write the path of dll to this memory block 64 | if (WriteProcessMemory(hProcess, dllPathAddr, pathStr, strlen(pathStr), NULL) == 0) { 65 | std::cout << "Failed to inject the path of dll to the memory block\n"; 66 | return; 67 | } 68 | 69 | // get the address of LoadLibrary() in kernel32.dll 70 | HMODULE k32 = GetModuleHandle("Kernel32.dll"); 71 | LPVOID loadAddr = GetProcAddress(k32, "LoadLibraryA"); 72 | // execute the dll as a remote thread 73 | HANDLE newThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)loadAddr, dllPathAddr, 0, NULL); 74 | if (newThread == NULL) { 75 | std::cout << "Failed to create a remote thread.\n"; 76 | } 77 | std::cout << "Dll injected.\n"; 78 | WaitForSingleObject(newThread, INFINITE); 79 | CloseHandle(newThread); 80 | CloseHandle(hProcess); 81 | } 82 | 83 | VOID EjectDll() { 84 | char szDllName[] = Dll_NAME_2B_INJECTED; 85 | DWORD PID = GetPidByProcessName(WECHAT_PROCESS_NAME); 86 | HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, PID); 87 | MODULEENTRY32 ME32 = { 0 }; 88 | ME32.dwSize = sizeof(MODULEENTRY32); 89 | BOOL isNext = Module32First(hSnap, &ME32); 90 | BOOL flag = FALSE; 91 | while (isNext) { 92 | if (strcmp(ME32.szModule, szDllName) == 0) { 93 | flag = TRUE; 94 | break; 95 | } 96 | isNext = Module32Next(hSnap, &ME32); 97 | } 98 | if (flag == FALSE) { 99 | std::cout << "Can not find the dll module.\n"; 100 | return; 101 | } 102 | CloseHandle(hSnap); 103 | HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, PID); 104 | FARPROC pFun = GetProcAddress(GetModuleHandle("kernel32.dll"), "FreeLibrary"); 105 | HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)pFun, ME32.modBaseAddr, 0, NULL); 106 | if (hThread == NULL) { 107 | std::cout << "Failed to create a remote thread.\n"; 108 | } 109 | std::cout << "Dll ejected.\n"; 110 | WaitForSingleObject(hThread, INFINITE); 111 | CloseHandle(hThread); 112 | CloseHandle(hProcess); 113 | } 114 | 115 | int main() 116 | { 117 | InjectDll(); 118 | system("pause"); 119 | EjectDll(); 120 | return 0; 121 | } -------------------------------------------------------------------------------- /DllLoader/DllLoader.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 | 15.0 23 | {435743A5-3B6E-4D8B-B19F-F95F09552592} 24 | Win32Proj 25 | DllLoader 26 | 10.0.17763.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v141 33 | NotSet 34 | 35 | 36 | Application 37 | false 38 | v141 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v141 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v141 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 | true 75 | 76 | 77 | true 78 | 79 | 80 | false 81 | 82 | 83 | false 84 | 85 | 86 | 87 | NotUsing 88 | Level3 89 | Disabled 90 | true 91 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 92 | true 93 | pch.h 94 | 95 | 96 | Console 97 | true 98 | 99 | 100 | 101 | 102 | Use 103 | Level3 104 | Disabled 105 | true 106 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 107 | true 108 | pch.h 109 | 110 | 111 | Console 112 | true 113 | 114 | 115 | 116 | 117 | Use 118 | Level3 119 | MaxSpeed 120 | true 121 | true 122 | true 123 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 124 | true 125 | pch.h 126 | 127 | 128 | Console 129 | true 130 | true 131 | true 132 | 133 | 134 | 135 | 136 | Use 137 | Level3 138 | MaxSpeed 139 | true 140 | true 141 | true 142 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 143 | true 144 | pch.h 145 | 146 | 147 | Console 148 | true 149 | true 150 | true 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /DllLoader/DllLoader.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;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 | -------------------------------------------------------------------------------- /Hook/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 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | {dc7637d0-989f-474e-899d-3a38792d6b57} 37 | 38 | 39 | 40 | 15.0 41 | {34F17D6C-6E63-4A18-8F3F-2B797BB5BC0F} 42 | Win32Proj 43 | Hook 44 | 10.0.17763.0 45 | 46 | 47 | 48 | StaticLibrary 49 | true 50 | v141 51 | Unicode 52 | 53 | 54 | Application 55 | false 56 | v141 57 | true 58 | Unicode 59 | 60 | 61 | Application 62 | true 63 | v141 64 | Unicode 65 | 66 | 67 | Application 68 | false 69 | v141 70 | true 71 | Unicode 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | true 93 | 94 | 95 | true 96 | 97 | 98 | false 99 | 100 | 101 | false 102 | 103 | 104 | 105 | NotUsing 106 | Level3 107 | Disabled 108 | true 109 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 110 | true 111 | pch.h 112 | 113 | 114 | Console 115 | true 116 | 117 | 118 | 119 | 120 | Use 121 | Level3 122 | Disabled 123 | true 124 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 125 | true 126 | pch.h 127 | 128 | 129 | Console 130 | true 131 | 132 | 133 | 134 | 135 | Use 136 | Level3 137 | MaxSpeed 138 | true 139 | true 140 | true 141 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 142 | true 143 | pch.h 144 | 145 | 146 | Console 147 | true 148 | true 149 | true 150 | 151 | 152 | 153 | 154 | Use 155 | Level3 156 | MaxSpeed 157 | true 158 | true 159 | true 160 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 161 | true 162 | pch.h 163 | 164 | 165 | Console 166 | true 167 | true 168 | true 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /Hook/Hook.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;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 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | -------------------------------------------------------------------------------- /Hook/Hook_BaseClass.cpp: -------------------------------------------------------------------------------- 1 | #include "Hook_BaseClass.h" 2 | 3 | 4 | 5 | Hook_BaseClass::Hook_BaseClass() 6 | { 7 | WeChatWinAddr = getWeChatWinAddr(); 8 | } 9 | 10 | 11 | Hook_BaseClass::~Hook_BaseClass() 12 | { 13 | } 14 | 15 | DWORD Hook_BaseClass::getWeChatWinAddr() { 16 | HMODULE wechatWinDllAddr = LoadLibrary(L"WeChatWin.dll"); 17 | return (DWORD)wechatWinDllAddr; 18 | } 19 | -------------------------------------------------------------------------------- /Hook/Hook_BaseClass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "Offsets_2_6_8_51.h" 4 | 5 | 6 | struct wxStr { 7 | wchar_t * pStr; 8 | int strLen; 9 | int strLen2; 10 | }; 11 | 12 | class Hook_BaseClass 13 | { 14 | protected: 15 | DWORD WeChatWinAddr = 0; 16 | 17 | public: 18 | Hook_BaseClass(); 19 | ~Hook_BaseClass(); 20 | DWORD getWeChatWinAddr(); 21 | virtual void injectHook() = 0; 22 | virtual void ejectHook() = 0; 23 | }; 24 | 25 | -------------------------------------------------------------------------------- /Hook/Hook_Eject.cpp: -------------------------------------------------------------------------------- 1 | #include "Hook_Eject.h" 2 | 3 | 4 | 5 | Hook_Eject::Hook_Eject(Socket* s, HooksManager* hm) 6 | { 7 | sock = s; 8 | hookManager = hm; 9 | } 10 | 11 | 12 | Hook_Eject::~Hook_Eject() 13 | { 14 | } 15 | 16 | void Hook_Eject::injectHook() { 17 | 18 | } 19 | 20 | void Hook_Eject::ejectHook() { 21 | 22 | } 23 | 24 | VOID Hook_Eject::EjectHooks() { 25 | hookManager->ejectHooks(); 26 | char sendBuffer[0x3000]; 27 | sprintf_s(sendBuffer, 28 | "{ \"cmd\": \"EjectHooks_R\", \"args\": [\"Success\"] }\0" 29 | ); 30 | sock->push(sendBuffer, strlen(sendBuffer)); 31 | } 32 | -------------------------------------------------------------------------------- /Hook/Hook_Eject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Socket/Socket.h" 3 | #include "Hook_BaseClass.h" 4 | #include "../HooksManager/HooksManager.h" 5 | 6 | class Hook_Eject : 7 | public Hook_BaseClass 8 | { 9 | private: 10 | Socket* sock; 11 | HooksManager * hookManager; 12 | public: 13 | Hook_Eject(Socket* , HooksManager*); 14 | ~Hook_Eject(); 15 | virtual void injectHook(); 16 | virtual void ejectHook(); 17 | VOID EjectHooks(); 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /Hook/Hook_RecvMsg.cpp: -------------------------------------------------------------------------------- 1 | #include "Hook_RecvMsg.h" 2 | 3 | VOID _rm_send2Socket(DWORD esi); 4 | DWORD _rm_cEax = 0; 5 | DWORD _rm_cEcx = 0; 6 | DWORD _rm_cEdx = 0; 7 | DWORD _rm_cEbx = 0; 8 | DWORD _rm_cEsp = 0; 9 | DWORD _rm_cEbp = 0; 10 | DWORD _rm_cEsi = 0; 11 | DWORD _rm_cEdi = 0; 12 | DWORD _rm_retCallAddr = 0; 13 | DWORD _rm_retCallAddr2 = 0; 14 | DWORD _rm_retAddr = 0; 15 | DWORD _rm_WeChatWinAddr = 0; 16 | Socket* _rm_sock = nullptr; 17 | 18 | VOID _rm_send2Socket(DWORD esi) { 19 | DWORD wxidAddr = esi - A_WXID_OFFSET_TO_ESI_NEG; 20 | DWORD messageAddr = esi - A_MESSAGE_OFFSET_TO_ESI_NEG; 21 | DWORD wxid2Addr = esi - A_WXID2_OFFSET_TO_ESI_NEG; 22 | DWORD unknownAddr = esi - A_UNKNOWN_OFFSET_TO_ESI_NEG; 23 | wchar_t wxid[0x100] = { 0 }; 24 | wchar_t message[0x1000] = { 0 }; 25 | wchar_t wxid2[0x100] = { 0 }; 26 | wchar_t unknown[0x100] = { 0 }; 27 | swprintf_s(wxid, L"%s", (wchar_t*)(*((LPVOID *)wxidAddr))); 28 | swprintf_s(message, L"%s", (wchar_t*)(*((LPVOID *)messageAddr))); 29 | swprintf_s(wxid2, L"%s", (wchar_t*)(*((LPVOID *)wxid2Addr))); 30 | swprintf_s(unknown, L"%s", (wchar_t*)(*((LPVOID *)unknownAddr))); 31 | char * wxid_c = utf8_encode(wxid); 32 | char * message_c = utf8_encode(message); 33 | char * wxid2_c = utf8_encode(wxid2); 34 | char * unknown_c = utf8_encode(unknown); 35 | 36 | // todo: send the message to the socket 37 | char sendBuffer[0x3000]; 38 | sprintf_s(sendBuffer, 39 | "{ \"cmd\": \"RecvMessage_R\", \"args\": [\"%s\", \"%s\", \"%s\", \"%s\"] }\0", 40 | wxid_c, message_c, wxid2_c, unknown_c); 41 | _rm_sock->push(sendBuffer, strlen(sendBuffer)); 42 | 43 | delete wxid_c, message_c, wxid2_c, unknown_c; 44 | } 45 | 46 | VOID __declspec(naked) _rm_HookF() { 47 | __asm { 48 | mov _rm_cEax, eax 49 | mov _rm_cEcx, ecx 50 | mov _rm_cEdx, edx 51 | mov _rm_cEbx, ebx 52 | mov _rm_cEsp, esp 53 | mov _rm_cEbp, ebp 54 | mov _rm_cEsi, esi 55 | mov _rm_cEdi, edi 56 | } 57 | _rm_send2Socket(_rm_cEsi); 58 | _rm_retCallAddr = _rm_WeChatWinAddr + A_RETCALL_ADDR_OFFSET; 59 | _rm_retCallAddr2 = _rm_WeChatWinAddr + A_RETCALL2_ADDR_OFFSET; 60 | _rm_retAddr = _rm_WeChatWinAddr + A_RET_ADDR_OFFSET; 61 | __asm { 62 | mov eax, _rm_cEax 63 | mov ecx, _rm_cEcx 64 | mov edx, _rm_cEdx 65 | mov ebx, _rm_cEbx 66 | mov esp, _rm_cEsp 67 | mov ebp, _rm_cEbp 68 | mov esi, _rm_cEsi 69 | mov edi, _rm_cEdi 70 | mov ecx, _rm_retCallAddr 71 | call _rm_retCallAddr2 72 | jmp _rm_retAddr 73 | } 74 | } 75 | 76 | Hook_RecvMsg::Hook_RecvMsg(Socket* s) 77 | { 78 | _rm_WeChatWinAddr = WeChatWinAddr; 79 | sock = s; 80 | _rm_sock = s; 81 | } 82 | 83 | 84 | Hook_RecvMsg::~Hook_RecvMsg() 85 | { 86 | 87 | } 88 | 89 | void Hook_RecvMsg::injectHook() 90 | { 91 | processHandle = OpenProcess(PROCESS_ALL_ACCESS, NULL, GetCurrentProcessId()); 92 | DWORD hookAddr = WeChatWinAddr + A_HOOK_ADDR_OFFSET; 93 | 94 | BYTE jmpCode[HOOK_LEN] = { 0 }; 95 | jmpCode[0] = 0xE9; // ass code for "jmp" 96 | *(DWORD *)&jmpCode[1] = (DWORD)&_rm_HookF - hookAddr - HOOK_LEN; 97 | 98 | if (ReadProcessMemory(processHandle, (LPVOID)hookAddr, backCode, HOOK_LEN, NULL) == 0) { 99 | // fprintf_s(msgFile, "Failed at ReadProcessMemory\n"); 100 | return; 101 | } 102 | 103 | if (WriteProcessMemory(processHandle, (LPVOID)hookAddr, jmpCode, HOOK_LEN, NULL) == 0) { 104 | // fprintf_s(msgFile, "Failed at WriteProcessMemory\n"); 105 | return; 106 | } 107 | } 108 | 109 | void Hook_RecvMsg::ejectHook() 110 | { 111 | DWORD hookAddr = WeChatWinAddr + A_HOOK_ADDR_OFFSET; 112 | if (WriteProcessMemory(processHandle, (LPVOID)hookAddr, backCode, HOOK_LEN, NULL) == 0) { 113 | // fprintf_s(msgFile, "Failed to recover the hook\n"); 114 | return; 115 | } 116 | } 117 | 118 | -------------------------------------------------------------------------------- /Hook/Hook_RecvMsg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Socket/Socket.h" 3 | #include "Hook_BaseClass.h" 4 | #include "../UTF8UnicodeConverter/UTF8UnicodeConverter.h" 5 | #include "Offsets_2_6_8_51.h" 6 | #include 7 | 8 | constexpr auto HOOK_LEN = 5; 9 | 10 | class Hook_RecvMsg : 11 | public Hook_BaseClass 12 | { 13 | private: 14 | BYTE backUpCode[HOOK_LEN] = { 0 }; // backCode 15 | HANDLE processHandle = 0; // hWHND 16 | Socket* sock; 17 | BYTE backCode[HOOK_LEN] = { 0 }; 18 | 19 | public: 20 | Hook_RecvMsg(Socket* sock); 21 | ~Hook_RecvMsg(); 22 | virtual void injectHook(); 23 | virtual void ejectHook(); 24 | }; 25 | -------------------------------------------------------------------------------- /Hook/Hook_SendMsg.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Hook of SendMessage 3 | input cmd: 4 | SendMessage 5 | input args: 6 | string: wxid 7 | string: message content 8 | 9 | output cmd: 10 | SendMessage_R 11 | output args: 12 | constant string: "Success" 13 | */ 14 | 15 | #include "Hook_SendMsg.h" 16 | 17 | Hook_SendMsg::Hook_SendMsg(Socket* s) 18 | { 19 | sock = s; 20 | } 21 | 22 | 23 | Hook_SendMsg::~Hook_SendMsg() 24 | { 25 | } 26 | 27 | void Hook_SendMsg::injectHook() { 28 | 29 | } 30 | 31 | void Hook_SendMsg::ejectHook() { 32 | 33 | } 34 | 35 | VOID Hook_SendMsg::SendTextMessage(wchar_t * wxid, wchar_t * message) { 36 | DWORD sendCall = getWeChatWinAddr() + F_SENDMSG_ADDR_OFFSET; 37 | 38 | // assemble the msg structure 39 | wxStr pWxid = { 0 }; 40 | pWxid.pStr = wxid; 41 | pWxid.strLen = wcslen(wxid); // get the length of unicode 42 | pWxid.strLen2 = wcslen(wxid) * 2; 43 | 44 | wxStr pMessage = { 0 }; 45 | pMessage.pStr = message; 46 | pMessage.strLen = wcslen(message); 47 | pMessage.strLen2 = wcslen(message) * 2; 48 | 49 | /* 50 | // copied from ollydbg 51 | 52 | MOV EDX,DWORD PTR SS:[EBP-34] ; wxid 53 | LEA EAX,DWORD PTR DS:[EBX+14] 54 | PUSH 1 ; 0x1 55 | PUSH EAX ; can be 0x0. If you are "at" someone, here will be a pointer to the weid 56 | PUSH EBX ; message 57 | LEA ECX,DWORD PTR SS:[EBP-81C] ; buffer [0x81c] 58 | CALL WeChatWi.626DB4E0 ; The message sending call 59 | ADD ESP,0C ; outer stack equalizor 60 | */ 61 | char * asmWxid = (char *)&pWxid.pStr; 62 | char * asmMessage = (char *)&pMessage.pStr; 63 | char buff[0x81c] = { 0 }; 64 | __asm { 65 | mov edx, asmWxid 66 | mov eax, 0x0 67 | push 0x1 68 | push eax 69 | mov ebx, asmMessage 70 | push ebx 71 | lea ecx, buff 72 | call sendCall 73 | add esp, 0xC 74 | } 75 | char sendBuffer[0x3000]; 76 | sprintf_s(sendBuffer, 77 | "{ \"cmd\": \"SendMessage_R\", \"args\": [\"Success\"] }\0" 78 | ); 79 | sock->push(sendBuffer, strlen(sendBuffer)); 80 | } 81 | 82 | VOID Hook_SendMsg::SendStringMessage(std::string wxid_str, std::string msgContent_str) { 83 | char wxid_ch[0x50]; 84 | strcpy_s(wxid_ch, wxid_str.c_str()); 85 | char msgContent_ch[0x1000]; 86 | strcpy_s(msgContent_ch, msgContent_str.c_str()); 87 | wchar_t* wxid_wc = UTF8ToUnicode(wxid_ch); 88 | wchar_t* msgContent_wc = UTF8ToUnicode(msgContent_ch); 89 | SendTextMessage(wxid_wc, msgContent_wc); 90 | delete wxid_wc, msgContent_wc; 91 | } 92 | -------------------------------------------------------------------------------- /Hook/Hook_SendMsg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Socket/Socket.h" 3 | #include "Hook_BaseClass.h" 4 | #include "Offsets_2_6_8_51.h" 5 | #include "../UTF8UnicodeConverter/UTF8UnicodeConverter.h" 6 | #include 7 | 8 | class Hook_SendMsg : 9 | public Hook_BaseClass 10 | { 11 | private: 12 | Socket* sock; 13 | public: 14 | Hook_SendMsg(Socket*); 15 | ~Hook_SendMsg(); 16 | virtual void injectHook(); 17 | virtual void ejectHook(); 18 | VOID SendTextMessage(wchar_t *, wchar_t *); 19 | VOID SendStringMessage(std::string, std::string); 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /Hook/Offsets_2_6_8_51.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // prefix explaination: 4 | // P: points to a pointer 5 | // F: points to a function 6 | // A: points to an address 7 | 8 | // get info 9 | #define USERNAME_ADDR_OFFSET 0x126d91c 10 | #define WECHATID_ADDR_OFFSET 0x126da80 11 | #define P_AVARTARURL_ADDR_OFFSET 0x126dbe4 12 | 13 | // send message 14 | #define F_SENDMSG_ADDR_OFFSET 0x2eb4e0 15 | 16 | // receive message 17 | #define A_RETCALL_ADDR_OFFSET 0x126D7F8 18 | #define A_RETCALL2_ADDR_OFFSET 0x2599D0 19 | #define A_RET_ADDR_OFFSET 0x315E9B 20 | #define A_WXID_OFFSET_TO_ESI_NEG 0x1A0 21 | #define A_MESSAGE_OFFSET_TO_ESI_NEG 0x178 22 | #define A_WXID2_OFFSET_TO_ESI_NEG 0xCC 23 | #define A_UNKNOWN_OFFSET_TO_ESI_NEG 0xB8 24 | #define A_HOOK_ADDR_OFFSET 0x315E93 25 | -------------------------------------------------------------------------------- /HooksManager/HooksManager.cpp: -------------------------------------------------------------------------------- 1 | #include "HooksManager.h" 2 | 3 | 4 | 5 | HooksManager::HooksManager() 6 | { 7 | } 8 | 9 | 10 | HooksManager::~HooksManager() 11 | { 12 | } 13 | 14 | void HooksManager::addHook(Hook_BaseClass * hook) { 15 | hookList.push_back(hook); 16 | } 17 | 18 | void HooksManager::injectHooks() { 19 | for (auto h : hookList) { 20 | h->injectHook(); 21 | } 22 | } 23 | 24 | void HooksManager::ejectHooks() { 25 | for (auto h : hookList) { 26 | h->ejectHook(); 27 | } 28 | } 29 | 30 | #ifdef DEBUG_HOOKSMANAGER 31 | 32 | #include "../Hook/Hook_RecvMsg.h" 33 | #include "../Hook/Hook_SendMsg.h" 34 | 35 | int main() { 36 | Hook_RecvMsg rm; 37 | Hook_SendMsg sm; 38 | HooksManager hm; 39 | hm.addHook(&rm); 40 | hm.addHook(&sm); 41 | hm.injectHooks(); 42 | hm.ejectHooks(); 43 | return 0; 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /HooksManager/HooksManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "../Hook/Hook_BaseClass.h" 4 | 5 | using namespace std; 6 | class HooksManager 7 | { 8 | private: 9 | vector hookList; 10 | 11 | public: 12 | HooksManager(); 13 | ~HooksManager(); 14 | void addHook(Hook_BaseClass*); 15 | void injectHooks(); 16 | void ejectHooks(); 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /HooksManager/HooksManager.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 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | {34f17d6c-6e63-4a18-8f3f-2b797bb5bc0f} 30 | 31 | 32 | 33 | 15.0 34 | {13668D06-F8DE-42DC-B440-97C5555C3E63} 35 | Win32Proj 36 | HooksManager 37 | 10.0.17763.0 38 | 39 | 40 | 41 | StaticLibrary 42 | true 43 | v141 44 | Unicode 45 | 46 | 47 | Application 48 | false 49 | v141 50 | true 51 | Unicode 52 | 53 | 54 | Application 55 | true 56 | v141 57 | Unicode 58 | 59 | 60 | Application 61 | false 62 | v141 63 | true 64 | Unicode 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | true 86 | 87 | 88 | true 89 | 90 | 91 | false 92 | 93 | 94 | false 95 | 96 | 97 | 98 | NotUsing 99 | Level3 100 | Disabled 101 | true 102 | WIN32;_DEBUG;_CONSOLE;NOT_DEBUG_HOOKSMANAGER;%(PreprocessorDefinitions) 103 | true 104 | pch.h 105 | 106 | 107 | Console 108 | true 109 | 110 | 111 | 112 | 113 | Use 114 | Level3 115 | Disabled 116 | true 117 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 118 | true 119 | pch.h 120 | 121 | 122 | Console 123 | true 124 | 125 | 126 | 127 | 128 | Use 129 | Level3 130 | MaxSpeed 131 | true 132 | true 133 | true 134 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 135 | true 136 | pch.h 137 | 138 | 139 | Console 140 | true 141 | true 142 | true 143 | 144 | 145 | 146 | 147 | Use 148 | Level3 149 | MaxSpeed 150 | true 151 | true 152 | true 153 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 154 | true 155 | pch.h 156 | 157 | 158 | Console 159 | true 160 | true 161 | true 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /HooksManager/HooksManager.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;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 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /MessageDispatcher/MessageDispatcher.cpp: -------------------------------------------------------------------------------- 1 | #include "MessageDispatcher.h" 2 | 3 | void MessageDispatcher::addEntry(string cmd, 4 | DispFun func) { 5 | dispatcher[cmd] = func; 6 | } 7 | 8 | MessageDispatcher::DispFun MessageDispatcher::dispatch(string funcName) { 9 | return dispatcher[funcName]; 10 | } 11 | 12 | void MessageDispatcher::runInThread(string funcName, 13 | MessageDispatcher::DispArg args) { 14 | std::thread th(dispatch(funcName), args); 15 | th.detach(); 16 | return; 17 | } 18 | 19 | #ifdef DEBUG_MESSAGEDISPATCHER 20 | 21 | #include 22 | #include 23 | 24 | int test1(MessageDispatcher::DispArg args) { 25 | for (auto str : args) { 26 | Sleep(1000); 27 | cout << "test1: " << str << endl; 28 | } 29 | return 0; 30 | } 31 | 32 | int test2(MessageDispatcher::DispArg args) { 33 | for (auto str : args) { 34 | Sleep(1000); 35 | cout << "test2: " << str << endl; 36 | } 37 | return 0; 38 | } 39 | 40 | int main() { 41 | MessageDispatcher md; 42 | md.addEntry("test1", test1); 43 | md.addEntry("test2", test2); 44 | vector args; 45 | args.push_back("abc"); 46 | args.push_back("def"); 47 | md.runInThread("test1", args); 48 | md.runInThread("test2", args); 49 | Sleep(10000); 50 | return 0; 51 | } 52 | #endif // DEBUG_MESSAGEDISPATCHER 53 | -------------------------------------------------------------------------------- /MessageDispatcher/MessageDispatcher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | class MessageDispatcher 11 | { 12 | public: 13 | using DispArg = vector; 14 | using DispFun = function; 15 | void addEntry(string, DispFun); 16 | void runInThread(string, DispArg); 17 | 18 | private: 19 | unordered_map< 20 | string, 21 | DispFun 22 | > dispatcher; 23 | DispFun dispatch(string); 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /MessageDispatcher/MessageDispatcher.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 | 23 | 24 | 25 | 26 | 27 | 28 | 15.0 29 | {24B6FBBD-52A1-4A02-A042-066301ADC7E9} 30 | Win32Proj 31 | MessageDispatcher 32 | 10.0.17763.0 33 | 34 | 35 | 36 | StaticLibrary 37 | true 38 | v141 39 | Unicode 40 | 41 | 42 | Application 43 | false 44 | v141 45 | true 46 | Unicode 47 | 48 | 49 | Application 50 | true 51 | v141 52 | Unicode 53 | 54 | 55 | Application 56 | false 57 | v141 58 | true 59 | Unicode 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | true 81 | 82 | 83 | true 84 | 85 | 86 | false 87 | 88 | 89 | false 90 | 91 | 92 | 93 | NotUsing 94 | Level3 95 | Disabled 96 | true 97 | WIN32;_DEBUG;_CONSOLE;NOT_DEBUG_MESSAGEDISPATCHER;%(PreprocessorDefinitions) 98 | true 99 | pch.h 100 | 101 | 102 | Console 103 | true 104 | 105 | 106 | 107 | 108 | Use 109 | Level3 110 | Disabled 111 | true 112 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 113 | true 114 | pch.h 115 | 116 | 117 | Console 118 | true 119 | 120 | 121 | 122 | 123 | Use 124 | Level3 125 | MaxSpeed 126 | true 127 | true 128 | true 129 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 130 | true 131 | pch.h 132 | 133 | 134 | Console 135 | true 136 | true 137 | true 138 | 139 | 140 | 141 | 142 | Use 143 | Level3 144 | MaxSpeed 145 | true 146 | true 147 | true 148 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 149 | true 150 | pch.h 151 | 152 | 153 | Console 154 | true 155 | true 156 | true 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /MessageDispatcher/MessageDispatcher.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;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 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /PythonClient/testClient.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import sys 3 | import time 4 | import json 5 | import threading 6 | 7 | # Create a TCP/IP socket 8 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 9 | 10 | # Connect the socket to the port where the server is listening 11 | server_address = ('localhost', 50526) 12 | print('connecting to {} port {}'.format(*server_address)) 13 | sock.connect(server_address) 14 | 15 | def recv(): 16 | while True: 17 | data = sock.recv(1000) 18 | print('received {!r}'.format(data.decode())) 19 | recv_d = json.loads(data.decode()) 20 | if recv_d["cmd"]=="EjectHooks_R": 21 | sock.close() 22 | sys.exit() 23 | 24 | threading.Thread(target=recv).start() 25 | 26 | messages =[ 27 | "testMessages", 28 | "这是个测试消息。。", 29 | "你看我居然能发送中文!", 30 | "是不是很酷?", 31 | "Of course, I need some more messages", 32 | "...just for testing...", 33 | "message1", 34 | "message2", 35 | "message3", 36 | "Ok done." 37 | ] 38 | # Send data 39 | for m in messages: 40 | dToBeSent = {"cmd": "SendMessage", "args": ["filehelper", m]} 41 | messageString = (json.dumps(dToBeSent) + "\0").encode("utf-8") 42 | print('sending {!r}'.format(messageString.decode())) 43 | sock.sendall(messageString) 44 | time.sleep(2) 45 | dToBeSent = {"cmd": "EjectHooks", "args": ["1", "2"]} 46 | messageString = (json.dumps(dToBeSent) + "\0").encode("utf-8") 47 | print('sending {!r}'.format(messageString.decode())) 48 | sock.sendall(messageString) 49 | time.sleep(10) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## WeChook - 微信PC客户端API 2 | 3 | 一个基于DLL注入的微信PC客户端API项目。简单地说,通过这个项目,你可以通过你所熟悉的程序语言来控制微信PC客户端的行为。 4 | 5 | #### 在使用这个项目前你可能需要知道: 6 | 7 | * 本项目基于兴趣开发,目前还处在非常前期的开发阶段,**不对稳定性作任何保证,也不对后续开发进度有任何保证**(如果你对此有需求,阅读下一条)。当然,相对应的,本项目完全开源,你可以任意下载、修改、使用这里的代码,你**甚至可以通过PR来帮助这个项目变得更加美妙**。 8 | 9 | * 本项目由该[Github项目](https://github.com/hedada-hc/pc_wechat_hook) 启发。该项目是一个以微信PC客户端为例的面向PC逆向工程的教学项目,项目源码中提供了很多通过Hook微信二进制改变程序运行的方式。在该项目的[README.md](https://github.com/hedada-hc/pc_wechat_hook/blob/master/README.md)中项目作者介绍自己还有一个可供商用的闭源项目,完全出于对他的教程的感谢之理由,我建议有商用目的的读者前往他的项目了解详细信息。 10 | * 本项目核心运作原理是对二进制的逆向工程,坦白得讲,**作为开发者,我是绝对不会允许除我以外的其他作者的此类软件运行在我的计算机上的**。再坦白一点讲,如果我是邪恶的,运行本项目将会造成诸如被木马、被盗号乃至被破坏系统的后果。所以呢这边建议您,如果你不清楚运行这个软件的风险但还是想要尝试运行本项目,那你就必须发自内心地对一个如果不是因为这个项目而可能和你八竿子打不着儿的人——也就是我——完全信任。当然,清者自清,反正我都开源了,欢迎有识之士指着我的源码批判一番,共商改进大业。 11 | * 当然,如果你不想对一个八竿子打不着儿的人发自内心完全信任,你也可以给我捐个十万八万的美其名曰项目外包。一来我有动力维护这个项目,二来你也可以出于“额外的”理由来信任我,岂不美哉? 12 | 13 | #### 如果你只是想要使用本项目提供的功能: 14 | 15 | 你需要: 16 | 17 | 1. Visual Studio (开发环境是VS2017) 18 | 19 | 按照下列任一方式来编译工程: 20 | 21 | 1. 使用VS打开项目,然后右键项目“重新编译项目”(ctrl+alt+f7); 22 | 2. 左下角搜索“Developer Command Prompt”开启开发者命令行,cd到项目根目录后运行compile.bat。 23 | 24 | 使用项目: 25 | 26 | 1. 进入项目根目录中的Debug目录,运行DllLoader.exe便可以注入WeChook.dll。此时,WeChook.dll会在后台开启一个socket服务器(port: 50526),你可以使用任何可以与socket交互的语言来使用api。 27 | 2. 本项目中PythonClient文件夹中的testClient.py提供了一个供参考的python客户端程序。你可以使用任何版本的python3来执行python脚本观察运行结果。 28 | 29 | 可能会有的更新: 30 | 31 | 1. 对于api调用的封装,使用户在不直接与socket交互的情况下使用api 32 | 33 | #### 如果你是开发者: 34 | 35 | 这里将介绍整个项目的结构: 36 | 37 | 1. DllLoader: 38 | 1. 这是一个单独的exe程序,可以在整个系统空间中搜索WeChat.exe然后注入WeChook.dll。 39 | 2. 未来将变成一个针对任意进程注入任意dll的工具 40 | 2. Hook: 41 | 1. 这里是所有的Hook组件。 42 | 2. 目前有三个Hook组件,分别为Hook_Eject,Hook_RecvMsg,Hook_SendMsg,他们都继承于Hook_BaseClass类。 43 | 3. Offsets_x_x_x_xx.h中是hook偏移量的宏定义。文件名中的x代表了版本号。 44 | 45 | 3. HooksManager: 46 | 1. 这是一个统一管理Hook注入和弹出的管理器。你可以阅读WeChook项目中的WeChook.cpp来查看使用方式。 47 | 4. MessageDispatcher: 48 | 1. 这是一个任务分配器,根据socket传来的json数据中cmd字段的内容,来运行指定的函数,并传入json中args字段中的参数。使用方式可以查看WeChook.cpp。 49 | 5. Socket: 50 | 1. 封装了对于socket的调用。很简单得提供了pull和push来实现字符串的“接收”与“发送“ 51 | 6. TempTest: 52 | 1. 没啥用,用来测试可行性的暂时的项目。未来会被移除。 53 | 7. UTF8UnicodeConverter: 54 | 1. 因为微信客户端内部的数据都是Unicode,所以这里提供了一些utf8和unicode相互转换的函数 55 | 8. WeChook: 56 | 1. dll入口。 57 | 58 | 未来,这里将会提供全部api的表格以及更加详细的开发帮助文档。 -------------------------------------------------------------------------------- /Socket/Socket.cpp: -------------------------------------------------------------------------------- 1 | #include "Socket.h" 2 | 3 | Socket::Socket() 4 | { 5 | WSADATA wsaData; 6 | 7 | // Initialize Winsock 8 | int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); 9 | if (iResult != 0) { 10 | printf("WSAStartup failed: %d\n", iResult); 11 | return; 12 | } 13 | 14 | struct addrinfo *result = NULL, *ptr = NULL, hints; 15 | 16 | ZeroMemory(&hints, sizeof(hints)); 17 | hints.ai_family = AF_INET; 18 | hints.ai_socktype = SOCK_STREAM; 19 | hints.ai_protocol = IPPROTO_TCP; 20 | hints.ai_flags = AI_PASSIVE; 21 | 22 | // Resolve the local address and port to be used by the server 23 | iResult = getaddrinfo(NULL, DEFAULT_PORT, &hints, &result); 24 | if (iResult != 0) { 25 | printf("getaddrinfo failed: %d\n", iResult); 26 | WSACleanup(); 27 | return; 28 | } 29 | 30 | SOCKET ListenSocket = INVALID_SOCKET; 31 | // Create a SOCKET for the server to listen for client connections 32 | ListenSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol); 33 | if (ListenSocket == INVALID_SOCKET) { 34 | printf("Error at socket(): %ld\n", WSAGetLastError()); 35 | freeaddrinfo(result); 36 | WSACleanup(); 37 | return; 38 | } 39 | 40 | // Setup the TCP connection options 41 | BOOL bOptVal = TRUE; 42 | int bOptLen = sizeof(BOOL); 43 | iResult = setsockopt(ListenSocket, SOL_SOCKET, SO_REUSEADDR, (char *)&bOptVal, bOptLen); 44 | if (iResult == SOCKET_ERROR) { 45 | printf("setsockopt for SO_KEEPALIVE failed with error: %u\n", WSAGetLastError()); 46 | freeaddrinfo(result); 47 | closesocket(ListenSocket); 48 | WSACleanup(); 49 | return; 50 | } 51 | 52 | // Setup the TCP listening socket 53 | iResult = bind(ListenSocket, result->ai_addr, (int)result->ai_addrlen); 54 | if (iResult == SOCKET_ERROR) { 55 | printf("bind failed with error: %d\n", WSAGetLastError()); 56 | freeaddrinfo(result); 57 | closesocket(ListenSocket); 58 | WSACleanup(); 59 | return; 60 | } 61 | freeaddrinfo(result); 62 | 63 | if (listen(ListenSocket, SOMAXCONN) == SOCKET_ERROR) { 64 | printf("Listen failed with error: %ld\n", WSAGetLastError()); 65 | closesocket(ListenSocket); 66 | WSACleanup(); 67 | return; 68 | } 69 | 70 | ClientSocket = INVALID_SOCKET; 71 | 72 | // Accept a client socket 73 | ClientSocket = accept(ListenSocket, NULL, NULL); 74 | if (ClientSocket == INVALID_SOCKET) { 75 | printf("accept failed: %d\n", WSAGetLastError()); 76 | closesocket(ListenSocket); 77 | WSACleanup(); 78 | return; 79 | } 80 | closesocket(ListenSocket); 81 | } 82 | 83 | Socket::~Socket() 84 | { 85 | // shutdown the send half of the connection since no more data will be sent 86 | int iResult = shutdown(ClientSocket, SD_SEND); 87 | if (iResult == SOCKET_ERROR) { 88 | printf("shutdown failed: %d\n", WSAGetLastError()); 89 | closesocket(ClientSocket); 90 | WSACleanup(); 91 | return; 92 | } 93 | 94 | // cleanup 95 | closesocket(ClientSocket); 96 | WSACleanup(); 97 | 98 | return; 99 | } 100 | 101 | int Socket::pull(char * recvbuf, int recvBufLen) { 102 | int recvbuflen = recvBufLen; 103 | int recvBytes = recv(ClientSocket, recvbuf, recvbuflen, 0); 104 | if (recvBytes > 0) { 105 | return recvBytes; 106 | } 107 | else if (recvBytes == 0) { 108 | printf("Connection closing...\n"); 109 | return recvBytes; 110 | } 111 | else { 112 | printf("recv failed: %d\n", WSAGetLastError()); 113 | closesocket(ClientSocket); 114 | WSACleanup(); 115 | return recvBytes; 116 | } 117 | } 118 | 119 | int Socket::push(char * sendbuf, int sendBufLen) { 120 | int iSendResult = send(ClientSocket, sendbuf, sendBufLen, 0); 121 | if (iSendResult == SOCKET_ERROR) { 122 | printf("send failed: %d\n", WSAGetLastError()); 123 | closesocket(ClientSocket); 124 | WSACleanup(); 125 | return iSendResult; 126 | } 127 | return iSendResult; 128 | } 129 | 130 | 131 | #ifdef DEBUG_SOCKET 132 | #include 133 | 134 | const wchar_t * char2wchar(char * in) { 135 | size_t newsize = strlen(in) + 1; 136 | wchar_t * wcstring = new wchar_t[newsize]; 137 | size_t convertedChars = 0; 138 | mbstowcs_s(&convertedChars, wcstring, newsize, in, _TRUNCATE); 139 | return wcstring; 140 | } 141 | 142 | int main() 143 | { 144 | Socket sock; 145 | char recvBuffer[DEFAULT_BUFLEN]; 146 | int pullRet = 1; 147 | while (1) { 148 | pullRet = sock.pull(recvBuffer, DEFAULT_BUFLEN); 149 | if (pullRet <= 0) 150 | break; 151 | 152 | const wchar_t * wcstring = char2wchar(recvBuffer); 153 | wprintf(L"\"%s\"\n", wcstring); 154 | delete wcstring; 155 | 156 | int pushRet = sock.push(recvBuffer, pullRet); 157 | if (pushRet == SOCKET_ERROR) { 158 | break; 159 | } 160 | } 161 | return 0; 162 | } 163 | #endif 164 | -------------------------------------------------------------------------------- /Socket/Socket.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef WIN32_LEAN_AND_MEAN 3 | #define WIN32_LEAN_AND_MEAN 4 | #endif 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #pragma comment(lib, "Ws2_32.lib") 13 | 14 | #define DEFAULT_PORT "50526" 15 | #define DEFAULT_BUFLEN 1024 16 | 17 | class Socket 18 | { 19 | private: 20 | SOCKET ClientSocket; 21 | 22 | public: 23 | Socket(); 24 | ~Socket(); 25 | int pull(char * recvbuf, int recvBufLen); 26 | int push(char * sendbuf, int sendBufLen); 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /Socket/Socket.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 | 15.0 23 | {F074E2AD-6EA1-469C-A1DB-B4C9195752DD} 24 | Win32Proj 25 | Socket 26 | 10.0.17763.0 27 | 28 | 29 | 30 | StaticLibrary 31 | true 32 | v141 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v141 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v141 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v141 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 | true 75 | 76 | 77 | true 78 | 79 | 80 | false 81 | 82 | 83 | false 84 | 85 | 86 | 87 | NotUsing 88 | Level3 89 | Disabled 90 | true 91 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 92 | true 93 | pch.h 94 | 95 | 96 | Console 97 | true 98 | 99 | 100 | 101 | 102 | Use 103 | Level3 104 | Disabled 105 | true 106 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 107 | true 108 | pch.h 109 | 110 | 111 | Console 112 | true 113 | 114 | 115 | 116 | 117 | Use 118 | Level3 119 | MaxSpeed 120 | true 121 | true 122 | true 123 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 124 | true 125 | pch.h 126 | 127 | 128 | Console 129 | true 130 | true 131 | true 132 | 133 | 134 | 135 | 136 | Use 137 | Level3 138 | MaxSpeed 139 | true 140 | true 141 | true 142 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 143 | true 144 | pch.h 145 | 146 | 147 | Console 148 | true 149 | true 150 | true 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /Socket/Socket.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;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 | -------------------------------------------------------------------------------- /TempTest/BaseTest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../Hook/Hook_BaseClass.h" 3 | #include "../Hook/Hook_SendMsg.h" 4 | 5 | #ifdef TEST_BASETEST 6 | 7 | using namespace std; 8 | 9 | int main() { 10 | vector bcv; 11 | Hook_SendMsg hsm; 12 | bcv.push_back(&hsm); 13 | bcv[0]->ejectHook(); 14 | return 0; 15 | } 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /TempTest/TempTest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "json.hpp" 4 | #include "../Socket/Socket.h" 5 | #include "../MessageDispatcher/MessageDispatcher.h" 6 | 7 | class TestClass { 8 | public: 9 | int test1(MessageDispatcher::DispArg args) { 10 | for (auto str : args) { 11 | cout << "test1: " << str << endl; 12 | Sleep(1000); 13 | } 14 | return 0; 15 | } 16 | int test2(MessageDispatcher::DispArg args) { 17 | for (auto str : args) { 18 | cout << "test2: " << str << endl; 19 | Sleep(1000); 20 | } 21 | return 0; 22 | } 23 | }; 24 | 25 | int main() 26 | { 27 | Socket sock; 28 | char recvBuffer[DEFAULT_BUFLEN]; 29 | 30 | TestClass tc; 31 | 32 | MessageDispatcher md; 33 | md.addEntry("test1", [&tc](MessageDispatcher::DispArg args)->int 34 | { 35 | return tc.test1(args); 36 | }); 37 | md.addEntry("test2", [&tc](MessageDispatcher::DispArg args)->int 38 | { 39 | return tc.test2(args); 40 | }); 41 | 42 | while (1) { 43 | int pullRet = sock.pull(recvBuffer, DEFAULT_BUFLEN); 44 | if (pullRet <= 0) 45 | break; 46 | 47 | std::string so(recvBuffer); 48 | auto j = nlohmann::json::parse(so); 49 | 50 | string c = j["cmd"]; 51 | vector a = j["args"]; 52 | 53 | md.runInThread(c, a); 54 | 55 | int pushRet = sock.push(recvBuffer, pullRet); 56 | if (pushRet == SOCKET_ERROR) { 57 | break; 58 | } 59 | } 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /TempTest/TempTest.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 | 15.0 23 | {F64ACEB1-E889-430B-BA67-CA36040DAE8C} 24 | Win32Proj 25 | TempTest 26 | 10.0.17763.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v141 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v141 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v141 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v141 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 | true 75 | 76 | 77 | true 78 | 79 | 80 | false 81 | 82 | 83 | false 84 | 85 | 86 | 87 | NotUsing 88 | Level3 89 | Disabled 90 | true 91 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 92 | true 93 | pch.h 94 | 95 | 96 | Console 97 | true 98 | 99 | 100 | 101 | 102 | Use 103 | Level3 104 | Disabled 105 | true 106 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 107 | true 108 | pch.h 109 | 110 | 111 | Console 112 | true 113 | 114 | 115 | 116 | 117 | Use 118 | Level3 119 | MaxSpeed 120 | true 121 | true 122 | true 123 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 124 | true 125 | pch.h 126 | 127 | 128 | Console 129 | true 130 | true 131 | true 132 | 133 | 134 | 135 | 136 | Use 137 | Level3 138 | MaxSpeed 139 | true 140 | true 141 | true 142 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 143 | true 144 | pch.h 145 | 146 | 147 | Console 148 | true 149 | true 150 | true 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | {eb5f2d71-2c57-4a82-b00c-f92fdc9b33aa} 162 | 163 | 164 | {f074e2ad-6ea1-469c-a1db-b4c9195752dd} 165 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /TempTest/TempTest.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;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 | -------------------------------------------------------------------------------- /UTF8UnicodeConverter/UTF8UnicodeConverter.cpp: -------------------------------------------------------------------------------- 1 | #include "UTF8UnicodeConverter.h" 2 | 3 | // Convert a wide Unicode string to an UTF8 string 4 | std::string utf8_encode(const std::wstring &wstr) 5 | { 6 | if (wstr.empty()) return std::string(); 7 | int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL); 8 | std::string strTo(size_needed, 0); 9 | WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL); 10 | return strTo; 11 | } 12 | 13 | char* utf8_encode(wchar_t * wch) { 14 | std::wstring wch_str(wch); 15 | std::string ch_str = utf8_encode(wch_str); 16 | char *ch = (char *)malloc((ch_str.length() + 1) * sizeof(char)); 17 | rsize_t sz = ch_str.length() + 1; 18 | strcpy_s(ch, sz, ch_str.c_str()); 19 | return ch; 20 | } 21 | 22 | // Convert an UTF8 string to a wide Unicode String 23 | std::wstring utf8_decode(const std::string &str) 24 | { 25 | if (str.empty()) return std::wstring(); 26 | int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0); 27 | std::wstring wstrTo(size_needed, 0); 28 | MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &wstrTo[0], size_needed); 29 | return wstrTo; 30 | } 31 | 32 | wchar_t * UTF8ToUnicode(const char* str) 33 | { 34 | int textlen = 0; 35 | wchar_t * result; 36 | textlen = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); 37 | result = (wchar_t *)malloc((textlen + 1) * sizeof(wchar_t)); 38 | memset(result, 0, (textlen + 1) * sizeof(wchar_t)); 39 | MultiByteToWideChar(CP_UTF8, 0, str, -1, (LPWSTR)result, textlen); 40 | return result; 41 | } 42 | 43 | #ifdef DEBUG_UTF8UNICODECONVERTER 44 | int main() 45 | { 46 | std::string in("你好"); 47 | std::wstring out = utf8_decode(in); 48 | std::string outFromIn = utf8_encode(out); 49 | 50 | wchar_t in_wch[0x40] = L"你好abc"; 51 | char *out_ch = utf8_encode(in_wch); 52 | return 0; 53 | } 54 | #endif 55 | -------------------------------------------------------------------------------- /UTF8UnicodeConverter/UTF8UnicodeConverter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | std::string utf8_encode(const std::wstring &); 7 | char* utf8_encode(wchar_t *); 8 | std::wstring utf8_decode(const std::string &); 9 | wchar_t * UTF8ToUnicode(const char*); 10 | -------------------------------------------------------------------------------- /UTF8UnicodeConverter/UTF8UnicodeConverter.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 | 15.0 23 | {DC7637D0-989F-474E-899D-3A38792D6B57} 24 | Win32Proj 25 | UTF8UnicodeConverter 26 | 10.0.17763.0 27 | 28 | 29 | 30 | StaticLibrary 31 | true 32 | v141 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v141 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v141 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v141 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 | true 75 | 76 | 77 | true 78 | 79 | 80 | false 81 | 82 | 83 | false 84 | 85 | 86 | 87 | NotUsing 88 | Level3 89 | Disabled 90 | true 91 | WIN32;_DEBUG;_CONSOLE;NOT_DEBUG_UTF8UNICODECONVERTER;%(PreprocessorDefinitions) 92 | true 93 | pch.h 94 | 95 | 96 | Console 97 | true 98 | 99 | 100 | 101 | 102 | Use 103 | Level3 104 | Disabled 105 | true 106 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 107 | true 108 | pch.h 109 | 110 | 111 | Console 112 | true 113 | 114 | 115 | 116 | 117 | Use 118 | Level3 119 | MaxSpeed 120 | true 121 | true 122 | true 123 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 124 | true 125 | pch.h 126 | 127 | 128 | Console 129 | true 130 | true 131 | true 132 | 133 | 134 | 135 | 136 | Use 137 | Level3 138 | MaxSpeed 139 | true 140 | true 141 | true 142 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 143 | true 144 | pch.h 145 | 146 | 147 | Console 148 | true 149 | true 150 | true 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /UTF8UnicodeConverter/UTF8UnicodeConverter.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;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 | -------------------------------------------------------------------------------- /WeChook.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.572 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WeChook", "WeChook\WeChook.vcxproj", "{FBBCFFF2-42B9-4857-8E10-5A8FBE3F9F6A}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Socket", "Socket\Socket.vcxproj", "{F074E2AD-6EA1-469C-A1DB-B4C9195752DD}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DllLoader", "DllLoader\DllLoader.vcxproj", "{435743A5-3B6E-4D8B-B19F-F95F09552592}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Hook", "Hook\Hook.vcxproj", "{34F17D6C-6E63-4A18-8F3F-2B797BB5BC0F}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TempTest", "TempTest\TempTest.vcxproj", "{F64ACEB1-E889-430B-BA67-CA36040DAE8C}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HooksManager", "HooksManager\HooksManager.vcxproj", "{13668D06-F8DE-42DC-B440-97C5555C3E63}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MessageDispatcher", "MessageDispatcher\MessageDispatcher.vcxproj", "{24B6FBBD-52A1-4A02-A042-066301ADC7E9}" 19 | EndProject 20 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UTF8UnicodeConverter", "UTF8UnicodeConverter\UTF8UnicodeConverter.vcxproj", "{DC7637D0-989F-474E-899D-3A38792D6B57}" 21 | EndProject 22 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2A11DEEF-32C7-4678-B47F-C3F31A4BED81}" 23 | ProjectSection(SolutionItems) = preProject 24 | README.md = README.md 25 | EndProjectSection 26 | EndProject 27 | Global 28 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 29 | Debug|x64 = Debug|x64 30 | Debug|x86 = Debug|x86 31 | Release|x64 = Release|x64 32 | Release|x86 = Release|x86 33 | EndGlobalSection 34 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 35 | {FBBCFFF2-42B9-4857-8E10-5A8FBE3F9F6A}.Debug|x64.ActiveCfg = Debug|x64 36 | {FBBCFFF2-42B9-4857-8E10-5A8FBE3F9F6A}.Debug|x64.Build.0 = Debug|x64 37 | {FBBCFFF2-42B9-4857-8E10-5A8FBE3F9F6A}.Debug|x86.ActiveCfg = Debug|Win32 38 | {FBBCFFF2-42B9-4857-8E10-5A8FBE3F9F6A}.Debug|x86.Build.0 = Debug|Win32 39 | {FBBCFFF2-42B9-4857-8E10-5A8FBE3F9F6A}.Release|x64.ActiveCfg = Release|x64 40 | {FBBCFFF2-42B9-4857-8E10-5A8FBE3F9F6A}.Release|x64.Build.0 = Release|x64 41 | {FBBCFFF2-42B9-4857-8E10-5A8FBE3F9F6A}.Release|x86.ActiveCfg = Release|Win32 42 | {FBBCFFF2-42B9-4857-8E10-5A8FBE3F9F6A}.Release|x86.Build.0 = Release|Win32 43 | {F074E2AD-6EA1-469C-A1DB-B4C9195752DD}.Debug|x64.ActiveCfg = Debug|x64 44 | {F074E2AD-6EA1-469C-A1DB-B4C9195752DD}.Debug|x64.Build.0 = Debug|x64 45 | {F074E2AD-6EA1-469C-A1DB-B4C9195752DD}.Debug|x86.ActiveCfg = Debug|Win32 46 | {F074E2AD-6EA1-469C-A1DB-B4C9195752DD}.Debug|x86.Build.0 = Debug|Win32 47 | {F074E2AD-6EA1-469C-A1DB-B4C9195752DD}.Release|x64.ActiveCfg = Release|x64 48 | {F074E2AD-6EA1-469C-A1DB-B4C9195752DD}.Release|x64.Build.0 = Release|x64 49 | {F074E2AD-6EA1-469C-A1DB-B4C9195752DD}.Release|x86.ActiveCfg = Release|Win32 50 | {F074E2AD-6EA1-469C-A1DB-B4C9195752DD}.Release|x86.Build.0 = Release|Win32 51 | {435743A5-3B6E-4D8B-B19F-F95F09552592}.Debug|x64.ActiveCfg = Debug|x64 52 | {435743A5-3B6E-4D8B-B19F-F95F09552592}.Debug|x64.Build.0 = Debug|x64 53 | {435743A5-3B6E-4D8B-B19F-F95F09552592}.Debug|x86.ActiveCfg = Debug|Win32 54 | {435743A5-3B6E-4D8B-B19F-F95F09552592}.Debug|x86.Build.0 = Debug|Win32 55 | {435743A5-3B6E-4D8B-B19F-F95F09552592}.Release|x64.ActiveCfg = Release|x64 56 | {435743A5-3B6E-4D8B-B19F-F95F09552592}.Release|x64.Build.0 = Release|x64 57 | {435743A5-3B6E-4D8B-B19F-F95F09552592}.Release|x86.ActiveCfg = Release|Win32 58 | {435743A5-3B6E-4D8B-B19F-F95F09552592}.Release|x86.Build.0 = Release|Win32 59 | {34F17D6C-6E63-4A18-8F3F-2B797BB5BC0F}.Debug|x64.ActiveCfg = Debug|x64 60 | {34F17D6C-6E63-4A18-8F3F-2B797BB5BC0F}.Debug|x64.Build.0 = Debug|x64 61 | {34F17D6C-6E63-4A18-8F3F-2B797BB5BC0F}.Debug|x86.ActiveCfg = Debug|Win32 62 | {34F17D6C-6E63-4A18-8F3F-2B797BB5BC0F}.Debug|x86.Build.0 = Debug|Win32 63 | {34F17D6C-6E63-4A18-8F3F-2B797BB5BC0F}.Release|x64.ActiveCfg = Release|x64 64 | {34F17D6C-6E63-4A18-8F3F-2B797BB5BC0F}.Release|x64.Build.0 = Release|x64 65 | {34F17D6C-6E63-4A18-8F3F-2B797BB5BC0F}.Release|x86.ActiveCfg = Release|Win32 66 | {34F17D6C-6E63-4A18-8F3F-2B797BB5BC0F}.Release|x86.Build.0 = Release|Win32 67 | {F64ACEB1-E889-430B-BA67-CA36040DAE8C}.Debug|x64.ActiveCfg = Debug|x64 68 | {F64ACEB1-E889-430B-BA67-CA36040DAE8C}.Debug|x64.Build.0 = Debug|x64 69 | {F64ACEB1-E889-430B-BA67-CA36040DAE8C}.Debug|x86.ActiveCfg = Debug|Win32 70 | {F64ACEB1-E889-430B-BA67-CA36040DAE8C}.Debug|x86.Build.0 = Debug|Win32 71 | {F64ACEB1-E889-430B-BA67-CA36040DAE8C}.Release|x64.ActiveCfg = Release|x64 72 | {F64ACEB1-E889-430B-BA67-CA36040DAE8C}.Release|x64.Build.0 = Release|x64 73 | {F64ACEB1-E889-430B-BA67-CA36040DAE8C}.Release|x86.ActiveCfg = Release|Win32 74 | {F64ACEB1-E889-430B-BA67-CA36040DAE8C}.Release|x86.Build.0 = Release|Win32 75 | {13668D06-F8DE-42DC-B440-97C5555C3E63}.Debug|x64.ActiveCfg = Debug|x64 76 | {13668D06-F8DE-42DC-B440-97C5555C3E63}.Debug|x64.Build.0 = Debug|x64 77 | {13668D06-F8DE-42DC-B440-97C5555C3E63}.Debug|x86.ActiveCfg = Debug|Win32 78 | {13668D06-F8DE-42DC-B440-97C5555C3E63}.Debug|x86.Build.0 = Debug|Win32 79 | {13668D06-F8DE-42DC-B440-97C5555C3E63}.Release|x64.ActiveCfg = Release|x64 80 | {13668D06-F8DE-42DC-B440-97C5555C3E63}.Release|x64.Build.0 = Release|x64 81 | {13668D06-F8DE-42DC-B440-97C5555C3E63}.Release|x86.ActiveCfg = Release|Win32 82 | {13668D06-F8DE-42DC-B440-97C5555C3E63}.Release|x86.Build.0 = Release|Win32 83 | {24B6FBBD-52A1-4A02-A042-066301ADC7E9}.Debug|x64.ActiveCfg = Debug|x64 84 | {24B6FBBD-52A1-4A02-A042-066301ADC7E9}.Debug|x64.Build.0 = Debug|x64 85 | {24B6FBBD-52A1-4A02-A042-066301ADC7E9}.Debug|x86.ActiveCfg = Debug|Win32 86 | {24B6FBBD-52A1-4A02-A042-066301ADC7E9}.Debug|x86.Build.0 = Debug|Win32 87 | {24B6FBBD-52A1-4A02-A042-066301ADC7E9}.Release|x64.ActiveCfg = Release|x64 88 | {24B6FBBD-52A1-4A02-A042-066301ADC7E9}.Release|x64.Build.0 = Release|x64 89 | {24B6FBBD-52A1-4A02-A042-066301ADC7E9}.Release|x86.ActiveCfg = Release|Win32 90 | {24B6FBBD-52A1-4A02-A042-066301ADC7E9}.Release|x86.Build.0 = Release|Win32 91 | {DC7637D0-989F-474E-899D-3A38792D6B57}.Debug|x64.ActiveCfg = Debug|x64 92 | {DC7637D0-989F-474E-899D-3A38792D6B57}.Debug|x64.Build.0 = Debug|x64 93 | {DC7637D0-989F-474E-899D-3A38792D6B57}.Debug|x86.ActiveCfg = Debug|Win32 94 | {DC7637D0-989F-474E-899D-3A38792D6B57}.Debug|x86.Build.0 = Debug|Win32 95 | {DC7637D0-989F-474E-899D-3A38792D6B57}.Release|x64.ActiveCfg = Release|x64 96 | {DC7637D0-989F-474E-899D-3A38792D6B57}.Release|x64.Build.0 = Release|x64 97 | {DC7637D0-989F-474E-899D-3A38792D6B57}.Release|x86.ActiveCfg = Release|Win32 98 | {DC7637D0-989F-474E-899D-3A38792D6B57}.Release|x86.Build.0 = Release|Win32 99 | EndGlobalSection 100 | GlobalSection(SolutionProperties) = preSolution 101 | HideSolutionNode = FALSE 102 | EndGlobalSection 103 | GlobalSection(ExtensibilityGlobals) = postSolution 104 | SolutionGuid = {FDF64D84-8217-4C3F-998F-2B6B0C3AF42E} 105 | EndGlobalSection 106 | EndGlobal 107 | -------------------------------------------------------------------------------- /WeChook/WeChook.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "json.hpp" 4 | #include "../Socket/Socket.h" 5 | #include "../MessageDispatcher/MessageDispatcher.h" 6 | #include "../HooksManager/HooksManager.h" 7 | #include "../Hook/Hook_SendMsg.h" 8 | #include "../Hook/Hook_RecvMsg.h" 9 | #include "../Hook/Hook_Eject.h" 10 | 11 | 12 | void th_MainLoop() { 13 | Socket sock; 14 | char recvBuffer[DEFAULT_BUFLEN]; 15 | 16 | HooksManager hooksManager; 17 | 18 | Hook_SendMsg hook_sm(&sock); 19 | Hook_RecvMsg hook_rm(&sock); 20 | Hook_Eject hook_ej(&sock, &hooksManager); 21 | 22 | hooksManager.addHook(&hook_sm); 23 | hooksManager.addHook(&hook_rm); 24 | hooksManager.addHook(&hook_ej); 25 | 26 | MessageDispatcher md; 27 | md.addEntry("SendMessage", [&hook_sm](MessageDispatcher::DispArg args)->int 28 | { 29 | string wxid_str = args[0]; 30 | string msgContent_str = args[1]; 31 | hook_sm.SendStringMessage(wxid_str, msgContent_str); 32 | return 0; 33 | }); 34 | md.addEntry("EjectHooks", [&hook_ej](MessageDispatcher::DispArg args)->int { 35 | hook_ej.EjectHooks(); 36 | return 0; 37 | }); 38 | 39 | hooksManager.injectHooks(); 40 | 41 | while (1) { 42 | int pullRet = sock.pull(recvBuffer, DEFAULT_BUFLEN); 43 | if (pullRet <= 0) 44 | break; 45 | 46 | std::string so(recvBuffer); 47 | auto j = nlohmann::json::parse(so); 48 | 49 | string c = j["cmd"]; 50 | vector a = j["args"]; 51 | 52 | md.runInThread(c, a); 53 | } 54 | hooksManager.ejectHooks(); 55 | sock.~Socket(); 56 | } 57 | 58 | BOOL WINAPI DllMain( 59 | HINSTANCE hinstDLL, // handle to DLL module 60 | DWORD fdwReason, // reason for calling function 61 | LPVOID lpReserved) // reserved 62 | { 63 | // Perform actions based on the reason for calling. 64 | switch (fdwReason) 65 | { 66 | case DLL_PROCESS_ATTACH: 67 | CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)th_MainLoop, NULL, 0, NULL); 68 | break; 69 | 70 | case DLL_THREAD_ATTACH: 71 | // Do thread-specific initialization. 72 | break; 73 | 74 | case DLL_THREAD_DETACH: 75 | // Do thread-specific cleanup. 76 | break; 77 | 78 | case DLL_PROCESS_DETACH: 79 | // Perform any necessary cleanup. 80 | break; 81 | } 82 | 83 | return TRUE; // Successful DLL_PROCESS_ATTACH. 84 | } 85 | -------------------------------------------------------------------------------- /WeChook/WeChook.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 | 15.0 23 | {FBBCFFF2-42B9-4857-8E10-5A8FBE3F9F6A} 24 | Win32Proj 25 | WeChook 26 | 10.0.17763.0 27 | 28 | 29 | 30 | DynamicLibrary 31 | true 32 | v141 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v141 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v141 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v141 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 | true 75 | 76 | 77 | true 78 | 79 | 80 | false 81 | 82 | 83 | false 84 | 85 | 86 | 87 | NotUsing 88 | Level3 89 | Disabled 90 | true 91 | WIN32;_DEBUG;_CONSOLE;WINDOWS;%(PreprocessorDefinitions) 92 | true 93 | pch.h 94 | %(AdditionalIncludeDirectories) 95 | 96 | 97 | Console 98 | true 99 | 100 | 101 | 102 | 103 | Use 104 | Level3 105 | Disabled 106 | true 107 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 108 | true 109 | pch.h 110 | 111 | 112 | Console 113 | true 114 | 115 | 116 | 117 | 118 | Use 119 | Level3 120 | MaxSpeed 121 | true 122 | true 123 | true 124 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 125 | true 126 | pch.h 127 | 128 | 129 | Console 130 | true 131 | true 132 | true 133 | 134 | 135 | 136 | 137 | Use 138 | Level3 139 | MaxSpeed 140 | true 141 | true 142 | true 143 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 144 | true 145 | pch.h 146 | 147 | 148 | Console 149 | true 150 | true 151 | true 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | {13668d06-f8de-42dc-b440-97c5555c3e63} 160 | 161 | 162 | {34f17d6c-6e63-4a18-8f3f-2b797bb5bc0f} 163 | 164 | 165 | {24b6fbbd-52a1-4a02-a042-066301adc7e9} 166 | 167 | 168 | {f074e2ad-6ea1-469c-a1db-b4c9195752dd} 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /WeChook/WeChook.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;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 | -------------------------------------------------------------------------------- /clean.bat: -------------------------------------------------------------------------------- 1 | :clean.bat 2 | 3 | del /s *.vc.db* *.ncb *.pch *.ilk *.idb *.pdb *.obj *.sdf *.ipch ipch 4 | 5 | :del /s *.old 6 | :del /s *.ncb 7 | :del /s *.pch 8 | :del /s *.ilk 9 | :del /s *.idb 10 | :del /s *.pdb 11 | :del /s *.obj 12 | :del /s *.sdf 13 | 14 | 15 | -------------------------------------------------------------------------------- /compile.bat: -------------------------------------------------------------------------------- 1 | devenv WeChook.sln /rebuild --------------------------------------------------------------------------------