心态爆炸
This commit is contained in:
parent
1166be0471
commit
378f4ba664
|
|
@ -38,24 +38,9 @@ uint32_t NewPushString(uint32_t v, wchar_t* f, int freeVarsCnt)
|
||||||
return MLSqPushString(v, f, freeVarsCnt);
|
return MLSqPushString(v, f, freeVarsCnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
static NoticeCall _Noticecall = NULL;
|
|
||||||
|
|
||||||
void tihuancall(DWORD a1, DWORD a2, DWORD a3, DWORD a4, DWORD a5, DWORD a6, DWORD a7, DWORD a8, DWORD a9, DWORD a10, DWORD a11, DWORD a12, DWORD a13)
|
|
||||||
{
|
|
||||||
std::cout << "true" << std::endl;
|
|
||||||
|
|
||||||
std::cout << a1 << std::endl;
|
|
||||||
std::cout << a2 << std::endl;
|
|
||||||
std::cout << a3 << std::endl;
|
|
||||||
std::cout << a4 << std::endl;
|
|
||||||
//std::cout << a5 << std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
//return _Noticecall(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
int HOOK()
|
int HOOK()
|
||||||
{
|
{
|
||||||
std::cout << u8"开始hook" << std::endl;
|
std::cout << u8"开始hook" << std::endl;
|
||||||
|
|
@ -63,7 +48,7 @@ int HOOK()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (MH_CreateHook((void*)0x9536C0, &tihuancall,
|
if (MH_CreateHook((void*)0x9536C0, &tihuancall,
|
||||||
reinterpret_cast<void**>(&_Noticecall)) != MH_OK)
|
reinterpret_cast<void**>(&BCBB)) != MH_OK)
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
@ -98,62 +83,6 @@ int HOOK()
|
||||||
|
|
||||||
void testcall()
|
void testcall()
|
||||||
{
|
{
|
||||||
//SQdofile(GetSqVm(), L"1.cpp", false, false);
|
|
||||||
//SQloadfile(GetSqVm(), L"1.cpp", false);
|
|
||||||
|
|
||||||
//SQDofile(GetSqVm(),L"1.cpp",0,0);
|
|
||||||
//std::cout << gm(0x186FB828) << std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
//_SendpacksType(*_SendClass, 0, 0x2D);
|
|
||||||
//_SendPacks();
|
|
||||||
|
|
||||||
/*
|
|
||||||
_SendpacksType(*_SendClass, 0, 75);
|
|
||||||
_SendPacksByte(*_SendClass, 0, 2);
|
|
||||||
_SendPacksByte(*_SendClass, 0, 2);
|
|
||||||
_SendPacks();
|
|
||||||
|
|
||||||
_SendpacksType(*_SendClass, 0, 75);
|
|
||||||
_SendPacksByte(*_SendClass, 0, 1);
|
|
||||||
_SendPacksByte(*_SendClass, 0, 2);
|
|
||||||
_SendPacks();
|
|
||||||
|
|
||||||
|
|
||||||
_SendpacksType(*_SendClass, 0, 37);
|
|
||||||
_SendPacksWord(*_SendClass, 0, 636);
|
|
||||||
_SendPacksWord(*_SendClass, 0, 268);
|
|
||||||
_SendPacksByte(*_SendClass, 0, 5);
|
|
||||||
_SendPacksWord(*_SendClass, 0, 200);
|
|
||||||
_SendPacks();
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
_SendpacksType(*_SendClass, 0, 38);
|
|
||||||
_SendPacksByte(*_SendClass, 0, 1);
|
|
||||||
_SendPacksByte(*_SendClass, 0, 0);
|
|
||||||
_SendPacksWord(*_SendClass, 0, 1109);
|
|
||||||
_SendPacksWord(*_SendClass, 0, 268);
|
|
||||||
_SendPacksByte(*_SendClass, 0, 5);
|
|
||||||
_SendPacksWord(*_SendClass, 0, 0);
|
|
||||||
_SendPacksWord(*_SendClass, 0, 0);
|
|
||||||
_SendPacks();
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
_SendpacksType(*_SendClass, 0, 17);
|
|
||||||
_SendPacksByte(*_SendClass, 3, 1);
|
|
||||||
_SendPacksWord(*_SendClass, 56, 1);
|
|
||||||
_SendPacksDWord(*_SendClass, 0, 1);
|
|
||||||
_SendPacksDWord(*_SendClass, 6, 1);
|
|
||||||
_SendPacks();
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
_SendpacksType(*_SendClass, 0, 0x3);
|
|
||||||
_SendPacks();
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,7 +138,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
|
||||||
switch (ul_reason_for_call)
|
switch (ul_reason_for_call)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
//HOOK();
|
|
||||||
Lenheart();
|
Lenheart();
|
||||||
break;
|
break;
|
||||||
case DLL_THREAD_ATTACH:
|
case DLL_THREAD_ATTACH:
|
||||||
|
|
|
||||||
12
test/pch.h
12
test/pch.h
|
|
@ -263,7 +263,17 @@ static SendPacksWORD _SendPacksWord = (SendPacksWORD)0x1128580;
|
||||||
typedef int(__fastcall* SendPacksDWORD)(DWORD thisc, int Seat, int Parm);
|
typedef int(__fastcall* SendPacksDWORD)(DWORD thisc, int Seat, int Parm);
|
||||||
static SendPacksDWORD _SendPacksDWord = (SendPacksDWORD)0x11285B0;
|
static SendPacksDWORD _SendPacksDWord = (SendPacksDWORD)0x11285B0;
|
||||||
|
|
||||||
|
|
||||||
|
//公告Class this地址
|
||||||
|
typedef DWORD NoticeClass;
|
||||||
|
static NoticeClass* _NoticeClass = (NoticeClass*)0x1A5FB20;
|
||||||
//公告CALL
|
//公告CALL
|
||||||
typedef void( *NoticeCall)(int a1, int a2, int a3, int a4, int a5, int a6, int a7);
|
typedef void(__fastcall* NoticeCall)(DWORD thisc, int Seat , char* a1, DWORD a2, DWORD a3, DWORD a4, DWORD a5, DWORD a6, DWORD a7);
|
||||||
static NoticeCall _Noticecall = (NoticeCall)0x9536C0;
|
static NoticeCall _Noticecall = (NoticeCall)0x9536C0;
|
||||||
|
|
||||||
|
//公告CALL
|
||||||
|
typedef void(__fastcall* NoticeTCall)(DWORD thisc, DWORD Seat, DWORD a1, char* a2, DWORD a3);
|
||||||
|
static NoticeTCall _NoticeTcall = (NoticeTCall)0xE6E070;
|
||||||
|
|
||||||
|
|
||||||
#endif //PCH_H
|
#endif //PCH_H
|
||||||
|
|
|
||||||
190
test/函数块.cpp
190
test/函数块.cpp
|
|
@ -237,86 +237,90 @@ int GetEquAddr(int addr)
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
char* UnicodeToAnsi(const wchar_t* szStr, char* pResult, int maxLen)
|
||||||
|
{
|
||||||
|
if (NULL == pResult)
|
||||||
|
return NULL;
|
||||||
|
int nLen = WideCharToMultiByte(CP_ACP, 0, szStr, -1, NULL, 0, NULL, NULL);
|
||||||
|
if (0 == nLen)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (nLen >= maxLen)
|
||||||
|
nLen = maxLen;
|
||||||
|
WideCharToMultiByte(CP_ACP, 0, szStr, -1, pResult, nLen, NULL, NULL);
|
||||||
|
return pResult;
|
||||||
|
}
|
||||||
|
wchar_t* AnsiToUnicode(const char* szStr, wchar_t* pResult, int maxLen)
|
||||||
|
{
|
||||||
|
if (NULL == pResult)
|
||||||
|
return NULL;
|
||||||
|
int nLen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szStr, -1, NULL, 0);
|
||||||
|
if (0 == nLen)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (nLen >= maxLen)
|
||||||
|
nLen = maxLen;
|
||||||
|
|
||||||
|
nLen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szStr, -1, pResult, nLen);
|
||||||
|
if (0 == nLen)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return pResult;
|
||||||
|
}
|
||||||
|
|
||||||
//加载
|
//加载
|
||||||
static int SQloadfile(uint32_t v, const wchar_t* filename, bool printerror)
|
static int SQloadfile(uint32_t v, const wchar_t* filename, bool printerror)
|
||||||
{
|
{
|
||||||
SQFILE* file = SQfopen(filename, L"rb+");
|
//wchar_t* 转 char*
|
||||||
//FILE* file;
|
int size = wcslen(filename);
|
||||||
//file = fopen(filename, "rb");
|
char* fname = (char*)new char[size];
|
||||||
int ret;
|
UnicodeToAnsi(filename, fname, size);
|
||||||
unsigned short us;
|
|
||||||
unsigned char uc;
|
FILE* file;
|
||||||
|
file = fopen(fname, "rb+");
|
||||||
LSQLEXREADFUNC func = SQ_io_file_lexfeed_ASCII;
|
LSQLEXREADFUNC func = SQ_io_file_lexfeed_ASCII;
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
ret = SQfread(&us, 1, 2, file);
|
//求得文件的大小
|
||||||
if (ret != 2)
|
fseek(file, 0, SEEK_END);
|
||||||
{
|
int size = ftell(file);
|
||||||
us = 0;
|
rewind(file);
|
||||||
}
|
|
||||||
if (us == 0xFAFA)
|
|
||||||
{
|
|
||||||
SQfseek(file, 0, 2);
|
|
||||||
if (SQ_Readclosure(v, SQ_File_read, file) > 0)
|
|
||||||
{
|
|
||||||
SQ__Fclose(file);
|
|
||||||
return SQ_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (us)
|
|
||||||
{
|
|
||||||
case 0xFFFE: func = SQ_io_file_lexfeed_UCS2_BE; break;//UTF-16 little endian;
|
|
||||||
case 0xFEFF: func = SQ_io_file_lexfeed_UCS2_LE; break;//UTF-16 big endian;
|
|
||||||
case 0xBBEF:
|
|
||||||
if (SQfread(&uc, 1, sizeof(uc), file) == 0)
|
|
||||||
{
|
|
||||||
SQ__Fclose(file);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (uc != 0xBF)
|
|
||||||
{
|
|
||||||
SQ__Fclose(file);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
func = SQ_io_file_lexfeed_UTF8;
|
|
||||||
break;//UTF-8 ;
|
|
||||||
default: SQfseek(file, 0, 2); break; // ascii
|
|
||||||
}
|
|
||||||
|
|
||||||
SQfseek(file, 0, 1);//定位到尾
|
//申请一块能装下整个文件的空间
|
||||||
int length = SQftell(file);//得到文件长度
|
char* ar = (char*)malloc(sizeof(char) * size);
|
||||||
SQfseek(file, 0, 2);//定位到头
|
//读文件,每次读一个,共读size次
|
||||||
|
fread(ar, 1, size, file);
|
||||||
|
|
||||||
|
int skey[] = { 5,2,3,5,0 };//定义解密数组
|
||||||
|
|
||||||
char* temp = new char[length+4];//new一个新的字符串
|
Cutecode(ar, skey);//解密
|
||||||
|
|
||||||
SQfread(temp, sizeof(temp), length, file);//把文件读到字符串里
|
FILE* outfile;
|
||||||
temp[length] = '\0';//给结尾添加结束符号
|
outfile = fopen("ImagePacks2/sprite_interface_teart_zero.npk", "wb+");
|
||||||
|
int da = strlen(ar);
|
||||||
|
fwrite(ar, 1, da, outfile);
|
||||||
|
|
||||||
int key[] = { 5,2,3,5,0 };//定义解密数组
|
fclose(outfile);//关闭文件
|
||||||
Cutecode(temp, key);//解密
|
free(ar);//释放内存
|
||||||
|
|
||||||
SQFILE* newfile = SQfopen(L"ImagePacks2/sprite_interface_teart_zero.npk", L"wb+");//定义新的文件流
|
SQFILE* newfile = SQfopen(L"ImagePacks2/sprite_interface_teart_zero.npk", L"rb+");//定义新的文件流
|
||||||
SQwrite(temp, sizeof(temp), strlen(temp), newfile);//写入
|
|
||||||
|
|
||||||
|
|
||||||
SQfseek(file, 0, 2);//定位到头
|
|
||||||
SQfseek(newfile, 0, 2);//定位到头
|
SQfseek(newfile, 0, 2);//定位到头
|
||||||
|
|
||||||
if (SQ_Compile(v, func, newfile, filename, printerror) >= 0)
|
if (SQ_Compile(v, func, newfile, filename, printerror) >= 0)
|
||||||
{
|
{
|
||||||
SQ__Fclose(file);//关闭文件流
|
fclose(file);//关闭文件
|
||||||
SQ__Fclose(newfile);//关闭文件流
|
SQ__Fclose(newfile);//关闭文件
|
||||||
remove("ImagePacks2/sprite_interface_teart_zero.npk");//删除文件
|
remove("ImagePacks2/sprite_interface_teart_zero.npk");//删除文件
|
||||||
return SQ_OK;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
SQ__Fclose(file);
|
fclose(file);//关闭文件
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SQdofile(uint32_t v, const wchar_t* filename, bool retval, bool printerror)
|
static int SQdofile(uint32_t v, const wchar_t* filename, bool retval, bool printerror)
|
||||||
|
|
@ -339,25 +343,20 @@ static int SQdofile(uint32_t v, const wchar_t* filename, bool retval, bool print
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
void gonggao(char* str,int ctype,int ccolor)
|
||||||
|
|
||||||
void ggc(char* str,int type,int color)
|
|
||||||
{
|
{
|
||||||
int shangdian;
|
int shop, gonggao, type, color;
|
||||||
int laba;
|
char*addr;
|
||||||
int ggtype;
|
if (ctype == NULL)
|
||||||
int ggcolor;
|
ctype = 16;
|
||||||
int ggstr;
|
if (ccolor == NULL)
|
||||||
|
ccolor = 0x65535;
|
||||||
//ggtype = 16;
|
shop = 0x1A5FB20;
|
||||||
//ggcolor = 65535;
|
gonggao = 0x9536c0;
|
||||||
shangdian = 0x1A5FB20;
|
type = ctype;
|
||||||
laba = 0x9536c0;
|
color = ccolor;
|
||||||
ggtype = 16;
|
addr = str;
|
||||||
ggcolor = 65535;
|
|
||||||
ggstr = (int)str;
|
|
||||||
//std::cout << ggstr << std::endl;
|
|
||||||
|
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
|
|
@ -375,13 +374,17 @@ void ggc(char* str,int type,int color)
|
||||||
call dword ptr[ebp - 0x08]
|
call dword ptr[ebp - 0x08]
|
||||||
popad
|
popad
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//窗口公告
|
||||||
|
void WindowsNotice(char* str ,int type = 0x10d ,int b = 0x0)
|
||||||
|
{
|
||||||
|
DWORD thisc = 0x1A5FB20;
|
||||||
|
thisc = *(DWORD*)thisc;
|
||||||
|
_NoticeTcall(thisc, 0, type, str, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -406,14 +409,29 @@ void RegisterNutApi(const wchar_t* funcName, void* funcAddr, uint32_t v)
|
||||||
//Test
|
//Test
|
||||||
static int sq_Test(uint32_t v)
|
static int sq_Test(uint32_t v)
|
||||||
{
|
{
|
||||||
//sq_pushinteger(v, n1);
|
|
||||||
|
/*
|
||||||
|
DWORD thisc = 0x1A5FB20;
|
||||||
|
|
||||||
|
|
||||||
*(char**)0x400F00 = (char*)u"test";
|
|
||||||
|
|
||||||
_Noticecall(0x400F00, 65535, 14, 0, 0, 0, 0);
|
thisc = *(DWORD*)thisc;
|
||||||
|
thisc = *(DWORD*)(thisc + 0x40);
|
||||||
|
|
||||||
return 0;
|
char *str = (char*)u"test";
|
||||||
|
|
||||||
|
|
||||||
|
_Noticecall(thisc, NULL, str, 0x66535, 14, 0, 0, 0, 0);
|
||||||
|
*/
|
||||||
|
|
||||||
|
//char* str = (char*)u"test";
|
||||||
|
//gonggao(str, 14,NULL);
|
||||||
|
|
||||||
|
WindowsNotice((char*)u"我的天");
|
||||||
|
|
||||||
|
SQPopTop(v);
|
||||||
|
SQPushInt(v, 1);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
//读人物 或 装备属性
|
//读人物 或 装备属性
|
||||||
static int GetCharacterAttribute(uint32_t v)
|
static int GetCharacterAttribute(uint32_t v)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue