vc.cpp

来自「此为本书的配套光盘.本书不但由浅入深地讲解了软件保护技术」· C++ 代码 · 共 37 行

CPP
37
字号
// vc.cpp : Defines the entry point for the application.
//

#include "stdafx.h"

void MixCode();

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
 	MixCode();	
	return 0;
}

void MixCode()
{
	char*  pMsg=NULL;	
	__asm{
		jmp lbl_skipok;
        _emit 0x68
		_emit 0x65
		_emit 0x6C
		_emit 0x6C
		_emit 0x6F
		_emit 0x00    
lbl_skipok:
		call lbl_addr
lbl_addr:
		pop eax				//取得本行代码运行时的地址
		mov pMsg,eax	
	}
	pMsg -= (5+6);			//5是call lbl_addr的指令长度
							//6是hello字符串的长度
	MessageBox(NULL,pMsg,0,MB_OK);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?