BSOne.SFC/Tocsg.Module/AppCtrl/EXE_AppCtrl/AppCtrl.dpr

57 lines
1.4 KiB
Plaintext

program AppCtrl;
uses
Vcl.Forms,
Tocsg.Win32,
Tocsg.Safe,
Tocsg.Param,
Tocsg.Path,
Tocsg.Process,
Vcl.Dialogs,
System.SysUtils,
DAppCtrlMain in 'DAppCtrlMain.pas' {DlgAppCtrlMain},
AppCtrlServer in 'AppCtrlServer.pas',
Define in 'Define.pas',
AppCtrlDefine in '..\LIB_Common\AppCtrlDefine.pas',
Tocsg.DRM.Encrypt in '..\..\TocsgDRM\LIB_Common\Tocsg.DRM.Encrypt.pas',
Condition in '..\..\..\eCrmHE\LIB_Common\Condition.pas',
GlobalDefine in '..\..\..\eCrmHE\LIB_Common\GlobalDefine.pas';
{$R *.res}
var
mtx: TTgMutex;
param: TTgParam;
begin
ReportMemoryLeaksOnShutdown := DebugHook <> 0;
param := TTgParam.Create;
try
if param.ExistsParam('-hook') then
begin
var nResult := InjectModule(StrToIntDef(param.GetParamValue('-hook'), 0), GetRunExePathDir + DLL_APIHOOK);
if nResult <> 1 then
ShowMessage('Fail .. Code=' + IntToStr(nResult));
exit;
end else
if param.ExistsParam('-clearhook') then
begin
EjectModuleFromPath(GetRunExePathDir + DLL_APIHOOK);
Sleep(1000);
EjectModuleFromPath(GetRunExePathDir + DLL_APIHOOK);
exit;
end;
finally
param.Free;
end;
Guard(mtx, TTgMutex.Create(APP_MUTEX {$IFNDEF WIN64} + '32' {$ENDIF}));
if mtx.MutexState <> msCreateOk then
exit;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDlgAppCtrlMain, DlgAppCtrlMain);
Application.Run;
end.