Commit 98900483c9b7ca5f35112912f8b3e31e9b7560a3

Authored by anderson.peterle@previdencia.gov.br
1 parent 6b9b0bbe
Exists in master

Contem identificacao dinamica do S.O. da estacao; Correcao de coleta de sistemas…

… monitorados; Inclusao em Informacoes Gerais da sessao Coletas Realizadas nesta Data

git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@142 fecfc0c7-e812-0410-ae72-849f08638ee7
ChangeLog.txt
No preview for this file type
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=9 118 +Build=26
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -124,16 +124,16 @@ DLL=0 @@ -124,16 +124,16 @@ DLL=0
124 Locale=1046 124 Locale=1046
125 CodePage=1252 125 CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 -CompanyName=Dataprev - Escritório do ES 127 +CompanyName=Dataprev - Unidade Regional Espírito Santo
128 FileDescription=Configurador Automático e Coletor de Informações Computacionais 128 FileDescription=Configurador Automático e Coletor de Informações Computacionais
129 -FileVersion=2.2.0.9 129 +FileVersion=2.2.0.26
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=2.0.0.0  
136 -Comments= 134 +ProductName=Cacic - Agente Principal
  135 +ProductVersion=2.2.0.26
  136 +Comments=Baseado na licença GPL (General Public License)
137 [HistoryLists\hlUnitAliases] 137 [HistoryLists\hlUnitAliases]
138 Count=1 138 Count=1
139 Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; 139 Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
cacic2.res
No preview for this file type
chkcacic/chkcacic.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=17 118 +Build=24
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -124,16 +124,16 @@ DLL=0 @@ -124,16 +124,16 @@ DLL=0
124 Locale=2070 124 Locale=2070
125 CodePage=1252 125 CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 -CompanyName=Dataprev-ES  
128 -FileDescription=  
129 -FileVersion=2.2.0.17 127 +CompanyName=Dataprev - Unidade Regional Espírito Santo (URES)
  128 +FileDescription=Módulo Verificador/Instalador dos Agentes Principais para o Sistema CACIC
  129 +FileVersion=2.2.0.24
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=1.0.0.0  
136 -Comments=Verificador/Instalador dos Agentes Principais para o Sistema CACIC 134 +ProductName=ChkCACIC
  135 +ProductVersion=2.2.0.24
  136 +Comments=Baseado na licença GPL (General Public License)
137 [HistoryLists\hlUnitAliases] 137 [HistoryLists\hlUnitAliases]
138 Count=1 138 Count=1
139 Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; 139 Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
chkcacic/chkcacic.res
No preview for this file type
chkcacic/main.dcu
No preview for this file type
chkcacic/main.pas
@@ -17,6 +17,18 @@ Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -17,6 +17,18 @@ Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 ===================================================================================================== 17 =====================================================================================================
18 ChkCacic.exe : Verificador/Instalador dos agentes principais Cacic2.exe e Ger_Cols.exe 18 ChkCacic.exe : Verificador/Instalador dos agentes principais Cacic2.exe e Ger_Cols.exe
19 ===================================================================================================== 19 =====================================================================================================
  20 +
  21 +v 2.2.0.17
  22 ++ Acrescentado o tratamento da passagem de opções em linha de comando
  23 + * chkcacic /serv=<ip_server> /dir=<local_path>c:\%windir%\cacic
  24 + Exemplo de uso: chkcacic /serv=UXbra001 /dir=Cacic
  25 +
  26 +v 2.2.0.16
  27 +* Corrigido o fechamento do arquivo de configurações de ChkSis
  28 +
  29 +v 2.2.0.15
  30 +* Substituída a mensagem "File System diferente de "NTFS" por 'File System: "<NomeFileSystem>" - Ok!'
  31 +
20 v 2.2.0.14 32 v 2.2.0.14
21 + Críticas/mensagens: 33 + Críticas/mensagens:
22 "ATENÇÃO! Não foi possível estabelecer comunicação com o módulo Gerente WEB em <servidor>." e 34 "ATENÇÃO! Não foi possível estabelecer comunicação com o módulo Gerente WEB em <servidor>." e
@@ -49,7 +61,6 @@ uses Windows, @@ -49,7 +61,6 @@ uses Windows,
49 XML, 61 XML,
50 LibXmlParser, 62 LibXmlParser,
51 IdHTTP, 63 IdHTTP,
52 - dialogs,  
53 PJVersionInfo, 64 PJVersionInfo,
54 Controls, 65 Controls,
55 StdCtrls, 66 StdCtrls,
@@ -62,7 +73,8 @@ uses Windows, @@ -62,7 +73,8 @@ uses Windows,
62 DCPrijndael, 73 DCPrijndael,
63 DCPbase64, 74 DCPbase64,
64 NTFileSecurity, IdFTP, 75 NTFileSecurity, IdFTP,
65 - Tlhelp32; 76 + Tlhelp32,
  77 + dialogs;
66 78
67 var v_ip_serv_cacic, 79 var v_ip_serv_cacic,
68 v_cacic_dir, 80 v_cacic_dir,
@@ -72,14 +84,20 @@ var v_ip_serv_cacic, @@ -72,14 +84,20 @@ var v_ip_serv_cacic,
72 v_te_instala_informacoes_extras, 84 v_te_instala_informacoes_extras,
73 v_exibe_informacoes, 85 v_exibe_informacoes,
74 v_versao_local, 86 v_versao_local,
75 - v_versao_remota_inteira,  
76 - v_versao_remota_capada, 87 + v_versao_remota,
77 v_CipherKey, 88 v_CipherKey,
78 v_SeparatorKey, 89 v_SeparatorKey,
79 v_IV, 90 v_IV,
80 v_strCipherClosed, 91 v_strCipherClosed,
81 v_strCipherOpened, 92 v_strCipherOpened,
82 - v_DatFileName : String; 93 + v_DatFileName,
  94 + v_retorno,
  95 + v_versao_REM,
  96 + v_versao_LOC,
  97 + v_te_so : String;
  98 +
  99 + intWinVer : integer;
  100 + v_Debugs : boolean;
83 101
84 var v_tstrCipherOpened : TStrings; 102 var v_tstrCipherOpened : TStrings;
85 103
@@ -99,23 +117,29 @@ Procedure MostraFormConfigura; @@ -99,23 +117,29 @@ Procedure MostraFormConfigura;
99 Procedure GravaConfiguracoes; 117 Procedure GravaConfiguracoes;
100 Procedure DelValorReg(Chave: String); 118 Procedure DelValorReg(Chave: String);
101 procedure log_diario(strMsg : String); 119 procedure log_diario(strMsg : String);
  120 +procedure log_DEBUG(p_msg:string);
  121 +procedure KillProcess(hWindowHandle: HWND); // 2.2.0.15
  122 +procedure Matar(v_dir,v_files: string); // 2.2.0.16
  123 +procedure GravaIni(strFullPath : STring);
102 Function ListFileDir(Path: string):string; 124 Function ListFileDir(Path: string):string;
103 Function FTP(p_Host : String; p_Port : String; p_Username : String; p_Password : String; p_PathServer : String; p_File : String; p_Dest : String) : Boolean; 125 Function FTP(p_Host : String; p_Port : String; p_Username : String; p_Password : String; p_PathServer : String; p_File : String; p_Dest : String) : Boolean;
104 Function Explode(Texto, Separador : String) : TStrings; 126 Function Explode(Texto, Separador : String) : TStrings;
105 Function GetRootKey(strRootKey: String): HKEY; 127 Function GetRootKey(strRootKey: String): HKEY;
106 Function SetValorChaveRegEdit(Chave: String; Dado: Variant): Variant; 128 Function SetValorChaveRegEdit(Chave: String; Dado: Variant): Variant;
107 Function GetValorChaveRegEdit(Chave: String): Variant; 129 Function GetValorChaveRegEdit(Chave: String): Variant;
108 -function SetValorChaveRegIni(p_Secao, p_Chave, p_Valor, p_File : String): String;  
109 -function GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String;  
110 -function HomeDrive : string; 130 +Function SetValorChaveRegIni(p_Secao, p_Chave, p_Valor, p_File : String): String;
  131 +Function GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String;
  132 +Function HomeDrive : string;
111 Function RemoveCaracteresEspeciais(Texto : String) : String; 133 Function RemoveCaracteresEspeciais(Texto : String) : String;
112 -function FindWindowByTitle(WindowTitle: string): Hwnd;  
113 -function GetVersionInfo(p_File: string):string;  
114 -function VerFmt(const MS, LS: DWORD): string;  
115 -function GetWinVer: Integer;  
116 -function KillTask(ExeFileName: string): Integer;  
117 -procedure KillProcess(hWindowHandle: HWND);  
118 - 134 +Function FindWindowByTitle(WindowTitle: string): Hwnd;
  135 +Function GetVersionInfo(p_File: string):string;
  136 +Function VerFmt(const MS, LS: DWORD): string;
  137 +Function GetWinVer: Integer;
  138 +Function KillTask(ExeFileName: string): Integer;
  139 +Function ChecaVersoesAgentes(p_strNomeAgente : String) : integer; // 2.2.0.16
  140 +function Posso_Rodar_CACIC : boolean;
  141 +function GetFolderDate(Folder: string): TDateTime;
  142 +function abstraiCSD(p_te_so : String) : integer;
119 type 143 type
120 TForm1 = class(TForm) 144 TForm1 = class(TForm)
121 PJVersionInfo1: TPJVersionInfo; 145 PJVersionInfo1: TPJVersionInfo;
@@ -134,6 +158,7 @@ implementation @@ -134,6 +158,7 @@ implementation
134 uses FormConfig; 158 uses FormConfig;
135 159
136 {$R *.dfm} 160 {$R *.dfm}
  161 +
137 function IsAdmin: Boolean; 162 function IsAdmin: Boolean;
138 var hAccessToken: THandle; 163 var hAccessToken: THandle;
139 ptgGroups: PTokenGroups; 164 ptgGroups: PTokenGroups;
@@ -201,6 +226,15 @@ begin @@ -201,6 +226,15 @@ begin
201 end; 226 end;
202 end; 227 end;
203 228
  229 +procedure log_DEBUG(p_msg:string);
  230 +Begin
  231 + if v_Debugs then
  232 + Begin
  233 + ShowMessage('DEBUG - '+p_msg);
  234 + log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg);
  235 + End;
  236 +End;
  237 +
204 // Pad a string with zeros so that it is a multiple of size 238 // Pad a string with zeros so that it is a multiple of size
205 function PadWithZeros(const str : string; size : integer) : string; 239 function PadWithZeros(const str : string; size : integer) : string;
206 var 240 var
@@ -350,7 +384,7 @@ begin @@ -350,7 +384,7 @@ begin
350 if (trim(v_strCipherOpened)<>'') then 384 if (trim(v_strCipherOpened)<>'') then
351 Result := explode(v_strCipherOpened,v_SeparatorKey) 385 Result := explode(v_strCipherOpened,v_SeparatorKey)
352 else 386 else
353 - Result := explode('Configs.ID_SO'+v_SeparatorKey+inttostr(GetWinVer)+v_SeparatorKey+'Configs.Endereco_WS'+v_SeparatorKey+'/cacic2/ws/',v_SeparatorKey); 387 + Result := explode('Configs.ID_SO'+v_SeparatorKey+inttostr(intWinVer)+v_SeparatorKey+'Configs.Endereco_WS'+v_SeparatorKey+'/cacic2/ws/',v_SeparatorKey);
354 388
355 389
356 if Result.Count mod 2 <> 0 then 390 if Result.Count mod 2 <> 0 then
@@ -360,7 +394,7 @@ end; @@ -360,7 +394,7 @@ end;
360 394
361 Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String); 395 Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String);
362 begin 396 begin
363 - log_diario('Setando Chave "'+p_Chave+'" com "'+p_Valor+'"'); 397 + log_DEBUG('Setando Chave "'+p_Chave+'" com "'+p_Valor+'"');
364 // Exemplo: p_Chave => Configs.nu_ip_servidor : p_Valor => 10.71.0.120 398 // Exemplo: p_Chave => Configs.nu_ip_servidor : p_Valor => 10.71.0.120
365 if (v_tstrCipherOpened.IndexOf(p_Chave)<>-1) then 399 if (v_tstrCipherOpened.IndexOf(p_Chave)<>-1) then
366 v_tstrCipherOpened[v_tstrCipherOpened.IndexOf(p_Chave)+1] := p_Valor 400 v_tstrCipherOpened[v_tstrCipherOpened.IndexOf(p_Chave)+1] := p_Valor
@@ -402,15 +436,21 @@ const @@ -402,15 +436,21 @@ const
402 cOsServer2003 = 13; 436 cOsServer2003 = 13;
403 var 437 var
404 osVerInfo: TOSVersionInfo; 438 osVerInfo: TOSVersionInfo;
405 - majorVer, minorVer: Integer; 439 + platformID,
  440 + majorVer,
  441 + minorVer: Integer;
  442 + CSDVersion : String;
406 begin 443 begin
407 Result := cOsUnknown; 444 Result := cOsUnknown;
408 { set operating system type flag } 445 { set operating system type flag }
409 osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); 446 osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
410 if GetVersionEx(osVerInfo) then 447 if GetVersionEx(osVerInfo) then
411 begin 448 begin
412 - majorVer := osVerInfo.dwMajorVersion;  
413 - minorVer := osVerInfo.dwMinorVersion; 449 + platformId := osVerInfo.dwPlatformId;
  450 + majorVer := osVerInfo.dwMajorVersion;
  451 + minorVer := osVerInfo.dwMinorVersion;
  452 + CSDVersion := trim(osVerInfo.szCSDVersion);
  453 +
414 case osVerInfo.dwPlatformId of 454 case osVerInfo.dwPlatformId of
415 VER_PLATFORM_WIN32_NT: { Windows NT/2000 } 455 VER_PLATFORM_WIN32_NT: { Windows NT/2000 }
416 begin 456 begin
@@ -447,9 +487,25 @@ begin @@ -447,9 +487,25 @@ begin
447 end 487 end
448 else 488 else
449 Result := cOsUnknown; 489 Result := cOsUnknown;
450 -end;  
451 490
  491 + // A partir da versão 2.2.0.24, defino o valor da ID Interna e atribuo-a sem o CSDVersion à versão externa
  492 + v_te_so := IntToStr(platformId) + '.' +
  493 + IntToStr(majorVer) + '.' +
  494 + IntToStr(minorVer) +
  495 + IfThen(CSDVersion='','','.'+CSDVersion);
  496 + if (Result = 0) then
  497 + Result := abstraiCSD(v_te_so);
452 498
  499 + log_DEBUG('GetWinVer => ID_interna: '+ v_te_so + ' ID_Externa: ' + IntToStr(Result));
  500 +end;
  501 +
  502 +function abstraiCSD(p_te_so : String) : integer;
  503 + var tstrTe_so : tstrings;
  504 + Begin
  505 + tstrTe_so := Explode(p_te_so, '.');
  506 + Result := StrToInt(tstrTe_so[0] + tstrTe_so[1] + tstrTe_so[2]);
  507 + log_DEBUG('abstraiCSD=> '+ tstrTe_so[0] + tstrTe_so[1] + tstrTe_so[2]);
  508 + End;
453 509
454 function GetVersionInfo(p_File: string):string; 510 function GetVersionInfo(p_File: string):string;
455 begin 511 begin
@@ -511,6 +567,7 @@ begin @@ -511,6 +567,7 @@ begin
511 end; 567 end;
512 ListaAuxSet.Free; 568 ListaAuxSet.Free;
513 RegEditSet.Free; 569 RegEditSet.Free;
  570 + log_DEBUG('Setando valor "'+Dado+'" para chave "'+Chave+'"');
514 end; 571 end;
515 572
516 Function RemoveCaracteresEspeciais(Texto : String) : String; 573 Function RemoveCaracteresEspeciais(Texto : String) : String;
@@ -648,7 +705,7 @@ end; @@ -648,7 +705,7 @@ end;
648 Procedure CriaFormConfigura; 705 Procedure CriaFormConfigura;
649 begin 706 begin
650 Application.CreateForm(TConfigs, FormConfig.Configs); 707 Application.CreateForm(TConfigs, FormConfig.Configs);
651 - FormConfig.Configs.Label2.Caption := 'v: ' + getVersionInfo(ParamStr(0)); 708 + FormConfig.Configs.lbVersao.Caption := 'v: ' + getVersionInfo(ParamStr(0));
652 end; 709 end;
653 710
654 Procedure MostraFormConfigura; 711 Procedure MostraFormConfigura;
@@ -685,32 +742,54 @@ Begin @@ -685,32 +742,54 @@ Begin
685 Explode := ListaAuxUTILS; 742 Explode := ListaAuxUTILS;
686 end; 743 end;
687 744
688 -  
689 Function FTP(p_Host : String; p_Port : String; p_Username : String; p_Password : String; p_PathServer : String; p_File : String; p_Dest : String) : Boolean; 745 Function FTP(p_Host : String; p_Port : String; p_Username : String; p_Password : String; p_PathServer : String; p_File : String; p_Dest : String) : Boolean;
690 var IdFTP : TIdFTP; 746 var IdFTP : TIdFTP;
691 begin 747 begin
692 Try 748 Try
693 - IdFTP := TIdFTP.Create(IdFTP); 749 + Log_Debug('FTP: Criando instance');
  750 + IdFTP := TIdFTP.Create(nil);
  751 +
  752 + Log_Debug('FTP: Host => "'+p_Host+'"');
694 IdFTP.Host := p_Host; 753 IdFTP.Host := p_Host;
  754 +
  755 + Log_Debug('FTP: UserName => "'+p_Username+'"');
695 IdFTP.Username := p_Username; 756 IdFTP.Username := p_Username;
  757 +
  758 + Log_Debug('FTP: PassWord => "'+p_Password+'"');
696 IdFTP.Password := p_Password; 759 IdFTP.Password := p_Password;
  760 +
  761 + Log_Debug('FTP: PathServer => "'+p_PathServer+'"');
697 IdFTP.Port := strtoint(p_Port); 762 IdFTP.Port := strtoint(p_Port);
  763 +
  764 + Log_Debug('FTP: Setando TransferType para "ftBinary"');
698 IdFTP.TransferType := ftBinary; 765 IdFTP.TransferType := ftBinary;
  766 +
  767 + Log_Debug('FTP: Change to "'+p_PathServer+'"');
699 Try 768 Try
700 if IdFTP.Connected = true then 769 if IdFTP.Connected = true then
701 begin 770 begin
  771 + Log_Debug('FTP: Connected => Desconectando...');
702 IdFTP.Disconnect; 772 IdFTP.Disconnect;
703 end; 773 end;
  774 + Log_Debug('FTP: Efetuando Conexão...');
704 IdFTP.Connect(true); 775 IdFTP.Connect(true);
  776 + Log_Debug('FTP: Change to "'+p_PathServer+'"');
