Pascal (Lazarus/Delphi)
Pascal (Lazarus/Delphi)
Remove the Authenticode Signature from an EXE or DLL
See more Code Signing Examples
Demonstrates how to remove the Authenticode signature from an EXE or DLL.Note: Chilkat's code signing class was added in v9.5.0.97
Chilkat Pascal (Lazarus/Delphi) Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.CodeSign;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
success: Boolean;
path: string;
codeSign: TCodeSign;
begin
success := False;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// You can verify a signed DLL or EXE.
path := 'c:/someDir/something.dll';
codeSign := TCodeSign.Create;
// If successful, the signature is removed from the EXE or DLL file.
success := codeSign.RemoveSignature(path);
if (success = False) then
begin
WriteLn(codeSign.LastErrorText);
end;
WriteLn('success: ' + success);
codeSign.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.