BSOne.SFC/Tocsg.Module/RemoteSecu/EXE_RemoteSecuClient/RemoteSecuClient.dpr

83 lines
2.3 KiB
Plaintext

program RemoteSecuClient;
uses
Vcl.Forms,
Tocsg.Win32,
Tocsg.Safe,
Tocsg.Param,
EncdDecd,
System.SysUtils,
Messages,
Windows,
Classes,
superobject,
DRSecuClientMain in 'DRSecuClientMain.pas' {DlgCoeAgentMain},
RSecuClient in 'RSecuClient.pas',
Define in 'Define.pas',
ManagerConfig in 'ManagerConfig.pas',
NetFwTypeLib_TLB in '..\..\MgWinFW\NetFwTypeLib_TLB.pas',
Tocsg.Firewall in '..\..\MgWinFW\Tocsg.Firewall.pas',
GlobalSocketDefine in '..\LIB_Common\GlobalSocketDefine.pas',
DConnectInfo in 'DConnectInfo.pas' {DlgConnectInfo},
ManagerRdpSecu in 'ManagerRdpSecu.pas',
DSelRdpDest in 'DSelRdpDest.pas' {DlgSelRdpDest},
DRdpLink in 'DRdpLink.pas' {DlgRdpLink},
GlobalDefine in '..\LIB_Common\GlobalDefine.pas',
DImgView in 'DImgView.pas' {DlgImgView},
Tocsg.Watermark in '..\..\WaterToImage\Tocsg.Watermark.pas';
{$R *.res}
var
mtx: TTgMutex;
sJsonPath: String;
param: TTgParam;
ms: TMemoryStream;
begin
ReportMemoryLeaksOnShutdown := DebugHook <> 0;
Guard(param, TTgParam.Create);
sJsonPath := param.GetParamValue('/img');
if FileExists(sJsonPath) then
begin
var O, OSend: ISuperObject;
if not LoadJsonObjFromFile(O, sJsonPath) then
exit;
DeleteFile(PChar(sJsonPath));
if not FileExists(O.S['Path']) then
exit;
ms := TMemoryStream.Create;
// RenameFile(PChar(O.S['Path']), PChar(O.S['Path'] + '1'));
ms.LoadFromFile(O.S['Path']);
// DeleteFile(PChar(O.S['Path']));
ms.Position := 0;
OSend := SO;
OSend.S['Data'] := EncodeBase64(ms.Memory, ms.Size);
OSend.S['Path'] := O.S['Path'];
OSend.I['PID'] := O.I['PID'];
var sData: String := OSend.AsString;
var CopyData: TCopyDataStruct;
CopyData.dwData := RSCMD_CAPUTRE_DATA;
CopyData.cbData := (Length(sData) + 1) * 2;
CopyData.lpData := PChar(sData);
SendMessage(O.I['RH'], WM_COPYDATA, 0, NativeInt(@CopyData));
// var dlg: TDlgImgView;
// Guard(dlg, TDlgImgView.Create(nil, ms, O.S['Path'], O.I['PID'], O.I['RH']));
// if dlg.LoadFromStream(ms) then
// dlg.ShowModal;
exit;
end;
Guard(mtx, TTgMutex.Create(MUTEX_AGENT));
if mtx.MutexState <> msCreateOk then
exit;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDlgCoeAgentMain, DlgCoeAgentMain);
Application.Run;
end.