705 IdFTP.ChangeDir(p_PathServer); 777 IdFTP.ChangeDir(p_PathServer);
706 Try 778 Try
  779 + Log_Debug('Iniciando FTP de "'+p_Dest + '\' + p_File+'"');
707 IdFTP.Get(p_File, p_Dest + '\' + p_File, True); 780 IdFTP.Get(p_File, p_Dest + '\' + p_File, True);
708 result := true; 781 result := true;
709 Except 782 Except
710 - result := false; 783 + Begin
  784 + Log_Debug('Oops! Problemas Após Início de Operação...');
  785 + result := false;
  786 + end;
711 End; 787 End;
712 Except 788 Except
  789 + Begin
  790 + Log_Debug('Oops! Problemas Sem Início de Operação...');
713 result := false; 791 result := false;
  792 + End;
714 end; 793 end;
715 Except 794 Except
716 result := false; 795 result := false;
@@ -831,6 +910,23 @@ begin @@ -831,6 +910,23 @@ begin
831 end; 910 end;
832 end; 911 end;
833 912
  913 +procedure GravaIni(strFullPath : STring);
  914 +var iniFile : TextFile;
  915 +begin
  916 + try
  917 + FileSetAttr (strFullPath,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
  918 + AssignFile(iniFile,strFullPath); {Associa o arquivo a uma variável do tipo TextFile}
  919 + Rewrite (iniFile); // Recria o arquivo...
  920 + Append(iniFile);
  921 + Writeln(iniFile,'');
  922 + Writeln(iniFile,'[Cacic2]');
  923 + Writeln(iniFile,'ip_serv_cacic='+v_ip_serv_cacic);
  924 + Writeln(iniFile,'cacic_dir='+v_cacic_dir);
  925 + CloseFile(iniFile); {Fecha o arquivo texto}
  926 + except
  927 + end;
  928 +end;
  929 +
834 Function ListFileDir(Path: string):string; 930 Function ListFileDir(Path: string):string;
835 var 931 var
836 SR: TSearchRec; 932 SR: TSearchRec;
@@ -851,19 +947,20 @@ begin @@ -851,19 +947,20 @@ begin
851 end; 947 end;
852 procedure LiberaFireWall(p_objeto:string); 948 procedure LiberaFireWall(p_objeto:string);
853 begin 949 begin
  950 + log_DEBUG('Rotina para Liberação de FireWall...');
854 Try 951 Try
855 if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then 952 if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then
856 Begin 953 Begin
857 SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto); 954 SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto);
858 - log_diario('Liberação de FireWall para "'+p_objeto+'" efetivada!');  
859 End 955 End
860 - else log_diario('Liberação de FireWall para "'+p_objeto+'" já existente.'); 956 + else log_DEBUG('Exceção para "'+p_objeto+'" já existente.');
861 Except 957 Except
862 - log_diario('Problema Liberando FireWall para "'+p_objeto+'"!'); 958 + log_DEBUG('Problema adicionando "'+p_objeto+'" à lista de exceções do FireWall!');
863 End; 959 End;
864 960
865 end; 961 end;
866 962
  963 +{
867 // Dica obtida em http://www.webmundi.com/delphi/dfuncaof.asp?SubTipo=Sistema 964 // Dica obtida em http://www.webmundi.com/delphi/dfuncaof.asp?SubTipo=Sistema
868 Function DriveType(Unidade: String):String; 965 Function DriveType(Unidade: String):String;
869 Var StrDrive, 966 Var StrDrive,
@@ -886,12 +983,192 @@ begin @@ -886,12 +983,192 @@ begin
886 end; 983 end;
887 Result := StrDriveType; 984 Result := StrDriveType;
888 End; 985 End;
  986 +}
  987 +
  988 +Function ChecaVersoesAgentes(p_strNomeAgente : String) : integer; // 2.2.0.16
  989 +var strNomeAgente : String;
  990 + v_array_NomeAgente : TStrings;
  991 + intAux : integer;
  992 +Begin
  993 + v_array_NomeAgente := explode(p_strNomeAgente,'\');
  994 +
  995 + v_versao_REM := XML_RetornaValor(StringReplace(StrUpper(PChar(v_array_NomeAgente[v_array_NomeAgente.count-1])),'.EXE','',[rfReplaceAll]), v_retorno);
  996 + v_versao_LOC := GetVersionInfo(p_strNomeAgente);
  997 +
  998 + log_DEBUG('Checando versão de "'+p_strNomeAgente+'"');
  999 +
  1000 + intAux := v_array_NomeAgente.Count;
  1001 +
  1002 + // V: 2.2.0.16
  1003 + // Verifico existência do arquivo "versoes_agentes.ini" para comparação das versões dos agentes principais
  1004 + if (v_versao_REM = '') AND FileExists(ExtractFilePath(Application.Exename)+'versoes_agentes.ini') then
  1005 + Begin
  1006 + if (GetValorChaveRegIni('versoes_agentes',v_array_NomeAgente[intAux-1],ExtractFilePath(Application.Exename)+'versoes_agentes.ini')<>'') then
  1007 + Begin
  1008 + log_DEBUG('Encontrado arquivo "'+(ExtractFilePath(Application.Exename)+'versoes_agentes.ini')+'"');
  1009 + v_versao_REM := GetValorChaveRegIni('versoes_agentes',v_array_NomeAgente[intAux-1],ExtractFilePath(Application.Exename)+'versoes_agentes.ini');
  1010 + End;
  1011 + End;
  1012 +
  1013 + log_DEBUG('Versão Remota: "'+v_versao_REM+'" - Versão Local: "'+v_versao_LOC+'"');
  1014 +
  1015 + if (v_versao_REM + v_versao_LOC <> '') and
  1016 + (v_versao_LOC <> '0000') then
  1017 + Begin
  1018 + if (v_versao_REM = v_versao_LOC) then
  1019 + Result := 1
  1020 + else
  1021 + Result := 2;
  1022 + End
  1023 + else
  1024 + Result := 0;
  1025 +End;
  1026 +
  1027 +// Dica baixada de http://procedure.blig.ig.com.br/
  1028 +// Adaptada por Anderson Peterle - v:2.2.0.16 - 03/2007
  1029 +procedure Matar(v_dir,v_files: string);
  1030 +var SearchRec: TSearchRec;
  1031 + Result: Integer;
  1032 + strFileName : String;
  1033 +begin
  1034 + strFileName := StringReplace(v_dir + '\' + v_files,'\\','\',[rfReplaceAll]);
  1035 + Result:=FindFirst(strFileName, faAnyFile, SearchRec);
  1036 +
  1037 + while result=0 do
  1038 + begin
  1039 + strFileName := StringReplace(v_dir + '\' + SearchRec.Name,'\\','\',[rfReplaceAll]);
  1040 + log_DEBUG('Tentando Excluir: '+strFileName);
  1041 + if DeleteFile(strFileName) then
  1042 + log_DEBUG('Exclusão de ' + strFileName + ' efetuada com sucesso!')
  1043 + else
  1044 + Begin
  1045 + log_DEBUG('Exclusão não efetuada! Provavelmente já esteja sendo executado...');
  1046 + log_DEBUG('Tentarei finalizar Tarefa/Processo...');
  1047 + if ((intWinVer <> 0) and (intWinVer <= 5)) or
  1048 + (abstraiCSD(v_te_so) < 250) then // Menor que NT Like
  1049 + KillTask(SearchRec.Name)
  1050 + else
  1051 + KillProcess(FindWindow(PChar(SearchRec.Name),nil));
  1052 +
  1053 + if DeleteFile(strFileName) then
  1054 + log_DEBUG('Exclusão Impossibilitada de ' + strFileName + '!');
  1055 + End;
  1056 +
  1057 + Result:=FindNext(SearchRec);
  1058 + end;
  1059 +end;
  1060 +
  1061 +function Posso_Rodar_CACIC : boolean;
  1062 +Begin
  1063 + result := false;
  1064 +
  1065 + // Se o aguarde_CACIC.txt existir é porque refere-se a uma versão mais atual: 2.2.0.20 ou maior
  1066 + if (FileExists(v_cacic_dir + 'aguarde_CACIC.txt')) then
  1067 + Begin
  1068 + // Se eu conseguir matar o arquivo abaixo é porque não há outra sessão deste agente aberta... (POG? Nããão! :) )
  1069 + Matar(v_cacic_dir,'aguarde_CACIC.txt');
  1070 + if (not (FileExists(v_cacic_dir + 'aguarde_CACIC.txt'))) then
  1071 + result := true;
  1072 + End;
  1073 +End;
  1074 +function GetFolderDate(Folder: string): TDateTime;
  1075 +var
  1076 + Rec: TSearchRec;
  1077 + Found: Integer;
  1078 + Date: TDateTime;
  1079 +begin
  1080 + if Folder[Length(folder)] = '\' then
  1081 + Delete(Folder, Length(folder), 1);
  1082 + Result := 0;
  1083 + Found := FindFirst(Folder, faDirectory, Rec);
  1084 + try
  1085 + if Found = 0 then
  1086 + begin
  1087 + Date := FileDateToDateTime(Rec.Time);
  1088 + Result := Date;
  1089 + end;
  1090 + finally
  1091 + FindClose(Rec);
  1092 + end;
  1093 +end;
  1094 +
  1095 +function Get_File_Size(sFileToExamine: string): integer;
  1096 +var
  1097 + SearchRec: TSearchRec;
  1098 + sgPath: string;
  1099 + inRetval, I1: Integer;
  1100 +begin
  1101 + sgPath := ExpandFileName(sFileToExamine);
  1102 + try
  1103 + inRetval := FindFirst(ExpandFileName(sFileToExamine), faAnyFile, SearchRec);
  1104 + if inRetval = 0 then
  1105 + I1 := SearchRec.Size
  1106 + else
  1107 + I1 := -1;
  1108 + finally
  1109 + SysUtils.FindClose(SearchRec);
  1110 + end;
  1111 + Result := I1;
  1112 +end;
  1113 +
  1114 +procedure verifyAndGet(strModuleName,
  1115 + strDestinationFolderName,
  1116 + strServUpdates,
  1117 + strPortaServUpdates,
  1118 + strNomeUsuarioLoginServUpdates,
  1119 + strSenhaLoginServUpdates,
  1120 + strPathServUpdates,
  1121 + strExibeInformacoes : String);
  1122 + var intFileSize : integer;
  1123 + Begin
  1124 +
  1125 + // Verifico validade do Módulo e mato-o em caso negativo.
  1126 + intFileSize := Get_File_Size(strDestinationFolderName + '\'+strModuleName);
  1127 +
  1128 + log_DEBUG('verifyAndGet - intFileSize de "'+strDestinationFolderName + '\'+strModuleName+'": ' + IntToStr(intFileSize));
  1129 +
  1130 + If (intFileSize <= 0) then
  1131 + Matar(strDestinationFolderName, strModuleName);
  1132 +
  1133 + If not FileExists(strDestinationFolderName + '\'+strModuleName) Then
  1134 + Begin
  1135 + if (FileExists(ExtractFilePath(Application.Exename) + '\modulos\'+strModuleName)) then
  1136 + Begin
  1137 + log_diario('Copiando '+strModuleName+' de '+ExtractFilePath(Application.Exename)+'modulos\');
  1138 + CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\'+strModuleName), PChar(strDestinationFolderName + '\'+strModuleName),false);
  1139 + FileSetAttr (PChar(strDestinationFolderName + '\' + strModuleName),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED
  1140 + End
  1141 + else
  1142 + begin
  1143 + Try
  1144 + if not FTP(strServUpdates,
  1145 + strPortaServUpdates,
  1146 + strNomeUsuarioLoginServUpdates,
  1147 + strSenhaLoginServUpdates,
  1148 + strPathServUpdates,
  1149 + strModuleName,
  1150 + strDestinationFolderName) and (strExibeInformacoes = 'S') then
  1151 + MessageDLG(#13#10+'ATENÇÃO! Não foi possível efetuar FTP para "'+strDestinationFolderName + '\'+strModuleName+'".'+#13#10+'Verifique o Servidor de Updates.',mtError,[mbOK],0);
  1152 + Except
  1153 + log_DEBUG('FTP de "'+ strDestinationFolderName + '\' + strModuleName+'" Interrompido.');
  1154 + End;
  1155 +
  1156 + if not FileExists(strDestinationFolderName + '\' + strModuleName) Then
  1157 + Begin
  1158 + log_DEBUG('Problemas Efetuando Download de '+ strDestinationFolderName + '\' + strModuleName+' (FTP)');
  1159 + log_DEBUG('Conexão:');
  1160 + log_DEBUG(strServUpdates+', '+strPortaServUpdates+', '+strNomeUsuarioLoginServUpdates+', '+strSenhaLoginServUpdates+', '+strPathServUpdates);
  1161 + End
  1162 + else
  1163 + log_diario('Download Concluído de "'+strModuleName+'" (FTP)');
  1164 + end;
  1165 + End;
  1166 + End;
889 1167
890 procedure chkcacic; 1168 procedure chkcacic;
891 -var bool_download_CACIC2,  
892 - bool_download_GER_COLS,  
893 - bool_configura,  
894 - bool_ExistsAutoRun : boolean; 1169 +var bool_configura,
  1170 + bool_ExistsAutoRun,
  1171 + bool_CommandLine : boolean;
895 1172
896 v_te_serv_updates, 1173 v_te_serv_updates,
897 v_nu_porta_serv_updates, 1174 v_nu_porta_serv_updates,
@@ -900,37 +1177,87 @@ var bool_download_CACIC2, @@ -900,37 +1177,87 @@ var bool_download_CACIC2,
900 v_te_path_serv_updates, 1177 v_te_path_serv_updates,
901 v_te_texto_janela_instalacao, 1178 v_te_texto_janela_instalacao,
902 v_modulos, 1179 v_modulos,
903 - v_retorno,  
904 - strAux : String; 1180 + strAux,
  1181 + strDataHoraCACIC2_INI,
  1182 + strDataHoraGERCOLS_INI,
  1183 + strDataHoraCACIC2_FIM,
  1184 + strDataHoraGERCOLS_FIM : String;
905 1185
906 Request_Config : TStringList; 1186 Request_Config : TStringList;
907 v_array_modulos : TStrings; 1187 v_array_modulos : TStrings;
908 Response_Config : TStringStream; 1188 Response_Config : TStringStream;
909 IdHTTP1: TIdHTTP; 1189 IdHTTP1: TIdHTTP;
  1190 + intDownload_CACIC2,
  1191 + intDownload_GER_COLS,
910 intAux : integer; 1192 intAux : integer;
911 begin 1193 begin
  1194 + strDataHoraCACIC2_INI := '';
  1195 + strDataHoraCACIC2_FIM := '';
  1196 + strDataHoraGERCOLS_INI := '';
  1197 + strDataHoraGERCOLS_FIM := '';
912 v_te_instala_frase_sucesso := 'INSTALAÇÃO/ATUALIZAÇÃO EFETUADA COM SUCESSO!'; 1198 v_te_instala_frase_sucesso := 'INSTALAÇÃO/ATUALIZAÇÃO EFETUADA COM SUCESSO!';
913 v_te_instala_frase_insucesso := '***** INSTALAÇÃO/ATUALIZAÇÃO NÃO EFETUADA COM SUCESSO *****'; 1199 v_te_instala_frase_insucesso := '***** INSTALAÇÃO/ATUALIZAÇÃO NÃO EFETUADA COM SUCESSO *****';
  1200 + bool_CommandLine := false;
914 1201
915 Try 1202 Try
916 v_home_drive := MidStr(HomeDrive,1,3); //x:\ 1203 v_home_drive := MidStr(HomeDrive,1,3); //x:\
917 - If not (FileExists(ExtractFilePath(Application.Exename) + '\chkcacic.ini')) then  
918 - Begin  
919 - log_diario('Abrindo formulário de configurações');  
920 - CriaFormConfigura;  
921 - MostraFormConfigura;  
922 - End;  
923 1204
924 - bool_download_CACIC2 := false;  
925 - bool_download_GER_COLS := false;  
926 - v_ip_serv_cacic := GetValorChaveRegIni('Cacic2', 'ip_serv_cacic' , ExtractFilePath(Application.Exename) + '\chkcacic.ini');  
927 - v_cacic_dir := GetValorChaveRegIni('Cacic2', 'cacic_dir' , ExtractFilePath(Application.Exename) + '\chkcacic.ini');  
928 - v_exibe_informacoes := GetValorChaveRegIni('Cacic2', 'exibe_informacoes', ExtractFilePath(Application.Exename) + '\chkcacic.ini');  
929 - v_te_instala_informacoes_extras := StringReplace(GetValorChaveRegIni('Cacic2', 'te_instala_informacoes_extras', ExtractFilePath(Application.Exename) + '\chkcacic.ini'),'*13*10',#13#10,[rfReplaceAll]); 1205 + // 2.2.0.17 - Tratamento de opções passadas em linha de comando
  1206 + // Grande dica do grande Cláudio Filho (OpenOffice.org)
  1207 + if (ParamCount > 0) then
  1208 + Begin
  1209 + For intAux := 1 to ParamCount do
  1210 + Begin
  1211 + if LowerCase(Copy(ParamStr(intAux),1,6)) = '/serv=' then
  1212 + begin
  1213 + strAux := Trim(Copy(ParamStr(intAux),7,Length((ParamStr(intAux)))));
  1214 + v_ip_serv_cacic := Trim(Copy(strAux,0,Pos('/', strAux) - 1));
  1215 + If v_ip_serv_cacic = '' Then v_ip_serv_cacic := strAux;
  1216 + end;
  1217 + if LowerCase(Copy(ParamStr(intAux),1,5)) = '/dir=' then
  1218 + begin
  1219 + strAux := Trim(Copy(ParamStr(intAux),6,Length((ParamStr(intAux)))));
  1220 + v_cacic_dir := Trim(Copy(strAux,0,Pos('/', strAux) - 1));
  1221 + If v_cacic_dir = '' Then v_cacic_dir := strAux;
  1222 + end;
  1223 +
  1224 + end;
  1225 + if not(v_ip_serv_cacic='') and
  1226 + not(v_cacic_dir='')then
  1227 + bool_CommandLine := true;
  1228 + End;
  1229 +
  1230 + if not bool_CommandLine then
  1231 + Begin
  1232 + If not (FileExists(ExtractFilePath(Application.Exename) + '\chkcacic.ini')) then
  1233 + Begin
  1234 + log_diario('Abrindo formulário de configurações');
  1235 + CriaFormConfigura;
  1236 + MostraFormConfigura;
  1237 + End;
  1238 +
  1239 + v_ip_serv_cacic := GetValorChaveRegIni('Cacic2', 'ip_serv_cacic' , ExtractFilePath(Application.Exename) + '\chkcacic.ini');
  1240 + v_cacic_dir := GetValorChaveRegIni('Cacic2', 'cacic_dir' , ExtractFilePath(Application.Exename) + '\chkcacic.ini');
  1241 + v_exibe_informacoes := GetValorChaveRegIni('Cacic2', 'exibe_informacoes', ExtractFilePath(Application.Exename) + '\chkcacic.ini');
  1242 + v_te_instala_informacoes_extras := StringReplace(GetValorChaveRegIni('Cacic2', 'te_instala_informacoes_extras', ExtractFilePath(Application.Exename) + '\chkcacic.ini'),'*13*10',#13#10,[rfReplaceAll]);
  1243 + End;
  1244 +
930 Dir := v_home_drive + v_cacic_dir; // Ex.: c:\cacic\ 1245 Dir := v_home_drive + v_cacic_dir; // Ex.: c:\cacic\
931 1246
  1247 + if DirectoryExists(Dir + '\Temp\Debugs') then
  1248 + Begin
  1249 + if (FormatDateTime('ddmmyyyy', GetFolderDate(Dir + '\Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then
  1250 + Begin
  1251 + v_Debugs := true;
  1252 + log_DEBUG('Pasta "' + Dir + '\Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(Dir + '\Temp\Debugs'))+' encontrada. DEBUG ativado.');
  1253 + End;
  1254 + End;
  1255 +
  1256 + intWinVer := GetWinVer;
  1257 +
932 // Verifico se o S.O. é NT Like e se o Usuário está com privilégio administrativo... 1258 // Verifico se o S.O. é NT Like e se o Usuário está com privilégio administrativo...
933 - if (GetWinVer >= 6) and 1259 + if (((intWinVer <> 0) and (intWinVer >= 6)) or
  1260 + (abstraiCSD(v_te_so) >= 250)) and
934 (v_exibe_informacoes = 'S') and 1261 (v_exibe_informacoes = 'S') and
935 not IsAdmin then // Se NT/2000/XP/... 1262 not IsAdmin then // Se NT/2000/XP/...
936 Begin 1263 Begin
@@ -938,13 +1265,13 @@ begin @@ -938,13 +1265,13 @@ begin
938 End 1265 End
939 else 1266 else
940 Begin 1267 Begin
941 - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');  
942 - log_diario(':::::::::::::: OBTENDO VALORES DO "chkcacic.ini" ::::::::::::::');  
943 - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');  
944 - log_diario('Drive de instalação......................: '+v_home_drive);  
945 - log_diario('Pasta para instalação....................: '+Dir);  
946 - log_diario('IP do servidor...........................: '+v_ip_serv_cacic);  
947 - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'); 1268 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1269 + log_DEBUG(':::::::::::::: OBTENDO VALORES DO "chkcacic.ini" ::::::::::::::');
  1270 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1271 + log_DEBUG('Drive de instalação......................: '+v_home_drive);
  1272 + log_DEBUG('Pasta para instalação....................: '+Dir);
  1273 + log_DEBUG('IP do servidor...........................: '+v_ip_serv_cacic);
  1274 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
948 bool_configura := false; 1275 bool_configura := false;
949 1276
950 //chave AES. Recomenda-se que cada empresa/órgão altere a sua chave. 1277 //chave AES. Recomenda-se que cada empresa/órgão altere a sua chave.
@@ -955,19 +1282,48 @@ begin @@ -955,19 +1282,48 @@ begin
955 v_tstrCipherOpened := CipherOpen(v_DatFileName); 1282 v_tstrCipherOpened := CipherOpen(v_DatFileName);
956 1283
957 1284
958 - if (GetWinVer >= 8) then // Se >= WinXP... 1285 + if ((intWinVer <> 0) and (intWinVer >= 8)) or
  1286 + (abstraiCSD(v_te_so) >= 250) then // Se >= WinXP...
959 Begin 1287 Begin
960 Try 1288 Try
961 - // Acrescento os valores para uso do FireWall nativo... 1289 + // Libero as policies do FireWall (testes)
  1290 + Try
  1291 + Begin
  1292 + Log_DEBUG('Valor de "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DisableStatefulFTP" => '+trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DisableStatefulFTP')));
  1293 + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DisableStatefulFTP'))='0') then
  1294 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DisableStatefulFTP','1');
962 1295
963 - {chkcacic}  
964 - LiberaFireWall(ExtractFilePath(Application.Exename) + 'chkcacic'); 1296 + Log_DEBUG('Valor de "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\EnableFirewall" => '+trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\EnableFirewall')));
  1297 + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\EnableFirewall'))='1') then
  1298 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\EnableFirewall','0');
965 1299
966 - {chksis}  
967 - LiberaFireWall(HomeDrive + '\chksis'); 1300 + Log_DEBUG('Valor de "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\DisableNotifications" => '+trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\DisableNotifications')));
  1301 + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\DisableNotifications'))='0') then
  1302 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\DisableNotifications','1');
968 1303
969 - {ger_cols}  
970 - LiberaFireWall(Dir + '\modulos\ger_cols'); 1304 + Log_DEBUG('Valor de "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\DisableNotifications" => '+trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\DisableNotifications')));
  1305 + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\DisableNotifications'))='0') then
  1306 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\DisableNotifications','1');
  1307 +
  1308 + Log_DEBUG('Valor de "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\EnableFirewall" => '+trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\EnableFirewall')));
  1309 + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\EnableFirewall'))='1') then
  1310 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\EnableFirewall','0');
  1311 +
  1312 + Log_DEBUG('Valor de "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PublicProfile\DisableNotifications" => '+trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PublicProfile\DisableNotifications')));
  1313 + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PublicProfile\DisableNotifications'))='0') then
  1314 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PublicProfile\DisableNotifications','1');
  1315 +
  1316 + Log_DEBUG('Valor de "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PublicProfile\EnableFirewall" => '+trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PublicProfile\EnableFirewall')));
  1317 + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PublicProfile\EnableFirewall'))='1') then
  1318 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PublicProfile\EnableFirewall','0');
  1319 + End
  1320 + Except
  1321 + log_DEBUG('Problema Liberando Policies de FireWall!');
  1322 + End;
  1323 +
  1324 + // Acrescento o ChkCacic às exceções do FireWall nativo...
  1325 + {chkcacic}
  1326 + LiberaFireWall(ExtractFilePath(Application.Exename) + 'chkcacic');
971 1327
972 Except 1328 Except
973 End; 1329 End;
@@ -993,10 +1349,6 @@ begin @@ -993,10 +1349,6 @@ begin
993 1349
994 if (ParamCount > 0) and (LowerCase(Copy(ParamStr(1),1,7)) = '/config') then application.Terminate; 1350 if (ParamCount > 0) and (LowerCase(Copy(ParamStr(1),1,7)) = '/config') then application.Terminate;
995 1351
996 - // Caso o parâmetro rem_cacic_v0x seja "S/s" removo a chave/valor de execução do Cacic antigo  
997 - //if (LowerCase(v_rem_cacic_v0x)='s') then  
998 - // DelValorReg('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic');  
999 -  
1000 // Verifico a existência do diretório configurado para o Cacic, normalmente CACIC 1352 // Verifico a existência do diretório configurado para o Cacic, normalmente CACIC
1001 if not DirectoryExists(Dir) then 1353 if not DirectoryExists(Dir) then
1002 begin 1354 begin
@@ -1007,20 +1359,7 @@ begin @@ -1007,20 +1359,7 @@ begin
1007 // Para eliminar versão 20014 e anteriores que provavelmente não fazem corretamente o AutoUpdate 1359 // Para eliminar versão 20014 e anteriores que provavelmente não fazem corretamente o AutoUpdate
1008 if not DirectoryExists(Dir+'\modulos') then 1360 if not DirectoryExists(Dir+'\modulos') then
1009 begin 1361 begin
1010 - if DeleteFile(Dir + '\cacic2.exe') then  
1011 - log_diario('Exclusão de '+Dir + '\cacic2.exe' + ' efetuada com sucesso!')  
1012 - else  
1013 - Begin  
1014 - log_diario('Exclusão não efetuada! Provavelmente já esteja sendo executado...');  
1015 - log_diario('Tentarei finalizar Tarefa/Processo...');  
1016 - if (GetWinVer <= 5) then // Até  
1017 - KillTask('cacic2.exe')  
1018 - else  
1019 - KillProcess(FindWindow('cacic2.exe',nil));  
1020 - if DeleteFile(Dir + '\cacic2.exe') then  
1021 - log_diario('Exclusão Impossibilitada de '+Dir + '\cacic2.exe' + '!');  
1022 - End;  
1023 - 1362 + Matar(Dir, '\cacic2.exe');
1024 ForceDirectories(Dir + '\modulos'); 1363 ForceDirectories(Dir + '\modulos');
1025 log_diario('Criando pasta '+Dir+'\modulos'); 1364 log_diario('Criando pasta '+Dir+'\modulos');
1026 end; 1365 end;
@@ -1070,16 +1409,20 @@ begin @@ -1070,16 +1409,20 @@ begin
1070 v_te_senha_login_serv_updates := XML_RetornaValor('te_senha_login_serv_updates' , v_retorno); 1409 v_te_senha_login_serv_updates := XML_RetornaValor('te_senha_login_serv_updates' , v_retorno);
1071 v_te_path_serv_updates := XML_RetornaValor('te_path_serv_updates' , v_retorno); 1410 v_te_path_serv_updates := XML_RetornaValor('te_path_serv_updates' , v_retorno);
1072 1411
1073 - //log_diario('Retorno da comunicação: '+v_retorno);  
1074 -  
1075 - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');  
1076 - log_diario(':::::::::::::::: VALORES OBTIDOS NO Gerente WEB :::::::::::::::');  
1077 - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');  
1078 - log_diario('Servidor de updates......................: '+v_te_serv_updates);  
1079 - log_diario('Porta do servidor de updates.............: '+v_nu_porta_serv_updates);  
1080 - log_diario('Usuário para login no servidor de updates: '+v_nm_usuario_login_serv_updates);  
1081 - log_diario('Pasta no servidor de updates.............: '+v_te_path_serv_updates);  
1082 - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'); 1412 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1413 + log_DEBUG(':::::::::::::::: VALORES OBTIDOS NO Gerente WEB :::::::::::::::');
  1414 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1415 + log_DEBUG('Servidor de updates......................: '+v_te_serv_updates);
  1416 + log_DEBUG('Porta do servidor de updates.............: '+v_nu_porta_serv_updates);
  1417 + log_DEBUG('Usuário para login no servidor de updates: '+v_nm_usuario_login_serv_updates);
  1418 + log_DEBUG('Pasta no servidor de updates.............: '+v_te_path_serv_updates);
  1419 + log_DEBUG(' ');
  1420 + log_DEBUG('Versões dos Agentes Principais:');
  1421 + log_DEBUG('------------------------------');
  1422 + log_DEBUG('Cacic2 - Agente do Systray.........: '+XML_RetornaValor('CACIC2', v_retorno));
  1423 + log_DEBUG('Ger_Cols - Gerente de Coletas........: '+XML_RetornaValor('GER_COLS', v_retorno));
  1424 + log_DEBUG('ChkSis - Verificador de Integridade: '+XML_RetornaValor('CHKSIS', v_retorno));
  1425 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
1083 Except 1426 Except
1084 Begin 1427 Begin
1085 if v_exibe_informacoes = 'S' then 1428 if v_exibe_informacoes = 'S' then
@@ -1092,151 +1435,129 @@ begin @@ -1092,151 +1435,129 @@ begin
1092 Request_Config.Free; 1435 Request_Config.Free;
1093 Response_Config.Free; 1436 Response_Config.Free;
1094 1437
1095 - // Verificação de versão do cacic2.exe e exclusão em caso de versão antiga  
1096 - If (FileExists(Dir + '\cacic2.exe')) Then  
1097 - Begin  
1098 - v_versao_local := trim(GetVersionInfo(Dir + '\cacic2.exe'));  
1099 - v_versao_local := StringReplace(v_versao_local,'.','',[rfReplaceAll]);  
1100 -  
1101 - v_versao_remota_inteira := XML_RetornaValor('CACIC2' , v_retorno);  
1102 - v_versao_remota_capada := Copy(v_versao_remota_inteira,1,StrLen(PAnsiChar(v_versao_remota_inteira))-4);  
1103 -  
1104 - if not (v_versao_remota_inteira = '') then  
1105 - log_diario('Versão remota de "cacic2.exe": '+v_versao_remota_capada + '('+v_versao_remota_inteira+')'); 1438 + // Se NTFS em NT/2K/XP...
  1439 + // If NTFS on NT Like...
  1440 + if ((intWinVer <> 0) and (intWinVer > 5)) or
  1441 + (abstraiCSD(v_te_so) >= 250) then
  1442 + Begin
  1443 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1444 + log_DEBUG('::::::: VERIFICANDO FILE SYSTEM E ATRIBUINDO PERMISSÕES :::::::');
  1445 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
1106 1446
1107 - if (v_versao_local ='0000') or // Provavelmente versão muito antiga ou corrompida  
1108 - (v_versao_local ='2208') then  
1109 -// (v_versao_local <> v_versao_remota_capada) then  
1110 - Begin  
1111 - log_diario('Excluindo versão "'+v_versao_local+'" de Cacic2.exe');  
1112 - if DeleteFile(Dir + '\cacic2.exe') then  
1113 - log_diario('Exclusão de '+Dir + '\cacic2.exe'+' efetuada com sucesso!')  
1114 - else  
1115 - Begin  
1116 - log_diario('Exclusão não efetuada! Provavelmente já esteja sendo executado...');  
1117 - log_diario('Tentarei finalizar Tarefa/Processo...');  
1118 - if (GetWinVer <= 5) then // Até  
1119 - KillTask('cacic2.exe')  
1120 - else  
1121 - KillProcess(FindWindow('cacic2.exe',nil));  
1122 - if DeleteFile(Dir + '\cacic2.exe') then  
1123 - log_diario('Exclusão Impossibilitada de '+Dir + '\cacic2.exe' + '!');  
1124 - End;  
1125 - End;  
1126 - End; 1447 + Form1.FS_SetSecurity(Dir);
  1448 + Form1.FS_SetSecurity(Dir + '\cacic2.exe');
  1449 + Form1.FS_SetSecurity(Dir + '\cacic2.dat');
  1450 + Form1.FS_SetSecurity(Dir + '\cacic2.log');
  1451 + Form1.FS_SetSecurity(Dir + '\modulos');
  1452 + Form1.FS_SetSecurity(Dir + '\temp');
1127 1453
1128 - // Verificação de versão do ger_cols.exe e exclusão em caso de versão antiga  
1129 - If (FileExists(Dir + '\modulos\ger_cols.exe')) Then  
1130 - Begin  
1131 - v_versao_local := trim(GetVersionInfo(Dir + '\modulos\ger_cols.exe'));  
1132 - v_versao_local := StringReplace(v_versao_local,'.','',[rfReplaceAll]); 1454 + // Atribuição de acesso a todos os módulos para permissão de atualizações de versão
  1455 + Form1.FS_SetSecurity(Dir + '\modulos\ger_cols.exe');
  1456 + Form1.FS_SetSecurity(Dir + '\modulos\col_anvi.exe');
  1457 + Form1.FS_SetSecurity(Dir + '\modulos\col_comp.exe');
  1458 + Form1.FS_SetSecurity(Dir + '\modulos\col_hard.exe');
  1459 + Form1.FS_SetSecurity(Dir + '\modulos\col_moni.exe');
  1460 + Form1.FS_SetSecurity(Dir + '\modulos\col_patr.exe');
  1461 + Form1.FS_SetSecurity(Dir + '\modulos\col_soft.exe');
  1462 + Form1.FS_SetSecurity(Dir + '\modulos\col_undi.exe');
  1463 + Form1.FS_SetSecurity(Dir + '\modulos\ini_cols.exe');
  1464 + Form1.FS_SetSecurity(Dir + '\modulos\wscript.exe');
1133 1465
1134 - v_versao_remota_inteira := XML_RetornaValor('GER_COLS' , v_retorno);  
1135 - v_versao_remota_capada := Copy(v_versao_remota_inteira,1,StrLen(PAnsiChar(v_versao_remota_inteira))-4); 1466 + // Atribuição de acesso para atualização do módulo verificador de integridade do sistema e seus arquivos
  1467 + Form1.FS_SetSecurity(HomeDrive + '\chksis.exe');
  1468 + Form1.FS_SetSecurity(HomeDrive + '\chksis.log');
  1469 + Form1.FS_SetSecurity(HomeDrive + '\chksis.dat');
1136 1470
1137 - if not (v_versao_remota_inteira = '') then  
1138 - log_diario('Versão remota de "ger_cols.exe": '+v_versao_remota_capada+ '('+v_versao_remota_inteira+')'); 1471 + // Atribuição de acesso para atualização/exclusão de log do instalador
  1472 + Form1.FS_SetSecurity(v_home_drive + 'chkcacic.log');
  1473 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1474 + End;
1139 1475
1140 - if (v_versao_local ='0000') then //or // Provavelmente versão muito antiga ou corrompida  
1141 -// (v_versao_local <> v_versao_remota_capada) then 1476 + // Verificação de versão do cacic2.exe e exclusão em caso de versão antiga/diferente da atual
  1477 + If (FileExists(Dir + '\cacic2.exe')) Then
  1478 + Begin
  1479 + // Pego as informações de dia/mês/ano/horas/minutos/segundos/milésimos que identificam o agente Cacic2
  1480 + strDataHoraCACIC2_INI := FormatDateTime('ddmmyyyyhhnnsszzz', GetFolderDate(Dir + '\cacic2.exe'));
  1481 +
  1482 + intAux := ChecaVersoesAgentes(Dir + '\cacic2.exe');
  1483 + // 0 => Arquivo de versões ou informação inexistente
  1484 + // 1 => Versões iguais
  1485 + // 2 => Versões diferentes
  1486 + if (intAux = 0) then
1142 Begin 1487 Begin
1143 - log_diario('Excluindo versão "'+v_versao_local+'" de Ger_Cols.exe');  
1144 - if DeleteFile(Dir + '\modulos\ger_cols.exe') then  
1145 - log_diario('Exclusão de '+Dir + '\modulos\ger_cols.exe'+' efetuada com sucesso!')  
1146 - else  
1147 - Begin  
1148 - log_diario('Exclusão não efetuada! Provavelmente já esteja sendo executado...');  
1149 - log_diario('Tentarei finalizar Tarefa/Processo...');  
1150 - if (GetWinVer <= 5) then // Até  
1151 - KillTask('ger_cols.exe')  
1152 - else  
1153 - KillProcess(FindWindow('ger_cols.exe',nil));  
1154 - if DeleteFile(Dir + '\modulos\ger_cols.exe') then  
1155 - log_diario('Exclusão Impossibilitada de '+Dir + '\modulos\ger_cols.exe' + '!');  
1156 - End; 1488 + v_versao_local := StringReplace(trim(GetVersionInfo(Dir + '\cacic2.exe')),'.','',[rfReplaceAll]);
  1489 + v_versao_remota := StringReplace(XML_RetornaValor('CACIC2' , v_retorno),'0103','',[rfReplaceAll]);
1157 End; 1490 End;
1158 - End;  
1159 1491
  1492 + if (intAux = 2) or // Caso haja diferença na comparação de versões com "versoes_agentes.ini"...
  1493 + (v_versao_local ='0000') or // Provavelmente versão muito antiga ou corrompida
  1494 + (v_versao_local ='2208') then
  1495 + Matar(Dir, '\cacic2.exe');
  1496 + End;
1160 1497
1161 - // Verificação de versão do chksis.exe e exclusão em caso de versão antiga  
1162 - If (FileExists(HomeDrive + '\chksis.exe')) Then  
1163 - Begin  
1164 - v_versao_local := trim(GetVersionInfo(HomeDrive + '\chksis.exe'));  
1165 - v_versao_local := StringReplace(v_versao_local,'.','',[rfReplaceAll]); 1498 + // Verificação de versão do ger_cols.exe e exclusão em caso de versão antiga/diferente da atual
  1499 + If (FileExists(Dir + '\modulos\ger_cols.exe')) Then
  1500 + Begin
  1501 + // Pego as informações de dia/mês/ano/horas/minutos/segundos/milésimos que identificam o agente Ger_Cols
  1502 + strDataHoraGERCOLS_INI := FormatDateTime('ddmmyyyyhhnnsszzz', GetFolderDate(Dir + '\modulos\ger_cols.exe'));
  1503 +
  1504 + intAux := ChecaVersoesAgentes(Dir + '\modulos\ger_cols.exe');
  1505 + // 0 => Arquivo de versões ou informação inexistente
  1506 + // 1 => Versões iguais
  1507 + // 2 => Versões diferentes
  1508 + if (intAux = 0) then
  1509 + Begin
  1510 + v_versao_local := StringReplace(trim(GetVersionInfo(Dir + '\modulos\ger_cols.exe')),'.','',[rfReplaceAll]);
  1511 + v_versao_remota := StringReplace(XML_RetornaValor('GER_COLS' , v_retorno),'0103','',[rfReplaceAll]);
  1512 + End;
1166 1513
1167 - v_versao_remota_inteira := XML_RetornaValor('CHKSIS' , v_retorno);  
1168 - v_versao_remota_capada := Copy(v_versao_remota_inteira,1,StrLen(PAnsiChar(v_versao_remota_inteira))-4); 1514 + if (intAux = 2) or // Caso haja diferença na comparação de versões com "versoes_agentes.ini"...
  1515 + (v_versao_local ='0000') then // Provavelmente versão muito antiga ou corrompida
  1516 + Matar(Dir + '\modulos\', 'ger_cols.exe');
  1517 + End;
1169 1518
1170 - if not (v_versao_remota_inteira = '') then  
1171 - log_diario('Versão remota de "chksis.exe": '+v_versao_remota_capada+ '('+v_versao_remota_inteira+')');  
1172 1519
1173 - if (v_versao_local ='0000') then //or // Provavelmente versão muito antiga ou corrompida  
1174 -// (v_versao_local <> v_versao_remota_capada) then  
1175 - Begin  
1176 - log_diario('Excluindo versão "'+v_versao_local+'" de ChkSis.exe');  
1177 - if DeleteFile(HomeDrive + '\chksis.exe') then  
1178 - log_diario('Exclusão de '+HomeDrive + '\chksis.exe'+' efetuada com sucesso!')  
1179 - else  
1180 - Begin  
1181 - log_diario('Exclusão não efetuada! Provavelmente já esteja sendo executado...');  
1182 - log_diario('Tentarei finalizar Tarefa/Processo...');  
1183 - if (GetWinVer <= 5) then // Até  
1184 - KillTask('chksis.exe')  
1185 - else  
1186 - KillProcess(FindWindow('chksis.exe',nil));  
1187 - if DeleteFile(HomeDrive + '\chksis.exe') then  
1188 - log_diario('Exclusão Impossibilitada de '+HomeDrive + '\chksis.exe' + '!');  
1189 - End; 1520 + // Verificação de versão do chksis.exe e exclusão em caso de versão antiga/diferente da atual
  1521 + If (FileExists(HomeDrive + '\chksis.exe')) Then
  1522 + Begin
  1523 + intAux := ChecaVersoesAgentes(HomeDrive + '\chksis.exe');
  1524 + // 0 => Arquivo de versões ou informação inexistente
  1525 + // 1 => Versões iguais
  1526 + // 2 => Versões diferentes
  1527 + if (intAux = 0) then
  1528 + Begin
  1529 + v_versao_local := StringReplace(trim(GetVersionInfo(HomeDrive + '\chksis.exe')),'.','',[rfReplaceAll]);
  1530 + v_versao_remota := StringReplace(XML_RetornaValor('CHKSIS' , v_retorno),'0103','',[rfReplaceAll]);
  1531 + End;
1190 1532
1191 - End;  
1192 - End; 1533 + if (intAux = 2) or // Caso haja diferença na comparação de versões com "versoes_agentes.ini"...
  1534 + (v_versao_local ='0000') then // Provavelmente versão muito antiga ou corrompida
  1535 + Matar(HomeDrive,'chksis.exe');
  1536 + End;
1193 1537
1194 // Tento detectar o ChkSis.EXE e copio ou faço FTP caso não exista 1538 // Tento detectar o ChkSis.EXE e copio ou faço FTP caso não exista
1195 - If not FileExists(HomeDrive + '\chksis.exe') Then  
1196 - begin  
1197 - if (FileExists(ExtractFilePath(Application.Exename) + 'modulos\chksis.exe')) then  
1198 - Begin  
1199 - log_diario('Copiando ChkSis.exe de '+ExtractFilePath(Application.Exename)+'modulos\');  
1200 - CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\chksis.exe'), PChar(HomeDrive + '\chksis.exe'),false);  
1201 - FileSetAttr (PChar(HomeDrive + '\chksis.exe'),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000  
1202 - End  
1203 - else  
1204 - Begin  
1205 - if not FTP(v_te_serv_updates,  
1206 - v_nu_porta_serv_updates,  
1207 - v_nm_usuario_login_serv_updates,  
1208 - v_te_senha_login_serv_updates,  
1209 - v_te_path_serv_updates,  
1210 - 'chksis.exe',  
1211 - HomeDrive) and (v_exibe_informacoes = 'S') then  
1212 - MessageDLG(#13#10+'ATENÇÃO! Não foi possível efetuar FTP para "'+HomeDrive + '\chksis.exe".'+#13#10+'Verifique o Servidor de Updates.',mtError,[mbOK],0);  
1213 -  
1214 - If not FileExists(HomeDrive + '\chksis.exe') Then  
1215 - Begin  
1216 - log_diario('Problemas Efetuando Download de ChkSis.exe(FTP):');  
1217 - log_diario('v_te_serv_updates:'+v_te_serv_updates);  
1218 - log_diario('v_nu_porta_serv_updates:'+v_nu_porta_serv_updates);  
1219 - log_diario('v_nm_usuario_login_serv_updates:'+v_nm_usuario_login_serv_updates);  
1220 - log_diario('v_te_senha_login_serv_updates:'+v_te_senha_login_serv_updates);  
1221 - log_diario('v_te_path_serv_updates:'+v_te_path_serv_updates);  
1222 - End  
1223 - else log_diario('Download Concluído de ChkSis.exe (FTP)');  
1224 -  
1225 - End;  
1226 - end;  
1227 -  
1228 - // Tento detectar o ChkSis.INI e crio-o apartir do chkcacic.ini 1539 + verifyAndGet('chksis.exe',
  1540 + HomeDrive,
  1541 + v_te_serv_updates,
  1542 + v_nu_porta_serv_updates,
  1543 + v_nm_usuario_login_serv_updates,
  1544 + v_te_senha_login_serv_updates,
  1545 + v_te_path_serv_updates,
  1546 + v_exibe_informacoes);
  1547 +
  1548 + // Tento detectar o ChkSis.INI e crio-o caso necessário
1229 If not FileExists(HomeDrive + '\chksis.ini') Then 1549 If not FileExists(HomeDrive + '\chksis.ini') Then
1230 begin 1550 begin
1231 - log_diario('Criando ChkSis.ini');  
1232 - CopyFile(PChar(ExtractFilePath(Application.Exename) + 'chkcacic.ini'), PChar(HomeDrive + '\chksis.ini'),false); 1551 + log_DEBUG('Criando '+HomeDrive + '\chksis.ini');
  1552 + GravaIni(HomeDrive + '\chksis.ini');
1233 FileSetAttr ( PChar(HomeDrive + '\chksis.ini'),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 1553 FileSetAttr ( PChar(HomeDrive + '\chksis.ini'),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
1234 end; 1554 end;
1235 1555
1236 - // Tento detectar o cacic2.INI e crio-o apartir do chkcacic.ini 1556 + // Tento detectar o cacic2.INI e crio-o caso necessário
1237 If not FileExists(Dir + '\cacic2.ini') Then 1557 If not FileExists(Dir + '\cacic2.ini') Then
1238 begin 1558 begin
1239 - CopyFile(PChar(ExtractFilePath(Application.Exename) + 'chkcacic.ini'), PChar(Dir + '\cacic2.ini'),false) 1559 + log_DEBUG('Criando/Recriando '+Dir + '\cacic2.ini');
  1560 + GravaIni(Dir + '\cacic2.ini');
1240 end; 1561 end;
1241 1562
1242 // Verifico se existe a pasta "modulos" 1563 // Verifico se existe a pasta "modulos"
@@ -1244,78 +1565,23 @@ begin @@ -1244,78 +1565,23 @@ begin
1244 if (v_modulos <> '') then log_diario('Pasta "Modulos" encontrada..'); 1565 if (v_modulos <> '') then log_diario('Pasta "Modulos" encontrada..');
1245 1566
1246 // Tento detectar o Agente Principal e copio ou faço FTP caso não exista 1567 // Tento detectar o Agente Principal e copio ou faço FTP caso não exista
1247 - If not FileExists(Dir + '\cacic2.exe') Then  
1248 - Begin  
1249 - if (FileExists(ExtractFilePath(Application.Exename) + '\modulos\cacic2.exe')) then  
1250 - Begin  
1251 - log_diario('Copiando Cacic2.exe de '+ExtractFilePath(Application.Exename)+'modulos\');  
1252 - CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\cacic2.exe'), PChar(Dir + '\cacic2.exe'),false);  
1253 - FileSetAttr (PChar(Dir + '\cacic2.exe'),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000  
1254 - bool_download_CACIC2 := true;  
1255 - End  
1256 - else  
1257 - begin  
1258 - if not FTP(v_te_serv_updates,  
1259 - v_nu_porta_serv_updates,  
1260 - v_nm_usuario_login_serv_updates,  
1261 - v_te_senha_login_serv_updates,  
1262 - v_te_path_serv_updates,  
1263 - 'cacic2.exe',  
1264 - Dir) and (v_exibe_informacoes = 'S') then  
1265 - MessageDLG(#13#10+'ATENÇÃO! Não foi possível efetuar FTP para "'+Dir + '\cacic2.exe".'+#13#10+'Verifique o Servidor de Updates.',mtError,[mbOK],0);  
1266 -  
1267 - bool_download_CACIC2 := true;  
1268 -  
1269 - If not FileExists(Dir + '\cacic2.exe') Then  
1270 - Begin  
1271 - log_diario('Problemas Efetuando Download de Cacic2.exe(FTP):');  
1272 - log_diario('v_te_serv_updates:'+v_te_serv_updates);  
1273 - log_diario('v_nu_porta_serv_updates:'+v_nu_porta_serv_updates);  
1274 - log_diario('v_nm_usuario_login_serv_updates:'+v_nm_usuario_login_serv_updates);  
1275 - log_diario('v_te_senha_login_serv_updates:'+v_te_senha_login_serv_updates);  
1276 - log_diario('v_te_path_serv_updates:'+v_te_path_serv_updates);  
1277 - bool_download_CACIC2 := false;  
1278 - End  
1279 - else log_diario('Download Concluído de Cacic2.exe (FTP)');  
1280 -  
1281 - end;  
1282 - End;  
1283 - // Tento detectar o Gerente de Coletas e copio ou faço FTP caso não exista  
1284 - If (not FileExists(Dir + '\modulos\ger_cols.exe')) Then  
1285 - Begin  
1286 - if (FileExists(ExtractFilePath(Application.Exename) + '\modulos\ger_cols.exe')) then  
1287 - Begin  
1288 - log_diario('Copiando Ger_Cols.exe de '+ExtractFilePath(Application.Exename)+'modulos\');  
1289 - CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\ger_cols.exe'), PChar(Dir + '\modulos\ger_cols.exe'),false);  
1290 - FileSetAttr (PChar(Dir + '\modulos\ger_cols.exe'),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000  
1291 - bool_download_GER_COLS := true;  
1292 - End  
1293 - else  
1294 - begin  
1295 - if not FTP(v_te_serv_updates,  
1296 - v_nu_porta_serv_updates,  
1297 - v_nm_usuario_login_serv_updates,  
1298 - v_te_senha_login_serv_updates,  
1299 - v_te_path_serv_updates,  
1300 - 'ger_cols.exe',  
1301 - Dir + '\modulos') and (v_exibe_informacoes = 'S') then  
1302 - MessageDLG(#13#10+'ATENÇÃO! Não foi possível efetuar FTP para "'+Dir + '\modulos\ger_cols.exe".'+#13#10+'Verifique o Servidor de Updates.',mtError,[mbOK],0);  
1303 -  
1304 - bool_download_GER_COLS := true;  
1305 - If (not FileExists(Dir + '\modulos\ger_cols.exe')) Then  
1306 - Begin  
1307 - log_diario('Problemas Efetuando Download de Ger_Cols.exe(FTP):');  
1308 - log_diario('v_te_serv_updates:'+v_te_serv_updates);  
1309 - log_diario('v_nu_porta_serv_updates:'+v_nu_porta_serv_updates);  
1310 - log_diario('v_nm_usuario_login_serv_updates:'+v_nm_usuario_login_serv_updates);  
1311 - log_diario('v_te_senha_login_serv_updates:'+v_te_senha_login_serv_updates);  
1312 - log_diario('v_te_path_serv_updates:'+v_te_path_serv_updates);  
1313 - bool_download_GER_COLS := false;  
1314 - End  
1315 - else log_diario('Download Concluído de Ger_Cols.exe (FTP)');  
1316 -  
1317 - end;  
1318 - End; 1568 + verifyAndGet('cacic2.exe',
  1569 + Dir,
  1570 + v_te_serv_updates,
  1571 + v_nu_porta_serv_updates,
  1572 + v_nm_usuario_login_serv_updates,
  1573 + v_te_senha_login_serv_updates,
  1574 + v_te_path_serv_updates,
  1575 + v_exibe_informacoes);
  1576 +
  1577 + verifyAndGet('ger_cols.exe',
  1578 + Dir + '\modulos',
  1579 + v_te_serv_updates,
  1580 + v_nu_porta_serv_updates,
  1581 + v_nm_usuario_login_serv_updates,
  1582 + v_te_senha_login_serv_updates,
  1583 + v_te_path_serv_updates,
  1584 + v_exibe_informacoes);
1319 1585
1320 // Caso exista a pasta "modulos", copio todos os executáveis para a pasta Cacic\modulos, exceto cacic2.exe, ger_cols.exe e chksis.exe 1586 // Caso exista a pasta "modulos", copio todos os executáveis para a pasta Cacic\modulos, exceto cacic2.exe, ger_cols.exe e chksis.exe
1321 if (v_modulos <> '') then 1587 if (v_modulos <> '') then
@@ -1334,7 +1600,56 @@ begin @@ -1334,7 +1600,56 @@ begin
1334 End; 1600 End;
1335 End; 1601 End;
1336 1602
1337 - log_diario('Gravando registros para auto-execução'); 1603 + // ATENÇÃO:
  1604 + // Após testes no Vista, percebí que o firewall nativo interrompia o FTP e truncava o agente com tamanho zero...
  1605 + // A nova tentativa abaixo ajudará a sobrepor o agente truncado e corrompido
  1606 +
  1607 + // Tento detectar (de novo) o ChkSis.EXE e copio ou faço FTP caso não exista
  1608 + verifyAndGet('chksis.exe',
  1609 + HomeDrive,
  1610 + v_te_serv_updates,
  1611 + v_nu_porta_serv_updates,
  1612 + v_nm_usuario_login_serv_updates,
  1613 + v_te_senha_login_serv_updates,
  1614 + v_te_path_serv_updates,
  1615 + v_exibe_informacoes);
  1616 +
  1617 + // Tento detectar (de novo) o Agente Principal e copio ou faço FTP caso não exista
  1618 + verifyAndGet('cacic2.exe',
  1619 + Dir,
  1620 + v_te_serv_updates,
  1621 + v_nu_porta_serv_updates,
  1622 + v_nm_usuario_login_serv_updates,
  1623 + v_te_senha_login_serv_updates,
  1624 + v_te_path_serv_updates,
  1625 + v_exibe_informacoes);
  1626 +
  1627 + verifyAndGet('ger_cols.exe',
  1628 + Dir + '\modulos',
  1629 + v_te_serv_updates,
  1630 + v_nu_porta_serv_updates,
  1631 + v_nm_usuario_login_serv_updates,
  1632 + v_te_senha_login_serv_updates,
  1633 + v_te_path_serv_updates,
  1634 + v_exibe_informacoes);
  1635 +
  1636 + if ((intWinVer <> 0) and (intWinVer >= 8)) or
  1637 + (abstraiCSD(v_te_so) >= 250) then // Se >= WinXP...
  1638 + Begin
  1639 + Try
  1640 + // Acrescento o ChkSis e o Ger_Cols às exceções do FireWall nativo...
  1641 +
  1642 + {chksis}
  1643 + LiberaFireWall(HomeDrive + '\chksis');
  1644 +
  1645 + {ger_cols}
  1646 + LiberaFireWall(Dir + '\modulos\ger_cols');
  1647 +
  1648 + Except
  1649 + End;
  1650 + End;
  1651 +
  1652 + log_DEBUG('Gravando registros para auto-execução');
1338 1653
1339 // Crio a chave/valor cacic2 para autoexecução do Cacic, caso não exista esta chave/valor 1654 // Crio a chave/valor cacic2 para autoexecução do Cacic, caso não exista esta chave/valor
1340 // Crio a chave/valor chksis para autoexecução do ChkSIS, caso não exista esta chave/valor 1655 // Crio a chave/valor chksis para autoexecução do ChkSIS, caso não exista esta chave/valor
@@ -1348,43 +1663,30 @@ begin @@ -1348,43 +1663,30 @@ begin
1348 1663
1349 // Igualo as chaves ip_serv_cacic dos arquivos chksis.ini e cacic2.ini! 1664 // Igualo as chaves ip_serv_cacic dos arquivos chksis.ini e cacic2.ini!
1350 SetValorDatMemoria('Configs.EnderecoServidor', v_ip_serv_cacic); 1665 SetValorDatMemoria('Configs.EnderecoServidor', v_ip_serv_cacic);
1351 - log_diario('Fechando Arquivo de Configurações do CACIC'); 1666 + log_DEBUG('Fechando Arquivo de Configurações do Cacic');
1352 CipherClose(v_DatFileName); 1667 CipherClose(v_DatFileName);
1353 - log_diario('Abrindo Arquivo de Configurações do CHKSIS'); 1668 +
  1669 + log_DEBUG('Abrindo Arquivo de Configurações do ChkSis');
1354 CipherOpen(HomeDrive + '\chksis.dat'); 1670 CipherOpen(HomeDrive + '\chksis.dat');
1355 SetValorDatMemoria('Cacic2.ip_serv_cacic', v_ip_serv_cacic); 1671 SetValorDatMemoria('Cacic2.ip_serv_cacic', v_ip_serv_cacic);
1356 - // SetValorChaveRegIni('Cacic2', 'ip_serv_cacic', v_ip_serv_cacic, HomeDrive + '\chksis.ini'); 1672 + CipherClose(HomeDrive + '\chksis.dat');
1357 1673
  1674 + // Volto a gravar o chksis.ini para o difícil caso de leitura por versões antigas
  1675 + SetValorChaveRegIni('Cacic2', 'ip_serv_cacic', v_ip_serv_cacic, HomeDrive + '\chksis.ini');
  1676 + log_DEBUG('Fechando Arquivo de Configurações do ChkSis');
1358 1677
1359 - // Se NT/2K/XP...  
1360 - // If NT Like...  
1361 - if (GetWinVer > 5) then  
1362 - Begin  
1363 - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');  
1364 - log_diario('::::::: VERIFICANDO FILE SYSTEM E ATRIBUINDO PERMISSÕES :::::::');  
1365 - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');  
1366 - Form1.FS_SetSecurity(Dir);  
1367 - Form1.FS_SetSecurity(Dir + '\cacic2.exe');  
1368 - Form1.FS_SetSecurity(Dir + '\modulos');  
1369 - Form1.FS_SetSecurity(Dir + '\temp');  
1370 - Form1.FS_SetSecurity(v_DatFileName) ; // cacic2.dat 1678 + log_DEBUG('Resgatando informações para identificação de alteração do agente CACIC2');
  1679 + // Pego as informações de dia/mês/ano/horas/minutos/segundos/milésimos que identificam os agentes
  1680 + strDataHoraCACIC2_FIM := FormatDateTime('ddmmyyyyhhnnsszzz', GetFolderDate(Dir + '\cacic2.exe'));
  1681 + log_DEBUG('Inicial => "' + strDataHoraCACIC2_INI + '" Final => "' + strDataHoraCACIC2_FIM + '"');
1371 1682
1372 - // Atribuição de acesso a todos os módulos para permissão de atualizações de versão  
1373 - Form1.FS_SetSecurity(Dir + '\modulos\ger_cols.exe');  
1374 - Form1.FS_SetSecurity(Dir + '\modulos\col_anvi.exe');  
1375 - Form1.FS_SetSecurity(Dir + '\modulos\col_comp.exe');  
1376 - Form1.FS_SetSecurity(Dir + '\modulos\col_hard.exe');  
1377 - Form1.FS_SetSecurity(Dir + '\modulos\col_moni.exe');  
1378 - Form1.FS_SetSecurity(Dir + '\modulos\col_patr.exe');  
1379 - Form1.FS_SetSecurity(Dir + '\modulos\col_soft.exe');  
1380 - Form1.FS_SetSecurity(Dir + '\modulos\col_undi.exe');  
1381 - Form1.FS_SetSecurity(Dir + '\modulos\ini_cols.exe');  
1382 - Form1.FS_SetSecurity(Dir + '\modulos\wscript.exe');  
1383 - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');  
1384 - End; 1683 + log_DEBUG('Resgatando informações para identificação de alteração do agente GER_COLS');
  1684 + strDataHoraGERCOLS_FIM := FormatDateTime('ddmmyyyyhhnnsszzz', GetFolderDate(Dir + '\modulos\ger_cols.exe'));
  1685 + log_DEBUG('Inicial => "' + strDataHoraGERCOLS_INI + '" Final => "' + strDataHoraGERCOLS_FIM + '"');
1385 1686
1386 // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor 1687 // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor
1387 - if (bool_download_CACIC2) or (bool_download_GER_COLS) then 1688 + if ((strDataHoraCACIC2_INI <> strDataHoraCACIC2_FIM) OR
  1689 + (strDataHoraGERCOLS_INI <> strDataHoraGERCOLS_FIM)) then
1388 Begin 1690 Begin
1389 v_te_texto_janela_instalacao := v_te_instala_informacoes_extras; 1691 v_te_texto_janela_instalacao := v_te_instala_informacoes_extras;
1390 if (GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2')=Dir + '\cacic2.exe') then 1692 if (GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2')=Dir + '\cacic2.exe') then
@@ -1395,26 +1697,26 @@ begin @@ -1395,26 +1697,26 @@ begin
1395 else if (v_exibe_informacoes = 'S') then 1697 else if (v_exibe_informacoes = 'S') then
1396 MessageDlg(#13#10+#13#10+v_te_instala_frase_insucesso+#13#10+#13#10+#13#10 + '======================================================' + #13#10 + v_te_texto_janela_instalacao+ '======================================================',mtInformation,[mbok],0); 1698 MessageDlg(#13#10+#13#10+v_te_instala_frase_insucesso+#13#10+#13#10+#13#10 + '======================================================' + #13#10 + v_te_texto_janela_instalacao+ '======================================================',mtInformation,[mbok],0);
1397 1699
1398 - // Se eu não encontrei a chave de autoexecução ou  
1399 - // Se a unidade origem de chamada ao ChkCacic refere-se a Floppy, CDROM ou Flash  
1400 - // Eu executo o agente principal  
1401 - strAux := DriveType(Copy(ExtractFilePath(Application.Exename),1,1));  
1402 - if not bool_ExistsAutoRun or  
1403 - (not(strAux = 'ERRO') and  
1404 - not(strAux = 'REDE')) then  
1405 - Begin  
1406 - log_diario('Executando '+Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic);  
1407 - WinExec(PChar(Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute'), SW_HIDE);  
1408 - End  
1409 - else  
1410 - log_diario('Não Executei. Chave de AutoExecução já existente...');  
1411 -  
1412 End 1700 End
1413 else 1701 else
1414 - log_diario('ATENÇÃO: A Instalação NÃO Foi Realizada com Sucesso ou Atualização Desnecessária!'); 1702 + log_diario('ATENÇÃO: Instalação NÃO REALIZADA ou ATUALIZAÇÃO DESNECESSÁRIA!');
  1703 +
  1704 + if Posso_Rodar_CACIC or not bool_ExistsAutoRun then
  1705 + Begin
  1706 + log_DEBUG('Executando '+Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic);
  1707 +
  1708 + // Caso tenha havido download de agentes principais, executar coletas imediatamente...
  1709 + if ((strDataHoraCACIC2_INI <> strDataHoraCACIC2_FIM) OR
  1710 + (strDataHoraGERCOLS_INI <> strDataHoraGERCOLS_FIM)) then
  1711 + WinExec(PChar(Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute'), SW_HIDE)
  1712 + else
  1713 + WinExec(PChar(Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic ), SW_HIDE);
  1714 + End
  1715 + else
  1716 + log_DEBUG('Chave de Auto-Execução já existente ou Execução já iniciada...');
1415 End; 1717 End;
1416 Except 1718 Except
1417 - log_diario('Falha na instalação'); 1719 + log_diario('Falha na Instalação/Atualização');
1418 End; 1720 End;
1419 1721
1420 end; 1722 end;
@@ -1508,10 +1810,12 @@ end; @@ -1508,10 +1810,12 @@ end;
1508 procedure TForm1.FormCreate(Sender: TObject); 1810 procedure TForm1.FormCreate(Sender: TObject);
1509 begin 1811 begin
1510 Application.ShowMainForm:=false; 1812 Application.ShowMainForm:=false;
1511 - if (FindWindowByTitle('chksis') = 0) then  
1512 - chkcacic  
1513 - else  
1514 - log_diario('Não executei devido execução em paralelo de "chksis"'); 1813 + v_Debugs := false;
  1814 +
  1815 +// if (FindWindowByTitle('chksis') = 0) then
  1816 + chkcacic;
  1817 +// else
  1818 +// log_diario('Não executei devido execução em paralelo de "chksis"');
1515 1819
1516 Application.Terminate; 1820 Application.Terminate;
1517 end; 1821 end;
@@ -1519,6 +1823,7 @@ end; @@ -1519,6 +1823,7 @@ end;
1519 procedure TForm1.FS_SetSecurity(p_Target : String); 1823 procedure TForm1.FS_SetSecurity(p_Target : String);
1520 var intAux : integer; 1824 var intAux : integer;
1521 v_FS_Security : TNTFileSecurity; 1825 v_FS_Security : TNTFileSecurity;
  1826 + boolFound : boolean;
1522 begin 1827 begin
1523 v_FS_Security := TNTFileSecurity.Create(nil); 1828 v_FS_Security := TNTFileSecurity.Create(nil);
1524 v_FS_Security.FileName := ''; 1829 v_FS_Security.FileName := '';
@@ -1529,21 +1834,13 @@ begin @@ -1529,21 +1834,13 @@ begin
1529 Begin 1834 Begin
1530 for intAux := 0 to Pred(v_FS_Security.EntryCount) do 1835 for intAux := 0 to Pred(v_FS_Security.EntryCount) do
1531 begin 1836 begin
1532 - case v_FS_Security.EntryType[intAux] of  
1533 - seAlias : Try  
1534 - // Atribuo total privilégio aos grupos locais sobre a pasta "CACIC"  
1535 - // Set all privilegies to local groups on p_Target  
1536 - case v_FS_Security.EntryType[intAux] of  
1537 - seAlias : // Se for grupo local...  
1538 - Begin // If local group...  
1539 - v_FS_Security.FileRights[intAux] := [faAll];  
1540 - v_FS_Security.DirectoryRights[intAux] := [faAll];  
1541 - log_diario(p_Target + ' [Full Access] >> '+v_FS_Security.EntryName[intAux]);  
1542 - //Setting total access on p_Target to local groups.  
1543 - End;  
1544 - end;  
1545 - Except  
1546 - End; 1837 + case v_FS_Security.EntryType[intAux] of seAlias, seDomain, seGroup :
  1838 + Begin // If local group, alias or user...
  1839 + v_FS_Security.FileRights[intAux] := [faAll];
  1840 + v_FS_Security.DirectoryRights[intAux] := [faAll];
  1841 + log_DEBUG(p_Target + ' [Full Access] >> '+v_FS_Security.EntryName[intAux]);
  1842 + //Setting total access on p_Target to local groups.
  1843 + End;
1547 End; 1844 End;
1548 end; 1845 end;
1549 1846
@@ -1551,7 +1848,7 @@ begin @@ -1551,7 +1848,7 @@ begin
1551 // Set total permissions to local groups 1848 // Set total permissions to local groups
1552 v_FS_Security.SetSecurity; 1849 v_FS_Security.SetSecurity;
1553 end 1850 end
1554 - else Log_diario('File System diferente de "NTFS"'); 1851 + else Log_diario('File System: "' + v_FS_Security.FileSystemName+'" - Ok!');
1555 1852
1556 v_FS_Security.Free; 1853 v_FS_Security.Free;
1557 end; 1854 end;
chksis/chksis.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=8 118 +Build=20
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -124,15 +124,15 @@ DLL=0 @@ -124,15 +124,15 @@ DLL=0
124 Locale=1046 124 Locale=1046
125 CodePage=1252 125 CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 -CompanyName=Dataprev-ES 127 +CompanyName=Dataprev - Unidade Regional Espírito Santo (URES)
128 FileDescription=Módulo Verificador de Integridade do Sistema CACIC 128 FileDescription=Módulo Verificador de Integridade do Sistema CACIC
129 -FileVersion=2.2.0.8 129 +FileVersion=2.2.0.20
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=2.0.1.1 134 +ProductName=ChkSIS
  135 +ProductVersion=2.2.0.20
136 Comments=Baseado na licença GPL (General Public License) 136 Comments=Baseado na licença GPL (General Public License)
137 [HistoryLists\hlDebugSourcePath] 137 [HistoryLists\hlDebugSourcePath]
138 Count=1 138 Count=1
chksis/chksis.dpr
@@ -38,7 +38,8 @@ uses Windows, @@ -38,7 +38,8 @@ uses Windows,
38 Winsock, 38 Winsock,
39 DCPcrypt2, 39 DCPcrypt2,
40 DCPrijndael, 40 DCPrijndael,
41 - DCPbase64; 41 + DCPbase64,
  42 + Tlhelp32;
42 43
43 var PJVersionInfo1: TPJVersionInfo; 44 var PJVersionInfo1: TPJVersionInfo;
44 Dir, 45 Dir,
@@ -48,8 +49,7 @@ var PJVersionInfo1: TPJVersionInfo; @@ -48,8 +49,7 @@ var PJVersionInfo1: TPJVersionInfo;
48 v_strCipherClosed, 49 v_strCipherClosed,
49 v_DatFileName, 50 v_DatFileName,
50 v_versao_local, 51 v_versao_local,
51 - v_versao_remota_inteira,  
52 - v_versao_remota_capada, 52 + v_versao_remota,
53 v_retorno : String; 53 v_retorno : String;
54 54
55 var v_tstrCipherOpened : TStrings; 55 var v_tstrCipherOpened : TStrings;
@@ -632,6 +632,156 @@ begin @@ -632,6 +632,156 @@ begin
632 Result := 0; 632 Result := 0;
633 end; 633 end;
634 634
  635 +// Rotina obtida em http://www.swissdelphicenter.ch/torry/showcode.php?id=266
  636 +{For Windows 9x/ME/2000/XP }
  637 +function KillTask(ExeFileName: string): Integer;
  638 +const
  639 + PROCESS_TERMINATE = $0001;
  640 +var
  641 + ContinueLoop: BOOL;
  642 + FSnapshotHandle: THandle;
  643 + FProcessEntry32: TProcessEntry32;
  644 +begin
  645 + Result := 0;
  646 + FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  647 + FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
  648 + ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
  649 +
  650 + while Integer(ContinueLoop) <> 0 do
  651 + begin
  652 + if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
  653 + UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
  654 + UpperCase(ExeFileName))) then
  655 + Result := Integer(TerminateProcess(
  656 + OpenProcess(PROCESS_TERMINATE,
  657 + BOOL(0),
  658 + FProcessEntry32.th32ProcessID),
  659 + 0));
  660 + ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
  661 + end;
  662 + CloseHandle(FSnapshotHandle);
  663 +end;
  664 +
  665 +// Rotina obtida em http://www.swissdelphicenter.ch/torry/showcode.php?id=266
  666 +{ For Windows NT/2000/XP }
  667 +procedure KillProcess(hWindowHandle: HWND);
  668 +var
  669 + hprocessID: INTEGER;
  670 + processHandle: THandle;
  671 + DWResult: DWORD;
  672 +begin
  673 + SendMessageTimeout(hWindowHandle, WM_DDE_TERMINATE, 0, 0,
  674 + SMTO_ABORTIFHUNG or SMTO_NORMAL, 5000, DWResult);
  675 +
  676 + if isWindow(hWindowHandle) then
  677 + begin
  678 + // PostMessage(hWindowHandle, WM_QUIT, 0, 0);
  679 +
  680 + { Get the process identifier for the window}
  681 + GetWindowThreadProcessID(hWindowHandle, @hprocessID);
  682 + if hprocessID <> 0 then
  683 + begin
  684 + { Get the process handle }
  685 + processHandle := OpenProcess(PROCESS_TERMINATE or PROCESS_QUERY_INFORMATION,
  686 + False, hprocessID);
  687 + if processHandle <> 0 then
  688 + begin
  689 + { Terminate the process }
  690 + TerminateProcess(processHandle, 0);
  691 + CloseHandle(ProcessHandle);
  692 + end;
  693 + end;
  694 + end;
  695 +end;
  696 +
  697 +
  698 +// Dica baixada de http://procedure.blig.ig.com.br/
  699 +// Adaptada por Anderson Peterle - v:2.2.0.16 - 03/2007
  700 +procedure Matar(v_dir,v_files: string);
  701 +var SearchRec: TSearchRec;
  702 + Result: Integer;
  703 + strFileName : String;
  704 +begin
  705 + strFileName := StringReplace(v_dir + '\' + v_files,'\\','\',[rfReplaceAll]);
  706 + Result:=FindFirst(strFileName, faAnyFile, SearchRec);
  707 + while result=0 do
  708 + begin
  709 + strFileName := StringReplace(v_dir + '\' + SearchRec.Name,'\\','\',[rfReplaceAll]);
  710 + log_diario('Tentando Excluir: '+strFileName,ExtractFilePath(ParamStr(0)));
  711 + if DeleteFile(strFileName) then
  712 + log_diario('Exclusão de ' + strFileName + ' efetuada com sucesso!',ExtractFilePath(ParamStr(0)))
  713 + else
  714 + Begin
  715 + log_diario('Exclusão não efetuada! Provavelmente já esteja sendo executado...',ExtractFilePath(ParamStr(0)));
  716 + log_diario('Tentarei finalizar Tarefa/Processo...',ExtractFilePath(ParamStr(0)));
  717 + if (GetWinVer <= 5) then // Até
  718 + KillTask(SearchRec.Name)
  719 + else
  720 + KillProcess(FindWindow(PChar(SearchRec.Name),nil));
  721 +
  722 + if DeleteFile(strFileName) then
  723 + log_diario('Exclusão Impossibilitada de ' + strFileName + '!',ExtractFilePath(ParamStr(0)));
  724 + End;
  725 +
  726 + Result:=FindNext(SearchRec);
  727 + end;
  728 +end;
  729 +
  730 +function Posso_Rodar_CACIC : boolean;
  731 +Begin
  732 + result := false;
  733 +
  734 + // Se o aguarde_CACIC.txt existir é porque refere-se a uma versão mais atual: 2.2.0.20 ou maior
  735 + if (FileExists(Dir + 'aguarde_CACIC.txt')) then
  736 + Begin
  737 + // Se eu conseguir matar o arquivo abaixo é porque não há outra sessão deste agente aberta... (POG? Nããão! :) )
  738 + Matar(Dir,'aguarde_CACIC.txt');
  739 + if (not (FileExists(Dir + 'aguarde_CACIC.txt'))) then
  740 + result := true;
  741 + End;
  742 +End;
  743 +
  744 +Function ChecaVersoesAgentes(p_strNomeAgente : String) : integer;
  745 +var v_versao_REM,
  746 + v_versao_LOC,
  747 + strNomeAgente : String;
  748 + v_array_NomeAgente : TStrings;
  749 + intAux : integer;
  750 +Begin
  751 + v_array_NomeAgente := explode(p_strNomeAgente,'\');
  752 +
  753 + v_versao_REM := XML_RetornaValor(StringReplace(StrUpper(PChar(v_array_NomeAgente[v_array_NomeAgente.count-1])),'.EXE','',[rfReplaceAll]), v_retorno);
  754 + v_versao_LOC := GetVersionInfo(p_strNomeAgente);
  755 +
  756 + log_diario('Checando versão de "'+p_strNomeAgente+'"',ExtractFilePath(ParamStr(0)));
  757 +
  758 + intAux := v_array_NomeAgente.Count;
  759 +
  760 + // V: 2.2.0.16
  761 + // Verifico existência do arquivo "versoes_agentes.ini" para comparação das versões dos agentes principais
  762 + if (v_versao_REM = '') AND FileExists(ExtractFilePath(Application.Exename)+'versoes_agentes.ini') then
  763 + Begin
  764 + if (GetValorChaveRegIni('versoes_agentes',v_array_NomeAgente[intAux-1],ExtractFilePath(Application.Exename)+'versoes_agentes.ini')<>'') then
  765 + Begin
  766 + log_diario('Encontrado arquivo "'+(ExtractFilePath(Application.Exename)+'versoes_agentes.ini')+'"',ExtractFilePath(ParamStr(0)));
  767 + v_versao_REM := GetValorChaveRegIni('versoes_agentes',v_array_NomeAgente[intAux-1],ExtractFilePath(Application.Exename)+'versoes_agentes.ini');
  768 + End;
  769 + End;
  770 +
  771 + log_diario('Versão Remota: "'+v_versao_REM+'" - Versão Local: "'+v_versao_LOC+'"',ExtractFilePath(ParamStr(0)));
  772 +
  773 + if (v_versao_REM + v_versao_LOC <> '') and
  774 + (v_versao_LOC <> '0000') then
  775 + Begin
  776 + if (v_versao_REM = v_versao_LOC) then
  777 + Result := 1
  778 + else
  779 + Result := 2;
  780 + End
  781 + else
  782 + Result := 0;
  783 +End;
  784 +
635 procedure executa_chksis; 785 procedure executa_chksis;
636 var 786 var
637 bool_download_CACIC2, 787 bool_download_CACIC2,
@@ -642,6 +792,7 @@ var @@ -642,6 +792,7 @@ var
642 Request_Config : TStringList; 792 Request_Config : TStringList;
643 Response_Config : TStringStream; 793 Response_Config : TStringStream;
644 IdHTTP1: TIdHTTP; 794 IdHTTP1: TIdHTTP;
  795 + intAux : integer;
645 begin 796 begin
646 bool_download_CACIC2 := false; 797 bool_download_CACIC2 := false;
647 v_home_drive := MidStr(HomeDrive,1,3); //x:\ 798 v_home_drive := MidStr(HomeDrive,1,3); //x:\
@@ -670,7 +821,7 @@ begin @@ -670,7 +821,7 @@ begin
670 if not DirectoryExists(Dir+'\modulos') then 821 if not DirectoryExists(Dir+'\modulos') then
671 begin 822 begin
672 log_diario('Excluindo '+ Dir + '\cacic2.exe',ExtractFilePath(ParamStr(0))); 823 log_diario('Excluindo '+ Dir + '\cacic2.exe',ExtractFilePath(ParamStr(0)));
673 - DeleteFile(Dir + '\cacic2.exe'); 824 + Matar(Dir,'\cacic2.exe');
674 log_diario('Criando diretório ' + Dir + '\modulos',ExtractFilePath(ParamStr(0))); 825 log_diario('Criando diretório ' + Dir + '\modulos',ExtractFilePath(ParamStr(0)));
675 ForceDirectories(Dir + '\modulos'); 826 ForceDirectories(Dir + '\modulos');
676 end; 827 end;
@@ -688,7 +839,7 @@ begin @@ -688,7 +839,7 @@ begin
688 // SetValorChaveRegIni('Configs', 'EnderecoServidor', v_ip_serv_cacic, Dir + '\cacic2.ini'); 839 // SetValorChaveRegIni('Configs', 'EnderecoServidor', v_ip_serv_cacic, Dir + '\cacic2.ini');
689 840
690 //chave AES. Recomenda-se que cada empresa altere a sua chave. 841 //chave AES. Recomenda-se que cada empresa altere a sua chave.
691 - v_CipherKey := 'CacicES2005'; 842 + v_CipherKey := 'CacicBrasil';
692 v_IV := 'abcdefghijklmnop'; 843 v_IV := 'abcdefghijklmnop';
693 v_SeparatorKey := '=CacicIsFree='; 844 v_SeparatorKey := '=CacicIsFree=';
694 v_DatFileName := Dir + '\cacic2.dat'; 845 v_DatFileName := Dir + '\cacic2.dat';
@@ -722,11 +873,19 @@ begin @@ -722,11 +873,19 @@ begin
722 v_te_senha_login_serv_updates := XML_RetornaValor('te_senha_login_serv_updates' , Response_Config.DataString); 873 v_te_senha_login_serv_updates := XML_RetornaValor('te_senha_login_serv_updates' , Response_Config.DataString);
723 v_te_path_serv_updates := XML_RetornaValor('te_path_serv_updates' , Response_Config.DataString); 874 v_te_path_serv_updates := XML_RetornaValor('te_path_serv_updates' , Response_Config.DataString);
724 875
725 - log_diario(':::::::::::::: PARÂMETROS OBTIDOS NO Gerente WEB ::::::::::::::',ExtractFilePath(ParamStr(0))); 876 + log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::',ExtractFilePath(ParamStr(0)));
  877 + log_diario(':::::::::::::::: VALORES OBTIDOS NO Gerente WEB :::::::::::::::',ExtractFilePath(ParamStr(0)));
  878 + log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::',ExtractFilePath(ParamStr(0)));
726 log_diario('Servidor de updates......................: '+v_te_serv_updates,ExtractFilePath(ParamStr(0))); 879 log_diario('Servidor de updates......................: '+v_te_serv_updates,ExtractFilePath(ParamStr(0)));
727 log_diario('Porta do servidor de updates.............: '+v_nu_porta_serv_updates,ExtractFilePath(ParamStr(0))); 880 log_diario('Porta do servidor de updates.............: '+v_nu_porta_serv_updates,ExtractFilePath(ParamStr(0)));
728 log_diario('Usuário para login no servidor de updates: '+v_nm_usuario_login_serv_updates,ExtractFilePath(ParamStr(0))); 881 log_diario('Usuário para login no servidor de updates: '+v_nm_usuario_login_serv_updates,ExtractFilePath(ParamStr(0)));
729 log_diario('Pasta no servidor de updates.............: '+v_te_path_serv_updates,ExtractFilePath(ParamStr(0))); 882 log_diario('Pasta no servidor de updates.............: '+v_te_path_serv_updates,ExtractFilePath(ParamStr(0)));
  883 + log_diario(' ',ExtractFilePath(ParamStr(0)));
  884 + log_diario('Versões dos Agentes Principais:',ExtractFilePath(ParamStr(0)));
  885 + log_diario('------------------------------',ExtractFilePath(ParamStr(0)));
  886 + log_diario('Cacic2 - Agente do Systray.........: '+XML_RetornaValor('CACIC2', v_retorno),ExtractFilePath(ParamStr(0)));
  887 + log_diario('Ger_Cols - Gerente de Coletas........: '+XML_RetornaValor('GER_COLS', v_retorno),ExtractFilePath(ParamStr(0)));
  888 + log_diario('ChkSis - Verificador de Integridade: '+XML_RetornaValor('CHKSIS', v_retorno),ExtractFilePath(ParamStr(0)));
730 log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::',ExtractFilePath(ParamStr(0))); 889 log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::',ExtractFilePath(ParamStr(0)));
731 890
732 Except log_diario('Falha no contato com ' + 'http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php',ExtractFilePath(ParamStr(0))); 891 Except log_diario('Falha no contato com ' + 'http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php',ExtractFilePath(ParamStr(0)));
@@ -738,37 +897,39 @@ begin @@ -738,37 +897,39 @@ begin
738 // Verificação de versão do cacic2.exe e exclusão em caso de versão antiga 897 // Verificação de versão do cacic2.exe e exclusão em caso de versão antiga
739 If (FileExists(Dir + '\cacic2.exe')) Then 898 If (FileExists(Dir + '\cacic2.exe')) Then
740 Begin 899 Begin
741 - v_versao_local := trim(GetVersionInfo(Dir + '\cacic2.exe'));  
742 - v_versao_local := StringReplace(v_versao_local,'.','',[rfReplaceAll]);  
743 -  
744 - v_versao_remota_inteira := XML_RetornaValor('CACIC2' , v_retorno);  
745 - v_versao_remota_capada := Copy(v_versao_remota_inteira,1,StrLen(PAnsiChar(v_versao_remota_inteira))-4);  
746 -  
747 - if (v_versao_local ='0000') or // Provavelmente versão muito antiga ou corrompida  
748 - (v_versao_local <> v_versao_remota_capada) then 900 + intAux := ChecaVersoesAgentes(Dir + '\cacic2.exe');
  901 + // 0 => Arquivo de versões ou informação inexistente
  902 + // 1 => Versões iguais
  903 + // 2 => Versões diferentes
  904 + if (intAux = 0) then
749 Begin 905 Begin
750 - //log_diario('Excluindo versão "'+v_versao_local+'" de Cacic2.exe',ExtractFilePath(ParamStr(0)));  
751 - DeleteFile(Dir + '\cacic2.exe'); 906 + v_versao_local := StringReplace(trim(GetVersionInfo(Dir + '\cacic2.exe')),'.','',[rfReplaceAll]);
  907 + v_versao_remota := StringReplace(XML_RetornaValor('CACIC2' , v_retorno),'0103','',[rfReplaceAll]);
752 End; 908 End;
  909 +
  910 + if (intAux = 2) or // Caso haja diferença na comparação de versões com "versoes_agentes.ini"...
  911 + (v_versao_local ='0000') or // Provavelmente versão muito antiga ou corrompida
  912 + (v_versao_local ='2208') then
  913 + Matar(Dir, '\cacic2.exe');
753 End; 914 End;
754 915
755 // Verificação de versão do ger_cols.exe e exclusão em caso de versão antiga 916 // Verificação de versão do ger_cols.exe e exclusão em caso de versão antiga
756 If (FileExists(Dir + '\modulos\ger_cols.exe')) Then 917 If (FileExists(Dir + '\modulos\ger_cols.exe')) Then
757 Begin 918 Begin
758 - v_versao_local := trim(GetVersionInfo(Dir + '\modulos\ger_cols.exe'));  
759 - v_versao_local := StringReplace(v_versao_local,'.','',[rfReplaceAll]);  
760 -  
761 - v_versao_remota_inteira := XML_RetornaValor('GER_COLS' , v_retorno);  
762 - v_versao_remota_capada := Copy(v_versao_remota_inteira,1,StrLen(PAnsiChar(v_versao_remota_inteira))-4);  
763 -  
764 - //log_diario('Versão remota de "ger_cols.exe": '+v_versao_remota_capada + ' ('+v_versao_remota_inteira+')',ExtractFilePath(ParamStr(0)));  
765 -  
766 - if (v_versao_local ='0000') or // Provavelmente versão muito antiga ou corrompida  
767 - (v_versao_local <> v_versao_remota_capada) then 919 + intAux := ChecaVersoesAgentes(Dir + '\modulos\ger_cols.exe');
  920 + // 0 => Arquivo de versões ou informação inexistente
  921 + // 1 => Versões iguais
  922 + // 2 => Versões diferentes
  923 + if (intAux = 0) then
768 Begin 924 Begin
769 - //log_diario('Excluindo versão "'+v_versao_local+'" de Ger_Cols.exe',ExtractFilePath(ParamStr(0)));  
770 - DeleteFile(Dir + '\modulos\ger_cols.exe'); 925 + v_versao_local := StringReplace(trim(GetVersionInfo(Dir + '\modulos\ger_cols.exe')),'.','',[rfReplaceAll]);
  926 + v_versao_remota := StringReplace(XML_RetornaValor('GER_COLS' , v_retorno),'0103','',[rfReplaceAll]);
771 End; 927 End;
  928 +
  929 + if (intAux = 2) or // Caso haja diferença na comparação de versões com "versoes_agentes.ini"...
  930 + (v_versao_local ='0000') then // Provavelmente versão muito antiga ou corrompida
  931 + Matar(Dir + '\modulos\', 'ger_cols.exe');
  932 +
772 End; 933 End;
773 934
774 // Tento detectar o Agente Principal e faço FTP caso não exista 935 // Tento detectar o Agente Principal e faço FTP caso não exista
@@ -822,18 +983,25 @@ begin @@ -822,18 +983,25 @@ begin
822 SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2', Dir + '\cacic2.exe'); 983 SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2', Dir + '\cacic2.exe');
823 984
824 // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor 985 // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor
825 - if (bool_download_CACIC2) then  
826 - Begin  
827 - if not bool_ExistsAutoRun then  
828 - Begin  
829 - log_diario('Executando '+Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic,ExtractFilePath(ParamStr(0)));  
830 - WinExec(PChar(Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute'), SW_HIDE);  
831 - End  
832 - else  
833 - log_diario('Não Executei. Chave de AutoExecução já existente...',ExtractFilePath(ParamStr(0)));  
834 - End  
835 -end; 986 + //if (bool_download_CACIC2) then
  987 + //Begin
  988 + //if not bool_ExistsAutoRun then
  989 + // Begin
  990 + if Posso_Rodar_CACIC or not bool_ExistsAutoRun then
  991 + Begin
  992 + log_diario('Executando '+Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic,ExtractFilePath(ParamStr(0)));
836 993
  994 + // Caso tenha havido download de agentes principais, executar coletas imediatamente...
  995 + if (bool_download_CACIC2) then
  996 + WinExec(PChar(Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute'), SW_HIDE)
  997 + else
  998 + WinExec(PChar(Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic ), SW_HIDE);
  999 + End;
  1000 + // End
  1001 + // else
  1002 + // log_diario('Não Executei. Chave de AutoExecução já existente...',ExtractFilePath(ParamStr(0)));
  1003 + //End
  1004 +end;
837 1005
838 begin 1006 begin
839 // Application.ShowMainForm:=false; 1007 // Application.ShowMainForm:=false;
chksis/chksis.res
No preview for this file type
col_anvi/col_anvi.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=0 118 +Build=1
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -124,15 +124,15 @@ DLL=0 @@ -124,15 +124,15 @@ DLL=0
124 Locale=2070 124 Locale=2070
125 CodePage=1252 125 CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 -CompanyName=Dataprev-ES 127 +CompanyName=Dataprev-Unidade Regional Espírito Santo
128 FileDescription=Coletor de Informações de AntiVírus do Sistema CACIC 128 FileDescription=Coletor de Informações de AntiVírus do Sistema CACIC
129 -FileVersion=2.2.0.0 129 +FileVersion=2.2.0.1
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=2.0.1.1 134 +ProductName=Col_ANVI
  135 +ProductVersion=2.2.0.1
136 Comments=Baseado na licença GPL (General Public License) 136 Comments=Baseado na licença GPL (General Public License)
137 [HistoryLists\hlDebugSourcePath] 137 [HistoryLists\hlDebugSourcePath]
138 Count=1 138 Count=1
col_anvi/col_anvi.dpr
@@ -493,6 +493,7 @@ var Lista1_RCO : TStringList; @@ -493,6 +493,7 @@ var Lista1_RCO : TStringList;
493 searchResult : TSearchRec; // Necessário apenas para Win9x 493 searchResult : TSearchRec; // Necessário apenas para Win9x
494 begin 494 begin
495 Try 495 Try
  496 + SetValorDatMemoria('Col_Anvi.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
496 nu_versao_engine := ''; 497 nu_versao_engine := '';
497 nu_versao_pattern := ''; 498 nu_versao_pattern := '';
498 log_diario('Coletando informações de Antivírus OfficeScan.'); 499 log_diario('Coletando informações de Antivírus OfficeScan.');
@@ -552,6 +553,9 @@ begin @@ -552,6 +553,9 @@ begin
552 in_ativo); 553 in_ativo);
553 // Obtenho do registro o valor que foi previamente armazenado 554 // Obtenho do registro o valor que foi previamente armazenado
554 ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.OfficeScan',v_tstrCipherOpened)); 555 ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.OfficeScan',v_tstrCipherOpened));
  556 +
  557 + SetValorDatMemoria('Col_Anvi.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
  558 +
555 log_DEBUG('Registro Anterior: ' + ValorChaveRegistro); 559 log_DEBUG('Registro Anterior: ' + ValorChaveRegistro);
556 log_DEBUG('Registro Atual...: ' + UVC); 560 log_DEBUG('Registro Atual...: ' + UVC);
557 // Se essas informações forem diferentes significa que houve alguma alteração 561 // Se essas informações forem diferentes significa que houve alguma alteração
@@ -576,6 +580,7 @@ begin @@ -576,6 +580,7 @@ begin
576 Except 580 Except
577 Begin 581 Begin
578 SetValorDatMemoria('Col_Anvi.nada', 'nada', v_tstrCipherOpened1); 582 SetValorDatMemoria('Col_Anvi.nada', 'nada', v_tstrCipherOpened1);
  583 + SetValorDatMemoria('Col_Anvi.Fim', '99999999', v_tstrCipherOpened1);
579 CipherClose(p_path_cacic + 'temp\col_anvi.dat', v_tstrCipherOpened1); 584 CipherClose(p_path_cacic + 'temp\col_anvi.dat', v_tstrCipherOpened1);
580 End; 585 End;
581 End; 586 End;
col_anvi/col_anvi.res
No preview for this file type
col_comp/col_comp.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=0 118 +Build=1
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -124,15 +124,15 @@ DLL=0 @@ -124,15 +124,15 @@ DLL=0
124 Locale=2070 124 Locale=2070
125 CodePage=1252 125 CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 -CompanyName=Dataprev-ES 127 +CompanyName=Dataprev-Unidade Regional Espírito Santo
128 FileDescription=Coletor de Informações de Compartilhamento do Sistema CACIC 128 FileDescription=Coletor de Informações de Compartilhamento do Sistema CACIC
129 -FileVersion=2.2.0.0 129 +FileVersion=2.2.0.1
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=2.0.1.1 134 +ProductName=Col_COMP
  135 +ProductVersion=2.2.0.1
136 Comments=Baseado na licença GPL (General Public License) 136 Comments=Baseado na licença GPL (General Public License)
137 [HistoryLists\hlDebugSourcePath] 137 [HistoryLists\hlDebugSourcePath]
138 Count=1 138 Count=1
col_comp/col_comp.dpr
@@ -438,6 +438,7 @@ var Reg_RCC : TRegistry; @@ -438,6 +438,7 @@ var Reg_RCC : TRegistry;
438 Lista_RCC : TStringList; 438 Lista_RCC : TStringList;
439 Begin 439 Begin
440 Try 440 Try
  441 + SetValorDatMemoria('Col_Comp.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
441 nm_compartilhamento := ''; 442 nm_compartilhamento := '';
442 nm_dir_compart := ''; 443 nm_dir_compart := '';
443 cs_tipo_compart := ' '; 444 cs_tipo_compart := ' ';
@@ -530,6 +531,8 @@ Begin @@ -530,6 +531,8 @@ Begin
530 // Obtenho do registro o valor que foi previamente armazenado 531 // Obtenho do registro o valor que foi previamente armazenado
531 ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Compartilhamentos')); 532 ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Compartilhamentos'));
532 533
  534 + SetValorDatMemoria('Col_Comp.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
  535 +
533 // Se essas informações forem diferentes significa que houve alguma alteração 536 // Se essas informações forem diferentes significa que houve alguma alteração
534 // na configuração. Nesse caso, gravo as informações no BD Central e, se não houver 537 // na configuração. Nesse caso, gravo as informações no BD Central e, se não houver
535 // problemas durante esse procedimento, atualizo as informações no registro. 538 // problemas durante esse procedimento, atualizo as informações no registro.
@@ -548,6 +551,7 @@ Begin @@ -548,6 +551,7 @@ Begin
548 Except 551 Except
549 Begin 552 Begin
550 SetValorDatMemoria('Col_Comp.nada', 'nada', v_tstrCipherOpened1); 553 SetValorDatMemoria('Col_Comp.nada', 'nada', v_tstrCipherOpened1);
  554 + SetValorDatMemoria('Col_Comp.Fim', '99999999', v_tstrCipherOpened1);
551 CipherClose(p_path_cacic + 'temp\col_comp.dat', v_tstrCipherOpened1); 555 CipherClose(p_path_cacic + 'temp\col_comp.dat', v_tstrCipherOpened1);
552 End; 556 End;
553 End; 557 End;
col_comp/col_comp.res
No preview for this file type
col_hard/col_hard.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=0 118 +Build=1
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -124,15 +124,15 @@ DLL=0 @@ -124,15 +124,15 @@ DLL=0
124 Locale=2070 124 Locale=2070
125 CodePage=1252 125 CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 -CompanyName=Dataprev-ES 127 +CompanyName=Dataprev-Unidade Regional Espírito Santo
128 FileDescription=Coletor de Informações de Hardware do Sistema CACIC 128 FileDescription=Coletor de Informações de Hardware do Sistema CACIC
129 -FileVersion=2.2.0.0 129 +FileVersion=2.2.0.1
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=2.0.1.2 134 +ProductName=Col_Hard
  135 +ProductVersion=2.2.0.1
136 Comments=Baseado na licença GPL (General Public License) 136 Comments=Baseado na licença GPL (General Public License)
137 [HistoryLists\hlDebugSourcePath] 137 [HistoryLists\hlDebugSourcePath]
138 Count=1 138 Count=1
col_hard/col_hard.dpr
@@ -664,6 +664,7 @@ var v_te_cpu_freq, v_te_cpu_fabricante, v_te_cpu_desc, v_te_cpu_serial, v_te_pla @@ -664,6 +664,7 @@ var v_te_cpu_freq, v_te_cpu_fabricante, v_te_cpu_desc, v_te_cpu_serial, v_te_pla
664 v_Report : TStringList; 664 v_Report : TStringList;
665 begin 665 begin
666 Try 666 Try
  667 + SetValorDatMemoria('Col_Hard.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
667 v_Report := TStringList.Create; 668 v_Report := TStringList.Create;
668 log_diario('Coletando informações de Hardware.'); 669 log_diario('Coletando informações de Hardware.');
669 670
@@ -936,6 +937,8 @@ begin @@ -936,6 +937,8 @@ begin
936 // Obtenho do registro o valor que foi previamente armazenado 937 // Obtenho do registro o valor que foi previamente armazenado
937 ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Hardware',v_tstrCipherOpened)); 938 ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Hardware',v_tstrCipherOpened));
938 939
  940 + SetValorDatMemoria('Col_Hard.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
  941 +
939 // Se essas informações forem diferentes significa que houve alguma alteração 942 // Se essas informações forem diferentes significa que houve alguma alteração
940 // na configuração de hardware. Nesse caso, gravo as informações no BD Central 943 // na configuração de hardware. Nesse caso, gravo as informações no BD Central
941 // e, se não houver problemas durante esse procedimento, atualizo as 944 // e, se não houver problemas durante esse procedimento, atualizo as
@@ -973,11 +976,13 @@ begin @@ -973,11 +976,13 @@ begin
973 else 976 else
974 Begin 977 Begin
975 SetValorDatMemoria('Col_Hard.nada','nada', v_tstrCipherOpened1); 978 SetValorDatMemoria('Col_Hard.nada','nada', v_tstrCipherOpened1);
  979 + SetValorDatMemoria('Col_Hard.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
976 CipherClose(p_path_cacic + 'temp\col_hard.dat', v_tstrCipherOpened1); 980 CipherClose(p_path_cacic + 'temp\col_hard.dat', v_tstrCipherOpened1);
977 End; 981 End;
978 Except 982 Except
979 Begin 983 Begin
980 SetValorDatMemoria('Col_Hard.nada','nada', v_tstrCipherOpened1); 984 SetValorDatMemoria('Col_Hard.nada','nada', v_tstrCipherOpened1);
  985 + SetValorDatMemoria('Col_Hard.Fim' , '99999999', v_tstrCipherOpened1);
981 CipherClose(p_path_cacic + 'temp\col_hard.dat', v_tstrCipherOpened1); 986 CipherClose(p_path_cacic + 'temp\col_hard.dat', v_tstrCipherOpened1);
982 log_diario('Problema na execução => ' + v_mensagem); 987 log_diario('Problema na execução => ' + v_mensagem);
983 End; 988 End;
col_hard/col_hard.res
No preview for this file type
col_moni/col_moni.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=0 118 +Build=2
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -126,13 +126,13 @@ CodePage=1252 @@ -126,13 +126,13 @@ CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 CompanyName=Dataprev/ES 127 CompanyName=Dataprev/ES
128 FileDescription=Coletor de Informações de Sistemas Monitorados do pelo CACIC 128 FileDescription=Coletor de Informações de Sistemas Monitorados do pelo CACIC
129 -FileVersion=2.2.0.0 129 +FileVersion=2.2.0.2
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=2.0.1.1 134 +ProductName=Col_MONI
  135 +ProductVersion=2.2.0.2
136 Comments=Baseado na licença GPL (General Public License) 136 Comments=Baseado na licença GPL (General Public License)
137 [HistoryLists\hlDebugSourcePath] 137 [HistoryLists\hlDebugSourcePath]
138 Count=1 138 Count=1
col_moni/col_moni.dpr
@@ -575,6 +575,7 @@ var tstrTripa2, tstrTripa3, v_array1, v_array2, v_array3, v_array4 : TStrings; @@ -575,6 +575,7 @@ var tstrTripa2, tstrTripa3, v_array1, v_array2, v_array3, v_array4 : TStrings;
575 575
576 begin 576 begin
577 Try 577 Try
  578 + SetValorDatMemoria('Col_Moni.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
578 // Verifica se deverá ser realizada a coleta de informações de sistemas monitorados neste 579 // Verifica se deverá ser realizada a coleta de informações de sistemas monitorados neste
579 // computador, perguntando ao agente gerente. 580 // computador, perguntando ao agente gerente.
580 log_diario('Coletando informações de Sistemas Monitorados.'); 581 log_diario('Coletando informações de Sistemas Monitorados.');
@@ -727,8 +728,8 @@ begin @@ -727,8 +728,8 @@ begin
727 Begin 728 Begin
728 strAux1 := ''; 729 strAux1 := '';
729 Try 730 Try
730 - log_debug('Buscando informação de INSTALAÇÃO em '+tstrTripa2[5]);  
731 - strAux1 := Trim(GetValorChaveRegEdit(trim(tstrTripa2[5]))); 731 + log_debug('Buscando informação de INSTALAÇÃO em '+tstrTripa2[6]);
  732 + strAux1 := Trim(GetValorChaveRegEdit(trim(tstrTripa2[6])));
732 Except 733 Except
733 End; 734 End;
734 if (strAux1 <> '') then strAux := strAux + 'S,'; 735 if (strAux1 <> '') then strAux := strAux + 'S,';
@@ -1006,6 +1007,8 @@ begin @@ -1006,6 +1007,8 @@ begin
1006 1007
1007 UVC := Trim(GetValorDatMemoria('Coletas.Sistemas_Monitorados',v_tstrCipherOpened)); 1008 UVC := Trim(GetValorDatMemoria('Coletas.Sistemas_Monitorados',v_tstrCipherOpened));
1008 1009
  1010 + SetValorDatMemoria('Col_Moni.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
  1011 +
1009 If (GetValorDatMemoria('Configs.IN_COLETA_FORCADA_MONI',v_tstrCipherOpened)='S') or (trim(strAux) <> trim(UVC)) Then 1012 If (GetValorDatMemoria('Configs.IN_COLETA_FORCADA_MONI',v_tstrCipherOpened)='S') or (trim(strAux) <> trim(UVC)) Then
1010 Begin 1013 Begin
1011 if (trim(UVC) <> '') then 1014 if (trim(UVC) <> '') then
@@ -1044,6 +1047,7 @@ begin @@ -1044,6 +1047,7 @@ begin
1044 Except 1047 Except
1045 Begin 1048 Begin
1046 SetValorDatMemoria('Col_Moni.nada', 'nada', v_tstrCipherOpened1); 1049 SetValorDatMemoria('Col_Moni.nada', 'nada', v_tstrCipherOpened1);
  1050 + SetValorDatMemoria('Col_Moni.Fim', '99999999', v_tstrCipherOpened1);
1047 CipherClose(p_path_cacic + 'temp\col_moni.dat', v_tstrCipherOpened1); 1051 CipherClose(p_path_cacic + 'temp\col_moni.dat', v_tstrCipherOpened1);
1048 End; 1052 End;
1049 End; 1053 End;
col_moni/col_moni.res
No preview for this file type
col_patr/col_patr.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=0 118 +Build=1
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -124,15 +124,15 @@ DLL=0 @@ -124,15 +124,15 @@ DLL=0
124 Locale=1046 124 Locale=1046
125 CodePage=1252 125 CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 -CompanyName=Dataprev-ES 127 +CompanyName=Dataprev-Unidade Regional Espírito Santo
128 FileDescription=Coletor de Informações de Patrimônio do Sistema CACIC 128 FileDescription=Coletor de Informações de Patrimônio do Sistema CACIC
129 -FileVersion=2.2.0.0 129 +FileVersion=2.2.0.1
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=1.0.0.0 134 +ProductName=Col_PATR
  135 +ProductVersion=2.2.0.1
136 Comments=Baseado na Licença GPL(General Public License) 136 Comments=Baseado na Licença GPL(General Public License)
137 [HistoryLists\hlDebugSourcePath] 137 [HistoryLists\hlDebugSourcePath]
138 Count=1 138 Count=1
col_patr/col_patr.res
No preview for this file type
col_patr/main_col_patr.dcu
No preview for this file type
col_patr/main_col_patr.pas
@@ -739,6 +739,7 @@ begin @@ -739,6 +739,7 @@ begin
739 strAux2 := VetorUON2Filtrado[id_unid_organizacional_nivel2.ItemIndex]; 739 strAux2 := VetorUON2Filtrado[id_unid_organizacional_nivel2.ItemIndex];
740 Except 740 Except
741 end; 741 end;
  742 + SetValorDatMemoria('Col_Patr.Fim', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
742 if (strAux1 <> var_id_unid_organizacional_nivel1) or 743 if (strAux1 <> var_id_unid_organizacional_nivel1) or
743 (strAux2 <> var_id_unid_organizacional_nivel2) or 744 (strAux2 <> var_id_unid_organizacional_nivel2) or
744 (te_localizacao_complementar.Text <> var_te_localizacao_complementar) or 745 (te_localizacao_complementar.Text <> var_te_localizacao_complementar) or
@@ -997,15 +998,19 @@ Begin @@ -997,15 +998,19 @@ Begin
997 998
998 if boolColeta then 999 if boolColeta then
999 Begin 1000 Begin
  1001 + SetValorDatMemoria('Col_Patr.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
1000 log_diario('Coletando informações de Patrimônio e Localização Física.'); 1002 log_diario('Coletando informações de Patrimônio e Localização Física.');
1001 v_configs := GetValorDatMemoria('Patrimonio.Configs',v_tstrCipherOpened); 1003 v_configs := GetValorDatMemoria('Patrimonio.Configs',v_tstrCipherOpened);
1002 log_DEBUG('Configurações obtidas: '+v_configs); 1004 log_DEBUG('Configurações obtidas: '+v_configs);
  1005 +
1003 MontaInterface; 1006 MontaInterface;
1004 MontaCombos; 1007 MontaCombos;
1005 RecuperaValoresAnteriores; 1008 RecuperaValoresAnteriores;
  1009 +
1006 End; 1010 End;
1007 Except 1011 Except
1008 SetValorDatMemoria('Col_Patr.nada','nada', v_tstrCipherOpened1); 1012 SetValorDatMemoria('Col_Patr.nada','nada', v_tstrCipherOpened1);
  1013 + SetValorDatMemoria('Col_Patr.Fim', '99999999', v_tstrCipherOpened1);
1009 CipherClose(p_path_cacic + 'temp\col_patr.dat', v_tstrCipherOpened1); 1014 CipherClose(p_path_cacic + 'temp\col_patr.dat', v_tstrCipherOpened1);
1010 Application.Terminate; 1015 Application.Terminate;
1011 End; 1016 End;
col_soft/col_soft.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=0 118 +Build=1
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -124,15 +124,15 @@ DLL=0 @@ -124,15 +124,15 @@ DLL=0
124 Locale=1046 124 Locale=1046
125 CodePage=1252 125 CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 -CompanyName=Dataprev-ES 127 +CompanyName=Dataprev-Unidade Regional Espírito Santo
128 FileDescription=Coletor de Informações de Softwares Básicos do Sistema CACIC 128 FileDescription=Coletor de Informações de Softwares Básicos do Sistema CACIC
129 -FileVersion=2.2.0.0 129 +FileVersion=2.2.0.1
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=2.0.1.1 134 +ProductName=Col_SOFT
  135 +ProductVersion=2.2.0.1
136 Comments=Baseado na licença GPL (General Public License) 136 Comments=Baseado na licença GPL (General Public License)
137 [HistoryLists\hlDebugSourcePath] 137 [HistoryLists\hlDebugSourcePath]
138 Count=1 138 Count=1
col_soft/col_soft.dpr
@@ -633,7 +633,7 @@ var te_versao_mozilla, te_versao_ie, te_versao_jre, te_versao_acrobat_reader, @@ -633,7 +633,7 @@ var te_versao_mozilla, te_versao_ie, te_versao_jre, te_versao_acrobat_reader,
633 begin 633 begin
634 Try 634 Try
635 log_diario('Coletando informações de Softwares Básicos.'); 635 log_diario('Coletando informações de Softwares Básicos.');
636 - 636 + SetValorDatMemoria('Col_Soft.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
637 te_versao_mozilla := GetVersaoMozilla; 637 te_versao_mozilla := GetVersaoMozilla;
638 te_versao_ie := GetVersaoIE; 638 te_versao_ie := GetVersaoIE;
639 te_versao_jre := GetVersaoJRE; 639 te_versao_jre := GetVersaoJRE;
@@ -719,6 +719,8 @@ begin @@ -719,6 +719,8 @@ begin
719 // Obtenho do registro o valor que foi previamente armazenado 719 // Obtenho do registro o valor que foi previamente armazenado
720 ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Software',v_tstrCipherOpened)); 720 ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Software',v_tstrCipherOpened));
721 721
  722 + SetValorDatMemoria('Col_Soft.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
  723 +
722 // Se essas informações forem diferentes significa que houve alguma alteração 724 // Se essas informações forem diferentes significa que houve alguma alteração
723 // na configuração. Nesse caso, gravo as informações no BD Central 725 // na configuração. Nesse caso, gravo as informações no BD Central
724 // e, se não houver problemas durante esse procedimento, atualizo as 726 // e, se não houver problemas durante esse procedimento, atualizo as
@@ -761,6 +763,7 @@ begin @@ -761,6 +763,7 @@ begin
761 Except 763 Except
762 Begin 764 Begin
763 SetValorDatMemoria('Col_Soft.nada', 'nada', v_tstrCipherOpened1); 765 SetValorDatMemoria('Col_Soft.nada', 'nada', v_tstrCipherOpened1);
  766 + SetValorDatMemoria('Col_Soft.Fim' , '99999999', v_tstrCipherOpened1);
764 CipherClose(p_path_cacic + 'temp\col_soft.dat', v_tstrCipherOpened1); 767 CipherClose(p_path_cacic + 'temp\col_soft.dat', v_tstrCipherOpened1);
765 End; 768 End;
766 End; 769 End;
col_soft/col_soft.res
No preview for this file type
col_undi/col_undi.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=0 118 +Build=1
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -124,15 +124,15 @@ DLL=0 @@ -124,15 +124,15 @@ DLL=0
124 Locale=1046 124 Locale=1046
125 CodePage=1252 125 CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 -CompanyName=Dataprev-ES 127 +CompanyName=Dataprev-Unidade Regional Espírito Santo
128 FileDescription=Coletor de Informações de Unidades de Disco do Sistema CACIC 128 FileDescription=Coletor de Informações de Unidades de Disco do Sistema CACIC
129 -FileVersion=2.2.0.0 129 +FileVersion=2.2.0.1
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=2.0.1.1 134 +ProductName=Col_UNDI
  135 +ProductVersion=2.2.0.1
136 Comments=Baseado na licença GPL (General Public License) 136 Comments=Baseado na licença GPL (General Public License)
137 [HistoryLists\hlDebugSourcePath] 137 [HistoryLists\hlDebugSourcePath]
138 Count=1 138 Count=1
col_undi/col_undi.dpr
@@ -492,7 +492,8 @@ var strXML, strAux, id_tipo_unid_disco, ValorChaveRegistro : String; @@ -492,7 +492,8 @@ var strXML, strAux, id_tipo_unid_disco, ValorChaveRegistro : String;
492 v_DISK : TMiTeC_Disk; 492 v_DISK : TMiTeC_Disk;
493 v_Report : TstringList; 493 v_Report : TstringList;
494 Begin 494 Begin
495 - log_diario('Coletando informações de Unidades de Disco.'); 495 + SetValorDatMemoria('Col_Undi.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
  496 + log_diario('Coletando informações de Unidades de Disco.');
496 Try 497 Try
497 strXML := '<?xml version="1.0" encoding="ISO-8859-1"?><unidades>'; 498 strXML := '<?xml version="1.0" encoding="ISO-8859-1"?><unidades>';
498 v_DISK := TMiTeC_Disk.Create(nil); 499 v_DISK := TMiTeC_Disk.Create(nil);
@@ -540,6 +541,8 @@ Begin @@ -540,6 +541,8 @@ Begin
540 // Obtenho do registro o valor que foi previamente armazenado 541 // Obtenho do registro o valor que foi previamente armazenado
541 ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.UnidadesDisco',v_tstrCipherOpened)); 542 ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.UnidadesDisco',v_tstrCipherOpened));
542 543
  544 + SetValorDatMemoria('Col_Undi.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
  545 +
543 // Se essas informações forem diferentes significa que houve alguma alteração 546 // Se essas informações forem diferentes significa que houve alguma alteração
544 // na configuração. Nesse caso, gravo as informações no BD Central e, se não houver 547 // na configuração. Nesse caso, gravo as informações no BD Central e, se não houver
545 // problemas durante esse procedimento, atualizo as informações no registro. 548 // problemas durante esse procedimento, atualizo as informações no registro.
@@ -566,6 +569,7 @@ Begin @@ -566,6 +569,7 @@ Begin
566 End; 569 End;
567 Except 570 Except
568 SetValorDatMemoria('Col_Undi.nada', 'nada', v_tstrCipherOpened1); 571 SetValorDatMemoria('Col_Undi.nada', 'nada', v_tstrCipherOpened1);
  572 + SetValorDatMemoria('Col_Undi.Fim', '99999999', v_tstrCipherOpened1);
569 CipherClose(p_path_cacic + 'temp\col_undi.dat', v_tstrCipherOpened1); 573 CipherClose(p_path_cacic + 'temp\col_undi.dat', v_tstrCipherOpened1);
570 log_diario('Problema na coleta de informações de discos.'); 574 log_diario('Problema na coleta de informações de discos.');
571 End; 575 End;
col_undi/col_undi.res
No preview for this file type
frmConfiguracoes.dcu
No preview for this file type
frmlog.dcu
No preview for this file type
frmsenha.dcu
No preview for this file type
ger_cols/ger_cols.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=23 118 +Build=27
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -124,15 +124,15 @@ DLL=0 @@ -124,15 +124,15 @@ DLL=0
124 Locale=1046 124 Locale=1046
125 CodePage=1252 125 CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 -CompanyName=Dataprev-ES 127 +CompanyName=Dataprev-Unidade Regional Espírito Santo
128 FileDescription=Módulo Gerente de Coletas do Sistema CACIC 128 FileDescription=Módulo Gerente de Coletas do Sistema CACIC
129 -FileVersion=2.2.0.23 129 +FileVersion=2.2.0.27
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=2.0.1.6 134 +ProductName=Ger_COLS
  135 +ProductVersion=2.2.0.27
136 Comments=Baseado na licença GPL (General Public License) 136 Comments=Baseado na licença GPL (General Public License)
137 [HistoryLists\hlDebugSourcePath] 137 [HistoryLists\hlDebugSourcePath]
138 Count=2 138 Count=2
ger_cols/ger_cols.dpr
@@ -76,7 +76,8 @@ var CountUPD, @@ -76,7 +76,8 @@ var CountUPD,
76 76
77 var tstrTripa1, 77 var tstrTripa1,
78 v_tstrCipherOpened, 78 v_tstrCipherOpened,
79 - v_tstrCipherOpened1 : TStrings; 79 + v_tstrCipherOpened1,
  80 + tstringsAux : TStrings;
80 81
81 var v_Debugs, 82 var v_Debugs,
82 l_cs_cipher, 83 l_cs_cipher,
@@ -140,7 +141,6 @@ begin @@ -140,7 +141,6 @@ begin
140 end; 141 end;
141 end; 142 end;
142 143
143 -  
144 function VerFmt(const MS, LS: DWORD): string; 144 function VerFmt(const MS, LS: DWORD): string;
145 // Format the version number from the given DWORDs containing the info 145 // Format the version number from the given DWORDs containing the info
146 begin 146 begin
@@ -284,6 +284,12 @@ Begin @@ -284,6 +284,12 @@ Begin
284 End; 284 End;
285 Implode := strAux; 285 Implode := strAux;
286 end; 286 end;
  287 +function abstraiCSD(p_te_so : String) : integer;
  288 + var tstrTe_so : tstrings;
  289 + Begin
  290 + tstrTe_so := Explode(p_te_so, '.');
  291 + Result := StrToInt(tstrTe_so[0] + tstrTe_so[1] + tstrTe_so[2]);
  292 + End;
287 293
288 Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String; p_tstrCipherOpened : TStrings); 294 Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String; p_tstrCipherOpened : TStrings);
289 var v_Aux : string; 295 var v_Aux : string;
@@ -472,10 +478,13 @@ begin @@ -472,10 +478,13 @@ begin
472 else 478 else
473 Result := cOsUnknown; 479 Result := cOsUnknown;
474 480
  481 + // A partir da versão 2.2.0.24, defino o valor da ID Interna e atribuo-a sem o CSDVersion à versão externa
475 v_te_so := IntToStr(platformId) + '.' + 482 v_te_so := IntToStr(platformId) + '.' +
476 IntToStr(majorVer) + '.' + 483 IntToStr(majorVer) + '.' +
477 IntToStr(minorVer) + 484 IntToStr(minorVer) +
478 IfThen(CSDVersion='','','.'+CSDVersion); 485 IfThen(CSDVersion='','','.'+CSDVersion);
  486 + if (Result = 0) then
  487 + Result := abstraiCSD(v_te_so);
479 end; 488 end;
480 489
481 procedure Matar(v_dir,v_files: string); 490 procedure Matar(v_dir,v_files: string);
@@ -1250,6 +1259,7 @@ Begin @@ -1250,6 +1259,7 @@ Begin
1250 Request_Ger_Cols:=TStringList.Create; 1259 Request_Ger_Cols:=TStringList.Create;
1251 Request_Ger_Cols.Values['te_node_address'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),l_cs_compress); 1260 Request_Ger_Cols.Values['te_node_address'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),l_cs_compress);
1252 Request_Ger_Cols.Values['id_so'] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' , v_tstrCipherOpened),l_cs_compress); 1261 Request_Ger_Cols.Values['id_so'] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' , v_tstrCipherOpened),l_cs_compress);
  1262 + Request_Ger_Cols.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
1253 Request_Ger_Cols.Values['te_ip'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' , v_tstrCipherOpened),l_cs_compress); 1263 Request_Ger_Cols.Values['te_ip'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' , v_tstrCipherOpened),l_cs_compress);
1254 Request_Ger_Cols.Values['id_ip_rede'] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress); 1264 Request_Ger_Cols.Values['id_ip_rede'] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress);
1255 Request_Ger_Cols.Values['te_workgroup'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' , v_tstrCipherOpened),l_cs_compress); 1265 Request_Ger_Cols.Values['te_workgroup'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' , v_tstrCipherOpened),l_cs_compress);
@@ -1472,7 +1482,8 @@ Begin @@ -1472,7 +1482,8 @@ Begin
1472 Begin 1482 Begin
1473 if (v_Tamanho_Arquivo = '0') or (v_Tamanho_Arquivo = '-1') or (trim(GetVersionInfo(p_Dir_Inst + p_File + '.exe'))='0.0.0.0') then 1483 if (v_Tamanho_Arquivo = '0') or (v_Tamanho_Arquivo = '-1') or (trim(GetVersionInfo(p_Dir_Inst + p_File + '.exe'))='0.0.0.0') then
1474 Begin 1484 Begin
1475 - if (p_Medir_FTP) then Result := 1 1485 + if (p_Medir_FTP) then
  1486 + Result := 1
1476 else 1487 else
1477 Begin 1488 Begin
1478 log_diario(p_Nome_Modulo + ' corrompido'); 1489 log_diario(p_Nome_Modulo + ' corrompido');
@@ -2000,6 +2011,8 @@ Begin @@ -2000,6 +2011,8 @@ Begin
2000 Batchfile.SaveToFile(p_path_cacic + 'Temp\ipconfig.vbs'); 2011 Batchfile.SaveToFile(p_path_cacic + 'Temp\ipconfig.vbs');
2001 BatchFile.Free; 2012 BatchFile.Free;
2002 v_acao_gercols := 'Invocando execução de VBS para obtenção de IPCONFIG...'; 2013 v_acao_gercols := 'Invocando execução de VBS para obtenção de IPCONFIG...';
  2014 + log_DEBUG('Executando "'+p_path_cacic + 'modulos\' + v_scripter + ' //b ' + p_path_cacic + 'temp\ipconfig.vbs"');
  2015 +
2003 WinExec(PChar(p_path_cacic + 'modulos\' + v_scripter + ' //b ' + p_path_cacic + 'temp\ipconfig.vbs'), SW_HIDE); 2016 WinExec(PChar(p_path_cacic + 'modulos\' + v_scripter + ' //b ' + p_path_cacic + 'temp\ipconfig.vbs'), SW_HIDE);
2004 Except 2017 Except
2005 Begin 2018 Begin
@@ -2130,7 +2143,8 @@ Begin @@ -2130,7 +2143,8 @@ Begin
2130 if (te_wins_primario='') then Try te_wins_primario := PegaDadosIPConfig(v_array_campos,v_array_valores,'servidor,wins,prim;wins,server,primary','') Except te_wins_primario := ''; end; 2143 if (te_wins_primario='') then Try te_wins_primario := PegaDadosIPConfig(v_array_campos,v_array_valores,'servidor,wins,prim;wins,server,primary','') Except te_wins_primario := ''; end;
2131 if (te_wins_secundario='') then Try te_wins_secundario := PegaDadosIPConfig(v_array_campos,v_array_valores,'servidor,wins,secund;wins,server,secondary','') Except te_wins_secundario := ''; end; 2144 if (te_wins_secundario='') then Try te_wins_secundario := PegaDadosIPConfig(v_array_campos,v_array_valores,'servidor,wins,secund;wins,server,secondary','') Except te_wins_secundario := ''; end;
2132 2145
2133 - if (GetWinVer > 5) then //Se NT/2K/XP 2146 + if ((GetWinVer <> 0) and (GetWinVer > 5)) or
  2147 + (abstraiCSD(v_te_so) >= 250) then //Se NT/2K/XP
2134 Try te_dominio_windows := PegaDadosIPConfig(v_array_campos,v_array_valores,'usu,rio,logado;usu,rio,logado','') Except te_dominio_windows := 'Não Identificado'; end 2148 Try te_dominio_windows := PegaDadosIPConfig(v_array_campos,v_array_valores,'usu,rio,logado;usu,rio,logado','') Except te_dominio_windows := 'Não Identificado'; end
2135 else 2149 else
2136 Try te_dominio_windows := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP32\NetworkProvider\AuthenticatingAgent') + '\' + GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Network\Logon\username') Except te_dominio_windows := 'Não Identificado'; end 2150 Try te_dominio_windows := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP32\NetworkProvider\AuthenticatingAgent') + '\' + GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Network\Logon\username') Except te_dominio_windows := 'Não Identificado'; end
@@ -2411,7 +2425,8 @@ Begin @@ -2411,7 +2425,8 @@ Begin
2411 if (te_dominio_windows = '') then 2425 if (te_dominio_windows = '') then
2412 Begin 2426 Begin
2413 Try 2427 Try
2414 - if (GetWinVer > 5) then //Se NT/2K/XP 2428 + if ((GetWinVer <> 0) and (GetWinVer > 5)) or
  2429 + (abstraiCSD(v_te_so) >= 250) then //Se NT/2K/XP
2415 te_dominio_windows := GetDomainName + '\' + GetNetworkUserName 2430 te_dominio_windows := GetDomainName + '\' + GetNetworkUserName
2416 else 2431 else
2417 te_dominio_windows := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP32\NetworkProvider\AuthenticatingAgent') + '\' + GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Network\Logon\username'); 2432 te_dominio_windows := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP32\NetworkProvider\AuthenticatingAgent') + '\' + GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Network\Logon\username');
@@ -2422,6 +2437,7 @@ Begin @@ -2422,6 +2437,7 @@ Begin
2422 Request_SVG := TStringList.Create; 2437 Request_SVG := TStringList.Create;
2423 Request_SVG.Values['te_node_address'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),l_cs_compress); 2438 Request_SVG.Values['te_node_address'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),l_cs_compress);
2424 Request_SVG.Values['id_so'] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' , v_tstrCipherOpened),l_cs_compress); 2439 Request_SVG.Values['id_so'] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' , v_tstrCipherOpened),l_cs_compress);
  2440 + Request_SVG.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
2425 Request_SVG.Values['id_ip_rede'] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress); 2441 Request_SVG.Values['id_ip_rede'] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress);
2426 Request_SVG.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', v_tstrCipherOpened),l_cs_compress); 2442 Request_SVG.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', v_tstrCipherOpened),l_cs_compress);
2427 Request_SVG.Values['te_ip'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' , v_tstrCipherOpened),l_cs_compress); 2443 Request_SVG.Values['te_ip'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' , v_tstrCipherOpened),l_cs_compress);
@@ -2525,7 +2541,8 @@ Begin @@ -2525,7 +2541,8 @@ Begin
2525 Begin 2541 Begin
2526 v_acao_gercols := 'Configurando diretório para o CACIC. (Registry para w95/95OSR2/98/98SE/ME)'; 2542 v_acao_gercols := 'Configurando diretório para o CACIC. (Registry para w95/95OSR2/98/98SE/ME)';
2527 // Identifico a versão do Windows 2543 // Identifico a versão do Windows
2528 - If (GetWinVer <= 5) then 2544 + If ((GetWinVer <> 0) and (GetWinVer <= 5)) or
  2545 + (abstraiCSD(v_te_so) < 250) then
2529 begin 2546 begin
2530 //Se for 95/95OSR2/98/98SE/ME faço aqui... (Em NT Like isto é feito no LoginScript) 2547 //Se for 95/95OSR2/98/98SE/ME faço aqui... (Em NT Like isto é feito no LoginScript)
2531 SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2', Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))) + '\cacic2.exe'); 2548 SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2', Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))) + '\cacic2.exe');
@@ -2568,6 +2585,12 @@ Begin @@ -2568,6 +2585,12 @@ Begin
2568 log_DEBUG('Parâmetro(opção) /coletas recebido...'); 2585 log_DEBUG('Parâmetro(opção) /coletas recebido...');
2569 v_acao_gercols := 'Ger_Cols invocado para coletas...'; 2586 v_acao_gercols := 'Ger_Cols invocado para coletas...';
2570 2587
  2588 + // Verificando o registro de coletas do dia e eliminando datas diferentes...
  2589 + strAux := GetValorDatMemoria('Coletas.HOJE', v_tstrCipherOpened);
  2590 + if (strAux = '') or
  2591 + (copy(strAux,0,8) <> FormatDateTime('yyyymmdd', Date)) then
  2592 + SetValorDatMemoria('Coletas.HOJE', FormatDateTime('yyyymmdd', Date),v_tstrCipherOpened);
  2593 +
2571 BuscaConfigs(true); 2594 BuscaConfigs(true);
2572 2595
2573 // Abaixo eu testo se existe um endereço configurado para não disparar os procedimentos de coleta em vão. 2596 // Abaixo eu testo se existe um endereço configurado para não disparar os procedimentos de coleta em vão.
@@ -2782,6 +2805,7 @@ Begin @@ -2782,6 +2805,7 @@ Begin
2782 Request_Ger_Cols.Values['in_chkcacic'] := EnCrypt('chkcacic',l_cs_compress); 2805 Request_Ger_Cols.Values['in_chkcacic'] := EnCrypt('chkcacic',l_cs_compress);
2783 Request_Ger_Cols.Values['te_fila_ftp'] := EnCrypt('2',l_cs_compress); // Indicará sucesso na operação de FTP e liberará lugar para o próximo 2806 Request_Ger_Cols.Values['te_fila_ftp'] := EnCrypt('2',l_cs_compress); // Indicará sucesso na operação de FTP e liberará lugar para o próximo
2784 Request_Ger_Cols.Values['id_ftp'] := EnCrypt(GetValorDatMemoria('Configs.ID_FTP',v_tstrCipherOpened),l_cs_compress); // Indicará sucesso na operação de FTP e liberará lugar para o próximo 2807 Request_Ger_Cols.Values['id_ftp'] := EnCrypt(GetValorDatMemoria('Configs.ID_FTP',v_tstrCipherOpened),l_cs_compress); // Indicará sucesso na operação de FTP e liberará lugar para o próximo
  2808 + Request_Ger_Cols.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
2785 Request_Ger_Cols.Values['id_ip_estacao'] := EnCrypt(GetIP,l_cs_compress); // Informará o IP para registro na tabela redes_grupos_FTP 2809 Request_Ger_Cols.Values['id_ip_estacao'] := EnCrypt(GetIP,l_cs_compress); // Informará o IP para registro na tabela redes_grupos_FTP
2786 ComunicaServidor('get_config.php', Request_Ger_Cols, '>> Liberando Grupo FTP!...'); 2810 ComunicaServidor('get_config.php', Request_Ger_Cols, '>> Liberando Grupo FTP!...');
2787 Request_Ger_Cols.Free; 2811 Request_Ger_Cols.Free;
@@ -2804,7 +2828,7 @@ Begin @@ -2804,7 +2828,7 @@ Begin
2804 if not FileExists(p_path_cacic + 'Temp\ger_cols.exe') and 2828 if not FileExists(p_path_cacic + 'Temp\ger_cols.exe') and
2805 not FileExists(p_path_cacic + 'modulos\ger_cols.exe') then 2829 not FileExists(p_path_cacic + 'modulos\ger_cols.exe') then
2806 log_diario('Módulo Gerente de Coletas inexistente.') 2830 log_diario('Módulo Gerente de Coletas inexistente.')
2807 - else log_diario('Nenhuma coleta configurada para essa subrede.'); 2831 + else log_diario('Nenhuma coleta configurada para essa subrede / estação / S.O.');
2808 end; 2832 end;
2809 End; 2833 End;
2810 end; 2834 end;
@@ -2824,11 +2848,21 @@ Begin @@ -2824,11 +2848,21 @@ Begin
2824 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_anvi.dat encontrado.'); 2848 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_anvi.dat encontrado.');
2825 v_acao_gercols := '* Preparando envio de informações de Anti-Vírus.'; 2849 v_acao_gercols := '* Preparando envio de informações de Anti-Vírus.';
2826 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_anvi.dat'); 2850 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_anvi.dat');
  2851 +
  2852 + // Armazeno dados para informações de coletas na data, via menu popup do Systray
  2853 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+'#Informações sobre Anti-Vírus OfficeScan', v_tstrCipherOpened);
  2854 +
  2855 + // Armazeno as horas de início e fim das coletas
  2856 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Anvi.Inicio',v_tstrCipherOpened1), v_tstrCipherOpened);
  2857 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Anvi.Fim',v_tstrCipherOpened1), v_tstrCipherOpened);
  2858 +
2827 if (GetValorDatMemoria('Col_Anvi.nada',v_tstrCipherOpened1)='') then 2859 if (GetValorDatMemoria('Col_Anvi.nada',v_tstrCipherOpened1)='') then
2828 Begin 2860 Begin
  2861 +
2829 // Dados para uso do Gerente WEB... 2862 // Dados para uso do Gerente WEB...
2830 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress); 2863 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
2831 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress); 2864 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  2865 + Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
2832 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress); 2866 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
2833 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress); 2867 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
2834 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress); 2868 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
@@ -2847,13 +2881,24 @@ Begin @@ -2847,13 +2881,24 @@ Begin
2847 2881
2848 if (ComunicaServidor('set_officescan.php', Request_Ger_Cols, '>> Enviando informações de Antivírus OfficeScan para o Gerente WEB.') <> '0') Then 2882 if (ComunicaServidor('set_officescan.php', Request_Ger_Cols, '>> Enviando informações de Antivírus OfficeScan para o Gerente WEB.') <> '0') Then
2849 Begin 2883 Begin
  2884 + // Armazeno o Status Positivo de Envio
  2885 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',1', v_tstrCipherOpened);
  2886 +
2850 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD 2887 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD
2851 //Sobreponho a informação no registro para posterior comparação, na próxima execução. 2888 //Sobreponho a informação no registro para posterior comparação, na próxima execução.
2852 strAux := GetValorDatMemoria('Col_Anvi.UVC',v_tstrCipherOpened1); 2889 strAux := GetValorDatMemoria('Col_Anvi.UVC',v_tstrCipherOpened1);
2853 SetValorDatMemoria('Coletas.OfficeScan',strAux, v_tstrCipherOpened) ; 2890 SetValorDatMemoria('Coletas.OfficeScan',strAux, v_tstrCipherOpened) ;
2854 intAux := 1; 2891 intAux := 1;
2855 - End;  
2856 - End; 2892 + End
  2893 + else
  2894 + // Armazeno o Status Negativo de Envio
  2895 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',-1', v_tstrCipherOpened);
  2896 +
  2897 + End
  2898 + Else
  2899 + // Armazeno o Status Nulo de Envio
  2900 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',0', v_tstrCipherOpened);
  2901 +
2857 Request_Ger_Cols.Clear; 2902 Request_Ger_Cols.Clear;
2858 Matar(p_path_cacic+'Temp\','col_anvi.dat'); 2903 Matar(p_path_cacic+'Temp\','col_anvi.dat');
2859 End; 2904 End;
@@ -2863,11 +2908,20 @@ Begin @@ -2863,11 +2908,20 @@ Begin
2863 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_comp.dat encontrado.'); 2908 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_comp.dat encontrado.');
2864 v_acao_gercols := '* Preparando envio de informações de Compartilhamentos.'; 2909 v_acao_gercols := '* Preparando envio de informações de Compartilhamentos.';
2865 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_comp.dat'); 2910 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_comp.dat');
  2911 +
  2912 + // Armazeno dados para informações de coletas na data, via menu popup do Systray
  2913 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+'#Informações sobre Compartilhamentos', v_tstrCipherOpened);
  2914 +
  2915 + // Armazeno as horas de início e fim das coletas
  2916 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Comp.Inicio',v_tstrCipherOpened1), v_tstrCipherOpened);
  2917 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Comp.Fim',v_tstrCipherOpened1), v_tstrCipherOpened);
  2918 +
2866 if (GetValorDatMemoria('Col_Comp.nada',v_tstrCipherOpened1)='') then 2919 if (GetValorDatMemoria('Col_Comp.nada',v_tstrCipherOpened1)='') then
2867 Begin 2920 Begin
2868 // Dados para uso do Gerente WEB... 2921 // Dados para uso do Gerente WEB...
2869 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress); 2922 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
2870 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress); 2923 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  2924 + Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
2871 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress); 2925 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
2872 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress); 2926 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
2873 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress); 2927 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
@@ -2881,13 +2935,23 @@ Begin @@ -2881,13 +2935,23 @@ Begin
2881 2935
2882 if (ComunicaServidor('set_compart.php', Request_Ger_Cols, '>> Enviando informações de Compartilhamentos para o Gerente WEB.') <> '0') Then 2936 if (ComunicaServidor('set_compart.php', Request_Ger_Cols, '>> Enviando informações de Compartilhamentos para o Gerente WEB.') <> '0') Then
2883 Begin 2937 Begin
  2938 + // Armazeno o Status Positivo de Envio
  2939 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',1', v_tstrCipherOpened);
  2940 +
2884 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD 2941 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD
2885 //Sobreponho a informação no registro para posterior comparação, na próxima execução. 2942 //Sobreponho a informação no registro para posterior comparação, na próxima execução.
2886 strAux := GetValorDatMemoria('Col_Comp.UVC',v_tstrCipherOpened1); 2943 strAux := GetValorDatMemoria('Col_Comp.UVC',v_tstrCipherOpened1);
2887 SetValorDatMemoria('Coletas.Compartilhamentos', strAux, v_tstrCipherOpened); 2944 SetValorDatMemoria('Coletas.Compartilhamentos', strAux, v_tstrCipherOpened);
2888 intAux := 1; 2945 intAux := 1;
2889 - End;  
2890 - End; 2946 + End
  2947 + Else
  2948 + // Armazeno o Status Negativo de Envio
  2949 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',-1', v_tstrCipherOpened);
  2950 + End
  2951 + else
  2952 + // Armazeno o Status Nulo de Envio
  2953 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',0', v_tstrCipherOpened);
  2954 +
2891 Request_Ger_Cols.Clear; 2955 Request_Ger_Cols.Clear;
2892 Matar(p_path_cacic+'Temp\','col_comp.dat'); 2956 Matar(p_path_cacic+'Temp\','col_comp.dat');
2893 End; 2957 End;
@@ -2897,11 +2961,20 @@ Begin @@ -2897,11 +2961,20 @@ Begin
2897 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_hard.dat encontrado.'); 2961 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_hard.dat encontrado.');
2898 v_acao_gercols := '* Preparando envio de informações de Hardware.'; 2962 v_acao_gercols := '* Preparando envio de informações de Hardware.';
2899 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_hard.dat'); 2963 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_hard.dat');
  2964 +
  2965 + // Armazeno dados para informações de coletas na data, via menu popup do Systray
  2966 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+'#Informações sobre Hardware', v_tstrCipherOpened);
  2967 +
  2968 + // Armazeno as horas de início e fim das coletas
  2969 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Hard.Inicio',v_tstrCipherOpened1), v_tstrCipherOpened);
  2970 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Hard.Fim',v_tstrCipherOpened1), v_tstrCipherOpened);
  2971 +
2900 if (GetValorDatMemoria('Col_Hard.nada',v_tstrCipherOpened1)='') then 2972 if (GetValorDatMemoria('Col_Hard.nada',v_tstrCipherOpened1)='') then
2901 Begin 2973 Begin
2902 // Dados para uso do Gerente WEB... 2974 // Dados para uso do Gerente WEB...
2903 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress); 2975 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
2904 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress); 2976 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  2977 + Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
2905 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress); 2978 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
2906 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress); 2979 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
2907 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress); 2980 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
@@ -2935,13 +3008,23 @@ Begin @@ -2935,13 +3008,23 @@ Begin
2935 3008
2936 if (ComunicaServidor('set_hardware.php', Request_Ger_Cols, '>> Enviando informações de Hardware para o Gerente WEB.') <> '0') Then 3009 if (ComunicaServidor('set_hardware.php', Request_Ger_Cols, '>> Enviando informações de Hardware para o Gerente WEB.') <> '0') Then
2937 Begin 3010 Begin
  3011 + // Armazeno o Status Positivo de Envio
  3012 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',1', v_tstrCipherOpened);
  3013 +
