2288 lines
66 KiB
Plaintext
2288 lines
66 KiB
Plaintext
unit DeCrmHeInstMain;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls,
|
|
Vcl.Imaging.pngimage, PngImageList, System.ImageList, Vcl.ImgList,
|
|
Vcl.WinXPanels, Vcl.ComCtrls, VirtualTrees, Vcl.Buttons,
|
|
IdHTTP, IdSSLOpenSSL, IdIOHandler, System.Actions, Vcl.ActnList, AbZipper, AbArcTyp,
|
|
AbUtils, Tocsg.Obj, superobject, System.Net.HttpClient, System.Net.URLClient;
|
|
|
|
//{$DEFINE _MOTRAS_}
|
|
//{$DEFINE _SILENT_}
|
|
|
|
const
|
|
IGNORE_INTERGRITY_FILES = 'ptnsch.dat|eCrmHeServiced.dll|bootone.dll';
|
|
|
|
type
|
|
PInstEnt = ^TInstEnt;
|
|
TInstEnt = record
|
|
sName,
|
|
sDesc: String;
|
|
end;
|
|
|
|
TDlgeCrmHeInstMain = class(TForm)
|
|
seMain: TShape;
|
|
Label1: TLabel;
|
|
imgLogo: TImage;
|
|
imgProg: TImage;
|
|
imgMain: TImage;
|
|
imgMin: TImage;
|
|
imgExit: TImage;
|
|
imgNext: TImage;
|
|
imgPrev: TImage;
|
|
imgBtns: TPngImageList;
|
|
imgProgs: TPngImageCollection;
|
|
imgBtns2: TPngImageList;
|
|
cpMain: TCardPanel;
|
|
cdWelcome: TCard;
|
|
Label2: TLabel;
|
|
lbWC_Msg1: TLabel;
|
|
lbWC_Msg2: TLabel;
|
|
cdLicense: TCard;
|
|
Label5: TLabel;
|
|
Label6: TLabel;
|
|
mmLicense: TMemo;
|
|
rdAgree: TRadioButton;
|
|
rdNoAgree: TRadioButton;
|
|
cdInfo: TCard;
|
|
Label7: TLabel;
|
|
Label8: TLabel;
|
|
Label9: TLabel;
|
|
Label10: TLabel;
|
|
edEmpNo: TEdit;
|
|
edVpnId: TEdit;
|
|
cdInstall: TCard;
|
|
Label11: TLabel;
|
|
imgProcess: TImage;
|
|
Label12: TLabel;
|
|
pg: TProgressBar;
|
|
vtList: TVirtualStringTree;
|
|
cdCompleted: TCard;
|
|
lbCompleted: TLabel;
|
|
lbCompletedMsg: TLabel;
|
|
lbExitMsg: TLabel;
|
|
tExit: TTimer;
|
|
cdInstalled: TCard;
|
|
imgBtnInit: TPngImageCollection;
|
|
imgDelete: TImage;
|
|
imgReinstall: TImage;
|
|
Label15: TLabel;
|
|
Label16: TLabel;
|
|
imgInstalled: TImage;
|
|
tSilent: TTimer;
|
|
cdUserInfoAgree: TCard;
|
|
Label13: TLabel;
|
|
Label14: TLabel;
|
|
mmUserInfoAgree: TMemo;
|
|
rdAgree2: TRadioButton;
|
|
rdNoAgree2: TRadioButton;
|
|
btnInfo: TSpeedButton;
|
|
chCheckEmpNo: TCheckBox;
|
|
imgTops: TPngImageCollection;
|
|
pnProg: TPanel;
|
|
Label3: TLabel;
|
|
Label4: TLabel;
|
|
Label17: TLabel;
|
|
Label18: TLabel;
|
|
Label19: TLabel;
|
|
lbDelete: TLabel;
|
|
lbReinstall: TLabel;
|
|
mmLicense_en: TMemo;
|
|
ActionList: TActionList;
|
|
acAgree: TAction;
|
|
acNoAgree: TAction;
|
|
acNext: TAction;
|
|
acPrev: TAction;
|
|
acComplete: TAction;
|
|
acReinstall: TAction;
|
|
Label20: TLabel;
|
|
edtIPAddress: TEdit;
|
|
edtPort: TEdit;
|
|
Label21: TLabel;
|
|
chkIPCheck: TCheckBox;
|
|
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure imgMinClick(Sender: TObject);
|
|
procedure imgExitClick(Sender: TObject);
|
|
procedure imgMinMouseEnter(Sender: TObject);
|
|
procedure imgMinMouseLeave(Sender: TObject);
|
|
procedure imgPrevMouseEnter(Sender: TObject);
|
|
procedure imgPrevMouseLeave(Sender: TObject);
|
|
procedure imgNextClick(Sender: TObject);
|
|
procedure imgPrevClick(Sender: TObject);
|
|
procedure rdAgreeClick(Sender: TObject);
|
|
procedure rdNoAgreeClick(Sender: TObject);
|
|
procedure tExitTimer(Sender: TObject);
|
|
procedure imgDeleteMouseEnter(Sender: TObject);
|
|
procedure imgDeleteMouseLeave(Sender: TObject);
|
|
procedure imgReinstallClick(Sender: TObject);
|
|
procedure imgDeleteClick(Sender: TObject);
|
|
procedure vtListGetNodeDataSize(Sender: TBaseVirtualTree;
|
|
var NodeDataSize: Integer);
|
|
procedure vtListFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
|
procedure vtListGetHint(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
|
Column: TColumnIndex; var LineBreakStyle: TVTTooltipLineBreakStyle;
|
|
var HintText: string);
|
|
procedure vtListGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
|
Column: TColumnIndex; TextType: TVSTTextType; var CellText: string);
|
|
procedure edVpnIdKeyPress(Sender: TObject; var Key: Char);
|
|
procedure tSilentTimer(Sender: TObject);
|
|
procedure edEmpNoKeyPress(Sender: TObject; var Key: Char);
|
|
procedure btnInfoClick(Sender: TObject);
|
|
procedure lbDeleteMouseEnter(Sender: TObject);
|
|
procedure lbDeleteMouseLeave(Sender: TObject);
|
|
procedure lbReinstallMouseEnter(Sender: TObject);
|
|
procedure lbReinstallMouseLeave(Sender: TObject);
|
|
procedure acAgreeExecute(Sender: TObject);
|
|
procedure acNoAgreeExecute(Sender: TObject);
|
|
procedure acReinstallExecute(Sender: TObject);
|
|
procedure acCompleteExecute(Sender: TObject);
|
|
procedure acNextExecute(Sender: TObject);
|
|
procedure acPrevExecute(Sender: TObject);
|
|
procedure clickIpCheck(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
HTTP_: TIdHTTP;
|
|
SSL_: TIdSSLIOHandlerSocketOpenSSL;
|
|
sEmpNoVerifyOK_: String;
|
|
|
|
ip_: string;
|
|
port_: string;
|
|
serverInfo_: string;
|
|
procedure InitHttp;
|
|
function btnIpCheckClick: Boolean;
|
|
function CheckEmpNo: Boolean;
|
|
function LoadEmpNo: Boolean;
|
|
procedure SetImgBtn(aImgList: TPngImageList; imgBtn: TImage; nImgIdx: Integer);
|
|
procedure SetImgCtrl(aImgList: TPngImageCollection; imgCtrl: TImage; nImgIdx: Integer);
|
|
procedure SetLangRes;
|
|
function GetLangRes(sOrg, sRes: String): String;
|
|
procedure SetBoldEntProg(n: Integer);
|
|
function ProcessCheckId_CJONS: Boolean;
|
|
public
|
|
{ Public declarations }
|
|
Constructor Create(aOwner: TComponent); override;
|
|
Destructor Destroy; override;
|
|
|
|
procedure process_WM_SYSCOMMAND(var msg: TWMSysCommand); Message WM_SYSCOMMAND;
|
|
end;
|
|
|
|
TInstFileInfo = class(TTgObject)
|
|
private
|
|
IgrFList_ : TStringList;
|
|
|
|
procedure OnZipConfirmItem(Sender : TObject; Item : TAbArchiveItem; ProcessType : TAbProcessType; var Confirm : Boolean);
|
|
public
|
|
CurrDir: String;
|
|
FileList_: TStringList;
|
|
Constructor Create;
|
|
Destructor Destroy; override;
|
|
procedure SaveFileInfo(sPath: String);
|
|
end;
|
|
|
|
type
|
|
TCertValidator = class
|
|
public
|
|
procedure DoValidateServerCertificate(const Sender: TObject; const ARequest: TURLRequest;
|
|
const Certificate: TCertificate; var Accepted: Boolean);
|
|
end;
|
|
|
|
function ProcessInstall(aInstForm: TDlgeCrmHeInstMain; bStartSvc: Boolean = false): Boolean;
|
|
|
|
var
|
|
DlgeCrmHeInstMain: TDlgeCrmHeInstMain;
|
|
|
|
implementation
|
|
|
|
uses
|
|
Tocsg.Registry,
|
|
Define, Tocsg.Path, ProcessUninstall, GlobalDefine, Tocsg.VTUtil,
|
|
Tocsg.Safe, Tocsg.Exception, Tocsg.Service,
|
|
Winapi.WinSvc, Tocsg.Process, Tocsg.Shell, Tocsg.Files,
|
|
Tocsg.Strings, CrmLogger, Tocsg.Trace, Tocsg.WTS, Tocsg.Win32, Condition, Tocsg.Encrypt,
|
|
Tocsg.WinInfo, CrmUtil, AbUnzper,
|
|
GlobalOutAddInDefine, DUserInfoAgree, ManagerModel, Tocsg.Convert, Lang,
|
|
Tocsg.Hash;
|
|
|
|
{$R *.dfm}
|
|
|
|
resourcestring
|
|
RS_FMT_EmpNoInfo = '사번 : %s'#13#10'이름 : %s'#13#10'부서 : %s'#13#10'상태 : %s';
|
|
RS_FMT_EmpNoInfo2 = 'ID : %s'#13#10'이름 : %s'#13#10'부서 : %s'#13#10'상태 : %s';
|
|
RS_GetEmpNoInfo = '사번 정보를 확인했습니다.';
|
|
RS_GetEmpNoInfo2 = 'ID 정보를 확인했습니다.';
|
|
RS_Deleted = '삭제됨';
|
|
RS_Normal = '정상';
|
|
RS_InvaludEmpNo = '유효하지 않은 사번입니다.';
|
|
RS_InvaludEmpNo2 = '유효하지 않은 ID 입니다.';
|
|
RS_InputEmpNo = '"사번"을 입력해주십시오.';
|
|
RS_InputEmpNo2 = 'ID를 입력해주십시오.';
|
|
RS_FMT_TERMINATE = '설치 마법사는 %d 초 후 종료됩니다.';
|
|
RS_Q_Delete = '삭제하시겠습니까?';
|
|
RS_DeleteComp = '삭제 완료';
|
|
RS_MsgDeleted = '삭제가 완료되었습니다.';
|
|
RS_MsgNoDelete = '삭제를 완료하지 못했습니다.'+#13+#10+'잠시후 다시 시도해 주십시오.';
|
|
RS_Q_Exit = '설치를 종료하시겠습니까?';
|
|
|
|
var
|
|
_nExitSec: Integer = 5;
|
|
|
|
{ TInstFileInfo }
|
|
|
|
Constructor TInstFileInfo.Create;
|
|
begin
|
|
Inherited Create;
|
|
IgrFList_ := TStringList.Create;
|
|
IgrFList_.CaseSensitive := false;
|
|
SplitString(IGNORE_INTERGRITY_FILES, '|', IgrFList_);
|
|
FileList_ := TStringList.Create;
|
|
end;
|
|
|
|
Destructor TInstFileInfo.Destroy;
|
|
begin
|
|
// FileList_.SaveToFile('c:\test.txt');
|
|
FreeAndNil(FileList_);
|
|
FreeAndNil(IgrFList_);
|
|
Inherited;
|
|
end;
|
|
|
|
procedure TInstFileInfo.OnZipConfirmItem(Sender : TObject; Item : TAbArchiveItem; ProcessType : TAbProcessType; var Confirm : Boolean);
|
|
begin
|
|
try
|
|
Confirm := true;
|
|
if (ProcessType = ptExtract) and not Item.IsDirectory and (IgrFList_.IndexOf(Item.FileName) = -1) then
|
|
FileList_.Add(CurrDir + StringReplace(Item.FileName, '/', '\', [rfReplaceAll]));
|
|
except
|
|
on E: Exception do
|
|
ETgException.TraceException(Self, E, 'Fail .. OnZipConfirmItem()');
|
|
end;
|
|
end;
|
|
|
|
procedure TInstFileInfo.SaveFileInfo(sPath: String);
|
|
var
|
|
OA, O: ISuperObject;
|
|
i: Integer;
|
|
sHash: String;
|
|
ss: TStringStream;
|
|
|
|
begin
|
|
try
|
|
OA := TSuperObject.Create(stArray);
|
|
|
|
for i := 0 to FileList_.Count - 1 do
|
|
begin
|
|
if FileExists(FileList_[i]) then
|
|
begin
|
|
|
|
// if Pos('si.dat', FileList_[i]) > 0 then
|
|
// begin
|
|
// var sidat, encsidat: TStringStream;
|
|
// var siO:ISuperObject;
|
|
//
|
|
// Guard(sidat, TStringStream.Create('', TEncoding.UTF8));
|
|
// sidat.LoadFromFile(FileList_[i]);
|
|
//// siO := SO(sidat.DataString);
|
|
// OutputDebugString(PChar(Format('[MGKIM] Encrypt ok : DataString : %s',[sidat.DataString])));
|
|
// Guard(encsidat, TStringStream.Create(
|
|
// EncStrToBinStr(ekAes256cbc, PASS_MODEL, sidat.DataString), TEncoding.UTF8));
|
|
// encsidat.SaveToFile(FileList_[i]);
|
|
// OutputDebugString(PChar(Format('[MGKIM] Encrypt ok : %s',[PChar(FileList_[i])])));
|
|
// end;
|
|
|
|
sHash := GetFileToSha256(FileList_[i]);
|
|
if sHash <> '' then
|
|
begin
|
|
O := SO;
|
|
O.S['P'] := FileList_[i];
|
|
O.S['H'] := sHash;
|
|
OA.AsArray.Add(O);
|
|
|
|
OutputDebugString(PChar(Format('[MGKIM] P: %s, H: %s',[PChar(FileList_[i]), PChar(sHash)])));
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
O := SO;
|
|
O.O['List'] := OA;
|
|
Guard(ss, TStringStream.Create(
|
|
EncStrToBinStr(ekAes256cbc, PASS_MODEL, O.AsString), TEncoding.UTF8));
|
|
|
|
ss.SaveToFile(sPath);
|
|
//SaveJsonObjToFile(O, sPath);
|
|
except
|
|
on E: Exception do
|
|
ETgException.TraceException(Self, E, 'Fail .. SaveFileInfo()');
|
|
end;
|
|
end;
|
|
|
|
function ProcessInstall(aInstForm: TDlgeCrmHeInstMain; bStartSvc: Boolean = false): Boolean;
|
|
|
|
procedure AddInstEnt(sName, sDesc: String);
|
|
var
|
|
pData: PInstEnt;
|
|
begin
|
|
if aInstForm <> nil then
|
|
begin
|
|
pData := VT_AddChildData(aInstForm.vtList);
|
|
pData.sName := sName;
|
|
pData.sDesc := sDesc;
|
|
aInstForm.pg.Position := aInstForm.pg.Position + 1;
|
|
Application.ProcessMessages;
|
|
end;
|
|
end;
|
|
|
|
var
|
|
sSysDir,
|
|
sInstDir,
|
|
sBackDir,
|
|
sResPath: String;
|
|
CompModel: TCompanyModel;
|
|
AgentModel: TAgentModel;
|
|
InstFileInfo: TInstFileInfo;
|
|
|
|
function GetRes(sId: String; sBackName: String = ''): Boolean;
|
|
var
|
|
res: TResourceStream;
|
|
begin
|
|
Result := false;
|
|
|
|
if FileExists(sResPath) then
|
|
DeleteFile(sResPath);
|
|
|
|
try
|
|
res := TResourceStream.Create(HInstance, sId, 'raw');
|
|
if res <> nil then
|
|
begin
|
|
res.SaveToFile(sResPath);
|
|
if sBackName <> '' then
|
|
res.SaveToFile(sBackDir + sBackName);
|
|
res.Free;
|
|
Result := true;
|
|
end;
|
|
except
|
|
on E: Exception do
|
|
ETgException.TraceException(E, Format('Fail .. GetRes(), ID="%s"', [sId]));
|
|
end;
|
|
end;
|
|
|
|
function ExtrZip(sDestDir: String; bAddInfo: Boolean = false; bIgrErr: Boolean = false): Boolean;
|
|
var
|
|
zip: TAbUnZipper;
|
|
begin
|
|
Result := bIgrErr or false;
|
|
if not ForceDirectories(sDestDir) then
|
|
exit;
|
|
|
|
try
|
|
Guard(zip, TAbUnzipper.Create(nil));
|
|
zip.FileName := sResPath;
|
|
zip.ExtractOptions := [eoCreateDirs, eoRestorePath];
|
|
zip.BaseDirectory := sDestDir;
|
|
// zip.OnArchiveProgress := ;
|
|
// zip.OnNeedPassword := ;
|
|
|
|
if bAddInfo then
|
|
begin
|
|
InstFileInfo.CurrDir := IncludeTrailingPathDelimiter(sDestDir);
|
|
zip.OnConfirmProcessItem := InstFileInfo.OnZipConfirmItem;
|
|
end;
|
|
|
|
zip.ExtractFiles('*.*');
|
|
Result := true;
|
|
except
|
|
on E: Exception do
|
|
ETgException.TraceException(E, Format('Fail .. ExtrZip(), ExtrDir="%s"', [sDestDir]));
|
|
end;
|
|
|
|
// if ForceDirectories(sDestDir) then
|
|
// begin
|
|
// try
|
|
// TZipFile.ExtractZipFile(sResPath, sDestDir);
|
|
// Result := true;
|
|
// except
|
|
// on E: Exception do
|
|
// ETgException.TraceException(E, Format('Fail .. ExtrZip(), ExtrDir="%s"', [sDestDir]));
|
|
// end;
|
|
// end;
|
|
end;
|
|
|
|
function AddFileToZip(const sZipFilePath, sFileToAdd: string): Boolean;
|
|
var
|
|
zip: TAbZipper;
|
|
begin
|
|
Result := False;
|
|
|
|
if not FileExists(sFileToAdd) then
|
|
Exit;
|
|
|
|
try
|
|
zip := TAbZipper.Create(nil);
|
|
try
|
|
zip.FileName := sZipFilePath;
|
|
zip.StoreOptions := [soStripPath];
|
|
zip.AddFiles(sFileToAdd, 0);
|
|
zip.Save;
|
|
|
|
Result := True;
|
|
finally
|
|
zip.Free;
|
|
end;
|
|
except
|
|
on E: Exception do
|
|
ETgException.TraceException(E, Format('Fail .. AddFileToZip(), Zip="%s", File="%s"', [sZipFilePath, sFileToAdd]));
|
|
end;
|
|
end;
|
|
var
|
|
ProcInfo: TProcessInformation;
|
|
begin
|
|
Result := false;
|
|
|
|
if aInstForm <> nil then
|
|
begin
|
|
aInstForm.pg.Position := 0;
|
|
aInstForm.pg.Max := 6;
|
|
end else begin
|
|
// 기존에 설치된게 없다면 무시 22_0517 14:24:38 kku
|
|
sInstDir := GetProgramFilesDir + DIR_HE;
|
|
if not DirectoryExists(sInstDir) then
|
|
exit;
|
|
|
|
if not FileExists(sInstDir + EXE_HE) then
|
|
exit;
|
|
|
|
// 1.2.x 이하 버전에서는 PROP_USERINFO 사번 정보 데이터가 없다.
|
|
// 체크하지 않도록 수정 22_0711 15:39:07 kku
|
|
// if not FileExists(sInstDir + DIR_CONF + DAT_AGENT) and
|
|
// not FileExists(sInstDir + DIR_CONF + PROP_USERINFO) then
|
|
// exit;
|
|
end;
|
|
|
|
try
|
|
Guard(InstFileInfo, TInstFileInfo.Create);
|
|
ZeroMemory(@ProcInfo, SizeOf(ProcInfo));
|
|
if GetProcessPidByName(EXE_HE) <> 0 then
|
|
begin
|
|
// 구버전에서 설치를 위해 EXE_HE 리소스를 미리 추출한다 22_0517 13:59:04 kku
|
|
sInstDir := GetProgramFilesDir + DIR_TG;
|
|
if ForceDirectories(sInstDir) then
|
|
begin
|
|
sResPath := sInstDir + '$InstData';
|
|
if not GetRes('RS_HEBIN') then
|
|
exit;
|
|
if not ExtrZip(sInstDir + 'Temp\') then
|
|
exit;
|
|
DeleteFile(sResPath);
|
|
|
|
if CopyFile(PChar(sInstDir + 'Temp\' + EXE_HE), PChar(sInstDir + EXE_HE), false) then
|
|
begin
|
|
Sleep(500);
|
|
DeleteDir(sInstDir + 'Temp\', true, true);
|
|
|
|
// 실행중 재설치라면 EXE_HE 죽는거 보고 VPN이 따라 죽지 않도록 더미를 띄워준다. 22_0511 15:26:13 kku
|
|
var sCurPath: String := sInstDir + EXE_HE;
|
|
if FileExists(sCurPath) then
|
|
begin
|
|
Sleep(1000);
|
|
var O: ISuperObject := SO;
|
|
O.I['M'] := 11; // MODE_DUMMY
|
|
O.B['SD'] := true;
|
|
O.S['AM'] := MUTEX_INSTALLER;
|
|
var sParam: String := GetRunExePathDir + 'reqprm.json';
|
|
if SaveJsonObjToFile(O, sParam) then
|
|
ProcInfo := ExecuteApp(sCurPath, Format('-i "%s"', [sParam]), SW_HIDE)
|
|
else
|
|
DeleteFile(sCurPath);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
{$IFDEF _PATCH_}
|
|
var nUpdate: Integer := 1;
|
|
// 패치 시 화면잠금 상태 였는지 체크 추가 22_1018 13:55:28 kku
|
|
if FindWindow('TDlgLockScreen', nil) <> 0 then
|
|
nUpdate := 3;
|
|
|
|
SetRegValueInteger(HKEY_LOCAL_MACHINE, 'SOFTWARE\eCrmHomeEdition', 'update', nUpdate, true);
|
|
{$ELSE}
|
|
SetRegValueInteger(HKEY_LOCAL_MACHINE, 'SOFTWARE\eCrmHomeEdition', 'update', 2, true);
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _HDENG_}
|
|
{$IF Defined(HEC_2) or Defined(HEC_3)}
|
|
// 기존 개발계, 운영계
|
|
SetRegValueInteger(HKEY_LOCAL_MACHINE, 'SOFTWARE\eCrmHomeEdition', 'HEC_VER', 1, true);
|
|
{$ELSE}
|
|
// 고도화
|
|
SetRegValueInteger(HKEY_LOCAL_MACHINE, 'SOFTWARE\eCrmHomeEdition', 'HEC_VER', 2, true);
|
|
{$IFEND}
|
|
{$ENDIF}
|
|
|
|
AddInstEnt('Tocsg.Installation.Initiator', 'Initiate application check');
|
|
|
|
UninstallCrmHE(ProcInfo.dwProcessId, true); // aInstForm = nil {true = 패치});
|
|
|
|
sInstDir := GetProgramFilesDir + DIR_HE;
|
|
sBackDir := sInstDir + 'Resource\';
|
|
if not ForceDirectories(sInstDir) or not ForceDirectories(sBackDir) then
|
|
exit;
|
|
|
|
DeleteFile(sBackDir + 'rst.01');
|
|
// DeleteFile(sBackDir + 'rst.02'); // KV, 변동 없는 모듈의 경우 지우지 않음 23_1204 12:40:59 kku
|
|
DeleteFile(sBackDir + 'rst.03');
|
|
DeleteFile(sBackDir + 'rst.04');
|
|
DeleteFile(sBackDir + 'rst.05');
|
|
// DeleteFile(sBackDir + 'rst.06'); // Spool - Bs1psf.dat // 변동 없는 모듈의 경우 지우지 않음 23_1204 12:40:59 kku
|
|
|
|
// 업체 정보 암호화해서 저장
|
|
// 업체 정보 저장 버전이 전체적으로 모두 퍼진다면 이 코드는 _INST_ 에서만 사용하면 된다.
|
|
// 최종 목표는 패치 파일 하나만 빌드, 관리되는것 22_0624 08:23:35 kku
|
|
Guard(CompModel, TCompanyModel.Create);
|
|
CompModel.CustomerType := CUSTOMER_TYPE;
|
|
CompModel.CustomerSubType := CUSTOMER_SUB_TYPE;
|
|
CompModel.SvrDestList.Clear;
|
|
GetDestServerList(CompModel.SvrDestList);
|
|
CompModel.Save(sInstDir + DIR_CONF + DAT_COMPANY);
|
|
|
|
sResPath := sInstDir + '$InstData';
|
|
|
|
AddInstEnt('Tocsg.Installation.Service', 'Service check');
|
|
// if not DirectoryExists(sInstDir + 'bin\') and
|
|
if GetRes('RS_KVBIN', 'rst.02') then
|
|
begin
|
|
// 이건 패치의 경우 없을 수 있다. 22_0517 16:39:29 kku
|
|
ExtrZip(sInstDir + 'bin\', true);
|
|
end;
|
|
|
|
AddInstEnt('Tocsg.Installation.Component', 'Component check');
|
|
if not GetRes('RS_CONF', 'rst.03') then
|
|
exit;
|
|
if not ExtrZip(sInstDir + DIR_CONF, true) then
|
|
exit;
|
|
|
|
// Bs1shl.dll 탐색기 context popup menu 등록 23_0227 15:43:16 kku
|
|
if FileExists(sInstDir + DIR_CONF + DLL_SHELL) then
|
|
begin
|
|
if ExistsKey(HKEY_CLASSES_ROOT, REG_BS1_SHELL) then
|
|
begin
|
|
// todo : Bs1shl.dll 버전 체크 및 업데이트
|
|
{
|
|
if FileExists(sDir + DLL_SHELL) then
|
|
begin
|
|
// 이미 등록된 걸로 판단, DLL 버전 체크
|
|
FI := TKzFileInfo.Create(sDir + DLL_SHELL);
|
|
try
|
|
sOldVer := FI.Version;
|
|
finally
|
|
FI.Free;
|
|
end;
|
|
|
|
// 버전 업데이트 되었다면 해제 후 처리 19_0218 22:23:05 kku
|
|
FI := TKzFileInfo.Create(sDir + sDllName);
|
|
try
|
|
if sOldVer <> FI.Version then
|
|
begin
|
|
ExecutePath_hide('regsvr32.exe', '/s /u "' + sDir + DLL_SHELL + '"');
|
|
Sleep(500);
|
|
TerminateProcessByName('explorer.exe');
|
|
Sleep(500);
|
|
ExecutePath('explorer.exe');
|
|
DeleteFile_wait(sDir + DLL_SHELL);
|
|
end;
|
|
finally
|
|
FI.Free;
|
|
end;
|
|
end;
|
|
}
|
|
end else begin
|
|
// ExecutePath_hide('regsvr32.exe', '/s /i "' + sInstDir + DIR_CONF + DLL_SHELL + '"');
|
|
end;
|
|
end;
|
|
|
|
// 아웃룩 플러그인 설치
|
|
// {$IFNDEF _KIMCHANG_}
|
|
InstallOutlookAddin(sInstDir + DIR_CONF);
|
|
// {$ENDIF}
|
|
|
|
AddInstEnt('Tocsg.Installation.LicenseMgr', 'License check');
|
|
if not GetRes('RS_HEBIN', 'rst.01') then
|
|
exit;
|
|
if not ExtrZip(sInstDir, true) then
|
|
exit;
|
|
|
|
// 언어 추가 22_0810 16:48:03 kku
|
|
if GetRes('RS_LANG', 'rst.04') then
|
|
begin
|
|
ExtrZip(sInstDir + 'Language\', true);
|
|
end;
|
|
|
|
if GetRes('RS_SLCORE', 'rst.05') then
|
|
ExtrZip(sInstDir, true);
|
|
|
|
if not FileExists(sInstDir + DIR_CONF + EXE_SPL) and
|
|
GetRes('RS_EXTRSPOOL', 'rst.06') then
|
|
CopyFile(PChar(sResPath), PChar(sInstDir + DIR_CONF + EXE_SPL), false);
|
|
|
|
// 신한카드 safePC 삭제툴, 나중에 제거 해야함 23_0109 13:43:19 kku
|
|
{$IFDEF _SHCD_}
|
|
if GetRes('RS_SHCD_SAFEPC_DEL') then
|
|
begin
|
|
ExtrZip(sInstDir, false, true);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _LSITC_}
|
|
if GetRes('RS_LSITC_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _DEV_}
|
|
if GetRes('RS_DEV_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _DEMO_}
|
|
if GetRes('RS_DEMO_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _HDENG_}
|
|
if GetRes('RS_HEC_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
DeleteFile_wait(sInstDir + DIR_CONF + 'Bs1aip.dat');
|
|
MoveFile_wait(sInstDir + DIR_CONF + 'DRM_M.ico', sInstDir + DIR_CONF + 'Bs1aip.dat')
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _GEC_}
|
|
if GetRes('RS_GEC_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
DeleteFile_wait(sInstDir + DIR_CONF + 'Bs1aip.dat');
|
|
MoveFile_wait(sInstDir + DIR_CONF + 'DRM_M.ico', sInstDir + DIR_CONF + 'Bs1aip.dat')
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _HCA_}
|
|
if GetRes('RS_HCA_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _KDNVN_}
|
|
if GetRes('RS_KDNVN_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
DeleteFile_wait(sInstDir + DIR_CONF + 'Bs1aip.dat');
|
|
MoveFile_wait(sInstDir + DIR_CONF + 'DRM_M.ico', sInstDir + DIR_CONF + 'Bs1aip.dat')
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _UNITUS_}
|
|
if GetRes('RS_UNITUS_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _MOTRAS_}
|
|
if GetRes('RS_MOTRAS_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _SKEC_}
|
|
if GetRes('RS_SKEC_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _WHANIN_}
|
|
if GetRes('RS_WHANIN_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _BLUECORNER_}
|
|
if GetRes('RS_WELCAPI_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
// {$IFDEF _JUVIS_}
|
|
// if GetRes('RS_JUVIS_DATA') then
|
|
// begin
|
|
// ExtrZip(sInstDir + DIR_CONF);
|
|
// end;
|
|
// {$ENDIF}
|
|
|
|
{$IFDEF _SERVE1_}
|
|
if GetRes('RS_SERVE1_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
{$IFDEF _PATCH_}
|
|
var sUnInst: String := GetProgramFilesDir + DIR_HE + DIR_CONF + 'InstallCleaner.exe';
|
|
if FileExists(sUnInst) then
|
|
DeleteFile(sUnInst);
|
|
{$ENDIF}
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _KBIZ_}
|
|
if GetRes('RS_KBIZ_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _KORENTAL_}
|
|
if GetRes('RS_KORENTAL_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _SHCI_}
|
|
if GetRes('RS_SHCI_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _SHSC_}
|
|
if GetRes('RS_SHSC_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _WINSTN_}
|
|
if GetRes('RS_WINSTN_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _SANKYO_}
|
|
if GetRes('RS_SANKYO_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _LOTTEMART_}
|
|
if GetRes('RS_LOTTEMART_FSD') then
|
|
begin
|
|
ExtrZip(sInstDir);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _CJONS_}
|
|
if GetRes('RS_CJOVN_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _WELFNI_}
|
|
if GetRes('RS_WFNI_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _WELFND_}
|
|
if GetRes('RS_WFND_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _GIORDANO_}
|
|
if GetRes('RS_GIORDANO_DATA') then
|
|
begin
|
|
ExtrZip(sInstDir + DIR_CONF);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _SANKYO_}
|
|
// 다이이찌산쿄 아웃룩 플러그인 체크값 초기화, 160버전까지 유지필요 24_0325 10:45:49 kku
|
|
if GetRegValueAsInteger(HKEY_LOCAL_MACHINE, REG_HE, 'DSK_OI') <> 1 then
|
|
begin
|
|
DelRegKey(HKEY_CLASSES_ROOT, REG_BS1OutlookAddInKey);
|
|
SetRegValueInteger(HKEY_LOCAL_MACHINE, REG_HE, 'DSK_OI', 1, true);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _KIMCHANG_}
|
|
if GetRes('RS_XPRINT_DATA') then
|
|
begin
|
|
sSysDir := sInstDir[1] + ':\ProgramData\' + DIR_XPRINT;
|
|
ExtrZip(sSysDir);
|
|
|
|
case GetServiceStatus('BSonePrintService') of
|
|
SERVICE_RUNNING,
|
|
SERVICE_START_PENDING : ;
|
|
else begin
|
|
ExecutePath_hide(sSysDir + EXE_xPrintSvc, '-install');
|
|
end;
|
|
end;
|
|
|
|
end;
|
|
{$ENDIF}
|
|
|
|
// MG.exe에서 사용할거 같은? DLL 배포
|
|
if not GetRes('RS_DLLS') then
|
|
exit;
|
|
sSysDir := GetSystemDir;
|
|
if not ExtrZip(sSysDir, false, true) then
|
|
exit;
|
|
DeleteFile(sResPath);
|
|
|
|
AddInstEnt('Tocsg.Installation.Executable', 'Environment check');
|
|
|
|
if aInstForm <> nil then
|
|
begin
|
|
Guard(AgentModel, TAgentModel.Create);
|
|
AgentModel.Load(sInstDir + DIR_CONF + DAT_AGENT); // 기존 정보도 남겨두기 위해 22_0610 13:43:31 kku
|
|
AgentModel.EmpNo := aInstForm.edEmpNo.Text;
|
|
// AgentModel.VpnInfo := aInstForm.edEmpNo.Text; // aInstForm.edVpnId.Text;
|
|
AgentModel.HostName := GetComName;
|
|
AgentModel.DomainName := AgentModel.HostName + '\' + GetAccount;
|
|
AgentModel.Account := WTS_GetCurrentUserName;
|
|
if AgentModel.Account = '' then
|
|
AgentModel.Account := GetAccount;
|
|
AgentModel.UserName := ExtractFilePath(AgentModel.DomainName) + AgentModel.Account;
|
|
AgentModel.Save(sInstDir + DIR_CONF + DAT_AGENT);
|
|
end;
|
|
|
|
|
|
|
|
AddInstEnt('Tocsg.Installation.ServiceManager', 'Windows Service Registration');
|
|
|
|
// 레지스트리로 대체 22_0621 08:25:19 kku
|
|
// if aInstForm = nil then
|
|
// begin
|
|
// // HE.exe 실행 시 패치됐다는걸 알기 위해 만들어줌 22_0531 14:10:31 kku
|
|
// WriteLnFileEndUTF8(sInstDir + LOG_PATCH, DateTimeToStr(Now));
|
|
// end;
|
|
|
|
if FileExists(sInstDir + DLL_SV) then
|
|
begin
|
|
// 서비스 DLL 구동
|
|
// 서비스 DLL로 구동하면 프로그램 파일즈, 프로세스 목록에 접근 하지 못하는 현상이 발견됐다... 22_0511 17:21:35 kku
|
|
if not MoveFile(PChar(sInstDir + DLL_SV), PChar(sSysDir + DLL_SV)) then
|
|
exit;
|
|
Sleep(1000);
|
|
|
|
InstFileInfo.FileList_.Add(PChar(sSysDir + DLL_SV));
|
|
|
|
AddInstEnt('Tocsg.Installation.Validator', 'Validating the installation');
|
|
if ServiceExists(NAME_SERVICE) or
|
|
InstallServiceDll(sSysDir + DLL_SV,
|
|
SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START) then
|
|
begin
|
|
Sleep(500);
|
|
|
|
if bStartSvc then
|
|
begin
|
|
Result := ServiceStart(NAME_SERVICE);
|
|
|
|
// 서비스를 숨기면 윈도우 메이저 업데이트 시 서비스가 사라지는 문제가 있음 24_0105 08:18:24 kku
|
|
// SetVisibleService(NAME_SERVICE, false);
|
|
end else
|
|
Result := true;
|
|
end;
|
|
end else begin
|
|
if not MoveFile(PChar(sInstDir + EXE_SV), PChar(sSysDir + EXE_SV)) then
|
|
exit;
|
|
Sleep(1000);
|
|
|
|
InstFileInfo.FileList_.Add(PChar(sSysDir + EXE_SV));
|
|
|
|
AddInstEnt('Tocsg.Installation.Validator', 'Validating the installation');
|
|
if InstallService(NAME_SERVICE, sSysDir + EXE_SV, NAME_SERVICE,
|
|
SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START) then
|
|
begin
|
|
Sleep(500);
|
|
if bStartSvc then
|
|
begin
|
|
Result := ServiceStart(NAME_SERVICE);
|
|
// 서비스를 숨기면 윈도우 메이저 업데이트 시 서비스가 사라지는 문제가 있음 24_0105 08:18:24 kku
|
|
// SetVisibleService(NAME_SERVICE, false);
|
|
end else
|
|
Result := true;
|
|
end;
|
|
end;
|
|
|
|
if Result then
|
|
begin
|
|
var O: ISuperObject;
|
|
var ss: TStringStream;
|
|
|
|
O := SO;
|
|
O.S['SvrDest'] := DlgeCrmHeInstMain.serverInfo_;
|
|
Guard(ss, TStringStream.Create(
|
|
EncStrToBinStr(ekAes256cbc, PASS_MODEL, O.AsString), TEncoding.UTF8));
|
|
|
|
ss.SaveToFile(sInstDir + 'si.dat');
|
|
OutputDebugString(PChar(Format('[MGKIM] si dat ok : %s, %s',[PChar(sInstDir + 'si.dat'), DlgeCrmHeInstMain.serverInfo_])));
|
|
InstFileInfo.FileList_.Add(PChar(sInstDir + 'si.dat'));
|
|
|
|
AddFileToZip(sBackDir + 'rst.01', sInstDir + 'si.dat');
|
|
InstFileInfo.SaveFileInfo(sBackDir + 'rst.00');
|
|
end;
|
|
|
|
{$IFDEF _SILENT_}
|
|
{$IFDEF _SHCD_}
|
|
var sPath: String := GetWindowsDir;
|
|
if Length(sPath) > 0 then
|
|
begin
|
|
sPath := sPath[1] + Format(':\Users\%s\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\eCrmHeSilentInstaller.lnk', [GetUserNameFromReg]);
|
|
if FileExists(sPath) then
|
|
DeleteFile(PChar(sPath));
|
|
sPath := sPath[1] + ':\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\eCrmHeSilentInstaller.lnk';
|
|
if FileExists(sPath) then
|
|
DeleteFile(PChar(sPath));
|
|
end;
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
|
|
CopyRegKey(HKEY_LOCAL_MACHINE, 'SYSTEM\ControlSet001\Services\SvcCrmHe', 'SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\SvcCrmHe');
|
|
CopyRegKey(HKEY_LOCAL_MACHINE, 'SYSTEM\ControlSet001\Services\SvcCrmHe', 'SYSTEM\CurrentControlSet\Control\SafeBoot\Network\SvcCrmHe');
|
|
|
|
// {$IFDEF _CJONS_}
|
|
// {$IFDEF _DEMO_}
|
|
//// // 현재 사용자 권한으로 실행 24_1212 13:40:32 kku
|
|
// SetRegValueString(HKEY_LOCAL_MACHINE, 'SYSTEM\ControlSet001\Services\SvcCrmHe', 'EA', 'Admin', true);
|
|
//// SetRegValueString(HKEY_LOCAL_MACHINE, 'SYSTEM\ControlSet001\Services\SvcCrmHe', 'EA', 'User', true);
|
|
// {$ENDIF}
|
|
except
|
|
on E: Exception do
|
|
ETgException.TraceException(E, 'Fail .. ProcessInstall()');
|
|
end;
|
|
end;
|
|
|
|
{ TDlgeCrmHeInstMain }
|
|
|
|
Constructor TDlgeCrmHeInstMain.Create(aOwner: TComponent);
|
|
|
|
function IsUninstall: Boolean;
|
|
begin
|
|
// 기본으로 삭제버튼 숨기도록 기능 수정 24_0206 10:49:11 kku
|
|
Result := false;
|
|
|
|
{$IFDEF _METLIFE_} Result := true; {$ENDIF} // 메트라이프
|
|
{$IFDEF _SANKYO_} Result := true; {$ENDIF} // 한국다이이찌산쿄
|
|
{$IFDEF _CNSCERT_} Result := true; {$ENDIF} // LGCNS(인증)
|
|
{$IFDEF _CNSMYDATA_} Result := true; {$ENDIF} // LGCNS(mydata)
|
|
{$IFDEF _KOCES_} Result := true; {$ENDIF} // 한국신용카드결제
|
|
{$IFDEF _AUTOLEASE_} Result := true; {$ENDIF} // 롯데오토리스
|
|
{$IFDEF _HDQUMING_} Result := true; {$ENDIF} // 현대렌탈케어
|
|
{$IFDEF _HANYANG_} Result := true; {$ENDIF} // 한양증권
|
|
{$IFDEF _NHL_} Result := true; {$ENDIF} // NH농손해보험
|
|
{$IFDEF _KFB_} Result := true; {$ENDIF} // 은행연합회
|
|
{$IFDEF _JB_MAINTAIN_} Result := true; {$ENDIF} // JB우리캐피탈
|
|
{$IFDEF _JB_DEV_} Result := true; {$ENDIF} // JB우리캐피탈
|
|
{$IFDEF _UBASE_} Result := true; {$ENDIF} // 이베이코리아(G마켓)
|
|
{$IFDEF _SKMWS_} Result := true; {$ENDIF} // SK마이크로웍스
|
|
end;
|
|
|
|
procedure InitCtrls;
|
|
var
|
|
sInstDir: String;
|
|
begin
|
|
SetImgBtn(imgBtns, imgMin, 0);
|
|
SetImgBtn(imgBtns, imgExit, 2);
|
|
SetImgBtn(imgBtns2, imgPrev, 0);
|
|
SetImgBtn(imgBtns2, imgNext, 2);
|
|
SetImgCtrl(imgProgs, imgProg, 0);
|
|
|
|
sInstDir := GetProgramFilesDir + DIR_HE;
|
|
if DirectoryExists(sInstDir) and
|
|
FileExists(sInstDir + EXE_HE) then
|
|
begin
|
|
SetImgCtrl(imgBtnInit, imgDelete, imgDelete.Tag);
|
|
SetImgCtrl(imgBtnInit, imgReinstall, imgReinstall.Tag);
|
|
imgNext.Visible := false;
|
|
cpMain.ActiveCard := cdInstalled;
|
|
end else
|
|
cpMain.ActiveCard := cdWelcome;
|
|
|
|
if IsBS1Display then
|
|
begin
|
|
Caption := APP_NAME_BS1;
|
|
lbWC_Msg1.Caption := StringReplace(lbWC_Msg1.Caption, APP_NAME_CRM, APP_NAME_BS1, [rfReplaceAll]);
|
|
lbWC_Msg2.Caption := StringReplace(lbWC_Msg2.Caption, APP_NAME_CRM, APP_NAME_BS1, [rfReplaceAll]);
|
|
lbCompletedMsg.Caption := StringReplace(lbCompletedMsg.Caption, APP_NAME_CRM, APP_NAME_BS1, [rfReplaceAll]);
|
|
end else begin
|
|
Caption := APP_NAME_CRM;
|
|
imgLogo.Picture.Assign(imgTops.Items[0].PngImage);
|
|
end;
|
|
|
|
if not IsUninstall then
|
|
begin
|
|
Label16.Visible := false;
|
|
imgReinstall.Top := imgDelete.Top;
|
|
lbReinstall.Top := lbDelete.Top;
|
|
imgDelete.Enabled := false;
|
|
imgDelete.Visible := false;
|
|
lbDelete.Enabled := false;
|
|
lbDelete.Visible := false;
|
|
end;
|
|
end;
|
|
|
|
begin
|
|
Inherited Create(aOwner);
|
|
|
|
HTTP_ := nil;
|
|
SSL_ := nil;
|
|
sEmpNoVerifyOK_ := '';
|
|
SetLangRes;
|
|
InitCtrls;
|
|
|
|
{$IFDEF _PATCH_}
|
|
chCheckEmpNo.Checked := false;
|
|
{$ENDIF}
|
|
|
|
if IsCJ_Affiliates then
|
|
begin
|
|
// {$IFDEF _CJONS_}
|
|
Label9.Caption := 'ID';
|
|
chCheckEmpNo.Caption := 'Check ID';
|
|
chCheckEmpNo.Checked := true;
|
|
chCheckEmpNo.Enabled := FileExists('C:\Program Files\Tocsg\$ForceHE.ini');
|
|
btnInfo.Visible := false;
|
|
// {$ENDIF}
|
|
end;
|
|
|
|
{$IFDEF _KORENTAL_}
|
|
Label9.Caption := '아이디';
|
|
chCheckEmpNo.Caption := '아이디 유효성 체크';
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _SILENT_}
|
|
chCheckEmpNo.Checked := false;
|
|
tSilent.Enabled := true;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _SOLIDEO_}
|
|
chCheckEmpNo.Checked := true;
|
|
chCheckEmpNo.Enabled := FileExists('C:\Program Files\Tocsg\$ForceHE.ini');
|
|
{$ENDIF}
|
|
|
|
{$IF Defined(_KFTC_) or Defined(_ABL_) or Defined(_CGBEST_)}
|
|
chCheckEmpNo.Checked := false;
|
|
chCheckEmpNo.Enabled := false;
|
|
chCheckEmpNo.Visible := false;
|
|
btnInfo.Enabled := false;
|
|
btnInfo.Visible := false;
|
|
{$IFEND}
|
|
|
|
{$IFDEF _KFTC_}
|
|
chCheckEmpNo.Checked := true;
|
|
chCheckEmpNo.Visible := FileExists('C:\Program Files\Tocsg\$ForceHE.ini');
|
|
chCheckEmpNo.Enabled := chCheckEmpNo.Visible;
|
|
{$ENDIF}
|
|
|
|
{$IF Defined(_DEV_) or Defined(_DEMO_) or Defined(_LOCAL_)}
|
|
chCheckEmpNo.Checked := false;
|
|
{$IFEND}
|
|
|
|
//{$IFEND}
|
|
end;
|
|
|
|
Destructor TDlgeCrmHeInstMain.Destroy;
|
|
begin
|
|
if HTTP_ <> nil then
|
|
FreeAndNil(HTTP_);
|
|
if SSL_ <> nil then
|
|
FreeAndNil(SSL_);
|
|
Inherited;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.SetLangRes;
|
|
|
|
procedure SetRes(aCtrl: TLabel; sVal: String); overload; inline
|
|
begin
|
|
if sVal <> '' then
|
|
aCtrl.Caption := sVal;
|
|
end;
|
|
|
|
procedure SetRes(aCtrl: TRadioButton; sVal: String); overload;inline
|
|
begin
|
|
if sVal <> '' then
|
|
aCtrl.Caption := sVal;
|
|
end;
|
|
|
|
procedure SetRes(aCtrl: TSpeedButton; sVal: String); overload;inline
|
|
begin
|
|
if sVal <> '' then
|
|
aCtrl.Caption := sVal;
|
|
end;
|
|
|
|
procedure SetRes(aCtrl: TCheckBox; sVal: String); overload;inline
|
|
begin
|
|
if sVal <> '' then
|
|
aCtrl.Caption := sVal;
|
|
end;
|
|
|
|
begin
|
|
pnProg.Visible := LangKind <> lkKor;
|
|
if pnProg.Visible then
|
|
begin
|
|
mmLicense.Visible := false;
|
|
mmLicense_en.Visible := true;
|
|
Label16.Visible := false;
|
|
end;
|
|
|
|
SetRes(Label2, RS_cpMain_cdWelcome_Label2);
|
|
SetRes(lbWC_Msg1, RS_cpMain_cdWelcome_lbWC_Msg1);
|
|
SetRes(lbWC_Msg2, RS_cpMain_cdWelcome_lbWC_Msg2);
|
|
|
|
SetRes(Label13, RS_cpMain_cdUserInfoAgree_Label13);
|
|
SetRes(Label14, RS_cpMain_cdUserInfoAgree_Label14);
|
|
SetRes(rdAgree2, RS_cpMain_cdUserInfoAgree_rdAgree2);
|
|
SetRes(rdNoAgree2, RS_cpMain_cdUserInfoAgree_rdNoAgree2);
|
|
|
|
SetRes(Label5, RS_cpMain_cdLicense_Label5);
|
|
SetRes(Label6, RS_cpMain_cdLicense_Label6);
|
|
SetRes(rdAgree, RS_cpMain_cdLicense_rdAgree);
|
|
SetRes(rdNoAgree, RS_cpMain_cdLicense_rdNoAgree);
|
|
|
|
SetRes(Label15, RS_cpMain_cdInstalled_Label15);
|
|
SetRes(Label16, RS_cpMain_cdInstalled_Label16);
|
|
SetRes(lbDelete, RS_cpMain_cdInstalled_lbDelete);
|
|
SetRes(lbReinstall, RS_cpMain_cdInstalled_lbReinstall);
|
|
|
|
SetRes(Label11, RS_cpMain_cdInstall_Label11);
|
|
SetRes(Label12, RS_cpMain_cdInstall_Label12);
|
|
|
|
SetRes(btnInfo, RS_cpMain_cdInfo_btnInfo);
|
|
SetRes(chCheckEmpNo, RS_cpMain_cdInfo_chCheckEmpNo);
|
|
SetRes(Label7, RS_cpMain_cdInfo_Label7);
|
|
SetRes(Label8, RS_cpMain_cdInfo_Label8);
|
|
SetRes(Label9, RS_cpMain_cdInfo_Label9);
|
|
|
|
SetRes(lbCompleted, RS_cpMain_cdCompleted_lbCompleted);
|
|
SetRes(lbCompletedMsg, RS_cpMain_cdCompleted_lbCompletedMsg);
|
|
SetRes(lbExitMsg, RS_cpMain_cdCompleted_lbExitMsg);
|
|
end;
|
|
|
|
function TDlgeCrmHeInstMain.GetLangRes(sOrg, sRes: String): String;
|
|
begin
|
|
if sRes <> '' then
|
|
Result := sRes
|
|
else
|
|
Result := sOrg;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.SetBoldEntProg(n: Integer);
|
|
begin
|
|
Label3.Font.Style := Label3.Font.Style - [fsBold];
|
|
Label4.Font.Style := Label4.Font.Style - [fsBold];
|
|
Label17.Font.Style := Label17.Font.Style - [fsBold];
|
|
Label18.Font.Style := Label18.Font.Style - [fsBold];
|
|
Label19.Font.Style := Label19.Font.Style - [fsBold];
|
|
|
|
case n of
|
|
0 : Label3.Font.Style := Label3.Font.Style + [fsBold];
|
|
1 : Label4.Font.Style := Label4.Font.Style + [fsBold];
|
|
2 : Label17.Font.Style := Label17.Font.Style + [fsBold];
|
|
3 : Label18.Font.Style := Label18.Font.Style + [fsBold];
|
|
4 : Label19.Font.Style := Label19.Font.Style + [fsBold];
|
|
end;
|
|
Application.ProcessMessages;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.InitHttp;
|
|
|
|
function ExtractSSL_DLL: Boolean;
|
|
var
|
|
res: TResourceStream;
|
|
ms: TMemoryStream;
|
|
sSysDir: String;
|
|
zip: TAbUnZipper;
|
|
begin
|
|
Result := false;
|
|
|
|
try
|
|
sSysDir := GetSystemDir;
|
|
if FileExists(sSysDir + 'ssleay32.dll') and FileExists(sSysDir + 'libeay32.dll') then
|
|
begin
|
|
Result := true;
|
|
exit;
|
|
end;
|
|
|
|
Guard(ms, TMemoryStream.Create);
|
|
res := TResourceStream.Create(HInstance, 'RS_HEBIN', 'raw');
|
|
if res <> nil then
|
|
begin
|
|
res.SaveToStream(ms);
|
|
res.Free;
|
|
ms.Position := 0;
|
|
|
|
Guard(zip, TAbUnzipper.Create(nil));
|
|
zip.Stream := ms;
|
|
zip.ExtractOptions := [eoCreateDirs, eoRestorePath];
|
|
zip.BaseDirectory := sSysDir;
|
|
zip.ExtractFiles('ssleay32.dll');
|
|
zip.ExtractFiles('libeay32.dll');
|
|
Result := FileExists(sSysDir + 'ssleay32.dll') and FileExists(sSysDir + 'libeay32.dll');
|
|
end;
|
|
except
|
|
// ..
|
|
end;
|
|
end;
|
|
|
|
begin
|
|
if not ExtractSSL_DLL then
|
|
exit;
|
|
|
|
if (HTTP_ = nil) and (SSL_ = nil) then
|
|
begin
|
|
SSL_ := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
|
|
SSL_.SSLOptions.Method := sslvSSLv23;
|
|
SSL_.SSLOptions.SSLVersions := [sslvTLSv1_2, sslvTLSv1_1, sslvTLSv1];
|
|
|
|
HTTP_ := TIdHTTP.Create(nil);
|
|
HTTP_.IOHandler := SSL_;
|
|
with HTTP_ do
|
|
begin
|
|
Request.Clear;
|
|
Request.UserAgent := 'Mozilla/5.0';
|
|
Request.ContentType := 'application/json; charset=utf-8'; //'application/xml';
|
|
Request.Accept := 'application/json; charset=utf-8';
|
|
Request.Charset := 'utf-8';
|
|
Request.Connection := 'Keep-Alive';
|
|
Request.CacheControl := 'no-store';
|
|
ConnectTimeout := 2000;
|
|
ReadTimeout := 2000;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.lbDeleteMouseEnter(Sender: TObject);
|
|
begin
|
|
imgDeleteMouseEnter(imgDelete);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.lbDeleteMouseLeave(Sender: TObject);
|
|
begin
|
|
imgDeleteMouseLeave(imgDelete);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.lbReinstallMouseEnter(Sender: TObject);
|
|
begin
|
|
imgDeleteMouseEnter(imgReinstall);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.lbReinstallMouseLeave(Sender: TObject);
|
|
begin
|
|
imgDeleteMouseLeave(imgReinstall);
|
|
end;
|
|
|
|
function TDlgeCrmHeInstMain.ProcessCheckId_CJONS: Boolean;
|
|
var
|
|
sInfo: String;
|
|
O: ISuperObject;
|
|
SvrList: TStringList;
|
|
i: Integer;
|
|
begin
|
|
Result := false;
|
|
|
|
edEmpNo.Text := Trim(edEmpNo.Text);
|
|
if edEmpNo.Text = '' then
|
|
begin
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InputEmpNo2, RS_S_InputEmpNo2)), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
InitHttp;
|
|
|
|
Guard(SvrList, TStringList.Create);
|
|
GetDestServerList(SvrList);
|
|
ASSERT(SvrList.Count > 0);
|
|
|
|
for i := 0 to SvrList.Count - 1 do
|
|
begin
|
|
sInfo := GetEmpNoInfo(SvrList[i], HTTP_, edEmpNo.Text);
|
|
if sInfo <> '' then
|
|
begin
|
|
try
|
|
O := SO(sInfo);
|
|
break;
|
|
except
|
|
// ..
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
if (O <> nil) and (O.S['result'] <> 'false') then
|
|
begin
|
|
sEmpNoVerifyOK_ := edEmpNo.Text;
|
|
sInfo := Format(GetLangRes(RS_FMT_EmpNoInfo2, RS_S_FMT_EmpNoInfo2),
|
|
[O.S['empno'], O.S['name'], O.S['dept'], BooleanToStr(O.S['deleteyn'] = 'true', GetLangRes(RS_Deleted, RS_S_Deleted), GetLangRes(RS_Normal, RS_S_Normal))]);
|
|
if MessageBox(Handle, PChar(GetLangRes(RS_GetEmpNoInfo2, RS_S_GetEmpNoInfo2) + #13#10#13#10 + sInfo),
|
|
PChar(Caption), MB_ICONINFORMATION or MB_YESNO) <> IDNO then Result := true;
|
|
end else begin
|
|
sEmpNoVerifyOK_ := '';
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InvaludEmpNo2, RS_S_InvaludEmpNo2)), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.acAgreeExecute(Sender: TObject);
|
|
begin
|
|
rdAgree.Checked := true;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.acCompleteExecute(Sender: TObject);
|
|
begin
|
|
if (cpMain.ActiveCard = cdCompleted) and imgNext.Visible and imgNext.Enabled then
|
|
imgNextClick(nil);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.acNextExecute(Sender: TObject);
|
|
begin
|
|
if imgNext.Visible and imgNext.Enabled then
|
|
begin
|
|
case cpMain.ActiveCardIndex of
|
|
0, 1, 2, 3, 6 : imgNextClick(nil);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.acNoAgreeExecute(Sender: TObject);
|
|
begin
|
|
rdNoAgree.Checked := true;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.acPrevExecute(Sender: TObject);
|
|
begin
|
|
if imgPrev.Visible and imgPrev.Enabled then
|
|
begin
|
|
case cpMain.ActiveCardIndex of
|
|
1, 2, 6 : imgPrevClick(nil);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.acReinstallExecute(Sender: TObject);
|
|
begin
|
|
if (cpMain.ActiveCard = cdInstalled) and imgReinstall.Visible and imgReinstall.Enabled then
|
|
imgReinstallClick(nil);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.btnInfoClick(Sender: TObject);
|
|
var
|
|
sInfo: String;
|
|
O: ISuperObject;
|
|
SvrList: TStringList;
|
|
i: Integer;
|
|
begin
|
|
edEmpNo.Text := Trim(edEmpNo.Text);
|
|
if edEmpNo.Text = '' then
|
|
begin
|
|
if IsCJ_Affiliates then
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InputEmpNo2, RS_S_InputEmpNo2)), PChar(Caption), MB_ICONWARNING or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InputEmpNo, RS_S_InputEmpNo)), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
InitHttp;
|
|
|
|
// Guard(SvrList, TStringList.Create);
|
|
// GetDestServerList(SvrList);
|
|
// ASSERT(SvrList.Count > 0);
|
|
|
|
var serverInfo: string;
|
|
serverInfo := 'https://' + edtIPAddress.Text + ':' + edtPort.Text + '/agentLogRequests.do';
|
|
|
|
sInfo := GetEmpNoInfo(serverInfo, HTTP_, edEmpNo.Text);
|
|
if sInfo <> '' then
|
|
begin
|
|
try
|
|
O := SO(sInfo);
|
|
except
|
|
// ..
|
|
end;
|
|
end;
|
|
|
|
|
|
// for i := 0 to SvrList.Count - 1 do
|
|
// begin
|
|
// sInfo := GetEmpNoInfo(SvrList[i], HTTP_, edEmpNo.Text);
|
|
// if sInfo <> '' then
|
|
// begin
|
|
// try
|
|
// O := SO(sInfo);
|
|
// break;
|
|
// except
|
|
// // ..
|
|
// end;
|
|
// end;
|
|
// end;
|
|
|
|
if (O <> nil) and (O.S['result'] <> 'false') then
|
|
begin
|
|
sEmpNoVerifyOK_ := edEmpNo.Text;
|
|
if IsCJ_Affiliates then
|
|
begin
|
|
sInfo := Format(GetLangRes(RS_FMT_EmpNoInfo2, RS_S_FMT_EmpNoInfo2),
|
|
[O.S['empno'], O.S['name'], O.S['dept'], BooleanToStr(O.S['deleteyn'] = 'true', GetLangRes(RS_Deleted, RS_S_Deleted), GetLangRes(RS_Normal, RS_S_Normal))]);
|
|
MessageBox(Handle, PChar(GetLangRes(RS_GetEmpNoInfo2, RS_S_GetEmpNoInfo2) + #13#10#13#10 + sInfo), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
end else begin
|
|
sInfo := Format(GetLangRes(RS_FMT_EmpNoInfo, RS_S_FMT_EmpNoInfo),
|
|
[O.S['empno'], O.S['name'], O.S['dept'], BooleanToStr(O.S['deleteyn'] = 'true', GetLangRes(RS_Deleted, RS_S_Deleted), GetLangRes(RS_Normal, RS_S_Normal))]);
|
|
MessageBox(Handle, PChar(GetLangRes(RS_GetEmpNoInfo, RS_S_GetEmpNoInfo) + #13#10#13#10 + sInfo), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
end;
|
|
end else begin
|
|
sEmpNoVerifyOK_ := '';
|
|
if IsCJ_Affiliates then
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InvaludEmpNo2, RS_S_InvaludEmpNo2)), PChar(Caption), MB_ICONWARNING or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InvaludEmpNo, RS_S_InvaludEmpNo)), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TCertValidator.DoValidateServerCertificate(const Sender: TObject; const ARequest: TURLRequest;
|
|
const Certificate: TCertificate; var Accepted: Boolean);
|
|
begin
|
|
// 인증서가 만료되었거나 IP 주소라서 안 맞거나, 사설 인증서라도 무조건 통과(True) 시킴!
|
|
// 1. 인증서 상세 정보 출력
|
|
OutputDebugString(PChar('[MGKIM] 인증서 정보 시작 ---'));
|
|
|
|
// 발급 대상 (도메인, 소유자 정보 등)
|
|
OutputDebugString(PChar('[MGKIM] 발급 대상(Subject): ' + Certificate.Subject));
|
|
|
|
// 발급자 (인증 기관 - CA)
|
|
OutputDebugString(PChar('[MGKIM] 발급자(Issuer): ' + Certificate.Issuer));
|
|
|
|
// 유효 기간
|
|
OutputDebugString(PChar('[MGKIM] 유효기간 시작: ' + DateTimeToStr(Certificate.Start)));
|
|
OutputDebugString(PChar('[MGKIM] 유효기간 만료: ' + DateTimeToStr(Certificate.Expiry)));
|
|
|
|
// 보안 및 암호화 정보 (수정된 정확한 속성명)
|
|
OutputDebugString(PChar('[MGKIM] 서명 알고리즘: ' + Certificate.AlgSignature));
|
|
OutputDebugString(PChar('[MGKIM] 암호화 알고리즘: ' + Certificate.AlgEncryption));
|
|
OutputDebugString(PChar('[MGKIM] 키 크기(Key Size): ' + IntToStr(Certificate.KeySize) + ' bits'));
|
|
OutputDebugString(PChar('[MGKIM] 일련번호(SerialNum): ' + Certificate.SerialNum));
|
|
|
|
OutputDebugString(PChar('[MGKIM] 인증서 정보 끝 ---'));
|
|
|
|
Accepted := True;
|
|
end;
|
|
|
|
function CheckServerConnection(const AUrl: string): Boolean;
|
|
var
|
|
Client: THTTPClient;
|
|
Response: IHTTPResponse;
|
|
Validator: TCertValidator;
|
|
begin
|
|
|
|
Result := False;
|
|
try
|
|
Validator := TCertValidator.Create;
|
|
try // Validator 보호용 try 추가
|
|
Client := THTTPClient.Create;
|
|
try
|
|
Client.ConnectionTimeout := 3000;
|
|
Client.ResponseTimeout := 3000;
|
|
|
|
Client.OnValidateServerCertificate := Validator.DoValidateServerCertificate;
|
|
|
|
// GET 방식 요청
|
|
Response := Client.Get(AUrl);
|
|
|
|
if Response.StatusCode = 200 then
|
|
Result := True
|
|
else
|
|
begin
|
|
OutputDebugString(PChar(Format('[MGKIM] 서버 응답 오류: %d', [Response.StatusCode])));
|
|
end;
|
|
except
|
|
on E: Exception do
|
|
begin
|
|
OutputDebugString(PChar('[MGKIM] 접속 실패: ' + E.Message));
|
|
end;
|
|
end;
|
|
finally
|
|
Client.Free;
|
|
end;
|
|
finally
|
|
Validator.Free;
|
|
end;
|
|
end;
|
|
|
|
function TDlgeCrmHeInstMain.btnIpCheckClick: Boolean;
|
|
var
|
|
ip: string;
|
|
port: string;
|
|
begin
|
|
|
|
Result:= False;
|
|
|
|
// if chkIPCheck.Enabled then
|
|
// exit;
|
|
|
|
ip:= edtIPAddress.Text;
|
|
if ip = '' then
|
|
begin
|
|
ShowMessage('IP 정보를 입력해주세요');
|
|
exit;
|
|
end;
|
|
|
|
port:= edtPort.Text;
|
|
if port = '' then
|
|
begin
|
|
ShowMessage('포트 정보를 입력해주세요');
|
|
exit;
|
|
end;
|
|
|
|
|
|
|
|
var serverInfo: string;
|
|
serverInfo := 'https://' + edtIPAddress.Text + ':' + edtPort.Text;
|
|
|
|
OutputDebugString(PChar(Format('[MGKIM] btnIpCheckClick ok .. (%s)(%d)(%s)',[ip, port.ToInteger(), serverInfo])));
|
|
|
|
// 마우스 커서를 모래시계(로딩) 상태로 변경 (사용자 UX 향상)
|
|
Screen.Cursor := crHourGlass;
|
|
try
|
|
if CheckServerConnection(serverInfo) then
|
|
begin
|
|
ShowMessage('서버에 성공적으로 접속되었습니다.');
|
|
Result:= True;
|
|
// TODO: 접속 성공 시 다음 로직 수행
|
|
end
|
|
else
|
|
begin
|
|
ShowMessage('서버 접속에 실패했습니다.' + sLineBreak +
|
|
'IP 주소와 포트 번호, 서버 상태를 확인해 주세요.');
|
|
end;
|
|
finally
|
|
// 검사가 끝나면 마우스 커서 원상복구
|
|
//Screen.Cursor := crDefault;
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
function TDlgeCrmHeInstMain.CheckEmpNo: Boolean;
|
|
var
|
|
SvrList: TStringList;
|
|
i: Integer;
|
|
begin
|
|
Result := false;
|
|
|
|
edEmpNo.Text := Trim(edEmpNo.Text);
|
|
if edEmpNo.Text = '' then
|
|
begin
|
|
if IsCJ_Affiliates then
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InputEmpNo2, RS_S_InputEmpNo2)), PChar(Caption), MB_ICONWARNING or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InputEmpNo, RS_S_InputEmpNo)), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
InitHttp;
|
|
|
|
Guard(SvrList, TStringList.Create);
|
|
GetDestServerList(SvrList);
|
|
ASSERT(SvrList.Count > 0);
|
|
|
|
//https://localhost:8443/agentLogRequests.do
|
|
var serverInfo: string;
|
|
serverInfo := 'https://' + edtIPAddress.Text + ':' + edtPort.Text + '/agentLogRequests.do';
|
|
|
|
if VerifyEmpNo(serverInfo, HTTP_, edEmpNo.Text) then
|
|
begin
|
|
sEmpNoVerifyOK_ := edEmpNo.Text;
|
|
|
|
Result := true;
|
|
exit;
|
|
end;
|
|
|
|
// for i := 0 to SvrList.Count - 1 do
|
|
// begin
|
|
// if VerifyEmpNo(SvrList[i], HTTP_, edEmpNo.Text) then
|
|
// begin
|
|
// sEmpNoVerifyOK_ := edEmpNo.Text;
|
|
//
|
|
// Result := true;
|
|
// exit;
|
|
// end;
|
|
// end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.clickIpCheck(Sender: TObject);
|
|
var
|
|
state : Boolean;
|
|
|
|
begin
|
|
if not chkIPCheck.Checked then
|
|
begin
|
|
|
|
edtIPAddress.ReadOnly := False;
|
|
edtPort.ReadOnly := False;
|
|
edtIPAddress.Color := clWindow;
|
|
edtPort.Color := clWindow;
|
|
Exit;
|
|
end;
|
|
|
|
try
|
|
state := btnIpCheckClick;
|
|
if state then
|
|
begin
|
|
edtIPAddress.ReadOnly := True;
|
|
edtPort.ReadOnly := True;
|
|
|
|
edtIPAddress.Color := clBtnFace;
|
|
edtPort.Color := clBtnFace;
|
|
end
|
|
else
|
|
begin
|
|
chkIPCheck.Checked := False;
|
|
|
|
edtIPAddress.ReadOnly := False;
|
|
edtPort.ReadOnly := False;
|
|
edtIPAddress.Color := clWindow;
|
|
edtPort.Color := clWindow;
|
|
end;
|
|
|
|
finally
|
|
Screen.Cursor := crDefault;
|
|
chkIPCheck.Checked := state;
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.SetImgBtn(aImgList: TPngImageList; imgBtn: TImage; nImgIdx: Integer);
|
|
begin
|
|
aImgList.GetIcon(nImgIdx, imgBtn.Picture.Icon);
|
|
imgBtn.Repaint
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.SetImgCtrl(aImgList: TPngImageCollection; imgCtrl: TImage; nImgIdx: Integer);
|
|
begin
|
|
if (nImgIdx > -1) and (aImgList.Items.Count > nImgIdx) then
|
|
imgCtrl.Picture.Assign(aImgList.Items[nImgIdx].PngImage);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.tExitTimer(Sender: TObject);
|
|
begin
|
|
Dec(_nExitSec);
|
|
if _nExitSec <= 0 then
|
|
begin
|
|
tExit.Enabled := false;
|
|
Close;
|
|
exit;
|
|
end;
|
|
|
|
lbExitMsg.Caption := Format(GetLangRes(RS_FMT_TERMINATE, RS_S_FMT_TERMINATE), [_nExitSec]);
|
|
|
|
Application.ProcessMessages;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.tSilentTimer(Sender: TObject);
|
|
begin
|
|
tSilent.Enabled := false;
|
|
//{$IF Defined(_KR_) or Defined(_LX_)}
|
|
{$IFDEF _SILENT_}
|
|
// 코리안리 재보험이 아닐 경우, 사번에 대한 정의를 따라 해줘야 한다. 22_0602 09:55:31 kku
|
|
// if not LoadEmpNo then
|
|
begin
|
|
var sUserName: String := WTS_GetCurrentUserName;
|
|
|
|
{$IFDEF _SHCD_}
|
|
sUserName := 'Empty';
|
|
{$ELSE}
|
|
|
|
if IsCJ_Affiliates then
|
|
sUserName := CJ_EMPTY_EMPNO;
|
|
|
|
{$IFDEF _LOTTEMART_}
|
|
// NAC에서 유저 ID값 가져오기 25_0120 10:10:54 kku
|
|
var sNacHostName: String := GetRegValueAsString(HKEY_LOCAL_MACHINE,
|
|
'SOFTWARE\Geni\Genian\Common', 'Auth');
|
|
if sNacHostName.Length > 2 then
|
|
begin
|
|
// MT는 롯데마트, SP는 롯데슈퍼
|
|
if sNacHostName.ToUpper.StartsWith('MT') or
|
|
sNacHostName.ToUpper.StartsWith('SP') then Delete(sNacHostName, 1, 2);
|
|
sUserName := sNacHostName;
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _KBIZ_}
|
|
// 레지스트리에서 AD 계정 획득 24_0724 15:08:23 kku
|
|
var sAdHostName: String := GetRegValueAsString(HKEY_LOCAL_MACHINE,
|
|
'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'DefaultUserName');
|
|
|
|
// 보완 24_0108 12:57:40 kku
|
|
if sAdHostName = '' then
|
|
sAdHostName := GetRegValueAsString(HKEY_CURRENT_USER, 'Volatile Environment', 'USERNAME');
|
|
// if sAdHostName = '' then
|
|
// sAdHostName := GetRegValueAsString(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\DataStore\Machine\0', 'szTargetName');
|
|
//
|
|
// if sAdHostName = '' then
|
|
// sAdHostName := GetRegValueAsString(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName', 'ComputerName');
|
|
|
|
if sAdHostName <> '' then
|
|
sUserName := sAdHostName;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _UNITUS_}
|
|
sUserName := GetRegValueAsString(HKEY_CURRENT_USER, 'SOFTWARE\CKBS\CKPORT\USR', 'USERID');
|
|
if sUserName = '' then
|
|
begin
|
|
sUserName := ExtractFileName(GetADUserName);
|
|
if Pos('(', sUserName) > 0 then
|
|
begin
|
|
var sTemp: String := GetCapsuleStr('(', ')', sUserName);
|
|
if sTemp <> '' then
|
|
sUserName := sTemp;
|
|
end;
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF _MOTRAS_}
|
|
sUserName := GetRegValueAsString(HKEY_CURRENT_USER, 'Software\Microsoft\Office\16.0\Common\Identity', 'ADUserName');
|
|
if sUserName <> '' then
|
|
begin
|
|
var nPos: Integer := Pos('@', sUserName);
|
|
if nPos > 0 then
|
|
SetLength(sUserName, nPos - 1);
|
|
end else
|
|
sUserName := ExtractFileName(GetADUserName);
|
|
|
|
var sTemp: String := ExtrNumStr(sUserName);
|
|
if sTemp.Length <> 7 then
|
|
begin
|
|
// 7자리 숫자가 아니라면 호스트 이름 확인해서 사번을 가져온다. 25_0618 09:00:32 kku
|
|
sTemp := GetComName;
|
|
if sTemp.Length >= 7 then
|
|
sUserName := Copy(sTemp, 1, 7);
|
|
end;
|
|
{$ENDIF}
|
|
|
|
if sUserName = '' then
|
|
begin
|
|
sUserName := GetAccount;
|
|
if (sUserName = '') or (CompareText(sUserName, 'system') = 0) then
|
|
sUserName := ExtractFileName(GetUserNameFromExplorer);
|
|
end;
|
|
edEmpNo.Text := sUserName;
|
|
edVpnId.Text := edEmpNo.Text; // edEmpNo.Text;
|
|
{$ENDIF}
|
|
end;
|
|
ProcessInstall(Self, true);
|
|
|
|
// 에이전트 설치 후 팝업을 위해 실행될때까지 기다린다.
|
|
|
|
// 사일런트 설치는 완료 후 팝업되지 않도록 수정 22_0816 08:17:24 kku
|
|
|
|
// nTO := 0;
|
|
// while not MutexExists(MUTEX_AGENT) do
|
|
// begin
|
|
// Sleep(500);
|
|
// Inc(nTO);
|
|
// if nTO > 20 then
|
|
// break;
|
|
// end;
|
|
{$ENDIF}
|
|
Close;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.vtListFreeNode(Sender: TBaseVirtualTree;
|
|
Node: PVirtualNode);
|
|
var
|
|
pData: PInstEnt;
|
|
begin
|
|
pData := Sender.GetNodeData(Node);
|
|
Finalize(pData^);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.vtListGetHint(Sender: TBaseVirtualTree;
|
|
Node: PVirtualNode; Column: TColumnIndex;
|
|
var LineBreakStyle: TVTTooltipLineBreakStyle; var HintText: string);
|
|
begin
|
|
HintText := vtList.Text[Node, Column];
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.vtListGetNodeDataSize(Sender: TBaseVirtualTree;
|
|
var NodeDataSize: Integer);
|
|
begin
|
|
NodeDataSize := SizeOf(TInstEnt);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.vtListGetText(Sender: TBaseVirtualTree;
|
|
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
|
|
var CellText: string);
|
|
var
|
|
pData: PInstEnt;
|
|
begin
|
|
pData := Sender.GetNodeData(Node);
|
|
|
|
case Column of
|
|
0 : CellText := IntToStr(Node.Index + 1);
|
|
1 : CellText := pData.sName;
|
|
2 : CellText := pData.sDesc;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.edEmpNoKeyPress(Sender: TObject; var Key: Char);
|
|
begin
|
|
if Key = #13 then
|
|
begin
|
|
Key := #0;
|
|
imgNextClick(nil);
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.edVpnIdKeyPress(Sender: TObject; var Key: Char);
|
|
begin
|
|
if Key = #13 then
|
|
begin
|
|
Key := #0;
|
|
imgNextClick(nil);
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.FormMouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
ReleaseCapture;
|
|
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgDeleteClick(Sender: TObject);
|
|
begin
|
|
if MessageBox(Handle, PChar(GetLangRes(RS_Q_Delete, RS_S_Q_Delete)),
|
|
PChar(Caption), MB_ICONQUESTION or MB_YESNO) = IDNO then exit;
|
|
|
|
if UninstallCrmHE then
|
|
begin
|
|
imgNext.Tag := 4;
|
|
imgNext.Visible := true;
|
|
SetImgBtn(imgBtns2, imgNext, imgNext.Tag);
|
|
SetImgCtrl(imgProgs, imgProg, 4);
|
|
SetBoldEntProg(4);
|
|
tExit.Enabled := true;
|
|
imgInstalled.Visible := false;
|
|
lbCompleted.Caption := GetLangRes(RS_DeleteComp, RS_S_DeleteComp);
|
|
lbCompletedMsg.Caption := GetLangRes(RS_MsgDeleted, RS_S_MsgDeleted);
|
|
cpMain.ActiveCard := cdCompleted;
|
|
Application.ProcessMessages;
|
|
end else begin
|
|
MessageBox(Handle, PChar(GetLangRes(RS_MsgNoDelete, RS_S_MsgNoDelete)),
|
|
PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgDeleteMouseEnter(Sender: TObject);
|
|
begin
|
|
if Sender is TImage then
|
|
SetImgCtrl(imgBtnInit, TImage(Sender), TImage(Sender).Tag + 1);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgDeleteMouseLeave(Sender: TObject);
|
|
begin
|
|
if Sender is TImage then
|
|
SetImgCtrl(imgBtnInit, TImage(Sender), TImage(Sender).Tag);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgExitClick(Sender: TObject);
|
|
begin
|
|
if not tExit.Enabled then
|
|
begin
|
|
if MessageBox(Handle, PChar(GetLangRes(RS_Q_Exit, RS_S_Q_Exit)),
|
|
PChar(Caption), MB_ICONQUESTION or MB_YESNO) = IDNO then exit;
|
|
end;
|
|
|
|
Close;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgMinClick(Sender: TObject);
|
|
begin
|
|
WindowState := TWindowState.wsMinimized;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgMinMouseEnter(Sender: TObject);
|
|
begin
|
|
if Sender is TImage then
|
|
SetImgBtn(imgBtns, TImage(Sender), TImage(Sender).Tag + 1);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgMinMouseLeave(Sender: TObject);
|
|
begin
|
|
if Sender is TImage then
|
|
SetImgBtn(imgBtns, TImage(Sender), TImage(Sender).Tag);
|
|
end;
|
|
|
|
function TDlgeCrmHeInstMain.LoadEmpNo: Boolean;
|
|
var
|
|
sDir: String;
|
|
AgentModel: TAgentModel;
|
|
begin
|
|
Result := false;
|
|
{$IFDEF _LOTTEMART_}
|
|
exit;
|
|
{$ENDIF}
|
|
sDir := GetProgramFilesDir + DIR_HE + DIR_CONF;
|
|
// 사번정보 있으면 채워주기 22_0530 08:25:01 kku
|
|
Guard(AgentModel, TAgentModel.Create);
|
|
AgentModel.Load(sDir + DAT_AGENT);
|
|
if (edEmpNo.Text = '') and (edVpnId.Text = '') then
|
|
begin
|
|
edEmpNo.Text := AgentModel.EmpNo;
|
|
// edVpnId.Text := AgentModel.VpnInfo;
|
|
end;
|
|
|
|
// if (edEmpNo.Text = '') and (edVpnId.Text = '') then
|
|
if edEmpNo.Text = '' then
|
|
begin
|
|
// 구버전 정보도 확인
|
|
if FileExists(sDir + PROP_USERINFO) then
|
|
begin
|
|
var ss: TStringStream;
|
|
var StrList: TStringList;
|
|
Guard(ss, TStringStream.Create('', TEncoding.UTF8));
|
|
ss.LoadFromFile(sDir + PROP_USERINFO);
|
|
Guard(StrList, TStringList.Create);
|
|
if SplitString(DecryptStr(ss.DataString), '---', StrList) > 1 then
|
|
begin
|
|
edEmpNo.Text := StrList[0];
|
|
edVpnId.Text := StrList[1];
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
Result := edEmpNo.Text <> '';
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgNextClick(Sender: TObject);
|
|
begin
|
|
if imgNext.Tag = 4 then
|
|
begin
|
|
Close;
|
|
exit;
|
|
end;
|
|
|
|
case cpMain.ActiveCardIndex of
|
|
0 :
|
|
begin
|
|
imgPrev.Visible := true;
|
|
cpMain.ActiveCard := cdLicense;
|
|
|
|
imgNext.Enabled := rdAgree.Checked;
|
|
if imgNext.Enabled then
|
|
SetImgBtn(imgBtns2, imgNext, imgNext.Tag)
|
|
else
|
|
SetImgBtn(imgBtns2, imgNext, imgNext.Tag + 1);
|
|
SetImgCtrl(imgProgs, imgProg, 1);
|
|
SetBoldEntProg(1);
|
|
end;
|
|
1 :
|
|
begin
|
|
{$IFDEF _KFTC_}
|
|
var dlg: TDlgUserInfoAgree;
|
|
Guard(dlg, TDlgUserInfoAgree.Create(Self));
|
|
if dlg.ShowModal <> mrOk then
|
|
exit;
|
|
|
|
// cpMain.ActiveCard := cdUserInfoAgree;
|
|
//
|
|
// imgNext.Enabled := rdAgree2.Checked;
|
|
// if imgNext.Enabled then
|
|
// SetImgBtn(imgBtns2, imgNext, imgNext.Tag)
|
|
// else
|
|
// SetImgBtn(imgBtns2, imgNext, imgNext.Tag + 1);
|
|
// SetImgCtrl(imgProgs, imgProg, 1);
|
|
{$ENDIF}
|
|
cpMain.ActiveCard := cdInfo;
|
|
LoadEmpNo;
|
|
SetImgCtrl(imgProgs, imgProg, 2);
|
|
SetBoldEntProg(2);
|
|
end;
|
|
2 :
|
|
begin
|
|
edEmpNo.Text := Trim(edEmpNo.Text);
|
|
edVpnId.Text := Trim(edVpnId.Text);
|
|
|
|
if not chkIPCheck.Checked then
|
|
begin
|
|
MessageBox(Handle, '서버 접속 확인을 해주세요.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
chkIPCheck.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if edtIPAddress.Text = '' then
|
|
begin
|
|
MessageBox(Handle, 'IP 정보를 입력해주세요', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edtIPAddress.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if edtPort.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '포트 정보를 입력해주세요', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edtPort.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
ip_:= edtIPAddress.Text;
|
|
port_:= edtPort.Text;
|
|
serverInfo_ := 'https://' + ip_ + ':' + port_ + '/agentLogRequests.do';
|
|
|
|
if edEmpNo.Text = '' then
|
|
begin
|
|
if IsCJ_Affiliates then
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InputEmpNo2, RS_S_InputEmpNo2)), PChar(Caption), MB_ICONWARNING or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InputEmpNo, RS_S_InputEmpNo)), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEmpNo.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if Length(edEmpNo.Text) > 24 then
|
|
begin
|
|
MessageBox(Handle, PChar('Please enter within 24 characters.'), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEmpNo.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
|
|
|
|
// if edVpnId.Text = '' then
|
|
// begin
|
|
// MessageBox(Handle, PChar('"VPN 계정"을 입력해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
// edVpnId.SetFocus;
|
|
// exit;
|
|
// end;
|
|
|
|
if chCheckEmpNo.Checked then
|
|
begin
|
|
if IsCJ_Affiliates then
|
|
begin
|
|
// if sEmpNoVerifyOK_ <> edEmpNo.Text then
|
|
// begin
|
|
// MessageBox(Handle, PChar('먼저 ID 조회를 시도해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
// exit;
|
|
// end;
|
|
|
|
if not ProcessCheckId_CJONS then
|
|
exit;
|
|
end;
|
|
|
|
if (sEmpNoVerifyOK_ <> edEmpNo.Text) and not CheckEmpNo then
|
|
begin
|
|
if IsCJ_Affiliates then
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InvaludEmpNo2, RS_S_InvaludEmpNo2)), PChar(Caption), MB_ICONWARNING or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(GetLangRes(RS_InvaludEmpNo, RS_S_InvaludEmpNo)), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
{$IFDEF _SERVE1_}
|
|
if MessageBox(Handle, PChar('설치가 완료되면 자동으로 재부팅 됩니다.'+
|
|
#13+#10+'계속하시겠습니까?'), PChar(Caption), MB_ICONQUESTION or MB_YESNO) = IDNO then exit;
|
|
{$ENDIF}
|
|
|
|
cpMain.ActiveCard := cdInstall;
|
|
SetImgCtrl(imgProgs, imgProg, 3);
|
|
SetBoldEntProg(3);
|
|
|
|
imgPrev.Enabled := false;
|
|
SetImgBtn(imgBtns2, imgPrev, imgPrev.Tag + 1);
|
|
|
|
imgExit.Enabled := false;
|
|
try
|
|
imgNext.Enabled := false;
|
|
SetImgBtn(imgBtns2, imgNext, imgNext.Tag + 1);
|
|
|
|
if ProcessInstall(Self, false) then
|
|
begin
|
|
imgNext.Enabled := true;
|
|
SetImgBtn(imgBtns2, imgNext, imgNext.Tag);
|
|
|
|
// {$IF Defined(_SERVE1_) or Defined(_CJONS_)}
|
|
// 전체 적용 25_0110 14:17:44 kku
|
|
imgNextClick(nil);
|
|
// {$IFEND}
|
|
end else
|
|
MessageBox(Handle, PChar('An error occurred during installation.'), PChar(Caption), MB_ICONSTOP or MB_OK);
|
|
finally
|
|
imgExit.Enabled := true;
|
|
end;
|
|
end;
|
|
3 :
|
|
begin
|
|
cpMain.ActiveCard := cdCompleted;
|
|
imgPrev.Visible := false;
|
|
imgNext.Tag := 4;
|
|
SetImgBtn(imgBtns2, imgNext, imgNext.Tag);
|
|
SetImgCtrl(imgProgs, imgProg, 4);
|
|
SetBoldEntProg(4);
|
|
|
|
// 서비스를 숨기면 윈도우 메이저 업데이트 시 서비스가 사라지는 문제가 있음 24_0105 08:18:24 kku
|
|
// SetVisibleService(NAME_SERVICE, false);
|
|
|
|
{$IFDEF _SERVE1_}
|
|
var sUnInst: String := GetProgramFilesDir + DIR_HE + DIR_CONF + 'InstallCleaner.exe';
|
|
if FileExists(sUnInst) then
|
|
begin
|
|
// 2번 실행하게 요청 24_0717 14:37:11 kku
|
|
ExecuteAppWaitUntilTerminate(sUnInst, '', SW_NORMAL, 10000);
|
|
|
|
Sleep(1000);
|
|
|
|
if ExecuteAppWaitUntilTerminate(sUnInst, '', SW_NORMAL, 10000) then
|
|
begin
|
|
Sleep(500);
|
|
if not ServiceExists(NAME_SERVICE) then
|
|
begin
|
|
var sSysDir: String := GetSystemDir;
|
|
var sInstDir: String := GetProgramFilesDir + DIR_HE;
|
|
if not FileExists(sSysDir + DLL_SV) then
|
|
MoveFile(PChar(sInstDir + DLL_SV), PChar(sSysDir + DLL_SV));
|
|
|
|
InstallService(NAME_SERVICE, sSysDir + EXE_SV, NAME_SERVICE, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START);
|
|
Sleep(500);
|
|
end;
|
|
|
|
DeleteFile_wait(sUnInst);
|
|
// if MessageBox(Handle, PChar('설치를 완료했습니다. 재부팅 하시겠습니까?'),
|
|
// PChar(APP_NAME_BS1), MB_ICONQUESTION or MB_YESNO) = IDYES then
|
|
begin
|
|
ExecutePath('shutdown', '/f /r /t 0');
|
|
end;
|
|
end;
|
|
end;
|
|
{$ELSE}
|
|
lbExitMsg.Visible := true;
|
|
_nExitSec := 5;
|
|
tExit.Enabled := true;
|
|
{$ENDIF}
|
|
|
|
// 나중에 시작하도록 보완 22_0510 15:13:29 kku
|
|
// 완료 페이지에서 자동 닫기 카운될때 프로그램이 팝업 되야 더 좋을듯 함
|
|
ServiceStart(NAME_SERVICE);
|
|
end;
|
|
6 :
|
|
begin
|
|
cpMain.ActiveCard := cdInfo;
|
|
LoadEmpNo;
|
|
SetImgCtrl(imgProgs, imgProg, 2);
|
|
SetBoldEntProg(2);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgPrevClick(Sender: TObject);
|
|
begin
|
|
case cpMain.ActiveCardIndex of
|
|
1 :
|
|
begin
|
|
imgPrev.Visible := false;
|
|
cpMain.ActiveCard := cdWelcome;
|
|
imgNext.Enabled := true;
|
|
SetImgBtn(imgBtns2, imgNext, imgNext.Tag);
|
|
SetImgCtrl(imgProgs, imgProg, 0);
|
|
SetBoldEntProg(0);
|
|
end;
|
|
2 :
|
|
begin
|
|
// {$IFDEF _KFTC_}
|
|
// cpMain.ActiveCard := cdUserInfoAgree;
|
|
// SetImgCtrl(imgProgs, imgProg, 1);
|
|
// {$ELSE}
|
|
cpMain.ActiveCard := cdLicense;
|
|
SetImgCtrl(imgProgs, imgProg, 1);
|
|
SetBoldEntProg(1);
|
|
// {$ENDIF}
|
|
end;
|
|
6 :
|
|
begin
|
|
cpMain.ActiveCard := cdLicense;
|
|
imgNext.Enabled := rdAgree.Checked;
|
|
if imgNext.Enabled then
|
|
SetImgBtn(imgBtns2, imgNext, imgNext.Tag)
|
|
else
|
|
SetImgBtn(imgBtns2, imgNext, imgNext.Tag + 1);
|
|
|
|
SetImgCtrl(imgProgs, imgProg, 1);
|
|
SetBoldEntProg(1);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgPrevMouseEnter(Sender: TObject);
|
|
begin
|
|
if (Sender is TImage) and TImage(Sender).Enabled then
|
|
SetImgBtn(imgBtns2, TImage(Sender), TImage(Sender).Tag + 1);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgPrevMouseLeave(Sender: TObject);
|
|
begin
|
|
if (Sender is TImage) and TImage(Sender).Enabled then
|
|
SetImgBtn(imgBtns2, TImage(Sender), TImage(Sender).Tag);
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.imgReinstallClick(Sender: TObject);
|
|
begin
|
|
imgNext.Visible := true;
|
|
cpMain.ActiveCard := cdWelcome;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.process_WM_SYSCOMMAND(var msg: TWMSysCommand);
|
|
begin
|
|
if msg.CmdType = SC_CLOSE then
|
|
begin
|
|
imgExitClick(nil);
|
|
exit;
|
|
end;
|
|
Inherited;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.rdAgreeClick(Sender: TObject);
|
|
begin
|
|
if TRadioButton(Sender).Checked then
|
|
begin
|
|
SetImgBtn(imgBtns2, imgNext, imgNext.Tag);
|
|
imgNext.Enabled := true;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgeCrmHeInstMain.rdNoAgreeClick(Sender: TObject);
|
|
begin
|
|
if TRadioButton(Sender).Checked then
|
|
begin
|
|
SetImgBtn(imgBtns2, imgNext, imgNext.Tag + 1);
|
|
imgNext.Enabled := false;
|
|
end;
|
|
end;
|
|
|
|
end.
|