问题描述
任何人都可以向我展示一个如何使用此组件的简单示例。谢谢
Can anyone show me a simple example how this component is used.Thanks
推荐答案
在您的应用程序中(您想要的一个以通过嵌入CRC进行保护),请删除 OgProtectExe
组件。使用 Object Inspector
为单个事件( OnChecked
,如果我没记错的话)添加处理程序。处理程序应包含以下内容:
In your application (the one you want to protect by embedding a CRC), drop an OgProtectExe
component. Use the Object Inspector
to add a handler for it's single event (OnChecked
, if I remember correctly). The handler should contain something like this:
procedure TForm1.OgProtectExe1Checked(Sender: TObject; Status: TExeStatus);
begin
if (Status <> exeSuccess) then // CRC changed
// Handle modified executable
end;
可能的 TExeStatus
值是:
exeSuccess - CRC is OK
exeSizeError - File size has changed
exeIntegrityError - CRC doesn't match
exeNotStamped - Executable not stamped
照常构建应用程序。使用 StampExe
(来自OnGuard examples\Delphi
文件夹)在CRC中标记可执行文件(或编写自己的可执行文件)。调用 OgProExe
单元的 ProtectExe
函数对其进行标记的应用程序。)
Build your application as usual. Use StampExe
(from the OnGuard examples\Delphi
folder) to stamp your executable with the CRC (or write your own app that calls the OgProExe
unit's ProtectExe
function to stamp it).
ProtectExe
带有两个参数-要保护的可执行文件的完整路径和文件名,以及一个布尔值,指示在保护后是否应删除其特殊标记。除非您以后想要解除对可执行文件的保护,否则应通过 True
。
ProtectExe
takes two parameters - the full path and filename of the executable to protect, and a boolean that indicates whether or not it should remove it's special marker after protecting. You should pass True
unless you want to have the ability to unprotect the executable afterwards.
uses
OgProExe;
...
if ProtectExe(YourExeName, EraseMarker) then // executable stamped
这篇关于使用来自tponguard的OgProtectExe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!