Change exe code

本文详细解析了Windows应用程序的启动过程,包括虚拟地址空间创建、可执行文件映射、依赖DLL加载等步骤,并讨论了直接修改运行中应用程序镜像文件的技术限制及可能的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

it can be done but not easily, but not with one app, you will need two at least on windows. the windows loader prevents direct modification of the image...

here's an outline of the loader process
0) create virtual address space for new process
1) map executable module into process's address space
2) parse executables import section
3) load and map required dll-files into address space
4) repeat 3 for each dll-file
5) start process

from this you would assume the following:
at step 0, space is allocated in the paging/swap file
at step 1, the PE is copied into this space
etc.

if you think about this, you will realize that app start times would be even worse than they are now... the work-around is that the system uses the actual image of the exe-file as the program's region of reserved space! this means that the file is locked to everyone except the kernel! translation: you cannot modify a running app's disk image.

the most obvious workaround to this is the use of a program to create a virtual drive, copy the image from the physical drive to the virtual one, delete the physical copy, start the copied app, &c.

another approach would be to compile "on-the-fly"...

at this point, I must stop helping you *unless* you can describe a legitimate use of this technique -- it's only real use is an attempt to defeat security measures on a system...

 

CHANGE.EXE 是一个以命令行方式处理对文件的修改工具,目标文件可以是任意大小任意格式。可以一次执行30条命令!非常地高效。 一、基本格式: change 源文件.txt /from “被替换的串” /to “替换串” /in “条件” 二、已知限制是它不支持长名,可能不认识一些windows下的特殊字符作文件名。对此,解决之道是以短文件名访问(例如:myfile~1.txt)。 三、详细功能列表: ⒈處理的文件不限大小,前提是磁盤上至少要有与目标文件等大的预留空间,用于临时存放其副本; ⒉不仅处理文本文件,也处理二进制文件; ⒊替入和换出的字符串长度可以不同; ⒋可以指定替换行为只在特定行发生,特定行的标志是有另一个指定的字符(串)出现,这个字符串还允许大小写敏感; ⒌可以同时执行多达30个修改指令; ⒍支持子目录; ⒎兼容dos/Unix/Mac 文本格式; ⒏输入输出字符串可以是文本的(Ascii),也可以是十六进制值或十进制值; ⒐替换速的特快; ⒑具有备份选项,以防源文件可能损坏; ⒒替换工作可以交互式进行(控制台); ⒓除命令行、控制台它还允许把多条指令组合编制为一个控制文件一次执行; ⒔可以使用布尔变量; ⒕源文件名支持通配符; ⒖"*"用在指定的被修改字符串时,表示由当前位置到行尾的整个子串; ⒗在指定目标字符串时,可以设定“列”,仅当字符位于此范围内时才发生替换; ⒘可以按文件属性排除某个文件不被处理; ⒙可以排除某些行不处理; ⒚按ESC可以中止处理进程。 ⒛ 四、如何指定参数 当程序运行时,它将以如下三种方式读取参数: ⒈INI文件 ⒉系统环境变量 ⒊命令行 先看最常用的命令行语法。 To/From/In规范: FROM 被替换的文字 TO 用于替换的文字 TO (可选)指定发生替换行为的特定行标志 举例,设test.txt文件包含如下两行: The quick brown fox jumped over the lazy brown dog. 我们输入: change /from brown /to red /fox 则文件变为: The quick red fox jumped over the lazy brown dog. 即:有出现"fox"的那行"brown:被替换为"red",其它行不变。 如果所指定字符串包含空格或其他特殊字符,请用双引号,比如: CHANGE test.TXT /FROM "my music" /TO "my video" 或者用十六进制字符处理特殊字符,如: CHANGE test.TXT /FROM &H0D0A0D0A /TO &H0D0A (删除多余的行) 设定列宽的例子: change test.txt /from ok 5/10 /to no 只替换从第5列到第10列的ok 为 no,这个功能是按首字符认定位置的,比如有一个“ok”位于4,5列那么它不会被替换。 仅删除的例子: change test.txt /from no /to null (即:删除所有的no) 如果要忽略英文字母的大小写,使用参数 /I 与DOS类似,可以用参数 /s 处理所有子目录中文件的替换工作 替换指定行的例子: change test.txt /from no /to re /lines 3-8 30-50 (即:只替换3到8行和30到50行的字符) 出于安全目的,该程序总要自动生成一个临时文件备份源文件,如果用 /N文件名 参数另指定一个输出文件,则没有临时文件输出。 要消除文件末尾多余的空格,可以用参数 /trim 使用布尔变量的例子: CHANGE TEST.TXT /FROM Apple /TO Banana /IN (red OR brown) AND NOT Pear 将替换apple为banana,但所在行必须有red或brown出现,并且没有Pear出现 本程序的返回误码意义: 0 无错,有修改 1 无错,无修改 253 提前中止 254 内部错误 255 语法错 件
Changelog: 更改日志: Version 2.01 includes the following 版本2.01包括以下内容 - Fixed RAW code conversion not padding leading zeros -修复了未填充前导零的原始代码转换 Description: 说明: PNACH Converter converts PNACH files into the following formats: PNACH转换器将PNACH文件转换为以下格式: - RAW PS2 cheat codes -原始PS2作弊代码 - Unique HEX search/replace strings -唯一十六进制搜索/替换字符串 - Modified ELFs -改良精灵 PNACH: 巴拿赫: In order to convert a PNACH file to a set of HEX search/replace strings or to modify the original ELF the following are required: 要将PNACH文件转换为一组十六进制搜索/替换字符串或修改原始ELF,需要以下内容: The game's ELF file (ELF files can be extracted using Elf Extractor (PS2 Hacking Toolkit)) 游戏的ELF文件(ELF文件可以使用ELF提取器(PS2黑客工具包)提取) PNACH type must be byte, short, word, or extended with the first digit of the address as '0', '1' or '2'. PNACH类型必须为byte、short、word或扩展,地址的第一个数字为“0”、“1”或“2”。 Note: that not all PNACH files can be converted into ELF patches - the address modified by the PNACH must exist within an ELF segment in order for this to be possible, if you receive the error "Address XXXXXXXX does not exist in ELF" then the PNACH line which specifies that address cannot be converted. 注意:并非所有PNACH文件都可以转换为ELF修补程序-PNACH修改的地址必须存在于ELF段中才能实现此目的,如果收到错误“address xxxxxxx不存在于ELF中”,则指定该地址的PNACH行无法转换。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值