-
-
求助“Hacker Disassembling Uncove”源码
-
2004-12-16 14:49 5311
-
小弟最近在看“Hacker Disassembling Uncovered”(英文版)一书,发现书上有很多源码和他/她 说的都不一样,比如说在“step four ,Method 0中的例子 Listing 4.2(crackme0x03),如下“#include <stdio.h>
#include <windows.h>
__declspec(dllexport) void Demo()
{
#define PASSWORD_SIZE 100
#define PASSWORD "myGOODpassword\n"
int count=0;
char buff [PASSWORD_SIZE]="";
for(;;)
{
printf("Enter password:");
fgets(&buff[0], PASSWORD_SIZE-1, stdin);
if (strcmp(&buff[0], PASSWORD))
printf("Wrong password\n");
else break;
if (++count>2) return -1;
}
printf("Password OK\n");
}
main()
{
HMODULE hmod;
void (*zzz) ();
if ((hmod=LoadLibrary("crackme0x03.exe(改了原为crack0~1.exe)"))
&& (zzz=(void (*) ())GetProcAddress (hmod(改了原为h), "Demo")))
zzz();
}
”编译通过了,但是执行起来没有任何反映,调试发现LoadLibrary返回为空,按书上的地址去找也找不到。那位大侠帮帮忙,指点一下吧,小弟都想了很久了 ,先行谢过。要是拿位大大有此书的源码感激不静
#include <windows.h>
__declspec(dllexport) void Demo()
{
#define PASSWORD_SIZE 100
#define PASSWORD "myGOODpassword\n"
int count=0;
char buff [PASSWORD_SIZE]="";
for(;;)
{
printf("Enter password:");
fgets(&buff[0], PASSWORD_SIZE-1, stdin);
if (strcmp(&buff[0], PASSWORD))
printf("Wrong password\n");
else break;
if (++count>2) return -1;
}
printf("Password OK\n");
}
main()
{
HMODULE hmod;
void (*zzz) ();
if ((hmod=LoadLibrary("crackme0x03.exe(改了原为crack0~1.exe)"))
&& (zzz=(void (*) ())GetProcAddress (hmod(改了原为h), "Demo")))
zzz();
}
”编译通过了,但是执行起来没有任何反映,调试发现LoadLibrary返回为空,按书上的地址去找也找不到。那位大侠帮帮忙,指点一下吧,小弟都想了很久了 ,先行谢过。要是拿位大大有此书的源码感激不静
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
赞赏
他的文章
看原图