首页
社区
课程
招聘
[求助][求助]请教高手如何用delphi编写文件补丁??
发表于: 2007-11-23 09:55 4498

[求助][求助]请教高手如何用delphi编写文件补丁??

2007-11-23 09:55
4498
  本人想学着用delphi编写文件补丁。比如,如何把exe中地址为004A748C 处的值75 3D修改为EB 3D??
  论坛里有关于文件补丁的贴子,http://www.pediy.com/bbshtml/BBS6/pediy6571.htm 但是用汇编语言写的,我是菜鸟看不懂,只懂看delphi  或者delphi高手把它翻译成delphi,期待中……

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 2384
活跃值: (766)
能力值: (RANK:410 )
在线值:
发帖
回帖
粉丝
2
//大概是这样,没测试。
program pathc;

uses windows,messages;

var
  FileName:PChar = 'Crackme5.exe';
  AppName:PChar = 'Crackme 5 Pathc';
  Done:PChar = 'File patched succesfully!';
  NoFile:PChar = 'Can''t find crackme5.exe!';
  ReFile:PChar = 'Wrong version of crackme5.exe!';
  WrFile:PChar = 'Error writing to crackme5.exe!';
  RBuffer:Array[0..1] of Byte = ($75,$15);
  WBuffer:Array[0..1] of Byte = ($90,$90);
  OffsetPos:TOVERLAPPED = (Internal:0;InternalHigh:0;Offset:$53f;OffsetHigh:0;hEvent:0);
  CommandLine:PChar;
  hwndname:HWND;
  hFile:THANDLE;
  Numb:DWORD;
  Buffer:Array[0..1] of Byte;
  nType:DWORD;
  pMsg:PChar;

begin
  hFile := CreateFile(FileName,GENERIC_READ OR GENERIC_WRITE,FILE_SHARE_READ OR FILE_SHARE_WRITE,nil,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
  if hFile <> INVALID_HANDLE_VALUE then
  begin
    ReadFile(hFile,Buffer,2,Numb,@OffsetPos);
    if WORD(Buffer[0]) = Word(RBuffer[0]) then
      if WriteFile(hFile,WBuffer,2,Numb,@OffsetPos) then
      begin
        nType := MB_OK;
        pMsg := Done;
      end
      else
      begin
        nType := MB_OK or MB_ICONINFORMATION;
        pMsg := WrFile;
       end
     else
     begin
       nType := MB_OK or MB_ICONINFORMATION;
       pMsg := ReFile;
     end;
  end
  else
  begin
    nType := MB_OK or MB_ICONINFORMATION;
    pMsg := NoFile;
  end;
  CloseHandle(hFile);
  MessageBox(0,pMsg,AppName,nType);
  ExitProcess(0);
end.
2007-11-23 12:08
0
雪    币: 241
活跃值: (15)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
3
非常漂亮的翻译!已经通过测试,谢谢版主!!!
2007-11-29 23:27
0
游客
登录 | 注册 方可回帖
返回
//