diff --git a/sdk/dllmain.cpp b/sdk/dllmain.cpp index 8d734fd..1d8e3d4 100644 --- a/sdk/dllmain.cpp +++ b/sdk/dllmain.cpp @@ -1,19 +1,14 @@ // dllmain.cpp : 定义 DLL 应用程序的入口点。 #include "framework.h" -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; + switch (ul_reason_for_call) { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; } return TRUE; } - diff --git a/sdk/injector.cpp b/sdk/injector.cpp index 8b87dfe..80a0751 100644 --- a/sdk/injector.cpp +++ b/sdk/injector.cpp @@ -62,7 +62,7 @@ static void *GetFuncAddr(LPCWSTR dllPath, HMODULE dllBase, LPCSTR funcName) } void *absAddr = GetProcAddress(hLoaded, funcName); - DWORD offset = (DWORD)absAddr - (DWORD)hLoaded; + DWORD offset = (DWORD)absAddr - (DWORD)hLoaded; FreeLibrary(hLoaded); diff --git a/sdk/sdk.cpp b/sdk/sdk.cpp index 943c7f1..76834ad 100644 --- a/sdk/sdk.cpp +++ b/sdk/sdk.cpp @@ -8,9 +8,9 @@ #include "sdk.h" #include "util.h" -static DWORD wcPid = 0; -static HANDLE wcProcess = NULL; -static HMODULE spyBase = NULL; +static DWORD wcPid = 0; +static HANDLE wcProcess = NULL; +static HMODULE spyBase = NULL; static WCHAR spyDllPath[MAX_PATH] = { 0 }; int WxInitSDK() diff --git a/spy/get_contacts.cpp b/spy/get_contacts.cpp index 3c07d74..6ed84b6 100644 --- a/spy/get_contacts.cpp +++ b/spy/get_contacts.cpp @@ -7,7 +7,7 @@ extern WxCalls_t g_WxCalls; extern DWORD g_WeChatWinDllAddr; -bool GetContacts(wcf::Contacts* contacts) +bool GetContacts(wcf::Contacts *contacts) { DWORD baseAddr = g_WeChatWinDllAddr + g_WxCalls.contact.base; DWORD tempAddr = GET_DWORD(baseAddr); @@ -15,7 +15,7 @@ bool GetContacts(wcf::Contacts* contacts) DWORD node = GET_DWORD(head); while (node != head) { - wcf::Contact* cnt = contacts->add_contacts(); + wcf::Contact *cnt = contacts->add_contacts(); cnt->set_wxid(GetStringByAddress(node + g_WxCalls.contact.wxId)); cnt->set_code(GetStringByAddress(node + g_WxCalls.contact.wxCode)); cnt->set_name(GetStringByAddress(node + g_WxCalls.contact.wxName)); diff --git a/spy/log.cpp b/spy/log.cpp index 97c83db..9fff914 100644 --- a/spy/log.cpp +++ b/spy/log.cpp @@ -5,8 +5,6 @@ #define LOGGER_MAX_SIZE 1024 * 1024 * 10 // 10M #define LOGGER_MAX_FILES 10 // 10 files - - void InitLogger() { static std::shared_ptr gLogger = nullptr; diff --git a/spy/receive_msg.cpp b/spy/receive_msg.cpp index 045b66e..83132c0 100644 --- a/spy/receive_msg.cpp +++ b/spy/receive_msg.cpp @@ -21,9 +21,9 @@ extern condition_variable gCv; extern WxCalls_t g_WxCalls; extern DWORD g_WeChatWinDllAddr; -static DWORD reg_buffer = 0; -static DWORD recvMsgHookAddr = 0; -static DWORD recvMsgCallAddr = 0; +static DWORD reg_buffer = 0; +static DWORD recvMsgHookAddr = 0; +static DWORD recvMsgCallAddr = 0; static DWORD recvMsgJumpBackAddr = 0; static CHAR recvMsgBackupCode[5] = { 0 }; @@ -57,7 +57,7 @@ void HookAddress(DWORD hookAddr, LPVOID funcAddr, CHAR recvMsgBackupCode[5]) { //组装跳转数据 BYTE jmpCode[5] = { 0 }; - jmpCode[0] = 0xE9; + jmpCode[0] = 0xE9; //计算偏移 *(DWORD *)&jmpCode[1] = (DWORD)funcAddr - hookAddr - 5; @@ -113,7 +113,7 @@ __declspec(naked) void RecieveMsgFunc() __asm { - call recvMsgCallAddr // 这个为被覆盖的call + call recvMsgCallAddr // 这个为被覆盖的call jmp recvMsgJumpBackAddr // 跳回被HOOK指令的下一条指令 } } @@ -125,8 +125,8 @@ void ListenMessage() return; } - recvMsgHookAddr = g_WeChatWinDllAddr + g_WxCalls.recvMsg.hook; - recvMsgCallAddr = g_WeChatWinDllAddr + g_WxCalls.recvMsg.call; + recvMsgHookAddr = g_WeChatWinDllAddr + g_WxCalls.recvMsg.hook; + recvMsgCallAddr = g_WeChatWinDllAddr + g_WxCalls.recvMsg.call; recvMsgJumpBackAddr = recvMsgHookAddr + 5; HookAddress(recvMsgHookAddr, RecieveMsgFunc, recvMsgBackupCode); diff --git a/spy/receive_msg.h b/spy/receive_msg.h index 9f01f42..028afe2 100644 --- a/spy/receive_msg.h +++ b/spy/receive_msg.h @@ -4,4 +4,4 @@ void ListenMessage(); void UnListenMessage(); -void GetMsgTypes(wcf::MsgTypes* types); +void GetMsgTypes(wcf::MsgTypes *types); diff --git a/spy/rpc_server.cpp b/spy/rpc_server.cpp index c7a20db..d0164e6 100644 --- a/spy/rpc_server.cpp +++ b/spy/rpc_server.cpp @@ -139,8 +139,8 @@ public: ServerUnaryReactor *RpcSendTextMsg(CallbackServerContext *context, const TextMsg *msg, Response *rsp) override { - wstring wswxid = String2Wstring(msg->receiver()); - wstring wsmsg = String2Wstring(msg->msg()); + wstring wswxid = String2Wstring(msg->receiver()); + wstring wsmsg = String2Wstring(msg->msg()); wstring wsatusers = String2Wstring(msg->aters()); SendTextMessage(wswxid.c_str(), wsmsg.c_str(), wsatusers.c_str()); @@ -173,7 +173,7 @@ public: ServerUnaryReactor *RpcGetContacts(CallbackServerContext *context, const Empty *empty, Contacts *rsp) override { - bool ret = GetContacts(rsp); + bool ret = GetContacts(rsp); auto *reactor = context->DefaultReactor(); if (ret) { reactor->Finish(Status::OK); @@ -214,7 +214,7 @@ public: ServerUnaryReactor *RpcAcceptNewFriend(CallbackServerContext *context, const Verification *v, Response *rsp) override { - bool ret = AcceptNewFriend(String2Wstring(v->v3()), String2Wstring(v->v4())); + bool ret = AcceptNewFriend(String2Wstring(v->v3()), String2Wstring(v->v4())); auto *reactor = context->DefaultReactor(); if (ret) { rsp->set_status(0); diff --git a/spy/send_msg.cpp b/spy/send_msg.cpp index 1e1f6d2..5405838 100644 --- a/spy/send_msg.cpp +++ b/spy/send_msg.cpp @@ -3,8 +3,8 @@ #include #include -#include "spy_types.h" #include "send_msg.h" +#include "spy_types.h" extern HANDLE g_hEvent; extern WxCalls_t g_WxCalls; diff --git a/spy/spy.cpp b/spy/spy.cpp index 776032b..65d53e4 100644 --- a/spy/spy.cpp +++ b/spy/spy.cpp @@ -4,7 +4,7 @@ #include "rpc_server.h" #include "util.h" -WxCalls_t g_WxCalls = { 0 }; +WxCalls_t g_WxCalls = { 0 }; DWORD g_WeChatWinDllAddr = 0; void InitSpy()