Commit 76399d4b4813d3c3bb39bb330ca75cb12d37400d

Authored by Adriano Vieira
1 parent f1ea1d68
Exists in master

Alterações acumuladas realizadas/enviadas pela Dataprev/ES (Anderson Peterle - 2…

…007/2008) - necessita de revisões e (muitos) testes

  + Foi aberta ao usuário de nível "Supervisão" a opção "Perfis Sistemas", onde este usuário
    poderá associar redes aos perfis de sistemas monitorados;
  + Foi acrescentada a informação "Total de Redes Alvo" na página principal dos Perfis de
    Sistemas Monitorados (Administração / Cadastros / Perfis Sistemas);
  + Foi acrescentada a informação de sequência dos ítens constantes dos Detalhes do
    Computador;		  
  * Foi implementada inteligência aos gráficos de pizza "Totais de computadores monitorados
    por local" e "Últimos acessos dos agentes por local nesta data", para que os gráficos
    não cresçam além dos limites impostos pela quantidade de locais.
  + Implementadas as opções Atualização Especial e Consulta Especial para o nível
    Administração, para operações de baixo nível no Servidor de Aplicações. 
    ATENÇÃO: Estas opções dependem do conjunto de permissões existentes nas pastas e
             arquivos objetos das operações.
  + Foi reativado o script "instalacacic.php" que recebe uma indicação de instalação mal
    sucedida, enviada pelo ChkCacic, e armazena na tabela "insucessos_instalacao";
  + Implementado o Log de Insucessos, para visualização das tentativas de instalação com
    insucesso.
  * Melhoria na recepção de valores de Softwares Inventariados e Variáveis de Ambiente, com
    a implementação de controle por HASH MD5;
  + Implementado o sequenciamento de ítens nas seções dos Detalhes do Computador;
  + Implementação em updates de SubRedes, onde o usuário poderá marcar/desmarcar subredes
    por local;
  * Correção no envio de email a partir da gravação de informações patrimoniais.
  + Exibição de alerta para falha de conexão ao servidor de updates nos detalhes da subrede.
    Os dois usuários/senhas são testados e os devidos campos destacados em amarelo em caso
    de falha, facilitando as providências de correção;
  + Exibição de informações de patrimônio (Unidades Organizacionais) associadas ao local;
    (Administração / Cadastros / Locais)
  + Exibição de destaques na opção Update de SubRedes: (Manutenção / Update de SubRedes)
    * AMARELO.: SubRedes com VERSÕES DIFERENTES DE MÓDULOS;
    * LARANJA.: SubRedes com INEXISTÊNCIA PARCIAL DE MÓDULOS;
    * VERMELHO: SubRedes com INEXISTÊNCIA TOTAL DE MÓDULOS.
  + Alterada a marca de nível de acesso na página dos detalhes do Local, passando a ser
    representada pelas duas letras iniciais do grupo de acesso;
  + Correção na rotina de Updates de SubRedes;
  + Correção na rotina de Detalhes de SubRedes.
  + Alterada a marca de nível de acesso na página Lista de Usuários (Administração /
    Cadastros / Usuários), passando a ser representada pelas duas letras iniciais do grupo
    de acesso conforme legenda:
    AD => Vermelho => Administração
    GC => Verde    => Gestão Central			
    SU => Amarelo  => Supervisão
    TE => Laranja  => Técnico
    CO => Azul     => Comum
  + Acrescentada a informação de total de usuários por nível de acesso na página
    Administração / Cadastros / Usuários;
  + Acrescentado "hint" para identificação das iniciais referentes aos níveis de acesso.
  + Acrescentada mensagem de "Operação Efetuada com Sucesso" ao fim do cadastramento de
    subrede seguido de updates;
  * Alterada a crítica de conexão ao servidor de updates nos detalhes da subrede, quando
    serão destacados apenas os campos relevantes;
  + Acrescentada a exibição da classificação de nível de acesso "Comum" na grade de
    visualização de usuários cadastrados;
  + Acrescentada a exibição de Totais de Redes, Usuários Primários e Usuários Secundários na
    visualização dos locais cadastrados;
  + Acrescentada a exibição de mensagem de sucesso/insucesso na conexão FTP nos detalhes das
    subredes.
  * Adequação do recebimento de informações patrimoniais ao conceito de Linhas de Negócio;
  * Correções no script get_config.php para o tratamento do sistema operacional Windows VISTA;
  * Correções no script library.php para o tratamento do sistema operacional Windows VISTA.
  * Adequação da opção Relatórios/Patrimônio ao conceito de Linhas de Negócio
  * Correção da opção de cadastramento de U.O.N. 2;
  * Adequação da opção Administração/Patrimônio/Interface ao novo layout da janela de coleta
    de informações patrimoniais
  + Exibição das sub-opções de Patrimônio de acordo com as definições efetuadas para
    UON1, UON1a e UON2
  * Correção do envio de dados ao MapaCacic, retirando as restrições ao local da estação
  * Restrição dos cadastramentos de U.O.N. 1, U.O.N. 1a e U.O.N. 2 ao nível
    "Administração"		  
  + Acrescentados diversas funcionalidades pertinentes ao conceito de "Linha de Negócio"
  * Correção do envio de dados ao MapaCacic, restringindo informações ao local da estação
  + Implementação do conceito de "Linha de Negócio" para as informações patrimoniais
  * Implementação da opção "Administração / Patrimônio / U.O. Nível 1a" para o nível
    "Administração"			
  * Correção na exibição de módulos a usuários com nível "Supervisão".
  + Acrescentado o nível "Técnico" para classificação(tick) na opção "Administração
    /Cadastros/Usuários";
  * Correção no cadastramento de usuários, quando da seleção de Local Secundário em
    conjunto (CTRL + Click) com valor vazio.
  * Correção da consulta gerada na página retornada pela opção "Administração/Patrimônio/
    U.O. Nível 2".



git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@371 fecfc0c7-e812-0410-ae72-849f08638ee7
cacic2.dof
... ... @@ -115,7 +115,7 @@ AutoIncBuild=0
115 115 MajorVer=2
116 116 MinorVer=2
117 117 Release=0
118   -Build=26
  118 +Build=30
119 119 Debug=0
120 120 PreRelease=0
121 121 Special=0
... ... @@ -126,13 +126,13 @@ CodePage=1252
126 126 [Version Info Keys]
127 127 CompanyName=Dataprev - Unidade Regional Espírito Santo
128 128 FileDescription=Configurador Automático e Coletor de Informações Computacionais
129   -FileVersion=2.2.0.26
  129 +FileVersion=2.2.0.30
130 130 InternalName=
131 131 LegalCopyright=
132 132 LegalTrademarks=
133 133 OriginalFilename=
134 134 ProductName=Cacic - Agente Principal
135   -ProductVersion=2.2.0.26
  135 +ProductVersion=2.2.0.30
136 136 Comments=Baseado na licença GPL (General Public License)
137 137 [HistoryLists\hlUnitAliases]
138 138 Count=1
... ...
cacic2.res
No preview for this file type
chkcacic/chkcacic.dof
... ... @@ -115,7 +115,7 @@ AutoIncBuild=0
115 115 MajorVer=2
116 116 MinorVer=2
117 117 Release=0
118   -Build=24
  118 +Build=32
119 119 Debug=0
120 120 PreRelease=0
121 121 Special=0
... ... @@ -126,13 +126,13 @@ CodePage=1252
126 126 [Version Info Keys]
127 127 CompanyName=Dataprev - Unidade Regional Espírito Santo (URES)
128 128 FileDescription=Módulo Verificador/Instalador dos Agentes Principais para o Sistema CACIC
129   -FileVersion=2.2.0.24
  129 +FileVersion=2.2.0.32
130 130 InternalName=
131 131 LegalCopyright=
132 132 LegalTrademarks=
133 133 OriginalFilename=
134 134 ProductName=ChkCACIC
135   -ProductVersion=2.2.0.24
  135 +ProductVersion=2.2.0.32
136 136 Comments=Baseado na licença GPL (General Public License)
137 137 [HistoryLists\hlUnitAliases]
138 138 Count=1
... ...
chkcacic/chkcacic.res
No preview for this file type
chkcacic/main.pas
... ... @@ -18,6 +18,12 @@ Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 18 ChkCacic.exe : Verificador/Instalador dos agentes principais Cacic2.exe e Ger_Cols.exe
19 19 =====================================================================================================
20 20  
  21 +v 2.2.0.38
  22 ++ Acrescentado a obtenção de versão interna do S.O.
  23 ++ Acrescentado a inserção dos agentes principais nas exceções do FireWall interno do MS-Windows VISTA...
  24 +.
  25 +Diversas rebuilds...
  26 +.
21 27 v 2.2.0.17
22 28 + Acrescentado o tratamento da passagem de opções em linha de comando
23 29 * chkcacic /serv=<ip_server> /dir=<local_path>c:\%windir%\cacic
... ... @@ -72,9 +78,11 @@ uses Windows,
72 78 DCPcrypt2,
73 79 DCPrijndael,
74 80 DCPbase64,
75   - NTFileSecurity, IdFTP,
  81 + NTFileSecurity,
  82 + IdFTP,
76 83 Tlhelp32,
77   - dialogs;
  84 + dialogs,
  85 + ExtCtrls;
78 86  
79 87 var v_ip_serv_cacic,
80 88 v_cacic_dir,
... ... @@ -112,34 +120,39 @@ const KeySize = 32; // 32 bytes = 256 bits
112 120 BlockSize = 16; // 16 bytes = 128 bits
113 121  
114 122 Procedure chkcacic;
  123 +procedure ComunicaInsucesso(strIndicador : String); //2.2.0.32
115 124 Procedure CriaFormConfigura;
116   -Procedure MostraFormConfigura;
117   -Procedure GravaConfiguracoes;
118 125 Procedure DelValorReg(Chave: String);
119   -procedure log_diario(strMsg : String);
120   -procedure log_DEBUG(p_msg:string);
  126 +Procedure GravaConfiguracoes;
  127 +procedure GravaIni(strFullPath : STring);
121 128 procedure KillProcess(hWindowHandle: HWND); // 2.2.0.15
  129 +procedure LogDebug(p_msg:string);
  130 +procedure LogDiario(strMsg : String);
122 131 procedure Matar(v_dir,v_files: string); // 2.2.0.16
123   -procedure GravaIni(strFullPath : STring);
124   -Function ListFileDir(Path: string):string;
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;
  132 +Procedure MostraFormConfigura;
  133 +
  134 +function abstraiCSD(p_te_so : String) : integer;
  135 +Function ChecaVersoesAgentes(p_strNomeAgente : String) : integer; // 2.2.0.16
126 136 Function Explode(Texto, Separador : String) : TStrings;
  137 +Function FindWindowByTitle(WindowTitle: string): Hwnd;
  138 +Function FTP(p_Host : String; p_Port : String; p_Username : String; p_Password : String; p_PathServer : String; p_File : String; p_Dest : String) : Boolean;
  139 +function Get_File_Size(sFileToExamine: string): integer; // 2.2.0.31
  140 +function GetFolderDate(Folder: string): TDateTime;
  141 +function GetNetworkUserName : String; // 2.2.0.32
127 142 Function GetRootKey(strRootKey: String): HKEY;
128   -Function SetValorChaveRegEdit(Chave: String; Dado: Variant): Variant;
129 143 Function GetValorChaveRegEdit(Chave: String): Variant;
130   -Function SetValorChaveRegIni(p_Secao, p_Chave, p_Valor, p_File : String): String;
131 144 Function GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String;
132   -Function HomeDrive : string;
133   -Function RemoveCaracteresEspeciais(Texto : String) : String;
134   -Function FindWindowByTitle(WindowTitle: string): Hwnd;
135 145 Function GetVersionInfo(p_File: string):string;
136   -Function VerFmt(const MS, LS: DWORD): string;
137 146 Function GetWinVer: Integer;
  147 +Function HomeDrive : string;
138 148 Function KillTask(ExeFileName: string): Integer;
139   -Function ChecaVersoesAgentes(p_strNomeAgente : String) : integer; // 2.2.0.16
  149 +Function ListFileDir(Path: string):string;
140 150 function Posso_Rodar_CACIC : boolean;
141   -function GetFolderDate(Folder: string): TDateTime;
142   -function abstraiCSD(p_te_so : String) : integer;
  151 +Function SetValorChaveRegEdit(Chave: String; Dado: Variant): Variant;
  152 +Function SetValorChaveRegIni(p_Secao, p_Chave, p_Valor, p_File : String): String;
  153 +Function RemoveCaracteresEspeciais(Texto : String) : String;
  154 +Function VerFmt(const MS, LS: DWORD): string;
  155 +
143 156 type
144 157 TForm1 = class(TForm)
145 158 PJVersionInfo1: TPJVersionInfo;
... ... @@ -158,6 +171,98 @@ implementation
158 171 uses FormConfig;
159 172  
160 173 {$R *.dfm}
  174 +function GetWinVer: Integer;
  175 +const
  176 + { operating system (OS)constants }
  177 + cOsUnknown = 0;
  178 + cOsWin95 = 1;
  179 + cOsWin95OSR2 = 2; // Não implementado.
  180 + cOsWin98 = 3;
  181 + cOsWin98SE = 4;
  182 + cOsWinME = 5;
  183 + cOsWinNT = 6;
  184 + cOsWin2000 = 7;
  185 + cOsXP = 8;
  186 + cOsServer2003 = 13;
  187 +var
  188 + osVerInfo: TOSVersionInfo;
  189 + platformID,
  190 + majorVer,
  191 + minorVer: Integer;
  192 + CSDVersion : String;
  193 +begin
  194 + Result := cOsUnknown;
  195 + { set operating system type flag }
  196 + osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
  197 + if GetVersionEx(osVerInfo) then
  198 + begin
  199 + platformId := osVerInfo.dwPlatformId;
  200 + majorVer := osVerInfo.dwMajorVersion;
  201 + minorVer := osVerInfo.dwMinorVersion;
  202 + CSDVersion := trim(osVerInfo.szCSDVersion);
  203 +
  204 + case osVerInfo.dwPlatformId of
  205 + VER_PLATFORM_WIN32_NT: { Windows NT/2000 }
  206 + begin
  207 + if majorVer <= 4 then
  208 + Result := cOsWinNT
  209 + else if (majorVer = 5) and (minorVer = 0) then
  210 + Result := cOsWin2000
  211 + else if (majorVer = 5) and (minorVer = 1) then
  212 + Result := cOsXP
  213 + else if (majorVer = 5) and (minorVer = 2) then
  214 + Result := cOsServer2003
  215 + else
  216 + Result := cOsUnknown;
  217 + end;
  218 + VER_PLATFORM_WIN32_WINDOWS: { Windows 9x/ME }
  219 + begin
  220 + if (majorVer = 4) and (minorVer = 0) then
  221 + Result := cOsWin95
  222 + else if (majorVer = 4) and (minorVer = 10) then
  223 + begin
  224 + if osVerInfo.szCSDVersion[1] = 'A' then
  225 + Result := cOsWin98SE
  226 + else
  227 + Result := cOsWin98;
  228 + end
  229 + else if (majorVer = 4) and (minorVer = 90) then
  230 + Result := cOsWinME
  231 + else
  232 + Result := cOsUnknown;
  233 + end;
  234 + else
  235 + Result := cOsUnknown;
  236 + end;
  237 + end
  238 + else
  239 + Result := cOsUnknown;
  240 +
  241 + // A partir da versão 2.2.0.24, defino o valor da ID Interna e atribuo-a sem o CSDVersion à versão externa
  242 + v_te_so := IntToStr(platformId) + '.' +
  243 + IntToStr(majorVer) + '.' +
  244 + IntToStr(minorVer) +
  245 + IfThen(CSDVersion='','','.'+CSDVersion);
  246 + if (Result = 0) then
  247 + Result := abstraiCSD(v_te_so);
  248 +
  249 + LogDebug('GetWinVer => ID_interna: '+ v_te_so + ' ID_Externa: ' + IntToStr(Result));
  250 +end;
  251 +function GetNetworkUserName : String;
  252 + // Gets the name of the user currently logged into the network on
  253 + // the local PC
  254 +var
  255 + temp: PChar;
  256 + Ptr: DWord;
  257 +const
  258 + buff = 255;
  259 +begin
  260 + ptr := buff;
  261 + temp := StrAlloc(buff);
  262 + GetUserName(temp, ptr);
  263 + Result := string(temp);
  264 + StrDispose(temp);
  265 +end;
161 266  
162 267 function IsAdmin: Boolean;
163 268 var hAccessToken: THandle;
... ... @@ -199,7 +304,37 @@ begin
199 304 end;
200 305 end;
201 306  
202   -procedure log_diario(strMsg : String);
  307 +procedure ComunicaInsucesso(strIndicador : String);
  308 +var IdHTTP2: TIdHTTP;
  309 + Request_Config : TStringList;
  310 + Response_Config : TStringStream;
  311 +begin
  312 + GetWinVer(); // Para obtenção de "te_so"
  313 + // Envio notificação de insucesso para o Módulo Gerente Centralizado
  314 + Request_Config := TStringList.Create;
  315 + Request_Config.Values['cs_indicador'] := strIndicador;
  316 + Request_Config.Values['id_usuario'] := GetNetworkUserName();
  317 + Request_Config.Values['te_so'] := v_te_so;
  318 + Response_Config := TStringStream.Create('');
  319 + Try
  320 + Try
  321 + IdHTTP2 := TIdHTTP.Create(nil);
  322 + IdHTTP2.Post('http://' + v_ip_serv_cacic + '/cacic2/ws/instalacacic.php', Request_Config, Response_Config);
  323 + IdHTTP2.Free;
  324 + Request_Config.Free;
  325 + Response_Config.Free;
  326 + Except
  327 + End;
  328 + finally
  329 + Begin
  330 + IdHTTP2.Free;
  331 + Request_Config.Free;
  332 + Response_Config.Free;
  333 + End;
  334 + End;
  335 +end;
  336 +
  337 +procedure LogDiario(strMsg : String);
203 338 var
204 339 HistoricoLog : TextFile;
205 340 begin
... ... @@ -226,12 +361,15 @@ begin
226 361 end;
227 362 end;
228 363  
229   -procedure log_DEBUG(p_msg:string);
  364 +procedure LogDebug(p_msg:string);
230 365 Begin
231 366 if v_Debugs then
232 367 Begin
233   - ShowMessage('DEBUG - '+p_msg);
234   - log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg);
  368 +
  369 + //if FileExists(Dir + '\Temp\Debugs\show.txt') then
  370 + // ShowMessage('DEBUG - '+p_msg);
  371 +
  372 + LogDiario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg);
235 373 End;
236 374 End;
237 375  
... ... @@ -282,7 +420,7 @@ begin
282 420 // Return the Base64 encoded result
283 421 Result := Base64EncodeStr(l_Data);
284 422 Except
285   - log_diario('Erro no Processo de Criptografia');
  423 + LogDiario('Erro no Processo de Criptografia');
286 424 End;
287 425 end;
288 426  
... ... @@ -318,7 +456,7 @@ begin
318 456 // Return the result
319 457 Result := l_Data;
320 458 Except
321   - log_diario('Erro no Processo de Decriptografia');
  459 + LogDiario('Erro no Processo de Decriptografia');
322 460 End;
323 461 end;
324 462  
... ... @@ -394,7 +532,7 @@ end;
394 532  
395 533 Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String);
396 534 begin
397   - log_DEBUG('Setando Chave "'+p_Chave+'" com "'+p_Valor+'"');
  535 + LogDebug('Setando Chave "'+p_Chave+'" com "'+p_Valor+'"');
398 536 // Exemplo: p_Chave => Configs.nu_ip_servidor : p_Valor => 10.71.0.120
399 537 if (v_tstrCipherOpened.IndexOf(p_Chave)<>-1) then
400 538 v_tstrCipherOpened[v_tstrCipherOpened.IndexOf(p_Chave)+1] := p_Valor
... ... @@ -421,90 +559,14 @@ begin
421 559 [HiWord(MS), LoWord(MS), HiWord(LS), LoWord(LS)])
422 560 end;
423 561  
424   -function GetWinVer: Integer;
425   -const
426   - { operating system (OS)constants }
427   - cOsUnknown = 0;
428   - cOsWin95 = 1;
429   - cOsWin95OSR2 = 2; // Não implementado.
430   - cOsWin98 = 3;
431   - cOsWin98SE = 4;
432   - cOsWinME = 5;
433   - cOsWinNT = 6;
434   - cOsWin2000 = 7;
435   - cOsXP = 8;
436   - cOsServer2003 = 13;
437   -var
438   - osVerInfo: TOSVersionInfo;
439   - platformID,
440   - majorVer,
441   - minorVer: Integer;
442   - CSDVersion : String;
443   -begin
444   - Result := cOsUnknown;
445   - { set operating system type flag }
446   - osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
447   - if GetVersionEx(osVerInfo) then
448   - begin
449   - platformId := osVerInfo.dwPlatformId;
450   - majorVer := osVerInfo.dwMajorVersion;
451   - minorVer := osVerInfo.dwMinorVersion;
452   - CSDVersion := trim(osVerInfo.szCSDVersion);
453 562  
454   - case osVerInfo.dwPlatformId of
455   - VER_PLATFORM_WIN32_NT: { Windows NT/2000 }
456   - begin
457   - if majorVer <= 4 then
458   - Result := cOsWinNT
459   - else if (majorVer = 5) and (minorVer = 0) then
460   - Result := cOsWin2000
461   - else if (majorVer = 5) and (minorVer = 1) then
462   - Result := cOsXP
463   - else if (majorVer = 5) and (minorVer = 2) then
464   - Result := cOsServer2003
465   - else
466   - Result := cOsUnknown;
467   - end;
468   - VER_PLATFORM_WIN32_WINDOWS: { Windows 9x/ME }
469   - begin
470   - if (majorVer = 4) and (minorVer = 0) then
471   - Result := cOsWin95
472   - else if (majorVer = 4) and (minorVer = 10) then
473   - begin
474   - if osVerInfo.szCSDVersion[1] = 'A' then
475   - Result := cOsWin98SE
476   - else
477   - Result := cOsWin98;
478   - end
479   - else if (majorVer = 4) and (minorVer = 90) then
480   - Result := cOsWinME
481   - else
482   - Result := cOsUnknown;
483   - end;
484   - else
485   - Result := cOsUnknown;
486   - end;
487   - end
488   - else
489   - Result := cOsUnknown;
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);
498   -
499   - log_DEBUG('GetWinVer => ID_interna: '+ v_te_so + ' ID_Externa: ' + IntToStr(Result));
500   -end;
501 563  
502 564 function abstraiCSD(p_te_so : String) : integer;
503 565 var tstrTe_so : tstrings;
504 566 Begin
505 567 tstrTe_so := Explode(p_te_so, '.');
506 568 Result := StrToInt(tstrTe_so[0] + tstrTe_so[1] + tstrTe_so[2]);
507   - log_DEBUG('abstraiCSD=> '+ tstrTe_so[0] + tstrTe_so[1] + tstrTe_so[2]);
  569 + LogDebug('abstraiCSD=> '+ tstrTe_so[0] + tstrTe_so[1] + tstrTe_so[2]);
508 570 End;
509 571  
510 572 function GetVersionInfo(p_File: string):string;
... ... @@ -567,7 +629,7 @@ begin
567 629 end;
568 630 ListaAuxSet.Free;
569 631 RegEditSet.Free;
570   - log_DEBUG('Setando valor "'+Dado+'" para chave "'+Chave+'"');
  632 + LogDebug('Setando valor "'+Dado+'" para chave "'+Chave+'"');
571 633 end;
572 634  
573 635 Function RemoveCaracteresEspeciais(Texto : String) : String;
... ... @@ -746,48 +808,53 @@ Function FTP(p_Host : String; p_Port : String; p_Username : String; p_Password :
746 808 var IdFTP : TIdFTP;
747 809 begin
748 810 Try
749   - Log_Debug('FTP: Criando instance');
  811 + LogDebug('FTP: Criando instance');
  812 +
750 813 IdFTP := TIdFTP.Create(nil);
751 814  
752   - Log_Debug('FTP: Host => "'+p_Host+'"');
  815 + LogDebug('FTP: Host => "'+p_Host+'"');
753 816 IdFTP.Host := p_Host;
754 817  
755   - Log_Debug('FTP: UserName => "'+p_Username+'"');
  818 + LogDebug('FTP: UserName => "'+p_Username+'"');
756 819 IdFTP.Username := p_Username;
757 820  
758   - Log_Debug('FTP: PassWord => "'+p_Password+'"');
  821 + LogDebug('FTP: PassWord => "'+p_Password+'"');
759 822 IdFTP.Password := p_Password;
760 823  
761   - Log_Debug('FTP: PathServer => "'+p_PathServer+'"');
  824 + LogDebug('FTP: PathServer => "'+p_PathServer+'"');
762 825 IdFTP.Port := strtoint(p_Port);
763 826  
764   - Log_Debug('FTP: Setando TransferType para "ftBinary"');
  827 + LogDebug('FTP: Setando TransferType para "ftBinary"');
765 828 IdFTP.TransferType := ftBinary;
766 829  
767   - Log_Debug('FTP: Change to "'+p_PathServer+'"');
  830 + LogDebug('FTP: Setando Passive para "true"');
  831 + IdFTP.Passive := true;
  832 +
  833 + LogDebug('FTP: Change to "'+p_PathServer+'"');
768 834 Try
769 835 if IdFTP.Connected = true then
770 836 begin
771   - Log_Debug('FTP: Connected => Desconectando...');
  837 + LogDebug('FTP: Connected => Desconectando...');
772 838 IdFTP.Disconnect;
773 839 end;
774   - Log_Debug('FTP: Efetuando Conexão...');
  840 + LogDebug('FTP: Efetuando Conexão...');
775 841 IdFTP.Connect(true);
776   - Log_Debug('FTP: Change to "'+p_PathServer+'"');
  842 + LogDebug('FTP: Change to "'+p_PathServer+'"');
777 843 IdFTP.ChangeDir(p_PathServer);
778 844 Try
779   - Log_Debug('Iniciando FTP de "'+p_Dest + '\' + p_File+'"');
780   - IdFTP.Get(p_File, p_Dest + '\' + p_File, True);
781   - result := true;
782   - Except
783   - Begin
784   - Log_Debug('Oops! Problemas Após Início de Operação...');
785   - result := false;
786   - end;
  845 + LogDebug('Iniciando FTP de "'+p_Dest + '\' + p_File+'"');
  846 + LogDebug('Size de "'+p_File+'" Antes do FTP => '+IntToSTR(IdFTP.Size(p_File)));
  847 + IdFTP.Get(p_File, p_Dest + '\' + p_File, True, True);
  848 + LogDebug('Size de "'+p_Dest + '\' + p_File +'" Após o FTP => '+IntToSTR(Get_File_Size(p_Dest + '\' + p_File)));
  849 + Finally
  850 + LogDebug('Size de "'+p_Dest + '\' + p_File +'" Após o FTP em Finally => '+IntToStr(Get_File_Size(p_Dest + '\' + p_File)));
  851 + IdFTP.Disconnect;
  852 + IdFTP.Free;
  853 + result := true;
787 854 End;
788 855 Except
789 856 Begin
790   - Log_Debug('Oops! Problemas Sem Início de Operação...');
  857 + LogDebug('Oops! Problemas Sem Início de Operação...');
791 858 result := false;
792 859 End;
793 860 end;
... ... @@ -947,17 +1014,27 @@ begin
947 1014 end;
948 1015 procedure LiberaFireWall(p_objeto:string);
949 1016 begin
950   - log_DEBUG('Rotina para Liberação de FireWall...');
  1017 + LogDebug('Rotina para Liberação de FireWall...');
951 1018 Try
952   - if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then
  1019 + if (abstraiCSD(v_te_so) >= 260) then // Se VISTA...
953 1020 Begin
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);
  1021 + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then
  1022 + Begin
  1023 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto);
  1024 + End
  1025 + else
  1026 + LogDebug('Exceção para "'+p_objeto+'" já existente.');
955 1027 End
956   - else log_DEBUG('Exceção para "'+p_objeto+'" já existente.');
  1028 + else
  1029 + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then
  1030 + Begin
  1031 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto);
  1032 + End
  1033 + else
  1034 + LogDebug('Exceção para "'+p_objeto+'" já existente.');
957 1035 Except
958   - log_DEBUG('Problema adicionando "'+p_objeto+'" à lista de exceções do FireWall!');
  1036 + LogDebug('Problema adicionando "'+p_objeto+'" à lista de exceções do FireWall!');
959 1037 End;
960   -
961 1038 end;
962 1039  
963 1040 {
... ... @@ -995,7 +1072,7 @@ Begin
995 1072 v_versao_REM := XML_RetornaValor(StringReplace(StrUpper(PChar(v_array_NomeAgente[v_array_NomeAgente.count-1])),'.EXE','',[rfReplaceAll]), v_retorno);
996 1073 v_versao_LOC := GetVersionInfo(p_strNomeAgente);
997 1074  
998   - log_DEBUG('Checando versão de "'+p_strNomeAgente+'"');
  1075 + LogDebug('Checando versão de "'+p_strNomeAgente+'"');
999 1076  
1000 1077 intAux := v_array_NomeAgente.Count;
1001 1078  
... ... @@ -1005,12 +1082,12 @@ Begin
1005 1082 Begin
1006 1083 if (GetValorChaveRegIni('versoes_agentes',v_array_NomeAgente[intAux-1],ExtractFilePath(Application.Exename)+'versoes_agentes.ini')<>'') then
1007 1084 Begin
1008   - log_DEBUG('Encontrado arquivo "'+(ExtractFilePath(Application.Exename)+'versoes_agentes.ini')+'"');
  1085 + LogDebug('Encontrado arquivo "'+(ExtractFilePath(Application.Exename)+'versoes_agentes.ini')+'"');
1009 1086 v_versao_REM := GetValorChaveRegIni('versoes_agentes',v_array_NomeAgente[intAux-1],ExtractFilePath(Application.Exename)+'versoes_agentes.ini');
1010 1087 End;
1011 1088 End;
1012 1089  
1013   - log_DEBUG('Versão Remota: "'+v_versao_REM+'" - Versão Local: "'+v_versao_LOC+'"');
  1090 + LogDebug('Versão Remota: "'+v_versao_REM+'" - Versão Local: "'+v_versao_LOC+'"');
1014 1091  
1015 1092 if (v_versao_REM + v_versao_LOC <> '') and
1016 1093 (v_versao_LOC <> '0000') then
... ... @@ -1037,13 +1114,13 @@ begin
1037 1114 while result=0 do
1038 1115 begin
1039 1116 strFileName := StringReplace(v_dir + '\' + SearchRec.Name,'\\','\',[rfReplaceAll]);
1040   - log_DEBUG('Tentando Excluir: '+strFileName);
  1117 + LogDebug('Tentando Excluir: '+strFileName);
1041 1118 if DeleteFile(strFileName) then
1042   - log_DEBUG('Exclusão de ' + strFileName + ' efetuada com sucesso!')
  1119 + LogDebug('Exclusão de ' + strFileName + ' efetuada com sucesso!')
1043 1120 else
1044 1121 Begin
1045   - log_DEBUG('Exclusão não efetuada! Provavelmente já esteja sendo executado...');
1046   - log_DEBUG('Tentarei finalizar Tarefa/Processo...');
  1122 + LogDebug('Exclusão não efetuada! Provavelmente já esteja sendo executado...');
  1123 + LogDebug('Tentarei finalizar Tarefa/Processo...');
1047 1124 if ((intWinVer <> 0) and (intWinVer <= 5)) or
1048 1125 (abstraiCSD(v_te_so) < 250) then // Menor que NT Like
1049 1126 KillTask(SearchRec.Name)
... ... @@ -1051,7 +1128,7 @@ begin
1051 1128 KillProcess(FindWindow(PChar(SearchRec.Name),nil));
1052 1129  
1053 1130 if DeleteFile(strFileName) then
1054   - log_DEBUG('Exclusão Impossibilitada de ' + strFileName + '!');
  1131 + LogDebug('Exclusão Impossibilitada de ' + strFileName + '!');
1055 1132 End;
1056 1133  
1057 1134 Result:=FindNext(SearchRec);
... ... @@ -1125,7 +1202,7 @@ procedure verifyAndGet(strModuleName,
1125 1202 // Verifico validade do Módulo e mato-o em caso negativo.
1126 1203 intFileSize := Get_File_Size(strDestinationFolderName + '\'+strModuleName);
1127 1204  
1128   - log_DEBUG('verifyAndGet - intFileSize de "'+strDestinationFolderName + '+strModuleName+'": ' + IntToStr(intFileSize));
  1205 + LogDebug('verifyAndGet - intFileSize de "'+strDestinationFolderName + '+strModuleName+'": ' + IntToStr(intFileSize));
1129 1206  
1130 1207 If (intFileSize <= 0) then
1131 1208 Matar(strDestinationFolderName, strModuleName);
... ... @@ -1134,7 +1211,7 @@ procedure verifyAndGet(strModuleName,
1134 1211 Begin
1135 1212 if (FileExists(ExtractFilePath(Application.Exename) + '\modulos\'+strModuleName)) then
1136 1213 Begin
1137   - log_diario('Copiando '+strModuleName+' de '+ExtractFilePath(Application.Exename)+'modulos);
  1214 + LogDiario('Copiando '+strModuleName+' de '+ExtractFilePath(Application.Exename)+'modulos);
1138 1215 CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\'+strModuleName), PChar(strDestinationFolderName + '\'+strModuleName),false);
1139 1216 FileSetAttr (PChar(strDestinationFolderName + '\' + strModuleName),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED
1140 1217 End
... ... @@ -1150,17 +1227,17 @@ procedure verifyAndGet(strModuleName,
1150 1227 strDestinationFolderName) and (strExibeInformacoes = 'S') then
1151 1228 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 1229 Except
1153   - log_DEBUG('FTP de "'+ strDestinationFolderName + ' + strModuleName+'" Interrompido.');
  1230 + LogDebug('FTP de "'+ strDestinationFolderName + ' + strModuleName+'" Interrompido.');
1154 1231 End;
1155 1232  
1156 1233 if not FileExists(strDestinationFolderName + '\' + strModuleName) Then
1157 1234 Begin
1158   - log_DEBUG('Problemas Efetuando Download de '+ strDestinationFolderName + '\' + strModuleName+' (FTP)');
1159   - log_DEBUG('Conexão:');
1160   - log_DEBUG(strServUpdates+', '+strPortaServUpdates+', '+strNomeUsuarioLoginServUpdates+', '+strSenhaLoginServUpdates+', '+strPathServUpdates);
  1235 + LogDebug('Problemas Efetuando Download de '+ strDestinationFolderName + '\' + strModuleName+' (FTP)');
  1236 + LogDebug('Conexão:');
  1237 + LogDebug(strServUpdates+', '+strPortaServUpdates+', '+strNomeUsuarioLoginServUpdates+', '+strSenhaLoginServUpdates+', '+strPathServUpdates);
1161 1238 End
1162 1239 else
1163   - log_diario('Download Concluído de "'+strModuleName+'" (FTP)');
  1240 + LogDiario('Download Concluído de "'+strModuleName+'" (FTP)');
1164 1241 end;
1165 1242 End;
1166 1243 End;
... ... @@ -1227,15 +1304,24 @@ begin
1227 1304 bool_CommandLine := true;
1228 1305 End;
1229 1306  
  1307 +
  1308 + // ATENÇÃO: Trecho para uso exclusivo no âmbito da DATAPREV a nível Brasil, para internalização maciça.
  1309 + // Para envio à Comunidade, retirar as chaves mais abaixo, para que o código padrão seja descomentado.
  1310 + // Anderson Peterle - FEV2008
  1311 + //v_ip_serv_cacic := 'UXRJO115';
  1312 + //v_cacic_dir := 'Cacic';
  1313 + //v_exibe_informacoes := 'N'; // Manter o "N", pois, esse mesmo ChkCacic será colocado em NetLogons!
  1314 +
  1315 +
  1316 +
1230 1317 if not bool_CommandLine then
1231 1318 Begin
1232 1319 If not (FileExists(ExtractFilePath(Application.Exename) + '\chkcacic.ini')) then
1233 1320 Begin
1234   - log_diario('Abrindo formulário de configurações');
  1321 + LogDiario('Abrindo formulário de configurações');
1235 1322 CriaFormConfigura;
1236 1323 MostraFormConfigura;
1237 1324 End;
1238   -
1239 1325 v_ip_serv_cacic := GetValorChaveRegIni('Cacic2', 'ip_serv_cacic' , ExtractFilePath(Application.Exename) + '\chkcacic.ini');
1240 1326 v_cacic_dir := GetValorChaveRegIni('Cacic2', 'cacic_dir' , ExtractFilePath(Application.Exename) + '\chkcacic.ini');
1241 1327 v_exibe_informacoes := GetValorChaveRegIni('Cacic2', 'exibe_informacoes', ExtractFilePath(Application.Exename) + '\chkcacic.ini');
... ... @@ -1249,7 +1335,7 @@ begin
1249 1335 if (FormatDateTime('ddmmyyyy', GetFolderDate(Dir + '\Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then
1250 1336 Begin
1251 1337 v_Debugs := true;
1252   - log_DEBUG('Pasta "' + Dir + '\Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(Dir + '\Temp\Debugs'))+' encontrada. DEBUG ativado.');
  1338 + LogDebug('Pasta "' + Dir + '\Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(Dir + '\Temp\Debugs'))+' encontrada. DEBUG ativado.');
1253 1339 End;
1254 1340 End;
1255 1341  
... ... @@ -1258,20 +1344,21 @@ begin
1258 1344 // Verifico se o S.O. é NT Like e se o Usuário está com privilégio administrativo...
1259 1345 if (((intWinVer <> 0) and (intWinVer >= 6)) or
1260 1346 (abstraiCSD(v_te_so) >= 250)) and
1261   - (v_exibe_informacoes = 'S') and
1262 1347 not IsAdmin then // Se NT/2000/XP/...
1263 1348 Begin
1264   - MessageDLG(#13#10+'ATENÇÃO! Essa aplicação requer execução com nível administrativo.',mtError,[mbOK],0);
  1349 + if (v_exibe_informacoes = 'S') then
  1350 + MessageDLG(#13#10+'ATENÇÃO! Essa aplicação requer execução com nível administrativo.',mtError,[mbOK],0);
  1351 + ComunicaInsucesso('0'); // O indicador "0" (zero) sinalizará falta de privilégio na estação
1265 1352 End
1266 1353 else
1267 1354 Begin
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(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1355 + LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1356 + LogDebug(':::::::::::::: OBTENDO VALORES DO "chkcacic.ini" ::::::::::::::');
  1357 + LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1358 + LogDebug('Drive de instalação......................: '+v_home_drive);
  1359 + LogDebug('Pasta para instalação....................: '+Dir);
  1360 + LogDebug('IP do servidor...........................: '+v_ip_serv_cacic);
  1361 + LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
1275 1362 bool_configura := false;
1276 1363  
1277 1364 //chave AES. Recomenda-se que cada empresa/órgão altere a sua chave.
... ... @@ -1281,50 +1368,42 @@ begin
1281 1368 v_DatFileName := Dir + '\cacic2.dat';
1282 1369 v_tstrCipherOpened := CipherOpen(v_DatFileName);
1283 1370  
1284   -
1285 1371 if ((intWinVer <> 0) and (intWinVer >= 8)) or
1286   - (abstraiCSD(v_te_so) >= 250) then // Se >= WinXP...
  1372 + (abstraiCSD(v_te_so) >= 250) then // Se >= Maior ou Igual ao WinXP...
1287 1373 Begin
1288 1374 Try
1289   - // Libero as policies do FireWall (testes)
1290   - Try
  1375 + // Libero as policies do FireWall Interno
  1376 + if (abstraiCSD(v_te_so) >= 260) then // Maior ou Igual ao VISTA...
1291 1377 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');
1295   -
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');
1299   -
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');
1303   -
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');
  1378 + Try
  1379 + Begin
  1380 + // Liberando as conexões de Saída para o FTP
  1381 + SetValorChaveRegEdit('HKEY_LOCAL//_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\FTP-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App=C:\\windows\\system32\\ftp.exe|Name=Programa de transferência de arquivos|Desc=Programa de transferência de arquivos|Edge=FALSE|');
  1382 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\FTP-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App=C:\\windows\\system32\\ftp.exe|Name=Programa de transferência de arquivos|Desc=Programa de transferência de arquivos|Edge=FALSE|');
  1383 +
  1384 + // Liberando as conexões de Saída para o Ger_Cols
  1385 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-GERCOLS-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+Dir+'\modulos\\ger_cols.exe|Name=Módulo Gerente de Coletas do Sistema CACIC|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|');
  1386 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-GERCOLS-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+Dir+'\modulos\\ger_cols.exe|Name=Módulo Gerente de Coletas do Sistema CACIC|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|');
  1387 +
  1388 + // Liberando as conexões de Saída para o ChkCacic
  1389 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKCACIC-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+ExtractFilePath(Application.Exename) + '\chkcacic.exe|Name=chkcacic.exe|Desc=chkcacic.exe|Edge=FALSE|');
  1390 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKCACIC-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+ExtractFilePath(Application.Exename) + '\chkcacic.exe|Name=chkcacic.exe|Desc=chkcacic.exe|Edge=FALSE|');
  1391 +
  1392 + // Liberando as conexões de Saída para o ChkSis
  1393 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKSIS-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+HomeDrive + '\chksis.exe|Name=Módulo Verificador de Integridade do Sistema CACIC|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|');
  1394 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKSIS-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+HomeDrive + '\chksis.exe|Name=Módulo Verificador de Integridade do Sistema CACIC|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|');
  1395 + End
  1396 + Except
  1397 + LogDebug('Problema Liberando Policies de FireWall!');
  1398 + End;
1319 1399 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');
1327   -
  1400 + else
  1401 + Begin
  1402 + // Acrescento o ChkCacic às exceções do FireWall nativo...
  1403 + {chkcacic}
  1404 + LogDebug('Inserindo "'+ExtractFilePath(Application.Exename) + 'chkcacic" nas exceções do FireWall!');
  1405 + LiberaFireWall(ExtractFilePath(Application.Exename) + 'chkcacic');
  1406 + End;
1328 1407 Except
1329 1408 End;
1330 1409 End;
... ... @@ -1334,7 +1413,7 @@ begin
1334 1413  
1335 1414 while (v_ip_serv_cacic = '') or (v_cacic_dir = '') or bool_configura do
1336 1415 Begin
1337   - log_diario('Abrindo formulário de configurações');
  1416 + LogDiario('Abrindo formulário de configurações');
1338 1417 bool_configura := false;
1339 1418 CriaFormConfigura;
1340 1419 Configs.Edit_ip_serv_cacic.text := v_ip_serv_cacic;
... ... @@ -1352,7 +1431,7 @@ begin
1352 1431 // Verifico a existência do diretório configurado para o Cacic, normalmente CACIC
1353 1432 if not DirectoryExists(Dir) then
1354 1433 begin
1355   - log_diario('Criando pasta '+Dir);
  1434 + LogDiario('Criando pasta '+Dir);
1356 1435 ForceDirectories(Dir);
1357 1436 end;
1358 1437  
... ... @@ -1361,14 +1440,14 @@ begin
1361 1440 begin
1362 1441 Matar(Dir, '\cacic2.exe');
1363 1442 ForceDirectories(Dir + '\modulos');
1364   - log_diario('Criando pasta '+Dir+'\modulos');
  1443 + LogDiario('Criando pasta '+Dir+'\modulos');
1365 1444 end;
1366 1445  
1367 1446 // Crio o SubDiretório TEMP, caso não exista
1368 1447 if not DirectoryExists(Dir+'\temp') then
1369 1448 begin
1370 1449 ForceDirectories(Dir + '\temp');
1371   - log_diario('Criando pasta '+Dir+'\temp');
  1450 + LogDiario('Criando pasta '+Dir+'\temp');
1372 1451 end;
1373 1452  
1374 1453  
... ... @@ -1380,6 +1459,7 @@ begin
1380 1459 Response_Config := TStringStream.Create('');
1381 1460  
1382 1461 Try
  1462 + LogDiario('Iniciando comunicação com '+'http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php');
1383 1463 IdHTTP1 := TIdHTTP.Create(IdHTTP1);
1384 1464 idHTTP1.AllowCookies := true;
1385 1465 idHTTP1.ASCIIFilter := false;
... ... @@ -1399,9 +1479,11 @@ begin
1399 1479 idHTTP1.Request.ContentType := 'text/html';
1400 1480 idHTTP1.SendBufferSize := 32768;
1401 1481 idHTTP1.Tag := 0;
1402   - log_diario('Iniciando comunicação com '+'http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php');
  1482 +
1403 1483 IdHTTP1.Post('http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php', Request_Config, Response_Config);
  1484 + idHTTP1.Disconnect;
1404 1485 idHTTP1.Free;
  1486 +
1405 1487 v_retorno := Response_Config.DataString;
1406 1488 v_te_serv_updates := XML_RetornaValor('te_serv_updates' , v_retorno);
1407 1489 v_nu_porta_serv_updates := XML_RetornaValor('nu_porta_serv_updates' , v_retorno);
... ... @@ -1409,27 +1491,27 @@ begin
1409 1491 v_te_senha_login_serv_updates := XML_RetornaValor('te_senha_login_serv_updates' , v_retorno);
1410 1492 v_te_path_serv_updates := XML_RetornaValor('te_path_serv_updates' , v_retorno);
1411 1493  
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(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1494 + LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1495 + LogDebug(':::::::::::::::: VALORES OBTIDOS NO Gerente WEB :::::::::::::::');
  1496 + LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1497 + LogDebug('Servidor de updates......................: '+v_te_serv_updates);
  1498 + LogDebug('Porta do servidor de updates.............: '+v_nu_porta_serv_updates);
  1499 + LogDebug('Usuário para login no servidor de updates: '+v_nm_usuario_login_serv_updates);
  1500 + LogDebug('Pasta no servidor de updates.............: '+v_te_path_serv_updates);
  1501 + LogDebug(' ');
  1502 + LogDebug('Versões dos Agentes Principais:');
  1503 + LogDebug('------------------------------');
  1504 + LogDebug('Cacic2 - Agente do Systray.........: '+XML_RetornaValor('CACIC2', v_retorno));
  1505 + LogDebug('Ger_Cols - Gerente de Coletas........: '+XML_RetornaValor('GER_COLS', v_retorno));
  1506 + LogDebug('ChkSis - Verificador de Integridade: '+XML_RetornaValor('CHKSIS', v_retorno));
  1507 + LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
1426 1508 Except
1427 1509 Begin
1428 1510 if v_exibe_informacoes = 'S' then
1429 1511 MessageDLG(#13#10+'ATENÇÃO! Não foi possível estabelecer comunicação com o módulo Gerente WEB em "'+v_ip_serv_cacic+'".',mtError,[mbOK],0);
1430   - log_diario('**********************************************************');
1431   - log_diario('Oops! Não Foi Possível Comunicar com o Módulo Gerente WEB!');
1432   - log_diario('**********************************************************');
  1512 + LogDiario('**********************************************************');
  1513 + LogDiario('Oops! Não Foi Possível Comunicar com o Módulo Gerente WEB!');
  1514 + LogDiario('**********************************************************');
1433 1515 End
1434 1516 End;
1435 1517 Request_Config.Free;
... ... @@ -1440,10 +1522,11 @@ begin
1440 1522 if ((intWinVer <> 0) and (intWinVer > 5)) or
1441 1523 (abstraiCSD(v_te_so) >= 250) then
1442 1524 Begin
1443   - log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
1444   - log_DEBUG('::::::: VERIFICANDO FILE SYSTEM E ATRIBUINDO PERMISSÕES :::::::');
1445   - log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1525 + LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1526 + LogDebug('::::::: VERIFICANDO FILE SYSTEM E ATRIBUINDO PERMISSÕES :::::::');
  1527 + LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
1446 1528  
  1529 + // Atribuição de acesso ao módulo principal e pastas
1447 1530 Form1.FS_SetSecurity(Dir);
1448 1531 Form1.FS_SetSecurity(Dir + '\cacic2.exe');
1449 1532 Form1.FS_SetSecurity(Dir + '\cacic2.dat');
... ... @@ -1451,7 +1534,7 @@ begin
1451 1534 Form1.FS_SetSecurity(Dir + '\modulos');
1452 1535 Form1.FS_SetSecurity(Dir + '\temp');
1453 1536  
1454   - // Atribuição de acesso a todos os módulos para permissão de atualizações de versão
  1537 + // Atribuição de acesso aos módulos de gerenciamento de coletas e coletas para permissão de atualizações de versões
1455 1538 Form1.FS_SetSecurity(Dir + '\modulos\ger_cols.exe');
1456 1539 Form1.FS_SetSecurity(Dir + '\modulos\col_anvi.exe');
1457 1540 Form1.FS_SetSecurity(Dir + '\modulos\col_comp.exe');
... ... @@ -1470,7 +1553,7 @@ begin
1470 1553  
1471 1554 // Atribuição de acesso para atualização/exclusão de log do instalador
1472 1555 Form1.FS_SetSecurity(v_home_drive + 'chkcacic.log');
1473   - log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  1556 + LogDebug(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
1474 1557 End;
1475 1558  
1476 1559 // Verificação de versão do cacic2.exe e exclusão em caso de versão antiga/diferente da atual
... ... @@ -1548,7 +1631,7 @@ begin
1548 1631 // Tento detectar o ChkSis.INI e crio-o caso necessário
1549 1632 If not FileExists(HomeDrive + '\chksis.ini') Then
1550 1633 begin
1551   - log_DEBUG('Criando '+HomeDrive + '\chksis.ini');
  1634 + LogDebug('Criando '+HomeDrive + '\chksis.ini');
1552 1635 GravaIni(HomeDrive + '\chksis.ini');
1553 1636 FileSetAttr ( PChar(HomeDrive + '\chksis.ini'),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
1554 1637 end;
... ... @@ -1556,13 +1639,13 @@ begin
1556 1639 // Tento detectar o cacic2.INI e crio-o caso necessário
1557 1640 If not FileExists(Dir + '\cacic2.ini') Then
1558 1641 begin
1559   - log_DEBUG('Criando/Recriando '+Dir + '\cacic2.ini');
  1642 + LogDebug('Criando/Recriando '+Dir + '\cacic2.ini');
1560 1643 GravaIni(Dir + '\cacic2.ini');
1561 1644 end;
1562 1645  
1563 1646 // Verifico se existe a pasta "modulos"
1564 1647 v_modulos := ListFileDir(ExtractFilePath(Application.Exename)+'\modulos\*.exe');
1565   - if (v_modulos <> '') then log_diario('Pasta "Modulos" encontrada..');
  1648 + if (v_modulos <> '') then LogDiario('Pasta "Modulos" encontrada..');
1566 1649  
1567 1650 // Tento detectar o Agente Principal e copio ou faço FTP caso não exista
1568 1651 verifyAndGet('cacic2.exe',
... ... @@ -1593,7 +1676,7 @@ begin
1593 1676 (v_array_modulos[intAux]<>'ger_cols.exe') and
1594 1677 (v_array_modulos[intAux]<>'chksis.exe') then
1595 1678 Begin
1596   - log_diario('Copiando '+v_array_modulos[intAux]+' de '+ExtractFilePath(Application.Exename)+'modulos);
  1679 + LogDiario('Copiando '+v_array_modulos[intAux]+' de '+ExtractFilePath(Application.Exename)+'modulos);
1597 1680 CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\'+v_array_modulos[intAux]), PChar(Dir + '\modulos\'+v_array_modulos[intAux]),false);
1598 1681 FileSetAttr (PChar(Dir + '\modulos\'+v_array_modulos[intAux]),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
1599 1682 End;
... ... @@ -1640,16 +1723,17 @@ begin
1640 1723 // Acrescento o ChkSis e o Ger_Cols às exceções do FireWall nativo...
1641 1724  
1642 1725 {chksis}
  1726 + LogDebug('Inserindo "'+HomeDrive + '\chksis" nas exceções do FireWall!');
1643 1727 LiberaFireWall(HomeDrive + '\chksis');
1644 1728  
1645 1729 {ger_cols}
  1730 + LogDebug('Inserindo "'+Dir + '\modulos\ger_cols" nas exceções do FireWall!');
1646 1731 LiberaFireWall(Dir + '\modulos\ger_cols');
1647   -
1648 1732 Except
1649 1733 End;
1650 1734 End;
1651 1735  
1652   - log_DEBUG('Gravando registros para auto-execução');
  1736 + LogDebug('Gravando registros para auto-execução');
1653 1737  
1654 1738 // Crio a chave/valor cacic2 para autoexecução do Cacic, caso não exista esta chave/valor
1655 1739 // Crio a chave/valor chksis para autoexecução do ChkSIS, caso não exista esta chave/valor
... ... @@ -1663,26 +1747,26 @@ begin
1663 1747  
1664 1748 // Igualo as chaves ip_serv_cacic dos arquivos chksis.ini e cacic2.ini!
1665 1749 SetValorDatMemoria('Configs.EnderecoServidor', v_ip_serv_cacic);
1666   - log_DEBUG('Fechando Arquivo de Configurações do Cacic');
  1750 + LogDebug('Fechando Arquivo de Configurações do Cacic');
1667 1751 CipherClose(v_DatFileName);
1668 1752  
1669   - log_DEBUG('Abrindo Arquivo de Configurações do ChkSis');
  1753 + LogDebug('Abrindo Arquivo de Configurações do ChkSis');
1670 1754 CipherOpen(HomeDrive + '\chksis.dat');
1671 1755 SetValorDatMemoria('Cacic2.ip_serv_cacic', v_ip_serv_cacic);
1672 1756 CipherClose(HomeDrive + '\chksis.dat');
1673 1757  
1674 1758 // Volto a gravar o chksis.ini para o difícil caso de leitura por versões antigas
1675 1759 SetValorChaveRegIni('Cacic2', 'ip_serv_cacic', v_ip_serv_cacic, HomeDrive + '\chksis.ini');
1676   - log_DEBUG('Fechando Arquivo de Configurações do ChkSis');
  1760 + LogDebug('Fechando Arquivo de Configurações do ChkSis');
1677 1761  
1678   - log_DEBUG('Resgatando informações para identificação de alteração do agente CACIC2');
  1762 + LogDebug('Resgatando informações para identificação de alteração do agente CACIC2');
1679 1763 // Pego as informações de dia/mês/ano/horas/minutos/segundos/milésimos que identificam os agentes
1680 1764 strDataHoraCACIC2_FIM := FormatDateTime('ddmmyyyyhhnnsszzz', GetFolderDate(Dir + '\cacic2.exe'));
1681   - log_DEBUG('Inicial => "' + strDataHoraCACIC2_INI + '" Final => "' + strDataHoraCACIC2_FIM + '"');
  1765 + LogDebug('Inicial => "' + strDataHoraCACIC2_INI + '" Final => "' + strDataHoraCACIC2_FIM + '"');
1682 1766  
1683   - log_DEBUG('Resgatando informações para identificação de alteração do agente GER_COLS');
  1767 + LogDebug('Resgatando informações para identificação de alteração do agente GER_COLS');
1684 1768 strDataHoraGERCOLS_FIM := FormatDateTime('ddmmyyyyhhnnsszzz', GetFolderDate(Dir + '\modulos\ger_cols.exe'));
1685   - log_DEBUG('Inicial => "' + strDataHoraGERCOLS_INI + '" Final => "' + strDataHoraGERCOLS_FIM + '"');
  1769 + LogDebug('Inicial => "' + strDataHoraGERCOLS_INI + '" Final => "' + strDataHoraGERCOLS_FIM + '"');
1686 1770  
1687 1771 // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor
1688 1772 if ((strDataHoraCACIC2_INI <> strDataHoraCACIC2_FIM) OR
... ... @@ -1692,33 +1776,37 @@ begin
1692 1776 if (GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2')=Dir + '\cacic2.exe') then
1693 1777 Begin
1694 1778 if (v_exibe_informacoes = 'S') then
1695   - MessageDlg(#13#10+#13#10+v_te_instala_frase_sucesso+#13#10+#13#10+#13#10 + '======================================================' + #13#10 + v_te_texto_janela_instalacao+ '======================================================',mtInformation,[mbok],0);
  1779 + MessageDlg(#13#10+#13#10+'Sistema CACIC'+#13#10+#13#10+v_te_instala_frase_sucesso+#13#10+#13#10+#13#10 + '======================================================' + #13#10 + v_te_texto_janela_instalacao+ #13#10 +'======================================================',mtInformation,[mbok],0);
1696 1780 End
1697   - else if (v_exibe_informacoes = 'S') then
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);
1699   -
  1781 + else
  1782 + Begin
  1783 + if (v_exibe_informacoes = 'S') then
  1784 + MessageDlg(#13#10+#13#10+'Sistema CACIC'+#13#10+#13#10+v_te_instala_frase_insucesso+#13#10+#13#10+#13#10 + '======================================================' + #13#10 + v_te_texto_janela_instalacao+ #13#10 +'======================================================',mtInformation,[mbok],0);
  1785 + ComunicaInsucesso('1'); // O indicador "1" sinalizará que não foi devido a privilégio na estação
  1786 + End;
1700 1787 End
1701 1788 else
1702   - log_diario('ATENÇÃO: Instalação NÃO REALIZADA ou ATUALIZAÇÃO DESNECESSÁRIA!');
  1789 + LogDiario('ATENÇÃO: Instalação NÃO REALIZADA ou ATUALIZAÇÃO DESNECESSÁRIA!');
1703 1790  
1704   - if Posso_Rodar_CACIC or not bool_ExistsAutoRun then
  1791 + if Posso_Rodar_CACIC or
  1792 + not bool_ExistsAutoRun or
  1793 + (strDataHoraCACIC2_INI <> strDataHoraCACIC2_FIM) then
1705 1794 Begin
1706   - log_DEBUG('Executando '+Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic);
  1795 + LogDebug('Executando '+Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic);
1707 1796  
1708 1797 // Caso tenha havido download de agentes principais, executar coletas imediatamente...
1709   - if ((strDataHoraCACIC2_INI <> strDataHoraCACIC2_FIM) OR
1710   - (strDataHoraGERCOLS_INI <> strDataHoraGERCOLS_FIM)) then
  1798 + if (strDataHoraCACIC2_INI <> strDataHoraCACIC2_FIM) then
1711 1799 WinExec(PChar(Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute'), SW_HIDE)
1712 1800 else
1713 1801 WinExec(PChar(Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic ), SW_HIDE);
1714 1802 End
1715 1803 else
1716   - log_DEBUG('Chave de Auto-Execução já existente ou Execução já iniciada...');
  1804 + LogDebug('Chave de Auto-Execução já existente ou Execução já iniciada...');
1717 1805 End;
1718 1806 Except
1719   - log_diario('Falha na Instalação/Atualização');
  1807 + LogDiario('Falha na Instalação/Atualização');
1720 1808 End;
1721   -
  1809 + Application.Terminate;
1722 1810 end;
1723 1811  
1724 1812 function FindWindowByTitle(WindowTitle: string): Hwnd;
... ... @@ -1815,7 +1903,7 @@ begin
1815 1903 // if (FindWindowByTitle('chksis') = 0) then
1816 1904 chkcacic;
1817 1905 // else
1818   -// log_diario('Não executei devido execução em paralelo de "chksis"');
  1906 +// LogDiario('Não executei devido execução em paralelo de "chksis"');
1819 1907  
1820 1908 Application.Terminate;
1821 1909 end;
... ... @@ -1838,7 +1926,7 @@ begin
1838 1926 Begin // If local group, alias or user...
1839 1927 v_FS_Security.FileRights[intAux] := [faAll];
1840 1928 v_FS_Security.DirectoryRights[intAux] := [faAll];
1841   - log_DEBUG(p_Target + ' [Full Access] >> '+v_FS_Security.EntryName[intAux]);
  1929 + LogDebug(p_Target + ' [Full Access] >> '+v_FS_Security.EntryName[intAux]);
1842 1930 //Setting total access on p_Target to local groups.
1843 1931 End;
1844 1932 End;
... ... @@ -1848,7 +1936,7 @@ begin
1848 1936 // Set total permissions to local groups
1849 1937 v_FS_Security.SetSecurity;
1850 1938 end
1851   - else Log_diario('File System: "' + v_FS_Security.FileSystemName+'" - Ok!');
  1939 + else LogDiario('File System: "' + v_FS_Security.FileSystemName+'" - Ok!');
1852 1940  
1853 1941 v_FS_Security.Free;
1854 1942 end;
... ...
chksis/chksis.dof
... ... @@ -115,7 +115,7 @@ AutoIncBuild=0
115 115 MajorVer=2
116 116 MinorVer=2
117 117 Release=0
118   -Build=20
  118 +Build=29
119 119 Debug=0
120 120 PreRelease=0
121 121 Special=0
... ... @@ -126,13 +126,13 @@ CodePage=1252
126 126 [Version Info Keys]
127 127 CompanyName=Dataprev - Unidade Regional Espírito Santo (URES)
128 128 FileDescription=Módulo Verificador de Integridade do Sistema CACIC
129   -FileVersion=2.2.0.20
  129 +FileVersion=2.2.0.29
130 130 InternalName=
131 131 LegalCopyright=
132 132 LegalTrademarks=
133 133 OriginalFilename=
134 134 ProductName=ChkSIS
135   -ProductVersion=2.2.0.20
  135 +ProductVersion=2.2.0.29
136 136 Comments=Baseado na licença GPL (General Public License)
137 137 [HistoryLists\hlDebugSourcePath]
138 138 Count=1
... ...
chksis/chksis.dpr
... ... @@ -50,8 +50,10 @@ var PJVersionInfo1: TPJVersionInfo;
50 50 v_DatFileName,
51 51 v_versao_local,
52 52 v_versao_remota,
53   - v_retorno : String;
54   -
  53 + v_retorno,
  54 + v_te_so : String;
  55 + intWinVer : integer;
  56 + v_Debugs : Boolean;
55 57 var v_tstrCipherOpened : TStrings;
56 58  
57 59 // Some constants that are dependant on the cipher being used
... ... @@ -111,14 +113,17 @@ Begin
111 113 Implode := strAux;
112 114 end;
113 115  
114   -procedure log_diario(strMsg,p_path : String);
  116 +procedure log_diario(strMsg : String);
115 117 var
116 118 HistoricoLog : TextFile;
117   - strDataArqLocal, strDataAtual : string;
  119 + strDataArqLocal,
  120 + strDataAtual,
  121 + p_path : string;
118 122 begin
119 123 try
120   - FileSetAttr (Dir + '\cacic2.log',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
121   - AssignFile(HistoricoLog,Dir + '\cacic2.log'); {Associa o arquivo a uma variável do tipo TextFile}
  124 + p_path := Dir + '\chksis.log';
  125 + FileSetAttr (p_path,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
  126 + AssignFile(HistoricoLog,p_path); {Associa o arquivo a uma variável do tipo TextFile}
122 127 {$IOChecks off}
123 128 Reset(HistoricoLog); {Abre o arquivo texto}
124 129 {$IOChecks on}
... ... @@ -128,7 +133,7 @@ begin
128 133 Append(HistoricoLog);
129 134 Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log <=======================');
130 135 end;
131   - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(Dir + '\cacic2.log')));
  136 + DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(p_path)));
132 137 DateTimeToString(strDataAtual , 'yyyymmdd', Date);
133 138 if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual...
134 139 begin
... ... @@ -140,9 +145,20 @@ begin
140 145 Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now)+ '[Verif.Integr.Sistema] '+strMsg); {Grava a string Texto no arquivo texto}
141 146 CloseFile(HistoricoLog); {Fecha o arquivo texto}
142 147 except
143   - log_diario('Erro na gravação do log!',ExtractFilePath(ParamStr(0)));
  148 + log_diario('Erro na gravação do log!');
144 149 end;
145 150 end;
  151 +function GetVersionInfo(p_File: string):string;
  152 +begin
  153 + PJVersionInfo1 := TPJVersionInfo.Create(PJVersionInfo1);
  154 + PJVersionInfo1.FileName := PChar(p_File);
  155 + Result := VerFmt(PJVersionInfo1.FixedFileInfo.dwFileVersionMS, PJVersionInfo1.FixedFileInfo.dwFileVersionLS);
  156 +end;
  157 +
  158 +procedure log_DEBUG(p_msg:string);
  159 +Begin
  160 + if v_Debugs then log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg);
  161 +End;
146 162  
147 163 // Pad a string with zeros so that it is a multiple of size
148 164 function PadWithZeros(const str : string; size : integer) : string;
... ... @@ -191,7 +207,7 @@ begin
191 207 // Return the Base64 encoded result
192 208 Result := Base64EncodeStr(l_Data);
193 209 Except
194   - log_diario('Erro no Processo de Criptografia',ExtractFilePath(ParamStr(0)));
  210 + log_diario('Erro no Processo de Criptografia');
195 211 End;
196 212 end;
197 213  
... ... @@ -227,7 +243,7 @@ begin
227 243 // Return the result
228 244 Result := l_Data;
229 245 Except
230   - log_diario('Erro no Processo de Decriptografia',ExtractFilePath(ParamStr(0)));
  246 + log_diario('Erro no Processo de Decriptografia');
231 247 End;
232 248 end;
233 249  
... ... @@ -264,32 +280,47 @@ begin
264 280  
265 281 CloseFile(v_DatFile);
266 282 except
267   - log_diario('Problema na gravação do arquivo de configurações.',ExtractFilePath(ParamStr(0)));
  283 + log_diario('Problema na gravação do arquivo de configurações.');
268 284 end;
269 285 end;
  286 +
  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;
  293 +
270 294 function GetWinVer: Integer;
271 295 const
272 296 { operating system (OS)constants }
273   - cOsUnknown = 0;
274   - cOsWin95 = 1;
275   - cOsWin95OSR2 = 2; // Não implementado.
276   - cOsWin98 = 3;
277   - cOsWin98SE = 4;
278   - cOsWinME = 5;
279   - cOsWinNT = 6;
280   - cOsWin2000 = 7;
281   - cOsXP = 8;
  297 + cOsUnknown = 0;
  298 + cOsWin95 = 1;
  299 + cOsWin95OSR2 = 2; // Não implementado.
  300 + cOsWin98 = 3;
  301 + cOsWin98SE = 4;
  302 + cOsWinME = 5;
  303 + cOsWinNT = 6;
  304 + cOsWin2000 = 7;
  305 + cOsXP = 8;
  306 + cOsServer2003 = 13;
282 307 var
283 308 osVerInfo: TOSVersionInfo;
284   - majorVer, minorVer: Integer;
  309 + platformID,
  310 + majorVer,
  311 + minorVer: Integer;
  312 + CSDVersion : String;
285 313 begin
286 314 Result := cOsUnknown;
287 315 { set operating system type flag }
288 316 osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
289 317 if GetVersionEx(osVerInfo) then
290 318 begin
291   - majorVer := osVerInfo.dwMajorVersion;
292   - minorVer := osVerInfo.dwMinorVersion;
  319 + platformId := osVerInfo.dwPlatformId;
  320 + majorVer := osVerInfo.dwMajorVersion;
  321 + minorVer := osVerInfo.dwMinorVersion;
  322 + CSDVersion := trim(osVerInfo.szCSDVersion);
  323 +
293 324 case osVerInfo.dwPlatformId of
294 325 VER_PLATFORM_WIN32_NT: { Windows NT/2000 }
295 326 begin
... ... @@ -299,6 +330,8 @@ begin
299 330 Result := cOsWin2000
300 331 else if (majorVer = 5) and (minorVer = 1) then
301 332 Result := cOsXP
  333 + else if (majorVer = 5) and (minorVer = 2) then
  334 + Result := cOsServer2003
302 335 else
303 336 Result := cOsUnknown;
304 337 end;
... ... @@ -324,6 +357,15 @@ begin
324 357 end
325 358 else
326 359 Result := cOsUnknown;
  360 +
  361 + // A partir da versão 2.2.0.24, defino o valor da ID Interna e atribuo-a sem o CSDVersion à versão externa
  362 + v_te_so := IntToStr(platformId) + '.' +
  363 + IntToStr(majorVer) + '.' +
  364 + IntToStr(minorVer) +
  365 + IfThen(CSDVersion='','','.'+CSDVersion);
  366 + if (Result = 0) then
  367 + Result := abstraiCSD(v_te_so);
  368 +
327 369 end;
328 370  
329 371 Function CipherOpen(p_DatFileName : string) : TStrings;
... ... @@ -352,7 +394,7 @@ begin
352 394 if (trim(v_strCipherOpened)<>'') then
353 395 Result := explode(v_strCipherOpened,v_SeparatorKey)
354 396 else
355   - Result := explode('Configs.ID_SO' + v_SeparatorKey + inttostr(GetWinVer)+v_SeparatorKey+'Configs.Endereco_WS'+v_SeparatorKey+'/cacic2/ws/',v_SeparatorKey);
  397 + Result := explode('Configs.ID_SO' + v_SeparatorKey + inttostr(intWinVer)+v_SeparatorKey+'Configs.Endereco_WS'+v_SeparatorKey+'/cacic2/ws/',v_SeparatorKey);
356 398  
357 399 if Result.Count mod 2 <> 0 then
358 400 Result.Add('');
... ... @@ -371,12 +413,6 @@ begin
371 413 End;
372 414 end;
373 415  
374   -function GetVersionInfo(p_File: string):string;
375   -begin
376   - PJVersionInfo1 := TPJVersionInfo.Create(PJVersionInfo1);
377   - PJVersionInfo1.FileName := PChar(p_File);
378   - Result := VerFmt(PJVersionInfo1.FixedFileInfo.dwFileVersionMS, PJVersionInfo1.FixedFileInfo.dwFileVersionLS);
379   -end;
380 416  
381 417 function GetRootKey(strRootKey: String): HKEY;
382 418 begin
... ... @@ -554,6 +590,24 @@ begin
554 590 RegDelValorReg.Free;
555 591 ListaAuxDel.Free;
556 592 end;
  593 +function Get_File_Size(sFileToExamine: string; bInKBytes: Boolean): string;
  594 +var
  595 + SearchRec: TSearchRec;
  596 + sgPath: string;
  597 + inRetval, I1: Integer;
  598 +begin
  599 + sgPath := ExpandFileName(sFileToExamine);
  600 + try
  601 + inRetval := FindFirst(ExpandFileName(sFileToExamine), faAnyFile, SearchRec);
  602 + if inRetval = 0 then
  603 + I1 := SearchRec.Size
  604 + else
  605 + I1 := -1;
  606 + finally
  607 + SysUtils.FindClose(SearchRec);
  608 + end;
  609 + Result := IntToStr(I1);
  610 +end;
557 611  
558 612  
559 613  
... ... @@ -567,6 +621,7 @@ begin
567 621 IdFTP.Password := p_Password;
568 622 IdFTP.Port := strtoint(p_Port);
569 623 IdFTP.TransferType := ftBinary;
  624 + IdFTP.Passive := true;
570 625 Try
571 626 if IdFTP.Connected = true then
572 627 begin
... ... @@ -575,10 +630,14 @@ begin
575 630 IdFTP.Connect(true);
576 631 IdFTP.ChangeDir(p_PathServer);
577 632 Try
  633 + log_DEBUG('Size de "'+p_File+'" Antes do FTP => '+IntToSTR(IdFTP.Size(p_File)));
578 634 IdFTP.Get(p_File, p_Dest + '\' + p_File, True);
  635 + log_DEBUG('Size de "'+p_Dest + '\' + p_File +'" Após o FTP => '+Get_File_Size(p_Dest + '\' + p_File,true));
  636 + Finally
  637 + log_DEBUG('Size de "'+p_Dest + '\' + p_File +'" Após o FTP em Finally => '+Get_File_Size(p_Dest + '\' + p_File,true));
  638 + idFTP.Disconnect;
  639 + idFTP.Free;
579 640 result := true;
580   - Except
581   - result := false;
582 641 End;
583 642 Except
584 643 result := false;
... ... @@ -704,23 +763,20 @@ var SearchRec: TSearchRec;
704 763 begin
705 764 strFileName := StringReplace(v_dir + '\' + v_files,'\\','\',[rfReplaceAll]);
706 765 Result:=FindFirst(strFileName, faAnyFile, SearchRec);
  766 +
707 767 while result=0 do
708 768 begin
709 769 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
  770 +
  771 + if not DeleteFile(strFileName) then
714 772 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é
  773 + if ((intWinVer <> 0) and (intWinVer <= 5)) or
  774 + (abstraiCSD(v_te_so) < 250) then // Menor que NT Like
718 775 KillTask(SearchRec.Name)
719 776 else
720 777 KillProcess(FindWindow(PChar(SearchRec.Name),nil));
721 778  
722   - if DeleteFile(strFileName) then
723   - log_diario('Exclusão Impossibilitada de ' + strFileName + '!',ExtractFilePath(ParamStr(0)));
  779 + DeleteFile(strFileName);
724 780 End;
725 781  
726 782 Result:=FindNext(SearchRec);
... ... @@ -732,11 +788,11 @@ Begin
732 788 result := false;
733 789  
734 790 // 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
  791 + if (FileExists(Dir + '\aguarde_CACIC.txt')) then
736 792 Begin
737 793 // Se eu conseguir matar o arquivo abaixo é porque não há outra sessão deste agente aberta... (POG? Nããão! :) )
738 794 Matar(Dir,'aguarde_CACIC.txt');
739   - if (not (FileExists(Dir + 'aguarde_CACIC.txt'))) then
  795 + if (not (FileExists(Dir + '\aguarde_CACIC.txt'))) then
740 796 result := true;
741 797 End;
742 798 End;
... ... @@ -753,7 +809,7 @@ Begin
753 809 v_versao_REM := XML_RetornaValor(StringReplace(StrUpper(PChar(v_array_NomeAgente[v_array_NomeAgente.count-1])),'.EXE','',[rfReplaceAll]), v_retorno);
754 810 v_versao_LOC := GetVersionInfo(p_strNomeAgente);
755 811  
756   - log_diario('Checando versão de "'+p_strNomeAgente+'"',ExtractFilePath(ParamStr(0)));
  812 + log_diario('Checando versão de "'+p_strNomeAgente+'"');
757 813  
758 814 intAux := v_array_NomeAgente.Count;
759 815  
... ... @@ -763,12 +819,12 @@ Begin
763 819 Begin
764 820 if (GetValorChaveRegIni('versoes_agentes',v_array_NomeAgente[intAux-1],ExtractFilePath(Application.Exename)+'versoes_agentes.ini')<>'') then
765 821 Begin
766   - log_diario('Encontrado arquivo "'+(ExtractFilePath(Application.Exename)+'versoes_agentes.ini')+'"',ExtractFilePath(ParamStr(0)));
  822 + log_diario('Encontrado arquivo "'+(ExtractFilePath(Application.Exename)+'versoes_agentes.ini')+'"');
767 823 v_versao_REM := GetValorChaveRegIni('versoes_agentes',v_array_NomeAgente[intAux-1],ExtractFilePath(Application.Exename)+'versoes_agentes.ini');
768 824 End;
769 825 End;
770 826  
771   - log_diario('Versão Remota: "'+v_versao_REM+'" - Versão Local: "'+v_versao_LOC+'"',ExtractFilePath(ParamStr(0)));
  827 + log_diario('Versão Remota: "'+v_versao_REM+'" - Versão Local: "'+v_versao_LOC+'"');
772 828  
773 829 if (v_versao_REM + v_versao_LOC <> '') and
774 830 (v_versao_LOC <> '0000') then
... ... @@ -782,6 +838,27 @@ Begin
782 838 Result := 0;
783 839 End;
784 840  
  841 +function GetFolderDate(Folder: string): TDateTime;
  842 +var
  843 + Rec: TSearchRec;
  844 + Found: Integer;
  845 + Date: TDateTime;
  846 +begin
  847 + if Folder[Length(folder)] = '\' then
  848 + Delete(Folder, Length(folder), 1);
  849 + Result := 0;
  850 + Found := FindFirst(Folder, faDirectory, Rec);
  851 + try
  852 + if Found = 0 then
  853 + begin
  854 + Date := FileDateToDateTime(Rec.Time);
  855 + Result := Date;
  856 + end;
  857 + finally
  858 + FindClose(Rec);
  859 + end;
  860 +end;
  861 +
785 862 procedure executa_chksis;
786 863 var
787 864 bool_download_CACIC2,
... ... @@ -794,6 +871,7 @@ var
794 871 IdHTTP1: TIdHTTP;
795 872 intAux : integer;
796 873 begin
  874 +
797 875 bool_download_CACIC2 := false;
798 876 v_home_drive := MidStr(HomeDrive,1,3); //x:\
799 877 v_ip_serv_cacic := GetValorChaveRegIni('Cacic2', 'ip_serv_cacic', ExtractFilePath(ParamStr(0)) + 'chksis.ini');
... ... @@ -801,7 +879,17 @@ begin
801 879 v_rem_cacic_v0x := GetValorChaveRegIni('Cacic2', 'rem_cacic_v0x', ExtractFilePath(ParamStr(0)) + 'chksis.ini');
802 880 Dir := v_home_drive + v_cacic_dir;
803 881  
  882 + v_Debugs := false;
  883 + if DirectoryExists(v_cacic_dir + '\Temp\Debugs') then
  884 + Begin
  885 + if (FormatDateTime('ddmmyyyy', GetFolderDate(v_cacic_dir + '\Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then
  886 + Begin
  887 + v_Debugs := true;
  888 + log_DEBUG('Pasta "' + v_cacic_dir + '\Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(v_cacic_dir + '\Temp\Debugs'))+' encontrada. DEBUG ativado.');
  889 + End;
  890 + End;
804 891  
  892 + intWinVer := GetWinVer;
805 893  
806 894 // Caso o parâmetro rem_cacic_v0x seja "S/s" removo a chave/valor de execução do Cacic antigo
807 895 if (LowerCase(v_rem_cacic_v0x)='s') then
... ... @@ -820,16 +908,16 @@ begin
820 908 // Para eliminar versão 20014 e anteriores que provavelmente não fazem corretamente o AutoUpdate
821 909 if not DirectoryExists(Dir+'\modulos') then
822 910 begin
823   - log_diario('Excluindo '+ Dir + '\cacic2.exe',ExtractFilePath(ParamStr(0)));
  911 + log_diario('Excluindo '+ Dir + '\cacic2.exe');
824 912 Matar(Dir,'\cacic2.exe');
825   - log_diario('Criando diretório ' + Dir + '\modulos',ExtractFilePath(ParamStr(0)));
  913 + log_diario('Criando diretório ' + Dir + '\modulos');
826 914 ForceDirectories(Dir + '\modulos');
827 915 end;
828 916  
829 917 // Crio o SubDiretório TEMP, caso não exista
830 918 if not DirectoryExists(Dir+'\temp') then
831 919 begin
832   - log_diario('Criando diretório ' + Dir + '\temp',ExtractFilePath(ParamStr(0)));
  920 + log_diario('Criando diretório ' + Dir + '\temp');
833 921 ForceDirectories(Dir + '\temp');
834 922 end;
835 923  
... ... @@ -843,15 +931,15 @@ begin
843 931 v_IV := 'abcdefghijklmnop';
844 932 v_SeparatorKey := '=CacicIsFree=';
845 933 v_DatFileName := Dir + '\cacic2.dat';
846   - v_tstrCipherOpened := CipherOpen(v_DatFileName);
  934 + //v_tstrCipherOpened := CipherOpen(v_DatFileName);
847 935  
848   - SetValorDatMemoria('Configs.EnderecoServidor', v_ip_serv_cacic);
  936 + //SetValorDatMemoria('Configs.EnderecoServidor', v_ip_serv_cacic);
849 937  
850 938 // log_diario('Setando chave Configs/cacic_dir=' + v_cacic_dir + ' em '+Dir + '\cacic2.ini',ExtractFilePath(ParamStr(0)));
851 939 // SetValorChaveRegIni('Configs', 'cacic_dir', v_cacic_dir, Dir + '\cacic2.ini');
852   - SetValorDatMemoria('Configs.cacic_dir', v_cacic_dir);
  940 + //SetValorDatMemoria('Configs.cacic_dir', v_cacic_dir);
853 941  
854   - CipherClose(v_DatFileName);
  942 + //CipherClose(v_DatFileName);
855 943 // Verifico existência dos dois principais objetos
856 944 If (not FileExists(Dir + '\cacic2.exe')) or (not FileExists(Dir + '\modulos\ger_cols.exe')) Then
857 945 Begin
... ... @@ -863,9 +951,11 @@ begin
863 951 Response_Config := TStringStream.Create('');
864 952  
865 953 Try
  954 + log_diario('Tentando contato com ' + 'http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php');
866 955 IdHTTP1 := TIdHTTP.Create(nil);
867   - log_diario('Tentando contato com ' + 'http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php',ExtractFilePath(ParamStr(0)));
868 956 IdHTTP1.Post('http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php', Request_Config, Response_Config);
  957 + IdHTTP1.Disconnect;
  958 + IdHTTP1.Free;
869 959 v_retorno := Response_Config.DataString;
870 960 v_te_serv_updates := XML_RetornaValor('te_serv_updates' , Response_Config.DataString);
871 961 v_nu_porta_serv_updates := XML_RetornaValor('nu_porta_serv_updates' , Response_Config.DataString);
... ... @@ -873,22 +963,22 @@ begin
873 963 v_te_senha_login_serv_updates := XML_RetornaValor('te_senha_login_serv_updates' , Response_Config.DataString);
874 964 v_te_path_serv_updates := XML_RetornaValor('te_path_serv_updates' , Response_Config.DataString);
875 965  
876   - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::',ExtractFilePath(ParamStr(0)));
877   - log_diario(':::::::::::::::: VALORES OBTIDOS NO Gerente WEB :::::::::::::::',ExtractFilePath(ParamStr(0)));
878   - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::',ExtractFilePath(ParamStr(0)));
879   - log_diario('Servidor de updates......................: '+v_te_serv_updates,ExtractFilePath(ParamStr(0)));
880   - log_diario('Porta do servidor de updates.............: '+v_nu_porta_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)));
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)));
889   - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::',ExtractFilePath(ParamStr(0)));
890   -
891   - Except log_diario('Falha no contato com ' + 'http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php',ExtractFilePath(ParamStr(0)));
  966 + log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  967 + log_diario(':::::::::::::::: VALORES OBTIDOS NO Gerente WEB :::::::::::::::');
  968 + log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  969 + log_diario('Servidor de updates......................: '+v_te_serv_updates);
  970 + log_diario('Porta do servidor de updates.............: '+v_nu_porta_serv_updates);
  971 + log_diario('Usuário para login no servidor de updates: '+v_nm_usuario_login_serv_updates);
  972 + log_diario('Pasta no servidor de updates.............: '+v_te_path_serv_updates);
  973 + log_diario(' ');
  974 + log_diario('Versões dos Agentes Principais:');
  975 + log_diario('------------------------------');
  976 + log_diario('Cacic2 - Agente do Systray.........: '+XML_RetornaValor('CACIC2', v_retorno));
  977 + log_diario('Ger_Cols - Gerente de Coletas........: '+XML_RetornaValor('GER_COLS', v_retorno));
  978 + log_diario('ChkSis - Verificador de Integridade: '+XML_RetornaValor('CHKSIS', v_retorno));
  979 + log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  980 +
  981 + Except log_diario('Falha no contato com ' + 'http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php');
892 982 End;
893 983  
894 984 Request_Config.Free;
... ... @@ -938,7 +1028,7 @@ begin
938 1028 log_diario('Fazendo FTP de cacic2.exe a partir de ' + v_te_serv_updates + '/' +
939 1029 v_nu_porta_serv_updates+'/'+
940 1030 v_nm_usuario_login_serv_updates + '/' +
941   - v_te_path_serv_updates + ' para a pasta ' + Dir,ExtractFilePath(ParamStr(0)));
  1031 + v_te_path_serv_updates + ' para a pasta ' + Dir);
942 1032 FTP(v_te_serv_updates,
943 1033 v_nu_porta_serv_updates,
944 1034 v_nm_usuario_login_serv_updates,
... ... @@ -955,7 +1045,7 @@ begin
955 1045 log_diario('Fazendo FTP de ger_cols.exe a partir de ' + v_te_serv_updates + '/' +
956 1046 v_nu_porta_serv_updates+'/'+
957 1047 v_nm_usuario_login_serv_updates + '/' +
958   - v_te_path_serv_updates + ' para a pasta ' + Dir + '\modulos',ExtractFilePath(ParamStr(0)));
  1048 + v_te_path_serv_updates + ' para a pasta ' + Dir + '\modulos');
959 1049  
960 1050 FTP(v_te_serv_updates,
961 1051 v_nu_porta_serv_updates,
... ... @@ -970,17 +1060,25 @@ begin
970 1060 // 5 segundos para espera de possível FTP...
971 1061 Sleep(5000);
972 1062  
973   - // Crio a chave/valor cacic2 para autoexecução do Cacic, caso não exista esta chave/valor
974   - // Crio a chave/valor chksis para autoexecução do Cacic, caso não exista esta chave/valor
975   - //log_diario('Setando chave HLM../Run com ' + HomeDrive + '\chksis.exe',ExtractFilePath(ParamStr(0)));
976   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\CheckSystemRoutine', HomeDrive + '\chksis.exe');
977   - //log_diario('Setando chave HLM../Run com ' + Dir + '\cacic2.exe',ExtractFilePath(ParamStr(0)));
  1063 + Try
  1064 + // Crio a chave/valor chksis para autoexecução do Cacic, caso não exista esta chave/valor
  1065 + log_diario('Setando chave HLM../Run com ' + HomeDrive + '\chksis.exe');
  1066 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\CheckSystemRoutine', HomeDrive + '\chksis.exe');
  1067 + Except
  1068 + End;
978 1069  
979 1070 bool_ExistsAutoRun := false;
980 1071 if (GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2')=Dir + '\cacic2.exe') then
981 1072 bool_ExistsAutoRun := true
982 1073 else
983   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2', Dir + '\cacic2.exe');
  1074 + Begin
  1075 + Try
  1076 + // Crio a chave/valor cacic2 para autoexecução do Cacic, caso não exista esta chave/valor
  1077 + log_diario('Setando chave HLM../Run com ' + Dir + '\cacic2.exe');
  1078 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2', Dir + '\cacic2.exe');
  1079 + Except
  1080 + End;
  1081 + End;
984 1082  
985 1083 // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor
986 1084 //if (bool_download_CACIC2) then
... ... @@ -989,7 +1087,7 @@ begin
989 1087 // Begin
990 1088 if Posso_Rodar_CACIC or not bool_ExistsAutoRun then
991 1089 Begin
992   - log_diario('Executando '+Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic,ExtractFilePath(ParamStr(0)));
  1090 + log_diario('Executando '+Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic);
993 1091  
994 1092 // Caso tenha havido download de agentes principais, executar coletas imediatamente...
995 1093 if (bool_download_CACIC2) then
... ... @@ -999,15 +1097,16 @@ begin
999 1097 End;
1000 1098 // End
1001 1099 // else
1002   - // log_diario('Não Executei. Chave de AutoExecução já existente...',ExtractFilePath(ParamStr(0)));
  1100 + log_diario('Não Executei. Chave de AutoExecução já existente...');
1003 1101 //End
  1102 + Application.Terminate;
1004 1103 end;
1005 1104  
1006 1105 begin
1007 1106 // Application.ShowMainForm:=false;
1008 1107 if (FindWindowByTitle('chkcacic') = 0) and (FindWindowByTitle('cacic2') = 0) then
1009 1108 if (FileExists(ExtractFilePath(ParamStr(0)) + 'chksis.ini')) then executa_chksis
1010   - else log_diario('Não executei devido execução em paralelo de "chkcacic" ou "cacic2"!',ExtractFilePath(ParamStr(0)));
  1109 + else log_diario('Não executei devido execução em paralelo de "chkcacic" ou "cacic2"!');
1011 1110  
1012 1111 Halt;
1013 1112 //Application.Terminate;
... ...
chksis/chksis.res
No preview for this file type
col_comp/col_comp.dof
... ... @@ -115,7 +115,7 @@ AutoIncBuild=0
115 115 MajorVer=2
116 116 MinorVer=2
117 117 Release=0
118   -Build=1
  118 +Build=2
119 119 Debug=0
120 120 PreRelease=0
121 121 Special=0
... ... @@ -126,13 +126,13 @@ CodePage=1252
126 126 [Version Info Keys]
127 127 CompanyName=Dataprev-Unidade Regional Espírito Santo
128 128 FileDescription=Coletor de Informações de Compartilhamento do Sistema CACIC
129   -FileVersion=2.2.0.1
  129 +FileVersion=2.2.0.2
130 130 InternalName=
131 131 LegalCopyright=
132 132 LegalTrademarks=
133 133 OriginalFilename=
134 134 ProductName=Col_COMP
135   -ProductVersion=2.2.0.1
  135 +ProductVersion=2.2.0.2
136 136 Comments=Baseado na licença GPL (General Public License)
137 137 [HistoryLists\hlDebugSourcePath]
138 138 Count=1
... ...
col_comp/col_comp.dpr
... ... @@ -432,126 +432,133 @@ Begin
432 432 end;
433 433 var Reg_RCC : TRegistry;
434 434 ChaveRegistro, ValorChaveRegistro, nm_compartilhamento, nm_dir_compart,
435   - in_senha_escrita, in_senha_leitura, te_comentario, strXML, strAux,
  435 + in_senha_escrita, in_senha_leitura, te_comentario, strTripaDados, strAux,
436 436 cs_tipo_permissao, cs_tipo_compart : String;
437 437 I, intAux: Integer;
438 438 Lista_RCC : TStringList;
439 439 Begin
440 440 Try
441   - SetValorDatMemoria('Col_Comp.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
442   - nm_compartilhamento := '';
443   - nm_dir_compart := '';
444   - cs_tipo_compart := ' ';
445   - cs_tipo_permissao := ' ';
446   - in_senha_leitura := '';
447   - in_senha_escrita := '';
448   - log_diario('Coletando informações de Compartilhamentos.');
449   - Reg_RCC := TRegistry.Create;
450   - Reg_RCC.LazyWrite := False;
451   - Lista_RCC := TStringList.Create;
452   - Reg_RCC.Rootkey := HKEY_LOCAL_MACHINE;
453   - {
454   - strXML := '<?xml version="1.0" encoding="ISO-8859-1"?>' +
455   - '<comparts>' +
456   - '<te_node_address>' + GetValorChaveRegIni('TcpIp' ,'TE_NODE_ADDRESS' ,p_path_cacic_ini) + '</te_node_address>' +
457   - '<te_nome_computador>' + GetValorChaveRegIni('TcpIp' ,'TE_NOME_COMPUTADOR',p_path_cacic_ini) + '</te_nome_computador>' +
458   - '<te_workgroup>' + GetValorChaveRegIni('TcpIp' ,'TE_WORKGROUP' ,p_path_cacic_ini) + '</te_workgroup>' +
459   - '<id_so>' + GetValorChaveRegIni('Configs','ID_SO' ,p_path_cacic_ini) + '</id_so>';
460   - }
461   -
462   - strXML := '<?xml version="1.0" encoding="ISO-8859-1"?><comparts>';
463   -
464   - if Win32Platform = VER_PLATFORM_WIN32_NT then
465   - Begin // 2k, xp, nt.
466   - ChaveRegistro := '\System\ControlSet001\Services\lanmanserver\Shares\';
467   - Reg_RCC.OpenKeyReadOnly(ChaveRegistro);
468   - Reg_RCC.GetValueNames(Lista_RCC);
469   - Reg_RCC.CloseKey;
470   - For I := 0 To Lista_RCC.Count - 1 Do
471   - Begin
472   - nm_compartilhamento := Lista_RCC.Strings[i];
473   - strAux := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE' + ChaveRegistro + nm_compartilhamento);
474   - nm_dir_compart := RetornaValorShareNT(strAux, 'Path=', 'Permissions=');
475   - te_comentario := RetornaValorShareNT(strAux, 'Remark=', 'Type=');
476   - cs_tipo_compart := RetornaValorShareNT(strAux, 'Type=', 'Fim');
477   - if (cs_tipo_compart = '0') Then cs_tipo_compart := 'D' Else cs_tipo_compart := 'I';
478   - strXML := strXML + '<compart>' +
479   - '<nm_compartilhamento>' + nm_compartilhamento + '</nm_compartilhamento>' +
480   - '<nm_dir_compart>' + nm_dir_compart + '</nm_dir_compart>' +
481   - '<cs_tipo_compart>' + cs_tipo_compart + '</cs_tipo_compart>' +
482   - '<te_comentario>' + te_comentario + '</te_comentario>' +
483   - '</compart>';
484   - end;
485   - end
486   - Else
487 441 Begin
488   - ChaveRegistro := '\Software\Microsoft\Windows\CurrentVersion\Network\LanMan\';
489   - Reg_RCC.OpenKeyReadOnly(ChaveRegistro);
490   - Reg_RCC.GetKeyNames(Lista_RCC);
491   - Reg_RCC.CloseKey;
492   - For I := 0 To Lista_RCC.Count - 1 Do
493   - Begin
494   - nm_compartilhamento := Lista_RCC.Strings[i];
495   - Reg_RCC.OpenKey(ChaveRegistro + nm_compartilhamento, True);
496   - nm_dir_compart := Reg_RCC.ReadString('Path');
497   - te_comentario := Reg_RCC.ReadString('Remark');
498   - if (Reg_RCC.GetDataSize('Parm1enc') = 0) Then in_senha_escrita := '0' Else in_senha_escrita := '1';
499   - if (Reg_RCC.GetDataSize('Parm2enc') = 0) Then in_senha_leitura := '0' Else in_senha_leitura := '1';
500   - if (Reg_RCC.ReadInteger('Type') = 0) Then cs_tipo_compart := 'D' Else cs_tipo_compart := 'I';
501   - intAux := Reg_RCC.ReadInteger('Flags');
502   - Case intAux of //http://www.la2600.org/talks/chronology/enigma/19971107.html
503   - 401 : cs_tipo_permissao := 'S'; // Somente Leitura.
504   - 258 : cs_tipo_permissao := 'C'; // Completo.
505   - 259 : cs_tipo_permissao := 'D'; // Depende de senha.
506   - end;
507   - Reg_RCC.CloseKey;
508   - strXML := strXML + '<compart>' +
509   - '<nm_compartilhamento>' + nm_compartilhamento + '</nm_compartilhamento>' +
510   - '<nm_dir_compart>' + nm_dir_compart + '</nm_dir_compart>' +
511   - '<cs_tipo_compart>' + cs_tipo_compart + '</cs_tipo_compart>' +
512   - '<cs_tipo_permissao>' + cs_tipo_permissao + '</cs_tipo_permissao>' +
513   - '<in_senha_leitura>' + in_senha_leitura + '</in_senha_leitura>' +
514   - '<in_senha_escrita>' + in_senha_escrita + '</in_senha_escrita>' +
515   - '<te_comentario>' + te_comentario + '</te_comentario>' +
516   - '</compart>';
517   - end;
518   - end;
519   -
520   - if (Lista_RCC.Count = 0) then strXML := strXML + '<compart>' +
521   - '<nm_compartilhamento></nm_compartilhamento>' +
522   - '<nm_dir_compart></nm_dir_compart>' +
523   - '<cs_tipo_compart></cs_tipo_compart>' +
524   - '<te_comentario></te_comentario>' +
525   - '</compart>';
526   -
527   - Reg_RCC.Free;
528   - Lista_RCC.Free;
529   - strXML := strXML + '</comparts>';
530   -
531   - // Obtenho do registro o valor que foi previamente armazenado
532   - ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Compartilhamentos'));
533   -
534   - SetValorDatMemoria('Col_Comp.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
535   -
536   - // Se essas informações forem diferentes significa que houve alguma alteração
537   - // na configuração. Nesse caso, gravo as informações no BD Central e, se não houver
538   - // problemas durante esse procedimento, atualizo as informações no registro.
539   - If (GetValorDatMemoria('Configs.IN_COLETA_FORCADA_COMP')='S') or (strXML <> ValorChaveRegistro) Then
540   - Begin
541   - SetValorDatMemoria('Col_Comp.UVC', strXML, v_tstrCipherOpened1);
542   -//log_diario('Vou chamar o CLOSE...');
543   - CipherClose(p_path_cacic + 'temp\col_comp.dat', v_tstrCipherOpened1);
544   -//log_diario('Após chamada ao CLOSE...');
545   - End
546   - else
  442 + SetValorDatMemoria('Col_Comp.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
  443 + nm_compartilhamento := '';
  444 + nm_dir_compart := '';
  445 + cs_tipo_compart := ' ';
  446 + cs_tipo_permissao := ' ';
  447 + in_senha_leitura := '';
  448 + in_senha_escrita := '';
  449 + log_diario('Coletando informações de Compartilhamentos.');
  450 + Reg_RCC := TRegistry.Create;
  451 + Reg_RCC.LazyWrite := False;
  452 + Lista_RCC := TStringList.Create;
  453 + Reg_RCC.Rootkey := HKEY_LOCAL_MACHINE;
  454 + {
  455 + strXML := '<?xml version="1.0" encoding="ISO-8859-1"?>' +
  456 + '<comparts>' +
  457 + '<te_node_address>' + GetValorChaveRegIni('TcpIp' ,'TE_NODE_ADDRESS' ,p_path_cacic_ini) + '</te_node_address>' +
  458 + '<te_nome_computador>' + GetValorChaveRegIni('TcpIp' ,'TE_NOME_COMPUTADOR',p_path_cacic_ini) + '</te_nome_computador>' +
  459 + '<te_workgroup>' + GetValorChaveRegIni('TcpIp' ,'TE_WORKGROUP' ,p_path_cacic_ini) + '</te_workgroup>' +
  460 + '<id_so>' + GetValorChaveRegIni('Configs','ID_SO' ,p_path_cacic_ini) + '</id_so>';
  461 + }
  462 +
  463 + //strXML := '<?xml version="1.0" encoding="ISO-8859-1"?><comparts>';
  464 + strTripaDados := '';
  465 +
  466 + if Win32Platform = VER_PLATFORM_WIN32_NT then
  467 + Begin // 2k, xp, nt.
  468 + ChaveRegistro := '\System\ControlSet001\Services\lanmanserver\Shares\';
  469 + Reg_RCC.OpenKeyReadOnly(ChaveRegistro);
  470 + Reg_RCC.GetValueNames(Lista_RCC);
  471 + Reg_RCC.CloseKey;
  472 + For I := 0 To Lista_RCC.Count - 1 Do
  473 + Begin
  474 + nm_compartilhamento := Lista_RCC.Strings[i];
  475 + strAux := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE' + ChaveRegistro + nm_compartilhamento);
  476 + nm_dir_compart := RetornaValorShareNT(strAux, 'Path=', 'Permissions=');
  477 + te_comentario := RetornaValorShareNT(strAux, 'Remark=', 'Type=');
  478 + cs_tipo_compart := RetornaValorShareNT(strAux, 'Type=', 'Fim');
  479 + if (cs_tipo_compart = '0') Then cs_tipo_compart := 'D' Else cs_tipo_compart := 'I';
  480 + if (strTripaDados <> '') then
  481 + strTripaDados := strTripaDados + '<REG>'; // Delimitador de REGISTRO
  482 +
  483 + strTripaDados := strTripaDados + nm_compartilhamento + '<FIELD>' +
  484 + nm_dir_compart + '<FIELD>' +
  485 + cs_tipo_compart + '<FIELD>' +
  486 + te_comentario;
  487 + end;
  488 + end
  489 + Else
547 490 Begin
  491 + ChaveRegistro := '\Software\Microsoft\Windows\CurrentVersion\Network\LanMan\';
  492 + Reg_RCC.OpenKeyReadOnly(ChaveRegistro);
  493 + Reg_RCC.GetKeyNames(Lista_RCC);
  494 + Reg_RCC.CloseKey;
  495 + For I := 0 To Lista_RCC.Count - 1 Do
  496 + Begin
  497 + nm_compartilhamento := Lista_RCC.Strings[i];
  498 + Reg_RCC.OpenKey(ChaveRegistro + nm_compartilhamento, True);
  499 + nm_dir_compart := Reg_RCC.ReadString('Path');
  500 + te_comentario := Reg_RCC.ReadString('Remark');
  501 + if (Reg_RCC.GetDataSize('Parm1enc') = 0) Then in_senha_escrita := '0' Else in_senha_escrita := '1';
  502 + if (Reg_RCC.GetDataSize('Parm2enc') = 0) Then in_senha_leitura := '0' Else in_senha_leitura := '1';
  503 + if (Reg_RCC.ReadInteger('Type') = 0) Then cs_tipo_compart := 'D' Else cs_tipo_compart := 'I';
  504 + intAux := Reg_RCC.ReadInteger('Flags');
  505 + Case intAux of //http://www.la2600.org/talks/chronology/enigma/19971107.html
  506 + 401 : cs_tipo_permissao := 'S'; // Somente Leitura.
  507 + 258 : cs_tipo_permissao := 'C'; // Completo.
  508 + 259 : cs_tipo_permissao := 'D'; // Depende de senha.
  509 + end;
  510 + Reg_RCC.CloseKey;
  511 + {
  512 + strXML := strXML + '<compart>' +
  513 + '<nm_compartilhamento>' + nm_compartilhamento + '</nm_compartilhamento>' +
  514 + '<nm_dir_compart>' + nm_dir_compart + '</nm_dir_compart>' +
  515 + '<cs_tipo_compart>' + cs_tipo_compart + '</cs_tipo_compart>' +
  516 + '<cs_tipo_permissao>' + cs_tipo_permissao + '</cs_tipo_permissao>' +
  517 + '<in_senha_leitura>' + in_senha_leitura + '</in_senha_leitura>' +
  518 + '<in_senha_escrita>' + in_senha_escrita + '</in_senha_escrita>' +
  519 + '<te_comentario>' + te_comentario + '</te_comentario>' +
  520 + '</compart>';
  521 + }
  522 + if (strTripaDados <> '') then
  523 + strTripaDados := strTripaDados + '<REG>'; // Delimitador de REGISTRO
  524 +
  525 + strTripaDados := strTripaDados + nm_compartilhamento + '<FIELD>' +
  526 + nm_dir_compart + '<FIELD>' +
  527 + cs_tipo_compart + '<FIELD>' +
  528 + te_comentario + '<FIELD>' +
  529 + in_senha_leitura + '<FIELD>' +
  530 + in_senha_escrita + '<FIELD>' +
  531 + cs_tipo_permissao;
  532 + end;
  533 + end;
  534 +
  535 + Reg_RCC.Free;
  536 + Lista_RCC.Free;
  537 +
  538 +
  539 + // Obtenho do registro o valor que foi previamente armazenado
  540 + ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Compartilhamentos'));
  541 +
  542 + SetValorDatMemoria('Col_Comp.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
  543 +
  544 + // Se essas informações forem diferentes significa que houve alguma alteração
  545 + // na configuração. Nesse caso, gravo as informações no BD Central e, se não houver
  546 + // problemas durante esse procedimento, atualizo as informações no registro.
  547 + If ((GetValorDatMemoria('Configs.IN_COLETA_FORCADA_COMP')='S') or (strTripaDados <> ValorChaveRegistro)) and
  548 + (strTripaDados <> '') Then
  549 + Begin
  550 + SetValorDatMemoria('Col_Comp.UVC', strTripaDados, v_tstrCipherOpened1);
  551 + CipherClose(p_path_cacic + 'temp\col_comp.dat', v_tstrCipherOpened1);
  552 + End
  553 + else
548 554 SetValorDatMemoria('Col_Comp.nada', 'nada', v_tstrCipherOpened1);
549   - CipherClose(p_path_cacic + 'temp\col_comp.dat', v_tstrCipherOpened1);
550   - End;
  555 +
  556 + CipherClose(p_path_cacic + 'temp\col_comp.dat', v_tstrCipherOpened1);
  557 + End;
551 558 Except
552 559 Begin
553 560 SetValorDatMemoria('Col_Comp.nada', 'nada', v_tstrCipherOpened1);
554   - SetValorDatMemoria('Col_Comp.Fim', '99999999', v_tstrCipherOpened1);
  561 + SetValorDatMemoria('Col_Comp.Fim', '99999999', v_tstrCipherOpened1);
555 562 CipherClose(p_path_cacic + 'temp\col_comp.dat', v_tstrCipherOpened1);
556 563 End;
557 564 End;
... ...
col_comp/col_comp.res
No preview for this file type
col_hard/col_hard.cfg
... ... @@ -33,10 +33,3 @@
33 33 -K$00400000
34 34 -LE"c:\arquivos de programas\borland\delphi7\Projects\Bpl"
35 35 -LN"c:\arquivos de programas\borland\delphi7\Projects\Bpl"
36   --U"C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibEx"
37   --O"C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibEx"
38   --I"C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibEx"
39   --R"C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibEx"
40   --w-UNSAFE_TYPE
41   --w-UNSAFE_CODE
42   --w-UNSAFE_CAST
... ...
col_hard/col_hard.dof
... ... @@ -76,9 +76,9 @@ LocaleToUnicode=1
76 76 ImagebaseMultiple=1
77 77 SuspiciousTypecast=1
78 78 PrivatePropAccessor=1
79   -UnsafeType=0
80   -UnsafeCode=0
81   -UnsafeCast=0
  79 +UnsafeType=1
  80 +UnsafeCode=1
  81 +UnsafeCast=1
82 82 [Linker]
83 83 MapFile=0
84 84 OutputObjs=0
... ... @@ -94,10 +94,10 @@ OutputDir=
94 94 UnitOutputDir=
95 95 PackageDLLOutputDir=
96 96 PackageDCPOutputDir=
97   -SearchPath=C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibEx
98   -Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOffice2k;MSI_D7_Rtl
  97 +SearchPath=
  98 +Packages=
99 99 Conditionals=
100   -DebugSourceDirs=C:\Arquivos de programas\Borland\Delphi7\Mitec\D7
  100 +DebugSourceDirs=
101 101 UsePackages=0
102 102 [Parameters]
103 103 RunParams=
... ... @@ -108,40 +108,18 @@ DebugCWD=
108 108 [Language]
109 109 ActiveLang=
110 110 ProjectLang=
111   -RootDir=C:\Arquivos de programas\Borland\Delphi7\Bin\
  111 +RootDir=
112 112 [Version Info]
113 113 IncludeVerInfo=1
114 114 AutoIncBuild=0
115   -MajorVer=2
116   -MinorVer=2
  115 +MajorVer=1
  116 +MinorVer=0
117 117 Release=0
118   -Build=1
  118 +Build=0
119 119 Debug=0
120 120 PreRelease=0
121 121 Special=0
122 122 Private=0
123 123 DLL=0
124   -Locale=2070
  124 +Locale=1046
125 125 CodePage=1252
126   -[Version Info Keys]
127   -CompanyName=Dataprev-Unidade Regional Espírito Santo
128   -FileDescription=Coletor de Informações de Hardware do Sistema CACIC
129   -FileVersion=2.2.0.1
130   -InternalName=
131   -LegalCopyright=
132   -LegalTrademarks=
133   -OriginalFilename=
134   -ProductName=Col_Hard
135   -ProductVersion=2.2.0.1
136   -Comments=Baseado na licença GPL (General Public License)
137   -[HistoryLists\hlDebugSourcePath]
138   -Count=1
139   -Item0=C:\Arquivos de programas\Borland\Delphi7\Mitec\D7
140   -[HistoryLists\hlUnitAliases]
141   -Count=1
142   -Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
143   -[HistoryLists\hlSearchPath]
144   -Count=3
145   -Item0=C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibEx
146   -Item1=C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Ciphers;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Hashes;C:\Arquivos de programas\Borland\Delphi7\Mitec\9.60
147   -Item2=C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Ciphers;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Hashes
... ...
col_hard/col_hard.dpr
... ... @@ -22,17 +22,22 @@ program col_hard;
22 22 {$R *.res}
23 23 {$APPTYPE CONSOLE}
24 24  
25   -uses Windows, SysUtils, Classes, IniFiles,
26   - MSI_SMBIOS,
27   - MSI_Devices,
28   - MSI_CPU,
29   - MSI_DISPLAY,
30   - MSI_MEDIA,
31   - MSI_NETWORK,
32   - MSI_XML_Reports,
33   - DCPcrypt2,
34   - DCPrijndael,
35   - DCPbase64;
  25 +uses
  26 + Windows,
  27 + SysUtils,
  28 + Classes,
  29 + IniFiles,
  30 + MSI_SMBIOS,
  31 + MSI_Devices,
  32 + MSI_CPU,
  33 + MSI_DISPLAY,
  34 + MSI_MEDIA,
  35 + MSI_NETWORK,
  36 + MSI_XML_Reports,
  37 + DCPcrypt2,
  38 + DCPrijndael,
  39 + DCPbase64,
  40 + PJVersionInfo;
36 41  
37 42 var p_path_cacic, v_mensagem : string;
38 43 v_debugs : boolean;
... ... @@ -49,6 +54,16 @@ var v_tstrCipherOpened,
49 54 const KeySize = 32; // 32 bytes = 256 bits
50 55 BlockSize = 16; // 16 bytes = 128 bits
51 56  
  57 +// Dica baixada de http://www.marcosdellantonio.net/2007/06/14/operador-if-ternario-em-delphi-e-c/
  58 +// Fiz isso para não ter que acrescentar o componente Math ao USES!
  59 +function iif(condicao : boolean; resTrue, resFalse : Variant) : Variant;
  60 + Begin
  61 + if condicao then
  62 + Result := resTrue
  63 + else
  64 + Result := resFalse;
  65 + End;
  66 +
52 67 function HomeDrive : string;
53 68 var
54 69 WinDir : array [0..144] of char;
... ... @@ -57,6 +72,7 @@ GetWindowsDirectory (WinDir, 144);
57 72 Result := StrPas (WinDir);
58 73 end;
59 74  
  75 +
60 76 Function Implode(p_Array : TStrings ; p_Separador : String) : String;
61 77 var intAux : integer;
62 78 strAux : string;
... ... @@ -355,8 +371,26 @@ begin
355 371 else
356 372 Result := '';
357 373 end;
  374 +function VerFmt(const MS, LS: DWORD): string;
  375 + // Format the version number from the given DWORDs containing the info
  376 +begin
  377 + Result := Format('%d.%d.%d.%d',
  378 + [HiWord(MS), LoWord(MS), HiWord(LS), LoWord(LS)])
  379 +end;
358 380  
  381 +function GetVersionInfo(p_File: string):string;
  382 +var PJVersionInfo1: TPJVersionInfo;
  383 +begin
  384 + PJVersionInfo1 := TPJVersionInfo.Create(nil);
  385 + PJVersionInfo1.FileName := PChar(p_File);
  386 + Result := VerFmt(PJVersionInfo1.FixedFileInfo.dwFileVersionMS, PJVersionInfo1.FixedFileInfo.dwFileVersionLS);
  387 + PJVersionInfo1.Free;
  388 +end;
359 389  
  390 +procedure log_DEBUG(p_msg:string);
  391 +Begin
  392 + if v_Debugs then log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg);
  393 +End;
360 394  
361 395 // Função criada devido a divergências entre os valores retornados pelos métodos dos componentes MSI e seus Reports.
362 396 function Parse(p_ClassName, p_SectionName, p_DataName:string; p_Report : TStringList) : String;
... ... @@ -364,6 +398,7 @@ var intClasses, intSections, intDatas, v_achei_SectionName, v_array_SectionName_
364 398 v_ClassName, v_DataName, v_string_consulta : string;
365 399 v_array_SectionName : tstrings;
366 400 begin
  401 + Log_DEBUG('p_ClassName => "'+p_ClassName+'" p_SectionName => "'+p_SectionName+'" p_DataName => "'+p_DataName+'"');
367 402 Result := '';
368 403 if (p_SectionName <> '') then
369 404 Begin
... ... @@ -647,45 +682,110 @@ Begin
647 682 End;
648 683  
649 684 procedure Executa_Col_Hard;
650   -var v_te_cpu_freq, v_te_cpu_fabricante, v_te_cpu_desc, v_te_cpu_serial, v_te_placa_rede_desc, v_te_placa_som_desc, v_te_cdrom_desc, v_te_teclado_desc,
651   - v_te_modem_desc, v_te_mouse_desc, v_te_mem_ram_desc, v_te_mem_ram_tipo, v_qt_placa_video_mem, v_te_placa_video_resolucao, v_te_placa_video_desc,
652   - v_qt_placa_video_cores, v_te_bios_fabricante, v_te_bios_data, v_te_bios_desc,
653   - v_te_placa_mae_fabricante, v_te_placa_mae_desc,UVC, ValorChaveRegistro,
654   - v_DataName, v_SectionName, v_Macs_Invalidos, v_Mac_Address : String;
655   - i : Integer;
656   - v_qt_mem_ram : WORD;
657   - v_CPU : TMiTeC_CPU;
658   - v_DISPLAY : TMiTeC_Display;
659   - v_MEDIA : TMiTeC_Media;
660   - v_DEVICES : TMiTeC_Devices;
661   - v_TCP : TMiTeC_TCPIP;
662   - v_SMBIOS : TMiTeC_SMBIOS;
663   - v_MemoriaRAM : TMemoryStatus;
664   - v_Report : TStringList;
  685 +var v_te_cpu_fabricante,
  686 + v_te_cpu_desc,
  687 + v_te_cpu_serial,
  688 + v_te_cpu_frequencia,
  689 + v_te_placa_rede_desc,
  690 + v_te_placa_som_desc,
  691 + v_te_cdrom_desc,
  692 + v_te_teclado_desc,
  693 + v_te_modem_desc,
  694 + v_te_mouse_desc,
  695 + v_te_mem_ram_desc,
  696 + v_te_mem_ram_tipo,
  697 + v_qt_placa_video_mem,
  698 + v_te_placa_video_resolucao,
  699 + v_te_placa_video_desc,
  700 + v_qt_placa_video_cores,
  701 + v_te_bios_fabricante,
  702 + v_te_bios_data,
  703 + v_te_bios_desc,
  704 + v_te_placa_mae_fabricante,
  705 + v_te_placa_mae_desc,
  706 + UVC,
  707 + ValorChaveRegistro,
  708 + v_DataName,
  709 + v_SectionName,
  710 + v_Macs_Invalidos,
  711 + v_Mac_Address,
  712 + v_Tripa_CDROM,
  713 + v_Tripa_TCPIP,
  714 + v_Tripa_CPU,
  715 + strAux,
  716 + v_PhysicalAddress,
  717 + v_IPAddress,
  718 + v_IPMask,
  719 + v_Gateway_IPAddress,
  720 + v_DHCP_IPAddress,
  721 + v_PrimaryWINS_IPAddress,
  722 + v_SecondaryWINS_IPAddress : String;
  723 + i : Integer;
  724 + v_qt_mem_ram : WORD;
  725 + v_CPU : TMiTeC_CPU;
  726 + v_DISPLAY : TMiTeC_Display;
  727 + v_MEDIA : TMiTeC_Media;
  728 + v_DEVICES : TMiTeC_Devices;
  729 + v_TCP : TMiTeC_TCPIP;
  730 + v_SMBIOS : TMiTeC_SMBIOS;
  731 + v_MemoriaRAM : TMemoryStatus;
  732 + v_Report,
  733 + v_tstrCPU,
  734 + v_tstrCDROM,
  735 + v_tstrTCPIP : TStringList;
665 736 begin
666 737 Try
667 738 SetValorDatMemoria('Col_Hard.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
668 739 v_Report := TStringList.Create;
669 740 log_diario('Coletando informações de Hardware.');
670 741  
  742 + v_tstrCPU := TStringList.Create;
  743 + v_tstrCDROM := TStringList.Create;
  744 + v_tstrTCPIP := TStringList.Create;
  745 +
671 746 Try
  747 + Begin
  748 + Log_Debug('Instanciando v_CPU...');
672 749 v_CPU := TMiTeC_CPU.Create(nil);
  750 + Log_Debug('RefreshingData...');
673 751 v_CPU.RefreshData;
  752 + Log_Debug('Gerando MSI_XML_Reports...');
674 753 MSI_XML_Reports.CPU_XML_Report(v_CPU,TRUE,v_Report);
  754 + Log_Debug('Liberando v_CPU...');
675 755 //v_CPU.Report(v_Report);
676 756 v_CPU.Free;
677 757  
  758 + Log_Debug('CPU Informations - OK!');
678 759 // CPU Informations
679 760 Try
680   - v_te_cpu_serial := parse('TCPU','Processor #1','Serial Number',v_Report);
681   - v_te_cpu_desc := AnsiToAscii(parse('TCPU','Processor #1','CPUName',v_Report));
682   - v_te_cpu_fabricante := AnsiToAscii(parse('TCPU','Processor #1','Vendor',v_Report));
683   - v_te_cpu_freq := parse('TCPU','Processor #1','Frequency',v_Report);
  761 + i := 1;
  762 + while (i <= 128) DO// Vamos procurar até 128 processadores! Eu já ouví dizer de máquinas neste porte!! (AP - 15FEV2008)
  763 + Begin
  764 + strAux := 'Processor #' + trim(intToStr(i));
  765 + v_te_cpu_serial := parse('TCPU',strAux,'Serial Number',v_Report);
  766 + v_te_cpu_desc := AnsiToAscii(parse('TCPU',strAux,'CPUName',v_Report));
  767 + IF (v_te_cpu_desc = '') then
  768 + v_te_cpu_desc := AnsiToAscii(parse('TCPU',strAux,'MarketingName',v_Report));
  769 + v_te_cpu_frequencia := AnsiToAscii(parse('TCPU',strAux,'Frequency',v_Report));
  770 + v_te_cpu_fabricante := AnsiToAscii(parse('TCPU',strAux,'Vendor',v_Report));
  771 +
  772 + // Se pegou ao menos a descrição, adiciono à tripa...
  773 + if (v_te_cpu_desc <> '') then
  774 + Begin
  775 + v_tstrCPU.Add('te_cpu_desc###' + v_te_cpu_desc + '#FIELD#' +
  776 + 'te_cpu_fabricante###' + v_te_cpu_fabricante + '#FIELD#' +
  777 + 'te_cpu_serial###' + v_te_cpu_serial + '#FIELD#' +
  778 + 'te_cpu_frequencia###' + v_te_cpu_frequencia);
  779 + Log_Debug('Adicionando a tstrCPU: "'+v_tstrCPU[v_tstrCPU.count-1]);
  780 + Log_DEBUG('Tamanho de v_tstrCPU 0: '+intToStr(v_tstrCPU.Count));
  781 + End;
  782 + i := i+1;
  783 + End;
684 784 Except
685 785 log_diario('Problema em CPU Details!');
686 786 end;
687 787  
688   -
  788 + Log_DEBUG('Tamanho de v_tstrCPU 1: '+intToStr(v_tstrCPU.Count));
689 789 // Media informations
690 790 Try
691 791 v_MEDIA := TMiTeC_Media.Create(nil);
... ... @@ -704,53 +804,85 @@ begin
704 804 except log_diario('Problema em MEDIA Details!');
705 805 end;
706 806  
  807 + Log_Debug('MEDIA Informations - OK!');
707 808  
708 809 // Devices informations
709 810 Try
  811 + Log_Debug('Instanciando v_DEVICES...');
710 812 v_DEVICES := TMiTeC_Devices.Create(nil);
  813 + Log_Debug('RefreshingData...');
711 814 v_DEVICES.RefreshData;
712 815 //if v_Debugs then v_DEVICES.Report(v_Report);
713 816 if v_Debugs then MSI_XML_Reports.Devices_XML_Report(v_DEVICES,TRUE,v_Report);
714   -
  817 + Log_Debug('v_DEVICES.DeviceCount = '+intToStr(v_DEVICES.DeviceCount));
715 818 i := 0;
716 819 While i < v_DEVICES.DeviceCount do
717 820 Begin
718 821 v_mensagem := 'Obtendo Descrição de CDROM';
  822 + Log_Debug('Percorrendo v_DEVICES.Devices['+intToStr(i)+']...');
719 823  
720 824 if v_DEVICES.Devices[i].DeviceClass=dcCDROM then
721   - if Trim(v_DEVICES.Devices[i].FriendlyName)='' then v_te_cdrom_desc := Trim(v_DEVICES.Devices[i].Description)
722   - else v_te_cdrom_desc := Trim(v_DEVICES.Devices[i].FriendlyName);
  825 + Begin
  826 + // Vamos tentar de tudo! :))))
  827 + v_te_cdrom_desc := Trim(v_DEVICES.Devices[i].Name);
  828 + if Trim(v_te_cdrom_desc)='' then
  829 + v_te_cdrom_desc := v_DEVICES.Devices[i].FriendlyName;
  830 + if Trim(v_te_cdrom_desc)='' then
  831 + v_te_cdrom_desc := v_DEVICES.Devices[i].Description;
  832 +
  833 + if (v_te_cdrom_desc <> '') then
  834 + Begin
  835 + v_tstrCDROM.Add('te_cdrom_desc###'+v_te_cdrom_desc);
  836 + Log_Debug('Adicionando a tstrCDROM: "'+v_tstrCDROM[v_tstrCDROM.count-1]+'"');
  837 + Log_Debug('CDROM Informations - OK!');
  838 + End;
  839 + End;
  840 +
723 841  
724 842 v_mensagem := 'Obtendo Descrição de Modem';
725 843 if v_DEVICES.Devices[i].DeviceClass=dcModem then
726   - if Trim(v_DEVICES.Devices[i].FriendlyName)='' then v_te_modem_desc := Trim(v_DEVICES.Devices[i].Description)
727   - else v_te_modem_desc := Trim(v_DEVICES.Devices[i].FriendlyName);
  844 + Begin
  845 + if Trim(v_DEVICES.Devices[i].FriendlyName)='' then
  846 + v_te_modem_desc := Trim(v_DEVICES.Devices[i].Description)
  847 + else
  848 + v_te_modem_desc := Trim(v_DEVICES.Devices[i].FriendlyName);
  849 +
  850 + Log_Debug('MODEM Informations - OK!');
  851 + End;
728 852  
729 853 v_mensagem := 'Obtendo Descrição de Mouse';
730 854 if v_DEVICES.Devices[i].DeviceClass=dcMouse then
731   - if Trim(v_DEVICES.Devices[i].FriendlyName)='' then v_te_mouse_desc := Trim(v_DEVICES.Devices[i].Description)
732   - else v_te_mouse_desc := Trim(v_DEVICES.Devices[i].FriendlyName);
  855 + Begin
  856 + if Trim(v_DEVICES.Devices[i].FriendlyName)='' then
  857 + v_te_mouse_desc := Trim(v_DEVICES.Devices[i].Description)
  858 + else
  859 + v_te_mouse_desc := Trim(v_DEVICES.Devices[i].FriendlyName);
  860 +
  861 + Log_Debug('MOUSE Informations - OK!');
  862 + End;
733 863  
734 864 v_mensagem := 'Obtendo Descrição de Teclado';
735 865 if v_DEVICES.Devices[i].DeviceClass=dcKeyboard then
736   - if Trim(v_DEVICES.Devices[i].FriendlyName)='' then v_te_teclado_desc := Trim(v_DEVICES.Devices[i].Description)
737   - else v_te_teclado_desc := Trim(v_DEVICES.Devices[i].FriendlyName);
738   -
739   -// v_mensagem := 'Obtendo Descrição de Placa-Mãe';
740   -// if v_DEVICES.Devices[i].DeviceClass=dcComputer then
741   -// if Trim(v_DEVICES.Devices[i].FriendlyName)='' then v_te_placa_mae_desc := Trim(v_DEVICES.Devices[i].Description)
742   -// else v_te_placa_mae_desc := Trim(v_DEVICES.Devices[i].FriendlyName);
743   -
744   -// if Trim(v_te_placa_mae_desc)='' then v_te_placa_mae_desc := Trim(v_DEVICES.Devices[i].Name);
  866 + Begin
  867 + if Trim(v_DEVICES.Devices[i].FriendlyName)='' then
  868 + v_te_teclado_desc := Trim(v_DEVICES.Devices[i].Description)
  869 + else
  870 + v_te_teclado_desc := Trim(v_DEVICES.Devices[i].FriendlyName);
745 871  
746   -// v_mensagem := 'Obtendo Fabricante da Placa-Mãe';
747   -// if v_DEVICES.Devices[i].DeviceClass=dcComputer then
748   -// v_te_placa_mae_fabricante := Trim(v_DEVICES.Devices[i].Manufacturer);
  872 + Log_Debug('KEYBOARD Informations - OK!');
  873 + End;
749 874  
750 875 v_mensagem := 'Obtendo Descrição de Vídeo';
751 876 if v_DEVICES.Devices[i].DeviceClass=dcDisplay then
752   - if Trim(v_DEVICES.Devices[i].FriendlyName)='' then v_te_placa_video_desc := Trim(v_DEVICES.Devices[i].Description)
753   - else v_te_placa_video_desc := Trim(v_DEVICES.Devices[i].FriendlyName);
  877 + Begin
  878 + if Trim(v_DEVICES.Devices[i].FriendlyName)='' then
  879 + v_te_placa_video_desc := Trim(v_DEVICES.Devices[i].Description)
  880 + else
  881 + v_te_placa_video_desc := Trim(v_DEVICES.Devices[i].FriendlyName);
  882 +
  883 + Log_Debug('DISPLAY Informations - OK!');
  884 + End;
  885 +
754 886 i := i+1;
755 887 End;
756 888 except log_diario('Problema em DEVICES Details!');
... ... @@ -760,126 +892,144 @@ begin
760 892  
761 893 // Memory informations
762 894 Try
  895 + Begin
763 896 v_MemoriaRAM.dwLength := SizeOf(v_MemoriaRAM);
764 897 GlobalMemoryStatus(v_MemoriaRAM);
765 898 v_qt_mem_ram := v_MemoriaRAM.dwTotalPhys div 1024000;
  899 + Log_Debug('MEMORY Informations - OK!');
  900 + End;
766 901 except log_diario('Problema em MEMORY Details!');
767 902 end;
768 903  
769 904 //
770 905 Try
771   - v_SMBIOS := TMiTeC_SMBIOS.Create(nil);
772   - v_SMBIOS.RefreshData;
773   - //v_SMBIOS.Report(v_Report);
774   - MSI_XML_Reports.SMBIOS_XML_Report(v_SMBIOS,true,v_Report);
  906 + Begin
  907 + v_SMBIOS := TMiTeC_SMBIOS.Create(nil);
  908 + v_SMBIOS.RefreshData;
  909 + //v_SMBIOS.Report(v_Report);
  910 + MSI_XML_Reports.SMBIOS_XML_Report(v_SMBIOS,true,v_Report);
775 911  
776   - v_SMBIOS.Free;
  912 + v_SMBIOS.Free;
777 913  
778 914  
779   - if Parse('TSMBIOS','MemoryModule', 'Count', v_Report) <> '0' then
780   - Begin
781   - i :=0;
782   - while i < StrToInt(Parse('TSMBIOS','MemoryModule', 'Count', v_Report)) do
783   - Begin
784   - v_SectionName := 'MemoryModule/Module_'+IntToStr(i);
785   - v_te_mem_ram_tipo:=Parse('TSMBIOS',v_SectionName, 'Type', v_Report);
786   - if Parse('TSMBIOS',v_SectionName, 'Size', v_Report)<>'0' then
787   - begin
788   - if (v_te_mem_ram_desc <> '') then v_te_mem_ram_desc := v_te_mem_ram_desc + ' - ';
789   - v_te_mem_ram_desc := v_te_mem_ram_desc + 'Slot ' + IntToStr(i) + ': ' + Parse('TSMBIOS',v_SectionName, 'Size', v_Report) + '(' + v_te_mem_ram_tipo +')';
790   - end;
791   - i := i+1;
792   - End;
793   - end
794   - else
795   - Begin
796   - i := 0;
797   - while i < StrToInt(Parse('TSMBIOS','MemoryDevice', 'Count', v_Report)) do
798   - Begin
799   - v_SectionName := 'MemoryModule/Device_'+IntToStr(i);
800   - v_te_mem_ram_tipo := Parse('TSMBIOS',v_SectionName, 'Type', v_Report);
801   -
802   - if Parse('TSMBIOS',v_SectionName, 'Size', v_Report)<>'0' then
803   - begin
804   - if (v_te_mem_ram_desc <> '') then v_te_mem_ram_desc := v_te_mem_ram_desc + ' - ';
805   - v_te_mem_ram_desc := v_te_mem_ram_desc + 'Slot ' + IntToStr(i) + ': ' + Parse('TSMBIOS',v_SectionName, 'Size', v_Report) + '(' + v_te_mem_ram_tipo + ')';
806   - end;
807   - i := i+1;
808   - end;
809   - End;
  915 + if Parse('TSMBIOS','MemoryModule', 'Count', v_Report) <> '0' then
  916 + Begin
  917 + i :=0;
  918 + while i < StrToInt(Parse('TSMBIOS','MemoryModule', 'Count', v_Report)) do
  919 + Begin
  920 + v_SectionName := 'MemoryModule/Module_'+IntToStr(i);
  921 + v_te_mem_ram_tipo:=Parse('TSMBIOS',v_SectionName, 'Type', v_Report);
  922 + if Parse('TSMBIOS',v_SectionName, 'Size', v_Report)<>'0' then
  923 + begin
  924 + if (v_te_mem_ram_desc <> '') then v_te_mem_ram_desc := v_te_mem_ram_desc + ' - ';
  925 + v_te_mem_ram_desc := v_te_mem_ram_desc + 'Slot ' + IntToStr(i) + ': ' + Parse('TSMBIOS',v_SectionName, 'Size', v_Report) + '(' + v_te_mem_ram_tipo +')';
  926 + end;
  927 + i := i+1;
  928 + End;
  929 + end
  930 + else
  931 + Begin
  932 + i := 0;
  933 + while i < StrToInt(Parse('TSMBIOS','MemoryDevice', 'Count', v_Report)) do
  934 + Begin
  935 + v_SectionName := 'MemoryModule/Device_'+IntToStr(i);
  936 + v_te_mem_ram_tipo := Parse('TSMBIOS',v_SectionName, 'Type', v_Report);
  937 +
  938 + if Parse('TSMBIOS',v_SectionName, 'Size', v_Report)<>'0' then
  939 + begin
  940 + if (v_te_mem_ram_desc <> '') then v_te_mem_ram_desc := v_te_mem_ram_desc + ' - ';
  941 + v_te_mem_ram_desc := v_te_mem_ram_desc + 'Slot ' + IntToStr(i) + ': ' + Parse('TSMBIOS',v_SectionName, 'Size', v_Report) + '(' + v_te_mem_ram_tipo + ')';
  942 + end;
  943 + i := i+1;
  944 + end;
  945 + End;
810 946  
811   - if (trim(v_te_placa_mae_fabricante)='') then
812   - v_te_placa_mae_fabricante := AnsiToAscii(Trim(Parse('TSMBIOS','Mainboard', 'Manufacturer', v_Report)));
813   - if (trim(v_te_placa_mae_desc)='') then
814   - v_te_placa_mae_desc := AnsiToAscii(Trim(Parse('TSMBIOS','Mainboard', 'Model', v_Report)));
815   - v_te_bios_data := Trim(Parse('TSMBIOS','BIOS', 'Date', v_Report));
816   - v_te_bios_fabricante := Trim(Parse('TSMBIOS','BIOS', 'Vendor', v_Report));
817   - v_te_bios_desc := AnsiToAscii(Trim(Parse('TBIOS','', 'Copyright', v_Report)));
818   - if (v_te_bios_desc = '') then
819   - v_te_bios_desc := Trim(Parse('TSMBIOS','BIOS', 'Version', v_Report));
  947 + if (trim(v_te_placa_mae_fabricante)='') then
  948 + v_te_placa_mae_fabricante := AnsiToAscii(Trim(Parse('TSMBIOS','Mainboard', 'Manufacturer', v_Report)));
  949 + if (trim(v_te_placa_mae_desc)='') then
  950 + v_te_placa_mae_desc := AnsiToAscii(Trim(Parse('TSMBIOS','Mainboard', 'Model', v_Report)));
  951 + v_te_bios_data := Trim(Parse('TSMBIOS','BIOS', 'Date', v_Report));
  952 + v_te_bios_fabricante := Trim(Parse('TSMBIOS','BIOS', 'Vendor', v_Report));
  953 + v_te_bios_desc := AnsiToAscii(Trim(Parse('TBIOS','', 'Copyright', v_Report)));
  954 + if (v_te_bios_desc = '') then
  955 + v_te_bios_desc := Trim(Parse('TSMBIOS','BIOS', 'Version', v_Report));
  956 +
  957 + Log_Debug('SMBIOS Informations - OK!');
  958 + End;
820 959 Except log_diario('Problema em SMBIOS Details!');
821 960 End;
822 961  
823 962 // Display informations
824 963 Try
825   - v_DISPLAY := TMiTeC_Display.Create(nil);
826   - v_DISPLAY.RefreshData;
827   - //v_DISPLAY.Report(v_Report);
828   - MSI_XML_Reports.Display_XML_Report(v_DISPLAY,true,v_Report);
829   - v_DISPLAY.Free;
830   -
831   - if (trim(v_te_placa_video_desc)='') then v_te_placa_video_desc := parse('TDisplay','','Adapter',v_Report);
832   - v_qt_placa_video_cores := parse('TDisplay','','ColorDepth',v_Report);
833   - v_qt_placa_video_mem := IntToStr(StrToInt(parse('TDisplay','','MemorySize',v_Report)) div 1048576 );
834   - v_te_placa_video_resolucao := parse('TDisplay','','HorizontalResolution',v_Report) + 'x' + parse('TDisplay','','VerticalResolution',v_Report);
  964 + Begin
  965 + v_DISPLAY := TMiTeC_Display.Create(nil);
  966 + v_DISPLAY.RefreshData;
  967 + //v_DISPLAY.Report(v_Report);
  968 + MSI_XML_Reports.Display_XML_Report(v_DISPLAY,true,v_Report);
  969 + v_DISPLAY.Free;
  970 +
  971 + if (trim(v_te_placa_video_desc)='') then v_te_placa_video_desc := parse('TDisplay','','Adapter',v_Report);
  972 + v_qt_placa_video_cores := parse('TDisplay','','ColorDepth',v_Report);
  973 + v_qt_placa_video_mem := IntToStr(StrToInt(parse('TDisplay','','MemorySize',v_Report)) div 1048576 );
  974 + v_te_placa_video_resolucao := parse('TDisplay','','HorizontalResolution',v_Report) + 'x' + parse('TDisplay','','VerticalResolution',v_Report);
  975 +
  976 + Log_Debug('VIDEO Informations - OK!');
  977 + End;
835 978 Except log_diario('Problema em VIDEO Details!');
836 979 End;
837 980  
838   - {
839   - // Network informations
840   - Try
841   - v_NETWORK := TMiTeC_Network.Create(nil);
842   - v_NETWORK.RefreshData;
843   - v_mensagem := 'Ativando Network Getinfo...';
844   - if v_Debugs then v_NETWORK.Report(v_Report);
845   - if v_NETWORK.PhysicalAdapters.Count>0 then
846   - Begin
847   - v_te_placa_rede_desc := v_NETWORK.TCPIP.Adapter[0].Name;
848   - End
849   - else if v_NETWORK.VirtualAdapters.Count >0 then
850   - Begin
851   - v_te_placa_rede_desc := v_NETWORK.VirtualAdapters.Names[0];
852   - End;
853   -
854   - Except log_diario('Problema em NETWORK Details!');
855   - End;
856   -
857   - v_NETWORK.Free;
858   - }
859   -
860 981 // Network informations
861 982 Try
862   - v_TCP := TMiTeC_TCPIP.Create(nil);
863   - v_TCP.RefreshData;
864   - //v_TCP.Report(v_Report);
865   - MSI_XML_Reports.TCPIP_XML_Report(v_TCP,true,v_Report);
866   - v_TCP.Free;
867   - v_mensagem := 'Ativando TCP Getinfo...';
  983 + Begin
  984 + v_TCP := TMiTeC_TCPIP.Create(nil);
  985 + v_TCP.RefreshData;
  986 + //v_TCP.Report(v_Report);
  987 + MSI_XML_Reports.TCPIP_XML_Report(v_TCP,true,v_Report);
  988 + v_TCP.Free;
  989 + v_mensagem := 'Ativando TCP Getinfo...';
868 990  
869   - i := 0;
870   - v_Macs_Invalidos := trim(GetValorDatMemoria('TCPIP.TE_ENDERECOS_MAC_INVALIDOS',v_tstrCipherOpened));
871   - v_te_placa_rede_desc := '';
  991 + i := 0;
  992 + v_Macs_Invalidos := trim(GetValorDatMemoria('TCPIP.TE_ENDERECOS_MAC_INVALIDOS',v_tstrCipherOpened));
872 993  
873   - // Em virtude de possibilidades de existência de VmWare likes,
874   - // serão verificados até 50 adaptadores de redes! :)
875   - While (v_te_placa_rede_desc = '') and (i < 50) do
876   - Begin
877   - v_SectionName := 'Adapter_'+inttostr(i);
878   - v_Mac_Address := parse('TTCPIP',v_SectionName,'PhysicalAddress',v_Report);
879   - if (TrataExcecoesMacAddress(v_Mac_Address, v_Macs_Invalidos)<>'') then
880   - v_te_placa_rede_desc := AnsiToAscii(trim(parse('TTCPIP',v_SectionName,'Name',v_Report)));
881   - i := i + 1;
882   - End;
  994 + // Em virtude de possibilidades de existência de VmWare likes,
  995 + // serão verificados até 50 adaptadores de redes! :) Não pesquisei essa possibilidade, por via das dúvidas... (AP - 15FEV2008)
  996 + While (i < 50) do
  997 + Begin
  998 + v_SectionName := 'Adapter_'+inttostr(i);
  999 + v_te_placa_rede_desc := AnsiToAscii(trim(parse('TTCPIP',v_SectionName,'Name',v_Report)));
  1000 + v_PhysicalAddress := parse('TTCPIP',v_SectionName,'PhysicalAddress',v_Report);
  1001 + v_IPAddress := parse('TTCPIP',v_SectionName,'IPAddress',v_Report);
  1002 + v_IPMask := parse('TTCPIP',v_SectionName,'IPMask',v_Report);
  1003 + v_Gateway_IPAddress := parse('TTCPIP',v_SectionName,'Gateway_IPAddress',v_Report);
  1004 + v_DHCP_IPAddress := parse('TTCPIP',v_SectionName,'DHCP_IPAddress',v_Report);
  1005 + v_PrimaryWINS_IPAddress := parse('TTCPIP',v_SectionName,'PrimaryWINS_IPAddress',v_Report);
  1006 + v_SecondaryWINS_IPAddress := parse('TTCPIP',v_SectionName,'SecondaryWINS_IPAddress',v_Report);
  1007 +
  1008 + if (trim( v_te_placa_rede_desc +
  1009 + v_PhysicalAddress +
  1010 + v_IPAddress +
  1011 + v_IPMask +
  1012 + v_Gateway_IPAddress +
  1013 + v_DHCP_IPAddress +
  1014 + v_PrimaryWINS_IPAddress +
  1015 + v_SecondaryWINS_IPAddress)<>'') then
  1016 + Begin
  1017 + v_tstrTCPIP.Add('te_placa_rede_desc###' + v_te_placa_rede_desc +'#FIELD#'+
  1018 + 'te_node_address###' + v_PhysicalAddress +'#FIELD#'+
  1019 + 'te_ip###' + v_IPAddress +'#FIELD#'+
  1020 + 'te_mascara###' + v_IPMask +'#FIELD#'+
  1021 + 'te_gateway###' + v_Gateway_IPAddress +'#FIELD#'+
  1022 + 'te_serv_dhcp###' + v_DHCP_IPAddress +'#FIELD#'+
  1023 + 'te_wins_primario###' + v_PrimaryWINS_IPAddress +'#FIELD#'+
  1024 + 'te_wins_secundario###' + v_SecondaryWINS_IPAddress);
  1025 + Log_Debug('Adicionando a tstrTCPIP: "'+v_tstrTCPIP[v_tstrTCPIP.count-1]+'"');
  1026 + End
  1027 + else
  1028 + i := 50;
  1029 + i := i + 1;
  1030 + End;
  1031 + Log_Debug('TCPIP Informations - OK!');
  1032 + End;
883 1033 Except log_diario('Problema em TCP Details!');
884 1034 End;
885 1035  
... ... @@ -895,42 +1045,65 @@ begin
895 1045 End;
896 1046 v_report.Free;
897 1047 End;
898   -
  1048 + End;
899 1049 Except
900 1050 End;
901   - {
902   - for i:=0 to MSysteminfo1.Storage.DeviceCount-1 do
903   - if (MSysteminfo1.Storage.Devices[i].Geometry.MediaType = Fixedmedia) Then
904   - Begin
905   - DescHDs := MSysteminfo1.Storage.Devices[i].Model + IntToStr((MSysteminfo1.Storage.Devices[i].Capacity div 1024) div 1024);
906   - end;
907   - }
  1051 +
  1052 + // Crio as Tripas dos múltiplos ítens...
  1053 + v_Tripa_CPU := '';
  1054 + v_tstrCPU.Sort;
  1055 + Log_DEBUG('Tamanho de v_tstrCPU 2: '+intToStr(v_tstrCPU.Count));
  1056 + i := 0;
  1057 + while (i < v_tstrCPU.Count) do
  1058 + Begin
  1059 + v_Tripa_CPU := v_Tripa_CPU + iif(v_Tripa_CPU = '','','#CPU#');
  1060 + v_Tripa_CPU := v_Tripa_CPU + v_tstrCPU[i];
  1061 + i := i + 1;
  1062 + End;
  1063 +
  1064 + v_Tripa_CDROM := '';
  1065 + v_tstrCDROM.Sort;
  1066 + Log_DEBUG('Tamanho de v_tstrCDROM: '+intToStr(v_tstrCDROM.Count));
  1067 + i := 0;
  1068 + while (i < v_tstrCDROM.Count) do
  1069 + Begin
  1070 + v_Tripa_CDROM := v_Tripa_CDROM + iif(v_Tripa_CDROM = '','','#CDROM#');
  1071 + v_Tripa_CDROM := v_Tripa_CDROM + v_tstrCDROM[i];
  1072 + i := i + 1;
  1073 + End;
  1074 +
  1075 + v_Tripa_TCPIP := '';
  1076 + v_tstrTCPIP.Sort;
  1077 + Log_DEBUG('Tamanho de v_tstrTCPIP: '+intToStr(v_tstrTCPIP.Count));
  1078 + i := 0;
  1079 + while (i < v_tstrTCPIP.Count) do
  1080 + Begin
  1081 + v_Tripa_TCPIP := v_Tripa_TCPIP + iif(v_Tripa_TCPIP = '','','#TCPIP#');
  1082 + v_Tripa_TCPIP := v_Tripa_TCPIP + v_tstrTCPIP[i];
  1083 + i := i + 1;
  1084 + End;
908 1085  
909 1086 Try
910 1087 // Monto a string que será comparada com o valor armazenado no registro.
911 1088 v_mensagem := 'Montando pacote para comparações...';
912   - UVC := Trim(v_te_placa_rede_desc + ';' +
913   - v_te_cpu_fabricante + ';' +
914   - v_te_cpu_desc + ';' +
915   - // Como a frequência não é constante, ela não vai entrar na verificação da mudança de hardware.
916   - // IntToStr(MSysteminfo1.CPU.Frequency) + ';' +
917   - v_te_cpu_serial + ';' +
918   - v_te_mem_ram_desc + ';' +
919   - IntToStr(v_qt_mem_ram) + ';' +
920   - v_te_bios_desc + ';' +
921   - v_te_bios_data + ';' +
922   - v_te_bios_fabricante + ';' +
923   - v_te_placa_mae_fabricante + ';' +
924   - v_te_placa_mae_desc + ';' +
925   - v_te_placa_video_desc + ';' +
926   - v_te_placa_video_resolucao + ';' +
927   - v_qt_placa_video_cores + ';' +
928   - v_qt_placa_video_mem + ';' +
929   - v_te_placa_som_desc + ';' +
930   - v_te_cdrom_desc + ';' +
931   - v_te_teclado_desc + ';' +
932   - v_te_modem_desc + ';' +
933   - v_te_mouse_desc);
  1089 + UVC := StringReplace(Trim( v_Tripa_TCPIP + ';' +
  1090 + v_Tripa_CPU + ';' +
  1091 + v_Tripa_CDROM + ';' +
  1092 + v_te_mem_ram_desc + ';' +
  1093 + IntToStr(v_qt_mem_ram) + ';' +
  1094 + v_te_bios_desc + ';' +
  1095 + v_te_bios_data + ';' +
  1096 + v_te_bios_fabricante + ';' +
  1097 + v_te_placa_mae_fabricante + ';' +
  1098 + v_te_placa_mae_desc + ';' +
  1099 + v_te_placa_video_desc + ';' +
  1100 + v_te_placa_video_resolucao + ';' +
  1101 + v_qt_placa_video_cores + ';' +
  1102 + v_qt_placa_video_mem + ';' +
  1103 + v_te_placa_som_desc + ';' +
  1104 + v_te_teclado_desc + ';' +
  1105 + v_te_modem_desc + ';' +
  1106 + v_te_mouse_desc),' ',' ',[rfReplaceAll]);
934 1107 Except log_diario('Problema em comparação de envio!');
935 1108 End;
936 1109  
... ... @@ -947,28 +1120,25 @@ begin
947 1120 Begin
948 1121 Try
949 1122 //Envio via rede para ao Agente Gerente, para gravação no BD.
950   - SetValorDatMemoria('Col_Hard.te_placa_rede_desc' , v_te_placa_rede_desc , v_tstrCipherOpened1);
951   - SetValorDatMemoria('Col_Hard.te_placa_mae_fabricante' , v_te_placa_mae_fabricante , v_tstrCipherOpened1);
952   - SetValorDatMemoria('Col_Hard.te_placa_mae_desc' , v_te_placa_mae_desc , v_tstrCipherOpened1);
953   - SetValorDatMemoria('Col_Hard.te_cpu_serial' , v_te_cpu_serial , v_tstrCipherOpened1);
954   - SetValorDatMemoria('Col_Hard.te_cpu_desc' , v_te_cpu_desc , v_tstrCipherOpened1);
955   - SetValorDatMemoria('Col_Hard.te_cpu_fabricante' , v_te_cpu_fabricante , v_tstrCipherOpened1);
956   - SetValorDatMemoria('Col_Hard.te_cpu_freq' , v_te_cpu_freq , v_tstrCipherOpened1);
957   - SetValorDatMemoria('Col_Hard.qt_mem_ram' , IntToStr(v_qt_mem_ram) , v_tstrCipherOpened1);
958   - SetValorDatMemoria('Col_Hard.te_mem_ram_desc' , v_te_mem_ram_desc , v_tstrCipherOpened1);
959   - SetValorDatMemoria('Col_Hard.te_bios_desc' , v_te_bios_desc , v_tstrCipherOpened1);
960   - SetValorDatMemoria('Col_Hard.te_bios_data' , v_te_bios_data , v_tstrCipherOpened1);
961   - SetValorDatMemoria('Col_Hard.te_bios_fabricante' , v_te_bios_fabricante , v_tstrCipherOpened1);
962   - SetValorDatMemoria('Col_Hard.qt_placa_video_cores' , v_qt_placa_video_cores , v_tstrCipherOpened1);
963   - SetValorDatMemoria('Col_Hard.te_placa_video_desc' , v_te_placa_video_desc , v_tstrCipherOpened1);
964   - SetValorDatMemoria('Col_Hard.qt_placa_video_mem' , v_qt_placa_video_mem , v_tstrCipherOpened1);
965   - SetValorDatMemoria('Col_Hard.te_placa_video_resolucao', v_te_placa_video_resolucao, v_tstrCipherOpened1);
966   - SetValorDatMemoria('Col_Hard.te_placa_som_desc' , v_te_placa_som_desc , v_tstrCipherOpened1);
967   - SetValorDatMemoria('Col_Hard.te_cdrom_desc' , v_te_cdrom_desc , v_tstrCipherOpened1);
968   - SetValorDatMemoria('Col_Hard.te_teclado_desc' , v_te_teclado_desc , v_tstrCipherOpened1);
969   - SetValorDatMemoria('Col_Hard.te_mouse_desc' , v_te_mouse_desc , v_tstrCipherOpened1);
970   - SetValorDatMemoria('Col_Hard.te_modem_desc' , v_te_modem_desc , v_tstrCipherOpened1);
971   - SetValorDatMemoria('Col_Hard.UVC' , UVC , v_tstrCipherOpened1);
  1123 + SetValorDatMemoria('Col_Hard.te_Tripa_TCPIP' , StringReplace(v_Tripa_TCPIP ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1124 + SetValorDatMemoria('Col_Hard.te_Tripa_CPU' , StringReplace(v_Tripa_CPU ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1125 + SetValorDatMemoria('Col_Hard.te_Tripa_CDROM' , StringReplace(v_Tripa_CDROM ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1126 + SetValorDatMemoria('Col_Hard.te_placa_mae_fabricante' , StringReplace(v_te_placa_mae_fabricante ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1127 + SetValorDatMemoria('Col_Hard.te_placa_mae_desc' , StringReplace(v_te_placa_mae_desc ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1128 + SetValorDatMemoria('Col_Hard.qt_mem_ram' , StringReplace(IntToStr(v_qt_mem_ram) ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1129 + SetValorDatMemoria('Col_Hard.te_mem_ram_desc' , StringReplace(v_te_mem_ram_desc ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1130 + SetValorDatMemoria('Col_Hard.te_bios_desc' , StringReplace(v_te_bios_desc ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1131 + SetValorDatMemoria('Col_Hard.te_bios_data' , StringReplace(v_te_bios_data ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1132 + SetValorDatMemoria('Col_Hard.te_bios_fabricante' , StringReplace(v_te_bios_fabricante ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1133 + SetValorDatMemoria('Col_Hard.qt_placa_video_cores' , StringReplace(v_qt_placa_video_cores ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1134 + SetValorDatMemoria('Col_Hard.te_placa_video_desc' , StringReplace(v_te_placa_video_desc ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1135 + SetValorDatMemoria('Col_Hard.qt_placa_video_mem' , StringReplace(v_qt_placa_video_mem ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1136 + SetValorDatMemoria('Col_Hard.te_placa_video_resolucao', StringReplace(v_te_placa_video_resolucao,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1137 + SetValorDatMemoria('Col_Hard.te_placa_som_desc' , StringReplace(v_te_placa_som_desc ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1138 + SetValorDatMemoria('Col_Hard.te_teclado_desc' , StringReplace(v_te_teclado_desc ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1139 + SetValorDatMemoria('Col_Hard.te_mouse_desc' , StringReplace(v_te_mouse_desc ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1140 + SetValorDatMemoria('Col_Hard.te_modem_desc' , StringReplace(v_te_modem_desc ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
  1141 + SetValorDatMemoria('Col_Hard.UVC' , StringReplace(UVC ,' ',' ',[rfReplaceAll]) , v_tstrCipherOpened1);
972 1142 CipherClose(p_path_cacic + 'temp\col_hard.dat', v_tstrCipherOpened1);
973 1143 Except log_diario('Problema em gravação de dados no DAT!');
974 1144 End;
... ...
col_patr/col_patr.dof
... ... @@ -115,7 +115,7 @@ AutoIncBuild=0
115 115 MajorVer=2
116 116 MinorVer=2
117 117 Release=0
118   -Build=1
  118 +Build=3
119 119 Debug=0
120 120 PreRelease=0
121 121 Special=0
... ... @@ -126,13 +126,13 @@ CodePage=1252
126 126 [Version Info Keys]
127 127 CompanyName=Dataprev-Unidade Regional Espírito Santo
128 128 FileDescription=Coletor de Informações de Patrimônio do Sistema CACIC
129   -FileVersion=2.2.0.1
  129 +FileVersion=2.2.0.3
130 130 InternalName=
131 131 LegalCopyright=
132 132 LegalTrademarks=
133 133 OriginalFilename=
134 134 ProductName=Col_PATR
135   -ProductVersion=2.2.0.1
  135 +ProductVersion=2.2.0.3
136 136 Comments=Baseado na Licença GPL(General Public License)
137 137 [HistoryLists\hlDebugSourcePath]
138 138 Count=1
... ...
col_patr/col_patr.res
No preview for this file type
col_patr/main_col_patr.dfm
1 1 object FormPatrimonio: TFormPatrimonio
2   - Left = 65
3   - Top = 67
  2 + Left = 137
  3 + Top = 173
4 4 BorderIcons = [biSystemMenu]
5 5 BorderStyle = bsSingle
6   - Caption = 'CACIC - Coletor Informa'#231#245'es Patrimoniais'
7   - ClientHeight = 246
8   - ClientWidth = 605
  6 + Caption = 'CACIC - Coletor de Informa'#231#245'es Patrimoniais'
  7 + ClientHeight = 286
  8 + ClientWidth = 782
9 9 Color = clBtnFace
10 10 Font.Charset = DEFAULT_CHARSET
11 11 Font.Color = clWindowText
... ... @@ -20,11 +20,26 @@ object FormPatrimonio: TFormPatrimonio
20 20 OnCreate = FormCreate
21 21 PixelsPerInch = 96
22 22 TextHeight = 13
  23 + object lbVersao: TLabel
  24 + Left = 672
  25 + Top = 273
  26 + Width = 108
  27 + Height = 12
  28 + Alignment = taRightJustify
  29 + AutoSize = False
  30 + Caption = 'v: X.X.X.X'
  31 + Font.Charset = DEFAULT_CHARSET
  32 + Font.Color = clWindowText
  33 + Font.Height = -9
  34 + Font.Name = 'Arial'
  35 + Font.Style = []
  36 + ParentFont = False
  37 + end
23 38 object GroupBox1: TGroupBox
24   - Left = 5
  39 + Left = 2
25 40 Top = -1
26   - Width = 596
27   - Height = 67
  41 + Width = 780
  42 + Height = 75
28 43 Caption = ' Leia com aten'#231#227'o '
29 44 Color = clBtnFace
30 45 Font.Charset = DEFAULT_CHARSET
... ... @@ -38,7 +53,7 @@ object FormPatrimonio: TFormPatrimonio
38 53 object Label10: TLabel
39 54 Left = 5
40 55 Top = 14
41   - Width = 588
  56 + Width = 769
42 57 Height = 32
43 58 AutoSize = False
44 59 Caption =
... ... @@ -55,12 +70,12 @@ object FormPatrimonio: TFormPatrimonio
55 70 end
56 71 object Label11: TLabel
57 72 Left = 6
58   - Top = 46
59   - Width = 456
  73 + Top = 54
  74 + Width = 475
60 75 Height = 16
61 76 Caption =
62   - 'Por favor, atualize as informa'#231#245'es abaixo. Agradecemos a sua col' +
63   - 'abora'#231#227'o.'
  77 + 'Por favor, atualize as informa'#231#245'es abaixo. Agradecemos pela sua ' +
  78 + 'colabora'#231#227'o.'
64 79 Color = clBtnFace
65 80 Font.Charset = DEFAULT_CHARSET
66 81 Font.Color = clBlack
... ... @@ -72,11 +87,13 @@ object FormPatrimonio: TFormPatrimonio
72 87 end
73 88 end
74 89 object GroupBox2: TGroupBox
75   - Left = 5
76   - Top = 69
77   - Width = 596
  90 + Left = 2
  91 + Top = 77
  92 + Width = 780
78 93 Height = 144
79   - Caption = ' Informa'#231#245'es sobre este computador '
  94 + Caption =
  95 + 'Informa'#231#245'es sobre localiza'#231#227'o f'#237'sica e patrimonial deste computa' +
  96 + 'dor'
80 97 Font.Charset = DEFAULT_CHARSET
81 98 Font.Color = clBlue
82 99 Font.Height = -11
... ... @@ -85,7 +102,7 @@ object FormPatrimonio: TFormPatrimonio
85 102 ParentFont = False
86 103 TabOrder = 1
87 104 object Etiqueta1: TLabel
88   - Left = 11
  105 + Left = 3
89 106 Top = 17
90 107 Width = 48
91 108 Height = 13
... ... @@ -98,8 +115,8 @@ object FormPatrimonio: TFormPatrimonio
98 115 ParentFont = False
99 116 end
100 117 object Etiqueta2: TLabel
101   - Left = 185
102   - Top = 17
  118 + Left = 3
  119 + Top = 101
103 120 Width = 48
104 121 Height = 13
105 122 Caption = 'Etiqueta 2'
... ... @@ -111,7 +128,7 @@ object FormPatrimonio: TFormPatrimonio
111 128 ParentFont = False
112 129 end
113 130 object Etiqueta3: TLabel
114   - Left = 430
  131 + Left = 341
115 132 Top = 17
116 133 Width = 48
117 134 Height = 13
... ... @@ -124,8 +141,8 @@ object FormPatrimonio: TFormPatrimonio
124 141 ParentFont = False
125 142 end
126 143 object Etiqueta4: TLabel
127   - Left = 11
128   - Top = 57
  144 + Left = 341
  145 + Top = 59
129 146 Width = 48
130 147 Height = 13
131 148 Caption = 'Etiqueta 4'
... ... @@ -137,8 +154,8 @@ object FormPatrimonio: TFormPatrimonio
137 154 ParentFont = False
138 155 end
139 156 object Etiqueta5: TLabel
140   - Left = 185
141   - Top = 57
  157 + Left = 492
  158 + Top = 59
142 159 Width = 48
143 160 Height = 13
144 161 Caption = 'Etiqueta 5'
... ... @@ -150,8 +167,8 @@ object FormPatrimonio: TFormPatrimonio
150 167 ParentFont = False
151 168 end
152 169 object Etiqueta6: TLabel
153   - Left = 430
154   - Top = 57
  170 + Left = 645
  171 + Top = 59
155 172 Width = 48
156 173 Height = 13
157 174 Caption = 'Etiqueta 6'
... ... @@ -163,8 +180,8 @@ object FormPatrimonio: TFormPatrimonio
163 180 ParentFont = False
164 181 end
165 182 object Etiqueta7: TLabel
166   - Left = 11
167   - Top = 98
  183 + Left = 341
  184 + Top = 101
168 185 Width = 48
169 186 Height = 13
170 187 Caption = 'Etiqueta 7'
... ... @@ -176,8 +193,8 @@ object FormPatrimonio: TFormPatrimonio
176 193 ParentFont = False
177 194 end
178 195 object Etiqueta8: TLabel
179   - Left = 185
180   - Top = 98
  196 + Left = 492
  197 + Top = 101
181 198 Width = 48
182 199 Height = 13
183 200 Caption = 'Etiqueta 8'
... ... @@ -189,8 +206,8 @@ object FormPatrimonio: TFormPatrimonio
189 206 ParentFont = False
190 207 end
191 208 object Etiqueta9: TLabel
192   - Left = 430
193   - Top = 98
  209 + Left = 645
  210 + Top = 101
194 211 Width = 48
195 212 Height = 13
196 213 Caption = 'Etiqueta 9'
... ... @@ -201,10 +218,23 @@ object FormPatrimonio: TFormPatrimonio
201 218 Font.Style = []
202 219 ParentFont = False
203 220 end
  221 + object Etiqueta1a: TLabel
  222 + Left = 3
  223 + Top = 60
  224 + Width = 54
  225 + Height = 13
  226 + Caption = 'Etiqueta 1a'
  227 + Font.Charset = DEFAULT_CHARSET
  228 + Font.Color = clWindowText
  229 + Font.Height = -11
  230 + Font.Name = 'MS Sans Serif'
  231 + Font.Style = []
  232 + ParentFont = False
  233 + end
204 234 object id_unid_organizacional_nivel1: TComboBox
205   - Left = 9
  235 + Left = 3
206 236 Top = 31
207   - Width = 157
  237 + Width = 325
208 238 Height = 21
209 239 Hint = 'Esse '#233' o texto de ajuda da "Etiqueta 1"'
210 240 Style = csDropDownList
... ... @@ -221,9 +251,9 @@ object FormPatrimonio: TFormPatrimonio
221 251 OnChange = id_unid_organizacional_nivel1Change
222 252 end
223 253 object id_unid_organizacional_nivel2: TComboBox
224   - Left = 185
225   - Top = 31
226   - Width = 226
  254 + Left = 3
  255 + Top = 115
  256 + Width = 325
227 257 Height = 21
228 258 Style = csDropDownList
229 259 Font.Charset = DEFAULT_CHARSET
... ... @@ -238,117 +268,151 @@ object FormPatrimonio: TFormPatrimonio
238 268 TabOrder = 1
239 269 end
240 270 object te_localizacao_complementar: TEdit
241   - Left = 430
  271 + Left = 341
242 272 Top = 31
243   - Width = 157
  273 + Width = 434
244 274 Height = 21
245 275 Font.Charset = DEFAULT_CHARSET
246 276 Font.Color = clWindowText
247 277 Font.Height = -11
248 278 Font.Name = 'MS Sans Serif'
249 279 Font.Style = []
  280 + MaxLength = 100
250 281 ParentFont = False
251 282 ParentShowHint = False
252 283 ShowHint = True
253 284 TabOrder = 2
254 285 end
255 286 object te_info_patrimonio3: TEdit
256   - Left = 430
257   - Top = 71
258   - Width = 155
  287 + Left = 645
  288 + Top = 73
  289 + Width = 130
259 290 Height = 21
260 291 Font.Charset = DEFAULT_CHARSET
261 292 Font.Color = clWindowText
262 293 Font.Height = -11
263 294 Font.Name = 'MS Sans Serif'
264 295 Font.Style = []
  296 + MaxLength = 20
265 297 ParentFont = False
266 298 ParentShowHint = False
267 299 ShowHint = True
268 300 TabOrder = 5
269 301 end
270 302 object te_info_patrimonio1: TEdit
271   - Left = 9
272   - Top = 71
273   - Width = 158
  303 + Left = 341
  304 + Top = 73
  305 + Width = 130
274 306 Height = 21
275 307 Font.Charset = DEFAULT_CHARSET
276 308 Font.Color = clWindowText
277 309 Font.Height = -11
278 310 Font.Name = 'MS Sans Serif'
279 311 Font.Style = []
  312 + MaxLength = 20
280 313 ParentFont = False
281 314 ParentShowHint = False
282 315 ShowHint = True
283 316 TabOrder = 3
284 317 end
285 318 object te_info_patrimonio2: TEdit
286   - Left = 185
287   - Top = 71
288   - Width = 155
  319 + Left = 492
  320 + Top = 73
  321 + Width = 130
289 322 Height = 21
290 323 Font.Charset = DEFAULT_CHARSET
291 324 Font.Color = clWindowText
292 325 Font.Height = -11
293 326 Font.Name = 'MS Sans Serif'
294 327 Font.Style = []
  328 + MaxLength = 20
295 329 ParentFont = False
296 330 ParentShowHint = False
297 331 ShowHint = True
298 332 TabOrder = 4
299 333 end
300 334 object te_info_patrimonio6: TEdit
301   - Left = 430
302   - Top = 112
303   - Width = 155
  335 + Left = 645
  336 + Top = 115
  337 + Width = 130
304 338 Height = 21
305 339 Font.Charset = DEFAULT_CHARSET
306 340 Font.Color = clWindowText
307 341 Font.Height = -11
308 342 Font.Name = 'MS Sans Serif'
309 343 Font.Style = []
  344 + MaxLength = 20
310 345 ParentFont = False
311 346 ParentShowHint = False
312 347 ShowHint = True
313 348 TabOrder = 8
314 349 end
315 350 object te_info_patrimonio4: TEdit
316   - Left = 9
317   - Top = 112
318   - Width = 158
  351 + Left = 341
  352 + Top = 115
  353 + Width = 130
319 354 Height = 21
320 355 Font.Charset = DEFAULT_CHARSET
321 356 Font.Color = clWindowText
322 357 Font.Height = -11
323 358 Font.Name = 'MS Sans Serif'
324 359 Font.Style = []
  360 + MaxLength = 20
325 361 ParentFont = False
326 362 ParentShowHint = False
327 363 ShowHint = True
328 364 TabOrder = 6
329 365 end
330 366 object te_info_patrimonio5: TEdit
331   - Left = 185
332   - Top = 112
333   - Width = 155
  367 + Left = 492
  368 + Top = 115
  369 + Width = 130
334 370 Height = 21
335 371 Font.Charset = DEFAULT_CHARSET
336 372 Font.Color = clWindowText
337 373 Font.Height = -11
338 374 Font.Name = 'MS Sans Serif'
339 375 Font.Style = []
  376 + MaxLength = 20
340 377 ParentFont = False
341 378 ParentShowHint = False
342 379 ShowHint = True
343 380 TabOrder = 7
344 381 end
  382 + object id_unid_organizacional_nivel1a: TComboBox
  383 + Left = 3
  384 + Top = 73
  385 + Width = 325
  386 + Height = 21
  387 + Hint = 'Esse '#233' o texto de ajuda da "Etiqueta 1"'
  388 + Style = csDropDownList
  389 + Font.Charset = DEFAULT_CHARSET
  390 + Font.Color = clWindowText
  391 + Font.Height = -11
  392 + Font.Name = 'MS Sans Serif'
  393 + Font.Style = []
  394 + ItemHeight = 13
  395 + ParentFont = False
  396 + ParentShowHint = False
  397 + ShowHint = True
  398 + TabOrder = 9
  399 + OnChange = id_unid_organizacional_nivel1aChange
  400 + end
  401 + object Panel1: TPanel
  402 + Left = 333
  403 + Top = 15
  404 + Width = 2
  405 + Height = 125
  406 + Caption = 'Panel1'
  407 + TabOrder = 10
  408 + end
345 409 end
346 410 object Button2: TButton
347   - Left = 435
348   - Top = 219
349   - Width = 155
350   - Height = 23
351   - Caption = 'Gravar Informa'#231#245'es'
  411 + Left = 290
  412 + Top = 237
  413 + Width = 212
  414 + Height = 33
  415 + Caption = 'Gravar Informa'#231#245'es Patrimoniais'
352 416 Font.Charset = DEFAULT_CHARSET
353 417 Font.Color = clWindowText
354 418 Font.Height = -11
... ...
col_patr/main_col_patr.pas
... ... @@ -33,7 +33,9 @@ uses IniFiles,
33 33 DIALOGS,
34 34 DCPcrypt2,
35 35 DCPrijndael,
36   - DCPbase64;
  36 + DCPbase64,
  37 + ExtCtrls,
  38 + Math;
37 39  
38 40 var p_path_cacic : String;
39 41 v_Dados_Patrimonio : TStrings;
... ... @@ -79,6 +81,10 @@ type
79 81 te_info_patrimonio4: TEdit;
80 82 te_info_patrimonio5: TEdit;
81 83 te_info_patrimonio6: TEdit;
  84 + Etiqueta1a: TLabel;
  85 + id_unid_organizacional_nivel1a: TComboBox;
  86 + Panel1: TPanel;
  87 + lbVersao: TLabel;
82 88  
83 89 function SetValorChaveRegEdit(Chave: String; Dado: Variant): Variant;
84 90 function GetValorChaveRegEdit(Chave: String): Variant;
... ... @@ -107,10 +113,19 @@ type
107 113 function GetVersionInfo(p_File: string):string;
108 114 function VerFmt(const MS, LS: DWORD): string;
109 115 function GetFolderDate(Folder: string): TDateTime;
  116 + procedure id_unid_organizacional_nivel1aChange(Sender: TObject);
110 117 private
111   - var_id_unid_organizacional_nivel1, var_id_unid_organizacional_nivel2, var_te_localizacao_complementar,
112   - var_te_info_patrimonio1, var_te_info_patrimonio2, var_te_info_patrimonio3, var_te_info_patrimonio4,
113   - var_te_info_patrimonio5, var_te_info_patrimonio6 : String;
  118 + var_id_unid_organizacional_nivel1,
  119 + var_id_unid_organizacional_nivel1a,
  120 + var_id_unid_organizacional_nivel2,
  121 + var_id_Local,
  122 + var_te_localizacao_complementar,
  123 + var_te_info_patrimonio1,
  124 + var_te_info_patrimonio2,
  125 + var_te_info_patrimonio3,
  126 + var_te_info_patrimonio4,
  127 + var_te_info_patrimonio5,
  128 + var_te_info_patrimonio6 : String;
114 129 public
115 130 end;
116 131  
... ... @@ -130,15 +145,29 @@ type
130 145 end;
131 146 TVetorUON1 = array of TRegistroUON1;
132 147  
  148 + TRegistroUON1a = record
  149 + id1 : String;
  150 + id1a : String;
  151 + nm1a : String;
  152 + id_local: String;
  153 + end;
  154 +
  155 + TVetorUON1a = array of TRegistroUON1a;
  156 +
133 157 TRegistroUON2 = record
134   - id1 : String;
135   - id2 : String;
136   - nm2 : String;
  158 + id1a : String;
  159 + id2 : String;
  160 + nm2 : String;
  161 + id_local: String;
137 162 end;
138 163 TVetorUON2 = array of TRegistroUON2;
139 164  
140   -var VetorUON1 : TVetorUON1;
141   - VetorUON2 : TVetorUON2;
  165 +var VetorUON1 : TVetorUON1;
  166 + VetorUON1a : TVetorUON1a;
  167 + VetorUON2 : TVetorUON2;
  168 +
  169 + // Esse array é usado apenas para saber a uon1a, após a filtragem pelo uon1
  170 + VetorUON1aFiltrado : array of String;
142 171  
143 172 // Esse array é usado apenas para saber a uon2, após a filtragem pelo uon1
144 173 VetorUON2Filtrado : array of String;
... ... @@ -582,28 +611,39 @@ begin
582 611 end;
583 612 end;
584 613  
585   -Function RetornaValorVetorUON1(id1Procurado1 : string) : String;
  614 +Function RetornaValorVetorUON1(id1 : string) : String;
586 615 var I : Integer;
587 616 begin
588 617 For I := 0 to (Length(VetorUON1)-1) Do
589   - If (VetorUON1[I].id1 = id1Procurado1) Then Result := VetorUON1[I].nm1;
  618 + If (VetorUON1[I].id1 = id1) Then Result := VetorUON1[I].nm1;
590 619 end;
591 620  
592   -
593   -Function RetornaValorVetorUON2(id1Procurado : string; id2Procurado : string) : String;
  621 +Function RetornaValorVetorUON1a(id1a : string) : String;
  622 +var I : Integer;
  623 +begin
  624 + For I := 0 to (Length(VetorUON1a)-1) Do
  625 + If (VetorUON1a[I].id1a = id1a) Then Result := VetorUON1a[I].nm1a;
  626 +end;
  627 +Function RetornaValorVetorUON2(id2, idLocal : string) : String;
594 628 var I : Integer;
595 629 begin
596 630 For I := 0 to (Length(VetorUON2)-1) Do
597   - If (VetorUON2[I].id1 = id1Procurado) and (VetorUON2[I].id2 = id2Procurado) Then Result := VetorUON2[I].nm2;
  631 + If (VetorUON2[I].id2 = id2) and
  632 + (VetorUON2[I].id_local = idLocal) Then Result := VetorUON2[I].nm2;
598 633 end;
599 634  
  635 +
600 636 procedure TFormPatrimonio.RecuperaValoresAnteriores;
601 637 begin
602   - Etiqueta1.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta1', v_configs));
  638 + Etiqueta1.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta1', v_configs));
  639 + Etiqueta1a.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta1a', v_configs));
603 640  
604 641 var_id_unid_organizacional_nivel1 := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1',v_tstrCipherOpened);
605 642 if (var_id_unid_organizacional_nivel1='') then var_id_unid_organizacional_nivel1 := DeCrypt(XML.XML_RetornaValor('ID_UON1', v_configs));
606 643  
  644 + var_id_unid_organizacional_nivel1a := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1a',v_tstrCipherOpened);
  645 + if (var_id_unid_organizacional_nivel1a='') then var_id_unid_organizacional_nivel1a := DeCrypt(XML.XML_RetornaValor('ID_UON1a', v_configs));
  646 +
607 647 var_id_unid_organizacional_nivel2 := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2',v_tstrCipherOpened);
608 648 if (var_id_unid_organizacional_nivel2='') then var_id_unid_organizacional_nivel2 := DeCrypt(XML.XML_RetornaValor('ID_UON2', v_configs));
609 649  
... ... @@ -638,12 +678,32 @@ begin
638 678 var_te_info_patrimonio6 := GetValorDatMemoria('Patrimonio.te_info_patrimonio6',v_tstrCipherOpened);
639 679 if (var_te_info_patrimonio6='') then var_te_info_patrimonio6 := DeCrypt(XML.XML_RetornaValor('TE_INFO6', v_configs));
640 680  
  681 + {
641 682 Try
642 683 id_unid_organizacional_nivel1.ItemIndex := id_unid_organizacional_nivel1.Items.IndexOf(RetornaValorVetorUON1(var_id_unid_organizacional_nivel1));
643 684 id_unid_organizacional_nivel1Change(Nil); // Para filtrar os valores do combo2 de acordo com o valor selecionado no combo1
644 685 id_unid_organizacional_nivel2.ItemIndex := id_unid_organizacional_nivel2.Items.IndexOf(RetornaValorVetorUON2(var_id_unid_organizacional_nivel1, var_id_unid_organizacional_nivel2));
645 686 Except
646 687 end;
  688 + }
  689 + Try
  690 + id_unid_organizacional_nivel1.ItemIndex := id_unid_organizacional_nivel1.Items.IndexOf(RetornaValorVetorUON1(var_id_unid_organizacional_nivel1));
  691 + id_unid_organizacional_nivel1Change(Nil); // Para filtrar os valores do combo2 de acordo com o valor selecionado no combo1
  692 +
  693 + Except
  694 + end;
  695 +
  696 + Try
  697 + id_unid_organizacional_nivel1a.ItemIndex := id_unid_organizacional_nivel1a.Items.IndexOf(RetornaValorVetorUON1a(var_id_unid_organizacional_nivel1a));
  698 + id_unid_organizacional_nivel1aChange(Nil); // Para filtrar os valores do combo3 de acordo com o valor selecionado no combo2
  699 + Except
  700 + End;
  701 +
  702 + Try
  703 + id_unid_organizacional_nivel2.ItemIndex := id_unid_organizacional_nivel2.Items.IndexOf(RetornaValorVetorUON2(var_id_unid_organizacional_nivel2,var_id_Local));
  704 + Except
  705 + end;
  706 +
647 707  
648 708 te_localizacao_complementar.Text := var_te_localizacao_complementar;
649 709 te_info_patrimonio1.Text := var_te_info_patrimonio1;
... ... @@ -660,7 +720,12 @@ procedure TFormPatrimonio.MontaCombos;
660 720 var Parser : TXmlParser;
661 721 i : integer;
662 722 v_Tag : boolean;
  723 + strAux,
  724 + strAux1,
  725 + strTagName,
  726 + strItemName : string;
663 727 begin
  728 +{
664 729 Parser := TXmlParser.Create;
665 730 Parser.Normalize := True;
666 731 Parser.LoadFromBuffer(PAnsiChar(v_configs));
... ... @@ -703,13 +768,147 @@ begin
703 768 id_unid_organizacional_nivel1.Items.Clear;
704 769 For i := 0 to Length(VetorUON1) - 1 Do
705 770 id_unid_organizacional_nivel1.Items.Add(VetorUON1[i].nm1);
  771 + }
  772 +
  773 +
  774 + Parser := TXmlParser.Create;
  775 + Parser.Normalize := True;
  776 + Parser.LoadFromBuffer(PAnsiChar(v_Configs));
  777 + log_DEBUG('v_Configs: '+v_Configs);
  778 + Parser.StartScan;
  779 + i := -1;
  780 + strItemName := '';
  781 + strTagName := '';
  782 + While Parser.Scan DO
  783 + Begin
  784 + strItemName := UpperCase(Parser.CurName);
  785 + if (Parser.CurPartType = ptStartTag) and (strItemName = 'IT1') Then
  786 + Begin
  787 + i := i + 1;
  788 + SetLength(VetorUON1, i + 1); // Aumento o tamanho da matriz dinamicamente de acordo com o número de itens recebidos.
  789 + strTagName := 'IT1';
  790 + end
  791 + else if (Parser.CurPartType = ptEndTag) and (strItemName = 'IT1') then
  792 + strTagName := ''
  793 + else if (Parser.CurPartType in [ptContent, ptCData]) and (strTagName='IT1')Then
  794 + Begin
  795 + strAux1 := DeCrypt(Parser.CurContent);
  796 + if (strItemName = 'ID1') then
  797 + Begin
  798 + VetorUON1[i].id1 := strAux1;
  799 + log_DEBUG('Gravei VetorUON1.id1: "'+strAux1+'"');
  800 + End
  801 + else if (strItemName = 'NM1') then
  802 + Begin
  803 + VetorUON1[i].nm1 := strAux1;
  804 + log_DEBUG('Gravei VetorUON1.nm1: "'+strAux1+'"');
  805 + End;
  806 + End;
  807 + End;
  808 +
  809 + // Código para montar o combo 2
  810 + Parser.StartScan;
  811 + strTagName := '';
  812 + strAux1 := '';
  813 + i := -1;
  814 + While Parser.Scan DO
  815 + Begin
  816 + strItemName := UpperCase(Parser.CurName);
  817 + if (Parser.CurPartType = ptStartTag) and (strItemName = 'IT1A') Then
  818 + Begin
  819 + i := i + 1;
  820 + SetLength(VetorUON1a, i + 1); // Aumento o tamanho da matriz dinamicamente de acordo com o número de itens recebidos.
  821 + strTagName := 'IT1A';
  822 + end
  823 + else if (Parser.CurPartType = ptEndTag) and (strItemName = 'IT1A') then
  824 + strTagName := ''
  825 + else if (Parser.CurPartType in [ptContent, ptCData]) and (strTagName='IT1A')Then
  826 + Begin
  827 + strAux1 := DeCrypt(Parser.CurContent);
  828 + if (strItemName = 'ID1') then
  829 + Begin
  830 + VetorUON1a[i].id1 := strAux1;
  831 + log_DEBUG('Gravei VetorUON1a.id1: "'+strAux1+'"');
  832 + End
  833 + else if (strItemName = 'SG_LOC') then
  834 + Begin
  835 + strAux := ' ('+strAux1 + ')';
  836 + End
  837 + else if (strItemName = 'ID1A') then
  838 + Begin
  839 + VetorUON1a[i].id1a := strAux1;
  840 + log_DEBUG('Gravei VetorUON1a.id1a: "'+strAux1+'"');
  841 + End
  842 + else if (strItemName = 'NM1A') then
  843 + Begin
  844 + VetorUON1a[i].nm1a := strAux1+strAux;
  845 + log_DEBUG('Gravei VetorUON1a.nm1a: "'+strAux1+strAux+'"');
  846 + End
  847 + else if (strItemName = 'ID_LOCAL') then
  848 + Begin
  849 + VetorUON1a[i].id_local := strAux1;
  850 + log_DEBUG('Gravei VetorUON1a.id_local: "'+strAux1+'"');
  851 + End;
  852 +
  853 + End;
  854 + end;
  855 +
  856 + // Código para montar o combo 3
  857 + Parser.StartScan;
  858 + strTagName := '';
  859 + i := -1;
  860 + While Parser.Scan DO
  861 + Begin
  862 + strItemName := UpperCase(Parser.CurName);
  863 + if (Parser.CurPartType = ptStartTag) and (strItemName = 'IT2') Then
  864 + Begin
  865 + i := i + 1;
  866 + SetLength(VetorUON2, i + 1); // Aumento o tamanho da matriz dinamicamente de acordo com o número de itens recebidos.
  867 + strTagName := 'IT2';
  868 + end
  869 + else if (Parser.CurPartType = ptEndTag) and (strItemName = 'IT2') then
  870 + strTagName := ''
  871 + else if (Parser.CurPartType in [ptContent, ptCData]) and (strTagName='IT2')Then
  872 + Begin
  873 + strAux1 := DeCrypt(Parser.CurContent);
  874 + if (strItemName = 'ID1A') then
  875 + Begin
  876 + VetorUON2[i].id1a := strAux1;
  877 + log_DEBUG('Gravei VetorUON2.id1a: "'+strAux1+'"');
  878 + End
  879 + else if (strItemName = 'ID2') then
  880 + Begin
  881 + VetorUON2[i].id2 := strAux1;
  882 + log_DEBUG('Gravei VetorUON2.id2: "'+strAux1+'"');
  883 + End
  884 + else if (strItemName = 'NM2') then
  885 + Begin
  886 + VetorUON2[i].nm2 := strAux1;
  887 + log_DEBUG('Gravei VetorUON2.nm2: "'+strAux1+'"');
  888 + End
  889 + else if (strItemName = 'ID_LOCAL') then
  890 + Begin
  891 + VetorUON2[i].id_local := strAux1;
  892 + log_DEBUG('Gravei VetorUON2.id_local: "'+strAux1+'"');
  893 + End;
  894 +
  895 + End;
  896 + end;
  897 + Parser.Free;
  898 + // Como os itens do combo1 nunca mudam durante a execução do programa (ao contrario dos combo2 e 3), posso colocar o seu preenchimento aqui mesmo.
  899 + id_unid_organizacional_nivel1.Items.Clear;
  900 + For i := 0 to Length(VetorUON1) - 1 Do
  901 + id_unid_organizacional_nivel1.Items.Add(VetorUON1[i].nm1);
  902 +
706 903 end;
707 904  
708 905  
709 906 procedure TFormPatrimonio.id_unid_organizacional_nivel1Change(Sender: TObject);
710 907 var i, j: Word;
711   - strAux : String;
  908 + strAux,
  909 + strIdUON1 : String;
712 910 begin
  911 + {
713 912 // Filtro os itens do combo2, de acordo com o item selecionado no combo1
714 913 strAux := VetorUON1[id_unid_organizacional_nivel1.ItemIndex].id1;
715 914  
... ... @@ -725,23 +924,106 @@ begin
725 924 VetorUON2Filtrado[j] := VetorUON2[i].id2;
726 925 end;
727 926 end;
728   -end;
  927 + }
  928 + // Filtro os itens do combo2, de acordo com o item selecionado no combo1
  929 + strIdUON1 := VetorUON1[id_unid_organizacional_nivel1.ItemIndex].id1;
  930 + id_unid_organizacional_nivel1a.Items.Clear;
  931 + id_unid_organizacional_nivel2.Items.Clear;
  932 + id_unid_organizacional_nivel1a.Enabled := false;
  933 + id_unid_organizacional_nivel2.Enabled := false;
  934 + SetLength(VetorUON1aFiltrado, 0);
  935 +
  936 + For i := 0 to Length(VetorUON1a) - 1 Do
  937 + Begin
  938 + Try
  939 + if VetorUON1a[i].id1 = strIdUON1 then
  940 + Begin
  941 + id_unid_organizacional_nivel1a.Items.Add(VetorUON1a[i].nm1a);
  942 + j := Length(VetorUON1aFiltrado);
  943 + SetLength(VetorUON1aFiltrado, j + 1);
  944 + VetorUON1aFiltrado[j] := VetorUON1a[i].id1a;
  945 + end;
  946 + Except
  947 + End;
  948 + end;
  949 + if (id_unid_organizacional_nivel1a.Items.Count > 0) then
  950 + Begin
  951 + id_unid_organizacional_nivel1a.Enabled := true;
  952 + id_unid_organizacional_nivel1a.ItemIndex := 0;
  953 + id_unid_organizacional_nivel1aChange(nil);
  954 + End;
729 955  
  956 +end;
  957 +procedure TFormPatrimonio.id_unid_organizacional_nivel1aChange(
  958 + Sender: TObject);
  959 +var i, j: Word;
  960 + strIdUON1a,
  961 + strIdLocal : String;
  962 + intAux : integer;
  963 +begin
  964 + // Filtro os itens do combo2, de acordo com o item selecionado no combo1
  965 + intAux := IfThen(id_unid_organizacional_nivel1a.Items.Count > 1,id_unid_organizacional_nivel1a.ItemIndex+1,0);
  966 + strIdUON1a := VetorUON1a[intAux].id1a;
  967 + strIdLocal := VetorUON1a[intAux].id_local;
  968 + id_unid_organizacional_nivel2.Items.Clear;
  969 + id_unid_organizacional_nivel2.Enabled := false;
  970 + SetLength(VetorUON2Filtrado, 0);
  971 +
  972 + For i := 0 to Length(VetorUON2) - 1 Do
  973 + Begin
  974 + Try
  975 + if (VetorUON2[i].id1a = strIdUON1a) and
  976 + (VetorUON2[i].id_local = strIdLocal) then
  977 + Begin
  978 + id_unid_organizacional_nivel2.Items.Add(VetorUON2[i].nm2);
  979 + j := Length(VetorUON2Filtrado);
  980 + SetLength(VetorUON2Filtrado, j + 1);
  981 + VetorUON2Filtrado[j] := VetorUON2[i].id2 + '#' + VetorUON2[i].id_local;
  982 + end;
  983 + Except
  984 + End;
  985 + end;
  986 + if (id_unid_organizacional_nivel2.Items.Count > 0) then
  987 + Begin
  988 + id_unid_organizacional_nivel2.Enabled := true;
  989 + id_unid_organizacional_nivel2.ItemIndex := 0;
  990 + End;
  991 +end;
730 992  
731 993 procedure TFormPatrimonio.AtualizaPatrimonio(Sender: TObject);
732   -var strAux1, strAux2 : String;
  994 +var strIdUON1,
  995 + strIdUON1a,
  996 + strIdUON2,
  997 + strIdLocal,
  998 + strRetorno : String;
  999 + tstrAux : TStrings;
733 1000 begin
734 1001  
735 1002 //Verifico se houve qualquer alteração nas informações.
736 1003 // Só vou enviar as novas informações para o bd ou gravar no registro se houve alterações.
  1004 + {
737 1005 Try
738 1006 strAux1 := VetorUON1[id_unid_organizacional_nivel1.ItemIndex].id1;
739 1007 strAux2 := VetorUON2Filtrado[id_unid_organizacional_nivel2.ItemIndex];
740 1008 Except
741 1009 end;
  1010 + }
  1011 +
  1012 + tstrAux := TStrings.Create;
  1013 + tstrAux := explode(VetorUON2Filtrado[id_unid_organizacional_nivel2.ItemIndex],'#');
  1014 + Try
  1015 + strIdUON1 := VetorUON1[id_unid_organizacional_nivel1.ItemIndex].id1;
  1016 + strIdUON1a := VetorUON1aFiltrado[id_unid_organizacional_nivel1a.ItemIndex];
  1017 + strIdUON2 := tstrAux[0];
  1018 + strIdLocal := tstrAux[1];
  1019 + Except
  1020 + end;
  1021 + tstrAux.Free;
  1022 +
742 1023 SetValorDatMemoria('Col_Patr.Fim', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
743   - if (strAux1 <> var_id_unid_organizacional_nivel1) or
744   - (strAux2 <> var_id_unid_organizacional_nivel2) or
  1024 + if (strIdUON1 <> var_id_unid_organizacional_nivel1) or
  1025 + (strIdUON1a <> var_id_unid_organizacional_nivel1a) or
  1026 + (strIdUON2 <> var_id_unid_organizacional_nivel2) or
745 1027 (te_localizacao_complementar.Text <> var_te_localizacao_complementar) or
746 1028 (te_info_patrimonio1.Text <> var_te_info_patrimonio1) or
747 1029 (te_info_patrimonio2.Text <> var_te_info_patrimonio2) or
... ... @@ -751,17 +1033,18 @@ begin
751 1033 (te_info_patrimonio6.Text <> var_te_info_patrimonio6) then
752 1034 begin
753 1035 //Envio via rede para ao Agente Gerente, para gravação no BD.
754   - SetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel1', strAux1, v_tstrCipherOpened1);
755   - SetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel2', strAux2, v_tstrCipherOpened1);
756   - SetValorDatMemoria('Col_Patr.te_localizacao_complementar' , te_localizacao_complementar.Text, v_tstrCipherOpened1);
757   - SetValorDatMemoria('Col_Patr.te_info_patrimonio1' , te_info_patrimonio1.Text, v_tstrCipherOpened1);
  1036 + SetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel1' , strIdUON1, v_tstrCipherOpened1);
  1037 + SetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel1a', strIdUON1a, v_tstrCipherOpened1);
  1038 + SetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel2' , strIdUON2, v_tstrCipherOpened1);
  1039 + SetValorDatMemoria('Col_Patr.te_localizacao_complementar' , te_localizacao_complementar.Text, v_tstrCipherOpened1);
  1040 + SetValorDatMemoria('Col_Patr.te_info_patrimonio1' , te_info_patrimonio1.Text, v_tstrCipherOpened1);
758 1041 SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio1', te_info_patrimonio1.Text);
759   - SetValorDatMemoria('Col_Patr.te_info_patrimonio2' , te_info_patrimonio2.Text, v_tstrCipherOpened1);
760   - SetValorDatMemoria('Col_Patr.te_info_patrimonio3' , te_info_patrimonio3.Text, v_tstrCipherOpened1);
761   - SetValorDatMemoria('Col_Patr.te_info_patrimonio4' , te_info_patrimonio4.Text, v_tstrCipherOpened1);
  1042 + SetValorDatMemoria('Col_Patr.te_info_patrimonio2' , te_info_patrimonio2.Text, v_tstrCipherOpened1);
  1043 + SetValorDatMemoria('Col_Patr.te_info_patrimonio3' , te_info_patrimonio3.Text, v_tstrCipherOpened1);
  1044 + SetValorDatMemoria('Col_Patr.te_info_patrimonio4' , te_info_patrimonio4.Text, v_tstrCipherOpened1);
762 1045 SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio4', te_info_patrimonio4.Text);
763   - SetValorDatMemoria('Col_Patr.te_info_patrimonio5' , te_info_patrimonio5.Text, v_tstrCipherOpened1);
764   - SetValorDatMemoria('Col_Patr.te_info_patrimonio6' , te_info_patrimonio6.Text, v_tstrCipherOpened1);
  1046 + SetValorDatMemoria('Col_Patr.te_info_patrimonio5' , te_info_patrimonio5.Text, v_tstrCipherOpened1);
  1047 + SetValorDatMemoria('Col_Patr.te_info_patrimonio6' , te_info_patrimonio6.Text, v_tstrCipherOpened1);
765 1048 CipherClose(p_path_cacic + 'temp\col_patr.dat', v_tstrCipherOpened1);
766 1049 end
767 1050 else
... ... @@ -780,6 +1063,9 @@ Begin
780 1063 Etiqueta1.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta1', v_configs));
781 1064 id_unid_organizacional_nivel1.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta1', v_configs));
782 1065  
  1066 + Etiqueta1a.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta1a', v_configs));
  1067 + id_unid_organizacional_nivel1a.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta1a', v_configs));
  1068 +
783 1069 Etiqueta2.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta2', v_configs));
784 1070 id_unid_organizacional_nivel2.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta2', v_configs));
785 1071  
... ... @@ -926,8 +1212,10 @@ var boolColeta : boolean;
926 1212 i,intAux : integer;
927 1213 v_Aux : String;
928 1214 Begin
  1215 +
929 1216 if (ParamCount>0) then
930 1217 Begin
  1218 + FormPatrimonio.lbVersao.Caption := 'Versão: ' + GetVersionInfo(ParamStr(0));
931 1219 For intAux := 1 to ParamCount do
932 1220 Begin
933 1221 if LowerCase(Copy(ParamStr(intAux),1,13)) = '/p_cipherkey=' then
... ... @@ -1018,4 +1306,6 @@ Begin
1018 1306 End;
1019 1307 end;
1020 1308  
  1309 +
  1310 +
1021 1311 end.
... ...
col_undi/col_undi.dof
... ... @@ -115,7 +115,7 @@ AutoIncBuild=0
115 115 MajorVer=2
116 116 MinorVer=2
117 117 Release=0
118   -Build=1
  118 +Build=2
119 119 Debug=0
120 120 PreRelease=0
121 121 Special=0
... ... @@ -126,13 +126,13 @@ CodePage=1252
126 126 [Version Info Keys]
127 127 CompanyName=Dataprev-Unidade Regional Espírito Santo
128 128 FileDescription=Coletor de Informações de Unidades de Disco do Sistema CACIC
129   -FileVersion=2.2.0.1
  129 +FileVersion=2.2.0.2
130 130 InternalName=
131 131 LegalCopyright=
132 132 LegalTrademarks=
133 133 OriginalFilename=
134 134 ProductName=Col_UNDI
135   -ProductVersion=2.2.0.1
  135 +ProductVersion=2.2.0.2
136 136 Comments=Baseado na licença GPL (General Public License)
137 137 [HistoryLists\hlDebugSourcePath]
138 138 Count=1
... ...
col_undi/col_undi.dpr
... ... @@ -487,7 +487,7 @@ end;
487 487  
488 488  
489 489 procedure Executa_Col_undi;
490   -var strXML, strAux, id_tipo_unid_disco, ValorChaveRegistro : String;
  490 +var strTripaDados, strAux, id_tipo_unid_disco, ValorChaveRegistro : String;
491 491 I: Integer;
492 492 v_DISK : TMiTeC_Disk;
493 493 v_Report : TstringList;
... ... @@ -495,7 +495,8 @@ Begin
495 495 SetValorDatMemoria('Col_Undi.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
496 496 log_diario('Coletando informações de Unidades de Disco.');
497 497 Try
498   - strXML := '<?xml version="1.0" encoding="ISO-8859-1"?><unidades>';
  498 + //strXML := '<?xml version="1.0" encoding="ISO-8859-1"?><unidades>';
  499 + strTripaDados := '';
499 500 v_DISK := TMiTeC_Disk.Create(nil);
500 501  
501 502 with v_DISK do
... ... @@ -511,17 +512,30 @@ Begin
511 512 if (UpperCase(id_tipo_unid_disco) = 'FIXED') then
512 513 Begin
513 514 id_tipo_unid_disco := '2';
514   - strXML := strXML + '<unidade>' +
515   - '<te_letra>' + Drive + '</te_letra>';
516   - if ((id_tipo_unid_disco = '2') or (id_tipo_unid_disco = '4')) then strXML := strXML +
517   - '<cs_sist_arq>' + FileSystem + '</cs_sist_arq>' +
518   - '<nu_serial>' + SerialNumber + '</nu_serial>' +
519   - '<nu_capacidade>' + IntToStr(Capacity div 10485760) + '0</nu_capacidade>' + // Em MB - Coleta apenas de 10 em 10 MB
520   - '<nu_espaco_livre>' + IntToStr(FreeSpace div 10485760 ) + '0</nu_espaco_livre>'; // Em MB - Coleta apenas de 10 em 10 MB
521   - if (id_tipo_unid_disco = '4') then strXML := strXML +
522   - '<te_unc>' + ExpandUNCFilename(Drive) + '</te_unc>';
523   - strXML := strXML + '<id_tipo_unid_disco>' + id_tipo_unid_disco + '</id_tipo_unid_disco>' +
524   - '</unidade>';
  515 + if (strTripaDados <> '') then
  516 + strTripaDados := strTripaDados + '<REG>'; // Delimitador de REGISTRO
  517 +
  518 + //strXML := strXML + '<unidade>' +
  519 + // '<te_letra>' + Drive + '</te_letra>';
  520 + strTripaDados := strTripaDados + Drive + '<FIELD>';
  521 +
  522 + strTripaDados := strTripaDados + id_tipo_unid_disco + '<FIELD>';
  523 +
  524 + if ((id_tipo_unid_disco = '2') or (id_tipo_unid_disco = '4')) then
  525 + strTripaDados := strTripaDados + FileSystem + '<FIELD>' +
  526 + SerialNumber + '<FIELD>' +
  527 + IntToStr(Capacity div 10485760) + '0' + '<FIELD>' + // Em MB - Coleta apenas de 10 em 10 MB
  528 + IntToStr(FreeSpace div 10485760) + '0' + '<FIELD>' // Em MB - Coleta apenas de 10 em 10 MB
  529 + else
  530 + strTripaDados := strTripaDados + '' + '<FIELD>' +
  531 + '' + '<FIELD>' +
  532 + '' + '<FIELD>' + // Em MB - Coleta apenas de 10 em 10 MB
  533 + '' + '<FIELD>'; // Em MB - Coleta apenas de 10 em 10 MB
  534 + if (id_tipo_unid_disco = '4') then
  535 + strTripaDados := strTripaDados + ExpandUNCFilename(Drive)
  536 + else
  537 + strTripaDados := strTripaDados + '';
  538 +
525 539 end;
526 540 end;
527 541  
... ... @@ -536,7 +550,7 @@ Begin
536 550 End;
537 551  
538 552 v_DISK.Free;
539   - strXML := strXML + '</unidades>';
  553 + //strXML := strXML + '</unidades>';
540 554  
541 555 // Obtenho do registro o valor que foi previamente armazenado
542 556 ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.UnidadesDisco',v_tstrCipherOpened));
... ... @@ -546,9 +560,10 @@ Begin
546 560 // Se essas informações forem diferentes significa que houve alguma alteração
547 561 // na configuração. Nesse caso, gravo as informações no BD Central e, se não houver
548 562 // problemas durante esse procedimento, atualizo as informações no registro.
549   - If (GetValorDatMemoria('Configs.IN_COLETA_FORCADA_UNDI',v_tstrCipherOpened)='S') or (strXML <> ValorChaveRegistro) Then
  563 + If ((GetValorDatMemoria('Configs.IN_COLETA_FORCADA_UNDI',v_tstrCipherOpened)='S') or (strTripaDados <> ValorChaveRegistro)) and
  564 + (strTripaDados <> '') Then
550 565 Begin
551   - SetValorDatMemoria('Col_Undi.UVC', strXML, v_tstrCipherOpened1);
  566 + SetValorDatMemoria('Col_Undi.UVC', strTripaDados, v_tstrCipherOpened1);
552 567 CipherClose(p_path_cacic + 'temp\col_undi.dat', v_tstrCipherOpened1);
553 568 end
554 569 else
... ...
col_undi/col_undi.res
No preview for this file type
ger_cols/ger_cols.cfg
... ... @@ -33,10 +33,3 @@
33 33 -K$00400000
34 34 -LE"c:\arquivos de programas\borland\delphi7\Projects\Bpl"
35 35 -LN"c:\arquivos de programas\borland\delphi7\Projects\Bpl"
36   --U"C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibex"
37   --O"C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibex"
38   --I"C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibex"
39   --R"C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibex"
40   --w-UNSAFE_TYPE
41   --w-UNSAFE_CODE
42   --w-UNSAFE_CAST
... ...
ger_cols/ger_cols.dof
... ... @@ -76,9 +76,9 @@ LocaleToUnicode=1
76 76 ImagebaseMultiple=1
77 77 SuspiciousTypecast=1
78 78 PrivatePropAccessor=1
79   -UnsafeType=0
80   -UnsafeCode=0
81   -UnsafeCast=0
  79 +UnsafeType=1
  80 +UnsafeCode=1
  81 +UnsafeCast=1
82 82 [Linker]
83 83 MapFile=0
84 84 OutputObjs=0
... ... @@ -94,10 +94,10 @@ OutputDir=
94 94 UnitOutputDir=
95 95 PackageDLLOutputDir=
96 96 PackageDCPOutputDir=
97   -SearchPath=C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibex
98   -Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOffice2k
  97 +SearchPath=
  98 +Packages=
99 99 Conditionals=
100   -DebugSourceDirs=C:\Arquivos de programas\Borland\Delphi7\
  100 +DebugSourceDirs=
101 101 UsePackages=0
102 102 [Parameters]
103 103 RunParams=
... ... @@ -108,14 +108,14 @@ DebugCWD=
108 108 [Language]
109 109 ActiveLang=
110 110 ProjectLang=
111   -RootDir=C:\Arquivos de programas\Borland\Delphi7\Bin\
  111 +RootDir=
112 112 [Version Info]
113 113 IncludeVerInfo=1
114 114 AutoIncBuild=0
115   -MajorVer=2
116   -MinorVer=2
  115 +MajorVer=1
  116 +MinorVer=0
117 117 Release=0
118   -Build=27
  118 +Build=0
119 119 Debug=0
120 120 PreRelease=0
121 121 Special=0
... ... @@ -123,33 +123,3 @@ Private=0
123 123 DLL=0
124 124 Locale=1046
125 125 CodePage=1252
126   -[Version Info Keys]
127   -CompanyName=Dataprev-Unidade Regional Espírito Santo
128   -FileDescription=Módulo Gerente de Coletas do Sistema CACIC
129   -FileVersion=2.2.0.27
130   -InternalName=
131   -LegalCopyright=
132   -LegalTrademarks=
133   -OriginalFilename=
134   -ProductName=Ger_COLS
135   -ProductVersion=2.2.0.27
136   -Comments=Baseado na licença GPL (General Public License)
137   -[HistoryLists\hlDebugSourcePath]
138   -Count=2
139   -Item0=C:\Arquivos de programas\Borland\Delphi7\
140   -Item1=C:\Arquivos de programas\Borland\Delphi7\Mitec\v910_Delphi7
141   -[HistoryLists\hlUnitAliases]
142   -Count=1
143   -Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
144   -[HistoryLists\hlSearchPath]
145   -Count=10
146   -Item0=C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibex
147   -Item1=C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\ZLibex;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\TpAbbrevia
148   -Item2=C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\Mitec\v1010_Delphi7;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\NTFileSecurity;C:\Arquivos de programas\Borland\Delphi7\Comps_CACIC\PJVersion
149   -Item3=C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Hashes;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Ciphers;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Mitec\v1010_Delphi7
150   -Item4=C:\Arquivos de programas\Borland\Delphi7\Mitec\9.60;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Hashes;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Ciphers;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP;C:\Arquivos de programas\Borland\Delphi7\Mitec\v1010_Delphi7
151   -Item5=C:\Arquivos de programas\Borland\Delphi7\Mitec\9.60;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Hashes;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Ciphers;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP
152   -Item6=C:\Arquivos de programas\Borland\Delphi7\Mitec\9.60;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Hashes;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Ciphers
153   -Item7=C:\Arquivos de programas\Borland\Delphi7\Mitec\9.60;C:\Arquivos de programas\Borland\Delphi7\CriptografiaDCP\Hashes
154   -Item8=C:\Arquivos de programas\Borland\Delphi7\Mitec\9.60
155   -Item9=C:\Arquivos de programas\Borland\Delphi7\Mitec\v910_Delphi7
... ...
ger_cols/ger_cols.dpr
1   -(**
  1 +(*
2 2 ---------------------------------------------------------------------------------------------------------------------------------------------------------------
3 3 Copyright 2000, 2001, 2002, 2003, 2004, 2005 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil
4 4  
... ... @@ -20,7 +20,7 @@ NOTA: O componente MiTeC System Information Component (MSIC) é baseado na classe
20 20  
21 21 program ger_cols;
22 22 {$R *.res}
23   -{$APPTYPE CONSOLE}
  23 +
24 24 uses
25 25 ShellApi,
26 26 Windows,
... ... @@ -47,7 +47,7 @@ uses
47 47 DCPrijndael,
48 48 DCPbase64,
49 49 ZLibEx;
50   -
  50 +{$APPTYPE CONSOLE}
51 51 var p_path_cacic,
52 52 v_scripter,
53 53 p_Shell_Command,
... ... @@ -72,8 +72,6 @@ var CountUPD,
72 72 intMontaBatch,
73 73 intLoop : integer;
74 74  
75   -
76   -
77 75 var tstrTripa1,
78 76 v_tstrCipherOpened,
79 77 v_tstrCipherOpened1,
... ... @@ -93,6 +91,7 @@ var BatchFile,
93 91 const KeySize = 32; // 32 bytes = 256 bits
94 92 BlockSize = 16; // 16 bytes = 128 bits
95 93  
  94 +
96 95 // Pad a string with zeros so that it is a multiple of size
97 96 function PadWithZeros(const str : string; size : integer) : string;
98 97 var
... ... @@ -273,6 +272,25 @@ Begin
273 272 Explode := ListaAuxUTILS;
274 273 end;
275 274  
  275 +function StringtoHex(Data: string): string;
  276 +var
  277 + i, i2: Integer;
  278 + s: string;
  279 +begin
  280 + i2 := 1;
  281 + for i := 1 to Length(Data) do
  282 + begin
  283 + Inc(i2);
  284 + if i2 = 2 then
  285 + begin
  286 + s := s + ' ';
  287 + i2 := 1;
  288 + end;
  289 + s := s + IntToHex(Ord(Data[i]), 2);
  290 + end;
  291 + Result := s;
  292 +end;
  293 +
276 294 Function Implode(p_Array : TStrings ; p_Separador : String) : String;
277 295 var intAux : integer;
278 296 Begin
... ... @@ -319,7 +337,10 @@ end;
319 337 function EnCrypt(p_Data : String; p_Compress : Boolean) : String;
320 338 var
321 339 l_Cipher : TDCP_rijndael;
322   - l_Data, l_Key, l_IV : String;
  340 + l_Data,
  341 + l_Key,
  342 + l_IV,
  343 + strAux : String;
323 344 begin
324 345 Try
325 346 if l_cs_cipher then
... ... @@ -329,6 +350,10 @@ begin
329 350 l_IV := PadWithZeros(v_IV,BlockSize);
330 351 l_Data := PadWithZeros(trim(p_Data),BlockSize);
331 352  
  353 + //log_DEBUG('Encrypt - HEXA da CHAVE "'+v_CipherKey+'": "'+StringtoHex(l_Key)+'"');
  354 + //log_DEBUG('Encrypt - HEXA do IV "'+v_IV+'": "'+StringtoHex(l_IV)+'"');
  355 + //log_DEBUG('Encrypt - HEXA do DADO "'+trim(p_Data)+'": "'+StringtoHex(l_Data)+'"');
  356 +
332 357 // Create the cipher and initialise according to the key length
333 358 l_Cipher := TDCP_rijndael.Create(nil);
334 359 if Length(v_CipherKey) <= 16 then
... ... @@ -346,6 +371,9 @@ begin
346 371 FillChar(l_Key[1],Length(l_Key),0);
347 372 log_DEBUG('Criptografia(ATIVADA) de "'+p_Data+'" => "'+l_Data+'"');
348 373 // Return the Base64 encoded result
  374 +
  375 + // Substituo os sinais de "+" por <MAIS> devido a problema com tráfego POST
  376 +
349 377 Result := trim(Base64EncodeStr(l_Data));
350 378 End
351 379 else
... ... @@ -379,6 +407,10 @@ begin
379 407 // Decode the Base64 encoded string
380 408 l_Data := Base64DecodeStr(trim(v_Data));
381 409  
  410 + //log_DEBUG('Decrypt - HEXA da CHAVE "'+v_CipherKey+'": "'+StringtoHex(l_Key)+'"');
  411 + //log_DEBUG('Decrypt - HEXA do IV "'+v_IV+'": "'+StringtoHex(l_IV)+'"');
  412 + //log_DEBUG('Decrypt - HEXA do DADO "'+trim(p_Data)+'": "'+StringtoHex(l_Data)+'"');
  413 +
382 414 // Create the cipher and initialise according to the key length
383 415 l_Cipher := TDCP_rijndael.Create(nil);
384 416 if Length(v_CipherKey) <= 16 then
... ... @@ -482,7 +514,8 @@ begin
482 514 v_te_so := IntToStr(platformId) + '.' +
483 515 IntToStr(majorVer) + '.' +
484 516 IntToStr(minorVer) +
485   - IfThen(CSDVersion='','','.'+CSDVersion);
  517 + ifThen(CSDVersion='','','.'+CSDVersion);
  518 +
486 519 if (Result = 0) then
487 520 Result := abstraiCSD(v_te_so);
488 521 end;
... ... @@ -502,9 +535,10 @@ end;
502 535  
503 536 Function CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings) : String;
504 537 var v_strCipherOpenImploded,
505   - v_strCipherClosed : string;
506   - v_DatFile : TextFile;
507   - //intAux : integer;
  538 + v_strCipherClosed,
  539 + strAux : string;
  540 + v_DatFile,
  541 + v_DatFileDebug : TextFile;
508 542 v_cs_cipher : boolean;
509 543 begin
510 544 try
... ... @@ -521,14 +555,33 @@ begin
521 555 Rewrite (v_DatFile);
522 556 Append(v_DatFile);
523 557  
  558 + if v_Debugs then
  559 + Begin
  560 + strAux := StringReplace(p_DatFileName,'.dat','_Debug.dat',[rfReplaceAll]);
  561 + AssignFile(v_DatFileDebug,strAux); {Associa o arquivo a uma variável do tipo TextFile}
  562 +
  563 + // Criação do arquivo .DAT para Debug
  564 + {$IOChecks off}
  565 + Rewrite (v_DatFileDebug);
  566 + {$IOChecks on}
  567 + Append(v_DatFileDebug);
  568 + End;
  569 +
524 570 v_strCipherOpenImploded := Implode(p_tstrCipherOpened,'=CacicIsFree=');
  571 +
525 572 v_cs_cipher := l_cs_cipher;
526 573 l_cs_cipher := true;
527 574 log_DEBUG('Rotina de Fechamento do cacic2.dat ATIVANDO criptografia.');
528 575 v_strCipherClosed := EnCrypt(v_strCipherOpenImploded, false);
  576 +
529 577 l_cs_cipher := v_cs_cipher;
530 578 log_DEBUG('Rotina de Fechamento do cacic2.dat RESTAURANDO estado da criptografia.');
531 579 Writeln(v_DatFile,v_strCipherClosed); {Grava a string Texto no arquivo texto}
  580 + if v_Debugs then
  581 + Begin
  582 + Writeln(v_DatFileDebug,StringReplace(v_strCipherOpenImploded,'=CacicIsFree=',#13#10,[rfReplaceAll]));
  583 + CloseFile(v_DatFileDebug);
  584 + End;
532 585 CloseFile(v_DatFile);
533 586 except
534 587 log_diario('ERRO NA GRAVAÇÃO DO ARQUIVO DE CONFIGURAÇÕES.');
... ... @@ -1140,12 +1193,23 @@ begin
1140 1193 Reg_Ini.Free;
1141 1194 end;
1142 1195  
  1196 +function GetIP: string;
  1197 +var ipwsa:TWSAData; p:PHostEnt; s:array[0..128] of char; c:pchar;
  1198 +begin
  1199 + wsastartup(257,ipwsa);
  1200 + GetHostName(@s, 128);
  1201 + p := GetHostByName(@s);
  1202 + c := iNet_ntoa(PInAddr(p^.h_addr_list^)^);
  1203 + Result := String(c);
  1204 +end;
  1205 +
1143 1206 Function ComunicaServidor(URL : String; Request : TStringList; MsgAcao: String) : String;
1144 1207 var Response_CS : TStringStream;
1145 1208 strEndereco,
1146 1209 v_Endereco_WS,
1147 1210 v_Aux,
1148   - v_Aux1 : String;
  1211 + v_Aux1,
  1212 + strAux : String;
1149 1213 idHTTP1 : TIdHTTP;
1150 1214 intAux : integer;
1151 1215 v_AuxRequest : TStringList;
... ... @@ -1157,7 +1221,27 @@ Begin
1157 1221 v_AuxRequest.Values['cs_cipher'] := GetValorDatMemoria('Configs.CS_CIPHER',v_tstrCipherOpened);
1158 1222  
1159 1223 // A partir da versão 2.0.2.18+ envio um Classificador indicativo de dados compactados...
1160   - v_AuxRequest.Values['cs_compress'] := GetValorDatMemoria('Configs.CS_COMPRESS',v_tstrCipherOpened);
  1224 + v_AuxRequest.Values['cs_compress'] := GetValorDatMemoria('Configs.CS_COMPRESS',v_tstrCipherOpened);
  1225 +
  1226 + intAux := GetWinVer;
  1227 + strAux := GetValorDatMemoria('TcpIp.TE_IP', v_tstrCipherOpened);
  1228 + if (strAux = '') then
  1229 + strAux := 'A.B.C.D'; // Apenas para forçar que o Gerente extraia via _SERVER[REMOTE_ADDR]
  1230 +
  1231 + // Tratamentos de valores para tráfego POST:
  1232 + // v_te_so => transformar ' ' em <ESPACE> Razão: o mmcrypt se perde quando encontra ' ' (espaço)
  1233 + v_te_so := StringReplace(v_te_so,' ','<ESPACE>',[rfReplaceAll]);
  1234 +
  1235 + v_AuxRequest.Values['te_node_address'] := StringReplace(EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1236 + v_AuxRequest.Values['id_so'] := StringReplace(EnCrypt(IntToStr(intAux) ,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1237 + v_AuxRequest.Values['te_so'] := StringReplace(EnCrypt(v_te_so ,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1238 + v_AuxRequest.Values['te_ip'] := StringReplace(EnCrypt(strAux ,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1239 + v_AuxRequest.Values['id_ip_rede'] := StringReplace(EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1240 + v_AuxRequest.Values['te_workgroup'] := StringReplace(EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' , v_tstrCipherOpened),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1241 + v_AuxRequest.Values['te_nome_computador']:= StringReplace(EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', v_tstrCipherOpened),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1242 + v_AuxRequest.Values['id_ip_estacao'] := StringReplace(EnCrypt(GetIP,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1243 + v_AuxRequest.Values['te_versao_cacic'] := StringReplace(EnCrypt(getVersionInfo(p_path_cacic + 'cacic2.exe'),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1244 + v_AuxRequest.Values['te_versao_gercols'] := StringReplace(EnCrypt(getVersionInfo(ParamStr(0)),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
1161 1245  
1162 1246 v_Endereco_WS := GetValorDatMemoria('Configs.Endereco_WS', v_tstrCipherOpened);
1163 1247 v_Endereco_Servidor := GetValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened);
... ... @@ -1186,37 +1270,39 @@ Begin
1186 1270 Try
1187 1271 idHTTP1 := TIdHTTP.Create(nil);
1188 1272 idHTTP1.AllowCookies := true;
1189   - idHTTP1.ASCIIFilter := false;
1190   - idHTTP1.AuthRetries := 1;
  1273 + idHTTP1.ASCIIFilter := false; // ATENÇÃO: Esta propriedade deixa de existir na próxima versão do Indy (10.x)
  1274 + idHTTP1.AuthRetries := 1; // ATENÇÃO: Esta propriedade deixa de existir na próxima versão do Indy (10.x)
1191 1275 idHTTP1.BoundPort := 0;
1192 1276 idHTTP1.HandleRedirects := false;
1193 1277 idHTTP1.ProxyParams.BasicAuthentication := false;
1194 1278 idHTTP1.ProxyParams.ProxyPort := 0;
1195 1279 idHTTP1.ReadTimeout := 0;
1196   - idHTTP1.RecvBufferSize := 32768;
1197 1280 idHTTP1.RedirectMaximum := 15;
1198   - idHTTP1.Request.UserAgent := EnCrypt('AGENTE_CACIC',l_cs_compress);
1199   - idHTTP1.Request.Username := EnCrypt('USER_CACIC',l_cs_compress);
1200   - idHTTP1.Request.Password := EnCrypt('PW_CACIC',l_cs_compress);
  1281 + idHTTP1.Request.UserAgent := StringReplace(EnCrypt('AGENTE_CACIC',l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1282 + idHTTP1.Request.Username := StringReplace(EnCrypt('USER_CACIC',l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1283 + idHTTP1.Request.Password := StringReplace(EnCrypt('PW_CACIC',l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
1201 1284 idHTTP1.Request.Accept := 'text/html, */*';
1202 1285 idHTTP1.Request.BasicAuthentication := true;
1203 1286 idHTTP1.Request.ContentLength := -1;
1204 1287 idHTTP1.Request.ContentRangeStart := 0;
1205 1288 idHTTP1.Request.ContentRangeEnd := 0;
1206 1289 idHTTP1.Request.ContentType := 'text/html';
1207   - idHTTP1.SendBufferSize := 32768;
  1290 + idHTTP1.RecvBufferSize := 32768; // ATENÇÃO: Esta propriedade deixa de existir na próxima versão do Indy (10.x)
  1291 + idHTTP1.SendBufferSize := 32768; // ATENÇÃO: Esta propriedade deixa de existir na próxima versão do Indy (10.x)
1208 1292 idHTTP1.Tag := 0;
1209 1293  
1210 1294 if v_Debugs then
1211 1295 Begin
  1296 + Log_Debug('te_so => '+v_te_so);
1212 1297 Log_Debug('Valores de REQUEST para envio ao Gerente WEB:');
1213 1298 for intAux := 0 to v_AuxRequest.count -1 do
1214 1299 Log_Debug('#'+inttostr(intAux)+': '+v_AuxRequest[intAux]);
1215 1300 End;
1216 1301  
1217 1302 IdHTTP1.Post(strEndereco, v_AuxRequest, Response_CS);
  1303 + idHTTP1.Disconnect;
1218 1304 idHTTP1.Free;
1219   -// log_DEBUG('Retorno: "'+StringReplace(Response_CS.DataString,' ','=CacicIsFree=',[rfReplaceAll])+'"');
  1305 +
1220 1306 log_DEBUG('Retorno: "'+Response_CS.DataString+'"');
1221 1307 Except
1222 1308 log_diario('ERRO! Comunicação impossível com o endereço ' + strEndereco + Response_CS.DataString);
... ... @@ -1257,13 +1343,6 @@ var strDt_ultima_renovacao_patrim,
1257 1343 Begin
1258 1344 // Solicita ao servidor as configurações para a Coleta de Informações de Patrimônio
1259 1345 Request_Ger_Cols:=TStringList.Create;
1260   - Request_Ger_Cols.Values['te_node_address'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , 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);
1263   - Request_Ger_Cols.Values['te_ip'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' , v_tstrCipherOpened),l_cs_compress);
1264   - Request_Ger_Cols.Values['id_ip_rede'] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress);
1265   - Request_Ger_Cols.Values['te_workgroup'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' , v_tstrCipherOpened),l_cs_compress);
1266   - Request_Ger_Cols.Values['te_nome_computador']:= EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', v_tstrCipherOpened),l_cs_compress);
1267 1346  
1268 1347 strRetorno := ComunicaServidor('get_patrimonio.php', Request_Ger_Cols, '.');
1269 1348 SetValorDatMemoria('Patrimonio.Configs', strRetorno, v_tstrCipherOpened);
... ... @@ -1385,12 +1464,16 @@ var v_te_senha_login_serv_updates : string;
1385 1464 IdFTP1 : TIdFTP;
1386 1465 begin
1387 1466 v_te_senha_login_serv_updates := GetValorDatMemoria('Configs.TE_SENHA_LOGIN_SERV_UPDATES', v_tstrCipherOpened);
  1467 + log_DEBUG('Instanciando FTP...');
1388 1468 IdFTP1 := TIdFTP.Create(IdFTP1);
  1469 +
  1470 + log_DEBUG('FTP Instanciado!');
1389 1471 IdFTP1.Host := GetValorDatMemoria('Configs.TE_SERV_UPDATES', v_tstrCipherOpened);
1390 1472 IdFTP1.Username := GetValorDatMemoria('Configs.NM_USUARIO_LOGIN_SERV_UPDATES', v_tstrCipherOpened);
1391 1473 IdFTP1.Password := v_te_senha_login_serv_updates;
1392 1474 IdFTP1.Port := strtoint(GetValorDatMemoria('Configs.NU_PORTA_SERV_UPDATES', v_tstrCipherOpened));
1393 1475 IdFTP1.TransferType := ftBinary;
  1476 + IdFTP1.Passive := true;
1394 1477  
1395 1478 log_DEBUG('Iniciando FTP de '+Arq +' para '+StringReplace(DirDestino + '\' + Arq,'\\','\',[rfReplaceAll]));
1396 1479 log_DEBUG('Host........ ='+IdFTP1.Host);
... ... @@ -1403,19 +1486,24 @@ begin
1403 1486 begin
1404 1487 IdFTP1.Disconnect;
1405 1488 end;
1406   - IdFTP1.Connect(true);
  1489 + //IdFTP1.Connect(True);
  1490 + IdFTP1.Connect;
1407 1491 IdFTP1.ChangeDir(GetValorDatMemoria('Configs.TE_PATH_SERV_UPDATES', v_tstrCipherOpened));
1408 1492 Try
1409 1493 // Substituo \\ por \ devido a algumas vezes em que o DirDestino assume o valor de DirTemp...
  1494 + log_DEBUG('FTP - Size de "'+Arq+'" Antes => '+IntToSTR(IdFTP1.Size(Arq)));
1410 1495 IdFTP1.Get(Arq, StringReplace(DirDestino + '\' + Arq,'\\','\',[rfReplaceAll]), True);
  1496 + log_DEBUG('FTP - Size de "'+DirDestino + '\' + Arq +'" Após => '+Get_File_Size(DirDestino + '\' + Arq,true));
  1497 + Finally
1411 1498 result := true;
1412   - Except
1413   - result := false;
  1499 + log_DEBUG('FTP - Size de "'+DirDestino + '\' + Arq +'" Após em Finally => '+Get_File_Size(DirDestino + '\' + Arq,true));
  1500 + idFTP1.Disconnect;
  1501 + IdFTP1.Free;
1414 1502 End;
1415 1503 Except
  1504 + log_DEBUG('FTP - Erro - Size de "'+DirDestino + '\' + Arq +'" Após em Finally => '+Get_File_Size(DirDestino + '\' + Arq,true));
1416 1505 result := false;
1417 1506 end;
1418   - IdFTP1.Free
1419 1507 end;
1420 1508  
1421 1509 procedure CriaTXT(p_Dir, p_File : string);
... ... @@ -1535,15 +1623,6 @@ begin
1535 1623 Result := WinPath
1536 1624 end;
1537 1625  
1538   -function GetIP: string;
1539   -var ipwsa:TWSAData; p:PHostEnt; s:array[0..128] of char; c:pchar;
1540   -begin
1541   - wsastartup(257,ipwsa);
1542   - GetHostName(@s, 128);
1543   - p := GetHostByName(@s);
1544   - c := iNet_ntoa(PInAddr(p^.h_addr_list^)^);
1545   - Result := String(c);
1546   -end;
1547 1626  
1548 1627 function GetNetworkUserName : String;
1549 1628 // Gets the name of the user currently logged into the network on
... ... @@ -1663,10 +1742,41 @@ begin
1663 1742 end;
1664 1743 end;
1665 1744  
  1745 +function ChecaAgente(agentFolder, agentName : String) : boolean;
  1746 +var strFraseVersao : String;
  1747 +Begin
  1748 + Result := true;
  1749 +
  1750 + log_DEBUG('Verificando existência e tamanho de "'+agentFolder+'\'+agentName+'"');
  1751 + v_Tamanho_Arquivo := Get_File_Size(agentFolder+'\'+agentName,true);
  1752 +
  1753 + log_DEBUG('Resultado: #'+v_Tamanho_Arquivo);
  1754 +
  1755 + if (v_Tamanho_Arquivo = '0') or (v_Tamanho_Arquivo = '-1') then
  1756 + Begin
  1757 + Result := false;
  1758 +
  1759 + Matar(agentFolder+'\',agentName);
  1760 +
  1761 + Ver_UPD(StringReplace(LowerCase(agentName),'.exe','',[rfReplaceAll]),agentName,agentFolder+'\','Temp',false);
  1762 +
  1763 + sleep(15000); // 15 segundos de espera para download do agente
  1764 + v_Tamanho_Arquivo := Get_File_Size(agentFolder+'\'+agentName,true);
  1765 + if not(v_Tamanho_Arquivo = '0') and not(v_Tamanho_Arquivo = '-1') then
  1766 + Begin
  1767 + log_diario('Agente "'+agentFolder+'\'+agentName+'" RECUPERADO COM SUCESSO!');
  1768 + Result := True;
  1769 + End
  1770 + else
  1771 + log_diario('Agente "'+agentFolder+'\'+agentName+'" NÃO RECUPERADO!');
  1772 + End;
  1773 +End;
  1774 +
1666 1775 procedure Patrimnio1Click(Sender: TObject);
1667 1776 begin
1668 1777 SetValorDatMemoria('Patrimonio.dt_ultima_renovacao_patrim','', v_tstrCipherOpened);
1669   - WinExec(PChar(p_path_cacic + 'modulos\ini_cols.exe /p_CipherKey='+v_CipherKey+ ' /p_ModulosOpcoes=col_patr,wait,user#'),SW_HIDE);
  1778 + if ChecaAgente(p_path_cacic + 'modulos', 'ini_cols.exe') then
  1779 + WinExec(PChar(p_path_cacic + 'modulos\ini_cols.exe /p_CipherKey='+v_CipherKey+ ' /p_ModulosOpcoes=col_patr,wait,user#'),SW_HIDE);
1670 1780 end;
1671 1781  
1672 1782 procedure ChecaCipher;
... ... @@ -1759,7 +1869,7 @@ Begin
1759 1869 Begin
1760 1870 v_acao_gercols := 'Gerando Report para TMiTeC_Network...';
1761 1871 //v_NETWORK.Report(v_Report,false);
1762   - MSI_XML_Reports.Network_XML_Report(v_NETWORK,true,v_Report);
  1872 + MSI_XML_Reports.Network_XML_Report(v_NETWORK,true,v_Report);
1763 1873  
1764 1874 for intAux1:=0 to v_Report.count-1 do
1765 1875 Begin
... ... @@ -1776,13 +1886,13 @@ Begin
1776 1886  
1777 1887 // Verifico comunicação com o Módulo Gerente WEB.
1778 1888 Request_SVG := TStringList.Create;
1779   - Request_SVG.Values['in_teste'] := EnCrypt('OK',l_cs_compress);
1780   - Request_SVG.Values['te_node_address'] := EnCrypt(v_mac_address,l_cs_compress);
1781   - Request_SVG.Values['id_so'] := EnCrypt(inttostr(GetWinVer),l_cs_compress);
1782   - Request_SVG.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
1783   - Request_SVG.Values['id_ip_rede'] := EnCrypt(GetIPRede(te_ip, te_mascara),l_cs_compress);
1784   - Request_SVG.Values['te_workgroup'] := EnCrypt(GetWorkgroup,l_cs_compress);
1785   - Request_SVG.Values['te_nome_computador']:= EnCrypt(te_nome_host,l_cs_compress);
  1889 + Request_SVG.Values['in_teste'] := StringReplace(EnCrypt('OK',l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  1890 + //Request_SVG.Values['te_node_address'] := EnCrypt(v_mac_address,l_cs_compress);
  1891 + //Request_SVG.Values['id_so'] := EnCrypt(inttostr(GetWinVer),l_cs_compress);
  1892 + //Request_SVG.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
  1893 + //Request_SVG.Values['id_ip_rede'] := EnCrypt(GetIPRede(te_ip, te_mascara),l_cs_compress);
  1894 + //Request_SVG.Values['te_workgroup'] := EnCrypt(GetWorkgroup,l_cs_compress);
  1895 + //Request_SVG.Values['te_nome_computador']:= EnCrypt(te_nome_host,l_cs_compress);
1786 1896  
1787 1897 v_acao_gercols := 'Preparando teste de comunicação com Módulo Gerente WEB.';
1788 1898  
... ... @@ -1798,7 +1908,7 @@ Begin
1798 1908 for intAux1 := 0 to intAux2 do
1799 1909 Begin
1800 1910 v_acao_gercols := 'Setando Request.te_ip com ' + v_tcpip.Adapter[v_index_ethernet].IPAddress[intAux1];
1801   -
  1911 + SetValorDatMemoria('TcpIp.TE_IP',v_tcpip.Adapter[v_index_ethernet].IPAddress[intAux1], v_tstrCipherOpened);
1802 1912 Try
1803 1913 strRetorno := ComunicaServidor('get_config.php', Request_SVG, 'Testando comunicação com o Módulo Gerente WEB.');
1804 1914 Seta_l_cs_cipher(strRetorno);
... ... @@ -1826,15 +1936,14 @@ Begin
1826 1936 // Nova tentativa, preciso reinicializar o objeto devido aos restos da operação anterior... (Eu acho!) :)
1827 1937 Request_SVG.Free;
1828 1938 Request_SVG := TStringList.Create;
1829   - Request_SVG.Values['te_node_address'] := EnCrypt(v_mac_address,l_cs_compress);
1830   - Request_SVG.Values['id_so'] := EnCrypt(inttostr(GetWinVer),l_cs_compress);
1831   - Request_SVG.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
1832   - Request_SVG.Values['id_ip_rede'] := EnCrypt(GetIPRede(te_ip, te_mascara),l_cs_compress);
1833   - Request_SVG.Values['te_workgroup'] := EnCrypt(GetWorkgroup,l_cs_compress);
1834   - Request_SVG.Values['te_nome_computador']:= EnCrypt(te_nome_host,l_cs_compress);
1835   - Request_SVG.Values['te_ip'] := EnCrypt(te_ip,l_cs_compress);
1836   - Request_SVG.Values['in_teste'] := EnCrypt('OK',l_cs_compress);
1837   -
  1939 + //Request_SVG.Values['te_node_address'] := EnCrypt(v_mac_address,l_cs_compress);
  1940 + //Request_SVG.Values['id_so'] := EnCrypt(inttostr(GetWinVer),l_cs_compress);
  1941 + //Request_SVG.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
  1942 + //Request_SVG.Values['id_ip_rede'] := EnCrypt(GetIPRede(te_ip, te_mascara),l_cs_compress);
  1943 + //Request_SVG.Values['te_workgroup'] := EnCrypt(GetWorkgroup,l_cs_compress);
  1944 + //Request_SVG.Values['te_nome_computador']:= EnCrypt(te_nome_host,l_cs_compress);
  1945 + //Request_SVG.Values['te_ip'] := EnCrypt(te_ip,l_cs_compress);
  1946 + Request_SVG.Values['in_teste'] := StringReplace(EnCrypt('OK',l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
1838 1947 Try
1839 1948 strRetorno := ComunicaServidor('get_config.php', Request_SVG, 'Teste de comunicação com o Módulo Gerente WEB.');
1840 1949 Seta_l_cs_cipher(strRetorno);
... ... @@ -1906,9 +2015,9 @@ Begin
1906 2015 log_DEBUG('Preparando contato com módulo Gerente WEB para Downloads.');
1907 2016 v_acao_gercols := 'Contactando o módulo Gerente WEB: get_config.php...';
1908 2017 Request_SVG := TStringList.Create;
1909   - Request_SVG.Values['in_chkcacic'] := EnCrypt('chkcacic',l_cs_compress);
1910   - Request_SVG.Values['te_fila_ftp'] := EnCrypt('1',l_cs_compress); // Indicará que o agente quer entrar no grupo para FTP
1911   - Request_SVG.Values['id_ip_estacao'] := EnCrypt(GetIP,l_cs_compress); // Informará o IP para registro na tabela redes_grupos_FTP
  2018 + Request_SVG.Values['in_chkcacic'] := StringReplace(EnCrypt('chkcacic',l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2019 + Request_SVG.Values['te_fila_ftp'] := StringReplace(EnCrypt('1',l_cs_compress),'+','<MAIS>',[rfReplaceAll]); // Indicará que o agente quer entrar no grupo para FTP
  2020 + //Request_SVG.Values['id_ip_estacao'] := EnCrypt(GetIP,l_cs_compress); // Informará o IP para registro na tabela redes_grupos_FTP
1912 2021  
1913 2022 log_DEBUG(v_acao_gercols + ' Parâmetros: in_chkcacic="'+Request_SVG.Values['in_chkcacic']+'", te_fila_ftp="'+Request_SVG.Values['te_fila_ftp']+'" e id_ip_estacao="'+Request_SVG.Values['id_ip_estacao']+'"');
1914 2023 strRetorno := ComunicaServidor('get_config.php', Request_SVG, v_mensagem_log);
... ... @@ -2013,7 +2122,8 @@ Begin
2013 2122 v_acao_gercols := 'Invocando execução de VBS para obtenção de IPCONFIG...';
2014 2123 log_DEBUG('Executando "'+p_path_cacic + 'modulos\' + v_scripter + ' //b ' + p_path_cacic + 'temp\ipconfig.vbs"');
2015 2124  
2016   - WinExec(PChar(p_path_cacic + 'modulos\' + v_scripter + ' //b ' + p_path_cacic + 'temp\ipconfig.vbs'), SW_HIDE);
  2125 + if ChecaAgente(p_path_cacic + 'modulos', v_scripter) then
  2126 + WinExec(PChar(p_path_cacic + 'modulos\' + v_scripter + ' //b ' + p_path_cacic + 'temp\ipconfig.vbs'), SW_HIDE);
2017 2127 Except
2018 2128 Begin
2019 2129 log_diario('Erro na geração do ipconfig.txt pelo ' + v_metodo_obtencao+'.');
... ... @@ -2147,7 +2257,7 @@ Begin
2147 2257 (abstraiCSD(v_te_so) >= 250) then //Se NT/2K/XP
2148 2258 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
2149 2259 else
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
  2260 + 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
2151 2261 End // fim do Begin
2152 2262 Else
2153 2263 Begin
... ... @@ -2219,11 +2329,12 @@ Begin
2219 2329 log_diario('Erro setando NODE_ADDRESS.');
2220 2330 end;
2221 2331  
2222   - Try
2223   - SetValorDatMemoria('TcpIp.TE_IP',TE_IP, v_tstrCipherOpened);
2224   - except
2225   - log_diario('Erro setando IP.');
2226   - End;
  2332 + // Esta atribuição foi realizada no teste de comunicação mais acima
  2333 + //Try
  2334 + // SetValorDatMemoria('TcpIp.TE_IP',TE_IP, v_tstrCipherOpened);
  2335 + //except
  2336 + // log_diario('Erro setando IP.');
  2337 + //End;
2227 2338  
2228 2339 Try
2229 2340 SetValorDatMemoria('TcpIp.TE_NOME_HOST',TE_NOME_HOST, v_tstrCipherOpened);
... ... @@ -2248,15 +2359,13 @@ Begin
2248 2359 // Passei a enviar sempre a versão do CACIC...
2249 2360 // Solicito do servidor a configuração que foi definida pelo administrador do CACIC.
2250 2361 Request_SVG := TStringList.Create;
2251   - Request_SVG.Values['te_node_address'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),l_cs_compress);
2252   - Request_SVG.Values['id_so'] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' , v_tstrCipherOpened),l_cs_compress);
2253   - Request_SVG.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
2254   - Request_SVG.Values['id_ip_rede'] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress);
2255   - Request_SVG.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', v_tstrCipherOpened),l_cs_compress);
2256   - Request_SVG.Values['te_ip'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' , v_tstrCipherOpened),l_cs_compress);
2257   - Request_SVG.Values['te_workgroup'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' , v_tstrCipherOpened),l_cs_compress);
2258   - Request_SVG.Values['te_versao_cacic'] := EnCrypt(getVersionInfo(p_path_cacic + 'cacic2.exe'),l_cs_compress);
2259   - Request_SVG.Values['te_versao_gercols'] := EnCrypt(getVersionInfo(ParamStr(0)),l_cs_compress);
  2362 + //Request_SVG.Values['te_node_address'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),l_cs_compress);
  2363 + //Request_SVG.Values['id_so'] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' , v_tstrCipherOpened),l_cs_compress);
  2364 + //Request_SVG.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
  2365 + //Request_SVG.Values['id_ip_rede'] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress);
  2366 + //Request_SVG.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', v_tstrCipherOpened),l_cs_compress);
  2367 + //Request_SVG.Values['te_ip'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' , v_tstrCipherOpened),l_cs_compress);
  2368 + //Request_SVG.Values['te_workgroup'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' , v_tstrCipherOpened),l_cs_compress);
2260 2369  
2261 2370 //Tratamento de Sistemas Monitorados
2262 2371 intAux4 := 1;
... ... @@ -2282,7 +2391,7 @@ Begin
2282 2391  
2283 2392 // Request_SVG.Values['te_tripa_perfis'] := strTripa;
2284 2393 // Proposital, para forçar a chegada dos perfis, solução temporária...
2285   - Request_SVG.Values['te_tripa_perfis'] := EnCrypt('',l_cs_compress);
  2394 + Request_SVG.Values['te_tripa_perfis'] := StringReplace(EnCrypt('',l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
2286 2395 v_te_serv_cacic := GetValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened);
2287 2396  
2288 2397 strRetorno := ComunicaServidor('get_config.php', Request_SVG, v_mensagem_log);
... ... @@ -2309,16 +2418,14 @@ Begin
2309 2418 // Solicito do servidor a configuração que foi definida pelo administrador do CACIC.
2310 2419 Request_SVG.Free;
2311 2420 Request_SVG := TStringList.Create;
2312   - Request_SVG.Values['te_node_address'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),l_cs_compress);
2313   - Request_SVG.Values['id_so'] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' , v_tstrCipherOpened),l_cs_compress);
2314   - Request_SVG.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
2315   - Request_SVG.Values['id_ip_rede'] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress);
2316   - Request_SVG.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', v_tstrCipherOpened),l_cs_compress);
2317   - Request_SVG.Values['te_ip'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' , v_tstrCipherOpened),l_cs_compress);
2318   - Request_SVG.Values['te_workgroup'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' , v_tstrCipherOpened),l_cs_compress);
2319   - Request_SVG.Values['te_versao_cacic'] := EnCrypt(GetVersionInfo(p_path_cacic + 'cacic2.exe'),l_cs_compress);
2320   - Request_SVG.Values['te_versao_gercols'] := EnCrypt(getVersionInfo(ParamStr(0)),l_cs_compress);
2321   - Request_SVG.Values['te_tripa_perfis'] := EnCrypt('',l_cs_compress);
  2421 + //Request_SVG.Values['te_node_address'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),l_cs_compress);
  2422 + //Request_SVG.Values['id_so'] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' , v_tstrCipherOpened),l_cs_compress);
  2423 + //Request_SVG.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
  2424 + //Request_SVG.Values['id_ip_rede'] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress);
  2425 + //Request_SVG.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', v_tstrCipherOpened),l_cs_compress);
  2426 + //Request_SVG.Values['te_ip'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' , v_tstrCipherOpened),l_cs_compress);
  2427 + //Request_SVG.Values['te_workgroup'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' , v_tstrCipherOpened),l_cs_compress);
  2428 + Request_SVG.Values['te_tripa_perfis'] := StringReplace(EnCrypt('',l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
2322 2429 strRetorno := ComunicaServidor('get_config.php', Request_SVG, v_mensagem_log);
2323 2430 Seta_l_cs_cipher(strRetorno);
2324 2431 Seta_l_cs_compress(strRetorno);
... ... @@ -2427,32 +2534,32 @@ Begin
2427 2534 Try
2428 2535 if ((GetWinVer <> 0) and (GetWinVer > 5)) or
2429 2536 (abstraiCSD(v_te_so) >= 250) then //Se NT/2K/XP
2430   - te_dominio_windows := GetDomainName + '\' + GetNetworkUserName
  2537 + te_dominio_windows := GetNetworkUserName + '@' + GetDomainName
2431 2538 else
2432   - te_dominio_windows := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP32\NetworkProvider\AuthenticatingAgent') + '\' + GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Network\Logon\username');
  2539 + te_dominio_windows := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Network\Logon\username')+ '@' + GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSNP32\NetworkProvider\AuthenticatingAgent');
2433 2540 Except te_dominio_windows := 'Não Identificado';
2434 2541 End;
2435 2542 End;
2436 2543  
2437 2544 Request_SVG := TStringList.Create;
2438   - Request_SVG.Values['te_node_address'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , 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);
2441   - Request_SVG.Values['id_ip_rede'] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress);
2442   - Request_SVG.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', v_tstrCipherOpened),l_cs_compress);
2443   - Request_SVG.Values['te_ip'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' , v_tstrCipherOpened),l_cs_compress);
2444   - Request_SVG.Values['te_workgroup'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' , v_tstrCipherOpened),l_cs_compress);
2445   - Request_SVG.Values['te_mascara'] := EnCrypt(te_mascara,l_cs_compress);
2446   - Request_SVG.Values['te_gateway'] := EnCrypt(te_gateway,l_cs_compress);
2447   - Request_SVG.Values['te_serv_dhcp'] := EnCrypt(te_serv_dhcp,l_cs_compress);
2448   - Request_SVG.Values['te_dns_primario'] := EnCrypt(te_dns_primario,l_cs_compress);
2449   - Request_SVG.Values['te_dns_secundario'] := EnCrypt(te_dns_secundario,l_cs_compress);
2450   - Request_SVG.Values['te_wins_primario'] := EnCrypt(te_wins_primario,l_cs_compress);
2451   - Request_SVG.Values['te_wins_secundario'] := EnCrypt(te_wins_secundario,l_cs_compress);
2452   - Request_SVG.Values['te_nome_host'] := EnCrypt(te_nome_host,l_cs_compress);
2453   - Request_SVG.Values['te_dominio_dns'] := EnCrypt(te_dominio_dns,l_cs_compress);
2454   - Request_SVG.Values['te_origem_mac'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_ORIGEM_MAC', v_tstrCipherOpened),l_cs_compress);
2455   - Request_SVG.Values['te_dominio_windows'] := EnCrypt(te_dominio_windows,l_cs_compress);
  2545 + //Request_SVG.Values['te_node_address'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),l_cs_compress);
  2546 + //Request_SVG.Values['id_so'] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' , v_tstrCipherOpened),l_cs_compress);
  2547 + //Request_SVG.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
  2548 + //Request_SVG.Values['id_ip_rede'] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' , v_tstrCipherOpened),l_cs_compress);
  2549 + //Request_SVG.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', v_tstrCipherOpened),l_cs_compress);
  2550 + //Request_SVG.Values['te_ip'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' , v_tstrCipherOpened),l_cs_compress);
  2551 + //Request_SVG.Values['te_workgroup'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' , v_tstrCipherOpened),l_cs_compress);
  2552 + Request_SVG.Values['te_mascara'] := StringReplace(EnCrypt(te_mascara,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2553 + Request_SVG.Values['te_gateway'] := StringReplace(EnCrypt(te_gateway,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2554 + Request_SVG.Values['te_serv_dhcp'] := StringReplace(EnCrypt(te_serv_dhcp,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2555 + Request_SVG.Values['te_dns_primario'] := StringReplace(EnCrypt(te_dns_primario,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2556 + Request_SVG.Values['te_dns_secundario'] := StringReplace(EnCrypt(te_dns_secundario,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2557 + Request_SVG.Values['te_wins_primario'] := StringReplace(EnCrypt(te_wins_primario,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2558 + Request_SVG.Values['te_wins_secundario'] := StringReplace(EnCrypt(te_wins_secundario,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2559 + Request_SVG.Values['te_nome_host'] := StringReplace(EnCrypt(te_nome_host,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2560 + Request_SVG.Values['te_dominio_dns'] := StringReplace(EnCrypt(te_dominio_dns,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2561 + Request_SVG.Values['te_origem_mac'] := StringReplace(EnCrypt(GetValorDatMemoria('TcpIp.TE_ORIGEM_MAC', v_tstrCipherOpened),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2562 + Request_SVG.Values['te_dominio_windows'] := StringReplace(EnCrypt(te_dominio_windows,l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
2456 2563  
2457 2564 v_acao_gercols := 'Contactando módulo Gerente WEB: set_tcp_ip.php';
2458 2565  
... ... @@ -2517,7 +2624,9 @@ Begin
2517 2624  
2518 2625 v_acao_gercols := 'Atualização do Agente Principal - Invocando '+p_path_cacic + 'cacic2.exe /atualizacao';
2519 2626 Finalizar(false);
2520   - WinExec(PChar(p_path_cacic + 'cacic2.exe /atualizacao'), SW_MINIMIZE);
  2627 +
  2628 + if ChecaAgente(p_path_cacic, 'cacic2.exe') then
  2629 + WinExec(PChar(p_path_cacic + 'cacic2.exe /atualizacao'), SW_MINIMIZE);
2521 2630 Sair;
2522 2631 end;
2523 2632  
... ... @@ -2802,11 +2911,11 @@ Begin
2802 2911 (GetValorDatMemoria('Configs.ID_FTP',v_tstrCipherOpened)<>'') then
2803 2912 Begin
2804 2913 Request_Ger_Cols := TStringList.Create;
2805   - Request_Ger_Cols.Values['in_chkcacic'] := EnCrypt('chkcacic',l_cs_compress);
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
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);
2809   - Request_Ger_Cols.Values['id_ip_estacao'] := EnCrypt(GetIP,l_cs_compress); // Informará o IP para registro na tabela redes_grupos_FTP
  2914 + Request_Ger_Cols.Values['in_chkcacic'] := StringReplace(EnCrypt('chkcacic',l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2915 + Request_Ger_Cols.Values['te_fila_ftp'] := StringReplace(EnCrypt('2',l_cs_compress),'+','<MAIS>',[rfReplaceAll]); // Indicará sucesso na operação de FTP e liberará lugar para o próximo
  2916 + Request_Ger_Cols.Values['id_ftp'] := StringReplace(EnCrypt(GetValorDatMemoria('Configs.ID_FTP',v_tstrCipherOpened),l_cs_compress),'+','<MAIS>',[rfReplaceAll]); // Indicará sucesso na operação de FTP e liberará lugar para o próximo
  2917 + //Request_Ger_Cols.Values['te_so'] := EnCrypt(v_te_so,l_cs_compress);
  2918 + //Request_Ger_Cols.Values['id_ip_estacao'] := EnCrypt(GetIP,l_cs_compress); // Informará o IP para registro na tabela redes_grupos_FTP
2810 2919 ComunicaServidor('get_config.php', Request_Ger_Cols, '>> Liberando Grupo FTP!...');
2811 2920 Request_Ger_Cols.Free;
2812 2921 SetValorDatMemoria('Configs.ID_FTP','', v_tstrCipherOpened)
... ... @@ -2860,20 +2969,20 @@ Begin
2860 2969 Begin
2861 2970  
2862 2971 // Dados para uso do Gerente WEB...
2863   - Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,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);
2866   - Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
2867   - Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
2868   - Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
2869   - Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
  2972 + //Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
  2973 + //Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  2974 + //Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
  2975 + //Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
  2976 + //Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
  2977 + //Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
  2978 + //Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
2870 2979  
2871 2980 // Preparação para envio...
2872   - Request_Ger_Cols.Values['nu_versao_engine' ] := EnCrypt(GetValorDatMemoria('Col_Anvi.nu_versao_engine' ,v_tstrCipherOpened1),l_cs_compress);
2873   - Request_Ger_Cols.Values['nu_versao_pattern'] := EnCrypt(GetValorDatMemoria('Col_Anvi.nu_versao_pattern',v_tstrCipherOpened1),l_cs_compress);
2874   - Request_Ger_Cols.Values['dt_hr_instalacao' ] := EnCrypt(GetValorDatMemoria('Col_Anvi.dt_hr_instalacao' ,v_tstrCipherOpened1),l_cs_compress);
2875   - Request_Ger_Cols.Values['te_servidor' ] := EnCrypt(GetValorDatMemoria('Col_Anvi.te_servidor' ,v_tstrCipherOpened1),l_cs_compress);
2876   - Request_Ger_Cols.Values['in_ativo' ] := EnCrypt(GetValorDatMemoria('Col_Anvi.in_ativo' ,v_tstrCipherOpened1),l_cs_compress);
  2981 + Request_Ger_Cols.Values['nu_versao_engine' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Anvi.nu_versao_engine' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2982 + Request_Ger_Cols.Values['nu_versao_pattern'] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Anvi.nu_versao_pattern',v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2983 + Request_Ger_Cols.Values['dt_hr_instalacao' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Anvi.dt_hr_instalacao' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2984 + Request_Ger_Cols.Values['te_servidor' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Anvi.te_servidor' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  2985 + Request_Ger_Cols.Values['in_ativo' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Anvi.in_ativo' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
2877 2986  
2878 2987 if v_Debugs then
2879 2988 For intLoop := 0 to Request_Ger_Cols.Count-1 do
... ... @@ -2919,19 +3028,22 @@ Begin
2919 3028 if (GetValorDatMemoria('Col_Comp.nada',v_tstrCipherOpened1)='') then
2920 3029 Begin
2921 3030 // Dados para uso do Gerente WEB...
2922   - Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,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);
2925   - Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
2926   - Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
2927   - Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
2928   - Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
  3031 + //Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
  3032 + //Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  3033 + //Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
  3034 + //Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
  3035 + //Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
  3036 + //Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
  3037 + //Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
2929 3038  
2930 3039 // Preparação para envio...
2931   - Request_Ger_Cols.Values['compartilhamentos'] := EnCrypt(GetValorDatMemoria('Col_Comp.UVC',v_tstrCipherOpened1),l_cs_compress);
  3040 + Request_Ger_Cols.Values['CompartilhamentosLocais'] := StringReplace(EnCrypt(StringReplace(GetValorDatMemoria('Col_Comp.UVC',v_tstrCipherOpened1),'\','<BarrInv>',[rfReplaceAll]),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
2932 3041 if v_Debugs then
  3042 + Begin
  3043 + log_DEBUG('Col_Comp.UVC => '+GetValorDatMemoria('Col_Comp.UVC',v_tstrCipherOpened1));
2933 3044 For intLoop := 0 to Request_Ger_Cols.Count-1 do
2934 3045 log_DEBUG('Item "'+Request_Ger_Cols.Names[intLoop]+'" de Col_Comp: '+Request_Ger_Cols.ValueFromIndex[intLoop]);
  3046 + End;
2935 3047  
2936 3048 if (ComunicaServidor('set_compart.php', Request_Ger_Cols, '>> Enviando informações de Compartilhamentos para o Gerente WEB.') <> '0') Then
2937 3049 Begin
... ... @@ -2972,36 +3084,33 @@ Begin
2972 3084 if (GetValorDatMemoria('Col_Hard.nada',v_tstrCipherOpened1)='') then
2973 3085 Begin
2974 3086 // Dados para uso do Gerente WEB...
2975   - Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,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);
2978   - Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
2979   - Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
2980   - Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
2981   - Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
  3087 + //Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
  3088 + //Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  3089 + //Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
  3090 + //Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
  3091 + //Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
  3092 + //Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
  3093 + //Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
2982 3094  
2983 3095 // Preparação para envio...
2984   - Request_Ger_Cols.Values['te_placa_rede_desc' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_placa_rede_desc' ,v_tstrCipherOpened1),l_cs_compress);
2985   - Request_Ger_Cols.Values['te_placa_mae_fabricante' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_placa_mae_fabricante' ,v_tstrCipherOpened1),l_cs_compress);
2986   - Request_Ger_Cols.Values['te_placa_mae_desc' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_placa_mae_desc' ,v_tstrCipherOpened1),l_cs_compress);
2987   - Request_Ger_Cols.Values['te_cpu_serial' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_cpu_serial' ,v_tstrCipherOpened1),l_cs_compress);
2988   - Request_Ger_Cols.Values['te_cpu_desc' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_cpu_desc' ,v_tstrCipherOpened1),l_cs_compress);
2989   - Request_Ger_Cols.Values['te_cpu_fabricante' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_cpu_fabricante' ,v_tstrCipherOpened1),l_cs_compress);
2990   - Request_Ger_Cols.Values['te_cpu_freq' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_cpu_freq' ,v_tstrCipherOpened1),l_cs_compress);
2991   - Request_Ger_Cols.Values['qt_mem_ram' ] := EnCrypt(GetValorDatMemoria('Col_Hard.qt_mem_ram' ,v_tstrCipherOpened1),l_cs_compress);
2992   - Request_Ger_Cols.Values['te_mem_ram_desc' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_mem_ram_desc' ,v_tstrCipherOpened1),l_cs_compress);
2993   - Request_Ger_Cols.Values['te_bios_desc' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_bios_desc' ,v_tstrCipherOpened1),l_cs_compress);
2994   - Request_Ger_Cols.Values['te_bios_data' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_bios_data' ,v_tstrCipherOpened1),l_cs_compress);
2995   - Request_Ger_Cols.Values['te_bios_fabricante' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_bios_fabricante' ,v_tstrCipherOpened1),l_cs_compress);
2996   - Request_Ger_Cols.Values['qt_placa_video_cores' ] := EnCrypt(GetValorDatMemoria('Col_Hard.qt_placa_video_cores' ,v_tstrCipherOpened1),l_cs_compress);
2997   - Request_Ger_Cols.Values['te_placa_video_desc' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_placa_video_desc' ,v_tstrCipherOpened1),l_cs_compress);
2998   - Request_Ger_Cols.Values['qt_placa_video_mem' ] := EnCrypt(GetValorDatMemoria('Col_Hard.qt_placa_video_mem' ,v_tstrCipherOpened1),l_cs_compress);
2999   - Request_Ger_Cols.Values['te_placa_video_resolucao'] := EnCrypt(GetValorDatMemoria('Col_Hard.te_placa_video_resolucao',v_tstrCipherOpened1),l_cs_compress);
3000   - Request_Ger_Cols.Values['te_placa_som_desc' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_placa_som_desc' ,v_tstrCipherOpened1),l_cs_compress);
3001   - Request_Ger_Cols.Values['te_cdrom_desc' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_cdrom_desc' ,v_tstrCipherOpened1),l_cs_compress);
3002   - Request_Ger_Cols.Values['te_teclado_desc' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_teclado_desc' ,v_tstrCipherOpened1),l_cs_compress);
3003   - Request_Ger_Cols.Values['te_mouse_desc' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_mouse_desc' ,v_tstrCipherOpened1),l_cs_compress);
3004   - Request_Ger_Cols.Values['te_modem_desc' ] := EnCrypt(GetValorDatMemoria('Col_Hard.te_modem_desc' ,v_tstrCipherOpened1),l_cs_compress);
  3096 + Request_Ger_Cols.Values['te_Tripa_TCPIP' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_Tripa_TCPIP' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3097 + Request_Ger_Cols.Values['te_Tripa_CPU' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_Tripa_CPU' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3098 + Request_Ger_Cols.Values['te_Tripa_CDROM' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_Tripa_CDROM' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3099 + Request_Ger_Cols.Values['te_placa_mae_fabricante' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_placa_mae_fabricante' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3100 + Request_Ger_Cols.Values['te_placa_mae_desc' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_placa_mae_desc' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3101 + Request_Ger_Cols.Values['qt_mem_ram' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.qt_mem_ram' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3102 + Request_Ger_Cols.Values['te_mem_ram_desc' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_mem_ram_desc' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3103 + Request_Ger_Cols.Values['te_bios_desc' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_bios_desc' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3104 + Request_Ger_Cols.Values['te_bios_data' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_bios_data' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3105 + Request_Ger_Cols.Values['te_bios_fabricante' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_bios_fabricante' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3106 + Request_Ger_Cols.Values['qt_placa_video_cores' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.qt_placa_video_cores' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3107 + Request_Ger_Cols.Values['te_placa_video_desc' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_placa_video_desc' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3108 + Request_Ger_Cols.Values['qt_placa_video_mem' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.qt_placa_video_mem' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3109 + Request_Ger_Cols.Values['te_placa_video_resolucao'] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_placa_video_resolucao',v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3110 + Request_Ger_Cols.Values['te_placa_som_desc' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_placa_som_desc' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3111 + Request_Ger_Cols.Values['te_teclado_desc' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_teclado_desc' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3112 + Request_Ger_Cols.Values['te_mouse_desc' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_mouse_desc' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3113 + Request_Ger_Cols.Values['te_modem_desc' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Hard.te_modem_desc' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
3005 3114 if v_Debugs then
3006 3115 For intLoop := 0 to Request_Ger_Cols.Count-1 do
3007 3116 log_DEBUG('Item "'+Request_Ger_Cols.Names[intLoop]+'" de Col_Hard: '+Request_Ger_Cols.ValueFromIndex[intLoop]);
... ... @@ -3045,24 +3154,25 @@ Begin
3045 3154 if (GetValorDatMemoria('Col_Patr.nada',v_tstrCipherOpened1)='') then
3046 3155 Begin
3047 3156 // Dados para uso do Gerente WEB...
3048   - Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,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);
3051   - Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
3052   - Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
3053   - Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
3054   - Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
  3157 + //Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
  3158 + //Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  3159 + //Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
  3160 + //Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
  3161 + //Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
  3162 + //Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
  3163 + //Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
3055 3164  
3056 3165 // Preparação para envio...
3057   - Request_Ger_Cols.Values['id_unid_organizacional_nivel1'] := EnCrypt(GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel1' ,v_tstrCipherOpened1),l_cs_compress);
3058   - Request_Ger_Cols.Values['id_unid_organizacional_nivel2'] := EnCrypt(GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel2' ,v_tstrCipherOpened1),l_cs_compress);
3059   - Request_Ger_Cols.Values['te_localizacao_complementar' ] := EnCrypt(GetValorDatMemoria('Col_Patr.te_localizacao_complementar' ,v_tstrCipherOpened1),l_cs_compress);
3060   - Request_Ger_Cols.Values['te_info_patrimonio1' ] := EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio1' ,v_tstrCipherOpened1),l_cs_compress);
3061   - Request_Ger_Cols.Values['te_info_patrimonio2' ] := EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio2' ,v_tstrCipherOpened1),l_cs_compress);
3062   - Request_Ger_Cols.Values['te_info_patrimonio3' ] := EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio3' ,v_tstrCipherOpened1),l_cs_compress);
3063   - Request_Ger_Cols.Values['te_info_patrimonio4' ] := EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio4' ,v_tstrCipherOpened1),l_cs_compress);
3064   - Request_Ger_Cols.Values['te_info_patrimonio5' ] := EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio5' ,v_tstrCipherOpened1),l_cs_compress);
3065   - Request_Ger_Cols.Values['te_info_patrimonio6' ] := EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio6' ,v_tstrCipherOpened1),l_cs_compress);
  3166 + Request_Ger_Cols.Values['id_unid_organizacional_nivel1'] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel1' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3167 + Request_Ger_Cols.Values['id_unid_organizacional_nivel1a'] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel1a' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3168 + Request_Ger_Cols.Values['id_unid_organizacional_nivel2'] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel2' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3169 + Request_Ger_Cols.Values['te_localizacao_complementar' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Patr.te_localizacao_complementar' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3170 + Request_Ger_Cols.Values['te_info_patrimonio1' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio1' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3171 + Request_Ger_Cols.Values['te_info_patrimonio2' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio2' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3172 + Request_Ger_Cols.Values['te_info_patrimonio3' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio3' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3173 + Request_Ger_Cols.Values['te_info_patrimonio4' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio4' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3174 + Request_Ger_Cols.Values['te_info_patrimonio5' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio5' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3175 + Request_Ger_Cols.Values['te_info_patrimonio6' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Patr.te_info_patrimonio6' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
3066 3176  
3067 3177 if v_Debugs then
3068 3178 For intLoop := 0 to Request_Ger_Cols.Count-1 do
... ... @@ -3075,16 +3185,17 @@ Begin
3075 3185  
3076 3186 // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD
3077 3187 //Sobreponho a informação no registro para posterior comparação, na próxima execução.
3078   - SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1', GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel1',v_tstrCipherOpened1), v_tstrCipherOpened);
3079   - SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2', GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel2',v_tstrCipherOpened1), v_tstrCipherOpened);
3080   - SetValorDatMemoria('Patrimonio.te_localizacao_complementar' , GetValorDatMemoria('Col_Patr.te_localizacao_complementar' ,v_tstrCipherOpened1), v_tstrCipherOpened);
3081   - SetValorDatMemoria('Patrimonio.te_info_patrimonio1' , GetValorDatMemoria('Col_Patr.te_info_patrimonio1' ,v_tstrCipherOpened1), v_tstrCipherOpened);
3082   - SetValorDatMemoria('Patrimonio.te_info_patrimonio2' , GetValorDatMemoria('Col_Patr.te_info_patrimonio2' ,v_tstrCipherOpened1), v_tstrCipherOpened);
3083   - SetValorDatMemoria('Patrimonio.te_info_patrimonio3' , GetValorDatMemoria('Col_Patr.te_info_patrimonio3' ,v_tstrCipherOpened1), v_tstrCipherOpened);
3084   - SetValorDatMemoria('Patrimonio.te_info_patrimonio4' , GetValorDatMemoria('Col_Patr.te_info_patrimonio4' ,v_tstrCipherOpened1), v_tstrCipherOpened);
3085   - SetValorDatMemoria('Patrimonio.te_info_patrimonio5' , GetValorDatMemoria('Col_Patr.te_info_patrimonio5' ,v_tstrCipherOpened1), v_tstrCipherOpened);
3086   - SetValorDatMemoria('Patrimonio.te_info_patrimonio6' , GetValorDatMemoria('Col_Patr.te_info_patrimonio6' ,v_tstrCipherOpened1), v_tstrCipherOpened);
3087   - SetValorDatMemoria('Patrimonio.ultima_rede_obtida' , GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened) , v_tstrCipherOpened);
  3188 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1' , GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel1',v_tstrCipherOpened1), v_tstrCipherOpened);
  3189 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1a', GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel1a',v_tstrCipherOpened1), v_tstrCipherOpened);
  3190 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2' , GetValorDatMemoria('Col_Patr.id_unid_organizacional_nivel2',v_tstrCipherOpened1), v_tstrCipherOpened);
  3191 + SetValorDatMemoria('Patrimonio.te_localizacao_complementar' , GetValorDatMemoria('Col_Patr.te_localizacao_complementar' ,v_tstrCipherOpened1), v_tstrCipherOpened);
  3192 + SetValorDatMemoria('Patrimonio.te_info_patrimonio1' , GetValorDatMemoria('Col_Patr.te_info_patrimonio1' ,v_tstrCipherOpened1), v_tstrCipherOpened);
  3193 + SetValorDatMemoria('Patrimonio.te_info_patrimonio2' , GetValorDatMemoria('Col_Patr.te_info_patrimonio2' ,v_tstrCipherOpened1), v_tstrCipherOpened);
  3194 + SetValorDatMemoria('Patrimonio.te_info_patrimonio3' , GetValorDatMemoria('Col_Patr.te_info_patrimonio3' ,v_tstrCipherOpened1), v_tstrCipherOpened);
  3195 + SetValorDatMemoria('Patrimonio.te_info_patrimonio4' , GetValorDatMemoria('Col_Patr.te_info_patrimonio4' ,v_tstrCipherOpened1), v_tstrCipherOpened);
  3196 + SetValorDatMemoria('Patrimonio.te_info_patrimonio5' , GetValorDatMemoria('Col_Patr.te_info_patrimonio5' ,v_tstrCipherOpened1), v_tstrCipherOpened);
  3197 + SetValorDatMemoria('Patrimonio.te_info_patrimonio6' , GetValorDatMemoria('Col_Patr.te_info_patrimonio6' ,v_tstrCipherOpened1), v_tstrCipherOpened);
  3198 + SetValorDatMemoria('Patrimonio.ultima_rede_obtida' , GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened) , v_tstrCipherOpened);
3088 3199 intAux := 1;
3089 3200 End
3090 3201 else
... ... @@ -3115,16 +3226,16 @@ Begin
3115 3226 if (GetValorDatMemoria('Col_Moni.nada',v_tstrCipherOpened1)='') then
3116 3227 Begin
3117 3228 // Dados para uso do Gerente WEB...
3118   - Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,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);
3121   - Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
3122   - Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
3123   - Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
3124   - Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
  3229 + //Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
  3230 + //Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  3231 + //Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
  3232 + //Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
  3233 + //Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
  3234 + //Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
  3235 + //Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
3125 3236  
3126 3237 // Preparação para envio...
3127   - Request_Ger_Cols.Values['te_tripa_monitorados'] := EnCrypt(GetValorDatMemoria('Col_Moni.UVC',v_tstrCipherOpened1),l_cs_compress);
  3238 + Request_Ger_Cols.Values['te_tripa_monitorados'] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Moni.UVC',v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
3128 3239  
3129 3240 if v_Debugs then
3130 3241 For intLoop := 0 to Request_Ger_Cols.Count-1 do
... ... @@ -3169,28 +3280,26 @@ Begin
3169 3280 if (GetValorDatMemoria('Col_Soft.nada',v_tstrCipherOpened1)='') then
3170 3281 Begin
3171 3282 // Dados para uso do Gerente WEB...
3172   - Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,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);
3175   - Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
3176   - Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
3177   - Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
3178   - Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
  3283 + //Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
  3284 + //Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  3285 + //Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
  3286 + //Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
  3287 + //Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
  3288 + //Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
  3289 + //Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
3179 3290  
3180 3291 // Preparação para envio...
3181   - Request_Ger_Cols.Values['te_versao_bde' ] := EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_bde' ,v_tstrCipherOpened1),l_cs_compress);
3182   - Request_Ger_Cols.Values['te_versao_dao' ] := EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_dao' ,v_tstrCipherOpened1),l_cs_compress);
3183   - Request_Ger_Cols.Values['te_versao_ado' ] := EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_ado' ,v_tstrCipherOpened1),l_cs_compress);
3184   - Request_Ger_Cols.Values['te_versao_odbc' ] := EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_odbc' ,v_tstrCipherOpened1),l_cs_compress);
3185   - Request_Ger_Cols.Values['te_versao_directx' ] := EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_directx' ,v_tstrCipherOpened1),l_cs_compress);
3186   - Request_Ger_Cols.Values['te_versao_acrobat_reader'] := EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_acrobat_reader',v_tstrCipherOpened1),l_cs_compress);
3187   - Request_Ger_Cols.Values['te_versao_ie' ] := EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_ie' ,v_tstrCipherOpened1),l_cs_compress);
3188   - Request_Ger_Cols.Values['te_versao_mozilla' ] := EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_mozilla' ,v_tstrCipherOpened1),l_cs_compress);
3189   - Request_Ger_Cols.Values['te_versao_jre' ] := EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_jre' ,v_tstrCipherOpened1),l_cs_compress);
3190   - Request_Ger_Cols.Values['te_inventario_softwares' ] := EnCrypt(GetValorDatMemoria('Col_Soft.te_inventario_softwares' ,v_tstrCipherOpened1),l_cs_compress);
3191   - Request_Ger_Cols.Values['te_variaveis_ambiente' ] := EnCrypt(GetValorDatMemoria('Col_Soft.te_variaveis_ambiente' ,v_tstrCipherOpened1),l_cs_compress);
3192   - Request_Ger_Cols.Values['te_versao_cacic' ] := EnCrypt(getVersionInfo(p_path_cacic + 'cacic2.exe'),l_cs_compress);
3193   - Request_Ger_Cols.Values['te_versao_gercols' ] := EnCrypt(getVersionInfo(ParamStr(0)),l_cs_compress);
  3292 + Request_Ger_Cols.Values['te_versao_bde' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_bde' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3293 + Request_Ger_Cols.Values['te_versao_dao' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_dao' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3294 + Request_Ger_Cols.Values['te_versao_ado' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_ado' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3295 + Request_Ger_Cols.Values['te_versao_odbc' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_odbc' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3296 + Request_Ger_Cols.Values['te_versao_directx' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_directx' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3297 + Request_Ger_Cols.Values['te_versao_acrobat_reader'] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_acrobat_reader',v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3298 + Request_Ger_Cols.Values['te_versao_ie' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_ie' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3299 + Request_Ger_Cols.Values['te_versao_mozilla' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_mozilla' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3300 + Request_Ger_Cols.Values['te_versao_jre' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Soft.te_versao_jre' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3301 + Request_Ger_Cols.Values['te_inventario_softwares' ] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Soft.te_inventario_softwares' ,v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
  3302 + Request_Ger_Cols.Values['te_variaveis_ambiente' ] := StringReplace(EnCrypt(StringReplace(GetValorDatMemoria('Col_Soft.te_variaveis_ambiente',v_tstrCipherOpened1),'\','<BarrInv>',[rfReplaceAll]),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
3194 3303  
3195 3304 if v_Debugs then
3196 3305 For intLoop := 0 to Request_Ger_Cols.Count-1 do
... ... @@ -3235,16 +3344,16 @@ Begin
3235 3344 if (GetValorDatMemoria('Col_Undi.nada',v_tstrCipherOpened1)='') then
3236 3345 Begin
3237 3346 // Dados para uso do Gerente WEB...
3238   - Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,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);
3241   - Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
3242   - Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
3243   - Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
3244   - Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
  3347 + //Request_Ger_Cols.Values['te_node_address' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened),l_cs_compress);
  3348 + //Request_Ger_Cols.Values['id_so' ] := EnCrypt(GetValorDatMemoria('Configs.ID_SO' ,v_tstrCipherOpened),l_cs_compress);
  3349 + //Request_Ger_Cols.Values['te_so' ] := EnCrypt(v_te_so,l_cs_compress);
  3350 + //Request_Ger_Cols.Values['te_ip' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened),l_cs_compress);
  3351 + //Request_Ger_Cols.Values['id_ip_rede' ] := EnCrypt(GetValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened),l_cs_compress);
  3352 + //Request_Ger_Cols.Values['te_workgroup' ] := EnCrypt(GetValorDatMemoria('TcpIp.TE_WORKGROUP' ,v_tstrCipherOpened),l_cs_compress);
  3353 + //Request_Ger_Cols.Values['te_nome_computador'] := EnCrypt(GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR',v_tstrCipherOpened),l_cs_compress);
3245 3354  
3246 3355 // Preparação para envio...
3247   - Request_Ger_Cols.Values['unidades'] := EnCrypt(GetValorDatMemoria('Col_Undi.UVC',v_tstrCipherOpened1),l_cs_compress);
  3356 + Request_Ger_Cols.Values['UnidadesDiscos'] := StringReplace(EnCrypt(GetValorDatMemoria('Col_Undi.UVC',v_tstrCipherOpened1),l_cs_compress),'+','<MAIS>',[rfReplaceAll]);
3248 3357  
3249 3358 if v_Debugs then
3250 3359 For intLoop := 0 to Request_Ger_Cols.Count-1 do
... ...
ger_cols/ger_cols.res
No preview for this file type
ini_cols/ini_cols.dpr
... ... @@ -457,6 +457,7 @@ begin
457 457 v_DatFileName := p_path_cacic + 'cacic2.dat';
458 458 v_SeparatorKey := '=CacicIsFree=';
459 459  
  460 + Matar(p_path_cacic+'temp\','*.dat');
460 461 Try
461 462 // Caso exista o Gerente de Coletas será verificada a versão...
462 463 // Devido a problemas na rotina de FTP na versão 2.0.1.2,
... ...
No preview for this file type
main.pas
... ... @@ -107,11 +107,15 @@ type
107 107 Mnu_FinalizarCacic: TMenuItem;
108 108 listSistemasMonitorados: TListView;
109 109 Panel1: TPanel;
110   - Label1: TLabel;
  110 + lbColetasRealizadasNestaData: TLabel;
111 111 listaColetas: TListView;
112   - lbDataColeta: TLabel;
  112 + teDataColeta: TLabel;
113 113 Panel2: TPanel;
114 114 Panel3: TPanel;
  115 + pnVersao: TPanel;
  116 + lbServidorWEB: TLabel;
  117 + teServidorWEB: TLabel;
  118 + Panel5: TPanel;
115 119 procedure RemoveIconesMortos;
116 120 procedure ChecaCONFIGS;
117 121 procedure CriaFormSenha(Sender: TObject);
... ... @@ -141,7 +145,7 @@ type
141 145 procedure Bt_Fechar_InfosGeraisClick(Sender: TObject);
142 146 function Get_File_Size(sFileToExamine: string; bInKBytes: Boolean): string;
143 147 function Posso_Rodar : boolean;
144   - function abstraiCSD(p_te_so : String) : integer;
  148 + function abstraiCSD(p_te_so : String) : integer;
145 149 private
146 150 ShutdownEmExecucao : Boolean;
147 151 IsMenuOpen : Boolean;
... ... @@ -506,7 +510,9 @@ begin
506 510 end;
507 511  
508 512 log_DEBUG('Lendo '+v_DatFileName);
  513 +
509 514 Readln(v_DatFile,v_strCipherClosed);
  515 +
510 516 log_DEBUG('Povoando Variável');
511 517 while not EOF(v_DatFile) do Readln(v_DatFile,v_strCipherClosed);
512 518 log_DEBUG('Fechando '+v_DatFileName);
... ... @@ -663,22 +669,35 @@ end;
663 669 function TFormularioGeral.ChecaGERCOLS : boolean;
664 670 var strFraseVersao : String;
665 671 Begin
666   - log_DEBUG('Verificando existência do Gerente de Coletas...');
667   - if not (FileExists(p_path_cacic + 'modulos\ger_cols.exe')) then
  672 + Result := true;
  673 +
  674 + log_DEBUG('Verificando existência e tamanho do Gerente de Coletas...');
  675 + v_Tamanho_Arquivo := Get_File_Size(p_path_cacic + 'modulos\ger_cols.exe',true);
  676 +
  677 + log_DEBUG('Resultado: #'+v_Tamanho_Arquivo);
  678 +
  679 + if (v_Tamanho_Arquivo = '0') or (v_Tamanho_Arquivo = '-1') then
668 680 Begin
  681 + Result := false;
  682 +
  683 + Matar(p_path_cacic + 'modulos\','ger_cols.exe');
  684 +
669 685 strFraseVersao := 'CACIC V:' + getVersionInfo(ParamStr(0));
670 686 if not (getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened) = '') then
671 687 strFraseVersao := strFraseVersao + #13#10 + 'IP: '+getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened);
672 688  
673 689 InicializaTray(strFraseVersao);
674 690 log_diario('Acionando recuperador de Módulo Gerente de Coletas.');
  691 + log_DEBUG('Recuperador de Módulo Gerente de Coletas: '+HomeDrive + '\chksis.exe');
675 692 WinExec(PChar(HomeDrive + '\chksis.exe'),SW_HIDE);
676 693  
677 694 sleep(30000); // 30 segundos de espera para download do ger_cols.exe
678   - if (FileExists(p_path_cacic + 'modulos\ger_cols.exe')) then
  695 + v_Tamanho_Arquivo := Get_File_Size(p_path_cacic + 'modulos\ger_cols.exe',true);
  696 + if not(v_Tamanho_Arquivo = '0') and not(v_Tamanho_Arquivo = '-1') then
679 697 Begin
680 698 log_diario('Módulo Gerente de Coletas RECUPERADO COM SUCESSO!');
681 699 InicializaTray('');
  700 + Result := True;
682 701 End
683 702 else
684 703 log_diario('Módulo Gerente de Coletas NÃO RECUPERADO!');
... ... @@ -965,6 +984,9 @@ var strAux,
965 984 v_Aguarde : TextFile;
966 985 v_SystemDrive : TStrings;
967 986 begin
  987 + // Não mostrar o formulário...
  988 + Application.ShowMainForm:=false;
  989 +
968 990 Try
969 991 // De acordo com a versão do OS, determino o ShellCommand para chamadas externas.
970 992 if ((GetWinVer <> 0) and (GetWinVer > 5)) or
... ... @@ -984,7 +1006,6 @@ begin
984 1006 p_Shell_Command := 'command.com';
985 1007 strAux := GetEnvironmentVariable('windir') + '\'; //Ex.: c:\windows\
986 1008 End;
987   -
988 1009 v_SystemDrive := explode(strAux,'\');
989 1010 v_cacic_dir := v_SystemDrive[0] + '\' + getValorChaveRegIni('Cacic2','cacic_dir',strAux + 'chksis.ini') + '\';
990 1011  
... ... @@ -1025,7 +1046,7 @@ begin
1025 1046 // Chave AES. Recomenda-se que cada empresa altere a sua chave.
1026 1047 // Esta chave é passada como parâmetro para o Gerente de Coletas que, por sua vez,
1027 1048 // passa para o Inicializador de Coletas e este passa para os coletores...
1028   - v_CipherKey := 'CacicBrasil';
  1049 + v_CipherKey := 'CacicBrasil';
1029 1050 v_IV := 'abcdefghijklmnop';
1030 1051 v_SeparatorKey := '=CacicIsFree='; // Usada apenas para o cacic2.dat
1031 1052 v_DatFileName := p_path_cacic + 'cacic2.dat';
... ... @@ -1111,7 +1132,7 @@ begin
1111 1132 strFraseVersao := 'CACIC V:' + getVersionInfo(ParamStr(0));
1112 1133 if not (getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened) = '') then
1113 1134 strFraseVersao := strFraseVersao + #13#10 + 'IP: '+ getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened);
1114   -
  1135 + pnVersao.Caption := 'V. ' + getVersionInfo(ParamStr(0));
1115 1136 InicializaTray(strFraseVersao);
1116 1137 CipherClose;
1117 1138 End
... ... @@ -1238,16 +1259,6 @@ begin
1238 1259 Matar(p_path_cacic + 'temp\','*.ini');
1239 1260  
1240 1261 // Caso exista o Gerente de Coletas será verificada a versão e excluída caso antiga(Uma forma de ação pró-ativa)
1241   - If (FileExists(p_path_cacic + 'modulos\ger_cols.exe')) Then
1242   - Begin
1243   - v_versao := trim(GetVersionInfo(p_path_cacic + 'modulos\ger_cols.exe'));
1244   - if (v_versao = '0.0.0.0') then // Provavelmente arquivo corrompido ou versão muito antiga
1245   - Begin
1246   - log_diario('Excluindo versão ('+v_versao+') de Ger_Cols.exe');
1247   - Matar(p_path_cacic + 'modulos\','ger_cols.exe');
1248   - End;
1249   - End;
1250   -
1251 1262 if ChecaGERCOLS then
1252 1263 Begin
1253 1264 ChecaCONFIGS;
... ... @@ -1255,7 +1266,9 @@ begin
1255 1266 log_diario('Invocando Gerente de Coletas com ação: "'+p_acao+'"');
1256 1267 Timer_Nu_Exec_Apos.Enabled := False;
1257 1268 WinExec(PChar(p_path_cacic + 'modulos\GER_COLS.EXE /'+p_acao+' /p_CipherKey='+v_CipherKey),SW_HIDE);
1258   - End;
  1269 + End
  1270 + else
  1271 + log_diario('Não foi possível invocar o Gerente de Coletas!');
1259 1272 end;
1260 1273  
1261 1274 function TFormularioGeral.FindWindowByTitle(WindowTitle: string): Hwnd;
... ... @@ -1760,7 +1773,8 @@ begin
1760 1773 End;
1761 1774 end;
1762 1775  
1763   - lbDataColeta.Caption := '('+FormatDateTime('dd/mm/yyyy', now)+')';
  1776 + teDataColeta.Caption := '('+FormatDateTime('dd/mm/yyyy', now)+')';
  1777 + teServidorWEB.Caption := '"'+FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor',v_tstrCipherOpened)+'"';
1764 1778  
1765 1779 strAux := GetValorDatMemoria('Coletas.HOJE', v_tstrCipherOpened);
1766 1780 if (strAux <> '') then
... ...
mapa/acesso.dfm
... ... @@ -150,9 +150,38 @@ object frmAcesso: TfrmAcesso
150 150 OnShow = FormShow
151 151 PixelsPerInch = 96
152 152 TextHeight = 13
  153 + object lbNomeServidorWEB: TLabel
  154 + Left = 0
  155 + Top = 272
  156 + Width = 300
  157 + Height = 12
  158 + AutoSize = False
  159 + Caption = 'Servidor: ABCDEFGHIJKLMNOP'
  160 + Font.Charset = DEFAULT_CHARSET
  161 + Font.Color = clWindowText
  162 + Font.Height = -9
  163 + Font.Name = 'Arial'
  164 + Font.Style = [fsBold]
  165 + ParentFont = False
  166 + end
  167 + object lbVersao: TLabel
  168 + Left = 303
  169 + Top = 272
  170 + Width = 300
  171 + Height = 12
  172 + Alignment = taRightJustify
  173 + AutoSize = False
  174 + Caption = 'Vers'#227'o: X.X.X.X'
  175 + Font.Charset = DEFAULT_CHARSET
  176 + Font.Color = clWindowText
  177 + Font.Height = -9
  178 + Font.Name = 'Arial'
  179 + Font.Style = []
  180 + ParentFont = False
  181 + end
153 182 object btAcesso: TButton
154 183 Left = 174
155   - Top = 241
  184 + Top = 233
156 185 Width = 100
157 186 Height = 30
158 187 Caption = 'Acessar'
... ... @@ -167,8 +196,8 @@ object frmAcesso: TfrmAcesso
167 196 OnClick = btAcessoClick
168 197 end
169 198 object btCancela: TButton
170   - Left = 324
171   - Top = 241
  199 + Left = 330
  200 + Top = 233
172 201 Width = 100
173 202 Height = 30
174 203 Caption = 'Cancelar'
... ... @@ -182,9 +211,9 @@ object frmAcesso: TfrmAcesso
182 211 OnClick = btCancelaClick
183 212 end
184 213 object pnAcesso: TPanel
185   - Left = 5
186   - Top = 10
187   - Width = 596
  214 + Left = 2
  215 + Top = 3
  216 + Width = 602
188 217 Height = 196
189 218 BevelInner = bvRaised
190 219 BevelOuter = bvLowered
... ... @@ -203,7 +232,7 @@ object frmAcesso: TfrmAcesso
203 232 ParentFont = False
204 233 end
205 234 object lbSenhaAcesso: TLabel
206   - Left = 389
  235 + Left = 394
207 236 Top = 39
208 237 Width = 110
209 238 Height = 16
... ... @@ -218,7 +247,7 @@ object frmAcesso: TfrmAcesso
218 247 object lbAviso: TLabel
219 248 Left = 4
220 249 Top = 121
221   - Width = 587
  250 + Width = 593
222 251 Height = 13
223 252 Alignment = taCenter
224 253 AutoSize = False
... ... @@ -242,7 +271,7 @@ object frmAcesso: TfrmAcesso
242 271 OnKeyUp = edNomeUsuarioAcessoKeyUp
243 272 end
244 273 object edSenhaAcesso: TEdit
245   - Left = 389
  274 + Left = 394
246 275 Top = 55
247 276 Width = 150
248 277 Height = 21
... ... @@ -252,9 +281,9 @@ object frmAcesso: TfrmAcesso
252 281 end
253 282 end
254 283 object pnMensagens: TPanel
255   - Left = 4
256   - Top = 205
257   - Width = 596
  284 + Left = 1
  285 + Top = 200
  286 + Width = 602
258 287 Height = 24
259 288 BevelInner = bvLowered
260 289 TabOrder = 3
... ... @@ -267,51 +296,6 @@ object frmAcesso: TfrmAcesso
267 296 AutoSize = False
268 297 end
269 298 end
270   - object pnVersao: TPanel
271   - Left = 513
272   - Top = 267
273   - Width = 90
274   - Height = 14
275   - BevelOuter = bvLowered
276   - TabOrder = 4
277   - object lbVersao: TLabel
278   - Left = 4
279   - Top = 1
280   - Width = 85
281   - Height = 12
282   - Alignment = taCenter
283   - AutoSize = False
284   - Caption = 'v: X.X.X.X'
285   - Font.Charset = DEFAULT_CHARSET
286   - Font.Color = clWindowText
287   - Font.Height = -9
288   - Font.Name = 'Arial'
289   - Font.Style = []
290   - ParentFont = False
291   - end
292   - end
293   - object pnNomeServidorWEB: TPanel
294   - Left = 1
295   - Top = 267
296   - Width = 90
297   - Height = 14
298   - BevelOuter = bvLowered
299   - TabOrder = 5
300   - object lbNomeServidorWEB: TLabel
301   - Left = 3
302   - Top = 1
303   - Width = 83
304   - Height = 12
305   - Alignment = taCenter
306   - AutoSize = False
307   - Font.Charset = DEFAULT_CHARSET
308   - Font.Color = clWindowText
309   - Font.Height = -9
310   - Font.Name = 'Arial'
311   - Font.Style = [fsBold]
312   - ParentFont = False
313   - end
314   - end
315 299 object tm_Mensagem: TTimer
316 300 Enabled = False
317 301 Interval = 5000
... ...
mapa/acesso.pas
... ... @@ -21,7 +21,7 @@ interface
21 21  
22 22 uses
23 23 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
24   - Dialogs, StdCtrls, ExtCtrls;
  24 + StdCtrls, ExtCtrls, dialogs;
25 25  
26 26 type
27 27 TfrmAcesso = class(TForm)
... ... @@ -35,11 +35,9 @@ type
35 35 pnMensagens: TPanel;
36 36 lbMsg_Erro_Senha: TLabel;
37 37 lbAviso: TLabel;
38   - pnVersao: TPanel;
39   - lbVersao: TLabel;
40 38 tm_Mensagem: TTimer;
41   - pnNomeServidorWEB: TPanel;
42 39 lbNomeServidorWEB: TLabel;
  40 + lbVersao: TLabel;
43 41 procedure btAcessoClick(Sender: TObject);
44 42 procedure btCancelaClick(Sender: TObject);
45 43 procedure FormCreate(Sender: TObject);
... ... @@ -73,16 +71,23 @@ begin
73 71 lbMsg_Erro_Senha.Caption := str_local_Aux;
74 72  
75 73 // Envio dos dados ao DataBase...
76   - Request_mapa.Values['nm_acesso'] := frmMapaCacic.EnCrypt(edNomeUsuarioAcesso.Text);
77   - Request_mapa.Values['te_senha'] := frmMapaCacic.EnCrypt(edSenhaAcesso.Text);
78   - Request_mapa.Values['cs_MapaCacic'] := frmMapaCacic.EnCrypt('S');
79   -
  74 + Request_mapa.Values['nm_acesso'] := frmMapaCacic.EnCrypt(edNomeUsuarioAcesso.Text);
  75 + Request_mapa.Values['te_senha'] := frmMapaCacic.EnCrypt(edSenhaAcesso.Text);
  76 + Request_mapa.Values['cs_MapaCacic'] := frmMapaCacic.EnCrypt('S');
  77 + Request_mapa.Values['te_versao_mapa'] := frmMapaCacic.EnCrypt(frmMapaCacic.getVersionInfo(ParamStr(0)));
80 78  
81 79 strRetorno := frmMapaCacic.ComunicaServidor('mapa_acesso.php', Request_mapa, 'Autenticando o Acesso...');
82 80 Request_mapa.free;
83 81  
84 82 if (frmMapaCacic.XML_RetornaValor('STATUS', strRetorno)='OK') then
85 83 Begin
  84 + str_local_Aux := trim(frmMapaCacic.DeCrypt(frmMapaCacic.XML_RetornaValor('TE_VERSAO_MAPA',strRetorno)));
  85 + if (str_local_Aux <> '') then
  86 + Begin
  87 + MessageDLG(#13#10#13#10+'ATENÇÃO! Foi disponibilizada a versão "'+str_local_Aux+'".'+#13#10#13#10#13#10+'Efetue o download acessando http://www-cacic, na opção Repositório.'+#13#10#13#10,mtInformation,[mbOK],0);
  88 + btCancela.Click;
  89 + End;
  90 +
86 91 str_local_Aux := trim(frmMapaCacic.DeCrypt(frmMapaCacic.XML_RetornaValor('ID_USUARIO',strRetorno)));
87 92 if (str_local_Aux <> '') then
88 93 Begin
... ... @@ -138,9 +143,10 @@ end;
138 143  
139 144 procedure TfrmAcesso.FormCreate(Sender: TObject);
140 145 begin
141   - frmAcesso.lbVersao.Caption := 'v: ' + frmMapaCacic.GetVersionInfo(ParamStr(0));
  146 + intPausaPadrao := 3000; //(3 mil milisegundos = 3 segundos)
  147 + frmAcesso.lbVersao.Caption := 'Versão: ' + frmMapaCacic.GetVersionInfo(ParamStr(0));
142 148 frmMapaCacic.tStringsCipherOpened := frmMapaCacic.CipherOpen(frmMapaCacic.strDatFileName);
143   - frmMapaCacic.lbNomeServidorWEB.Caption := frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsCipherOpened);
  149 + frmMapaCacic.lbNomeServidorWEB.Caption := 'Servidor: '+frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsCipherOpened);
144 150 frmMapaCacic.lbMensagens.Caption := 'Entrada de Dados para Autenticação no Módulo Gerente WEB Cacic';
145 151 if (frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCipherOpened)='') then
146 152 Begin
... ... @@ -188,14 +194,14 @@ end;
188 194 procedure TfrmAcesso.FormActivate(Sender: TObject);
189 195 var strAux : String;
190 196 begin
191   - strAux := frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsCipherOpened);
  197 + strAux := 'Servidor: ' + frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsCipherOpened);
192 198 if not (strAux = '') then
193 199 Begin
194 200 frmAcesso.lbNomeServidorWEB.Caption := strAux;
195 201 End
196 202 else
197 203 Begin
198   - frmMapaCacic.Mensagem('Favor verificar a instalação do Cacic.' +#13#10 + 'Não Existe Servidor de Aplicação configurado!',true);
  204 + frmMapaCacic.Mensagem('Favor verificar a instalação do Cacic.' +#13#10 + 'Não Existe Servidor de Aplicação configurado!',true,intPausaPadrao);
199 205 frmMapaCacic.Finalizar(true);
200 206 End;
201 207 end;
... ...
mapa/main_mapa.dfm
... ... @@ -6,12 +6,12 @@ object frmMapaCacic: TfrmMapaCacic
6 6 Caption =
7 7 'MapaCacic - M'#243'dulo Avulso para Coleta de Informa'#231#245'es Patrimoniai' +
8 8 's'
9   - ClientHeight = 284
10   - ClientWidth = 605
  9 + ClientHeight = 316
  10 + ClientWidth = 782
11 11 Color = clBtnFace
12 12 Font.Charset = DEFAULT_CHARSET
13 13 Font.Color = clWindowText
14   - Font.Height = -11
  14 + Font.Height = -9
15 15 Font.Name = 'MS Sans Serif'
16 16 Font.Style = []
17 17 Icon.Data = {
... ... @@ -150,10 +150,38 @@ object frmMapaCacic: TfrmMapaCacic
150 150 OnClose = FormClose
151 151 PixelsPerInch = 96
152 152 TextHeight = 13
  153 + object lbNomeServidorWEB: TLabel
  154 + Left = 0
  155 + Top = 303
  156 + Width = 390
  157 + Height = 12
  158 + AutoSize = False
  159 + Font.Charset = DEFAULT_CHARSET
  160 + Font.Color = clWindowText
  161 + Font.Height = -9
  162 + Font.Name = 'Arial'
  163 + Font.Style = [fsBold]
  164 + ParentFont = False
  165 + end
  166 + object lbVersao: TLabel
  167 + Left = 389
  168 + Top = 303
  169 + Width = 390
  170 + Height = 12
  171 + Alignment = taRightJustify
  172 + AutoSize = False
  173 + Caption = 'v: X.X.X.X'
  174 + Font.Charset = DEFAULT_CHARSET
  175 + Font.Color = clWindowText
  176 + Font.Height = -9
  177 + Font.Name = 'Arial'
  178 + Font.Style = []
  179 + ParentFont = False
  180 + end
153 181 object gbLeiaComAtencao: TGroupBox
154   - Left = 5
  182 + Left = 1
155 183 Top = -1
156   - Width = 596
  184 + Width = 780
157 185 Height = 53
158 186 Caption = ' Leia com aten'#231#227'o '
159 187 Color = clBtnFace
... ... @@ -169,7 +197,7 @@ object frmMapaCacic: TfrmMapaCacic
169 197 object lbLeiaComAtencao: TLabel
170 198 Left = 5
171 199 Top = 14
172   - Width = 588
  200 + Width = 769
173 201 Height = 32
174 202 AutoSize = False
175 203 Caption =
... ... @@ -186,11 +214,13 @@ object frmMapaCacic: TfrmMapaCacic
186 214 end
187 215 end
188 216 object gbInformacoesSobreComputador: TGroupBox
189   - Left = 5
  217 + Left = 1
190 218 Top = 61
191   - Width = 596
192   - Height = 144
193   - Caption = ' Informa'#231#245'es sobre este computador '
  219 + Width = 780
  220 + Height = 151
  221 + Caption =
  222 + 'Informa'#231#245'es sobre localiza'#231#227'o f'#237'sica e patrimonial deste computa' +
  223 + 'dor'
194 224 Font.Charset = DEFAULT_CHARSET
195 225 Font.Color = clBlue
196 226 Font.Height = -11
... ... @@ -200,8 +230,8 @@ object frmMapaCacic: TfrmMapaCacic
200 230 TabOrder = 1
201 231 Visible = False
202 232 object lbEtiqueta1: TLabel
203   - Left = 11
204   - Top = 17
  233 + Left = 3
  234 + Top = 15
205 235 Width = 48
206 236 Height = 13
207 237 Caption = 'Etiqueta 1'
... ... @@ -214,8 +244,8 @@ object frmMapaCacic: TfrmMapaCacic
214 244 Visible = False
215 245 end
216 246 object lbEtiqueta2: TLabel
217   - Left = 185
218   - Top = 17
  247 + Left = 3
  248 + Top = 105
219 249 Width = 48
220 250 Height = 13
221 251 Caption = 'Etiqueta 2'
... ... @@ -228,8 +258,8 @@ object frmMapaCacic: TfrmMapaCacic
228 258 Visible = False
229 259 end
230 260 object lbEtiqueta3: TLabel
231   - Left = 430
232   - Top = 17
  261 + Left = 341
  262 + Top = 15
233 263 Width = 48
234 264 Height = 13
235 265 Caption = 'Etiqueta 3'
... ... @@ -242,8 +272,8 @@ object frmMapaCacic: TfrmMapaCacic
242 272 Visible = False
243 273 end
244 274 object lbEtiqueta4: TLabel
245   - Left = 11
246   - Top = 57
  275 + Left = 341
  276 + Top = 60
247 277 Width = 48
248 278 Height = 13
249 279 Caption = 'Etiqueta 4'
... ... @@ -256,8 +286,8 @@ object frmMapaCacic: TfrmMapaCacic
256 286 Visible = False
257 287 end
258 288 object lbEtiqueta5: TLabel
259   - Left = 185
260   - Top = 57
  289 + Left = 493
  290 + Top = 60
261 291 Width = 48
262 292 Height = 13
263 293 Caption = 'Etiqueta 5'
... ... @@ -270,8 +300,8 @@ object frmMapaCacic: TfrmMapaCacic
270 300 Visible = False
271 301 end
272 302 object lbEtiqueta6: TLabel
273   - Left = 430
274   - Top = 57
  303 + Left = 645
  304 + Top = 60
275 305 Width = 48
276 306 Height = 13
277 307 Caption = 'Etiqueta 6'
... ... @@ -284,8 +314,8 @@ object frmMapaCacic: TfrmMapaCacic
284 314 Visible = False
285 315 end
286 316 object lbEtiqueta7: TLabel
287   - Left = 11
288   - Top = 98
  317 + Left = 341
  318 + Top = 105
289 319 Width = 48
290 320 Height = 13
291 321 Caption = 'Etiqueta 7'
... ... @@ -298,8 +328,8 @@ object frmMapaCacic: TfrmMapaCacic
298 328 Visible = False
299 329 end
300 330 object lbEtiqueta8: TLabel
301   - Left = 185
302   - Top = 98
  331 + Left = 493
  332 + Top = 105
303 333 Width = 48
304 334 Height = 13
305 335 Caption = 'Etiqueta 8'
... ... @@ -312,8 +342,8 @@ object frmMapaCacic: TfrmMapaCacic
312 342 Visible = False
313 343 end
314 344 object lbEtiqueta9: TLabel
315   - Left = 430
316   - Top = 98
  345 + Left = 645
  346 + Top = 105
317 347 Width = 48
318 348 Height = 13
319 349 Caption = 'Etiqueta 9'
... ... @@ -325,10 +355,24 @@ object frmMapaCacic: TfrmMapaCacic
325 355 ParentFont = False
326 356 Visible = False
327 357 end
  358 + object lbEtiqueta1a: TLabel
  359 + Left = 3
  360 + Top = 60
  361 + Width = 54
  362 + Height = 13
  363 + Caption = 'Etiqueta 1a'
  364 + Font.Charset = DEFAULT_CHARSET
  365 + Font.Color = clWindowText
  366 + Font.Height = -11
  367 + Font.Name = 'MS Sans Serif'
  368 + Font.Style = []
  369 + ParentFont = False
  370 + Visible = False
  371 + end
328 372 object cb_id_unid_organizacional_nivel1: TComboBox
329   - Left = 9
330   - Top = 31
331   - Width = 157
  373 + Left = 3
  374 + Top = 30
  375 + Width = 325
332 376 Height = 21
333 377 Hint = 'Esse '#233' o texto de ajuda da "Etiqueta 1"'
334 378 Style = csDropDownList
... ... @@ -346,11 +390,12 @@ object frmMapaCacic: TfrmMapaCacic
346 390 OnChange = cb_id_unid_organizacional_nivel1Change
347 391 end
348 392 object cb_id_unid_organizacional_nivel2: TComboBox
349   - Left = 185
350   - Top = 31
351   - Width = 226
  393 + Left = 3
  394 + Top = 120
  395 + Width = 325
352 396 Height = 21
353 397 Style = csDropDownList
  398 + Enabled = False
354 399 Font.Charset = DEFAULT_CHARSET
355 400 Font.Color = clWindowText
356 401 Font.Height = -11
... ... @@ -364,15 +409,16 @@ object frmMapaCacic: TfrmMapaCacic
364 409 Visible = False
365 410 end
366 411 object ed_te_localizacao_complementar: TEdit
367   - Left = 430
368   - Top = 31
369   - Width = 157
370   - Height = 21
  412 + Left = 341
  413 + Top = 30
  414 + Width = 434
  415 + Height = 22
371 416 Font.Charset = DEFAULT_CHARSET
372 417 Font.Color = clWindowText
373 418 Font.Height = -11
374   - Font.Name = 'MS Sans Serif'
  419 + Font.Name = 'Arial'
375 420 Font.Style = []
  421 + MaxLength = 100
376 422 ParentFont = False
377 423 ParentShowHint = False
378 424 ShowHint = True
... ... @@ -380,15 +426,16 @@ object frmMapaCacic: TfrmMapaCacic
380 426 Visible = False
381 427 end
382 428 object ed_te_info_patrimonio3: TEdit
383   - Left = 430
384   - Top = 71
385   - Width = 155
  429 + Left = 645
  430 + Top = 75
  431 + Width = 130
386 432 Height = 21
387 433 Font.Charset = DEFAULT_CHARSET
388 434 Font.Color = clWindowText
389 435 Font.Height = -11
390 436 Font.Name = 'MS Sans Serif'
391 437 Font.Style = []
  438 + MaxLength = 20
392 439 ParentFont = False
393 440 ParentShowHint = False
394 441 ShowHint = True
... ... @@ -396,15 +443,16 @@ object frmMapaCacic: TfrmMapaCacic
396 443 Visible = False
397 444 end
398 445 object ed_te_info_patrimonio1: TEdit
399   - Left = 9
400   - Top = 71
401   - Width = 158
  446 + Left = 341
  447 + Top = 75
  448 + Width = 130
402 449 Height = 21
403 450 Font.Charset = DEFAULT_CHARSET
404 451 Font.Color = clWindowText
405 452 Font.Height = -11
406 453 Font.Name = 'MS Sans Serif'
407 454 Font.Style = []
  455 + MaxLength = 20
408 456 ParentFont = False
409 457 ParentShowHint = False
410 458 ShowHint = True
... ... @@ -412,15 +460,16 @@ object frmMapaCacic: TfrmMapaCacic
412 460 Visible = False
413 461 end
414 462 object ed_te_info_patrimonio2: TEdit
415   - Left = 185
416   - Top = 71
417   - Width = 155
  463 + Left = 493
  464 + Top = 75
  465 + Width = 130
418 466 Height = 21
419 467 Font.Charset = DEFAULT_CHARSET
420 468 Font.Color = clWindowText
421 469 Font.Height = -11
422 470 Font.Name = 'MS Sans Serif'
423 471 Font.Style = []
  472 + MaxLength = 20
424 473 ParentFont = False
425 474 ParentShowHint = False
426 475 ShowHint = True
... ... @@ -428,15 +477,16 @@ object frmMapaCacic: TfrmMapaCacic
428 477 Visible = False
429 478 end
430 479 object ed_te_info_patrimonio6: TEdit
431   - Left = 430
432   - Top = 112
433   - Width = 155
  480 + Left = 645
  481 + Top = 120
  482 + Width = 130
434 483 Height = 21
435 484 Font.Charset = DEFAULT_CHARSET
436 485 Font.Color = clWindowText
437 486 Font.Height = -11
438 487 Font.Name = 'MS Sans Serif'
439 488 Font.Style = []
  489 + MaxLength = 20
440 490 ParentFont = False
441 491 ParentShowHint = False
442 492 ShowHint = True
... ... @@ -444,15 +494,16 @@ object frmMapaCacic: TfrmMapaCacic
444 494 Visible = False
445 495 end
446 496 object ed_te_info_patrimonio4: TEdit
447   - Left = 9
448   - Top = 112
449   - Width = 158
  497 + Left = 341
  498 + Top = 120
  499 + Width = 130
450 500 Height = 21
451 501 Font.Charset = DEFAULT_CHARSET
452 502 Font.Color = clWindowText
453 503 Font.Height = -11
454 504 Font.Name = 'MS Sans Serif'
455 505 Font.Style = []
  506 + MaxLength = 20
456 507 ParentFont = False
457 508 ParentShowHint = False
458 509 ShowHint = True
... ... @@ -460,25 +511,54 @@ object frmMapaCacic: TfrmMapaCacic
460 511 Visible = False
461 512 end
462 513 object ed_te_info_patrimonio5: TEdit
463   - Left = 185
464   - Top = 112
465   - Width = 155
  514 + Left = 493
  515 + Top = 120
  516 + Width = 130
466 517 Height = 21
467 518 Font.Charset = DEFAULT_CHARSET
468 519 Font.Color = clWindowText
469 520 Font.Height = -11
470 521 Font.Name = 'MS Sans Serif'
471 522 Font.Style = []
  523 + MaxLength = 20
472 524 ParentFont = False
473 525 ParentShowHint = False
474 526 ShowHint = True
475 527 TabOrder = 7
476 528 Visible = False
477 529 end
  530 + object cb_id_unid_organizacional_nivel1a: TComboBox
  531 + Left = 3
  532 + Top = 75
  533 + Width = 325
  534 + Height = 22
  535 + Style = csDropDownList
  536 + Enabled = False
  537 + Font.Charset = DEFAULT_CHARSET
  538 + Font.Color = clWindowText
  539 + Font.Height = -11
  540 + Font.Name = 'Arial'
  541 + Font.Style = []
  542 + ItemHeight = 14
  543 + ParentFont = False
  544 + ParentShowHint = False
  545 + ShowHint = True
  546 + TabOrder = 9
  547 + Visible = False
  548 + OnChange = cb_id_unid_organizacional_nivel1aChange
  549 + end
  550 + object Panel1: TPanel
  551 + Left = 333
  552 + Top = 16
  553 + Width = 2
  554 + Height = 125
  555 + Caption = 'Panel1'
  556 + TabOrder = 10
  557 + end
478 558 end
479 559 object btGravarInformacoes: TButton
480   - Left = 164
481   - Top = 240
  560 + Left = 251
  561 + Top = 254
482 562 Width = 275
483 563 Height = 30
484 564 Caption = 'Grava e Envia Informa'#231#245'es Patrimoniais'
... ... @@ -492,40 +572,17 @@ object frmMapaCacic: TfrmMapaCacic
492 572 Visible = False
493 573 OnClick = AtualizaPatrimonio
494 574 end
495   - object pnVersao: TPanel
496   - Left = 513
497   - Top = 267
498   - Width = 90
499   - Height = 14
500   - BevelOuter = bvLowered
501   - TabOrder = 3
502   - object lbVersao: TLabel
503   - Left = 4
504   - Top = 1
505   - Width = 82
506   - Height = 12
507   - Alignment = taCenter
508   - AutoSize = False
509   - Caption = 'v: X.X.X.X'
510   - Font.Charset = DEFAULT_CHARSET
511   - Font.Color = clWindowText
512   - Font.Height = -9
513   - Font.Name = 'Arial'
514   - Font.Style = []
515   - ParentFont = False
516   - end
517   - end
518 575 object pnMensagens: TPanel
519   - Left = 4
520   - Top = 204
521   - Width = 596
  576 + Left = 1
  577 + Top = 212
  578 + Width = 779
522 579 Height = 22
523 580 BevelInner = bvLowered
524   - TabOrder = 4
  581 + TabOrder = 3
525 582 object lbMensagens: TLabel
526 583 Left = 2
527 584 Top = 2
528   - Width = 592
  585 + Width = 775
529 586 Height = 18
530 587 Align = alClient
531 588 Alignment = taCenter
... ... @@ -538,26 +595,4 @@ object frmMapaCacic: TfrmMapaCacic
538 595 ParentFont = False
539 596 end
540 597 end
541   - object pnNomeServidorWEB: TPanel
542   - Left = 1
543   - Top = 267
544   - Width = 90
545   - Height = 14
546   - BevelOuter = bvLowered
547   - TabOrder = 5
548   - object lbNomeServidorWEB: TLabel
549   - Left = 3
550   - Top = 1
551   - Width = 83
552   - Height = 12
553   - Alignment = taCenter
554   - AutoSize = False
555   - Font.Charset = DEFAULT_CHARSET
556   - Font.Color = clWindowText
557   - Font.Height = -9
558   - Font.Name = 'Arial'
559   - Font.Style = [fsBold]
560   - ParentFont = False
561   - end
562   - end
563 598 end
... ...
mapa/main_mapa.pas
... ... @@ -43,15 +43,16 @@ uses IniFiles,
43 43 DCPbase64,
44 44 ExtCtrls,
45 45 Graphics,
46   - dialogs;
  46 + Dialogs;
47 47  
48 48 var strCipherClosed,
49 49 strCipherOpened,
50 50 strPathCacic,
51 51 str_te_so : string;
52 52  
53   -var boolDebugs,
54   - boolUON2 : boolean;
  53 +var intPausaPadrao : integer;
  54 +
  55 +var boolDebugs : boolean;
55 56  
56 57  
57 58 // Some constants that are dependant on the cipher being used
... ... @@ -93,12 +94,13 @@ type
93 94 ed_te_info_patrimonio4: TEdit;
94 95 ed_te_info_patrimonio5: TEdit;
95 96 ed_te_info_patrimonio6: TEdit;
96   - pnVersao: TPanel;
97   - lbVersao: TLabel;
98 97 pnMensagens: TPanel;
99 98 lbMensagens: TLabel;
100   - pnNomeServidorWEB: TPanel;
  99 + lbEtiqueta1a: TLabel;
  100 + cb_id_unid_organizacional_nivel1a: TComboBox;
  101 + Panel1: TPanel;
101 102 lbNomeServidorWEB: TLabel;
  103 + lbVersao: TLabel;
102 104  
103 105 procedure mapa;
104 106 procedure Grava_Debugs(strMsg : String);
... ... @@ -141,23 +143,27 @@ type
141 143 Function Rat(OQue: String; Onde: String) : Integer;
142 144 Function RemoveZerosFimString(Texto : String) : String;
143 145 function GetValorChaveRegIni(p_SectionName, p_KeyName, p_IniFileName : String) : String;
144   - Function RetornaValorVetorUON1(id1Procurado1 : string) : String;
145   - Function RetornaValorVetorUON2(id1Procurado : string; id2Procurado : string) : String;
  146 + Function RetornaValorVetorUON1(id1 : string) : String;
  147 + Function RetornaValorVetorUON1a(id1a : string) : String;
  148 + Function RetornaValorVetorUON2(id2,idLocal : string) : String;
146 149 function LetrasDrives: string;
147 150 function SearchFile(p_Drive,p_File:string) : boolean;
148 151 procedure GetSubDirs(Folder:string; sList:TStringList);
149   - procedure Mensagem(p_strMsg : String; p_boolAlerta : boolean);
  152 + procedure Mensagem(p_strMsg : String; p_boolAlerta : boolean; p_intPausaSegundos : integer);
150 153 procedure FormActivate(Sender: TObject);
  154 + procedure cb_id_unid_organizacional_nivel1aChange(Sender: TObject);
151 155 private
152   - var_id_unid_organizacional_nivel1,
153   - var_id_unid_organizacional_nivel2,
154   - var_te_localizacao_complementar,
155   - var_te_info_patrimonio1,
156   - var_te_info_patrimonio2,
157   - var_te_info_patrimonio3,
158   - var_te_info_patrimonio4,
159   - var_te_info_patrimonio5,
160   - var_te_info_patrimonio6 : String;
  156 + strId_unid_organizacional_nivel1,
  157 + strId_unid_organizacional_nivel1a,
  158 + strId_unid_organizacional_nivel2,
  159 + strId_Local,
  160 + strTe_localizacao_complementar,
  161 + strTe_info_patrimonio1,
  162 + strTe_info_patrimonio2,
  163 + strTe_info_patrimonio3,
  164 + strTe_info_patrimonio4,
  165 + strTe_info_patrimonio5,
  166 + strTe_info_patrimonio6 : String;
161 167 public
162 168 boolAcessoOK : boolean;
163 169 strId_usuario,
... ... @@ -172,7 +178,7 @@ var
172 178  
173 179 implementation
174 180  
175   -uses acesso;
  181 +uses acesso, Math;
176 182  
177 183 {$R *.dfm}
178 184  
... ... @@ -185,21 +191,32 @@ type
185 191 end;
186 192 TVetorUON1 = array of TRegistroUON1;
187 193  
188   - TRegistroUON2 = record
189   - id1 : String;
190   - id2 : String;
191   - nm2 : String;
  194 + TRegistroUON1a = record
  195 + id1 : String;
  196 + id1a : String;
  197 + nm1a : String;
  198 + id_local: String;
192 199 end;
193   - TVetorUON2 = array of TRegistroUON2;
194 200  
195   -var VetorUON1 : TVetorUON1;
196   - VetorUON2 : TVetorUON2;
  201 + TVetorUON1a = array of TRegistroUON1a;
197 202  
198   - // Esse array é usado apenas para saber a uon2, após a filtragem pelo uon1
199   - VetorUON2Filtrado : array of String;
  203 + TRegistroUON2 = record
  204 + id1a : String;
  205 + id2 : String;
  206 + nm2 : String;
  207 + id_local: String;
  208 + end;
  209 + TVetorUON2 = array of TRegistroUON2;
200 210  
  211 +var VetorUON1 : TVetorUON1;
  212 + VetorUON1a : TVetorUON1a;
  213 + VetorUON2 : TVetorUON2;
201 214  
  215 + // Esse array é usado apenas para saber a uon1a, após a filtragem pelo uon1
  216 + VetorUON1aFiltrado : array of String;
202 217  
  218 + // Esse array é usado apenas para saber a uon2, após a filtragem pelo uon1a
  219 + VetorUON2Filtrado : array of String;
203 220  
204 221 // Baixada de http://www.geocities.com/SiliconValley/Bay/1058/fdelphi.html
205 222 Function TfrmMapaCacic.Rat(OQue: String; Onde: String) : Integer;
... ... @@ -229,7 +246,7 @@ while (Pos &gt;= 1) and not Achou do
229 246 Result := Pos;
230 247 end;
231 248  
232   -procedure TfrmMapaCacic.Mensagem(p_strMsg : String; p_boolAlerta : boolean);
  249 +procedure TfrmMapaCacic.Mensagem(p_strMsg : String; p_boolAlerta : boolean; p_intPausaSegundos : integer);
233 250 Begin
234 251 if p_boolAlerta then
235 252 lbMensagens.Font.Color := clRed
... ... @@ -239,6 +256,8 @@ Begin
239 256 lbMensagens.Caption := p_strMsg;
240 257 log_diario(lbMensagens.Caption);
241 258 Application.ProcessMessages;
  259 + if (p_intPausaSegundos > 0) then
  260 + sleep(p_intPausaSegundos);
242 261 End;
243 262  
244 263 procedure TfrmMapaCacic.log_diario(strMsg : String);
... ... @@ -418,7 +437,7 @@ begin
418 437 intClasses := intClasses + 1;
419 438 End; // for intClasses...
420 439 except
421   - frmMapaCacic.Mensagem('ERRO! Problema na rotina parse',true);
  440 + frmMapaCacic.Mensagem('ERRO! Problema na rotina parse',true,intPausaPadrao);
422 441 end;
423 442 end;
424 443  
... ... @@ -444,7 +463,7 @@ End;
444 463  
445 464 procedure TfrmMapaCacic.Finalizar(p_pausa:boolean);
446 465 Begin
447   - Mensagem('Finalizando MapaCacic...',false);
  466 + Mensagem('Finalizando MapaCacic...',false,0);
448 467  
449 468 CipherClose(strDatFileName, tStringsCipherOpened);
450 469 Apaga_Temps;
... ... @@ -579,7 +598,7 @@ Begin
579 598 idHTTP1.Free;
580 599 log_DEBUG('Retorno: "'+Response_CS.DataString+'"');
581 600 Except
582   - Mensagem('ERRO! Comunicação impossível com o endereço ' + strEndereco + ': '+Response_CS.DataString,true);
  601 + Mensagem('ERRO! Comunicação impossível com o endereço ' + strEndereco + ': '+Response_CS.DataString,true,intPausaPadrao);
583 602 result := '0';
584 603 Exit;
585 604 end;
... ... @@ -588,7 +607,7 @@ Begin
588 607 Try
589 608 if (UpperCase(XML_RetornaValor('Status', Response_CS.DataString)) <> 'OK') Then
590 609 Begin
591   - Mensagem('PROBLEMAS DURANTE A COMUNICAÇÃO',true);
  610 + Mensagem('PROBLEMAS DURANTE A COMUNICAÇÃO',true,intPausaPadrao);
592 611 log_diario('Endereço: ' + strEndereco);
593 612 log_diario('Mensagem: ' + Response_CS.DataString);
594 613 result := '0';
... ... @@ -600,7 +619,7 @@ Begin
600 619 Response_CS.Free;
601 620 Except
602 621 Begin
603   - Mensagem('PROBLEMAS DURANTE A COMUNICAÇÃO',true);
  622 + Mensagem('PROBLEMAS DURANTE A COMUNICAÇÃO',true,intPausaPadrao);
604 623 log_diario('Endereço: ' + strEndereco);
605 624 log_diario('Mensagem: ' + Response_CS.DataString);
606 625 result := '0';
... ... @@ -990,216 +1009,442 @@ begin
990 1009 else if Trim(strRootKey) = 'HKEY_DYN_DATA' Then Result := HKEY_DYN_DATA;
991 1010 end;
992 1011  
993   -Function TfrmMapaCacic.RetornaValorVetorUON1(id1Procurado1 : string) : String;
  1012 +Function TfrmMapaCacic.RetornaValorVetorUON1(id1 : string) : String;
994 1013 var I : Integer;
995 1014 begin
996 1015 For I := 0 to (Length(VetorUON1)-1) Do
997   - If (VetorUON1[I].id1 = id1Procurado1) Then Result := VetorUON1[I].nm1;
  1016 + If (VetorUON1[I].id1 = id1) Then Result := VetorUON1[I].nm1;
998 1017 end;
999 1018  
  1019 +Function TfrmMapaCacic.RetornaValorVetorUON1a(id1a : string) : String;
  1020 +var I : Integer;
  1021 +begin
  1022 + For I := 0 to (Length(VetorUON1a)-1) Do
  1023 + If (VetorUON1a[I].id1a = id1a) Then Result := VetorUON1a[I].nm1a;
  1024 +end;
1000 1025  
1001   -Function TfrmMapaCacic.RetornaValorVetorUON2(id1Procurado : string; id2Procurado : string) : String;
  1026 +Function TfrmMapaCacic.RetornaValorVetorUON2(id2, idLocal: string) : String;
1002 1027 var I : Integer;
1003 1028 begin
1004 1029 For I := 0 to (Length(VetorUON2)-1) Do
1005   - If (VetorUON2[I].id1 = id1Procurado) and (VetorUON2[I].id2 = id2Procurado) Then Result := VetorUON2[I].nm2;
  1030 + If (VetorUON2[I].id2 = id2) and
  1031 + (VetorUON2[I].id_local = idLocal) Then Result := VetorUON2[I].nm2;
1006 1032 end;
1007 1033  
1008 1034 procedure TfrmMapaCacic.RecuperaValoresAnteriores(p_strConfigs : String);
1009 1035 begin
1010   - Mensagem('Recuperando Valores Anteriores...',false);
  1036 + Mensagem('Recuperando Valores Anteriores...',false,intPausaPadrao div 3);
  1037 +
  1038 + strId_unid_organizacional_nivel1 := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1',tStringsCipherOpened);
  1039 + if (strId_unid_organizacional_nivel1='') then
  1040 + strId_unid_organizacional_nivel1 := DeCrypt(XML.XML_RetornaValor('ID_UON1', p_strConfigs));
1011 1041  
1012   - var_id_unid_organizacional_nivel1 := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1',tStringsCipherOpened);
1013   - if (var_id_unid_organizacional_nivel1='') then var_id_unid_organizacional_nivel1 := DeCrypt(XML.XML_RetornaValor('ID_UON1', p_strConfigs));
  1042 + strId_unid_organizacional_nivel1a := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1a',tStringsCipherOpened);
  1043 + if (strId_unid_organizacional_nivel1a='') then
  1044 + strId_unid_organizacional_nivel1a := DeCrypt(XML.XML_RetornaValor('ID_UON1a', p_strConfigs));
1014 1045  
1015   - var_id_unid_organizacional_nivel2 := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2',tStringsCipherOpened);
1016   - if (var_id_unid_organizacional_nivel2='') then var_id_unid_organizacional_nivel2 := DeCrypt(XML.XML_RetornaValor('ID_UON2', p_strConfigs));
  1046 + strId_unid_organizacional_nivel2 := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2',tStringsCipherOpened);
  1047 + if (strId_unid_organizacional_nivel2='') then
  1048 + strId_unid_organizacional_nivel2 := DeCrypt(XML.XML_RetornaValor('ID_UON2', p_strConfigs));
  1049 +
  1050 + strId_Local := GetValorDatMemoria('Patrimonio.id_local',tStringsCipherOpened);
  1051 + if (strId_Local='') then
  1052 + strId_Local := DeCrypt(XML.XML_RetornaValor('ID_LOCAL', p_strConfigs));
1017 1053  
1018 1054 Try
1019   - cb_id_unid_organizacional_nivel1.ItemIndex := cb_id_unid_organizacional_nivel1.Items.IndexOf(RetornaValorVetorUON1(var_id_unid_organizacional_nivel1));
  1055 + cb_id_unid_organizacional_nivel1.ItemIndex := cb_id_unid_organizacional_nivel1.Items.IndexOf(RetornaValorVetorUON1(strId_unid_organizacional_nivel1));
1020 1056 cb_id_unid_organizacional_nivel1Change(Nil); // Para filtrar os valores do combo2 de acordo com o valor selecionado no combo1
1021   - cb_id_unid_organizacional_nivel2.ItemIndex := cb_id_unid_organizacional_nivel2.Items.IndexOf(RetornaValorVetorUON2(var_id_unid_organizacional_nivel1, var_id_unid_organizacional_nivel2));
  1057 + cb_id_unid_organizacional_nivel1a.ItemIndex := cb_id_unid_organizacional_nivel1a.Items.IndexOf(RetornaValorVetorUON1(strId_unid_organizacional_nivel1));
1022 1058 Except
1023 1059 end;
1024 1060  
1025   - lbEtiqueta1.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta1', p_strConfigs));
  1061 + Try
  1062 + cb_id_unid_organizacional_nivel1a.ItemIndex := cb_id_unid_organizacional_nivel1a.Items.IndexOf(RetornaValorVetorUON1a(strId_unid_organizacional_nivel1a));
  1063 + cb_id_unid_organizacional_nivel1aChange(Nil); // Para filtrar os valores do combo3 de acordo com o valor selecionado no combo2
  1064 + cb_id_unid_organizacional_nivel2.ItemIndex := cb_id_unid_organizacional_nivel2.Items.IndexOf(RetornaValorVetorUON2(strId_unid_organizacional_nivel2,strId_Local));
  1065 + Except
  1066 + end;
1026 1067  
  1068 + lbEtiqueta1.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta1', p_strConfigs));
  1069 + lbEtiqueta1a.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta1a', p_strConfigs));
1027 1070  
1028   - var_te_localizacao_complementar := GetValorDatMemoria('Patrimonio.te_localizacao_complementar',tStringsCipherOpened);
1029   - if (var_te_localizacao_complementar='') then var_te_localizacao_complementar := DeCrypt(XML.XML_RetornaValor('TE_LOC_COMPL', p_strConfigs));
  1071 + strTe_localizacao_complementar := GetValorDatMemoria('Patrimonio.te_localizacao_complementar',tStringsCipherOpened);
  1072 + if (strTe_localizacao_complementar='') then strTe_localizacao_complementar := DeCrypt(XML.XML_RetornaValor('TE_LOC_COMPL', p_strConfigs));
1030 1073  
1031 1074 // Tentarei buscar informação gravada no Registry
1032   - var_te_info_patrimonio1 := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio1');
1033   - if (var_te_info_patrimonio1='') then
  1075 + strTe_info_patrimonio1 := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio1');
  1076 + if (strTe_info_patrimonio1='') then
1034 1077 Begin
1035   - var_te_info_patrimonio1 := GetValorDatMemoria('Patrimonio.te_info_patrimonio1',tStringsCipherOpened);
  1078 + strTe_info_patrimonio1 := GetValorDatMemoria('Patrimonio.te_info_patrimonio1',tStringsCipherOpened);
1036 1079 End;
1037   - if (var_te_info_patrimonio1='') then var_te_info_patrimonio1 := DeCrypt(XML.XML_RetornaValor('TE_INFO1', p_strConfigs));
  1080 + if (strTe_info_patrimonio1='') then strTe_info_patrimonio1 := DeCrypt(XML.XML_RetornaValor('TE_INFO1', p_strConfigs));
1038 1081  
1039   - var_te_info_patrimonio2 := GetValorDatMemoria('Patrimonio.te_info_patrimonio2',tStringsCipherOpened);
1040   - if (var_te_info_patrimonio2='') then var_te_info_patrimonio2 := DeCrypt(XML.XML_RetornaValor('TE_INFO2', p_strConfigs));
  1082 + strTe_info_patrimonio2 := GetValorDatMemoria('Patrimonio.te_info_patrimonio2',tStringsCipherOpened);
  1083 + if (strTe_info_patrimonio2='') then strTe_info_patrimonio2 := DeCrypt(XML.XML_RetornaValor('TE_INFO2', p_strConfigs));
1041 1084  
1042   - var_te_info_patrimonio3 := GetValorDatMemoria('Patrimonio.te_info_patrimonio3',tStringsCipherOpened);
1043   - if (var_te_info_patrimonio3='') then var_te_info_patrimonio3 := DeCrypt(XML.XML_RetornaValor('TE_INFO3', p_strConfigs));
  1085 + strTe_info_patrimonio3 := GetValorDatMemoria('Patrimonio.te_info_patrimonio3',tStringsCipherOpened);
  1086 + if (strTe_info_patrimonio3='') then strTe_info_patrimonio3 := DeCrypt(XML.XML_RetornaValor('TE_INFO3', p_strConfigs));
1044 1087  
1045 1088 // Tentarei buscar informação gravada no Registry
1046   - var_te_info_patrimonio4 := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio4');
1047   - if (var_te_info_patrimonio4='') then
  1089 + strTe_info_patrimonio4 := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio4');
  1090 + if (strTe_info_patrimonio4='') then
1048 1091 Begin
1049   - var_te_info_patrimonio4 := GetValorDatMemoria('Patrimonio.te_info_patrimonio4',tStringsCipherOpened);
  1092 + strTe_info_patrimonio4 := GetValorDatMemoria('Patrimonio.te_info_patrimonio4',tStringsCipherOpened);
1050 1093 End;
1051   - if (var_te_info_patrimonio4='') then var_te_info_patrimonio4 := DeCrypt(XML.XML_RetornaValor('TE_INFO4', p_strConfigs));
  1094 + if (strTe_info_patrimonio4='') then strTe_info_patrimonio4 := DeCrypt(XML.XML_RetornaValor('TE_INFO4', p_strConfigs));
1052 1095  
1053   - var_te_info_patrimonio5 := GetValorDatMemoria('Patrimonio.te_info_patrimonio5',tStringsCipherOpened);
1054   - if (var_te_info_patrimonio5='') then var_te_info_patrimonio5 := DeCrypt(XML.XML_RetornaValor('TE_INFO5', p_strConfigs));
  1096 + strTe_info_patrimonio5 := GetValorDatMemoria('Patrimonio.te_info_patrimonio5',tStringsCipherOpened);
  1097 + if (strTe_info_patrimonio5='') then strTe_info_patrimonio5 := DeCrypt(XML.XML_RetornaValor('TE_INFO5', p_strConfigs));
1055 1098  
1056   - var_te_info_patrimonio6 := GetValorDatMemoria('Patrimonio.te_info_patrimonio6',tStringsCipherOpened);
1057   - if (var_te_info_patrimonio6='') then var_te_info_patrimonio6 := DeCrypt(XML.XML_RetornaValor('TE_INFO6', p_strConfigs));
  1099 + strTe_info_patrimonio6 := GetValorDatMemoria('Patrimonio.te_info_patrimonio6',tStringsCipherOpened);
  1100 + if (strTe_info_patrimonio6='') then strTe_info_patrimonio6 := DeCrypt(XML.XML_RetornaValor('TE_INFO6', p_strConfigs));
1058 1101 end;
1059 1102  
1060 1103 procedure TfrmMapaCacic.MontaCombos(p_strConfigs : String);
1061 1104 var Parser : TXmlParser;
1062 1105 i : integer;
1063   - v_Tag : boolean;
  1106 + strAux,
  1107 + strAux1,
  1108 + strTagName,
  1109 + strItemName : string;
1064 1110 begin
1065   - Mensagem('Montando Listas para Seleção de U.O. Nível 1 e U.O. Nível 2...',false);
  1111 + Mensagem('Montando Listas para Seleção de Unidades Organizacionais...',false,intPausaPadrao div 3);
1066 1112  
1067 1113 Parser := TXmlParser.Create;
1068 1114 Parser.Normalize := True;
1069 1115 Parser.LoadFromBuffer(PAnsiChar(p_strConfigs));
  1116 + log_DEBUG('p_strConfigs: '+p_strConfigs);
1070 1117 Parser.StartScan;
1071 1118 i := -1;
1072   - v_Tag := false;
1073   - While Parser.Scan and (UpperCase(Parser.CurName) <> 'IT2') DO
1074   - Begin
1075   - if ((Parser.CurPartType = ptStartTag) and (UpperCase(Parser.CurName) = 'IT1')) Then
1076   - Begin
1077   - v_Tag := true;
  1119 + strItemName := '';
  1120 + strTagName := '';
  1121 + While Parser.Scan DO
  1122 + Begin
  1123 + strItemName := UpperCase(Parser.CurName);
  1124 + if (Parser.CurPartType = ptStartTag) and (strItemName = 'IT1') Then
  1125 + Begin
1078 1126 i := i + 1;
1079 1127 SetLength(VetorUON1, i + 1); // Aumento o tamanho da matriz dinamicamente de acordo com o número de itens recebidos.
1080   - end
1081   - else if (Parser.CurPartType in [ptContent, ptCData]) and v_Tag Then
1082   - if (UpperCase(Parser.CurName) = 'ID1') then VetorUON1[i].id1 := DeCrypt(Parser.CurContent)
1083   - else if (UpperCase(Parser.CurName) = 'NM1') then VetorUON1[i].nm1 := DeCrypt(Parser.CurContent);
1084   - end;
  1128 + strTagName := 'IT1';
  1129 + end
  1130 + else if (Parser.CurPartType = ptEndTag) and (strItemName = 'IT1') then
  1131 + strTagName := ''
  1132 + else if (Parser.CurPartType in [ptContent, ptCData]) and (strTagName='IT1')Then
  1133 + Begin
  1134 + strAux1 := DeCrypt(Parser.CurContent);
  1135 + if (strItemName = 'ID1') then
  1136 + Begin
  1137 + VetorUON1[i].id1 := strAux1;
  1138 + log_DEBUG('Gravei VetorUON1.id1: "'+strAux1+'"');
  1139 + End
  1140 + else if (strItemName = 'NM1') then
  1141 + Begin
  1142 + VetorUON1[i].nm1 := strAux1;
  1143 + log_DEBUG('Gravei VetorUON1.nm1: "'+strAux1+'"');
  1144 + End;
  1145 + End;
  1146 + End;
1085 1147  
1086 1148 // Código para montar o combo 2
1087 1149 Parser.StartScan;
1088   - v_Tag := false;
  1150 + strTagName := '';
  1151 + strAux1 := '';
1089 1152 i := -1;
1090 1153 While Parser.Scan DO
1091   - Begin
1092   - if ((Parser.CurPartType = ptStartTag) and (UpperCase(Parser.CurName) = 'IT2')) Then
  1154 + Begin
  1155 + strItemName := UpperCase(Parser.CurName);
  1156 + if (Parser.CurPartType = ptStartTag) and (strItemName = 'IT1A') Then
1093 1157 Begin
1094   - v_Tag := TRUE;
1095   - i := i + 1;
1096   - SetLength(VetorUON2, i + 1); // Aumento o tamanho da matriz dinamicamente de acordo com o número de itens recebidos.
  1158 + i := i + 1;
  1159 + SetLength(VetorUON1a, i + 1); // Aumento o tamanho da matriz dinamicamente de acordo com o número de itens recebidos.
  1160 + strTagName := 'IT1A';
1097 1161 end
1098   - else if (Parser.CurPartType in [ptContent, ptCData]) and v_Tag Then
1099   - Begin
1100   - boolUON2 := true;
1101   - if (UpperCase(Parser.CurName) = 'ID1') then
1102   - VetorUON2[i].id1 := DeCrypt(Parser.CurContent)
1103   - else if (UpperCase(Parser.CurName) = 'ID2') then
1104   - VetorUON2[i].id2 := DeCrypt(Parser.CurContent)
1105   - else if (UpperCase(Parser.CurName) = 'NM2') then
1106   - VetorUON2[i].nm2 := DeCrypt(Parser.CurContent);
1107   - End;
1108   - end;
  1162 + else if (Parser.CurPartType = ptEndTag) and (strItemName = 'IT1A') then
  1163 + strTagName := ''
  1164 + else if (Parser.CurPartType in [ptContent, ptCData]) and (strTagName='IT1A')Then
  1165 + Begin
  1166 + strAux1 := DeCrypt(Parser.CurContent);
  1167 + if (strItemName = 'ID1') then
  1168 + Begin
  1169 + VetorUON1a[i].id1 := strAux1;
  1170 + log_DEBUG('Gravei VetorUON1a.id1: "'+strAux1+'"');
  1171 + End
  1172 + else if (strItemName = 'SG_LOC') then
  1173 + Begin
  1174 + strAux := ' ('+strAux1 + ')';
  1175 + End
  1176 + else if (strItemName = 'ID1A') then
  1177 + Begin
  1178 + VetorUON1a[i].id1a := strAux1;
  1179 + log_DEBUG('Gravei VetorUON1a.id1a: "'+strAux1+'"');
  1180 + End
  1181 + else if (strItemName = 'NM1A') then
  1182 + Begin
  1183 + VetorUON1a[i].nm1a := strAux1+strAux;
  1184 + log_DEBUG('Gravei VetorUON1a.nm1a: "'+strAux1+strAux+'"');
  1185 + End
  1186 + else if (strItemName = 'ID_LOCAL') then
  1187 + Begin
  1188 + VetorUON1a[i].id_local := strAux1;
  1189 + log_DEBUG('Gravei VetorUON1a.id_local: "'+strAux1+'"');
  1190 + End;
  1191 +
  1192 + End;
  1193 + end;
  1194 +
  1195 + // Código para montar o combo 3
  1196 + Parser.StartScan;
  1197 + strTagName := '';
  1198 + i := -1;
  1199 + While Parser.Scan DO
  1200 + Begin
  1201 + strItemName := UpperCase(Parser.CurName);
  1202 + if (Parser.CurPartType = ptStartTag) and (strItemName = 'IT2') Then
  1203 + Begin
  1204 + i := i + 1;
  1205 + SetLength(VetorUON2, i + 1); // Aumento o tamanho da matriz dinamicamente de acordo com o número de itens recebidos.
  1206 + strTagName := 'IT2';
  1207 + end
  1208 + else if (Parser.CurPartType = ptEndTag) and (strItemName = 'IT2') then
  1209 + strTagName := ''
  1210 + else if (Parser.CurPartType in [ptContent, ptCData]) and (strTagName='IT2')Then
  1211 + Begin
  1212 + strAux1 := DeCrypt(Parser.CurContent);
  1213 + if (strItemName = 'ID1A') then
  1214 + Begin
  1215 + VetorUON2[i].id1a := strAux1;
  1216 + log_DEBUG('Gravei VetorUON2.id1a: "'+strAux1+'"');
  1217 + End
  1218 + else if (strItemName = 'ID2') then
  1219 + Begin
  1220 + VetorUON2[i].id2 := strAux1;
  1221 + log_DEBUG('Gravei VetorUON2.id2: "'+strAux1+'"');
  1222 + End
  1223 + else if (strItemName = 'NM2') then
  1224 + Begin
  1225 + VetorUON2[i].nm2 := strAux1;
  1226 + log_DEBUG('Gravei VetorUON2.nm2: "'+strAux1+'"');
  1227 + End
  1228 + else if (strItemName = 'ID_LOCAL') then
  1229 + Begin
  1230 + VetorUON2[i].id_local := strAux1;
  1231 + log_DEBUG('Gravei VetorUON2.id_local: "'+strAux1+'"');
  1232 + End;
  1233 +
  1234 + End;
  1235 + end;
1109 1236 Parser.Free;
1110   - // Como os itens do combo1 nunca mudam durante a execução do programa (ao contrario do combo2), posso colocar o seu preenchimento aqui mesmo.
  1237 + // Como os itens do combo1 nunca mudam durante a execução do programa (ao contrario dos combo2 e 3), posso colocar o seu preenchimento aqui mesmo.
1111 1238 cb_id_unid_organizacional_nivel1.Items.Clear;
1112 1239 For i := 0 to Length(VetorUON1) - 1 Do
1113 1240 cb_id_unid_organizacional_nivel1.Items.Add(VetorUON1[i].nm1);
  1241 +
  1242 + if (Length(VetorUON1) = 0) then
  1243 + Begin
  1244 + frmMapaCacic.Mensagem('ATENÇÃO! Verifique se esta subrede foi cadastrada no CACIC.',true,intPausaPadrao * 2);
  1245 + Finalizar(true);
  1246 + End;
  1247 +
  1248 + For i := 0 to Length(VetorUON1) - 1 Do
  1249 + Begin
  1250 + Log_DEBUG('VetorUON1['+IntToStr(i)+'].id1='+VetorUON1[i].id1);
  1251 + Log_DEBUG('VetorUON1['+IntToStr(i)+'].nm1='+VetorUON1[i].nm1);
  1252 + End;
  1253 +
  1254 + For i := 0 to Length(VetorUON1a) - 1 Do
  1255 + Begin
  1256 + Log_DEBUG('VetorUON1a['+IntToStr(i)+'].id1='+VetorUON1a[i].id1);
  1257 + Log_DEBUG('VetorUON1a['+IntToStr(i)+'].id1a='+VetorUON1a[i].id1a);
  1258 + Log_DEBUG('VetorUON1a['+IntToStr(i)+'].nm1a='+VetorUON1a[i].nm1a);
  1259 + Log_DEBUG('VetorUON1a['+IntToStr(i)+'].id_local='+VetorUON1a[i].id_local);
  1260 + End;
  1261 +
  1262 + For i := 0 to Length(VetorUON2) - 1 Do
  1263 + Begin
  1264 + Log_DEBUG('VetorUON2['+IntToStr(i)+'].id1a='+VetorUON2[i].id1a);
  1265 + Log_DEBUG('VetorUON2['+IntToStr(i)+'].id2='+VetorUON2[i].id2);
  1266 + Log_DEBUG('VetorUON2['+IntToStr(i)+'].nm2='+VetorUON2[i].nm2);
  1267 + Log_DEBUG('VetorUON2['+IntToStr(i)+'].id_local='+VetorUON2[i].id_local);
  1268 + End;
1114 1269 end;
1115 1270  
1116 1271  
1117 1272 procedure TfrmMapaCacic.cb_id_unid_organizacional_nivel1Change(Sender: TObject);
1118 1273 var i, j: Word;
1119   - strAux : String;
  1274 + strIdUON1 : String;
1120 1275 begin
1121   - if boolUON2 then
1122   - Begin
  1276 + log_DEBUG('Nível 1 CHANGE');
1123 1277 // Filtro os itens do combo2, de acordo com o item selecionado no combo1
1124   - strAux := VetorUON1[cb_id_unid_organizacional_nivel1.ItemIndex].id1;
  1278 + strIdUON1 := VetorUON1[cb_id_unid_organizacional_nivel1.ItemIndex].id1;
  1279 + cb_id_unid_organizacional_nivel1a.Items.Clear;
1125 1280 cb_id_unid_organizacional_nivel2.Items.Clear;
  1281 + cb_id_unid_organizacional_nivel1a.Enabled := false;
  1282 + cb_id_unid_organizacional_nivel2.Enabled := false;
  1283 + SetLength(VetorUON1aFiltrado, 0);
  1284 +
  1285 + log_DEBUG('Tamanho de VetorUON1..: '+IntToStr(Length(VetorUON1)));
  1286 + log_DEBUG('ItemIndex de cb_nivel1: '+IntToStr(cb_id_unid_organizacional_nivel1.ItemIndex));
  1287 + log_DEBUG('Tamanho de VetorUON1a.: '+IntToStr(Length(VetorUON1a)));
  1288 + For i := 0 to Length(VetorUON1a) - 1 Do
  1289 + Begin
  1290 + Try
  1291 + if VetorUON1a[i].id1 = strIdUON1 then
  1292 + Begin
  1293 + log_DEBUG('Add em cb_nivel1a: '+VetorUON1a[i].nm1a);
  1294 + cb_id_unid_organizacional_nivel1a.Items.Add(VetorUON1a[i].nm1a);
  1295 + j := Length(VetorUON1aFiltrado);
  1296 + SetLength(VetorUON1aFiltrado, j + 1);
  1297 + VetorUON1aFiltrado[j] := VetorUON1a[i].id1a + '#' +VetorUON1a[i].id_local;
  1298 + log_DEBUG('VetorUON1aFiltrado['+IntToStr(j)+']= '+VetorUON1aFiltrado[j]);
  1299 + end;
  1300 + Except
  1301 + End;
  1302 + end;
  1303 + if (cb_id_unid_organizacional_nivel1a.Items.Count > 0) then
  1304 + Begin
  1305 + cb_id_unid_organizacional_nivel1a.Enabled := true;
  1306 + cb_id_unid_organizacional_nivel1a.ItemIndex := 0;
  1307 + log_DEBUG('Provocando CHANGE em nivel1a');
  1308 + cb_id_unid_organizacional_nivel1aChange(nil);
  1309 + End;
  1310 +end;
  1311 +
  1312 +procedure TfrmMapaCacic.cb_id_unid_organizacional_nivel1aChange(
  1313 + Sender: TObject);
  1314 +var i, j: Word;
  1315 + strIdUON1a,
  1316 + strIdLocal : String;
  1317 + intAux : integer;
  1318 + tstrAux : TStrings;
  1319 +begin
  1320 + log_DEBUG('Nível 1a CHANGE');
  1321 + // Filtro os itens do combo2, de acordo com o item selecionado no combo1
  1322 + //intAux := IfThen(cb_id_unid_organizacional_nivel1a.Items.Count > 1,cb_id_unid_organizacional_nivel1a.ItemIndex+1,0);
  1323 + intAux := cb_id_unid_organizacional_nivel1a.ItemIndex;
  1324 + Log_debug('cb_id_unid_organizacional_nivel1a.ItemIndex = '+intToStr(cb_id_unid_organizacional_nivel1a.ItemIndex));
  1325 +
  1326 + tstrAux := TStrings.Create;
  1327 + tstrAux := Explode(VetorUON1aFiltrado[cb_id_unid_organizacional_nivel1a.ItemIndex],'#');
  1328 +
  1329 + strIdUON1a := tstrAux[0];
  1330 + strIdLocal := tstrAux[1];
  1331 +
  1332 + Log_debug('strIdLocal = '+strIdLocal);
  1333 + cb_id_unid_organizacional_nivel2.Items.Clear;
  1334 + cb_id_unid_organizacional_nivel2.Enabled := false;
1126 1335 SetLength(VetorUON2Filtrado, 0);
1127 1336  
  1337 + log_DEBUG('Tamanho de VetorUON1a..: '+IntToStr(Length(VetorUON1a)));
  1338 + log_DEBUG('ItemIndex de cb_nivel1a: '+IntToStr(cb_id_unid_organizacional_nivel1a.ItemIndex));
  1339 + log_DEBUG('Tamanho de VetorUON2...: '+IntToStr(Length(VetorUON2)));
  1340 +
1128 1341 For i := 0 to Length(VetorUON2) - 1 Do
1129 1342 Begin
1130 1343 Try
1131   - if VetorUON2[i].id1 = strAux then
  1344 + if (VetorUON2[i].id1a = strIdUON1a) and
  1345 + (VetorUON2[i].id_local = strIdLocal) then
1132 1346 Begin
  1347 + log_DEBUG('Add em cb_nivel2: '+VetorUON2[i].nm2);
1133 1348 cb_id_unid_organizacional_nivel2.Items.Add(VetorUON2[i].nm2);
1134 1349 j := Length(VetorUON2Filtrado);
1135 1350 SetLength(VetorUON2Filtrado, j + 1);
1136   - VetorUON2Filtrado[j] := VetorUON2[i].id2;
  1351 + VetorUON2Filtrado[j] := VetorUON2[i].id2 + '#' + VetorUON2[i].id_local;
  1352 + log_DEBUG('VetorUON2Filtrado['+IntToStr(j)+']= '+VetorUON2Filtrado[j]);
1137 1353 end;
1138 1354 Except
1139 1355 End;
1140 1356 end;
1141   - End
1142   - else
1143   - Mensagem('ATENÇÃO! Não Existe '+frmMapaCacic.lbEtiqueta2.Caption+' Associado a '+VetorUON1[cb_id_unid_organizacional_nivel1.ItemIndex].nm1+'. Procure um supervisor do sistema.',true);
  1357 + if (cb_id_unid_organizacional_nivel2.Items.Count > 0) then
  1358 + Begin
  1359 + cb_id_unid_organizacional_nivel2.Enabled := true;
  1360 + cb_id_unid_organizacional_nivel2.ItemIndex := 0;
  1361 + End;
1144 1362 end;
1145 1363  
1146 1364  
1147 1365 procedure TfrmMapaCacic.AtualizaPatrimonio(Sender: TObject);
1148   -var strAux1,
1149   - strAux2,
1150   - strRetorno : String;
1151   - Request_mapa : TStringList;
  1366 +var strIdUON1,
  1367 + strIdUON1a,
  1368 + strIdUON2,
  1369 + strIdLocal,
  1370 + strRetorno : String;
  1371 + tstrListAux : TStringList;
  1372 + tstrAux : TStrings;
1152 1373 begin
  1374 + tstrAux := TStrings.Create;
  1375 + tstrAux := explode(VetorUON2Filtrado[cb_id_unid_organizacional_nivel2.ItemIndex],'#');
  1376 + Try
  1377 + strIdUON1 := VetorUON1[cb_id_unid_organizacional_nivel1.ItemIndex].id1;
  1378 + strIdUON2 := tstrAux[0];
  1379 + strIdLocal := tstrAux[1];
  1380 + Except
  1381 + end;
  1382 +
  1383 + tstrAux := explode(VetorUON1aFiltrado[cb_id_unid_organizacional_nivel1a.ItemIndex],'#');
1153 1384 Try
1154   - strAux1 := VetorUON1[cb_id_unid_organizacional_nivel1.ItemIndex].id1;
1155   - strAux2 := VetorUON2Filtrado[cb_id_unid_organizacional_nivel2.ItemIndex];
  1385 + strIdUON1a := tstrAux[0];
1156 1386 Except
1157 1387 end;
  1388 +
  1389 + tstrAux.Free;
  1390 +
1158 1391 // Assim, o envio será incondicional! - 01/12/2006 - Anderson Peterle
1159   -// if (strAux1 <> var_id_unid_organizacional_nivel1) or
1160   -// (strAux2 <> var_id_unid_organizacional_nivel2) or
1161   -// (ed_te_localizacao_complementar.Text <> var_te_localizacao_complementar) or
1162   -// (ed_te_info_patrimonio1.Text <> var_te_info_patrimonio1) or
1163   -// (ed_te_info_patrimonio2.Text <> var_te_info_patrimonio2) or
1164   -// (ed_te_info_patrimonio3.Text <> var_te_info_patrimonio3) or
1165   -// (ed_te_info_patrimonio4.Text <> var_te_info_patrimonio4) or
1166   -// (ed_te_info_patrimonio5.Text <> var_te_info_patrimonio5) or
1167   -// (ed_te_info_patrimonio6.Text <> var_te_info_patrimonio6) then
  1392 +// if (strAux1 <> strId_unid_organizacional_nivel1) or
  1393 +// (strAux2 <> strId_unid_organizacional_nivel2) or
  1394 +// (ed_te_localizacao_complementar.Text <> strTe_localizacao_complementar) or
  1395 +// (ed_te_info_patrimonio1.Text <> strTe_info_patrimonio1) or
  1396 +// (ed_te_info_patrimonio2.Text <> strTe_info_patrimonio2) or
  1397 +// (ed_te_info_patrimonio3.Text <> strTe_info_patrimonio3) or
  1398 +// (ed_te_info_patrimonio4.Text <> strTe_info_patrimonio4) or
  1399 +// (ed_te_info_patrimonio5.Text <> strTe_info_patrimonio5) or
  1400 +// (ed_te_info_patrimonio6.Text <> strTe_info_patrimonio6) then
1168 1401 // begin
1169 1402  
1170   - Mensagem('Enviando Informações Coletadas ao Banco de Dados...',false);
  1403 + Mensagem('Enviando Informações Coletadas ao Banco de Dados...',false,intPausaPadrao div 3);
1171 1404  
1172 1405 // Envio dos Dados Coletados ao Banco de Dados
1173   - Request_mapa := TStringList.Create;
1174   - Request_mapa.Values['te_node_address'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , 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);
1177   - Request_mapa.Values['id_ip_rede'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.ID_IP_REDE' , frmMapaCacic.tStringsCipherOpened));
1178   - Request_mapa.Values['te_ip'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_IP' , frmMapaCacic.tStringsCipherOpened));
1179   - Request_mapa.Values['te_nome_computador'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR' , frmMapaCacic.tStringsCipherOpened));
1180   - Request_mapa.Values['te_workgroup'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_WORKGROUP' , frmMapaCacic.tStringsCipherOpened));
1181   - Request_mapa.Values['id_usuario'] := frmMapaCacic.EnCrypt(frmMapaCacic.strId_usuario);
1182   -
1183   - Request_mapa.Values['id_unid_organizacional_nivel1'] := frmMapaCacic.EnCrypt(strAux1);
1184   - Request_mapa.Values['id_unid_organizacional_nivel2'] := frmMapaCacic.EnCrypt(strAux2);
1185   - Request_mapa.Values['te_localizacao_complementar' ] := frmMapaCacic.EnCrypt(ed_te_localizacao_complementar.Text);
1186   - Request_mapa.Values['te_info_patrimonio1' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio1.Text);
1187   - Request_mapa.Values['te_info_patrimonio2' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio2.Text);
1188   - Request_mapa.Values['te_info_patrimonio3' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio3.Text);
1189   - Request_mapa.Values['te_info_patrimonio4' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio4.Text);
1190   - Request_mapa.Values['te_info_patrimonio5' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio5.Text);
1191   - Request_mapa.Values['te_info_patrimonio6' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio6.Text);
1192   -
1193   - strRetorno := frmMapaCacic.ComunicaServidor('mapa_set_patrimonio.php', Request_mapa, '');
1194   - Request_mapa.Free;
  1406 + tstrListAux := TStringList.Create;
  1407 + tstrListAux.Values['te_node_address'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCipherOpened));
  1408 + tstrListAux.Values['id_so'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('Configs.ID_SO' , frmMapaCacic.tStringsCipherOpened));
  1409 + tstrListAux.Values['te_so'] := frmMapaCacic.EnCrypt(str_te_so);
  1410 + tstrListAux.Values['id_ip_rede'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.ID_IP_REDE' , frmMapaCacic.tStringsCipherOpened));
  1411 + tstrListAux.Values['te_ip'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_IP' , frmMapaCacic.tStringsCipherOpened));
  1412 + tstrListAux.Values['te_nome_computador'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR' , frmMapaCacic.tStringsCipherOpened));
  1413 + tstrListAux.Values['te_workgroup'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_WORKGROUP' , frmMapaCacic.tStringsCipherOpened));
  1414 + tstrListAux.Values['id_usuario'] := frmMapaCacic.EnCrypt(frmMapaCacic.strId_usuario);
  1415 +
  1416 + tstrListAux.Values['id_unid_organizacional_nivel1'] := frmMapaCacic.EnCrypt(strIdUON1);
  1417 + tstrListAux.Values['id_unid_organizacional_nivel1a']:= frmMapaCacic.EnCrypt(strIdUON1A);
  1418 + tstrListAux.Values['id_unid_organizacional_nivel2'] := frmMapaCacic.EnCrypt(strIdUON2);
  1419 + tstrListAux.Values['te_localizacao_complementar' ] := frmMapaCacic.EnCrypt(ed_te_localizacao_complementar.Text);
  1420 + tstrListAux.Values['te_info_patrimonio1' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio1.Text);
  1421 + tstrListAux.Values['te_info_patrimonio2' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio2.Text);
  1422 + tstrListAux.Values['te_info_patrimonio3' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio3.Text);
  1423 + tstrListAux.Values['te_info_patrimonio4' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio4.Text);
  1424 + tstrListAux.Values['te_info_patrimonio5' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio5.Text);
  1425 + tstrListAux.Values['te_info_patrimonio6' ] := frmMapaCacic.EnCrypt(ed_te_info_patrimonio6.Text);
  1426 +
  1427 + log_DEBUG('Informações para contato com mapa_set_patrimonio:');
  1428 + log_DEBUG('te_node_address: '+tstrListAux.Values['te_node_address']);
  1429 + log_DEBUG('id_so: '+tstrListAux.Values['id_so']);
  1430 + log_DEBUG('te_so: '+tstrListAux.Values['te_so']);
  1431 + log_DEBUG('id_ip_rede: '+tstrListAux.Values['id_ip_rede']);
  1432 + log_DEBUG('te_ip: '+tstrListAux.Values['te_ip']);
  1433 + log_DEBUG('te_nome_computador: '+tstrListAux.Values['te_nome_computador']);
  1434 + log_DEBUG('te_workgroup: '+tstrListAux.Values['te_workgroup']);
  1435 +
  1436 + strRetorno := frmMapaCacic.ComunicaServidor('mapa_set_patrimonio.php', tstrListAux, '');
  1437 + tstrListAux.Free;
1195 1438  
1196 1439 if not (frmMapaCacic.XML_RetornaValor('STATUS', strRetorno)='OK') then
1197   - Mensagem('ATENÇÃO: PROBLEMAS NO ENVIO DAS INFORMAÇÕES COLETADAS AO BANCO DE DADOS...',true);
  1440 + Mensagem('ATENÇÃO: PROBLEMAS NO ENVIO DAS INFORMAÇÕES COLETADAS AO BANCO DE DADOS...',true,intPausaPadrao);
1198 1441 // else
1199 1442 // Begin
1200   - Mensagem('Salvando Informações Coletadas em Base Local...',false);
1201   - SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1', strAux1, tStringsCipherOpened);
1202   - SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2', strAux2, tStringsCipherOpened);
  1443 + Mensagem('Salvando Informações Coletadas em Base Local...',false,intPausaPadrao div 3);
  1444 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1', strIdUON1, tStringsCipherOpened);
  1445 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1a', strIdUON1a, tStringsCipherOpened);
  1446 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2' , strIdUON2, tStringsCipherOpened);
  1447 + SetValorDatMemoria('Patrimonio.id_local' , strIdLocal, tStringsCipherOpened);
1203 1448 SetValorDatMemoria('Patrimonio.te_localizacao_complementar' , ed_te_localizacao_complementar.Text, tStringsCipherOpened);
1204 1449 SetValorDatMemoria('Patrimonio.te_info_patrimonio1' , ed_te_info_patrimonio1.Text, tStringsCipherOpened);
1205 1450 SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio1', ed_te_info_patrimonio1.Text);
... ... @@ -1219,13 +1464,18 @@ end;
1219 1464  
1220 1465 procedure TfrmMapaCacic.MontaInterface(p_strConfigs : String);
1221 1466 Begin
1222   - Mensagem('Montando Interface para Coleta de Informações...',false);
  1467 + Mensagem('Montando Interface para Coleta de Informações...',false,intPausaPadrao div 3);
1223 1468  
1224 1469 lbEtiqueta1.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta1', p_strConfigs));
1225 1470 lbEtiqueta1.Visible := true;
1226 1471 cb_id_unid_organizacional_nivel1.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta1', p_strConfigs));
1227 1472 cb_id_unid_organizacional_nivel1.Visible := true;
1228 1473  
  1474 + lbEtiqueta1a.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta1a', p_strConfigs));
  1475 + lbEtiqueta1a.Visible := true;
  1476 + cb_id_unid_organizacional_nivel1a.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta1a', p_strConfigs));
  1477 + cb_id_unid_organizacional_nivel1a.Visible := true;
  1478 +
1229 1479 lbEtiqueta2.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta2', p_strConfigs));
1230 1480 lbEtiqueta2.Visible := true;
1231 1481 cb_id_unid_organizacional_nivel2.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta2', p_strConfigs));
... ... @@ -1233,7 +1483,7 @@ Begin
1233 1483  
1234 1484 lbEtiqueta3.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta3', p_strConfigs));
1235 1485 lbEtiqueta3.Visible := true;
1236   - ed_te_localizacao_complementar.Text := var_te_localizacao_complementar;
  1486 + ed_te_localizacao_complementar.Text := strTe_localizacao_complementar;
1237 1487 ed_te_localizacao_complementar.Visible := true;
1238 1488  
1239 1489 if (DeCrypt(XML.XML_RetornaValor('in_exibir_etiqueta4', p_strConfigs)) = 'S') then
... ... @@ -1241,7 +1491,7 @@ Begin
1241 1491 lbEtiqueta4.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta4', p_strConfigs));
1242 1492 lbEtiqueta4.Visible := true;
1243 1493 ed_te_info_patrimonio1.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta4', p_strConfigs));
1244   - ed_te_info_patrimonio1.Text := var_te_info_patrimonio1;
  1494 + ed_te_info_patrimonio1.Text := strTe_info_patrimonio1;
1245 1495 ed_te_info_patrimonio1.visible := True;
1246 1496 end;
1247 1497  
... ... @@ -1250,7 +1500,7 @@ Begin
1250 1500 lbEtiqueta5.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta5', p_strConfigs));
1251 1501 lbEtiqueta5.Visible := true;
1252 1502 ed_te_info_patrimonio2.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta5', p_strConfigs));
1253   - ed_te_info_patrimonio2.Text := var_te_info_patrimonio2;
  1503 + ed_te_info_patrimonio2.Text := strTe_info_patrimonio2;
1254 1504 ed_te_info_patrimonio2.visible := True;
1255 1505 end;
1256 1506  
... ... @@ -1259,7 +1509,7 @@ Begin
1259 1509 lbEtiqueta6.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta6', p_strConfigs));
1260 1510 lbEtiqueta6.Visible := true;
1261 1511 ed_te_info_patrimonio3.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta6', p_strConfigs));
1262   - ed_te_info_patrimonio3.Text := var_te_info_patrimonio3;
  1512 + ed_te_info_patrimonio3.Text := strTe_info_patrimonio3;
1263 1513 ed_te_info_patrimonio3.visible := True;
1264 1514 end;
1265 1515  
... ... @@ -1268,7 +1518,7 @@ Begin
1268 1518 lbEtiqueta7.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta7', p_strConfigs));
1269 1519 lbEtiqueta7.Visible := true;
1270 1520 ed_te_info_patrimonio4.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta7', p_strConfigs));
1271   - ed_te_info_patrimonio4.Text := var_te_info_patrimonio4;
  1521 + ed_te_info_patrimonio4.Text := strTe_info_patrimonio4;
1272 1522 ed_te_info_patrimonio4.visible := True;
1273 1523 end;
1274 1524  
... ... @@ -1277,7 +1527,7 @@ Begin
1277 1527 lbEtiqueta8.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta8', p_strConfigs));
1278 1528 lbEtiqueta8.Visible := true;
1279 1529 ed_te_info_patrimonio5.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta8', p_strConfigs));
1280   - ed_te_info_patrimonio5.Text := var_te_info_patrimonio5;
  1530 + ed_te_info_patrimonio5.Text := strTe_info_patrimonio5;
1281 1531 ed_te_info_patrimonio5.visible := True;
1282 1532 end;
1283 1533  
... ... @@ -1286,10 +1536,10 @@ Begin
1286 1536 lbEtiqueta9.Caption := DeCrypt(XML.XML_RetornaValor('te_etiqueta9', p_strConfigs));
1287 1537 lbEtiqueta9.Visible := true;
1288 1538 ed_te_info_patrimonio6.Hint := DeCrypt(XML.XML_RetornaValor('te_help_etiqueta9', p_strConfigs));
1289   - ed_te_info_patrimonio6.Text := var_te_info_patrimonio6;
  1539 + ed_te_info_patrimonio6.Text := strTe_info_patrimonio6;
1290 1540 ed_te_info_patrimonio6.visible := True;
1291 1541 end;
1292   - Mensagem('',false);
  1542 + Mensagem('',false,0);
1293 1543 btGravarInformacoes.Visible := true;
1294 1544 end;
1295 1545  
... ... @@ -1482,7 +1732,6 @@ begin
1482 1732 strConfigs := GetValorDatMemoria('Patrimonio.Configs', frmMapaCacic.tStringsCipherOpened);
1483 1733 gbLeiaComAtencao.Visible := true;
1484 1734 gbInformacoesSobreComputador.Visible := true;
1485   - boolUON2 := false; // Inicializo com false e torno true quando da montagem da combo de UON2...
1486 1735 MontaCombos(strConfigs);
1487 1736 RecuperaValoresAnteriores(strConfigs);
1488 1737 MontaInterface(strConfigs);
... ... @@ -1497,7 +1746,8 @@ var intAux : integer;
1497 1746 strRetorno : String;
1498 1747 Request_mapa : TStringList;
1499 1748 begin
1500   - frmMapaCacic.lbVersao.Caption := 'v: ' + frmMapaCacic.GetVersionInfo(ParamStr(0));
  1749 + frmMapaCacic.lbVersao.Caption := 'Versão: ' + frmMapaCacic.GetVersionInfo(ParamStr(0));
  1750 + log_DEBUG('Versão do MapaCacic: '+frmMapaCacic.lbVersao.Caption);
1501 1751 if (GetWinVer > 5) and not IsAdmin then
1502 1752 Begin
1503 1753 MessageDLG(#13#10+'ATENÇÃO! Essa aplicação requer execução com nível administrativo.',mtError,[mbOK],0);
... ... @@ -1547,7 +1797,7 @@ begin
1547 1797 else
1548 1798 Begin
1549 1799 pnMensagens.Visible := true;
1550   - Mensagem('Efetuando Comunicação com o Módulo Gerente WEB em "'+GetValorDatMemoria('Configs.EnderecoServidor', tStringsCipherOpened)+'"...',false);
  1800 + Mensagem('Efetuando Comunicação com o Módulo Gerente WEB em "'+GetValorDatMemoria('Configs.EnderecoServidor', tStringsCipherOpened)+'"...',false,intPausaPadrao div 3);
1551 1801 frmAcesso.Free;
1552 1802  
1553 1803 // Povoamento com dados de configurações da interface patrimonial
... ... @@ -1560,18 +1810,20 @@ begin
1560 1810 Request_mapa.Values['te_ip'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_IP' , frmMapaCacic.tStringsCipherOpened));
1561 1811 Request_mapa.Values['te_nome_computador']:= frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', frmMapaCacic.tStringsCipherOpened));
1562 1812 Request_mapa.Values['te_workgroup'] := frmMapaCacic.EnCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_WORKGROUP' , frmMapaCacic.tStringsCipherOpened));
  1813 + Request_mapa.Values['id_usuario'] := frmMapaCacic.EnCrypt(frmMapaCacic.strId_usuario);
1563 1814  
1564 1815 strRetorno := frmMapaCacic.ComunicaServidor('mapa_get_patrimonio.php', Request_mapa, '.');
1565 1816  
  1817 + log_DEBUG('Retorno: "'+strRetorno+'"');
  1818 +
1566 1819 if (frmMapaCacic.XML_RetornaValor('STATUS', strRetorno)='OK') then
1567 1820 Begin
1568   - Mensagem('Comunicação Efetuada com Sucesso! Salvando Configurações Obtidas...',false);
  1821 + Mensagem('Comunicação Efetuada com Sucesso! Salvando Configurações Obtidas...',false,intPausaPadrao div 3);
1569 1822 frmMapaCacic.SetValorDatMemoria('Patrimonio.Configs', strRetorno, frmMapaCacic.tStringsCipherOpened)
1570 1823 End
1571 1824 else
1572 1825 Begin
1573   - Mensagem('PROBLEMAS NA COMUNICAÇÃO COM O MÓDULO GERENTE WEB...',true);
1574   - sleep(3);
  1826 + Mensagem('PROBLEMAS NA COMUNICAÇÃO COM O MÓDULO GERENTE WEB...',true,intPausaPadrao);
1575 1827 Finalizar(true);
1576 1828 End;
1577 1829  
... ... @@ -1592,4 +1844,5 @@ begin
1592 1844  
1593 1845 end;
1594 1846  
  1847 +
1595 1848 end.
... ...
mapa/mapacacic.dof
... ... @@ -115,7 +115,7 @@ AutoIncBuild=0
115 115 MajorVer=1
116 116 MinorVer=0
117 117 Release=0
118   -Build=4
  118 +Build=11
119 119 Debug=0
120 120 PreRelease=0
121 121 Special=0
... ... @@ -126,13 +126,13 @@ CodePage=1252
126 126 [Version Info Keys]
127 127 CompanyName=Dataprev-ES
128 128 FileDescription=MapaCacic - Módulo Avulso para Coleta de Informações Patrimoniais para o Sistema CACIC
129   -FileVersion=1.0.0.4
  129 +FileVersion=1.0.0.11
130 130 InternalName=
131 131 LegalCopyright=
132 132 LegalTrademarks=
133 133 OriginalFilename=
134 134 ProductName=
135   -ProductVersion=1.0.0.4
  135 +ProductVersion=1.0.0.11
136 136 Comments=Baseado na Licença GPL(General Public License)
137 137 [HistoryLists\hlDebugSourcePath]
138 138 Count=1
... ...
mapa/mapacacic.res
No preview for this file type
mapa/xml.pas
... ... @@ -3,7 +3,7 @@ unit XML;
3 3  
4 4 interface
5 5  
6   -Uses LibXmlParser, SysUtils, dialogs;
  6 +Uses LibXmlParser, SysUtils;
7 7  
8 8 Function XML_RetornaValor(Tag : String; Fonte : String) : String;
9 9  
... ...