Programming Self-generating Code for Windows Applications

本文介绍了一种用于保护应用程序免受反编译的技术——自动生成代码技术。该技术通过修改应用程序的内存来隐藏关键信息,例如生成密钥的过程或验证序列号的方法。文中详细探讨了两种实现方式:使用kernel32.dll中的WriteProcessMemory函数和修改堆栈上的代码。
  Introduction
Self-generating code technology is a very important means to counteract disassembler. You should use this technology to protect your applications although it's a "bad" programming style. There are two documented ways of modifying application code at least. First, kernel32.dll exports the WriteProcessMemory function, intended as follows from its name, for modifying the memory of a process. Second, practically all operating systems, Windows and Linux included, allow the code placed on the stack to be modified. I like the second way, because it is more freedom and less limitation when I try creating self-generating code for Windows applications in VC++ IDE. A FAQ is to cause an exception with the subsequent abnormal termination of the application.

I try to resolve these questions, and get some experience as follows:
The function code must be relocatable code:
  1. Only use local variable, don't use global variable, static variable, and constant string variable.
  2. If the function code wants to invoke another function, the pointer of the function should be passed to it.
Some may have a question about Self-generating code: What's the advantage of it?
The answer is that it can conceal crucial or key information, such as procedures for generating the key or for verifying the serial number.

.
.
.
.


查看全文: http://www.codeproject.com/KB/tips/Self-generating-code.aspx
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值