unit DLicense; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.Imaging.pngimage, Vcl.StdCtrls, System.ImageList, Vcl.ImgList, PngImageList, Tocsg.Win32, KDL.Localizer; const DEF_VPN_DESC = '사내 VPN 접속시 아래의 기능이 제한됩니다.' + #13#10#13#10 + '1. 화면 캡처 제한' + #13#10 + ' - Screen Capture 기능이 제한됩니다.' + #13#10 + '2. 윈도우 원격 접속 프로그램 사용 금지' + #13#10 + ' - Windows 원격 데스크톱 기능이 제한됩니다.' + #13#10 + '3. 프린트 출력 금지' + #13#10 + ' - 프린트 출력이 제한됩니다.' + #13#10 + '4. PC 내 파일 생성 및 변경 제한' + #13#10 + ' - PC에서 파일을 생성하거나 변경하는 작업이 제한됩니다.' + #13#10 + '5. 개인정보 및 사내 주요 정보 마스킹 처리' + #13#10 + ' - 개인정보 및 사내 주요 정보에 대해서 자동으로 마스킹 처리 됩니다.' + #13#10 + '6. 클립보드 사용 제한' + #13#10 + ' - 클립보드 사용이 제한됩니다.'; KR_VPN_DESC = '사내 VPN 접속시 아래의 기능이 제한됩니다.' + #13#10#13#10 + '1. 업무 프로그램 외 인터넷 접속 차단' + #13#10 + ' - 업무PC가상화, MS Teams, 페이퍼리스, 외부메일서버 외 모든 접속이 차단됩니다.' + #13#10 + '2. 프린터 출력 금지' + #13#10 + ' - 개인 프린터 출력이 제한됩니다.' + #13#10 + '3. 공공장소(커피숍 등) 무선 와이파이 접속 차단' + #13#10 + '4. 일정 유휴시간 경과 시 VPN 접속이 차단됩니다.'; type TDlgLicense = class(TForm) imgMain: TImage; chAgree: TCheckBox; imgOk: TImage; imgBtnList: TPngImageList; Label1: TLabel; Label2: TLabel; Label3: TLabel; lbSecureAgree: TLabel; mmGuide: TMemo; mmAgree: TMemo; tInit: TTimer; lbCloseMsg: TLabel; tClose: TTimer; edAgree: TEdit; imgBsoneTop: TImage; lbOk: TLabel; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure tInitTimer(Sender: TObject); procedure imgMainMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure imgOkMouseEnter(Sender: TObject); procedure imgOkMouseLeave(Sender: TObject); procedure imgOkClick(Sender: TObject); procedure tCloseTimer(Sender: TObject); procedure FormShow(Sender: TObject); private { Private declarations } Mutex_: TTgMutex; nClose_: Integer; sTitle_, sOrgContent: String; OldAfterLanguageLoad_: TAfterLanguageLoadEvent; procedure SetImgBtn(nImgIdx: Integer); public { Public declarations } Constructor Create(aOwner: TComponent); override; procedure CreateParams(var Params: TCreateParams); override; Destructor Destroy; override; procedure OnAfterLanguageLoad(Sender: TObject; const LanguageFile: string); procedure PopupLicense(sJsonData: String); procedure process_WM_SYSCOMMAND(var msg: TWMSysCommand); Message WM_SYSCOMMAND; end; var DlgLicense: TDlgLicense; implementation uses ManagerService, Tocsg.Exception, superobject, Condition, Winapi.Imm, GlobalDefine, Tocsg.Path; resourcestring RS_FMT_CutTimer = '미동의 시 %d초 후 네트워크가 차단 됩니다.'; RS_SecuAgree = '보안 사용 동의'; RS_SecuAgree_ABL = 'ABL생명 정보보안 서약서 동의'; {$R *.dfm} Constructor TDlgLicense.Create(aOwner: TComponent); begin Inherited Create(aOwner); // if CUSTOMER_TYPE = CUSTOMER_KFTC then // begin // chAgree.Enabled := false; // chAgree.Visible := false; // // edAgree.Enabled := true; // edAgree.Visible := true; // edAgree.Top := 613; // edAgree.Left := 47; // // imgOk.Top := 652; // end; // chAgree.Top := 613; // chAgree.Left := 47; OldAfterLanguageLoad_ := nil; Mutex_ := TTgMutex.Create(MUTEX_LICENSE); SetImgBtn(0); if CUSTOMER_TYPE = CUSTOMER_KR then begin nClose_ := 300; mmGuide.Lines.Add(KR_VPN_DESC); end else begin nClose_ := 60; mmGuide.Lines.Add(DEF_VPN_DESC); end; if IsLicenseCount then lbCloseMsg.Caption := Format(RS_FMT_CutTimer, [nClose_]) else lbCloseMsg.Visible := false; if CUSTOMER_TYPE = CUSTOMER_ABL then begin Label1.Caption := RS_SecuAgree_ABL; Label1.Font.Color := clRed; end else Label1.Caption := RS_SecuAgree; imgBsoneTop.Visible := IsBS1Display; sOrgContent := mmGuide.Text; if Pos('412', FreeLocalizer.LanguageFile) = 0 then begin var sGuide: String := GetRunExePathDir + 'AppUseageGuide.txt'; if FileExists(sGuide) then mmGuide.Lines.LoadFromFile(sGuide, TEncoding.UTF8); end; tInit.Enabled := true; end; procedure TDlgLicense.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); Params.ExStyle := WS_EX_APPWINDOW; Params.WindowClass.Style := Params.WindowClass.Style or CS_DROPSHADOW; Params.WndParent := GetDesktopWindow; end; Destructor TDlgLicense.Destroy; begin FreeAndNil(Mutex_); Inherited; end; procedure TDlgLicense.OnAfterLanguageLoad(Sender: TObject; const LanguageFile: string); begin if Assigned(OldAfterLanguageLoad_) then OldAfterLanguageLoad_(Sender, LanguageFile); if Pos('412', FreeLocalizer.LanguageFile) = 0 then begin var sGuide: String := GetRunExePathDir + 'AppUseageGuide.txt'; if FileExists(sGuide) then mmGuide.Lines.LoadFromFile(sGuide, TEncoding.UTF8); end else mmGuide.Text := sOrgContent; lbSecureAgree.Caption := sTitle_; if CUSTOMER_TYPE = CUSTOMER_ABL then begin Label1.Caption := RS_SecuAgree_ABL; Label1.Font.Color := clRed; end else Label1.Caption := RS_SecuAgree; end; procedure TDlgLicense.PopupLicense(sJsonData: String); var O: ISuperObject; begin try sTitle_ := 'Unknown'; if gMgSvc.IsNewApi then begin sTitle_ := gMgSvc.PrefModel.EulaTitle; lbSecureAgree.Caption := sTitle_; mmAgree.Text := StringReplace(gMgSvc.PrefModel.EulaBody, '\r\n', #13#10, [rfReplaceAll]); end else if sJsonData <> '' then begin O := SO(sJsonData); if (O <> nil) and (O.O['resultStr'] <> nil) and (O.O['resultStr'].S['eulatitle'] <> '') then begin sTitle_ := O.O['resultStr'].S['eulatitle']; lbSecureAgree.Caption := sTitle_; mmAgree.Text := StringReplace(O.O['resultStr'].S['eulacontent'], '\r\n', #13#10, [rfReplaceAll]); end; end; except on E: Exception do ETgException.TraceException(Self, E, 'Fail .. PopupLicense()'); end; Show; end; procedure TDlgLicense.FormClose(Sender: TObject; var Action: TCloseAction); begin if Assigned(OldAfterLanguageLoad_) then FreeLocalizer.AfterLanguageLoad := OldAfterLanguageLoad_; Action := caFree; end; procedure TDlgLicense.FormShow(Sender: TObject); begin if Assigned(FreeLocalizer.AfterLanguageLoad) then OldAfterLanguageLoad_ := FreeLocalizer.AfterLanguageLoad; FreeLocalizer.AfterLanguageLoad := OnAfterLanguageLoad; end; procedure TDlgLicense.imgMainMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin ReleaseCapture; SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0); end; procedure TDlgLicense.imgOkClick(Sender: TObject); var sAgree: String; begin sAgree := Trim(edAgree.Text); if chAgree.Checked or (sAgree = '동의합니다') or (sAgree = '동의합니다.') then begin gMgSvc.SendAgreeInfo; Close; end; end; procedure TDlgLicense.imgOkMouseEnter(Sender: TObject); begin SetImgBtn(1); end; procedure TDlgLicense.imgOkMouseLeave(Sender: TObject); begin SetImgBtn(0); end; procedure TDlgLicense.SetImgBtn(nImgIdx: Integer); begin imgBtnList.GetIcon(nImgIdx, imgOk.Picture.Icon); imgOk.Repaint end; procedure TDlgLicense.tCloseTimer(Sender: TObject); begin Dec(nClose_); lbCloseMsg.Caption := Format(RS_FMT_CutTimer, [nClose_]); if nClose_ <= 0 then begin tClose.Enabled := false; gMgSvc.VulService.SetDisconnect(true, true); if not gMgSvc.IsSafeExitImpossible then begin Close; end else begin // 다시 반복 22_0725 14:07:04 kku // 반복되지 않도록 요청 사항 들어옴 (KR) 22_0809 16:50:40 kku // if CUSTOMER_TYPE = CUSTOMER_KR then // nClose_ := 300 // else // nClose_ := 60; // tClose.Enabled := true; lbCloseMsg.Visible := false; end; end; Application.ProcessMessages; end; procedure TDlgLicense.tInitTimer(Sender: TObject); begin tInit.Enabled := false; if MuTex_.MutexState <> msCreateOk then Close; // FormStyle := fsNormal; if IsLicenseCount then begin lbCloseMsg.Visible := true; tClose.Enabled := true; end; end; procedure TDlgLicense.process_WM_SYSCOMMAND(var msg: TWMSysCommand); begin if msg.CmdType = SC_CLOSE then exit; Inherited; end; end.