2938 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD 3014 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD
2939 //Sobreponho a informação no registro para posterior comparação, na próxima execução. 3015 //Sobreponho a informação no registro para posterior comparação, na próxima execução.
2940 strAux :=GetValorDatMemoria('Col_Hard.UVC',v_tstrCipherOpened1); 3016 strAux :=GetValorDatMemoria('Col_Hard.UVC',v_tstrCipherOpened1);
2941 SetValorDatMemoria('Coletas.Hardware', strAux, v_tstrCipherOpened); 3017 SetValorDatMemoria('Coletas.Hardware', strAux, v_tstrCipherOpened);
2942 intAux := 1; 3018 intAux := 1;
2943 - End;  
2944 - End; 3019 + End
  3020 + else
  3021 + // Armazeno o Status Negativo de Envio
  3022 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',-1', v_tstrCipherOpened);
  3023 + End
  3024 + else
  3025 + // Armazeno o Status Nulo de Envio
  3026 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',0', v_tstrCipherOpened);
  3027 +
2945 Request_Ger_Cols.Clear; 3028 Request_Ger_Cols.Clear;
2946 Matar(p_path_cacic+'Temp\','col_hard.dat'); 3029 Matar(p_path_cacic+'Temp\','col_hard.dat');
2947 End; 3030 End;
@@ -2951,11 +3034,20 @@ Begin @@ -2951,11 +3034,20 @@ Begin
2951 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_patr.dat encontrado.'); 3034 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_patr.dat encontrado.');
2952 v_acao_gercols := '* Preparando envio de informações de Patrimônio.'; 3035 v_acao_gercols := '* Preparando envio de informações de Patrimônio.';
2953 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_patr.dat'); 3036 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_patr.dat');
  3037 +
  3038 + // Armazeno dados para informações de coletas na data, via menu popup do Systray
  3039 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+'#Informações Patrimoniais', v_tstrCipherOpened);
  3040 +
  3041 + // Armazeno as horas de início e fim das coletas
  3042 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Patr.Inicio',v_tstrCipherOpened1), v_tstrCipherOpened);
  3043 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Patr.Fim',v_tstrCipherOpened1), v_tstrCipherOpened);
  3044 +
