求坛友指点一下问题代码
一个搜索数组字符串的函数,如下:int Function()
{
char date = {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x07,0x09,
0x00,0x20,0x10,0x03,0x03,0x0C,0x00,0x00,0x44,0x00,
0x00,0x33,0x00,0x47,0x0C,0x0E,0x00,0x0D,0x00,0x11,
0x00,0x00,0x00,0x02,0x64,0x00,0x00,0x00,0xAA,0x00,
0x00,0x00,0x64,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x02,0x00,0x74,0x0F,0x41,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x0A,0x00,
0x00,0x02,0x57,0x4F,0x57,0x00,0x06,0x08,0x00,0x00,
0x00,0x00,0x00,0x64,0x00,0x0F,0x00,0x00,0x0D,0x00,
0x00,0x00,0x23,0x00,0x00,0x64,0x00,0x00,0x64,0x00
};
char* p = date;
const char* z = "WOW";
int* x;
int* y;
for (int i = 0; i < 96; i++)
{
x = (int*)p + i;
y = (int*)z;
if (*x==*y)
{
return 1;
}
}
return 0;
}这一个Function()是可以找出来的。
下面这个我就不会弄
char Data =
{
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x07,0x09,
0x00,0x20,0x10,0x03,0x03,0x0C,0x00,0x00,0x44,0x00,
0x00,0x33,0x00,0x47,0x0C,0x0E,0x00,0x0D,0x00,0x11,
0x00,0x00,0x00,0x02,0x64,0x00,0x00,0x00,0xAA,0x00,
0x00,0x00,0x64,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x02,0x00,0x74,0x0F,0x41,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x0A,0x00,
0x00,0x02,0x57,0x4F,0x57,0x00,0x06,0x08,0x00,0x00,
0x00,0x00,0x00,0x64,0x00,0x0F,0x00,0x00,0x0D,0x00,
0x00,0x00,0x23,0x00,0x00,0x64,0x00,0x00,0x64,0x00
};
char* FindRoleNameAddr(char* Data, const char* pRoleName)
{
char* ret = Data;
const char* fund = pRoleName;
int* x;
int* y;
for (int i = 0; i < 96; i++)
{
x = (int*)ret;
y = (int*)fund;
if (*(x+i)==*y)
{
printf("%x", x);
}
}
return ret;
}
定义了一个全局的数组,然后下面这个函数指针不知道怎么写,也找不到 wow 这串字符串。main()函数里是这样的FindRoleNameAddr(Data,"wow");
求各位坛友大佬路过帮忙看看指点一下是哪里不对,谢谢。
页:
[1]