BSOne.SFC/Tocsg.Module/TocsgDRM/EXE_TocsgDRM/TocsgDRM.dpr

49 lines
1.0 KiB
Plaintext

program TocsgDRM;
uses
Vcl.Forms,
Tocsg.Win32,
Tocsg.Safe,
Tocsg.Param,
Tocsg.Path,
Tocsg.Process,
System.SysUtils,
DTgDrmMain in 'DTgDrmMain.pas' {DlgTgDrmMain},
GlobalDefine in '..\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
InjectModule(StrToIntDef(param.GetParamValue('-hook'), 0), GetRunExePathDir + DLL_APIHOOK);
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(TDlgTgDrmMain, DlgTgDrmMain);
Application.Run;
end.