2954 if (GetValorDatMemoria('Col_Patr.nada',v_tstrCipherOpened1)='') then 3045 if (GetValorDatMemoria('Col_Patr.nada',v_tstrCipherOpened1)='') then
2955 Begin 3046 Begin
2956 // Dados para uso do Gerente WEB... 3047 // Dados para uso do Gerente WEB...
2957 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress); 3048 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
2958 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress); 3049 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  3050 + Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
2959 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress); 3051 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
2960 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress); 3052 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
2961 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress); 3053 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
@@ -2978,6 +3070,9 @@ Begin @@ -2978,6 +3070,9 @@ Begin
2978 3070
2979 if (ComunicaServidor('set_patrimonio.php', Request_Ger_Cols, '>> Enviando informações de Patrimônio para o Gerente WEB.') <> '0') Then 3071 if (ComunicaServidor('set_patrimonio.php', Request_Ger_Cols, '>> Enviando informações de Patrimônio para o Gerente WEB.') <> '0') Then
2980 Begin 3072 Begin
  3073 + // Armazeno o Status Positivo de Envio
  3074 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',1', v_tstrCipherOpened);
  3075 +
2981 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD 3076 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD
2982 //Sobreponho a informação no registro para posterior comparação, na próxima execução. 3077 //Sobreponho a informação no registro para posterior comparação, na próxima execução.
2983 SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1', GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel1',v_tstrCipherOpened1), v_tstrCipherOpened); 3078 SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1', GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel1',v_tstrCipherOpened1), v_tstrCipherOpened);
@@ -2991,9 +3086,15 @@ Begin @@ -2991,9 +3086,15 @@ Begin
2991 SetValorDatMemoria('Patrimonio.te_info_patrimonio6' , GetValorDatMemoria('Col_Patr.te_info_patrimonio6' ,v_tstrCipherOpened1), v_tstrCipherOpened); 3086 SetValorDatMemoria('Patrimonio.te_info_patrimonio6' , GetValorDatMemoria('Col_Patr.te_info_patrimonio6' ,v_tstrCipherOpened1), v_tstrCipherOpened);
2992 SetValorDatMemoria('Patrimonio.ultima_rede_obtida' , GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened) , v_tstrCipherOpened); 3087 SetValorDatMemoria('Patrimonio.ultima_rede_obtida' , GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened) , v_tstrCipherOpened);
2993 intAux := 1; 3088 intAux := 1;
2994 - End; 3089 + End
  3090 + else
  3091 + // Armazeno o Status Negativo de Envio
  3092 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',-1', v_tstrCipherOpened);
  3093 + End
  3094 + else
  3095 + // Armazeno o Status Nulo de Envio
  3096 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',0', v_tstrCipherOpened);
