用 MapFileAndCheckSum 函数检测 exe 或 dll 是否被修改

 问题来源: 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.

你可能感兴趣的:(windows,Class,dll,exe,button,Forms)