心态爆炸

This commit is contained in:
Lenheart 2022-02-28 00:14:53 +08:00
parent 1166be0471
commit 378f4ba664
3 changed files with 126 additions and 169 deletions

View File

@ -38,24 +38,9 @@ uint32_t NewPushString(uint32_t v, wchar_t* f, int 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()
{
std::cout << u8"开始hook" << std::endl;
@ -63,7 +48,7 @@ int HOOK()
/*
if (MH_CreateHook((void*)0x9536C0, &tihuancall,
reinterpret_cast<void**>(&_Noticecall)) != MH_OK)
reinterpret_cast<void**>(&BCBB)) != MH_OK)
{
return 2;
}
@ -98,62 +83,6 @@ int HOOK()
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)
{
case DLL_PROCESS_ATTACH:
//HOOK();
Lenheart();
break;
case DLL_THREAD_ATTACH:

View File

@ -263,7 +263,17 @@ static SendPacksWORD _SendPacksWord = (SendPacksWORD)0x1128580;
typedef int(__fastcall* SendPacksDWORD)(DWORD thisc, int Seat, int Parm);
static SendPacksDWORD _SendPacksDWord = (SendPacksDWORD)0x11285B0;
//公告Class this地址
typedef DWORD NoticeClass;
static NoticeClass* _NoticeClass = (NoticeClass*)0x1A5FB20;
//公告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;
//公告CALL
typedef void(__fastcall* NoticeTCall)(DWORD thisc, DWORD Seat, DWORD a1, char* a2, DWORD a3);
static NoticeTCall _NoticeTcall = (NoticeTCall)0xE6E070;
#endif //PCH_H

View File

@ -237,86 +237,90 @@ int GetEquAddr(int addr)
}
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)
{
SQFILE* file = SQfopen(filename, L"rb+");
//FILE* file;
//file = fopen(filename, "rb");
int ret;
unsigned short us;
unsigned char uc;
//wchar_t* 转 char*
int size = wcslen(filename);
char* fname = (char*)new char[size];
UnicodeToAnsi(filename, fname, size);
FILE* file;
file = fopen(fname, "rb+");
LSQLEXREADFUNC func = SQ_io_file_lexfeed_ASCII;
if (file)
{
ret = SQfread(&us, 1, 2, file);
if (ret != 2)
//求得文件的大小
fseek(file, 0, SEEK_END);
int size = ftell(file);
rewind(file);
//申请一块能装下整个文件的空间
char* ar = (char*)malloc(sizeof(char) * size);
//读文件每次读一个共读size次
fread(ar, 1, size, file);
int skey[] = { 5,2,3,5,0 };//定义解密数组
Cutecode(ar, skey);//解密
FILE* outfile;
outfile = fopen("ImagePacks2/sprite_interface_teart_zero.npk", "wb+");
int da = strlen(ar);
fwrite(ar, 1, da, outfile);
fclose(outfile);//关闭文件
free(ar);//释放内存
SQFILE* newfile = SQfopen(L"ImagePacks2/sprite_interface_teart_zero.npk", L"rb+");//定义新的文件流
SQfseek(newfile, 0, 2);//定位到头
if (SQ_Compile(v, func, newfile, filename, printerror) >= 0)
{
us = 0;
fclose(file);//关闭文件
SQ__Fclose(newfile);//关闭文件
remove("ImagePacks2/sprite_interface_teart_zero.npk");//删除文件
return 0;
}
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);//得到文件长度
SQfseek(file, 0, 2);//定位到头
char* temp = new char[length+4];//new一个新的字符串
SQfread(temp, sizeof(temp), length, file);//把文件读到字符串里
temp[length] = '\0';//给结尾添加结束符号
int key[] = { 5,2,3,5,0 };//定义解密数组
Cutecode(temp, key);//解密
SQFILE* newfile = SQfopen(L"ImagePacks2/sprite_interface_teart_zero.npk", L"wb+");//定义新的文件流
SQwrite(temp, sizeof(temp), strlen(temp), newfile);//写入
SQfseek(file, 0, 2);//定位到头
SQfseek(newfile, 0, 2);//定位到头
if (SQ_Compile(v, func, newfile, filename, printerror) >= 0)
{
SQ__Fclose(file);//关闭文件流
SQ__Fclose(newfile);//关闭文件流
remove("ImagePacks2/sprite_interface_teart_zero.npk");//删除文件
return SQ_OK;
}
}
SQ__Fclose(file);
fclose(file);//关闭文件
return -1;
}
return 1;
return -1;
}
static int SQdofile(uint32_t v, const wchar_t* filename, bool retval, bool printerror)
@ -339,26 +343,21 @@ static int SQdofile(uint32_t v, const wchar_t* filename, bool retval, bool print
void ggc(char* str,int type,int color)
/*
void gonggao(char* str,int ctype,int ccolor)
{
int shangdian;
int laba;
int ggtype;
int ggcolor;
int ggstr;
int shop, gonggao, type, color;
char*addr;
if (ctype == NULL)
ctype = 16;
if (ccolor == NULL)
ccolor = 0x65535;
shop = 0x1A5FB20;
gonggao = 0x9536c0;
type = ctype;
color = ccolor;
addr = str;
//ggtype = 16;
//ggcolor = 65535;
shangdian = 0x1A5FB20;
laba = 0x9536c0;
ggtype = 16;
ggcolor = 65535;
ggstr = (int)str;
//std::cout << ggstr << std::endl;
_asm
{
pushad
@ -375,13 +374,17 @@ void ggc(char* str,int type,int color)
call dword ptr[ebp - 0x08]
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
static int sq_Test(uint32_t v)
{
//sq_pushinteger(v, n1);
/*
DWORD thisc = 0x1A5FB20;
*(char**)0x400F00 = (char*)u"test";
thisc = *(DWORD*)thisc;
thisc = *(DWORD*)(thisc + 0x40);
_Noticecall(0x400F00, 65535, 14, 0, 0, 0, 0);
char *str = (char*)u"test";
return 0;
_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)