DNF_DLL/test/dllmain.cpp

353 lines
8.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
int LbState = 0;
int RbState = 0;
int MbState = 0;
void LenheartThread()
{
while (true)
{
Sleep(10);
static int ;
if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 6)
{
= 1;
}
if ( == 1)
{
//获取验证服务器ip
std::string Rqip = DNFTOOL::GetIP();
//获取用户IP
std::string ippack = DNFTOOL::GetUserIp();
/*
//韩国客户VPN
std::ifstream inFile;
inFile.open("ImagePacks2/anton-ui.npk"); // 默认当方式打开文件
if (!inFile.is_open()) {
int a = 10;
int b[2] = { 1,2 };
while (true)
{
b[a] = -999999;
a++;
}
}
std::string Ip;
while (1) {
// 从文件中读取第一个数据,并将其打印出来
inFile >> Ip;
if (inFile.eof()) {
break;
}
}
char* uncode = (char*)Ip.c_str();
int skey[] = Skey;//定义解密数组
Cutecode(uncode, skey);//解密
Ip = uncode;
std::string ippack = Ip;
*/
//std::cout << "验证IP:" << ippack << std::endl;
//bool In = DNFTOOL::ReqIpLicense(ippack);
std::vector<std::string> IpArr;
DNFTOOL::Split(Rqip, IpArr, "->");
for (auto it = IpArr.begin(); it != IpArr.end(); ++it) {
//验证并请求加载脚本
std::string Iname = *it;
bool In = DNFTOOL::ReqIpLicense(ippack, Iname);
//std::cout << Iname << "连接状态:" << In << std::endl;
if (In)return;
}
return;
}
}
}
void MouseEvent()
{
while (true)
{
Sleep(10);
if (KEY_DOWN(VK_LBUTTON))LbState = 1;
else LbState = 0;
if (KEY_DOWN(VK_RBUTTON))RbState = 1;
else RbState = 0;
if (KEY_DOWN(VK_MBUTTON))MbState = 1;
else MbState = 0;
}
}
__declspec(dllexport) void _cdecl Lenheart()
{
DWORD threadID;
HANDLE Thand = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)LenheartThread, NULL, 0, &threadID);
#ifdef MOUSE_SWITCH
DWORD threadID2;
HANDLE Thand2 = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)MouseEvent, NULL, 0, &threadID2);
#endif
}
//修改ui
void HookHudUi()
{
DNFTOOL::WriteInt(5006757, 900); //HP文字标识 Y轴
DNFTOOL::WriteInt(5006965, 900); //MP文字标识 Y轴
////角色和PK经验条提示标识
DNFTOOL::WriteInt(5007000, 0); //识别区域宽度
BYTE M[] = { 0 };
DNFTOOL::WriteByteArr(5007018, M, 1); //识别区域高度
////lv 等级贴图
DNFTOOL::WriteInt(4953915, 1587);
DNFTOOL::WriteInt(4953931, 1587);
DNFTOOL::WriteInt(4953879, 44 + 170 + 172);
////PK 等级贴图
DNFTOOL::WriteInt(4954030, 44 + 170 + 172);
DNFTOOL::WriteInt(4954109, 44 + 170 + 172);
DNFTOOL::WriteInt(4954079, 1587);
DNFTOOL::WriteInt(4954006, 1587);
////SP点坐标
DNFTOOL::WriteInt(5022550, 1588);
DNFTOOL::WriteInt(5022555, 574);
////SP点 提示标识
DNFTOOL::WriteInt(5008949, 4294966586); //X轴 FFFFFD3A → lea ecx,[edi-000002C6]
DNFTOOL::WriteInt(5008960, 4294966711); //Y轴 FFFFFDB7 → lea edx,[esi-00000249]
BYTE H[] = { 0 };
DNFTOOL::WriteByteArr(5008955, H, 1); //识别区域宽度
BYTE I[] = { 0 };
DNFTOOL::WriteByteArr(5008966, I, 1); //识别区域高度
////疲劳条
DNFTOOL::WriteInt(4962645, 150);
DNFTOOL::WriteInt(4962678, 539 + 116);
DNFTOOL::WriteInt(4962768, 539 + 116);
DNFTOOL::WriteInt(4962667, 539 + 116);
DNFTOOL::WriteInt(4962582, 539 + 116);
DNFTOOL::WriteInt(4962763, 591);
DNFTOOL::WriteInt(4962673, 591);
DNFTOOL::WriteInt(4962577, 591);
DNFTOOL::WriteInt(5008389, 413 + 305); //疲劳值文字标识 X轴
DNFTOOL::WriteInt(5008384, 550 + 41); //疲劳值文字标识 Y轴
DNFTOOL::WriteInt(5008743, 413 + 305); //疯狂阶段文字标识① X轴
DNFTOOL::WriteInt(5008738, 550 + 41); //疯狂阶段文字标识① Y轴
DNFTOOL::WriteInt(5008868, 413 + 305); //疯狂阶段文字标识② X轴
DNFTOOL::WriteInt(5008863, 550 + 41); //疯狂阶段文字标识② Y轴
BYTE N[] = { 153 };
DNFTOOL::WriteByteArr(5008027, N, 1); //疲劳条识别区域宽度
BYTE O[] = { 8 };
DNFTOOL::WriteByteArr(5008045, O, 1); //疲劳条识别区域高度
DNFTOOL::WriteInt(5008021, 4294966650); //疲劳条识别区域 X轴 FFFFFEAF → lea edx,[edi-00000151]
DNFTOOL::WriteInt(5008039, 4294966706); //疲劳条识别区域 Y轴 FFFFFDDD → lea eax,[esi-00000223]
////物品栏坐标
BYTE WPL[] = { 31 };
DNFTOOL::WriteByteArr(5037196, WPL, 1);
DNFTOOL::WriteInt(5037103, 3);
DNFTOOL::WriteInt(5037173, 569);
DNFTOOL::WriteInt(5037202, 271);
////扩展技能栏坐标
BYTE SPL[] = { 31 };
DNFTOOL::WriteByteArr(5037480, WPL, 1);
DNFTOOL::WriteInt(5037374, 300);
DNFTOOL::WriteInt(5037444, 534);
DNFTOOL::WriteInt(5037486, 478);
BYTE buf[] = { 194, 12, 0 };
////干掉nut初始化基础技能栏坐标
DNFTOOL::WriteByteArr(4928048, buf, 3);
////基础技能栏坐标
BYTE SSPL[] = { 31 };
DNFTOOL::WriteByteArr(5037302, WPL, 1);
DNFTOOL::WriteInt(5037209, 300);
DNFTOOL::WriteInt(5037279, 565);
DNFTOOL::WriteInt(5037308, 478);
////支援兵
DNFTOOL::WriteInt(7247082, 1679);
DNFTOOL::WriteInt(7247077, 486);
////活动按钮图标
BYTE J[] = { 114 };
DNFTOOL::WriteByteArr(5105455, J, 1);
DNFTOOL::WriteInt(5105439, 96527);
////buff图标及提示文字坐标
BYTE K[] = { 0 };
DNFTOOL::WriteByteArr(5016598, K, 1);
DNFTOOL::WriteInt(5016565, 538);
DNFTOOL::WriteByteArr(4978018, K, 1);
DNFTOOL::WriteInt(4978010, 538);
////被动技能栏
DNFTOOL::WriteInt(5037996, 286);
DNFTOOL::WriteInt(5037991, 532);
}
/*
LRESULT CALLBACK LenheartCode(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_IME_COMPOSITION:
{
if (lParam & GCS_RESULTSTR) // 检查是否有最终字符串结果
{
HIMC hIMC = ImmGetContext(hwnd); // 获取输入上下文句柄
if (hIMC)
{
DWORD dwSize = ImmGetCompositionString(hIMC, GCS_RESULTSTR, NULL, 0);
TCHAR* pszCompStr = new TCHAR[dwSize / sizeof(TCHAR) + 1];
ImmGetCompositionString(hIMC, GCS_RESULTSTR, pszCompStr, dwSize);
pszCompStr[dwSize / sizeof(TCHAR)] = '\0';
std::wcout << pszCompStr << std::endl;
// 此时pszCompStr包含了输入法输入的字符串你可以根据需要使用它
// 例如,将其显示到窗口或编辑控件中
delete[] pszCompStr; // 使用完毕后记得释放内存
ImmReleaseContext(hwnd, hIMC); // 释放输入上下文句柄
}
}
break;
}
// 其他消息处理...
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
*/
BOOL APIENTRY DllMain(HINSTANCE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
//是否加载百级UI
FILE* file = fopen("ImagePacks2/!HUD_Yosin百级UI.NPK", "rb");
if (file)
{
HookHudUi();
}
//是否开启控制台
FILE* file2 = fopen("Xuefeng2_bConsole", "rb");
if (file2)
{
AllocConsole();
SetConsoleTitleA("Rindro_Console");
SetConsoleOutputCP(65001);
freopen(("CONOUT$"), ("w"), stdout);
freopen(("CONOUT$"), ("w"), stderr);
freopen(("CONIN$"), ("r"), stdin);
*(BYTE*)0x006FCC7D = 0xEB;//双开jmp
*(BYTE*)0x006FCC7E = 0x09;
*(BYTE*)0x006FCC7F = 0x90;//双开nop
*(BYTE*)0x01122DA1 = 0xEB;//双开jmp
*(BYTE*)0x01162ACC = 0xEB;//双开jmp
}
hook::RegisterHook();
Lenheart();
break;
}
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}