diff --git a/test/dllmain.cpp b/test/dllmain.cpp index 5256b38..f696745 100644 --- a/test/dllmain.cpp +++ b/test/dllmain.cpp @@ -59,6 +59,7 @@ void LenheartThread() LenheartBase::CBASE64 bb; ippack += "nima"; + std::string rsastring = bb.RsaPriEncrypt(ippack, Pri_key); std::string enstring = bb.encode(rsastring); diff --git a/test/hook.cpp b/test/hook.cpp index 03c00c6..42bc3b6 100644 --- a/test/hook.cpp +++ b/test/hook.cpp @@ -34,6 +34,17 @@ void hook::H_Register_Pack(void* Ecx) sock::R_Register_Pack(); } + +//Hook文字 +#ifdef CODEDRAW + extern struct CodeDrawObj + { + int Color; + std::string str; + }; + extern std::map< std::string, CodeDrawObj>CodeDrawMap; +#endif + //HOOK绘制字体 void _fastcall hook::H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4, int a5, int a6) { @@ -47,7 +58,20 @@ void _fastcall hook::H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4, std::string GameStr; DNFTOOL::Wchar_tToString(GameStr, clone); delete[]clone; - + //std::cout << GameStr << std::endl; + //Hook文字 +#ifdef CODEDRAW + if (CodeDrawMap.count(GameStr) == 1) + { + wchar_t* str = DNFTOOL::char2wchar(CodeDrawMap[GameStr].str.c_str()); + DrawCodeF(thisc, Seat, a3, a4, CodeDrawMap[GameStr].Color, (int)str); + delete[]str; + return; + } +#endif + + + //Hook游戏设置窗口CallBack ui/optionwindow #ifdef SETTINGWINDOWS if (GameStr.find("倾泪寒自定义设置") != std::string::npos) @@ -702,8 +726,8 @@ int hook::RegisterHook() #ifdef DRAWITEM //HOOK Item绘制 - MH_CreateHook((void*)0x7AA800, &newsub7AA800, reinterpret_cast(&sub7AA800)); - MH_EnableHook((void*)0x7AA800); + //MH_CreateHook((void*)0x7AA800, &newsub7AA800, reinterpret_cast(&sub7AA800)); + //MH_EnableHook((void*)0x7AA800); #endif #ifdef GET_EXE_STR @@ -712,6 +736,11 @@ int hook::RegisterHook() MH_EnableHook((void*)0x1220590); #endif +#ifdef HOOKDRAWITEM + MH_CreateHook((void*)0x11A8F60, &newsub11A8F60, reinterpret_cast(&sub11A8F60)); + MH_EnableHook((void*)0x11A8F60); +#endif // HOOKDRAWITEM + //获取坐标 //MH_CreateHook((void*)0x48c690, &NewGetItemPos, reinterpret_cast(&GetItemPos)); //MH_EnableHook((void*)0x48c690); @@ -745,9 +774,6 @@ int hook::RegisterHook() //MH_CreateHook((void*)0x1358A60, &NewSqPushStringFunc, reinterpret_cast(&OldSQPushString)); //MH_EnableHook((void*)0x1358A60); - //MH_CreateHook((void*)0x11A8F60, &newsub11A8F60, reinterpret_cast(&sub11A8F60)); - //MH_EnableHook((void*)0x11A8F60); - // HOOK exe 调用文本进 松鼠虚拟机 //MH_CreateHook((void*)0x135B2C0, &NewSQ_Compilebuffer, reinterpret_cast(&OldSQ_Compilebuffer)); diff --git a/test/libMinHook.x86.lib b/test/libMinHook.x86.lib index 30664b9..df8357d 100644 Binary files a/test/libMinHook.x86.lib and b/test/libMinHook.x86.lib differ diff --git a/test/pch.h b/test/pch.h index dd6c23b..f9896e5 100644 --- a/test/pch.h +++ b/test/pch.h @@ -46,7 +46,9 @@ #define CREAT_CHR_UI "鍒涘缓瑙掕壊 寮鍚" #define GET_EXE_STR "鑾峰彇EXE瀛楃涓茬储寮 寮鍚" #define DRAWITEM "缁樺埗ITEM 寮鍚" +#define HOOKDRAWITEM "HOOK缁樺埗ITEM 寮鍚" #define SETTINGWINDOWS "璁剧疆绐楀彛HOOK 寮鍚" +#define CODEDRAW "HOOK鏂囧瓧 寮鍚" #define RecoverySystem "鍥炴敹绯荤粺 寮鍚" #define Inventory_M_Pos "鑳屽寘榧犳爣浣嶇疆HOOK 寮鍚"//(寮鍚洖鏀剁郴缁熼渶瑕侀紶鏍囦綅缃敮鎸) diff --git a/test/squirrel.cpp b/test/squirrel.cpp index a5a08df..be6f449 100644 --- a/test/squirrel.cpp +++ b/test/squirrel.cpp @@ -935,6 +935,44 @@ int squirrel::RegisterItemColor_STL(uint32_t v) } #endif +//设置文字HOOK +#ifdef CODEDRAW +struct CodeDrawObj +{ + int Color; + std::string str; +}; +std::map< std::string , CodeDrawObj>CodeDrawMap; +int squirrel::RegisterCodeDraw_STL(uint32_t v) +{ + int Clolr; + wchar_t* Key; + wchar_t* OutPutBuffer; + int ParameterNum = SQGetTop(v); + if (ParameterNum == 4) + { + SQGetString(v, 2, &Key); + SQGetInt(v, 3, &Clolr); + SQGetString(v, 4, &OutPutBuffer); + + char* OutPutKey = DNFTOOL::SquirrelU2W(Key); + std::string BufferKey = OutPutKey; + delete[]OutPutKey; + + char* OutPutText = DNFTOOL::SquirrelU2W(OutPutBuffer); + std::string str = OutPutText; + delete[]OutPutText; + + CodeDrawObj buffobj; + buffobj.Color = Clolr; + buffobj.str = str; + CodeDrawMap[BufferKey] = buffobj; + } + return 0; +} +#endif + + //普通 STL #if defined NORMAL_STL //查询 类型容器 @@ -1904,6 +1942,11 @@ void squirrel::R_Register_Nut() RegisterNutApi(L"L_RegisterItemColor_STL", squirrel::RegisterItemColor_STL);//注册Item颜色 #endif + +#ifdef CODEDRAW + RegisterNutApi(L"L_RegisterCodeDraw_STL", squirrel::RegisterCodeDraw_STL);//注册文字绘制HOOK +#endif + //龙盒 #if defined DRAGONBOX_SWITCH //RegisterNutApi(L"L_Get_DragonModel", squirrel::Get_DragonModel);//获取龙盒模式 @@ -1917,6 +1960,8 @@ void squirrel::R_Register_Nut() //线程循环调用Sqr回调函数 void squirrel::SqrCallBackFunc() { +#ifndef DOFILE_HOOK +#ifndef SELL static int SqrCallBackFuncTimer = clock(); int NowTime = clock(); if ((NowTime - SqrCallBackFuncTimer) >= 2000) @@ -1935,7 +1980,8 @@ void squirrel::SqrCallBackFunc() SqrCallBackFuncTimer = NowTime; } - +#endif // !DOFILE_HOOK +#endif // !DOFILE_HOOK } diff --git a/test/squirrel.h b/test/squirrel.h index 3b17ad9..dbc731f 100644 --- a/test/squirrel.h +++ b/test/squirrel.h @@ -249,6 +249,7 @@ public://NUT API static int NewWindows(uint32_t v);//新建窗口 static int SetSlot(uint32_t v);//设置UI槽坐标 static int RegisterItemColor_STL(uint32_t v);//设置项目颜色 + static int RegisterCodeDraw_STL(uint32_t v);//设置项目颜色 static int Sout(uint32_t v);//输出 public://发包 API