2995 3097
2996 - End;  
2997 Request_Ger_Cols.Clear; 3098 Request_Ger_Cols.Clear;
2998 Matar(p_path_cacic+'Temp\','col_patr.dat'); 3099 Matar(p_path_cacic+'Temp\','col_patr.dat');
2999 End; 3100 End;
@@ -3003,11 +3104,20 @@ Begin @@ -3003,11 +3104,20 @@ Begin
3003 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_moni.dat encontrado.'); 3104 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_moni.dat encontrado.');
3004 v_acao_gercols := '* Preparando envio de informações de Sistemas Monitorados.'; 3105 v_acao_gercols := '* Preparando envio de informações de Sistemas Monitorados.';
3005 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_moni.dat'); 3106 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_moni.dat');
  3107 +
  3108 + // Armazeno dados para informações de coletas na data, via menu popup do Systray
  3109 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+'#Informações sobre Sistemas Monitorados', v_tstrCipherOpened);
  3110 +
  3111 + // Armazeno as horas de início e fim das coletas
  3112 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Moni.Inicio',v_tstrCipherOpened1), v_tstrCipherOpened);
  3113 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Moni.Fim',v_tstrCipherOpened1), v_tstrCipherOpened);
  3114 +
3006 if (GetValorDatMemoria('Col_Moni.nada',v_tstrCipherOpened1)='') then 3115 if (GetValorDatMemoria('Col_Moni.nada',v_tstrCipherOpened1)='') then
3007 Begin 3116 Begin
3008 // Dados para uso do Gerente WEB... 3117 // Dados para uso do Gerente WEB...
3009 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress); 3118 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
3010 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress); 3119 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  3120 + Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
3011 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress); 3121 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
3012 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress); 3122 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
3013 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress); 3123 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
@@ -3022,13 +3132,23 @@ Begin @@ -3022,13 +3132,23 @@ Begin
3022 3132
3023 if (ComunicaServidor('set_monitorado.php', Request_Ger_Cols, '>> Enviando informações de Sistemas Monitorados para o Gerente WEB.') <> '0') Then 3133 if (ComunicaServidor('set_monitorado.php', Request_Ger_Cols, '>> Enviando informações de Sistemas Monitorados para o Gerente WEB.') <> '0') Then
3024 Begin 3134 Begin
  3135 + // Armazeno o Status Positivo de Envio
  3136 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',1', v_tstrCipherOpened);
  3137 +
