首页
社区
课程
招聘
往exe里面直接添加代码可行吗?
2004-7-16 15:08 5122

往exe里面直接添加代码可行吗?

2004-7-16 15:08
5122
我有一个delphi编的程序,想刻到光盘里。这个程序读入同目录下的文
件'music'。用DeDe反汇编后,我分析它的源码大概是这样的:

var
  F: file of Byte;
... ...
begin
    AssignFile(F, 'music');
    Reset(F);
... ...

于是有个问题,music文件刻到光盘以后成了只读文件,而Reset()默认的
文件模式FileMode=2,也就是需要Read/Write access。所以把这个程序在
光盘上运行的时候,会出现EInOutError,弹出消息'File access denied.'
无法读取'music'文件。

我想如果源码里加上FileMode := 0;,程序就没问题了
var
  F: file of Byte;
... ...
begin
    AssignFile(F, 'music');
    FileMode := 0;
    Reset(F);
... ...

但现在我没有这个程序的源代码,只有exe文件,请问有什么样的方案可以实
现往exe文件里添加FileMode := 0;这么一项代码?

//bow!!!!!!!!!

[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
免费 2
打赏
分享
最新回复 (8)
雪    币: 202
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
ymsw 2004-7-16 15:22
2
0
我是菜鸟,没学过破解
大家多包涵阿
雪    币: 519
活跃值: (1223)
能力值: ( LV12,RANK:650 )
在线值:
发帖
回帖
粉丝
RoBa 16 2004-7-16 17:12
3
0
这个用的API是CreateFile吧,不知道DELPHI怎么把它包装的。用CreateFile断试试,改个参数。
雪    币: 202
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
ymsw 2004-7-16 18:33
4
0
这是Delphi6帮助里的
Reset procedure

Opens an existing file.

Unit

System

Category

I/O routines

procedure Reset(var F [: File; RecSize: Word ] );

Description

Reset opens the existing external file with the name assigned to F using the mode specified by the global FileMode variable. An error results if no existing external file of the given name exists or if the file can? be opened with the current file mode. If F is already open, it is first closed and then reopened. The current file position is set to the beginning of the file.

Warning:        The default value of FileMode is 2 (Read/Write access). If this is not changed to a read-only file mode before calling Reset, attempts to open read-only files will fail.

F is a variable of any file type associated with an external file using AssignFile. RecSize is an optional expression, which can be specified only if F is an untyped file. If F is an untyped file, RecSize specifies the record size to be used in data transfers. If RecSize is omitted, a default record size of 128 bytes is assumed.

If F is assigned an empty name, such as AssignFile(F, ''), then after the call to Reset, F refers to the standard input file.

If F is a text file, F becomes read-only.

After a call to Reset, Eof(F) is True if the file is empty; otherwise, Eof(F) is False.

Note:        {$I+} handles run-time errors using exceptions. When using {$I-}, use IOResult to check for I/O errors.
雪    币: 231
活跃值: (409)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
cobra1111 2004-7-16 18:37
5
0
看精华去

pll621的文章
雪    币: 202
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
ymsw 2004-7-16 18:59
6
0
是pll621的哪篇文章呢
求教文章名
//bow
雪    币: 390
活跃值: (707)
能力值: ( LV12,RANK:650 )
在线值:
发帖
回帖
粉丝
firstrose 16 2004-7-17 13:48
7
0
反汇编,找到对应filemode=2的指令,直接改。

不要叫找不到!
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
wscn 2004-7-17 17:44
8
0
用DeDe查找对应AssingFile的二进制代码,进入CALL,会有一段如下指令:
mov cl,[xxxxxx]
and cl,3
cmp cl,2
j........

把    mov cl,[],and cl,3
改为  mov cl,0 mov [],cl
雪    币: 202
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
ymsw 2004-7-18 13:16
9
0
最初由 wscn 发布
用DeDe查找对应AssingFile的二进制代码,进入CALL,会有一段如下指令:
mov cl,[xxxxxx]
and cl,3
cmp cl,2
j........

把 mov cl,[],and cl,3
改为 mov cl,0 mov [],cl


用wscn的方法果然成功啦,yeah~~~
kisssssssssssssssss
游客
登录 | 注册 方可回帖
返回