712 lines
23 KiB
Plaintext
712 lines
23 KiB
Plaintext
unit DFasooDrmMain;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Tocsg.Controls,
|
|
Tocsg.Trace;
|
|
|
|
type
|
|
TDlgFasooTest2Main = class(TForm)
|
|
gpMain: TGroupBox;
|
|
Label1: TLabel;
|
|
Label3: TLabel;
|
|
Label4: TLabel;
|
|
edHomeDir: TEdit;
|
|
edSrcPath: TEdit;
|
|
edDestPath: TEdit;
|
|
btnEncCheck: TButton;
|
|
btnDecrypt: TButton;
|
|
btnGetFileHeader: TButton;
|
|
mmInfo: TMemo;
|
|
btnForceDecrypt: TButton;
|
|
btnRegDll: TButton;
|
|
btnUnRegDll: TButton;
|
|
btnWorkThread: TButton;
|
|
btnWorkThread2: TButton;
|
|
Label2: TLabel;
|
|
Label5: TLabel;
|
|
Label6: TLabel;
|
|
edEncSrcPath: TEdit;
|
|
edEncDestPath: TEdit;
|
|
btnEnc: TButton;
|
|
btnEnc2: TButton;
|
|
btnEnc3: TButton;
|
|
procedure btnEncCheckClick(Sender: TObject);
|
|
procedure btnDecryptClick(Sender: TObject);
|
|
procedure btnGetFileHeaderClick(Sender: TObject);
|
|
procedure btnForceDecryptClick(Sender: TObject);
|
|
procedure btnRegDllClick(Sender: TObject);
|
|
procedure btnUnRegDllClick(Sender: TObject);
|
|
procedure btnWorkThreadClick(Sender: TObject);
|
|
procedure btnWorkThread2Click(Sender: TObject);
|
|
procedure btnEncClick(Sender: TObject);
|
|
procedure btnEnc2Click(Sender: TObject);
|
|
procedure btnEnc3Click(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
MgCtrlData_: TManagerInputControlsData;
|
|
Trace_: TTgTrace;
|
|
public
|
|
{ Public declarations }
|
|
Constructor Create(aOwner: TComponent); override;
|
|
Destructor Destroy; override;
|
|
end;
|
|
|
|
var
|
|
DlgFasooTest2Main: TDlgFasooTest2Main;
|
|
|
|
implementation
|
|
|
|
uses
|
|
Winapi.ActiveX, System.Win.ComObj, Tocsg.Path, Tocsg.Fasoo,
|
|
Tocsg.Safe, Tocsg.Shell, Tocsg.Convert, ThdProcFasooDRM, Tocsg.Thread;
|
|
|
|
{$R *.dfm}
|
|
|
|
Constructor TDlgFasooTest2Main.Create(aOwner: TComponent);
|
|
var
|
|
sLogPath,
|
|
sFsdDir: String;
|
|
begin
|
|
Inherited Create(aOwner);
|
|
sLogPath := CutFileExt(GetRunExePath) + '.log';
|
|
DeleteFile(sLogPath);
|
|
Trace_ := TTgTrace.Create(sLogPath);
|
|
MgCtrlData_ := TManagerInputControlsData.Create(CutFileExt(GetRunExePath) + '.ini');
|
|
MgCtrlData_.RegInputCtrl(edHomeDir);
|
|
MgCtrlData_.RegInputCtrl(edSrcPath);
|
|
MgCtrlData_.RegInputCtrl(edDestPath);
|
|
MgCtrlData_.RegInputCtrl(edEncSrcPath);
|
|
MgCtrlData_.RegInputCtrl(edEncDestPath);
|
|
MgCtrlData_.Load(true);
|
|
|
|
sFsdDir := 'fsdinit';
|
|
// SetDSD_CODE(DSD_CODE_CJ);
|
|
// SetDSD_CODE(DSD_CODE_WFND);
|
|
SetDSD_CODE(DSD_CODE_WFNI);
|
|
// SetDSD_CODE(DSD_CODE_GIORDANO);
|
|
if DSD_CODE = DSD_CODE_LOTTEMART then
|
|
begin
|
|
gpMain.Caption := '롯데마트 ' + gpMain.Caption;
|
|
sFsdDir := 'fsdinit_Lotte';
|
|
end else
|
|
if DSD_CODE = DSD_CODE_CJ then
|
|
begin
|
|
gpMain.Caption := 'CJ올리브네트웍스 ' + gpMain.Caption;
|
|
sFsdDir := 'fsdinit_CJ';
|
|
end else
|
|
if DSD_CODE = DSD_CODE_WFND then
|
|
begin
|
|
gpMain.Caption := '웰컴에프앤디 ' + gpMain.Caption;
|
|
sFsdDir := 'fsdinit_WFND';
|
|
btnForceDecrypt.Enabled := false;
|
|
end else
|
|
if DSD_CODE = DSD_CODE_WFNI then
|
|
begin
|
|
gpMain.Caption := '웰릭스에프앤아이 ' + gpMain.Caption;
|
|
sFsdDir := 'fsdinit_WFNI';
|
|
btnForceDecrypt.Enabled := false;
|
|
end else
|
|
if DSD_CODE = DSD_CODE_GIORDANO then
|
|
begin
|
|
gpMain.Caption := '지오다노 ' + gpMain.Caption;
|
|
sFsdDir := 'fsdinit_Giodano';
|
|
btnForceDecrypt.Enabled := false;
|
|
end else
|
|
gpMain.Caption := '? ' + gpMain.Caption;
|
|
|
|
if (edHomeDir.Text = '') and DirectoryExists(GetRunExePathDir + sFsdDir) then
|
|
edHomeDir.Text := GetRunExePathDir + sFsdDir;
|
|
end;
|
|
|
|
Destructor TDlgFasooTest2Main.Destroy;
|
|
begin
|
|
FreeAndNil(MgCtrlData_);
|
|
FreeAndNil(Trace_);
|
|
Inherited;
|
|
end;
|
|
|
|
procedure TDlgFasooTest2Main.btnEnc2Click(Sender: TObject);
|
|
var
|
|
fas: TTgFasoo;
|
|
nResult: Integer;
|
|
sMsg: String;
|
|
begin
|
|
edHomeDir.Text := Trim(edHomeDir.Text);
|
|
if edHomeDir.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"Fasoo 키폴더"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edHomeDir.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(edHomeDir.Text) then
|
|
begin
|
|
MessageBox(Handle, '입력한 "Fasoo 키폴더"가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
edEncSrcPath.Text := Trim(edEncSrcPath.Text);
|
|
if edEncSrcPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"원본 파일 경로"를 입력해 주십싣오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not FileExists(edEncSrcPath.Text) then
|
|
begin
|
|
MessageBox(Handle, '"원본 파일 경로"의 파일이 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
edEncDestPath.Text := Trim(edEncDestPath.Text);
|
|
if edEncDestPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"암호화 후 저장 경로"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(ExtractFilePath(edEncDestPath.Text)) then
|
|
begin
|
|
MessageBox(Handle, '"암호화 후 저장 경로"의 폴더가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
MgCtrlData_.Save;
|
|
Guard(fas, TTgFasoo.Create(edHomeDir.Text, edHomeDir.Text));
|
|
if fas.DoPackagingFsn2(edEncSrcPath.Text, edEncDestPath.Text, @nResult) then
|
|
MessageBox(Handle, '파일 암호화 작업 완료', PChar(Caption), MB_ICONINFORMATION or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(Format('파일 암호화 작업 실패 (%d)', [nResult])), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
end;
|
|
|
|
procedure TDlgFasooTest2Main.btnEnc3Click(Sender: TObject);
|
|
var
|
|
fas: TTgFasoo;
|
|
nResult: Integer;
|
|
sMsg: String;
|
|
begin
|
|
edHomeDir.Text := Trim(edHomeDir.Text);
|
|
if edHomeDir.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"Fasoo 키폴더"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edHomeDir.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(edHomeDir.Text) then
|
|
begin
|
|
MessageBox(Handle, '입력한 "Fasoo 키폴더"가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
edEncSrcPath.Text := Trim(edEncSrcPath.Text);
|
|
if edEncSrcPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"원본 파일 경로"를 입력해 주십싣오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not FileExists(edEncSrcPath.Text) then
|
|
begin
|
|
MessageBox(Handle, '"원본 파일 경로"의 파일이 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
edEncDestPath.Text := Trim(edEncDestPath.Text);
|
|
if edEncDestPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"암호화 후 저장 경로"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(ExtractFilePath(edEncDestPath.Text)) then
|
|
begin
|
|
MessageBox(Handle, '"암호화 후 저장 경로"의 폴더가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
MgCtrlData_.Save;
|
|
Guard(fas, TTgFasoo.Create(edHomeDir.Text, edHomeDir.Text));
|
|
if fas.DoPackaging(edEncSrcPath.Text, edEncDestPath.Text, @nResult) then
|
|
MessageBox(Handle, '파일 암호화 작업 완료', PChar(Caption), MB_ICONINFORMATION or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(Format('파일 암호화 작업 실패 (%d)', [nResult])), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
end;
|
|
|
|
procedure TDlgFasooTest2Main.btnEncCheckClick(Sender: TObject);
|
|
var
|
|
fas: TTgFasoo;
|
|
nResult: Integer;
|
|
sMsg: String;
|
|
begin
|
|
edSrcPath.Text := Trim(edSrcPath.Text);
|
|
|
|
if edSrcPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"암호화 파일 경로"를 입력해 주십싣오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
MgCtrlData_.Save;
|
|
|
|
nResult := -1;
|
|
Guard(fas, TTgFasoo.Create(edHomeDir.Text));
|
|
nResult := fas.GetFileType(edSrcPath.Text);
|
|
if nResult <> 0 then
|
|
begin
|
|
case nResult of
|
|
20 : sMsg := '파일을 찾을 수 없습니다.';
|
|
21 : sMsg := '파일 사이즈가 0 입니다.';
|
|
22 : sMsg := '파일을 읽을 수 없습니다.';
|
|
29 : sMsg := '암호화 파일 경로이 아닙니다.';
|
|
26 : sMsg := 'FSD 파일입니다.';
|
|
105 : sMsg := 'Wrapsody 파일입니다.';
|
|
101 : sMsg := 'MarkAny 파일입니다.';
|
|
104 : sMsg := 'INCAPS 파일입니다.';
|
|
103 : sMsg := 'FSN 파일입니다.';
|
|
106 : sMsg := 'NX 파일입니다.';
|
|
107 : sMsg := 'NASCA 파일입니다.';
|
|
else sMsg := '알수없는 오류입니다.';
|
|
end;
|
|
|
|
MessageBox(Handle, PChar(Format('%s - Result=%d', [sMsg, nResult])), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
if fas.IsPackageFile(edSrcPath.Text) then
|
|
MessageBox(Handle, PChar(Format('암호화 파일 경로입니다. - Result=%d', [nResult])), PChar(Caption), MB_ICONINFORMATION or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(Format('암호화 파일 경로이 아닙니다. - Result=%d', [nResult])), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
end;
|
|
|
|
procedure TDlgFasooTest2Main.btnEncClick(Sender: TObject);
|
|
var
|
|
fas: TTgFasoo;
|
|
nResult: Integer;
|
|
sMsg: String;
|
|
begin
|
|
edHomeDir.Text := Trim(edHomeDir.Text);
|
|
if edHomeDir.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"Fasoo 키폴더"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edHomeDir.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(edHomeDir.Text) then
|
|
begin
|
|
MessageBox(Handle, '입력한 "Fasoo 키폴더"가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
edEncSrcPath.Text := Trim(edEncSrcPath.Text);
|
|
if edEncSrcPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"원본 파일 경로"를 입력해 주십싣오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not FileExists(edEncSrcPath.Text) then
|
|
begin
|
|
MessageBox(Handle, '"원본 파일 경로"의 파일이 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
edEncDestPath.Text := Trim(edEncDestPath.Text);
|
|
if edEncDestPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"암호화 후 저장 경로"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(ExtractFilePath(edEncDestPath.Text)) then
|
|
begin
|
|
MessageBox(Handle, '"암호화 후 저장 경로"의 폴더가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edEncDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
MgCtrlData_.Save;
|
|
Guard(fas, TTgFasoo.Create(edHomeDir.Text, edHomeDir.Text));
|
|
if fas.DoPackagingFsn(edEncSrcPath.Text, edEncDestPath.Text, @nResult) then
|
|
MessageBox(Handle, '파일 암호화 작업 완료', PChar(Caption), MB_ICONINFORMATION or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(Format('파일 암호화 작업 실패 (%d)', [nResult])), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
end;
|
|
|
|
procedure TDlgFasooTest2Main.btnForceDecryptClick(Sender: TObject);
|
|
var
|
|
fas: TTgFasoo;
|
|
nResult: Integer;
|
|
sMsg: String;
|
|
begin
|
|
edHomeDir.Text := Trim(edHomeDir.Text);
|
|
if edHomeDir.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"Fasoo 키폴더"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edHomeDir.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(edHomeDir.Text) then
|
|
begin
|
|
MessageBox(Handle, '입력한 "Fasoo 키폴더"가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
edSrcPath.Text := Trim(edSrcPath.Text);
|
|
if edSrcPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"암호화 파일 경로"를 입력해 주십싣오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not FileExists(edSrcPath.Text) then
|
|
begin
|
|
MessageBox(Handle, '"암호화 파일 경로"의 파일이 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
edDestPath.Text := Trim(edDestPath.Text);
|
|
if edDestPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"복호화 파일 경로"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(ExtractFilePath(edDestPath.Text)) then
|
|
begin
|
|
MessageBox(Handle, '"복호화 파일 경로"의 폴더가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
MgCtrlData_.Save;
|
|
Guard(fas, TTgFasoo.Create(edHomeDir.Text, edHomeDir.Text));
|
|
if fas.DoExtract(edSrcPath.Text, edDestPath.Text) then
|
|
MessageBox(Handle, '파일 복호화 작업 완료', PChar(Caption), MB_ICONINFORMATION or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(Format('FSN 암호화 파일 경로이 아닙니다.'+#13#10+
|
|
'확인 후 다시 시도해 주십시오.'+#13#10+'FileType = %d', [nResult])), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
end;
|
|
|
|
procedure TDlgFasooTest2Main.btnGetFileHeaderClick(Sender: TObject);
|
|
var
|
|
fas: TTgFasoo;
|
|
nResult: Integer;
|
|
sMsg, sHeader: String;
|
|
begin
|
|
edSrcPath.Text := Trim(edSrcPath.Text);
|
|
|
|
if edSrcPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"암호화 파일 경로"를 입력해 주십싣오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
MgCtrlData_.Save;
|
|
Guard(fas, TTgFasoo.Create(edHomeDir.Text));
|
|
nResult := fas.GetFileType(edSrcPath.Text);
|
|
case nResult of
|
|
103,
|
|
106 :
|
|
begin
|
|
sHeader := fas.GetFileHeader(edSrcPath.Text);
|
|
mmInfo.Text := sHeader;
|
|
end;
|
|
else begin
|
|
MessageBox(Handle, PChar(Format('FSN 암호화 파일 경로가 아닙니다.'+#13#10+
|
|
'확인 후 다시 시도해 주십시오.'+#13#10+'FileType = %d', [nResult])), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgFasooTest2Main.btnRegDllClick(Sender: TObject);
|
|
var
|
|
sPath: String;
|
|
bFc: Boolean;
|
|
begin
|
|
bFc := true;
|
|
sPath := 'C:\Program Files\Fasoo DRM\CW-Packager\WorkPackagerV3.dll';
|
|
if not FileExists(sPath) then
|
|
begin
|
|
bFc := false;
|
|
sPath := GetRunExePathDir + DLL_FASOO;
|
|
end;
|
|
|
|
if not FileExists(sPath) then
|
|
begin
|
|
MessageBox(Handle, PChar(Format('"%s" 파일이 없습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', [DLL_FASOO])), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
ExecutePath_hide('regsvr32.exe', Format('/s "%s"', [sPath]));
|
|
|
|
MessageBox(Handle, PChar(Format('"%s"을 등록 하였습니다. ', [DLL_FASOO]) + BooleanToStr(bFc, '(FsDLL)', '(Local)')), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
end;
|
|
|
|
procedure TDlgFasooTest2Main.btnUnRegDllClick(Sender: TObject);
|
|
var
|
|
sPath: String;
|
|
bFc: Boolean;
|
|
begin
|
|
bFc := true;
|
|
sPath := 'C:\Program Files\Fasoo DRM\CW-Packager\WorkPackagerV3.dll';
|
|
if not FileExists(sPath) then
|
|
begin
|
|
bFc := false;
|
|
sPath := GetRunExePathDir + DLL_FASOO;
|
|
end;
|
|
|
|
sPath := GetRunExePathDir + DLL_FASOO;
|
|
if not FileExists(sPath) then
|
|
begin
|
|
MessageBox(Handle, PChar(Format('"%s" 파일이 없습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', [DLL_FASOO])), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
ExecutePath_hide('regsvr32.exe', Format('/u "%s"', [sPath]));
|
|
|
|
MessageBox(Handle, PChar(Format('"%s"을 등록해제 하였습니다. ', [DLL_FASOO]) + BooleanToStr(bFc, '(FsDLL)', '(Local)')), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
end;
|
|
|
|
procedure TDlgFasooTest2Main.btnWorkThread2Click(Sender: TObject);
|
|
var
|
|
fas: TTgFasoo;
|
|
nResult: Integer;
|
|
sMsg: String;
|
|
ThdProc: TThdProcFasooDRM;
|
|
begin
|
|
edHomeDir.Text := Trim(edHomeDir.Text);
|
|
if edHomeDir.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"Fasoo 키폴더"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edHomeDir.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(edHomeDir.Text) then
|
|
begin
|
|
MessageBox(Handle, '입력한 "Fasoo 키폴더"가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
edSrcPath.Text := Trim(edSrcPath.Text);
|
|
if edSrcPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"암호화 파일 경로"를 입력해 주십싣오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not FileExists(edSrcPath.Text) then
|
|
begin
|
|
MessageBox(Handle, '"암호화 파일 경로"의 파일이 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
edDestPath.Text := Trim(edDestPath.Text);
|
|
if edDestPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"복호화 파일 경로"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(ExtractFilePath(edDestPath.Text)) then
|
|
begin
|
|
MessageBox(Handle, '"복호화 파일 경로"의 폴더가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
MgCtrlData_.Save;
|
|
Guard(ThdProc, TThdProcFasooDRM.Create(edHomeDir.Text, edSrcPath.Text, edDestPath.Text, false));
|
|
ThdProc.StartThread;
|
|
while ThdProc.WorkState <> tsCompleted do
|
|
begin
|
|
Sleep(200);
|
|
Application.ProcessMessages;
|
|
end;
|
|
|
|
if FileExists(edDestPath.Text) then
|
|
MessageBox(Handle, PChar(Format('파일 복호화 작업 완료 (Code=%d)', [ThdProc.ErrorCode])), PChar(Caption), MB_ICONINFORMATION or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(Format('파일 복호화 작업 실패 (Code=%d)', [ThdProc.ErrorCode])), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
// MessageBox(Handle, PChar(Format('FSN 암호화 파일 경로가 아닙니다.'+#13#10+
|
|
// '확인 후 다시 시도해 주십시오.'+#13#10+'FileType = %d', [nResult])), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
end;
|
|
|
|
procedure TDlgFasooTest2Main.btnWorkThreadClick(Sender: TObject);
|
|
var
|
|
fas: TTgFasoo;
|
|
nResult: Integer;
|
|
sMsg: String;
|
|
ThdProc: TThdProcFasooDRM;
|
|
begin
|
|
edHomeDir.Text := Trim(edHomeDir.Text);
|
|
if edHomeDir.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"Fasoo 키폴더"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edHomeDir.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(edHomeDir.Text) then
|
|
begin
|
|
MessageBox(Handle, '입력한 "Fasoo 키폴더"가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
edSrcPath.Text := Trim(edSrcPath.Text);
|
|
if edSrcPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"암호화 파일 경로"를 입력해 주십싣오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not FileExists(edSrcPath.Text) then
|
|
begin
|
|
MessageBox(Handle, '"암호화 파일 경로"의 파일이 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
edDestPath.Text := Trim(edDestPath.Text);
|
|
if edDestPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"복호화 파일 경로"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(ExtractFilePath(edDestPath.Text)) then
|
|
begin
|
|
MessageBox(Handle, '"복호화 파일 경로"의 폴더가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
MgCtrlData_.Save;
|
|
Guard(ThdProc, TThdProcFasooDRM.Create(edHomeDir.Text, edSrcPath.Text, edDestPath.Text, true));
|
|
ThdProc.StartThread;
|
|
while ThdProc.WorkState <> tsCompleted do
|
|
begin
|
|
Sleep(200);
|
|
Application.ProcessMessages;
|
|
end;
|
|
|
|
if FileExists(edDestPath.Text) then
|
|
MessageBox(Handle, PChar(Format('파일 복호화 작업 완료 (Code=%d)', [ThdProc.ErrorCode])), PChar(Caption), MB_ICONINFORMATION or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(Format('파일 복호화 작업 실패 (Code=%d)', [ThdProc.ErrorCode])), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
// MessageBox(Handle, PChar(Format('FSN 암호화 파일 경로가 아닙니다.'+#13#10+
|
|
// '확인 후 다시 시도해 주십시오.'+#13#10+'FileType = %d', [nResult])), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
end;
|
|
|
|
procedure TDlgFasooTest2Main.btnDecryptClick(Sender: TObject);
|
|
var
|
|
fas: TTgFasoo;
|
|
nResult: Integer;
|
|
sMsg: String;
|
|
begin
|
|
edHomeDir.Text := Trim(edHomeDir.Text);
|
|
if edHomeDir.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"Fasoo 키폴더"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edHomeDir.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(edHomeDir.Text) then
|
|
begin
|
|
MessageBox(Handle, '입력한 "Fasoo 키폴더"가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
edSrcPath.Text := Trim(edSrcPath.Text);
|
|
if edSrcPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"암호화 파일 경로"를 입력해 주십싣오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not FileExists(edSrcPath.Text) then
|
|
begin
|
|
MessageBox(Handle, '"암호화 파일 경로"의 파일이 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edSrcPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
edDestPath.Text := Trim(edDestPath.Text);
|
|
if edDestPath.Text = '' then
|
|
begin
|
|
MessageBox(Handle, '"복호화 파일 경로"를 입력해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if not DirectoryExists(ExtractFilePath(edDestPath.Text)) then
|
|
begin
|
|
MessageBox(Handle, '"복호화 파일 경로"의 폴더가 존재하지 않습니다.'+#13+#10+
|
|
'확인 후 다시 시도해 주십시오.', PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edDestPath.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
MgCtrlData_.Save;
|
|
nResult := 0;
|
|
Guard(fas, TTgFasoo.Create(edHomeDir.Text, edHomeDir.Text));
|
|
if fas.DoExtract(edSrcPath.Text, edDestPath.Text, true, @nResult) then
|
|
MessageBox(Handle, '파일 복호화 작업 완료', PChar(Caption), MB_ICONINFORMATION or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(Format('FSN 암호화 파일 경로가 아닙니다.'+#13#10+
|
|
'확인 후 다시 시도해 주십시오.'+#13#10+'Error = %d', [nResult])), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
end;
|
|
|
|
end.
|