3025 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD 3138 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD
3026 //Sobreponho a informação no registro para posterior comparação, na próxima execução. 3139 //Sobreponho a informação no registro para posterior comparação, na próxima execução.
3027 strAux := GetValorDatMemoria('Col_Moni.UVC',v_tstrCipherOpened1); 3140 strAux := GetValorDatMemoria('Col_Moni.UVC',v_tstrCipherOpened1);
3028 SetValorDatMemoria('Coletas.Sistemas_Monitorados', strAux, v_tstrCipherOpened); 3141 SetValorDatMemoria('Coletas.Sistemas_Monitorados', strAux, v_tstrCipherOpened);
3029 intAux := 1; 3142 intAux := 1;
3030 - End;  
3031 - End; 3143 + End
  3144 + else
  3145 + // Armazeno o Status Negativo de Envio
  3146 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',-1', v_tstrCipherOpened);
  3147 + End
  3148 + else
  3149 + // Armazeno o Status Nulo de Envio
  3150 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',0', v_tstrCipherOpened);
  3151 +
3032 Request_Ger_Cols.Clear; 3152 Request_Ger_Cols.Clear;
3033 Matar(p_path_cacic+'Temp\','col_moni.dat'); 3153 Matar(p_path_cacic+'Temp\','col_moni.dat');
3034 End; 3154 End;
@@ -3038,11 +3158,20 @@ Begin @@ -3038,11 +3158,20 @@ Begin
3038 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_soft.dat encontrado.'); 3158 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_soft.dat encontrado.');
3039 v_acao_gercols := '* Preparando envio de informações de Softwares.'; 3159 v_acao_gercols := '* Preparando envio de informações de Softwares.';
3040 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_soft.dat'); 3160 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_soft.dat');
  3161 +
  3162 + // Armazeno dados para informações de coletas na data, via menu popup do Systray
  3163 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+'#Informações sobre Softwares', v_tstrCipherOpened);
  3164 +
  3165 + // Armazeno as horas de início e fim das coletas
  3166 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Soft.Inicio',v_tstrCipherOpened1), v_tstrCipherOpened);
  3167 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Soft.Fim',v_tstrCipherOpened1), v_tstrCipherOpened);
  3168 +
3041 if (GetValorDatMemoria('Col_Soft.nada',v_tstrCipherOpened1)='') then 3169 if (GetValorDatMemoria('Col_Soft.nada',v_tstrCipherOpened1)='') then
3042 Begin 3170 Begin
3043 // Dados para uso do Gerente WEB... 3171 // Dados para uso do Gerente WEB...
3044 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress); 3172 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
3045 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress); 3173 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  3174 + Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
3046 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress); 3175 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
3047 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress); 3176 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
3048 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress); 3177 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
@@ -3069,13 +3198,23 @@ Begin @@ -3069,13 +3198,23 @@ Begin
3069 3198
3070 if (ComunicaServidor('set_software.php', Request_Ger_Cols, '>> Enviando informações de Softwares Básicos para o Gerente WEB.') <> '0') Then 3199 if (ComunicaServidor('set_software.php', Request_Ger_Cols, '>> Enviando informações de Softwares Básicos para o Gerente WEB.') <> '0') Then
3071 Begin 3200 Begin
  3201 + // Armazeno o Status Positivo de Envio
  3202 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',1', v_tstrCipherOpened);
  3203 +
3072 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD 3204 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD
3073 // Sobreponho a informação no registro para posterior comparação, na próxima execução. 3205 // Sobreponho a informação no registro para posterior comparação, na próxima execução.
3074 strAux := GetValorDatMemoria('Col_Soft.UVC',v_tstrCipherOpened1); 3206 strAux := GetValorDatMemoria('Col_Soft.UVC',v_tstrCipherOpened1);
3075 SetValorDatMemoria('Coletas.Software', strAux, v_tstrCipherOpened); 3207 SetValorDatMemoria('Coletas.Software', strAux, v_tstrCipherOpened);
3076 intAux := 1; 3208 intAux := 1;
3077 - End;  
3078 - End; 3209 + End
  3210 + else
  3211 + // Armazeno o Status Negativo de Envio
  3212 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',-1', v_tstrCipherOpened);
  3213 + End
  3214 + else
  3215 + // Armazeno o Status Nulo de Envio
  3216 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',0', v_tstrCipherOpened);
  3217 +
3079 Request_Ger_Cols.Clear; 3218 Request_Ger_Cols.Clear;
3080 Matar(p_path_cacic+'Temp\','col_soft.dat'); 3219 Matar(p_path_cacic+'Temp\','col_soft.dat');
3081 End; 3220 End;
@@ -3085,11 +3224,20 @@ Begin @@ -3085,11 +3224,20 @@ Begin
3085 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_undi.dat encontrado.'); 3224 log_DEBUG('Indicador '+p_path_cacic + 'Temp\col_undi.dat encontrado.');
3086 v_acao_gercols := '* Preparando envio de informações de Unidades de Disco.'; 3225 v_acao_gercols := '* Preparando envio de informações de Unidades de Disco.';
3087 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_undi.dat'); 3226 v_tstrCipherOpened1 := CipherOpen(p_path_cacic + 'Temp\col_undi.dat');
  3227 +
  3228 + // Armazeno dados para informações de coletas na data, via menu popup do Systray
  3229 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+'#Informações sobre Unidades de Disco', v_tstrCipherOpened);
  3230 +
  3231 + // Armazeno as horas de início e fim das coletas
  3232 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Undi.Inicio',v_tstrCipherOpened1), v_tstrCipherOpened);
  3233 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+','+GetValorDatMemoria('Col_Undi.Fim',v_tstrCipherOpened1), v_tstrCipherOpened);
  3234 +
