用 MapFileAndCheckSum 函数检测 exe 或 dll 是否被修改 - 回复 "Joe Lo" 的问题

本文介绍了一种使用Delphi检测EXE文件原始大小和修改后大小的方法,通过调用MapFileAndCheckSum函数并展示了具体实现代码。
问题来源: http://www.cnblogs.com/del/archive/2008/12/08/1350440.html#1395177

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses ImageHlp; {MapFileAndCheckSum 定义在这个单元}

procedure TForm1.Button1Click(Sender: TObject);
const
  exeFile = 'c:\windows\system32\notepad.exe'; {exe or dll}
var
  size1,size2: Cardinal;
begin
  MapFileAndCheckSum(exeFile, size1, size2); 
  ShowMessageFmt('原生大小: %d; 修改后大小: %d', [size1,size2]);
  {函数返回 0 表示已顺利检测, 但还要判断 size1、size2 是否相等}
end;

end.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值