猜猜看如下三个程序会弹出几个对话框?

2009/03/06 program 共 860 字,约 3 分钟
//猜猜看如下三个程序,会弹出几个对话框?

#include "windows.h"

void main()

{

	HMODULE module = GetModuleHandle(0);

	CHAR buffer[MAX_PATH];

	GetModuleFileName(module, buffer, sizeof(buffer));

	UnmapViewOfFile(module);

	MessageBox(0, buffer, 0, 0);

}

//----------------------------

#include "windows.h"

void main()

{

	HMODULE module = GetModuleHandle(0);

	CHAR buffer[MAX_PATH];

	GetModuleFileName(module, buffer, sizeof(buffer));

	__asm

	{

		lea eax, buffer

		lea esi, goon

		push 0

		push 0

		push eax

		push 0

		push esi

		push module

		push MessageBox

		push UnmapViewOfFile

		ret

	}

goon:

	MessageBox(0, 0, 0, 0);

}

//----------------------------

#include "windows.h"

void main()

{

	HMODULE module = GetModuleHandle(0);

	static CHAR buffer[MAX_PATH];

	GetModuleFileName(module, buffer, sizeof(buffer));

	__asm

	{

		lea eax, buffer

		lea esi, goon

		push 0

		push 0

		push eax

		push 0

		push esi

		push module

		push MessageBox

		push UnmapViewOfFile

		ret

	}

goon:

	MessageBox(0, 0, 0, 0);

}

文档信息

Search

    Table of Contents