3088 if (GetValorDatMemoria('Col_Undi.nada',v_tstrCipherOpened1)='') then 3235 if (GetValorDatMemoria('Col_Undi.nada',v_tstrCipherOpened1)='') then
3089 Begin 3236 Begin
3090 // Dados para uso do Gerente WEB... 3237 // Dados para uso do Gerente WEB...
3091 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress); 3238 Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
3092 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress); 3239 Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  3240 + Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
3093 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress); 3241 Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
3094 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress); 3242 Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
3095 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress); 3243 Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
@@ -3104,13 +3252,23 @@ Begin @@ -3104,13 +3252,23 @@ Begin
3104 3252
3105 if (ComunicaServidor('set_unid_discos.php', Request_Ger_Cols, '>> Enviando informações de Unidades de Disco para o Gerente WEB.') <> '0') Then 3253 if (ComunicaServidor('set_unid_discos.php', Request_Ger_Cols, '>> Enviando informações de Unidades de Disco para o Gerente WEB.') <> '0') Then
3106 Begin 3254 Begin
  3255 + // Armazeno o Status Positivo de Envio
  3256 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',1', v_tstrCipherOpened);
  3257 +
3107 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD 3258 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD
3108 //Sobreponho a informação no registro para posterior comparação, na próxima execução. 3259 //Sobreponho a informação no registro para posterior comparação, na próxima execução.
3109 strAux := GetValorDatMemoria('Col_Undi.UVC',v_tstrCipherOpened1); 3260 strAux := GetValorDatMemoria('Col_Undi.UVC',v_tstrCipherOpened1);
3110 SetValorDatMemoria('Coletas.UnidadesDisco', strAux, v_tstrCipherOpened); 3261 SetValorDatMemoria('Coletas.UnidadesDisco', strAux, v_tstrCipherOpened);
3111 intAux := 1; 3262 intAux := 1;
3112 - End;  
3113 - End; 3263 + End
  3264 + else
  3265 + // Armazeno o Status Negativo de Envio
  3266 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',-1', v_tstrCipherOpened);
  3267 + End
  3268 + else
  3269 + // Armazeno o Status Nulo de Envio
  3270 + SetValorDatMemoria('Coletas.HOJE',GetValorDatMemoria('Coletas.HOJE',v_tstrCipherOpened)+',0', v_tstrCipherOpened);
  3271 +
3114 Request_Ger_Cols.Clear; 3272 Request_Ger_Cols.Clear;
3115 Matar(p_path_cacic+'Temp\','col_undi.dat'); 3273 Matar(p_path_cacic+'Temp\','col_undi.dat');
3116 End; 3274 End;
@@ -3171,7 +3329,8 @@ begin @@ -3171,7 +3329,8 @@ begin
3171 3329
3172 // De acordo com a versão do OS, determino o ShellCommand para chamadas externas. 3330 // De acordo com a versão do OS, determino o ShellCommand para chamadas externas.
3173 p_Shell_Command := 'command.com /c '; 3331 p_Shell_Command := 'command.com /c ';
3174 - if (GetWinVer > 5) then p_Shell_Command := 'cmd.exe /c '; //NT/2K/XP 3332 + if ((GetWinVer <> 0) and (GetWinVer > 5)) or
  3333 + (abstraiCSD(v_te_so) >= 250) then p_Shell_Command := 'cmd.exe /c '; //NT/2K/XP
3175 3334
3176 if not DirectoryExists(p_path_cacic + 'Temp') then 3335 if not DirectoryExists(p_path_cacic + 'Temp') then
3177 ForceDirectories(p_path_cacic + 'Temp'); 3336 ForceDirectories(p_path_cacic + 'Temp');
@@ -3200,6 +3359,9 @@ begin @@ -3200,6 +3359,9 @@ begin
3200 ChecaCipher; 3359 ChecaCipher;
3201 ChecaCompress; 3360 ChecaCompress;
3202 3361
  3362 + // Provoco a alimentação da variável v_te_so, para uso nas comunicações com o Gerente WEB.
  3363 + GetWinVer;
  3364 +
3203 Executa_Ger_Cols; 3365 Executa_Ger_Cols;
3204 Finalizar(true); 3366 Finalizar(true);
3205 End; 3367 End;
ger_cols/ger_cols.res
No preview for this file type
ini_cols/ini_cols.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=2 115 MajorVer=2
116 MinorVer=2 116 MinorVer=2
117 Release=0 117 Release=0
118 -Build=1 118 +Build=2
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -124,15 +124,15 @@ DLL=0 @@ -124,15 +124,15 @@ DLL=0
124 Locale=1046 124 Locale=1046
125 CodePage=1252 125 CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 -CompanyName=Dataprev - ESES.P 127 +CompanyName=Dataprev-Unidade Regional Espírito Santo
128 FileDescription=Inicializador de Coletas do Sistema CACIC 128 FileDescription=Inicializador de Coletas do Sistema CACIC
129 -FileVersion=2.2.0.1 129 +FileVersion=2.2.0.2
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 -ProductName=  
135 -ProductVersion=2.0.1.2 134 +ProductName=Ini_COLS
  135 +ProductVersion=2.2.0.2
136 Comments=Baseado na licença GPL (General Public License) 136 Comments=Baseado na licença GPL (General Public License)
137 [HistoryLists\hlDebugSourcePath] 137 [HistoryLists\hlDebugSourcePath]
138 Count=1 138 Count=1
ini_cols/ini_cols.res
No preview for this file type
No preview for this file type
No preview for this file type
@@ -34,7 +34,7 @@ uses Windows, @@ -34,7 +34,7 @@ uses Windows,
34 PJVersionInfo, 34 PJVersionInfo,
35 DCPcrypt2, 35 DCPcrypt2,
36 DCPrijndael, 36 DCPrijndael,
37 - DCPbase64; 37 + DCPbase64, ComCtrls;
38 38
39 39
40 const WM_MYMESSAGE = WM_USER+100; 40 const WM_MYMESSAGE = WM_USER+100;
@@ -52,7 +52,8 @@ var p_path_cacic, @@ -52,7 +52,8 @@ var p_path_cacic,
52 v_IV, 52 v_IV,
53 v_DatFileName, 53 v_DatFileName,
54 v_DataCacic2DAT, 54 v_DataCacic2DAT,
55 - v_Tamanho_Arquivo : string; 55 + v_Tamanho_Arquivo,
  56 + v_te_so : string;
56 v_tstrCipherOpened : TStrings; 57 v_tstrCipherOpened : TStrings;
57 v_Debugs : Boolean; 58 v_Debugs : Boolean;
58 59
@@ -62,52 +63,6 @@ type @@ -62,52 +63,6 @@ type
62 Bt_Fechar_InfosGerais: TButton; 63 Bt_Fechar_InfosGerais: TButton;
63 Pn_SisMoni: TPanel; 64 Pn_SisMoni: TPanel;
64 Lb_SisMoni: TLabel; 65 Lb_SisMoni: TLabel;
65 - GB_SisMoni: TGroupBox;  
66 - Pn_Coluna2_SisMoni: TPanel;  
67 - Pn_Coluna1_SisMoni: TPanel;  
68 - ST_VL_Sistema1: TStaticText;  
69 - ST_VL_Licenca10: TStaticText;  
70 - ST_VL_Licenca9: TStaticText;  
71 - ST_VL_Licenca8: TStaticText;  
72 - ST_VL_Licenca7: TStaticText;  
73 - ST_VL_Licenca6: TStaticText;  
74 - ST_VL_Licenca5: TStaticText;  
75 - ST_VL_Licenca4: TStaticText;  
76 - ST_VL_Licenca3: TStaticText;  
77 - ST_VL_Licenca2: TStaticText;  
78 - ST_VL_Licenca1: TStaticText;  
79 - ST_VL_Sistema10: TStaticText;  
80 - ST_VL_Sistema9: TStaticText;  
81 - ST_VL_Sistema8: TStaticText;  
82 - ST_VL_Sistema7: TStaticText;  
83 - ST_VL_Sistema6: TStaticText;  
84 - ST_VL_Sistema5: TStaticText;  
85 - ST_VL_Sistema4: TStaticText;  
86 - ST_VL_Sistema3: TStaticText;  
87 - ST_VL_Sistema2: TStaticText;  
88 - St_LB_Versao: TStaticText;  
89 - ST_LB_NomeSistema: TStaticText;  
90 - St_LB_NumeroLicenca: TStaticText;  
91 - ST_VL_Versao1: TStaticText;  
92 - ST_VL_Versao4: TStaticText;  
93 - ST_VL_Versao5: TStaticText;  
94 - ST_VL_Versao6: TStaticText;  
95 - ST_VL_Versao7: TStaticText;  
96 - ST_VL_Versao8: TStaticText;  
97 - ST_VL_Versao9: TStaticText;  
98 - ST_VL_Versao10: TStaticText;  
99 - ST_VL_Versao3: TStaticText;  
100 - ST_VL_Versao2: TStaticText;  
101 - Pn_Linha1_SisMoni: TPanel;  
102 - Pn_Linha2_SisMoni: TPanel;  
103 - Pn_Linha3_SisMoni: TPanel;  
104 - Pn_Linha4_SisMoni: TPanel;  
105 - Pn_Linha6_SisMoni: TPanel;  
106 - Pn_Linha7_SisMoni: TPanel;  
107 - Pn_Linha8_SisMoni: TPanel;  
108 - Pn_Linha9_SisMoni: TPanel;  
109 - Pn_Linha5_SisMoni: TPanel;  
110 - Pn_Linha10_SisMoni: TPanel;  
111 Pn_TCPIP: TPanel; 66 Pn_TCPIP: TPanel;
112 Lb_TCPIP: TLabel; 67 Lb_TCPIP: TLabel;
113 GB_InfosTCPIP: TGroupBox; 68 GB_InfosTCPIP: TGroupBox;
@@ -150,6 +105,13 @@ type @@ -150,6 +105,13 @@ type
150 Mnu_InfosTCP: TMenuItem; 105 Mnu_InfosTCP: TMenuItem;
151 Mnu_InfosPatrimoniais: TMenuItem; 106 Mnu_InfosPatrimoniais: TMenuItem;
152 Mnu_FinalizarCacic: TMenuItem; 107 Mnu_FinalizarCacic: TMenuItem;
  108 + listSistemasMonitorados: TListView;
  109 + Panel1: TPanel;
  110 + Label1: TLabel;
  111 + listaColetas: TListView;
  112 + lbDataColeta: TLabel;
  113 + Panel2: TPanel;
  114 + Panel3: TPanel;
153 procedure RemoveIconesMortos; 115 procedure RemoveIconesMortos;
154 procedure ChecaCONFIGS; 116 procedure ChecaCONFIGS;
155 procedure CriaFormSenha(Sender: TObject); 117 procedure CriaFormSenha(Sender: TObject);
@@ -178,6 +140,8 @@ type @@ -178,6 +140,8 @@ type
178 procedure Mnu_InfosTCPClick(Sender: TObject); 140 procedure Mnu_InfosTCPClick(Sender: TObject);
179 procedure Bt_Fechar_InfosGeraisClick(Sender: TObject); 141 procedure Bt_Fechar_InfosGeraisClick(Sender: TObject);
180 function Get_File_Size(sFileToExamine: string; bInKBytes: Boolean): string; 142 function Get_File_Size(sFileToExamine: string; bInKBytes: Boolean): string;
  143 + function Posso_Rodar : boolean;
  144 + function abstraiCSD(p_te_so : String) : integer;
181 private 145 private
182 ShutdownEmExecucao : Boolean; 146 ShutdownEmExecucao : Boolean;
183 IsMenuOpen : Boolean; 147 IsMenuOpen : Boolean;
@@ -705,6 +669,7 @@ Begin @@ -705,6 +669,7 @@ Begin
705 strFraseVersao := 'CACIC V:' + getVersionInfo(ParamStr(0)); 669 strFraseVersao := 'CACIC V:' + getVersionInfo(ParamStr(0));
706 if not (getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened) = '') then 670 if not (getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened) = '') then
707 strFraseVersao := strFraseVersao + #13#10 + 'IP: '+getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened); 671 strFraseVersao := strFraseVersao + #13#10 + 'IP: '+getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened);
  672 +
708 InicializaTray(strFraseVersao); 673 InicializaTray(strFraseVersao);
709 log_diario('Acionando recuperador de Módulo Gerente de Coletas.'); 674 log_diario('Acionando recuperador de Módulo Gerente de Coletas.');
710 WinExec(PChar(HomeDrive + '\chksis.exe'),SW_HIDE); 675 WinExec(PChar(HomeDrive + '\chksis.exe'),SW_HIDE);
@@ -713,7 +678,7 @@ Begin @@ -713,7 +678,7 @@ Begin
713 if (FileExists(p_path_cacic + 'modulos\ger_cols.exe')) then 678 if (FileExists(p_path_cacic + 'modulos\ger_cols.exe')) then
714 Begin 679 Begin
715 log_diario('Módulo Gerente de Coletas RECUPERADO COM SUCESSO!'); 680 log_diario('Módulo Gerente de Coletas RECUPERADO COM SUCESSO!');
716 - InicializaTray('Aguarde...'); 681 + InicializaTray('');
717 End 682 End
718 else 683 else
719 log_diario('Módulo Gerente de Coletas NÃO RECUPERADO!'); 684 log_diario('Módulo Gerente de Coletas NÃO RECUPERADO!');
@@ -781,7 +746,7 @@ begin @@ -781,7 +746,7 @@ begin
781 Result:=FindFirst(v_dir+v_files, faAnyFile, SearchRec); 746 Result:=FindFirst(v_dir+v_files, faAnyFile, SearchRec);
782 while result=0 do 747 while result=0 do
783 begin 748 begin
784 - log_DEBUG('Excluindo: '+v_dir + SearchRec.Name); 749 + log_DEBUG('Tentativa de Exclusão de "'+v_dir + SearchRec.Name+'"');
785 DeleteFile(v_dir+SearchRec.Name); 750 DeleteFile(v_dir+SearchRec.Name);
786 Result:=FindNext(SearchRec); 751 Result:=FindNext(SearchRec);
787 end; 752 end;
@@ -910,15 +875,20 @@ const @@ -910,15 +875,20 @@ const
910 cOsXP = 8; 875 cOsXP = 8;
911 var 876 var
912 osVerInfo: TOSVersionInfo; 877 osVerInfo: TOSVersionInfo;
913 - majorVer, minorVer: Integer; 878 + platformID,
  879 + majorVer,
  880 + minorVer : Integer;
  881 + CSDVersion : String;
914 begin 882 begin
915 Result := cOsUnknown; 883 Result := cOsUnknown;
916 { set operating system type flag } 884 { set operating system type flag }
917 osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); 885 osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
918 if GetVersionEx(osVerInfo) then 886 if GetVersionEx(osVerInfo) then
919 begin 887 begin
920 - majorVer := osVerInfo.dwMajorVersion;  
921 - minorVer := osVerInfo.dwMinorVersion; 888 + platformId := osVerInfo.dwPlatformId;
  889 + majorVer := osVerInfo.dwMajorVersion;
  890 + minorVer := osVerInfo.dwMinorVersion;
  891 + CSDVersion := trim(osVerInfo.szCSDVersion);
922 case osVerInfo.dwPlatformId of 892 case osVerInfo.dwPlatformId of
923 VER_PLATFORM_WIN32_NT: { Windows NT/2000 } 893 VER_PLATFORM_WIN32_NT: { Windows NT/2000 }
924 begin 894 begin
@@ -953,22 +923,57 @@ begin @@ -953,22 +923,57 @@ begin
953 end 923 end
954 else 924 else
955 Result := cOsUnknown; 925 Result := cOsUnknown;
  926 + // A partir da versão 2.2.0.24, defino o valor da ID Interna e atribuo-a sem o CSDVersion à versão externa
  927 + v_te_so := IntToStr(platformId) + '.' +
  928 + IntToStr(majorVer) + '.' +
  929 + IntToStr(minorVer) +
  930 + IfThen(CSDVersion='','','.'+CSDVersion);
  931 + if (Result = 0) then
  932 + Result := abstraiCSD(v_te_so);
  933 +
956 end; 934 end;
  935 +function TFormularioGeral.abstraiCSD(p_te_so : String) : integer;
  936 + var tstrTe_so : tstrings;
  937 + Begin
  938 + tstrTe_so := Explode(p_te_so, '.');
  939 + Result := StrToInt(tstrTe_so[0] + tstrTe_so[1] + tstrTe_so[2]);
  940 + End;
  941 +
  942 +procedure TFormularioGeral.log_DEBUG(p_msg:string);
  943 +Begin
  944 + if v_Debugs then log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg);
  945 +End;
  946 +
  947 +function TFormularioGeral.Posso_Rodar : boolean;
  948 +Begin
  949 + result := false;
  950 +
  951 + log_debug('Verificando concomitância de sessões');
  952 + // Se eu conseguir matar o arquivo abaixo é porque não há outra sessão deste agente aberta... (POG? Nããão! :) )
  953 + FormularioGeral.Matar(p_path_cacic,'aguarde_CACIC.txt');
  954 + if (not (FileExists(p_path_cacic + 'aguarde_CACIC.txt'))) then
  955 + result := true;
  956 +End;
957 957
958 procedure TFormularioGeral.FormCreate(Sender: TObject); 958 procedure TFormularioGeral.FormCreate(Sender: TObject);
959 var strAux, 959 var strAux,
960 v_ip_serv_cacic, 960 v_ip_serv_cacic,
  961 + v_cacic_dir,
961 v_windir, 962 v_windir,
962 strFraseVersao : string; 963 strFraseVersao : string;
963 intAux : integer; 964 intAux : integer;
  965 + v_Aguarde : TextFile;
  966 + v_SystemDrive : TStrings;
964 begin 967 begin
965 Try 968 Try
966 // De acordo com a versão do OS, determino o ShellCommand para chamadas externas. 969 // De acordo com a versão do OS, determino o ShellCommand para chamadas externas.
967 - if (GetWinVer > 5) then 970 + if ((GetWinVer <> 0) and (GetWinVer > 5)) or
  971 + (abstraiCSD(v_te_so) >= 250) then //Se NT/2K/XP... then
