From 4d566bb72f239870e95fde861d123bcee85f3672 Mon Sep 17 00:00:00 2001 From: anderson.peterle@previdencia.gov.br Date: Sun, 5 Apr 2009 19:15:55 +0000 Subject: [PATCH] Reuso de codigos da library generica, pequenas correcoes e faxina de codigo. --- cacic2.res | Bin 4784 -> 0 bytes cacicservice/CACICsvc.res | Bin 5272 -> 0 bytes cacicservice/CACICsvcMain.pas | 49 +++++++++++++++++++++++++++++-------------------- chkcacic/FormConfig.dfm | 8 ++++---- chkcacic/FormConfig.pas | 17 +++++++++++++++-- chkcacic/chkcacic.dpr | 8 ++++---- chkcacic/chkcacic.res | Bin 5212 -> 0 bytes chkcacic/main.pas | 215 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------- chksis/chksis.dpr | 29 +++++------------------------ chksis/chksis.res | Bin 5164 -> 0 bytes col_anvi/col_anvi.dpr | 80 ++++++++++++++++++++++++++++++++++++++++++++++---------------------------------- col_anvi/col_anvi.res | Bin 16324 -> 0 bytes col_comp/col_comp.dpr | 69 ++++++++++++++++++++++++++++++++++++++++----------------------------- col_comp/col_comp.res | Bin 16332 -> 0 bytes col_hard/col_hard.dpr | 79 +++++++++++++++++++++++++++++++++++++++++-------------------------------------- col_hard/col_hard.res | Bin 16320 -> 0 bytes col_moni/col_moni.res | Bin 16280 -> 0 bytes col_patr/col_patr.res | Bin 16324 -> 0 bytes col_soft/col_soft.res | Bin 16340 -> 0 bytes col_undi/col_undi.res | Bin 16340 -> 0 bytes ger_cols/ger_cols.res | Bin 4824 -> 0 bytes ini_cols/ini_cols.res | Bin 6740 -> 0 bytes mapa/mapacacic.res | Bin 5148 -> 0 bytes 23 files changed, 272 insertions(+), 282 deletions(-) diff --git a/cacic2.res b/cacic2.res index c887ce8..177bc9c 100755 Binary files a/cacic2.res and b/cacic2.res differ diff --git a/cacicservice/CACICsvc.res b/cacicservice/CACICsvc.res index 2377c23..7bb0cee 100755 Binary files a/cacicservice/CACICsvc.res and b/cacicservice/CACICsvc.res differ diff --git a/cacicservice/CACICsvcMain.pas b/cacicservice/CACICsvcMain.pas index 7e4c21e..8a5723e 100755 --- a/cacicservice/CACICsvcMain.pas +++ b/cacicservice/CACICsvcMain.pas @@ -44,7 +44,7 @@ type { Internal Start & Stop methods } function GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String; - procedure doSaveLog(Msg : String); + procedure logDEBUG(Msg : String); Procedure WMEndSession(var Msg : TWMEndSession) ; message WM_ENDSESSION; procedure ExecutaCACIC; public @@ -62,7 +62,7 @@ implementation procedure TCACICservice.WMEndSession(var Msg : TWMEndSession) ; begin if Msg.EndSession = TRUE then - doSaveLog('Windows finalizado em ' + FormatDateTime('c', Now)) ; + logDEBUG('Windows finalizado em ' + FormatDateTime('c', Now)) ; inherited; Application.Free; end; @@ -77,7 +77,7 @@ var i, j, v_Size_Section, v_Size_Key : integer; v_SectionName, v_KeyName : string; begin -//doSaveLog('GetVCRini: Secao: '+p_Secao+' Chave: '+p_Chave+' File: '+p_File); + logDEBUG('GetVCRini: Secao: '+p_Secao+' Chave: '+p_Chave+' File: '+p_File); Result := ''; v_SectionName := '[' + p_Secao + ']'; v_Size_Section := strLen(PChar(v_SectionName)); @@ -106,32 +106,34 @@ var end; end; -procedure TCACICservice.doSaveLog(Msg : String); +procedure TCACICservice.logDEBUG(Msg : String); var fLog: textfile; begin - AssignFile(fLog, g_oCacic.Windows.getWinDir + 'CACICsvc.log'); - if FileExists(g_oCacic.Windows.getWinDir + 'CACICsvc.log') then - Append(fLog) - else - Rewrite(fLog); - Writeln(fLog,FormatDateTime('dd/mm hh:nn:ss ', Now) + '[CACICsvc] : ' +msg); - CloseFile(fLog); + // Somente gravarei informações para debug se o arquivo ":\CACICsvc.log" existir + if FileExists(g_oCacic.Windows.getHomeDrive + 'CACICsvc.log') then + Begin + AssignFile(fLog, g_oCacic.Windows.getHomeDrive + 'CACICsvc.log'); + if FileExists(g_oCacic.Windows.getHomeDrive + 'CACICsvc.log') then + Append(fLog) + else + Rewrite(fLog); + Writeln(fLog,FormatDateTime('dd/mm hh:nn:ss ', Now) + '[CACICsvc][DEBUG] : ' +msg); + CloseFile(fLog); + End; End; procedure ServiceController(CtrlCode: DWord); stdcall; begin - CACICservice.Controller(CtrlCode); + CACICservice.Controller(CtrlCode); end; function TCACICservice.GetServiceController: TServiceController; begin - Result := ServiceController; + Result := ServiceController; end; procedure TCACICservice.ServiceExecute(Sender: TService); begin - doSaveLog('TCACICservice.ServiceExecute'); - { Loop while service is active in SCM } While NOT Terminated do Begin @@ -144,8 +146,9 @@ end; procedure TCACICservice.ServiceStart(Sender: TService; var Started: Boolean); begin - g_oCacic := TCACIC.Create; + g_oCacic := TCACIC.Create; + CACICservice.logDEBUG('TCACICservice.ServiceStart'); Started := true; ExecutaCACIC; @@ -159,8 +162,10 @@ end; procedure TCACICservice.ExecutaCACIC; Begin - g_oCacic.setCacicPath(g_oCacic.getHomeDrive + GetValorChaveRegIni('Cacic2', 'cacic_dir', g_oCacic.getWinDir + 'chksis.ini') + '\'); + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : setCacicPath => '+GetValorChaveRegIni('Cacic2', 'cacic_dir', g_oCacic.getWinDir + 'chksis.ini')); + g_oCacic.setCacicPath(GetValorChaveRegIni('Cacic2', 'cacic_dir', g_oCacic.getWinDir + 'chksis.ini')); + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : deleteFile => '+g_oCacic.getCacicPath + 'aguarde_CACIC.txt'); DeleteFile(g_oCacic.getCacicPath + 'aguarde_CACIC.txt'); Sleep(3000); @@ -169,7 +174,8 @@ Begin Begin // Executo o CHKsis, verificando a estrutura do sistema Try - WinEXEC(PChar(g_oCacic.getWinDir + 'chksis.exe'),sw_HIDE); + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : winExec => '+g_oCacic.getWinDir + 'chksis.exe'); + g_oCacic.createSampleProcess(g_oCacic.getWinDir + 'chksis.exe',false); Except End; @@ -180,19 +186,21 @@ Begin // Executo o Agente Principal do CACIC Try - WinEXEC(PChar(g_oCacic.getCacicPath + 'cacic2.exe'),sw_hide); + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : winExec => '+g_oCacic.getCacicPath + 'cacic2.exe'); + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe',false); Except End; End; procedure TCACICservice.ServiceAfterInstall(Sender: TService); - begin ServiceStart(nil,boolStarted); + CACICservice.logDEBUG('TCACICservice.ServiceAfterInstall'); end; procedure TCACICservice.Timer_CHKsisTimer(Sender: TObject); begin + CACICservice.logDEBUG('TCACICservice.Timer_CHKsisTimer'); ExecutaCACIC; // Verificações diversas @@ -202,6 +210,7 @@ end; procedure TCACICservice.ServiceStop(Sender: TService; var Stopped: Boolean); begin + CACICservice.logDEBUG('TCACICservice.ServiceStop'); Stopped := true; end; diff --git a/chkcacic/FormConfig.dfm b/chkcacic/FormConfig.dfm index 4142620..b5e306e 100755 --- a/chkcacic/FormConfig.dfm +++ b/chkcacic/FormConfig.dfm @@ -154,11 +154,11 @@ object Configs: TConfigs Text = 'Cacic' end object Button_Gravar: TButton - Left = 74 + Left = 48 Top = 325 - Width = 150 + Width = 214 Height = 35 - Caption = 'Gravar Configura'#231#245'es' + Caption = 'Concluir Instala'#231#227'o/Atualiza'#231#227'o' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 @@ -169,7 +169,7 @@ object Configs: TConfigs OnClick = Button_GravarClick end object btSair: TButton - Left = 265 + Left = 291 Top = 325 Width = 150 Height = 35 diff --git a/chkcacic/FormConfig.pas b/chkcacic/FormConfig.pas index 3d356b3..b2f8031 100755 --- a/chkcacic/FormConfig.pas +++ b/chkcacic/FormConfig.pas @@ -20,8 +20,21 @@ unit FormConfig; interface uses - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls,main, PJVersionInfo, NTFileSecurity, Buttons, ExtCtrls; + Windows, + Messages, + SysUtils, + Variants, + Classes, + Graphics, + Controls, + Forms, + Dialogs, + StdCtrls, + main, + PJVersionInfo, + NTFileSecurity, + Buttons, + ExtCtrls; type TConfigs = class(TForm) diff --git a/chkcacic/chkcacic.dpr b/chkcacic/chkcacic.dpr index 23277bf..04be977 100755 --- a/chkcacic/chkcacic.dpr +++ b/chkcacic/chkcacic.dpr @@ -27,18 +27,18 @@ const CACIC_APP_NAME = 'chkcacic'; var - g_oCacic : TCACIC; + oCacic : TCACIC; begin - g_oCacic := TCACIC.Create(); + oCacic := TCACIC.Create(); - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) + if( not oCacic.isAppRunning( CACIC_APP_NAME ) ) then begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end; - g_oCacic.Free(); + oCacic.Free(); end. diff --git a/chkcacic/chkcacic.res b/chkcacic/chkcacic.res index 2a1027d..6b01b52 100755 Binary files a/chkcacic/chkcacic.res and b/chkcacic/chkcacic.res differ diff --git a/chkcacic/main.pas b/chkcacic/main.pas index a99789d..3035d3d 100644 --- a/chkcacic/main.pas +++ b/chkcacic/main.pas @@ -80,9 +80,9 @@ uses IdFTP, Tlhelp32, ExtCtrls, + Dialogs, CACIC_Library, - WinSvc, - dialogs; + WinSvc; var v_ip_serv_cacic, @@ -94,9 +94,9 @@ var v_versao_remota, v_strCipherClosed, v_strCipherOpened, - v_retorno, v_versao_REM, - v_versao_LOC : String; + v_versao_LOC, + v_retorno : String; var v_Debugs : boolean; @@ -392,6 +392,7 @@ var v_DatFile : TextFile; v_strCipherOpened, v_strCipherClosed : string; begin + LogDebug('Tentando acessar configurações em '+g_oCacic.getCacicPath + g_oCacic.getDatFileName); v_strCipherOpened := ''; if FileExists(p_DatFileName) then begin @@ -415,10 +416,8 @@ begin else Result := g_oCacic.explode('Configs.ID_SO'+g_oCacic.getSeparatorKey+ g_oCacic.getWindowsStrId() +g_oCacic.getSeparatorKey+'Configs.Endereco_WS'+g_oCacic.getSeparatorKey+'/cacic2/ws/',g_oCacic.getSeparatorKey); - if Result.Count mod 2 <> 0 then Result.Add(''); - end; Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String); @@ -573,11 +572,6 @@ end; function SetValorChaveRegIni(p_Secao, p_Chave, p_Valor, p_File : String): String; var Reg_Ini : TIniFile; begin -// FileSetAttr (p_File,0); - { - To remove write protection on a file: - Den Schreibschutz einer Datei aufheben: - } if (FileGetAttr(p_File) and faReadOnly) > 0 then FileSetAttr(p_File, FileGetAttr(p_File) xor faReadOnly); @@ -650,12 +644,14 @@ end; Procedure CriaFormConfigura; begin + LogDebug('Chamando Criação do Formulário de Configurações - 1'); Application.CreateForm(TConfigs, FormConfig.Configs); FormConfig.Configs.lbVersao.Caption := 'v: ' + getVersionInfo(ParamStr(0)); end; Procedure MostraFormConfigura; begin + LogDebug('Exibindo formulário de configurações'); FormConfig.Configs.ShowModal; end; @@ -726,12 +722,12 @@ begin LogDebug('FTP: Change to "'+p_PathServer+'"'); IdFTP.ChangeDir(p_PathServer); Try - LogDebug('Iniciando FTP de "'+p_Dest + '\' + p_File+'"'); - LogDebug('HashCode de "'+p_File+'" Antes do FTP => '+g_oCacic.GetFileHash(p_File)); - IdFTP.Get(p_File, p_Dest + '\' + p_File, True, True); - LogDebug('HashCode de "'+p_Dest + '\' + p_File +'" Após o FTP => '+g_oCacic.GetFileHash(p_Dest + '\' + p_File)); + LogDebug('Iniciando FTP de "'+p_Dest + p_File+'"'); + LogDebug('HashCode de "'+p_File+'" Antes do FTP => '+g_oCacic.GetFileHash(p_Dest + p_File)); + IdFTP.Get(p_File, p_Dest + p_File, True, True); + LogDebug('HashCode de "'+p_Dest + p_File +'" Após o FTP => '+g_oCacic.GetFileHash(p_Dest + p_File)); Finally - LogDebug('HashCode de "'+p_Dest + '\' + p_File +'" Após o FTP em Finally => '+g_oCacic.GetFileHash(p_Dest + '\' + p_File)); + LogDebug('HashCode de "'+p_Dest + p_File +'" Após o FTP em Finally => '+g_oCacic.GetFileHash(p_Dest + p_File)); IdFTP.Disconnect; IdFTP.Free; result := true; @@ -751,7 +747,7 @@ procedure GravaConfiguracoes; var chkcacic_ini : TextFile; begin try - g_oCacic.setCacicPath(Configs.Edit_cacic_dir.text+'\'); + LogDebug('g_ocacic => setCacicpath => '+Configs.Edit_cacic_dir.text+'\'); FileSetAttr (ExtractFilePath(Application.Exename) + '\chkcacic.ini',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 AssignFile(chkcacic_ini,ExtractFilePath(Application.Exename) + '\chkcacic.ini'); {Associa o arquivo a uma variável do tipo TextFile} @@ -845,13 +841,15 @@ begin // Escrita dos parâmetros obrigatórios Writeln(chkcacic_ini,'ip_serv_cacic='+v_ip_serv_cacic); - Writeln(chkcacic_ini,'cacic_dir='+Configs.Edit_cacic_dir.text); + Writeln(chkcacic_ini,'cacic_dir='+g_oCacic.getHomeDrive + Configs.Edit_cacic_dir.text+'\'); Writeln(chkcacic_ini,'exibe_informacoes='+v_exibe_informacoes); // Escrita dos valores opcionais quando existirem if (v_te_instala_informacoes_extras <>'') then Writeln(chkcacic_ini,'te_instala_informacoes_extras='+ StringReplace(v_te_instala_informacoes_extras,#13#10,'*13*10',[rfReplaceAll])); CloseFile(chkcacic_ini); {Fecha o arquivo texto} + + g_oCacic.setCacicPath(g_oCacic.getHomeDrive + Configs.Edit_cacic_dir.text+'\'); except end; end; @@ -962,7 +960,9 @@ var SearchRec: TSearchRec; Result: Integer; strFileName : String; begin + strFileName := StringReplace(v_dir + '\' + v_files,'\\','\',[rfReplaceAll]); + LogDebug('Matando: '+strFileName); Result:=FindFirst(strFileName, faAnyFile, SearchRec); while result=0 do @@ -1022,52 +1022,56 @@ end; procedure verifyAndGet(p_strModuleName, p_strFileHash, - p_strDestinationFolderName, - p_strServUpdates, - p_strPortaServUpdates, - p_strNomeUsuarioLoginServUpdates, - p_strSenhaLoginServUpdates, - p_strPathServUpdates, - p_strExibeInformacoes : String); - var v_strFileHash : String; - Begin + p_strDestinationFolderName : String); +var v_strFileHash, + v_strDestinationFolderName : String; +Begin + v_strDestinationFolderName := p_strDestinationFolderName + '\'; + v_strDestinationFolderName := StringReplace(v_strDestinationFolderName,'\\','\',[rfReplaceAll]); + LogDebug('Verificando módulo: '+v_strDestinationFolderName +p_strModuleName); // Verifico validade do Módulo e mato-o em caso negativo. - v_strFileHash := g_oCacic.GetFileHash(p_strDestinationFolderName + '\'+p_strModuleName); + v_strFileHash := g_oCacic.GetFileHash(v_strDestinationFolderName + p_strModuleName); - LogDebug('verifyAndGet - strFileHash de "'+p_strDestinationFolderName + '\'+p_strModuleName+'": ' + v_strFileHash); + LogDebug('verifyAndGet - HashCode Remot: "'+p_strFileHash+'"'); + LogDebug('verifyAndGet - HashCode Local: "'+v_strFileHash+'"'); If (v_strFileHash <> p_strFileHash) then - Matar(p_strDestinationFolderName, p_strModuleName); + Matar(v_strDestinationFolderName, p_strModuleName); - If not FileExists(p_strDestinationFolderName + '\'+p_strModuleName) Then + If not FileExists(v_strDestinationFolderName + p_strModuleName) Then Begin if (FileExists(ExtractFilePath(Application.Exename) + '\modulos\'+p_strModuleName)) then Begin - LogDiario('Copiando '+p_strModuleName+' de '+ExtractFilePath(Application.Exename)+'modulos\'); - CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\'+p_strModuleName), PChar(p_strDestinationFolderName + '\'+p_strModuleName),false); - FileSetAttr (PChar(p_strDestinationFolderName + '\' + p_strModuleName),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED + LogDebug('Copiando '+p_strModuleName+' de '+ExtractFilePath(Application.Exename)+'modulos\'); + CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\'+p_strModuleName), PChar(v_strDestinationFolderName + p_strModuleName),false); + FileSetAttr (PChar(v_strDestinationFolderName + p_strModuleName),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED End else begin + Try - if not FTP(p_strServUpdates, - p_strPortaServUpdates, - p_strNomeUsuarioLoginServUpdates, - p_strSenhaLoginServUpdates, - p_strPathServUpdates, + if not FTP(XML_RetornaValor('te_serv_updates' , v_retorno), + XML_RetornaValor('nu_porta_serv_updates' , v_retorno), + XML_RetornaValor('nm_usuario_login_serv_updates', v_retorno), + XML_RetornaValor('te_senha_login_serv_updates' , v_retorno), + XML_RetornaValor('te_path_serv_updates' , v_retorno), p_strModuleName, - p_strDestinationFolderName) then - Configs.Memo_te_instala_informacoes_extras.Lines.add(#13#10+'ATENÇÃO! Não foi possível efetuar FTP para "'+p_strDestinationFolderName + '\'+p_strModuleName+'".'+#13#10+'Verifique o Servidor de Updates.'); + v_strDestinationFolderName) then + Configs.Memo_te_instala_informacoes_extras.Lines.add(#13#10+'ATENÇÃO! Não foi possível efetuar FTP para "'+v_strDestinationFolderName + p_strModuleName+'".'+#13#10+'Verifique o Servidor de Updates.'); Except - LogDebug('FTP de "'+ p_strDestinationFolderName + '\' + p_strModuleName+'" Interrompido.'); + LogDebug('FTP de "'+ v_strDestinationFolderName + p_strModuleName+'" Interrompido.'); End; - if not FileExists(p_strDestinationFolderName + '\' + p_strModuleName) Then + if not FileExists(v_strDestinationFolderName + p_strModuleName) Then Begin - LogDebug('Problemas Efetuando Download de '+ p_strDestinationFolderName + '\' + p_strModuleName+' (FTP)'); + LogDebug('Problemas Efetuando Download de '+ v_strDestinationFolderName + p_strModuleName+' (FTP)'); LogDebug('Conexão:'); - LogDebug(p_strServUpdates+', '+p_strPortaServUpdates+', '+p_strNomeUsuarioLoginServUpdates+', '+p_strSenhaLoginServUpdates+', '+p_strPathServUpdates); + LogDebug(XML_RetornaValor('te_serv_updates',v_retorno) +', '+ + XML_RetornaValor('nu_porta_serv_updates' , v_retorno)+', '+ + XML_RetornaValor('nm_usuario_login_serv_updates', v_retorno)+', '+ + XML_RetornaValor('te_senha_login_serv_updates' , v_retorno)+', '+ + XML_RetornaValor('te_path_serv_updates' , v_retorno)); End else LogDiario('Download Concluído de "'+p_strModuleName+'" (FTP)'); @@ -1114,6 +1118,8 @@ begin bool_CommandLine := false; bool_ArquivoINI := FileExists(ExtractFilePath(Application.Exename) + '\chkcacic.ini'); + g_oCacic := TCACIC.Create(); + g_oCacic.setBoolCipher(true); Try // 2.2.0.17 - Tratamento de opções passadas em linha de comando @@ -1155,7 +1161,6 @@ begin Begin If not bool_ArquivoINI then Begin - LogDiario('Abrindo formulário de configurações'); CriaFormConfigura; MostraFormConfigura; End; @@ -1165,8 +1170,7 @@ begin v_te_instala_informacoes_extras := StringReplace(GetValorChaveRegIni('Cacic2', 'te_instala_informacoes_extras', ExtractFilePath(Application.Exename) + '\chkcacic.ini'),'*13*10',#13#10,[rfReplaceAll]); End; - g_oCacic := TCACIC.Create(); - g_oCacic.setCacicPath(g_oCacic.getHomeDrive + v_cacic_dir + '\'); + g_oCacic.setCacicPath(v_cacic_dir); if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then Begin @@ -1202,7 +1206,7 @@ begin Configs.ckboxExibeInformacoes.Checked := true; Configs.ckboxExibeInformacoes.Visible := false; - Configs.Height := 357; + Configs.Height := 350; Configs.lbMensagemNaoAplicavel.Visible := false; Configs.Memo_te_instala_informacoes_extras.Clear; @@ -1232,7 +1236,7 @@ begin bool_configura := false; //chave AES. Recomenda-se que cada empresa/órgão altere a sua chave. - v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + '\' + g_oCacic.getDatFileName); + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); if (g_oCacic.isWindowsGEXP()) then // Se >= Maior ou Igual ao WinXP... Begin @@ -1282,7 +1286,6 @@ begin while (v_ip_serv_cacic = '') or (v_cacic_dir = '') or bool_configura do Begin - LogDiario('Abrindo formulário de configurações'); bool_configura := false; CriaFormConfigura; @@ -1304,6 +1307,7 @@ begin Application.Terminate; end; + LogDebug('Verificando pasta "'+g_oCacic.getCacicPath+'"'); // Verifico a existência do diretório configurado para o Cacic, normalmente CACIC if not DirectoryExists(g_oCacic.getCacicPath) then begin @@ -1311,6 +1315,7 @@ begin ForceDirectories(g_oCacic.getCacicPath); end; + LogDebug('Verificando pasta "'+g_oCacic.getCacicPath+'modulos'+'"'); // Para eliminar versão 20014 e anteriores que provavelmente não fazem corretamente o AutoUpdate if not DirectoryExists(g_oCacic.getCacicPath+'modulos') then begin @@ -1319,11 +1324,12 @@ begin LogDiario('Criando pasta '+g_oCacic.getCacicPath+'modulos'); end; + LogDebug('Verificando pasta "'+g_oCacic.getCacicPath+'Temp'+'"'); // Crio o SubDiretório TEMP, caso não exista - if not DirectoryExists(g_oCacic.getCacicPath+'temp') then + if not DirectoryExists(g_oCacic.getCacicPath+'Temp') then begin - ForceDirectories(g_oCacic.getCacicPath + 'temp'); - LogDiario('Criando pasta '+g_oCacic.getCacicPath+'temp'); + ForceDirectories(g_oCacic.getCacicPath + 'Temp'); + LogDiario('Criando pasta '+g_oCacic.getCacicPath+'Temp'); end; @@ -1361,19 +1367,15 @@ begin idHTTP1.Free; v_retorno := Response_Config.DataString; - v_te_serv_updates := XML_RetornaValor('te_serv_updates' , v_retorno); - v_nu_porta_serv_updates := XML_RetornaValor('nu_porta_serv_updates' , v_retorno); - v_nm_usuario_login_serv_updates := XML_RetornaValor('nm_usuario_login_serv_updates', v_retorno); - v_te_senha_login_serv_updates := XML_RetornaValor('te_senha_login_serv_updates' , v_retorno); - v_te_path_serv_updates := XML_RetornaValor('te_path_serv_updates' , v_retorno); + LogDebug('Retorno de comunicação com servidor: '+v_retorno); LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'); LogDebug(':::::::::::::::: VALORES OBTIDOS NO Gerente WEB :::::::::::::::'); LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'); - LogDebug('Servidor de updates......................: '+v_te_serv_updates); - LogDebug('Porta do servidor de updates.............: '+v_nu_porta_serv_updates); - LogDebug('Usuário para login no servidor de updates: '+v_nm_usuario_login_serv_updates); - LogDebug('Pasta no servidor de updates.............: '+v_te_path_serv_updates); + LogDebug('Servidor de updates......................: '+XML_RetornaValor('te_serv_updates' , v_retorno)); + LogDebug('Porta do servidor de updates.............: '+XML_RetornaValor('nu_porta_serv_updates' , v_retorno)); + LogDebug('Usuário para login no servidor de updates: '+XML_RetornaValor('nm_usuario_login_serv_updates', v_retorno)); + LogDebug('Pasta no servidor de updates.............: '+XML_RetornaValor('te_path_serv_updates' , v_retorno)); LogDebug(' '); LogDebug('Versões dos Agentes Principais:'); LogDebug('------------------------------'); @@ -1403,7 +1405,7 @@ begin // Atribuição de acesso ao módulo principal e pastas Form1.FS_SetSecurity(g_oCacic.getCacicPath); Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'cacic2.exe'); - Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'cacic2.dat'); + Form1.FS_SetSecurity(g_oCacic.getCacicPath + g_oCacic.getDatFileName); Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'cacic2.log'); Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'modulos'); Form1.FS_SetSecurity(g_oCacic.getCacicPath + 'temp'); @@ -1494,14 +1496,8 @@ begin // Tento detectar o ChkSis.EXE e copio ou faço FTP caso não exista verifyAndGet('chksis.exe', - XML_RetornaValor('CHKSIS_HASH', v_retorno), - g_oCacic.getWinDir, - v_te_serv_updates, - v_nu_porta_serv_updates, - v_nm_usuario_login_serv_updates, - v_te_senha_login_serv_updates, - v_te_path_serv_updates, - v_exibe_informacoes); + XML_RetornaValor('TE_HASH_CHKSIS', v_retorno), + g_oCacic.getWinDir); // Tento detectar o ChkSis.INI e crio-o caso necessário If not FileExists(g_oCacic.getWinDir + 'chksis.ini') Then @@ -1517,14 +1513,8 @@ begin Begin // Tento detectar o CACICsvc.EXE e copio ou faço FTP caso não exista verifyAndGet('cacicsvc.exe', - XML_RetornaValor('CACICSVC_HASH', v_retorno), - g_oCacic.getWinDir, - v_te_serv_updates, - v_nu_porta_serv_updates, - v_nm_usuario_login_serv_updates, - v_te_senha_login_serv_updates, - v_te_path_serv_updates, - v_exibe_informacoes); + XML_RetornaValor('TE_HASH_CACICSVC', v_retorno), + g_oCacic.getWinDir); // O CACICsvc usará o arquivo de configurações \Windows\chksis.ini End; @@ -1542,24 +1532,12 @@ begin // Tento detectar o Agente Principal e copio ou faço FTP caso não exista verifyAndGet('cacic2.exe', - XML_RetornaValor('CACIC2_HASH', v_retorno), - g_oCacic.getCacicPath, - v_te_serv_updates, - v_nu_porta_serv_updates, - v_nm_usuario_login_serv_updates, - v_te_senha_login_serv_updates, - v_te_path_serv_updates, - v_exibe_informacoes); + XML_RetornaValor('TE_HASH_CACIC2', v_retorno), + g_oCacic.getCacicPath); verifyAndGet('ger_cols.exe', - XML_RetornaValor('GER_COLS_HASH', v_retorno), - g_oCacic.getCacicPath + 'modulos', - v_te_serv_updates, - v_nu_porta_serv_updates, - v_nm_usuario_login_serv_updates, - v_te_senha_login_serv_updates, - v_te_path_serv_updates, - v_exibe_informacoes); + XML_RetornaValor('TE_HASH_GER_COLS', v_retorno), + g_oCacic.getCacicPath + 'modulos'); // Caso exista a pasta "modulos", copio todos os executáveis para a pasta Cacic\modulos, exceto cacic2.exe, ger_cols.exe e chksis.exe if (v_modulos <> '') then @@ -1584,35 +1562,17 @@ begin // Tento detectar (de novo) o ChkSis.EXE e copio ou faço FTP caso não exista verifyAndGet('chksis.exe', - XML_RetornaValor('CHKSIS_HASH', v_retorno), - g_oCacic.getWinDir, - v_te_serv_updates, - v_nu_porta_serv_updates, - v_nm_usuario_login_serv_updates, - v_te_senha_login_serv_updates, - v_te_path_serv_updates, - v_exibe_informacoes); + XML_RetornaValor('TE_HASH_CHKSIS', v_retorno), + g_oCacic.getWinDir); // Tento detectar (de novo) o Agente Principal e copio ou faço FTP caso não exista verifyAndGet('cacic2.exe', - XML_RetornaValor('CACIC2_HASH', v_retorno), - g_oCacic.getCacicPath, - v_te_serv_updates, - v_nu_porta_serv_updates, - v_nm_usuario_login_serv_updates, - v_te_senha_login_serv_updates, - v_te_path_serv_updates, - v_exibe_informacoes); + XML_RetornaValor('TE_HASH_CACIC2', v_retorno), + g_oCacic.getCacicPath); verifyAndGet('ger_cols.exe', - XML_RetornaValor('GER_COLS_HASH', v_retorno), - g_oCacic.getCacicPath + 'modulos', - v_te_serv_updates, - v_nu_porta_serv_updates, - v_nm_usuario_login_serv_updates, - v_te_senha_login_serv_updates, - v_te_path_serv_updates, - v_exibe_informacoes); + XML_RetornaValor('TE_HASH_GER_COLS', v_retorno), + g_oCacic.getCacicPath + 'modulos'); if (g_oCacic.isWindowsNTPlataform) then Begin @@ -1659,7 +1619,7 @@ begin // Igualo as chaves ip_serv_cacic dos arquivos chksis.ini e cacic2.ini! SetValorDatMemoria('Configs.EnderecoServidor', v_ip_serv_cacic); LogDebug('Fechando Arquivo de Configurações do Cacic'); - CipherClose(g_oCacic.getDatFileName); + CipherClose(g_oCacic.getCacicPath + g_oCacic.getDatFileName); LogDebug('Abrindo Arquivo de Configurações do ChkSis'); CipherOpen(g_oCacic.getWinDir + 'chksis.dat'); @@ -1709,9 +1669,9 @@ begin Begin LogDebug('Executando '+g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic); if (strDataHoraCACIC2_INI <> strDataHoraCACIC2_FIM) then - WinExec(PChar(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute'), SW_HIDE) + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute', false) else - WinExec(PChar(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic ), SW_HIDE); + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic , false); End else Begin @@ -1729,14 +1689,14 @@ begin if (wordServiceStatus = 0) then Begin // Instalo e Habilito o serviço - LogDiario('Instalando CACICservice...'); - WinExec(PChar(g_oCacic.getWinDir + 'cacicsvc.exe -install'), SW_NORMAL); + LogDiario('Instalando/Iniciando CACICservice...'); + g_oCacic.createSampleProcess(g_oCacic.getWinDir + 'cacicsvc.exe -install',false); End else if ((wordServiceStatus < 4) or (wordServiceStatus > 4)) then Begin LogDiario('Iniciando CACICservice'); - WinExec(PChar(g_oCacic.getWinDir + 'cacicsvc.exe -start'), SW_NORMAL); + g_oCacic.createSampleProcess(g_oCacic.getWinDir + 'cacicsvc.exe -start', false); End else LogDiario('Não instalei o CACICservice. Já está rodando...'); @@ -1757,9 +1717,10 @@ begin End; try - g_oCacic.Free(); + g_oCacic.Free; except end; + Application.Terminate; end; diff --git a/chksis/chksis.dpr b/chksis/chksis.dpr index 242bb04..8e86b4f 100755 --- a/chksis/chksis.dpr +++ b/chksis/chksis.dpr @@ -640,7 +640,7 @@ begin v_cacic_dir := GetValorChaveRegIni('Cacic2', 'cacic_dir' , ExtractFilePath(ParamStr(0)) + 'chksis.ini'); v_rem_cacic_v0x := GetValorChaveRegIni('Cacic2', 'rem_cacic_v0x', ExtractFilePath(ParamStr(0)) + 'chksis.ini'); - g_oCacic.setCacicPath(g_oCacic.getHomeDrive + v_cacic_dir +'\'); + g_oCacic.setCacicPath(v_cacic_dir); v_Debugs := false; if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then @@ -804,28 +804,7 @@ begin // 5 segundos para espera de possível FTP... Sleep(5000); - { - Try - // Crio a chave/valor chksis para autoexecução do Cacic, caso não exista esta chave/valor - log_diario('Setando chave HLM../Run com ' + HomeDrive + '\chksis.exe'); - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\CheckSystemRoutine', HomeDrive + '\chksis.exe'); - Except - End; - - bool_ExistsAutoRun := false; - if (GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2')=Dir + '\cacic2.exe') then - bool_ExistsAutoRun := true - else - Begin - Try - // Crio a chave/valor cacic2 para autoexecução do Cacic, caso não exista esta chave/valor - log_diario('Setando chave HLM../Run com ' + Dir + '\cacic2.exe'); - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2', Dir + '\cacic2.exe'); - Except - End; - End; - } // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor if Posso_Rodar_CACIC or not bool_ExistsAutoRun then Begin @@ -833,9 +812,9 @@ begin // Caso tenha havido download de agentes principais, executar coletas imediatamente... if (bool_download_CACIC2) then - WinExec(PChar(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute'), SW_HIDE) + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute', false) else - WinExec(PChar(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic ), SW_HIDE); + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic , false); End; end; @@ -845,6 +824,8 @@ const begin g_oCacic := TCACIC.Create(); + g_oCacic.setBoolCipher(true); + if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then begin if (FindWindowByTitle('chkcacic') = 0) and (FindWindowByTitle('cacic2') = 0) diff --git a/chksis/chksis.res b/chksis/chksis.res index f2669bb..cc567c1 100755 Binary files a/chksis/chksis.res and b/chksis/chksis.res differ diff --git a/col_anvi/col_anvi.dpr b/col_anvi/col_anvi.dpr index 8ed667f..4ef7327 100755 --- a/col_anvi/col_anvi.dpr +++ b/col_anvi/col_anvi.dpr @@ -28,12 +28,15 @@ uses PJVersionInfo, CACIC_Library in '..\CACIC_Library.pas'; -var v_strCipherClosed : String; +var + v_strCipherClosed : String; -var v_Debugs : boolean; +var + v_Debugs : boolean; -var v_tstrCipherOpened, - v_tstrCipherOpened1 : TStrings; +var + v_tstrCipherOpened, + v_tstrCipherOpened1 : TStrings; var g_oCacic : TCACIC; @@ -391,48 +394,57 @@ end; var tstrTripa1 : TStrings; intAux : integer; - v_path_cacic : String; + strAux : String; const CACIC_APP_NAME = 'col_anvi'; begin g_oCacic := TCACIC.Create(); + g_oCacic.setBoolCipher(true); + if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then if (ParamCount>0) then - Begin - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini - tstrTripa1 := g_oCacic.explode(ExtractFilePath(ParamStr(0)),'\'); - v_path_cacic := ''; - For intAux := 0 to tstrTripa1.Count -2 do - v_path_cacic := v_path_cacic + tstrTripa1[intAux] + '\'; - - g_oCacic.setCacicPath(v_path_cacic); - - v_Debugs := false; - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then - Begin - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then + Begin + strAux := ''; + For intAux := 1 to ParamCount do + Begin + if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then + begin + strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); + log_DEBUG('Parâmetro /CacicPath recebido com valor="'+strAux+'"'); + end; + end; + + if (strAux <> '') then Begin - v_Debugs := true; - log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); + g_oCacic.setCacicPath(strAux); + + v_Debugs := false; + if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then + Begin + if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then + Begin + v_Debugs := true; + log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); + End; End; - End; - - v_tstrCipherOpened := TStrings.Create; - v_tstrCipherOpened := CipherOpen(g_oCacic.getDatFileName); - v_tstrCipherOpened1 := TStrings.Create; - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_anvi.dat'); + v_tstrCipherOpened := TStrings.Create; + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); - Try - Executa_Col_Anvi; - Except - Begin - SetValorDatMemoria('Col_Anvi.nada', 'nada', v_tstrCipherOpened1); - CipherClose(g_oCacic.getCacicPath + 'temp\col_anvi.dat', v_tstrCipherOpened1); - End; - End; + v_tstrCipherOpened1 := TStrings.Create; + v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_anvi.dat'); + + Try + Executa_Col_Anvi; + Except + Begin + SetValorDatMemoria('Col_Anvi.nada', 'nada', v_tstrCipherOpened1); + CipherClose(g_oCacic.getCacicPath + 'temp\col_anvi.dat', v_tstrCipherOpened1); + End; + End; + End; End; g_oCacic.Free(); end. diff --git a/col_anvi/col_anvi.res b/col_anvi/col_anvi.res index 8fb2192..204a2bf 100755 Binary files a/col_anvi/col_anvi.res and b/col_anvi/col_anvi.res differ diff --git a/col_comp/col_comp.dpr b/col_comp/col_comp.dpr index 740802d..12014f7 100755 --- a/col_comp/col_comp.dpr +++ b/col_comp/col_comp.dpr @@ -25,12 +25,15 @@ uses Registry, CACIC_Library in '..\CACIC_Library.pas'; -var v_strCipherClosed : String; +var + v_strCipherClosed : String; -var v_tstrCipherOpened, - v_tstrCipherOpened1 : TStrings; +var + v_tstrCipherOpened, + v_tstrCipherOpened1 : TStrings; -var g_oCacic : TCACIC; +var + g_oCacic : TCACIC; procedure log_diario(strMsg : String); var @@ -140,7 +143,6 @@ begin Result := ''; end; - function GetRootKey(strRootKey: String): HKEY; begin /// Encontrar uma maneira mais elegante de fazer esses testes. @@ -343,37 +345,46 @@ end; var tstrTripa1 : TStrings; intAux : integer; - v_path_cacic : String; + strAux : String; const CACIC_APP_NAME = 'col_comp'; begin g_oCacic := TCACIC.Create(); - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then - if (ParamCount>0) then - Begin - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini - tstrTripa1 := g_oCacic.explode(ExtractFilePath(ParamStr(0)),'\'); - v_path_cacic := ''; - For intAux := 0 to tstrTripa1.Count -2 do - v_path_cacic := v_path_cacic + tstrTripa1[intAux] + '\'; - g_oCacic.setCacicPath(v_path_cacic); + g_oCacic.setBoolCipher(true); - v_tstrCipherOpened := TStrings.Create; - v_tstrCipherOpened := CipherOpen(g_oCacic.getDatFileName); - - v_tstrCipherOpened1 := TStrings.Create; - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_comp.dat'); - - Try - Executa_Col_comp; - Except - SetValorDatMemoria('Col_Comp.nada', 'nada', v_tstrCipherOpened1); - CipherClose(g_oCacic.getCacicPath + 'temp\col_comp.dat', v_tstrCipherOpened1); - End; - Halt(0); - End; + if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then + if (ParamCount>0) then + Begin + strAux := ''; + For intAux := 1 to ParamCount do + Begin + if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then + begin + strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); + end; + end; + + if (strAux <> '') then + Begin + g_oCacic.setCacicPath(strAux); + + v_tstrCipherOpened := TStrings.Create; + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); + + v_tstrCipherOpened1 := TStrings.Create; + v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_comp.dat'); + + Try + Executa_Col_comp; + Except + SetValorDatMemoria('Col_Comp.nada', 'nada', v_tstrCipherOpened1); + CipherClose(g_oCacic.getCacicPath + 'temp\col_comp.dat', v_tstrCipherOpened1); + End; + Halt(0); + End; + End; g_oCacic.Free(); end. diff --git a/col_comp/col_comp.res b/col_comp/col_comp.res index 42e982a..5929be9 100755 Binary files a/col_comp/col_comp.res and b/col_comp/col_comp.res differ diff --git a/col_hard/col_hard.dpr b/col_hard/col_hard.dpr index 7e19c8f..5fbb063 100644 --- a/col_hard/col_hard.dpr +++ b/col_hard/col_hard.dpr @@ -39,7 +39,6 @@ uses CACIC_Library in '..\CACIC_Library.pas'; var - v_path_cacic, v_mensagem, v_strCipherClosed : String; v_debugs : boolean; @@ -538,7 +537,7 @@ var v_te_cpu_fabricante, v_registry : TRegistry; begin - g_oCacic := TCACIC.Create(); + Try SetValorDatMemoria('Col_Hard.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); v_Report := TStringList.Create; @@ -955,47 +954,51 @@ begin g_oCacic.Free(); end; +var strAux : String; begin g_oCacic := TCACIC.Create(); + g_oCacic.setBoolCipher(true); + if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then if (ParamCount>0) then - Begin - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini - tstrTripa1 := g_oCacic.explode(ExtractFilePath(ParamStr(0)),'\'); - v_path_cacic := ''; - intAux :=0; - While intAux < tstrTripa1.Count -1 do - begin - v_path_cacic := v_path_cacic + tstrTripa1[intAux] + '\'; - intAux := intAux + 1 - end; - - g_oCacic.setCacicPath(v_path_cacic); - - v_tstrCipherOpened := TStrings.Create; - v_tstrCipherOpened := CipherOpen(g_oCacic.getDatFileName); - - v_tstrCipherOpened1 := TStrings.Create; - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_hard.dat'); - - Try - v_Debugs := false; - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then - Begin - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then - Begin - v_Debugs := true; - log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); - End; - End; - Executa_Col_Hard; - Except - SetValorDatMemoria('Col_Hard.nada', 'nada', v_tstrCipherOpened1); - CipherClose(g_oCacic.getCacicPath + 'temp\col_hard.dat', v_tstrCipherOpened1); - End; - End; + Begin + strAux := ''; + For intAux := 1 to ParamCount do + Begin + if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then + begin + strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); + log_DEBUG('Parâmetro /CacicPath recebido com valor="'+strAux+'"'); + end; + end; - g_oCacic.Free(); + if (strAux <> '') then + Begin + g_oCacic.setCacicPath(strAux); + + v_tstrCipherOpened := TStrings.Create; + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); + + v_tstrCipherOpened1 := TStrings.Create; + v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_hard.dat'); + + Try + v_Debugs := false; + if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then + Begin + if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then + Begin + v_Debugs := true; + log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); + End; + End; + Executa_Col_Hard; + Except + SetValorDatMemoria('Col_Hard.nada', 'nada', v_tstrCipherOpened1); + CipherClose(g_oCacic.getCacicPath + 'temp\col_hard.dat', v_tstrCipherOpened1); + End; + End; + End; end. diff --git a/col_hard/col_hard.res b/col_hard/col_hard.res index c0614fe..bf6555b 100755 Binary files a/col_hard/col_hard.res and b/col_hard/col_hard.res differ diff --git a/col_moni/col_moni.res b/col_moni/col_moni.res index 9f60394..9ed1cdb 100755 Binary files a/col_moni/col_moni.res and b/col_moni/col_moni.res differ diff --git a/col_patr/col_patr.res b/col_patr/col_patr.res index a2f3270..517d043 100755 Binary files a/col_patr/col_patr.res and b/col_patr/col_patr.res differ diff --git a/col_soft/col_soft.res b/col_soft/col_soft.res index 6b0e77b..2eb9ba9 100755 Binary files a/col_soft/col_soft.res and b/col_soft/col_soft.res differ diff --git a/col_undi/col_undi.res b/col_undi/col_undi.res index 346e8e7..e939358 100755 Binary files a/col_undi/col_undi.res and b/col_undi/col_undi.res differ diff --git a/ger_cols/ger_cols.res b/ger_cols/ger_cols.res index ebd33e5..856ffe9 100755 Binary files a/ger_cols/ger_cols.res and b/ger_cols/ger_cols.res differ diff --git a/ini_cols/ini_cols.res b/ini_cols/ini_cols.res index 3762e58..4398f76 100755 Binary files a/ini_cols/ini_cols.res and b/ini_cols/ini_cols.res differ diff --git a/mapa/mapacacic.res b/mapa/mapacacic.res index 3a95136..f5922f2 100755 Binary files a/mapa/mapacacic.res and b/mapa/mapacacic.res differ -- libgit2 0.21.2