968 Begin 972 Begin
969 //p_Shell_Command := GetEnvironmentVariable('SYSTEMROOT') + '\system32\cmd.exe /c '; //NT/2K/XP 973 //p_Shell_Command := GetEnvironmentVariable('SYSTEMROOT') + '\system32\cmd.exe /c '; //NT/2K/XP
970 p_Shell_Path := HomeDrive + '\system32\'; //NT/2K/XP 974 p_Shell_Path := HomeDrive + '\system32\'; //NT/2K/XP
971 p_Shell_Command := 'cmd.exe'; //NT/2K/XP 975 p_Shell_Command := 'cmd.exe'; //NT/2K/XP
  976 + strAux := HomeDrive + '\'; //Ex.: c:\windows\
972 End 977 End
973 else 978 else
974 Begin 979 Begin
@@ -977,10 +982,17 @@ begin @@ -977,10 +982,17 @@ begin
977 //p_Shell_Command := v_windir + 'command.com /c '; 982 //p_Shell_Command := v_windir + 'command.com /c ';
978 p_Shell_Path := v_windir; 983 p_Shell_Path := v_windir;
979 p_Shell_Command := 'command.com'; 984 p_Shell_Command := 'command.com';
  985 + strAux := GetEnvironmentVariable('windir') + '\'; //Ex.: c:\windows\
980 End; 986 End;
981 987
  988 + v_SystemDrive := explode(strAux,'\');
  989 + v_cacic_dir := v_SystemDrive[0] + '\' + getValorChaveRegIni('Cacic2','cacic_dir',strAux + 'chksis.ini') + '\';
  990 +
982 // Caminho do aplicativo 991 // Caminho do aplicativo
983 - p_path_cacic := ExtractFilePath(Application.Exename) ; 992 + if (v_cacic_dir <> '') then
  993 + p_path_cacic := v_cacic_dir
  994 + else
  995 + p_path_cacic := ExtractFilePath(Application.Exename) ;
984 996
985 v_Debugs := false; 997 v_Debugs := false;
986 if DirectoryExists(p_path_cacic + 'Temp\Debugs') then 998 if DirectoryExists(p_path_cacic + 'Temp\Debugs') then
@@ -992,98 +1004,122 @@ begin @@ -992,98 +1004,122 @@ begin
992 End; 1004 End;
993 End; 1005 End;
994 1006
995 - // Chave AES. Recomenda-se que cada empresa altere a sua chave.  
996 - // Esta chave é passada como parâmetro para o Gerente de Coletas que, por sua vez,  
997 - // passa para o Inicializador de Coletas e este passa para os coletores...  
998 - v_CipherKey := 'CacicBrasil';  
999 - v_IV := 'abcdefghijklmnop';  
1000 - v_SeparatorKey := '=CacicIsFree='; // Usada apenas para o cacic2.dat  
1001 - v_DatFileName := p_path_cacic + 'cacic2.dat';  
1002 - v_DataCacic2DAT := '';  
1003 - v_tstrCipherOpened := TStrings.Create;  
1004 - v_tstrCipherOpened := CipherOpen;  
1005 -  
1006 - if FileExists(p_path_cacic + 'cacic2.ini') then  
1007 - Begin  
1008 - log_DEBUG('O arquivo "'+p_path_cacic + 'cacic2.ini" ainda existe. Vou resgatar algumas chaves/valores');  
1009 - SetValorDatMemoria('Configs.EnderecoServidor' ,getValorChaveRegIni('Configs' ,'EnderecoServidor' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1010 - SetValorDatMemoria('Configs.IN_EXIBE_BANDEJA' ,getValorChaveRegIni('Configs' ,'IN_EXIBE_BANDEJA' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1011 - SetValorDatMemoria('Configs.TE_JANELAS_EXCECAO' ,getValorChaveRegIni('Configs' ,'TE_JANELAS_EXCECAO' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1012 - SetValorDatMemoria('Configs.NU_EXEC_APOS' ,getValorChaveRegIni('Configs' ,'NU_EXEC_APOS' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1013 - SetValorDatMemoria('Configs.NU_INTERVALO_EXEC' ,getValorChaveRegIni('Configs' ,'NU_INTERVALO_EXEC' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1014 - SetValorDatMemoria('Configs.Endereco_WS' ,getValorChaveRegIni('Configs' ,'Endereco_WS' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1015 - SetValorDatMemoria('Configs.TE_SENHA_ADM_AGENTE' ,getValorChaveRegIni('Configs' ,'TE_SENHA_ADM_AGENTE' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1016 - SetValorDatMemoria('Configs.NU_INTERVALO_RENOVACAO_PATRIM' ,getValorChaveRegIni('Configs' ,'NU_INTERVALO_RENOVACAO_PATRIM' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1017 - SetValorDatMemoria('Configs.DT_HR_ULTIMA_COLETA' ,getValorChaveRegIni('Configs' ,'DT_HR_ULTIMA_COLETA' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1018 - SetValorDatMemoria('TcpIp.TE_ENDERECOS_MAC_INVALIDOS' ,getValorChaveRegIni('TcpIp' ,'TE_ENDERECOS_MAC_INVALIDOS' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1019 - SetValorDatMemoria('TcpIp.ID_IP_REDE' ,getValorChaveRegIni('TcpIp' ,'ID_IP_REDE' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1020 - SetValorDatMemoria('TcpIp.TE_IP' ,getValorChaveRegIni('TcpIp' ,'TE_IP' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1021 - SetValorDatMemoria('TcpIp.TE_MASCARA' ,getValorChaveRegIni('TcpIp' ,'TE_MASCARA' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1022 - SetValorDatMemoria('Patrimonio.ultima_rede_obtida' ,getValorChaveRegIni('Patrimonio' ,'ultima_rede_obtida' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1023 - SetValorDatMemoria('Patrimonio.dt_ultima_renovacao' ,getValorChaveRegIni('Patrimonio' ,'dt_ultima_renovacao' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);  
1024 - Matar(p_path_cacic,'cacic2.ini');  
1025 - End; 1007 + log_DEBUG('Pasta do Sistema: "' + p_path_cacic + '"');
1026 1008
1027 - if (ParamCount > 0) then //Caso o Cacic2 seja chamado com passagem de parâmetros... 1009 + if Posso_Rodar then
1028 Begin 1010 Begin
1029 - // Parâmetros possíveis (aceitos)  
1030 - // /ip_serv_cacic => Endereço IP do Módulo Gerente. Ex.: 10.71.0.212  
1031 - // /atualizacao => O CACIC foi chamado pelo batch de AutoUpdate e deve ir direto para o ExecutaCacic. 1011 + // Uma forma fácil de evitar que outra sessão deste agente seja iniciada! (POG? Nããããooo!) :))))
  1012 + AssignFile(v_Aguarde,p_path_cacic + 'aguarde_CACIC.txt'); {Associa o arquivo a uma variável do tipo TextFile}
  1013 + {$IOChecks off}
  1014 + Reset(v_Aguarde); {Abre o arquivo texto}
  1015 + {$IOChecks on}
  1016 + if (IOResult <> 0) then // Arquivo não existe, será recriado.
  1017 + Rewrite (v_Aguarde);
  1018 +
  1019 + Append(v_Aguarde);
  1020 + Writeln(v_Aguarde,'Apenas um pseudo-cookie para evitar sessões concomitantes...');
  1021 + Append(v_Aguarde);
  1022 + Writeln(v_Aguarde,'Futuramente penso em colocar aqui o pID, para possibilitar finalização via software externo...');
  1023 + Append(v_Aguarde);
  1024 +
  1025 + // Chave AES. Recomenda-se que cada empresa altere a sua chave.
  1026 + // Esta chave é passada como parâmetro para o Gerente de Coletas que, por sua vez,
  1027 + // passa para o Inicializador de Coletas e este passa para os coletores...
  1028 + v_CipherKey := 'CacicBrasil';
  1029 + v_IV := 'abcdefghijklmnop';
  1030 + v_SeparatorKey := '=CacicIsFree='; // Usada apenas para o cacic2.dat
  1031 + v_DatFileName := p_path_cacic + 'cacic2.dat';
  1032 + v_DataCacic2DAT := '';
  1033 + v_tstrCipherOpened := TStrings.Create;
  1034 + v_tstrCipherOpened := CipherOpen;
  1035 +
  1036 + if FileExists(p_path_cacic + 'cacic2.ini') then
  1037 + Begin
  1038 + log_DEBUG('O arquivo "'+p_path_cacic + 'cacic2.ini" ainda existe. Vou resgatar algumas chaves/valores');
  1039 + SetValorDatMemoria('Configs.EnderecoServidor' ,getValorChaveRegIni('Configs' ,'EnderecoServidor' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1040 + SetValorDatMemoria('Configs.IN_EXIBE_BANDEJA' ,getValorChaveRegIni('Configs' ,'IN_EXIBE_BANDEJA' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1041 + SetValorDatMemoria('Configs.TE_JANELAS_EXCECAO' ,getValorChaveRegIni('Configs' ,'TE_JANELAS_EXCECAO' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1042 + SetValorDatMemoria('Configs.NU_EXEC_APOS' ,getValorChaveRegIni('Configs' ,'NU_EXEC_APOS' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1043 + SetValorDatMemoria('Configs.NU_INTERVALO_EXEC' ,getValorChaveRegIni('Configs' ,'NU_INTERVALO_EXEC' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1044 + SetValorDatMemoria('Configs.Endereco_WS' ,getValorChaveRegIni('Configs' ,'Endereco_WS' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1045 + SetValorDatMemoria('Configs.TE_SENHA_ADM_AGENTE' ,getValorChaveRegIni('Configs' ,'TE_SENHA_ADM_AGENTE' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1046 + SetValorDatMemoria('Configs.NU_INTERVALO_RENOVACAO_PATRIM' ,getValorChaveRegIni('Configs' ,'NU_INTERVALO_RENOVACAO_PATRIM' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1047 + SetValorDatMemoria('Configs.DT_HR_ULTIMA_COLETA' ,getValorChaveRegIni('Configs' ,'DT_HR_ULTIMA_COLETA' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1048 + SetValorDatMemoria('TcpIp.TE_ENDERECOS_MAC_INVALIDOS' ,getValorChaveRegIni('TcpIp' ,'TE_ENDERECOS_MAC_INVALIDOS' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1049 + SetValorDatMemoria('TcpIp.ID_IP_REDE' ,getValorChaveRegIni('TcpIp' ,'ID_IP_REDE' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1050 + SetValorDatMemoria('TcpIp.TE_IP' ,getValorChaveRegIni('TcpIp' ,'TE_IP' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1051 + SetValorDatMemoria('TcpIp.TE_MASCARA' ,getValorChaveRegIni('TcpIp' ,'TE_MASCARA' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1052 + SetValorDatMemoria('Patrimonio.ultima_rede_obtida' ,getValorChaveRegIni('Patrimonio' ,'ultima_rede_obtida' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1053 + SetValorDatMemoria('Patrimonio.dt_ultima_renovacao' ,getValorChaveRegIni('Patrimonio' ,'dt_ultima_renovacao' ,p_path_cacic + 'cacic2.ini'),v_tstrCipherOpened);
  1054 + Matar(p_path_cacic,'cacic2.ini');
  1055 + End;
1032 1056
1033 - // Chamada com parâmetros pelo chkcacic.exe ou linha de comando  
1034 - For intAux := 1 to ParamCount do 1057 + if (ParamCount > 0) then //Caso o Cacic2 seja chamado com passagem de parâmetros...
1035 Begin 1058 Begin
1036 - if LowerCase(Copy(ParamStr(intAux),1,15)) = '/ip_serv_cacic=' then  
1037 - begin  
1038 - log_DEBUG('Parâmetro /ip_serv_cacic recebido...');  
1039 - strAux := Trim(Copy(ParamStr(intAux),16,Length((ParamStr(intAux)))));  
1040 - v_ip_serv_cacic := Trim(Copy(strAux,0,Pos('/', strAux) - 1));  
1041 - If (v_ip_serv_cacic = '') Then v_ip_serv_cacic := strAux;  
1042 - SetValorDatMemoria('Configs.EnderecoServidor',v_ip_serv_cacic,v_tstrCipherOpened);  
1043 - end;  
1044 - end; 1059 + // Parâmetros possíveis (aceitos)
  1060 + // /ip_serv_cacic => Endereço IP do Módulo Gerente. Ex.: 10.71.0.212
  1061 + // /atualizacao => O CACIC foi chamado pelo batch de AutoUpdate e deve ir direto para o ExecutaCacic.
1045 1062
1046 - If FindCmdLineSwitch('execute', True) or  
1047 - FindCmdLineSwitch('atualizacao', True) Then  
1048 - begin  
1049 - if FindCmdLineSwitch('atualizacao', True) then  
1050 - begin  
1051 - log_DEBUG('Opção /atualizacao recebida...');  
1052 - Log_Diario('Reinicializando com versão '+getVersionInfo(ParamStr(0)));  
1053 - end  
1054 - else 1063 + // Chamada com parâmetros pelo chkcacic.exe ou linha de comando
  1064 + For intAux := 1 to ParamCount do
  1065 + Begin
  1066 + if LowerCase(Copy(ParamStr(intAux),1,15)) = '/ip_serv_cacic=' then
1055 begin 1067 begin
1056 - log_DEBUG('Opção /execute recebida...');  
1057 - log_diario('Opção para execução imediata encontrada...'); 1068 + log_DEBUG('Parâmetro /ip_serv_cacic recebido...');
  1069 + strAux := Trim(Copy(ParamStr(intAux),16,Length((ParamStr(intAux)))));
  1070 + v_ip_serv_cacic := Trim(Copy(strAux,0,Pos('/', strAux) - 1));
  1071 + If (v_ip_serv_cacic = '') Then v_ip_serv_cacic := strAux;
  1072 + SetValorDatMemoria('Configs.EnderecoServidor',v_ip_serv_cacic,v_tstrCipherOpened);
1058 end; 1073 end;
1059 - ExecutaCacic(nil);  
1060 end; 1074 end;
1061 - End;  
1062 1075
1063 - // Os timers iniciam-se desabilitados... Mais à frente receberão parâmetros de tempo para execução.  
1064 - Timer_Nu_Exec_Apos.Enabled := False;  
1065 - Timer_Nu_Intervalo.Enabled := False; 1076 + If FindCmdLineSwitch('execute', True) or
  1077 + FindCmdLineSwitch('atualizacao', True) Then
  1078 + begin
  1079 + if FindCmdLineSwitch('atualizacao', True) then
  1080 + begin
  1081 + log_DEBUG('Opção /atualizacao recebida...');
  1082 + Log_Diario('Reinicializando com versão '+getVersionInfo(ParamStr(0)));
  1083 + end
  1084 + else
  1085 + begin
  1086 + log_DEBUG('Opção /execute recebida...');
  1087 + log_diario('Opção para execução imediata encontrada...');
  1088 + end;
  1089 + ExecutaCacic(nil);
  1090 + end;
  1091 + End;
  1092 +
  1093 + // Os timers iniciam-se desabilitados... Mais à frente receberão parâmetros de tempo para execução.
  1094 + Timer_Nu_Exec_Apos.Enabled := False;
  1095 + Timer_Nu_Intervalo.Enabled := False;
1066 1096
1067 - // Derruba o cacic durante o shutdown do windows.  
1068 - ShutdownEmExecucao := False; 1097 + // Derruba o cacic durante o shutdown do windows.
  1098 + ShutdownEmExecucao := False;
1069 1099
1070 - // Não mostrar o formulário...  
1071 - Application.ShowMainForm:=false; 1100 + // Não mostrar o formulário...
  1101 + Application.ShowMainForm:=false;
1072 1102
1073 - Try  
1074 - // A chamada abaixo define os valores usados pelo agente principal.  
1075 - SetaVariaveisGlobais;  
1076 - Except  
1077 - log_diario('PROBLEMAS SETANDO VARIÁVEIS GLOBAIS!');  
1078 - End; 1103 + Try
  1104 + // A chamada abaixo define os valores usados pelo agente principal.
  1105 + SetaVariaveisGlobais;
  1106 + Except
  1107 + log_diario('PROBLEMAS SETANDO VARIÁVEIS GLOBAIS!');
  1108 + End;
1079 1109
1080 - // Envia o ícone para a bandeja com HINT mostrando Versão...  
1081 - strFraseVersao := 'CACIC V:' + getVersionInfo(ParamStr(0));  
1082 - if not (getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened) = '') then  
1083 - strFraseVersao := strFraseVersao + #13#10 + 'IP: '+ getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened);  
1084 - InicializaTray(strFraseVersao);  
1085 - CipherClose; 1110 + // Envia o ícone para a bandeja com HINT mostrando Versão...
  1111 + strFraseVersao := 'CACIC V:' + getVersionInfo(ParamStr(0));
  1112 + if not (getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened) = '') then
  1113 + strFraseVersao := strFraseVersao + #13#10 + 'IP: '+ getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened);
1086 1114
  1115 + InicializaTray(strFraseVersao);
  1116 + CipherClose;
  1117 + End
  1118 + else
  1119 + Begin
  1120 + log_DEBUG('Agente finalizado devido a concomitância de sessões...');
  1121 + Finaliza;
  1122 + End;
1087 Except 1123 Except
1088 log_diario('PROBLEMAS NA INICIALIZAÇÃO (2)'); 1124 log_diario('PROBLEMAS NA INICIALIZAÇÃO (2)');
1089 End; 1125 End;
@@ -1188,11 +1224,6 @@ Begin @@ -1188,11 +1224,6 @@ Begin
1188 Application.Terminate; 1224 Application.Terminate;
1189 End; 1225 End;
1190 1226
1191 -procedure TFormularioGeral.log_DEBUG(p_msg:string);  
1192 -Begin  
1193 - if v_Debugs then log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg);  
1194 -End;  
1195 -  
1196 procedure TFormularioGeral.Sair(Sender: TObject); 1227 procedure TFormularioGeral.Sair(Sender: TObject);
1197 begin 1228 begin
1198 CriaFormSenha(nil); 1229 CriaFormSenha(nil);
@@ -1299,7 +1330,7 @@ begin @@ -1299,7 +1330,7 @@ begin
1299 intContaExec := 2; 1330 intContaExec := 2;
1300 1331
1301 // Muda HINT 1332 // Muda HINT
1302 - InicializaTray('Aguarde...'); 1333 + InicializaTray('');
1303 1334
1304 // Loop para possível necessidade de updates de Agente Principal e/ou Gerente de Coletas 1335 // Loop para possível necessidade de updates de Agente Principal e/ou Gerente de Coletas
1305 For intAux := intContaExec to 2 do 1336 For intAux := intContaExec to 2 do
@@ -1500,6 +1531,7 @@ begin @@ -1500,6 +1531,7 @@ begin
1500 strFraseVersao := 'CACIC V:' + getVersionInfo(ParamStr(0)); 1531 strFraseVersao := 'CACIC V:' + getVersionInfo(ParamStr(0));
1501 if not (getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened) = '') then 1532 if not (getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened) = '') then
1502 strFraseVersao := strFraseVersao + #13#10 + 'IP: '+getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened); 1533 strFraseVersao := strFraseVersao + #13#10 + 'IP: '+getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened);
  1534 +
1503 InicializaTray(strFraseVersao); 1535 InicializaTray(strFraseVersao);
1504 1536
1505 except 1537 except
@@ -1573,7 +1605,7 @@ end; @@ -1573,7 +1605,7 @@ end;
1573 //======================================================================= 1605 //=======================================================================
1574 procedure TFormularioGeral.InicializaTray(v_Hint:string); 1606 procedure TFormularioGeral.InicializaTray(v_Hint:string);
1575 begin 1607 begin
1576 - log_DEBUG('Setando o HINT do Systray para: "'+v_Hint+'"'); 1608 +
1577 {Estrutura do tray icon sendo criada.} 1609 {Estrutura do tray icon sendo criada.}
1578 NotifyStruc.cbSize := SizeOf(NotifyStruc); 1610 NotifyStruc.cbSize := SizeOf(NotifyStruc);
1579 NotifyStruc.Wnd := Handle; 1611 NotifyStruc.Wnd := Handle;
@@ -1582,7 +1614,12 @@ begin @@ -1582,7 +1614,12 @@ begin
1582 NotifyStruc.uCallbackMessage := WM_MYMESSAGE; {User defined message} 1614 NotifyStruc.uCallbackMessage := WM_MYMESSAGE; {User defined message}
1583 NotifyStruc.hIcon := Application.Icon.Handle; 1615 NotifyStruc.hIcon := Application.Icon.Handle;
1584 1616
1585 - // Coloca as informações de versão na barra de título e no tip da bandeja 1617 + if (v_Hint = '') then
  1618 + v_Hint := 'Aguarde...';
  1619 +
  1620 + log_DEBUG('Setando o HINT do Systray para: "'+v_Hint+'"');
  1621 +
  1622 + // Atualiza o conteúdo do tip da bandeja
1586 StrPCopy(NotifyStruc.szTip, v_Hint); 1623 StrPCopy(NotifyStruc.szTip, v_Hint);
1587 1624
1588 if (getValorDatMemoria('Configs.IN_EXIBE_BANDEJA',v_tstrCipherOpened) <> 'N') Then 1625 if (getValorDatMemoria('Configs.IN_EXIBE_BANDEJA',v_tstrCipherOpened) <> 'N') Then
@@ -1656,13 +1693,13 @@ begin @@ -1656,13 +1693,13 @@ begin
1656 end; 1693 end;
1657 1694
1658 procedure TFormularioGeral.Mnu_InfosTCPClick(Sender: TObject); 1695 procedure TFormularioGeral.Mnu_InfosTCPClick(Sender: TObject);
1659 -var v_tripa_perfis, v_tripa_infos_coletadas, v_nome_campo_sistema, v_nome_campo_licenca, v_nome_campo_versao : string;  
1660 - v_array_perfis, v_array_tripa_infos_coletadas, v_array_infos_coletadas : tstrings; 1696 +var v_tripa_perfis, v_tripa_infos_coletadas,strAux : string;
  1697 + v_array_perfis, v_array_tripa_infos_coletadas, v_array_infos_coletadas,tstringsAux : tstrings;
1661 v_conta_perfis, v_conta_infos_coletadas, intAux, intAux1 : integer; 1698 v_conta_perfis, v_conta_infos_coletadas, intAux, intAux1 : integer;
1662 v_achei : boolean; 1699 v_achei : boolean;
1663 begin 1700 begin
1664 - FormularioGeral.Enabled := true;  
1665 - FormularioGeral.Visible := true; 1701 + FormularioGeral.Enabled := true;
  1702 + FormularioGeral.Visible := true;
1666 1703
1667 ST_VL_NomeHost.Caption := getValorDatMemoria('TcpIp.TE_NOME_HOST' ,v_tstrCipherOpened); 1704 ST_VL_NomeHost.Caption := getValorDatMemoria('TcpIp.TE_NOME_HOST' ,v_tstrCipherOpened);
1668 ST_VL_IPEstacao.Caption := getValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened); 1705 ST_VL_IPEstacao.Caption := getValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened);
@@ -1677,18 +1714,9 @@ begin @@ -1677,18 +1714,9 @@ begin
1677 ST_VL_WinsPrimario.Caption := getValorDatMemoria('TcpIp.TE_WINS_PRIMARIO' ,v_tstrCipherOpened); 1714 ST_VL_WinsPrimario.Caption := getValorDatMemoria('TcpIp.TE_WINS_PRIMARIO' ,v_tstrCipherOpened);
1678 ST_VL_WinsSecundario.Caption := getValorDatMemoria('TcpIp.TE_WINS_SECUNDARIO' ,v_tstrCipherOpened); 1715 ST_VL_WinsSecundario.Caption := getValorDatMemoria('TcpIp.TE_WINS_SECUNDARIO' ,v_tstrCipherOpened);
1679 1716
1680 - // Inicialização dos valores das INFORMAÇÕES GERAIS  
1681 - for intAux1 := 0 to (ComponentCount - 1) do  
1682 - if (Components[intAux1].ClassName = 'TStaticText') and  
1683 - ((Copy(Components[intAux1].Name,1,13)='ST_VL_Sistema') or  
1684 - (Copy(Components[intAux1].Name,1,13)='ST_VL_Licenca') or  
1685 - (Copy(Components[intAux1].Name,1,12)='ST_VL_Versao')) then  
1686 - Begin  
1687 - (Components[intAux1] as TStaticText).Caption := '';  
1688 - End;  
1689 - 1717 + // Exibição das informações de Sistemas Monitorados...
1690 v_conta_perfis := 1; 1718 v_conta_perfis := 1;
1691 - v_conta_infos_coletadas := 1; 1719 + v_conta_infos_coletadas := 0;
1692 v_tripa_perfis := '*'; 1720 v_tripa_perfis := '*';
1693 while v_tripa_perfis <> '' do 1721 while v_tripa_perfis <> '' do
1694 begin 1722 begin
@@ -1711,42 +1739,19 @@ begin @@ -1711,42 +1739,19 @@ begin
1711 for intAux := 0 to v_array_tripa_infos_coletadas.Count-1 Do 1739 for intAux := 0 to v_array_tripa_infos_coletadas.Count-1 Do
1712 Begin 1740 Begin
1713 v_array_infos_coletadas := explode(v_array_tripa_infos_coletadas[intAux],','); 1741 v_array_infos_coletadas := explode(v_array_tripa_infos_coletadas[intAux],',');
  1742 +
1714 if (v_array_infos_coletadas[0]=v_array_perfis[0]) then 1743 if (v_array_infos_coletadas[0]=v_array_perfis[0]) then
1715 Begin 1744 Begin
1716 if ((trim(v_array_infos_coletadas[1])<>'') and (trim(v_array_infos_coletadas[1])<>'?')) or 1745 if ((trim(v_array_infos_coletadas[1])<>'') and (trim(v_array_infos_coletadas[1])<>'?')) or
1717 ((trim(v_array_infos_coletadas[3])<>'') and (trim(v_array_infos_coletadas[3])<>'?')) then 1746 ((trim(v_array_infos_coletadas[3])<>'') and (trim(v_array_infos_coletadas[3])<>'?')) then
1718 Begin 1747 Begin
1719 v_achei := false; 1748 v_achei := false;
1720 - for intAux1 := 0 to (ComponentCount - 1) do  
1721 - Begin  
1722 - if (Components[intAux1].ClassName = 'TStaticText') and  
1723 - ((copy(Components[intAux1].Name,1,13)='ST_VL_Sistema') or  
1724 - (copy(Components[intAux1].Name,1,13)='ST_VL_Licenca') or  
1725 - (copy(Components[intAux1].Name,1,12)='ST_VL_Versao')) then  
1726 - Begin  
1727 - v_nome_campo_sistema := 'ST_VL_Sistema' + inttostr(v_conta_infos_coletadas);  
1728 - v_nome_campo_licenca := 'ST_VL_Licenca' + inttostr(v_conta_infos_coletadas);  
1729 - v_nome_campo_versao := 'ST_VL_Versao' + inttostr(v_conta_infos_coletadas);  
1730 - if (Components[intAux1].Name=v_nome_campo_sistema) then  
1731 - Begin  
1732 - (Components[intAux1] as TStaticText).Caption := v_array_perfis[12];  
1733 - v_achei := true;  
1734 - End;  
1735 -  
1736 - if (Components[intAux1].Name=v_nome_campo_licenca) then  
1737 - Begin  
1738 - (Components[intAux1] as TStaticText).Caption := v_array_infos_coletadas[1];  
1739 - v_achei := true;  
1740 - End;  
1741 -  
1742 - if (Components[intAux1].Name=v_nome_campo_versao) then  
1743 - Begin  
1744 - (Components[intAux1] as TStaticText).Caption := v_array_infos_coletadas[3];  
1745 - v_achei := true;  
1746 - End;  
1747 - End;  
1748 - End;  
1749 - if v_achei then v_conta_infos_coletadas := v_conta_infos_coletadas + 1; 1749 + listSistemasMonitorados.Items.Add;
  1750 + listSistemasMonitorados.Items[v_conta_infos_coletadas].Caption := Format('%2d', [v_conta_infos_coletadas+1])+') '+v_array_perfis[12];
  1751 + listSistemasMonitorados.Items[v_conta_infos_coletadas].SubItems.Add(v_array_infos_coletadas[1]);
  1752 + listSistemasMonitorados.Items[v_conta_infos_coletadas].SubItems.Add(v_array_infos_coletadas[3]);
  1753 + v_conta_infos_coletadas := v_conta_infos_coletadas + 1;
  1754 +
1750 End; 1755 End;
1751 End; 1756 End;
1752 End; 1757 End;
@@ -1754,6 +1759,49 @@ begin @@ -1754,6 +1759,49 @@ begin
1754 End; 1759 End;
1755 End; 1760 End;
1756 end; 1761 end;
  1762 +
  1763 + lbDataColeta.Caption := '('+FormatDateTime('dd/mm/yyyy', now)+')';
  1764 +
  1765 + strAux := GetValorDatMemoria('Coletas.HOJE', v_tstrCipherOpened);
  1766 + if (strAux <> '') then
  1767 + Begin
  1768 + if (copy(strAux,0,8) = FormatDateTime('yyyymmdd', Date)) then
  1769 + Begin
  1770 + // Vamos reaproveitar algumas variáveis!...
  1771 +
  1772 + v_array_perfis := explode(strAux,'#');
  1773 + for intAux := 1 to v_array_perfis.Count-1 Do
  1774 + Begin
  1775 + v_array_infos_coletadas := explode(v_array_perfis[intAux],',');
  1776 + listaColetas.Items.Add;
  1777 + listaColetas.Items[intAux-1].Caption := v_array_infos_coletadas[0];
  1778 + listaColetas.Items[intAux-1].SubItems.Add(v_array_infos_coletadas[1]);
  1779 +
  1780 + // Verifico se houve problema na coleta...
  1781 + if (v_array_infos_coletadas[2]<>'99999999') then
  1782 + listaColetas.Items[intAux-1].SubItems.Add(v_array_infos_coletadas[2])
  1783 + else
  1784 + Begin
  1785 + listaColetas.Items[intAux-1].SubItems.Add('--------');
  1786 + v_array_infos_coletadas[3] := v_array_infos_coletadas[2];
  1787 + End;
  1788 +
  1789 + // Códigos Possíveis: -1 : Problema no Envio da Coleta
  1790 + // 1 : Coleta Enviada
  1791 + // 0 : Sem Coleta para Envio
  1792 + strAux := IfThen(v_array_infos_coletadas[3]='1','Coleta Enviada ao Gerente WEB!',
  1793 + IfThen(v_array_infos_coletadas[3]='-1','Problema Enviando Coleta ao Gerente WEB!',
  1794 + IfThen(v_array_infos_coletadas[3]='0','Sem Coleta para Envio ao Gerente WEB!',
  1795 + IfThen(v_array_infos_coletadas[3]='99999999','Problema no Processo de Coleta!','Status Desconhecido!'))));
  1796 + listaColetas.Items[intAux-1].SubItems.Add(strAux);
  1797 + End;
  1798 + End
  1799 + End
  1800 + else
  1801 + Begin
  1802 + listSistemasMonitorados.Items.Add;
  1803 + listSistemasMonitorados.Items[0].Caption := 'Não Há Coletas Registradas Nesta Data';
  1804 + End;
1757 end; 1805 end;
1758 1806
1759 procedure TFormularioGeral.Bt_Fechar_InfosGeraisClick(Sender: TObject); 1807 procedure TFormularioGeral.Bt_Fechar_InfosGeraisClick(Sender: TObject);
mapa/main_mapa.dcu
No preview for this file type
mapa/main_mapa.pas
@@ -47,7 +47,8 @@ uses IniFiles, @@ -47,7 +47,8 @@ uses IniFiles,
47 47
48 var strCipherClosed, 48 var strCipherClosed,
49 strCipherOpened, 49 strCipherOpened,
50 - strPathCacic : string; 50 + strPathCacic,
  51 + str_te_so : string;
51 52
52 var boolDebugs, 53 var boolDebugs,
53 boolUON2 : boolean; 54 boolUON2 : boolean;
@@ -810,17 +811,24 @@ const @@ -810,17 +811,24 @@ const
810 cOsWinNT = 6; 811 cOsWinNT = 6;
811 cOsWin2000 = 7; 812 cOsWin2000 = 7;
812 cOsXP = 8; 813 cOsXP = 8;
  814 +
813 var 815 var
814 osVerInfo: TOSVersionInfo; 816 osVerInfo: TOSVersionInfo;
815 - majorVer, minorVer: Integer; 817 + platformID,
  818 + majorVer,
  819 + minorVer: Integer;
  820 + CSDVersion : String;
816 begin 821 begin
817 Result := cOsUnknown; 822 Result := cOsUnknown;
818 { set operating system type flag } 823 { set operating system type flag }
819 osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); 824 osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
820 if GetVersionEx(osVerInfo) then 825 if GetVersionEx(osVerInfo) then
821 begin 826 begin
822 - majorVer := osVerInfo.dwMajorVersion;  
823 - minorVer := osVerInfo.dwMinorVersion; 827 + platformId := osVerInfo.dwPlatformId;
  828 + majorVer := osVerInfo.dwMajorVersion;
  829 + minorVer := osVerInfo.dwMinorVersion;
  830 + CSDVersion := trim(osVerInfo.szCSDVersion);
  831 +
824 case osVerInfo.dwPlatformId of 832 case osVerInfo.dwPlatformId of
825 VER_PLATFORM_WIN32_NT: { Windows NT/2000 } 833 VER_PLATFORM_WIN32_NT: { Windows NT/2000 }
826 begin 834 begin
@@ -855,6 +863,13 @@ begin @@ -855,6 +863,13 @@ begin
855 end 863 end
856 else 864 else
857 Result := cOsUnknown; 865 Result := cOsUnknown;
  866 +
  867 + // Defino o valor da ID Interna
  868 + str_te_so := IntToStr(platformId) + '.' +
  869 + IntToStr(majorVer) + '.' +
  870 + IntToStr(minorVer) +
  871 + IfThen(CSDVersion='','','.'+CSDVersion);
  872 +
858 end; 873 end;
859 874
860 875
@@ -1158,6 +1173,7 @@ begin @@ -1158,6 +1173,7 @@ begin
1158 Request_mapa := TStringList.Create; 1173 Request_mapa := TStringList.Create;
1159 Request_mapa.Values['te_node_address'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCipherOpened)); 1174 Request_mapa.Values['te_node_address'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCipherOpened));
1160 Request_mapa.Values['id_so'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('Configs.ID_SO' , frmMapaCacic.tStringsCipherOpened)); 1175 Request_mapa.Values['id_so'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('Configs.ID_SO' , frmMapaCacic.tStringsCipherOpened));
  1176 + Request_mapa.Values['te_so'] := frmMapaCacic.EnCrypt(str_te_so);
1161 Request_mapa.Values['id_ip_rede'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.ID_IP_REDE' , frmMapaCacic.tStringsCipherOpened)); 1177 Request_mapa.Values['id_ip_rede'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.ID_IP_REDE' , frmMapaCacic.tStringsCipherOpened));
1162 Request_mapa.Values['te_ip'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_IP' , frmMapaCacic.tStringsCipherOpened)); 1178 Request_mapa.Values['te_ip'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_IP' , frmMapaCacic.tStringsCipherOpened));
1163 Request_mapa.Values['te_nome_computador'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR' , frmMapaCacic.tStringsCipherOpened)); 1179 Request_mapa.Values['te_nome_computador'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR' , frmMapaCacic.tStringsCipherOpened));
@@ -1539,6 +1555,7 @@ begin @@ -1539,6 +1555,7 @@ begin
1539 Request_mapa := TStringList.Create; 1555 Request_mapa := TStringList.Create;
1540 Request_mapa.Values['te_node_address'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCipherOpened)); 1556 Request_mapa.Values['te_node_address'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCipherOpened));
1541 Request_mapa.Values['id_so'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('Configs.ID_SO' , frmMapaCacic.tStringsCipherOpened)); 1557 Request_mapa.Values['id_so'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('Configs.ID_SO' , frmMapaCacic.tStringsCipherOpened));
  1558 + Request_mapa.Values['te_so'] := frmMapaCacic.EnCrypt(str_te_so);
1542 Request_mapa.Values['id_ip_rede'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.ID_IP_REDE' , frmMapaCacic.tStringsCipherOpened)); 1559 Request_mapa.Values['id_ip_rede'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.ID_IP_REDE' , frmMapaCacic.tStringsCipherOpened));
1543 Request_mapa.Values['te_ip'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_IP' , frmMapaCacic.tStringsCipherOpened)); 1560 Request_mapa.Values['te_ip'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_IP' , frmMapaCacic.tStringsCipherOpened));
1544 Request_mapa.Values['te_nome_computador']:= frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', frmMapaCacic.tStringsCipherOpened)); 1561 Request_mapa.Values['te_nome_computador']:= frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', frmMapaCacic.tStringsCipherOpened));
mapa/mapacacic.dof
@@ -115,7 +115,7 @@ AutoIncBuild=0 @@ -115,7 +115,7 @@ AutoIncBuild=0
115 MajorVer=1 115 MajorVer=1
116 MinorVer=0 116 MinorVer=0
117 Release=0 117 Release=0
118 -Build=3 118 +Build=4
119 Debug=0 119 Debug=0
120 PreRelease=0 120 PreRelease=0
121 Special=0 121 Special=0
@@ -126,13 +126,13 @@ CodePage=1252 @@ -126,13 +126,13 @@ CodePage=1252
126 [Version Info Keys] 126 [Version Info Keys]
127 CompanyName=Dataprev-ES 127 CompanyName=Dataprev-ES
128 FileDescription=MapaCacic - Módulo Avulso para Coleta de Informações Patrimoniais para o Sistema CACIC 128 FileDescription=MapaCacic - Módulo Avulso para Coleta de Informações Patrimoniais para o Sistema CACIC
129 -FileVersion=1.0.0.3 129 +FileVersion=1.0.0.4
130 InternalName= 130 InternalName=
131 LegalCopyright= 131 LegalCopyright=
132 LegalTrademarks= 132 LegalTrademarks=
133 OriginalFilename= 133 OriginalFilename=
134 ProductName= 134 ProductName=
135 -ProductVersion=1.0.0.0 135 +ProductVersion=1.0.0.4
136 Comments=Baseado na Licença GPL(General Public License) 136 Comments=Baseado na Licença GPL(General Public License)
137 [HistoryLists\hlDebugSourcePath] 137 [HistoryLists\hlDebugSourcePath]
138 Count=1 138 Count=1
mapa/mapacacic.res
No preview for this file type
testacrypt/main_testacrypt.dcu
No preview for this file type
testacrypt/main_testacrypt.dfm
@@ -57,7 +57,7 @@ object Form1: TForm1 @@ -57,7 +57,7 @@ object Form1: TForm1
57 MaxLength = 100 57 MaxLength = 100
58 ParentFont = False 58 ParentFont = False
59 TabOrder = 0 59 TabOrder = 0
60 - Text = 'http://10.0.135.167/cacic2/ws/testacrypt.php' 60 + Text = 'http://192.168.0.1/cacic2/ws/testacrypt.php'
61 end 61 end
62 end 62 end
63 object GroupBox_TestesCliente: TGroupBox 63 object GroupBox_TestesCliente: TGroupBox
vaca/main_vaca.dcu
No preview for this file type