Commit 1484da027fd29076177de03c98925c664512fc6a

Authored by anderson.peterle@previdencia.gov.br
1 parent 4736288a
Exists in master

Atualizacao de repositorio para criacao de pacote de instalacao para versao 2.6.0

git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@890 fecfc0c7-e812-0410-ae72-849f08638ee7
CACIC_Library.pas
... ... @@ -54,7 +54,9 @@ uses
54 54 MD5,
55 55 DCPcrypt2,
56 56 DCPrijndael,
57   - DCPbase64;
  57 + DCPbase64,
  58 + ActiveX,
  59 + ComObj;
58 60 type
59 61  
60 62 { ------------------------------------------------------------------------------
... ... @@ -104,6 +106,7 @@ type
104 106 function isWindowsAdmin() : boolean;
105 107 function createSampleProcess(p_cmd: string; p_wait: boolean; p_showWindow : word = SW_HIDE): boolean;
106 108 procedure showTrayIcon(p_visible:boolean);
  109 + procedure addApplicationToFirewall(p_EntryName:string;p_ApplicationPathAndExe:string; p_Enabled : boolean);
107 110 end;
108 111  
109 112 {*------------------------------------------------------------------------------
... ... @@ -248,6 +251,39 @@ begin
248 251 end;
249 252  
250 253 {*------------------------------------------------------------------------------
  254 + Insere exceção na FireWall nativa do MS-Windows
  255 +
  256 + @param p_EntryName String Nome da exceção
  257 + @param p_ApplicationPathAndExe String Caminho e nome da aplicação
  258 + @param p_Enabled Boolean Estado da exceção
  259 +-------------------------------------------------------------------------------}
  260 +procedure TCACIC_Windows.addApplicationToFirewall(p_EntryName:string;p_ApplicationPathAndExe:string; p_Enabled : boolean);
  261 +var fwMgr,app:OleVariant;
  262 + profile:OleVariant;
  263 +Const NET_FW_PROFILE_DOMAIN = 0;
  264 + NET_FW_PROFILE_STANDARD = 1;
  265 + NET_FW_IP_VERSION_ANY = 2;
  266 + NET_FW_IP_PROTOCOL_UDP = 17;
  267 + NET_FW_IP_PROTOCOL_TCP = 6;
  268 + NET_FW_SCOPE_ALL = 0;
  269 + NET_FW_SCOPE_LOCAL_SUBNET = 1;
  270 +begin
  271 + CoInitialize(nil);
  272 +
  273 + fwMgr := CreateOLEObject('HNetCfg.FwMgr');
  274 + profile := fwMgr.LocalPolicy.CurrentProfile;
  275 + app := CreateOLEObject('HNetCfg.FwAuthorizedApplication');
  276 + app.ProcessImageFileName := p_ApplicationPathAndExe;
  277 + app.Name := p_EntryName;
  278 + app.Scope := NET_FW_SCOPE_ALL;
  279 + app.IpVersion := NET_FW_IP_VERSION_ANY;
  280 + app.Enabled := p_Enabled;
  281 + profile.AuthorizedApplications.Add(app);
  282 +
  283 + CoUninitialize;
  284 +end;
  285 +
  286 +{*------------------------------------------------------------------------------
251 287 Retorna array de elementos com base em separador
252 288  
253 289 @param p_String String contendo campos e valores separados por caracter ou string
... ... @@ -890,3 +926,4 @@ begin
890 926 end;
891 927  
892 928 end.
  929 +
... ...
cacic2.res
No preview for this file type
cacicservice/CACICsvc.res
No preview for this file type
cacicservice/CACICsvcMain.pas
... ... @@ -26,12 +26,25 @@ uses
26 26 SvcMgr,
27 27 strUtils,
28 28 ExtCtrls,
29   - CACIC_Library;
  29 + CACIC_Library,
  30 + Psapi,
  31 + tlhelp32,
  32 + JwaWinNT, { As units com prefixo Jwa constam do Pacote Jedi_API22a }
  33 + JwaWinBase, { que pode ser obtido em http://sourceforge.net/projects/jedi-apilib/files/JEDI%20Windows%20API/JEDI%20API%202.2a%20and%20WSCL%200.9.2a/jedi_api22a_jwscl092a.zip/download }
  34 + JwaWtsApi32,
  35 + JwaWinSvc,
  36 + JwaWinType,
  37 + JwaNtStatus;
30 38  
31 39 var
32 40 boolStarted : boolean;
33 41 g_oCacic : TCACIC;
34 42  
  43 +//
  44 +const
  45 + SE_DEBUG_NAME = 'SeDebugPrivilege';
  46 +//
  47 +
35 48 type
36 49 TCACICservice = class(TService)
37 50 Timer_CHKsis: TTimer;
... ... @@ -47,6 +60,7 @@ type
47 60 procedure logDEBUG(Msg : String);
48 61 Procedure WMEndSession(var Msg : TWMEndSession) ; message WM_ENDSESSION;
49 62 procedure ExecutaCACIC;
  63 + function startapp : integer;
50 64 public
51 65 { Public declarations }
52 66  
... ... @@ -56,9 +70,154 @@ type
56 70 var
57 71 CACICservice: TCACICservice;
58 72  
  73 +function CreateEnvironmentBlock(var lpEnvironment: Pointer;
  74 + hToken: THandle;
  75 + bInherit: BOOL): BOOL; stdcall; external 'userenv';
  76 +function DestroyEnvironmentBlock(pEnvironment: Pointer): BOOL; stdcall; external 'userenv';
  77 +
59 78 implementation
60 79  
61 80 {$R *.DFM}
  81 +
  82 +// Solução adaptada a partir do exemplo contido em http://www.codeproject.com/KB/vista-security/VistaSessions.aspx?msg=2750630
  83 +// para execução a partir de token do WinLogon, possibilitando a exibição do ícone da aplicação na bandeja do systray em
  84 +// plataforma MS-VISTA.
  85 +function TCACICservice.startapp : integer;
  86 +var
  87 + pi : PROCESS_INFORMATION;
  88 + si : STARTUPINFO;
  89 + bresult : boolean;
  90 + dwSessionId,winlogonPid : DWORD;
  91 + hUserToken,hUserTokenDup,hPToken,hProcess,hsnap : THANDLE;
  92 + dwCreationFlags : DWORD;
  93 + procEntry : TPROCESSENTRY32;
  94 + winlogonSessId : DWORD;
  95 + tp : TOKEN_PRIVILEGES;
  96 + // luid : TLargeInteger;
  97 + abcd, abc, dup : integer;
  98 + lpenv : pointer;
  99 + iResultOfCreateProcessAsUser : integer;
  100 +
  101 +begin
  102 + Result := 0;
  103 + bresult := false;
  104 +
  105 + //TOKEN_ADJUST_SESSIONID := 256;
  106 +
  107 + // Log the client on to the local computer.
  108 +
  109 +
  110 + dwSessionId := WTSGetActiveConsoleSessionId();
  111 + hSnap := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  112 + if (hSnap = INVALID_HANDLE_VALUE) then
  113 + begin
  114 + result := 1;
  115 + exit;
  116 + end;
  117 +
  118 + procEntry.dwSize := sizeof(TPROCESSENTRY32);
  119 +
  120 + if (not Process32First(hSnap, procEntry)) then
  121 + begin
  122 + result := 1;
  123 + exit;
  124 + end;
  125 +
  126 + repeat
  127 + if (comparetext(procEntry.szExeFile, 'winlogon.exe') = 0) then
  128 + begin
  129 + // We found a winlogon process...
  130 +
  131 + // make sure it's running in the console session
  132 +
  133 + winlogonSessId := 0;
  134 + if (ProcessIdToSessionId(procEntry.th32ProcessID, winlogonSessId) and (winlogonSessId = dwSessionId)) then
  135 + begin
  136 + winlogonPid := procEntry.th32ProcessID;
  137 + break;
  138 + end;
  139 + end;
  140 +
  141 + until (not Process32Next(hSnap, procEntry));
  142 +
  143 + ////////////////////////////////////////////////////////////////////////
  144 +
  145 + WTSQueryUserToken(dwSessionId, hUserToken);
  146 + dwCreationFlags := NORMAL_PRIORITY_CLASS or CREATE_NEW_CONSOLE;
  147 + ZeroMemory(@si, sizeof(STARTUPINFO));
  148 + si.cb := sizeof(STARTUPINFO);
  149 + si.lpDesktop := 'winsta0\default';
  150 + ZeroMemory(@pi, sizeof(pi));
  151 + hProcess := OpenProcess(MAXIMUM_ALLOWED,FALSE,winlogonPid);
  152 +
  153 + if(not OpenProcessToken(hProcess,TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY
  154 + or TOKEN_DUPLICATE or TOKEN_ASSIGN_PRIMARY or TOKEN_ADJUST_SESSIONID
  155 + or TOKEN_READ or TOKEN_WRITE, hPToken)) then
  156 + begin
  157 + abcd := GetLastError();
  158 + logDEBUG('Process token open Error: ' + inttostr(GetLastError()));
  159 + end;
  160 +
  161 + if (not LookupPrivilegeValue(nil,SE_DEBUG_NAME,tp.Privileges[0].Luid)) then
  162 + begin
  163 + logDEBUG('Lookup Privilege value Error: ' + inttostr(GetLastError()));
  164 + end;
  165 +
  166 + tp.PrivilegeCount := 1;
  167 + tp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
  168 +
  169 + DuplicateTokenEx(hPToken,MAXIMUM_ALLOWED,Nil,SecurityIdentification,TokenPrimary,hUserTokenDup);
  170 + dup := GetLastError();
  171 +
  172 + // Adjust Token privilege
  173 +
  174 + SetTokenInformation(hUserTokenDup,TokenSessionId,pointer(dwSessionId),sizeof(DWORD));
  175 +
  176 + if (not AdjustTokenPrivileges(hUserTokenDup,FALSE,@tp,sizeof(TOKEN_PRIVILEGES),nil,nil)) then
  177 + begin
  178 + abc := GetLastError();
  179 + logDEBUG('Adjust Privilege value Error: ' + inttostr(GetLastError()));
  180 + end;
  181 +
  182 + if (GetLastError() = ERROR_NOT_ALL_ASSIGNED) then
  183 + begin
  184 + logDEBUG('Token does not have the provilege');
  185 + end;
  186 +
  187 + lpEnv := nil;
  188 +
  189 + if(CreateEnvironmentBlock(lpEnv,hUserTokenDup,TRUE)) then
  190 + begin
  191 + dwCreationFlags := dwCreationFlags or CREATE_UNICODE_ENVIRONMENT;
  192 + end
  193 + else
  194 + lpEnv := nil;
  195 +
  196 + // Launch the process in the client's logon session.
  197 + bResult := CreateProcessAsUser( hUserTokenDup, // client's access token
  198 + PAnsiChar(g_oCacic.getCacicPath + 'cacic2.exe'), // file to execute
  199 + nil, // command line
  200 + nil, // pointer to process SECURITY_ATTRIBUTES
  201 + nil, // pointer to thread SECURITY_ATTRIBUTES
  202 + FALSE, // handles are not inheritable
  203 + dwCreationFlags, // creation flags
  204 + lpEnv, // pointer to new environment block
  205 + PAnsiChar(g_oCacic.getCacicPath), // name of current directory
  206 + si, // pointer to STARTUPINFO structure
  207 + pi // receives information about new process
  208 + );
  209 +
  210 + // End impersonation of client.
  211 + //GetLastError Shud be 0
  212 + iResultOfCreateProcessAsUser := GetLastError();
  213 +
  214 + //Perform All the Close Handles tasks
  215 + CloseHandle(hProcess);
  216 + CloseHandle(hUserToken);
  217 + CloseHandle(hUserTokenDup);
  218 + CloseHandle(hPToken);
  219 +end;
  220 +//
62 221 procedure TCACICservice.WMEndSession(var Msg : TWMEndSession) ;
63 222 begin
64 223 if Msg.EndSession = TRUE then
... ... @@ -166,7 +325,7 @@ end;
166 325 procedure TCACICservice.ExecutaCACIC;
167 326 Begin
168 327 CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : deleteFile => '+g_oCacic.getCacicPath + 'aguarde_CACIC.txt');
169   - DeleteFile(g_oCacic.getCacicPath + 'aguarde_CACIC.txt');
  328 + DeleteFile(PAnsiChar(g_oCacic.getCacicPath + 'aguarde_CACIC.txt'));
170 329 Sleep(3000);
171 330  
172 331 // Se o arquivo indicador de execução não existir...
... ... @@ -174,7 +333,7 @@ Begin
174 333 Begin
175 334 // Executo o CHKsis, verificando a estrutura do sistema
176 335 Try
177   - CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : winExec => '+g_oCacic.getWinDir + 'chksis.exe');
  336 + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : createSampleProcess => '+g_oCacic.getWinDir + 'chksis.exe');
178 337 g_oCacic.createSampleProcess(g_oCacic.getWinDir + 'chksis.exe',false,SW_HIDE);
179 338 Except
180 339 End;
... ... @@ -184,8 +343,17 @@ Begin
184 343  
185 344 // Executo o Agente Principal do CACIC
186 345 Try
187   - CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : winExec => '+g_oCacic.getCacicPath + 'cacic2.exe');
188   - g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe',false,SW_NORMAL);
  346 + // Execução diferenciada para >= VISTA devido ao impedimento de escrita na Notification Area imposta a processos/serviços.
  347 + if (g_oCacic.isWindowsGEVista) then
  348 + Begin
  349 + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC invocando CACICservice.startapp para execução de "'+g_oCacic.getCacicPath + 'cacic2.exe'+'"');
  350 + CACICservice.startapp;
  351 + End
  352 + else
  353 + Begin
  354 + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : createSampleProcess => '+g_oCacic.getCacicPath + 'cacic2.exe');
  355 + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe',false,SW_NORMAL);
  356 + End;
189 357 Except
190 358 End;
191 359 End;
... ...
chkcacic/FormConfig.dfm
... ... @@ -18,7 +18,7 @@ object Configs: TConfigs
18 18 TextHeight = 13
19 19 object gbOpcional: TGroupBox
20 20 Left = 5
21   - Top = 83
  21 + Top = 91
22 22 Width = 480
23 23 Height = 219
24 24 Caption = 'Opcional'
... ... @@ -100,7 +100,7 @@ object Configs: TConfigs
100 100 Left = 5
101 101 Top = 8
102 102 Width = 480
103   - Height = 64
  103 + Height = 76
104 104 Caption = 'Obrigat'#243'rio'
105 105 Font.Charset = DEFAULT_CHARSET
106 106 Font.Color = clWindowText
... ... @@ -123,7 +123,7 @@ object Configs: TConfigs
123 123 ParentFont = False
124 124 end
125 125 object Label_cacic_dir: TLabel
126   - Left = 271
  126 + Left = 260
127 127 Top = 19
128 128 Width = 103
129 129 Height = 13
... ... @@ -135,19 +135,45 @@ object Configs: TConfigs
135 135 Font.Style = []
136 136 ParentFont = False
137 137 end
  138 + object Label1: TLabel
  139 + Left = 8
  140 + Top = 57
  141 + Width = 195
  142 + Height = 12
  143 + Caption = 'Informe apenas o endere'#231'o IP ou nome (DNS)'
  144 + Font.Charset = DEFAULT_CHARSET
  145 + Font.Color = clBlue
  146 + Font.Height = -9
  147 + Font.Name = 'Arial'
  148 + Font.Style = []
  149 + ParentFont = False
  150 + end
  151 + object Label2: TLabel
  152 + Left = 259
  153 + Top = 57
  154 + Width = 212
  155 + Height = 12
  156 + Caption = 'Pasta a ser criada na unidade padr'#227'o (HomeDrive)'
  157 + Font.Charset = DEFAULT_CHARSET
  158 + Font.Color = clBlue
  159 + Font.Height = -9
  160 + Font.Name = 'Arial'
  161 + Font.Style = []
  162 + ParentFont = False
  163 + end
138 164 end
139 165 object Edit_ip_serv_cacic: TEdit
140 166 Left = 13
141 167 Top = 42
142   - Width = 200
  168 + Width = 195
143 169 Height = 21
144 170 MaxLength = 100
145 171 TabOrder = 0
146 172 end
147 173 object Edit_cacic_dir: TEdit
148   - Left = 276
  174 + Left = 265
149 175 Top = 42
150   - Width = 200
  176 + Width = 211
151 177 Height = 21
152 178 MaxLength = 100
153 179 TabOrder = 1
... ...
chkcacic/FormConfig.pas
... ... @@ -53,6 +53,8 @@ type
53 53 btSair: TButton;
54 54 pnVersao: TPanel;
55 55 lbVersao: TLabel;
  56 + Label1: TLabel;
  57 + Label2: TLabel;
56 58 procedure Button_GravarClick(Sender: TObject);
57 59 procedure ckboxExibeInformacoesClick(Sender: TObject);
58 60 procedure btSairClick(Sender: TObject);
... ...
chkcacic/chkcacic.res
No preview for this file type
chkcacic/main.pas
... ... @@ -655,35 +655,6 @@ begin
655 655 FormConfig.Configs.ShowModal;
656 656 end;
657 657  
658   -Function Explode(Texto, Separador : String) : TStrings;
659   -var
660   - strItem : String;
661   - ListaAuxUTILS : TStrings;
662   - NumCaracteres,
663   - TamanhoSeparador,
664   - I : Integer;
665   -Begin
666   - ListaAuxUTILS := TStringList.Create;
667   - strItem := '';
668   - NumCaracteres := Length(Texto);
669   - TamanhoSeparador := Length(Separador);
670   - I := 1;
671   - While I <= NumCaracteres Do
672   - Begin
673   - If ((Copy(Texto,I,TamanhoSeparador) = Separador) and (Texto[I-1]<>'?')) or (I = NumCaracteres) Then
674   - Begin
675   - if (I = NumCaracteres) then strItem := strItem + Texto[I];
676   - ListaAuxUTILS.Add(trim(strItem));
677   - strItem := '';
678   - I := I + (TamanhoSeparador-1);
679   - end
680   - Else
681   - if (Texto[I]<>'?') then strItem := strItem + Texto[I];
682   - I := I + 1;
683   - End;
684   - Explode := ListaAuxUTILS;
685   -end;
686   -
687 658 Function FTP(p_Host : String; p_Port : String; p_Username : String; p_Password : String; p_PathServer : String; p_File : String; p_Dest : String) : Boolean;
688 659 var IdFTP : TIdFTP;
689 660 begin
... ... @@ -743,6 +714,42 @@ begin
743 714 End;
744 715 end;
745 716  
  717 +// Função para fixar o HomeDrive como letra para a pasta do CACIC
  718 +function TrataCacicDir(strCacicDir : String) : String;
  719 +var tstrCacicDir1,
  720 + tstrCacicDir2 : TStrings;
  721 + intAUX : integer;
  722 +Begin
  723 + Result := strCacicDir;
  724 + // Crio um array separado por ":" (Para o caso de ter sido informada a letra da unidade)
  725 + tstrCacicDir1 := TStrings.Create;
  726 + tstrCacicDir1 := g_oCacic.explode(strCacicDir,':');
  727 +
  728 + if (tstrCacicDir1.Count > 1) then
  729 + Begin
  730 + tstrCacicDir2 := TStrings.Create;
  731 + // Ignoro a letra informada...
  732 + // Certifico-me de que as barras são invertidas... (erros acontecem)
  733 + // Crio um array quebrado por "\"
  734 + Result := StringReplace(tstrCacicDir1[1],'/','\',[rfReplaceAll]);
  735 + tstrCacicDir2 := g_oCacic.explode(Result,'\');
  736 +
  737 + // Inicializo retorno com a unidade raiz do Sistema Operacional
  738 + // Concateno ao retorno as partes que formarão o caminho completo do CACIC
  739 + Result := g_oCacic.getHomeDrive;
  740 + for intAux := 0 to (tstrCacicDir2.Count-1) do
  741 + if (tstrCacicDir2[intAux] <> '') then
  742 + Result := Result + tstrCacicDir2[intAux] + '\';
  743 + tstrCacicDir2.Free;
  744 + End
  745 + else
  746 + Result := g_oCacic.getHomeDrive + strCacicDir + '\';
  747 +
  748 + tstrCacicDir1.Free;
  749 +
  750 + Result := StringReplace(Result,'\\','\',[rfReplaceAll]);
  751 +End;
  752 +
746 753 procedure GravaConfiguracoes;
747 754 var chkcacic_ini : TextFile;
748 755 begin
... ... @@ -790,6 +797,7 @@ begin
790 797 Writeln(chkcacic_ini,'# ser colocados todos os arquivos executáveis para uso do CACIC, pois, quando da necessidade de download');
791 798 Writeln(chkcacic_ini,'# de módulo, o arquivo será apenas copiado e não será necessário o FTP:');
792 799 Writeln(chkcacic_ini,'# cacic2.exe ............=> Agente Principal');
  800 + Writeln(chkcacic_ini,'# cacicsvc.exe ..........=> Serviço para Sustentação do Agente Principal');
793 801 Writeln(chkcacic_ini,'# ger_cols.exe ..........=> Gerente de Coletas');
794 802 Writeln(chkcacic_ini,'# srcacicsrv.exe ........=> Suporte Remoto Seguro');
795 803 Writeln(chkcacic_ini,'# chksis.exe ............=> Check System Routine (chkcacic residente)');
... ... @@ -812,6 +820,7 @@ begin
812 820 Writeln(chkcacic_ini,'# d:\chkcacic.ini');
813 821 Writeln(chkcacic_ini,'# \modulos');
814 822 Writeln(chkcacic_ini,'# cacic2.exe');
  823 + Writeln(chkcacic_ini,'# cacicsvc.exe');
815 824 Writeln(chkcacic_ini,'# chksis.exe');
816 825 Writeln(chkcacic_ini,'# col_anvi.exe');
817 826 Writeln(chkcacic_ini,'# col_comp.exe');
... ... @@ -841,7 +850,7 @@ begin
841 850  
842 851 // Escrita dos parâmetros obrigatórios
843 852 Writeln(chkcacic_ini,'ip_serv_cacic='+v_ip_serv_cacic);
844   - Writeln(chkcacic_ini,'cacic_dir='+g_oCacic.getHomeDrive + Configs.Edit_cacic_dir.text+'\');
  853 + Writeln(chkcacic_ini,'cacic_dir='+TrataCacicDir(Configs.Edit_cacic_dir.text));
845 854 Writeln(chkcacic_ini,'exibe_informacoes='+v_exibe_informacoes);
846 855  
847 856 // Escrita dos valores opcionais quando existirem
... ... @@ -849,7 +858,7 @@ begin
849 858 Writeln(chkcacic_ini,'te_instala_informacoes_extras='+ StringReplace(v_te_instala_informacoes_extras,#13#10,'*13*10',[rfReplaceAll]));
850 859 CloseFile(chkcacic_ini); {Fecha o arquivo texto}
851 860  
852   - g_oCacic.setCacicPath(g_oCacic.getHomeDrive + Configs.Edit_cacic_dir.text+'\');
  861 + g_oCacic.setCacicPath(TrataCacicDir(Configs.Edit_cacic_dir.text));
853 862 except
854 863 end;
855 864 end;
... ... @@ -889,55 +898,14 @@ begin
889 898 Result := FileList;
890 899 end;
891 900 end;
892   -procedure LiberaFireWall(p_objeto:string);
893   -begin
894   - LogDebug('Rotina para Liberação de FireWall...');
895   - Try
896   - if (g_oCacic.isWindowsGEVista()) then // Se >= WinVISTA...
897   - Begin
898   - if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then
899   - Begin
900   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto);
901   - End
902   - else
903   - LogDebug('Exceção para "'+p_objeto+'" já existente.');
904   -
905   - if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then
906   - Begin
907   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto);
908   - End
909   - else
910   - LogDebug('Exceção para "'+p_objeto+'" já existente.');
911   -
912   - End
913   - else
914   - Begin
915   - if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then
916   - Begin
917   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto);
918   - End
919   - else
920   - LogDebug('Exceção para "'+p_objeto+'" já existente.');
921   -
922   - if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then
923   - Begin
924   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto);
925   - End
926   - else
927   - LogDebug('Exceção para "'+p_objeto+'" já existente.');
928 901  
929   - End
930   - Except
931   - LogDebug('Problema adicionando "'+p_objeto+'" à lista de exceções do FireWall!');
932   - End;
933   -end;
934 902  
935 903 Function ChecaVersoesAgentes(p_strNomeAgente : String) : integer; // 2.2.0.16
936 904 var strNomeAgente : String;
937 905 v_array_NomeAgente : TStrings;
938 906 intAux : integer;
939 907 Begin
940   - v_array_NomeAgente := explode(p_strNomeAgente,');
  908 + v_array_NomeAgente := g_oCacic.explode(p_strNomeAgente,');
941 909  
942 910 v_versao_REM := XML_RetornaValor(StringReplace(StrUpper(PChar(v_array_NomeAgente[v_array_NomeAgente.count-1])),'.EXE','',[rfReplaceAll]), v_retorno);
943 911 v_versao_LOC := GetVersionInfo(p_strNomeAgente);
... ... @@ -1188,6 +1156,9 @@ begin
1188 1156 v_te_instala_informacoes_extras := StringReplace(GetValorChaveRegIni('Cacic2', 'te_instala_informacoes_extras', ExtractFilePath(Application.Exename) + '\chkcacic.ini'),'*13*10',#13#10,[rfReplaceAll]);
1189 1157 End;
1190 1158  
  1159 + // Tratamento do diretório informado para o CACIC, para que seja na unidade HomeDrive
  1160 + v_cacic_dir := TrataCacicDir(v_cacic_dir);
  1161 +
1191 1162 g_oCacic.setCacicPath(v_cacic_dir);
1192 1163  
1193 1164 if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then
... ... @@ -1265,35 +1236,35 @@ begin
1265 1236 Try
1266 1237 Begin
1267 1238 // Liberando as conexões de Saída para o FTP
1268   - 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='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=Programa de transferência de arquivos|Desc=Programa de transferência de arquivos|Edge=FALSE|');
1269   - 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='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=Programa de transferência de arquivos|Desc=Programa de transferência de arquivos|Edge=FALSE|');
1270   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\FTP-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=Programa de transferência de arquivos|Desc=Programa de transferência de arquivos|Edge=FALSE|');
1271   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\FTP-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=Programa de transferência de arquivos|Desc=Programa de transferência de arquivos|Edge=FALSE|');
  1239 + 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='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=FTP|Desc=Programa de transferência de arquivos|Edge=FALSE|');
  1240 + 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='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=FTP|Desc=Programa de transferência de arquivos|Edge=FALSE|');
  1241 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\FTP-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=FTP|Desc=Programa de transferência de arquivos|Edge=FALSE|');
  1242 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\FTP-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=FTP|Desc=Programa de transferência de arquivos|Edge=FALSE|');
1272 1243  
1273 1244 // Liberando as conexões de Saída para o Ger_Cols
1274   - 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='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=Módulo Gerente de Coletas do Sistema CACIC|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|');
1275   - 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='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=Módulo Gerente de Coletas do Sistema CACIC|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|');
1276   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-GERCOLS-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=Módulo Gerente de Coletas do Sistema CACIC|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|');
1277   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-GERCOLS-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=Módulo Gerente de Coletas do Sistema CACIC|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|');
  1245 + 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='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=GerCOLS|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|');
  1246 + 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='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=GerCOLS|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|');
  1247 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-GERCOLS-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=GerCOLS|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|');
  1248 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-GERCOLS-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=GerCOLS|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|');
1278 1249  
1279 1250 // Liberando as conexões de Saída para o SrCACICsrv
1280   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=Módulo Suporte Remoto Seguro do Sistema CACIC|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|');
1281   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=Módulo Suporte Remoto Seguro do Sistema CACIC|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|');
1282   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=Módulo Suporte Remoto Seguro do Sistema CACIC|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|');
1283   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=Módulo Suporte Remoto Seguro do Sistema CACIC|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|');
  1251 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=srCACICsrv|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|');
  1252 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=srCACICsrv|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|');
  1253 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=srCACICsrv|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|');
  1254 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=srCACICsrv|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|');
1284 1255  
1285 1256 // Liberando as conexões de Saída para o ChkCacic
1286   - 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|');
1287   - 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|');
1288   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\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|');
1289   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\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|');
  1257 + 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|Desc=Módulo Verificador de Integridade e Instalador do Sistema CACIC|Edge=FALSE|');
  1258 + 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|Desc=Módulo Verificador de Integridade e Instalador do Sistema CACIC|Edge=FALSE|');
  1259 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\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|Desc=Módulo Verificador de Integridade e Instalador do Sistema CACIC|Edge=FALSE|');
  1260 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\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|Desc=Módulo Verificador de Integridade e Instalador do Sistema CACIC|Edge=FALSE|');
1290 1261  
1291   - // Liberando as conexões de Saída para o ChkSis
1292   - 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='+g_oCacic.getWinDir + 'chksis.exe|Name=Módulo Verificador de Integridade do Sistema CACIC|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|');
1293   - 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='+g_oCacic.getWinDir + 'chksis.exe|Name=Módulo Verificador de Integridade do Sistema CACIC|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|');
1294   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKSIS-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getWinDir + 'chksis.exe|Name=Módulo Verificador de Integridade do Sistema CACIC|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|');
1295   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKSIS-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getWinDir + 'chksis.exe|Name=Módulo Verificador de Integridade do Sistema CACIC|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|');
1296 1262  
  1263 + // Liberando as conexões de Saída para o ChkSis
  1264 + 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='+g_oCacic.getWinDir + 'chksis.exe|Name=chkSIS|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|');
  1265 + 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='+g_oCacic.getWinDir + 'chksis.exe|Name=chkSIS|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|');
  1266 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKSIS-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getWinDir + 'chksis.exe|Name=chkSIS|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|');
  1267 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKSIS-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getWinDir + 'chksis.exe|Name=chkSIS|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|');
1297 1268 End
1298 1269 Except
1299 1270 LogDebug('Problema Liberando Policies de FireWall!');
... ... @@ -1304,8 +1275,8 @@ begin
1304 1275 // Acrescento o ChkCacic e srCACICsrv às exceções do FireWall nativo...
1305 1276 {chkcacic}
1306 1277 LogDebug('Inserindo "'+ExtractFilePath(Application.Exename) + 'chkcacic" nas exceções do FireWall!');
1307   - LiberaFireWall(ExtractFilePath(Application.Exename) + 'chkcacic');
1308   - LiberaFireWall(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe');
  1278 + g_oCacic.addApplicationToFirewall('chkCACIC - Instalador do Sistema CACIC',ExtractFilePath(Application.Exename) + Application.Exename,true);
  1279 + g_oCacic.addApplicationToFirewall('srCACICsrv - Módulo de Suporte Remoto Seguro do Sistema CACIC',g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe',true);
1309 1280 End;
1310 1281 Except
1311 1282 End;
... ... @@ -1569,22 +1540,22 @@ begin
1569 1540 XML_RetornaValor('TE_HASH_GER_COLS', v_retorno),
1570 1541 g_oCacic.getCacicPath + 'modulos');
1571 1542  
1572   - // Caso exista a pasta "modulos", copio todos os executáveis para a pasta Cacic\modulos, exceto cacic2.exe, ger_cols.exe e chksis.exe
1573   - if (v_modulos <> '') then
1574   - Begin
1575   - v_array_modulos := explode(v_modulos,'#');
1576   - For intAux := 0 To v_array_modulos.count -1 Do
1577   - Begin
1578   - if (v_array_modulos[intAux]<>'cacic2.exe') and
1579   - (v_array_modulos[intAux]<>'ger_cols.exe') and
1580   - (v_array_modulos[intAux]<>'chksis.exe') then
1581   - Begin
1582   - LogDiario('Copiando '+v_array_modulos[intAux]+' de '+ExtractFilePath(Application.Exename)+'modulos\');
1583   - CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\'+v_array_modulos[intAux]), PChar(g_oCacic.getCacicPath + 'modulos\'+v_array_modulos[intAux]),false);
1584   - FileSetAttr (PChar(g_oCacic.getCacicPath + 'modulos\'+v_array_modulos[intAux]),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
1585   - End;
1586   - End;
1587   - End;
  1543 + // Caso exista a pasta "modulos", copio todos os executáveis para a pasta Cacic\modulos, exceto cacic2.exe, ger_cols.exe e chksis.exe
  1544 + if (v_modulos <> '') then
  1545 + Begin
  1546 + v_array_modulos := g_oCacic.explode(v_modulos,'#');
  1547 + For intAux := 0 To v_array_modulos.count -1 Do
  1548 + Begin
  1549 + if (v_array_modulos[intAux]<>'cacic2.exe') and
  1550 + (v_array_modulos[intAux]<>'ger_cols.exe') and
  1551 + (v_array_modulos[intAux]<>'chksis.exe') then
  1552 + Begin
  1553 + LogDiario('Copiando '+v_array_modulos[intAux]+' de '+ExtractFilePath(Application.Exename)+'modulos\');
  1554 + CopyFile(PChar(ExtractFilePath(Application.Exename) + 'modulos\'+v_array_modulos[intAux]), PChar(g_oCacic.getCacicPath + 'modulos\'+v_array_modulos[intAux]),false);
  1555 + FileSetAttr (PChar(g_oCacic.getCacicPath + 'modulos\'+v_array_modulos[intAux]),0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
  1556 + End;
  1557 + End;
  1558 + End;
1588 1559  
1589 1560 // ATENÇÃO:
1590 1561 // Após testes no Vista, percebí que o firewall nativo interrompia o FTP e truncava o agente com tamanho zero...
... ... @@ -1611,15 +1582,18 @@ begin
1611 1582  
1612 1583 {chksis}
1613 1584 LogDebug('Inserindo "'+g_oCacic.getWinDir + 'chksis" nas exceções do FireWall!');
1614   - LiberaFireWall(g_oCacic.getWinDir + 'chksis');
  1585 + //LiberaFireWall(g_oCacic.getWinDir + 'chksis');
  1586 + g_oCacic.addApplicationToFirewall('chkSIS - Módulo Verificador de Integridade do Sistema CACIC',g_oCacic.getWinDir + 'chksis.exe',true);
1615 1587  
1616 1588 {ger_cols}
1617 1589 LogDebug('Inserindo "'+g_oCacic.getCacicPath + 'modulos\ger_cols" nas exceções do FireWall!');
1618   - LiberaFireWall(g_oCacic.getCacicPath + 'modulos\ger_cols');
  1590 +// LiberaFireWall(g_oCacic.getCacicPath + 'modulos\ger_cols');
  1591 + g_oCacic.addApplicationToFirewall('gerCOLS - Módulo Gerente de Coletas do Sistema CACIC',g_oCacic.getCacicPath+'modulos\ger_cols.exe',true);
1619 1592  
1620 1593 {srcacicsrv}
1621 1594 LogDebug('Inserindo "'+g_oCacic.getCacicPath + 'modulos\srcacicsrv" nas exceções do FireWall!');
1622   - LiberaFireWall(g_oCacic.getCacicPath + 'modulos\srcacicsrv');
  1595 + //LiberaFireWall(g_oCacic.getCacicPath + 'modulos\srcacicsrv');
  1596 + g_oCacic.addApplicationToFirewall('srCACICsrv - Módulo Servidor de Suporte Remoto Seguro do Sistema CACIC',g_oCacic.getCacicPath+'modulos\srcacicsrv.exe',true);
1623 1597  
1624 1598 Except
1625 1599 End;
... ... @@ -1732,6 +1706,10 @@ begin
1732 1706 else
1733 1707 LogDiario('Não instalei o CACICservice. Já está rodando...');
1734 1708 End;
  1709 +
  1710 + if Posso_Rodar_CACIC and not bool_CommandLine then
  1711 + MessageDLG(#13#10+'ATENÇÃO! É recomendável a reinicialização do sistema para início de ações do CACIC.',mtError,[mbOK],0);
  1712 +
1735 1713 End
1736 1714 else
1737 1715 LogDebug('Chave de Auto-Execução já existente ou Execução já iniciada...');
... ...
chksis/chksis.dpr
... ... @@ -103,6 +103,42 @@ begin
103 103 Result := VerFmt(PJVersionInfo1.FixedFileInfo.dwFileVersionMS, PJVersionInfo1.FixedFileInfo.dwFileVersionLS);
104 104 end;
105 105  
  106 +// Função para fixar o HomeDrive como letra para a pasta do CACIC
  107 +function TrataCacicDir(strCacicDir : String) : String;
  108 +var tstrCacicDir1,
  109 + tstrCacicDir2 : TStrings;
  110 + intAUX : integer;
  111 +Begin
  112 + Result := strCacicDir;
  113 + // Crio um array separado por ":" (Para o caso de ter sido informada a letra da unidade)
  114 + tstrCacicDir1 := TStrings.Create;
  115 + tstrCacicDir1 := g_oCacic.explode(strCacicDir,':');
  116 +
  117 + if (tstrCacicDir1.Count > 1) then
  118 + Begin
  119 + tstrCacicDir2 := TStrings.Create;
  120 + // Ignoro a letra informada...
  121 + // Certifico-me de que as barras são invertidas... (erros acontecem)
  122 + // Crio um array quebrado por "\"
  123 + Result := StringReplace(tstrCacicDir1[1],'/','\',[rfReplaceAll]);
  124 + tstrCacicDir2 := g_oCacic.explode(Result,'\');
  125 +
  126 + // Inicializo retorno com a unidade raiz do Sistema Operacional
  127 + // Concateno ao retorno as partes que formarão o caminho completo do CACIC
  128 + Result := g_oCacic.getHomeDrive;
  129 + for intAux := 0 to (tstrCacicDir2.Count-1) do
  130 + if (tstrCacicDir2[intAux] <> '') then
  131 + Result := Result + tstrCacicDir2[intAux] + '\';
  132 + tstrCacicDir2.Free;
  133 + End
  134 + else
  135 + Result := g_oCacic.getHomeDrive + strCacicDir + '\';
  136 +
  137 + tstrCacicDir1.Free;
  138 +
  139 + Result := StringReplace(Result,'\\','\',[rfReplaceAll]);
  140 +End;
  141 +
106 142 procedure log_DEBUG(p_msg:string);
107 143 Begin
108 144 if v_Debugs then log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg);
... ... @@ -640,7 +676,7 @@ begin
640 676 v_cacic_dir := GetValorChaveRegIni('Cacic2', 'cacic_dir' , ExtractFilePath(ParamStr(0)) + 'chksis.ini');
641 677 v_rem_cacic_v0x := GetValorChaveRegIni('Cacic2', 'rem_cacic_v0x', ExtractFilePath(ParamStr(0)) + 'chksis.ini');
642 678  
643   - g_oCacic.setCacicPath(v_cacic_dir);
  679 + g_oCacic.setCacicPath(TrataCacicDir(v_cacic_dir));
644 680  
645 681 v_Debugs := false;
646 682 if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then
... ... @@ -652,36 +688,43 @@ begin
652 688 End;
653 689 End;
654 690  
  691 + log_DEBUG('setCacicPath "'+g_oCacic.getCacicPath+'"');
  692 +
  693 + log_DEBUG('Verificando recepção do parâmetro rem_cacic_v0x...');
655 694 // Caso o parâmetro rem_cacic_v0x seja "S/s" removo a chave/valor de execução do Cacic antigo
656 695 if (LowerCase(v_rem_cacic_v0x)='s') then
657 696 begin
658   - //log_diario('Excluindo chave de execução do CACIC',ExtractFilePath(ParamStr(0)));
  697 + log_DEBUG('Excluindo chave de execução do CACIC');
659 698 DelValorReg('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic');
660 699 end;
661 700  
  701 + log_DEBUG('Verificando existência da pasta "'+g_oCacic.getCacicPath+'"');
662 702 // Verifico a existência do diretório configurado para o Cacic, normalmente CACIC
663 703 if not DirectoryExists(g_oCacic.getCacicPath) then
664 704 begin
665   - //log_diario('Criando diretório ' + Dir,ExtractFilePath(ParamStr(0)));
  705 + log_DEBUG('Criando diretório ' + g_oCacic.getCacicPath);
666 706 ForceDirectories(g_oCacic.getCacicPath);
667 707 end;
668 708  
  709 + log_DEBUG('Verificando existência da pasta "'+g_oCacic.getCacicPath+'modulos"');
669 710 // Para eliminar versão 20014 e anteriores que provavelmente não fazem corretamente o AutoUpdate
670 711 if not DirectoryExists(g_oCacic.getCacicPath+'modulos') then
671 712 begin
672   - log_diario('Excluindo '+ g_oCacic.getCacicPath + 'cacic2.exe');
  713 + log_DEBUG('Excluindo '+ g_oCacic.getCacicPath + 'cacic2.exe');
673 714 Matar(g_oCacic.getCacicPath,'cacic2.exe');
674   - log_diario('Criando diretório ' + g_oCacic.getCacicPath + 'modulos');
  715 + log_DEBUG('Criando diretório ' + g_oCacic.getCacicPath + 'modulos');
675 716 ForceDirectories(g_oCacic.getCacicPath + 'modulos');
676 717 end;
677 718  
  719 + log_DEBUG('Verificando existência da pasta "'+g_oCacic.getCacicPath+'temp"');
678 720 // Crio o SubDiretório TEMP, caso não exista
679 721 if not DirectoryExists(g_oCacic.getCacicPath+'temp') then
680 722 begin
681   - log_diario('Criando diretório ' + g_oCacic.getCacicPath + 'temp');
  723 + log_DEBUG('Criando diretório ' + g_oCacic.getCacicPath + 'temp');
682 724 ForceDirectories(g_oCacic.getCacicPath + 'temp');
683 725 end;
684 726  
  727 + log_DEBUG('Verificando existência dos agentes principais "'+g_oCacic.getCacicPath+'cacic2.exe" e "'+g_oCacic.getCacicPath + 'modulos\ger_cols.exe"');
685 728 // Verifico existência dos dois principais objetos
686 729 If (not FileExists(g_oCacic.getCacicPath + 'cacic2.exe')) or (not FileExists(g_oCacic.getCacicPath + 'modulos\ger_cols.exe')) Then
687 730 Begin
... ... @@ -705,27 +748,28 @@ begin
705 748 v_te_senha_login_serv_updates := XML_RetornaValor('te_senha_login_serv_updates' , Response_Config.DataString);
706 749 v_te_path_serv_updates := XML_RetornaValor('te_path_serv_updates' , Response_Config.DataString);
707 750  
708   - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
709   - log_diario(':::::::::::::::: VALORES OBTIDOS NO Gerente WEB :::::::::::::::');
710   - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
711   - log_diario('Servidor de updates......................: '+v_te_serv_updates);
712   - log_diario('Porta do servidor de updates.............: '+v_nu_porta_serv_updates);
713   - log_diario('Usuário para login no servidor de updates: '+v_nm_usuario_login_serv_updates);
714   - log_diario('Pasta no servidor de updates.............: '+v_te_path_serv_updates);
715   - log_diario(' ');
716   - log_diario('Versões dos Agentes Principais:');
717   - log_diario('------------------------------');
718   - log_diario('Cacic2 - Agente do Systray.........: '+XML_RetornaValor('CACIC2', v_retorno));
719   - log_diario('Ger_Cols - Gerente de Coletas........: '+XML_RetornaValor('GER_COLS', v_retorno));
720   - log_diario('ChkSis - Verificador de Integridade: '+XML_RetornaValor('CHKSIS', v_retorno));
721   - log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
722   -
723   - Except log_diario('Falha no contato com ' + 'http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php');
  751 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  752 + log_DEBUG(':::::::::::::::: VALORES OBTIDOS NO Gerente WEB :::::::::::::::');
  753 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  754 + log_DEBUG('Servidor de updates......................: '+v_te_serv_updates);
  755 + log_DEBUG('Porta do servidor de updates.............: '+v_nu_porta_serv_updates);
  756 + log_DEBUG('Usuário para login no servidor de updates: '+v_nm_usuario_login_serv_updates);
  757 + log_DEBUG('Pasta no servidor de updates.............: '+v_te_path_serv_updates);
  758 + log_DEBUG(' ');
  759 + log_DEBUG('Versões dos Agentes Principais:');
  760 + log_DEBUG('------------------------------');
  761 + log_DEBUG('Cacic2 - Agente do Systray.........: '+XML_RetornaValor('CACIC2', v_retorno));
  762 + log_DEBUG('Ger_Cols - Gerente de Coletas........: '+XML_RetornaValor('GER_COLS', v_retorno));
  763 + log_DEBUG('ChkSis - Verificador de Integridade: '+XML_RetornaValor('CHKSIS', v_retorno));
  764 + log_DEBUG(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::');
  765 +
  766 + Except log_DEBUG('Falha no contato com ' + 'http://' + v_ip_serv_cacic + '/cacic2/ws/get_config.php');
724 767 End;
725 768  
726 769 Request_Config.Free;
727 770 Response_Config.Free;
728 771  
  772 + log_DEBUG('Verificando existência do agente "'+g_oCacic.getCacicPath+'cacic2.exe"');
729 773 // Verificação de versão do cacic2.exe e exclusão em caso de versão antiga
730 774 If (FileExists(g_oCacic.getCacicPath + 'cacic2.exe')) Then
731 775 Begin
... ... @@ -745,6 +789,7 @@ begin
745 789 Matar(g_oCacic.getCacicPath, 'cacic2.exe');
746 790 End;
747 791  
  792 + log_DEBUG('Verificando existência do agente "'+g_oCacic.getCacicPath+'modulos\ger_cols.exe"');
748 793 // Verificação de versão do ger_cols.exe e exclusão em caso de versão antiga
749 794 If (FileExists(g_oCacic.getCacicPath + 'modulos\ger_cols.exe')) Then
750 795 Begin
... ... @@ -764,7 +809,7 @@ begin
764 809  
765 810 End;
766 811  
767   -
  812 + log_DEBUG('Nova Verificação de existência do agente "'+g_oCacic.getCacicPath+'cacic2.exe"');
768 813 // Tento detectar o Agente Principal e faço FTP caso não exista
769 814 If not FileExists(g_oCacic.getCacicPath + 'cacic2.exe') Then
770 815 begin
... ... @@ -782,6 +827,7 @@ begin
782 827 bool_download_CACIC2 := true;
783 828 end;
784 829  
  830 + log_DEBUG('Nova Verificação de existência do agente "'+g_oCacic.getCacicPath+'modulos\ger_cols.exe"');
785 831 // Tento detectar o Gerente de Coletas e faço FTP caso não exista
786 832 If (not FileExists(g_oCacic.getCacicPath + 'modulos\ger_cols.exe')) Then
787 833 begin
... ... @@ -806,16 +852,16 @@ begin
806 852 Sleep(5000);
807 853  
808 854 // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor
809   - if Posso_Rodar_CACIC or not bool_ExistsAutoRun then
810   - Begin
811   - log_diario('Executando '+g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic);
  855 + if Posso_Rodar_CACIC or not bool_ExistsAutoRun then
  856 + Begin
  857 + log_diario('Executando '+g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic);
812 858  
813   - // Caso tenha havido download de agentes principais, executar coletas imediatamente...
814   - if (bool_download_CACIC2) then
815   - g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute', false)
816   - else
817   - g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic , false);
818   - End;
  859 + // Caso tenha havido download de agentes principais, executar coletas imediatamente...
  860 + if (bool_download_CACIC2) then
  861 + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute', false)
  862 + else
  863 + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic , false);
  864 + End;
819 865 end;
820 866  
821 867 const
... ...
chksis/chksis.res
No preview for this file type
col_anvi/col_anvi.res
No preview for this file type
col_comp/col_comp.res
No preview for this file type
col_hard/col_hard.res
No preview for this file type
col_moni/col_moni.res
No preview for this file type
col_patr/col_patr.res
No preview for this file type
col_patr/main_col_patr.pas
... ... @@ -967,7 +967,7 @@ Begin
967 967 MessageDlg('Atenção: é necessário o preenchimento/atualização das informações de Patrimônio e Localização Física deste computador. Por favor, confirme as informações que serão apresentadas na tela que será exibida a seguir.', mtInformation, [mbOk], 0);
968 968 boolColeta := true;
969 969 end
970   - Else if (GetValorDatMemoria('Patrimonio.dt_ultima_renovacao_patrim',v_tstrCipherOpened)= '') then
  970 + Else if (GetValorDatMemoria('Patrimonio.dt_ultima_renovacao',v_tstrCipherOpened)= '') then
971 971 Begin
972 972 // Solicita o cadastramento de informações de patrimõnio caso ainda não tenha sido cadastrado.
973 973 boolColeta := true;
... ...
col_soft/col_soft.res
No preview for this file type
col_undi/col_undi.res
No preview for this file type
ger_cols/ger_cols.dpr
... ... @@ -1104,7 +1104,7 @@ Begin
1104 1104 end;
1105 1105  
1106 1106 procedure GetInfoPatrimonio;
1107   -var strDt_ultima_renovacao_patrim,
  1107 +var strDt_ultima_renovacao,
1108 1108 strUltimaRedeObtida,
1109 1109 strRetorno,
1110 1110 strIntervaloRenovacaoPatrimonio : string;
... ... @@ -1121,7 +1121,7 @@ Begin
1121 1121 Request_Ger_Cols.Free;
1122 1122  
1123 1123 strUltimaRedeObtida := GetValorDatMemoria('Patrimonio.ultima_rede_obtida', v_tstrCipherOpened);
1124   - strDt_ultima_renovacao_patrim := GetValorDatMemoria('Patrimonio.dt_ultima_renovacao_patrim', v_tstrCipherOpened);
  1124 + strDt_ultima_renovacao := GetValorDatMemoria('Patrimonio.dt_ultima_renovacao', v_tstrCipherOpened);
1125 1125  
1126 1126 // Inicializa como "N' os valores de Remanejamento e Renovação que serão lidos pelo módulo de Coleta de Informações Patrimoniais.
1127 1127 SetValorDatMemoria('Patrimonio.in_alteracao_fisica', 'N', v_tstrCipherOpened);
... ... @@ -1138,7 +1138,7 @@ Begin
1138 1138 Begin
1139 1139 intHoje := StrToInt(FormatDateTime('yyyymmdd', Date));
1140 1140 strIntervaloRenovacaoPatrimonio := GetValorDatMemoria('Configs.NU_INTERVALO_RENOVACAO_PATRIMONIO', v_tstrCipherOpened);
1141   - if ((strUltimaRedeObtida <> '') and (strIntervaloRenovacaoPatrimonio <> '') and ((intHoje - StrToInt64(strDt_ultima_renovacao_patrim)) >= strtoint(strIntervaloRenovacaoPatrimonio))) or
  1141 + if ((strUltimaRedeObtida <> '') and (strIntervaloRenovacaoPatrimonio <> '') and ((intHoje - StrToInt64(strDt_ultima_renovacao)) >= strtoint(strIntervaloRenovacaoPatrimonio))) or
1142 1142 (GetValorDatMemoria('Configs.IN_COLETA_FORCADA_PATR', v_tstrCipherOpened) = 'S') Then
1143 1143 Begin
1144 1144 // E neste caso seto como "S" o valor de Renovação de Informações para ser lido pelo módulo de Coleta de Informações Patrimoniais.
... ... @@ -1297,15 +1297,10 @@ Begin
1297 1297 log_DEBUG('Verificando necessidade de FTP para "'+p_Nome_Modulo +'" ('+p_File+')');
1298 1298 Result := 0;
1299 1299 Try
1300   -
1301 1300 if (trim(p_Dir_Temp)='') then
1302   - Begin
1303   - v_Dir_Temp := p_Dir_Inst;
1304   - End
  1301 + v_Dir_Temp := p_Dir_Inst
1305 1302 else
1306   - Begin
1307   - v_Dir_Temp := g_oCacic.getCacicPath + p_Dir_Temp;
1308   - End;
  1303 + v_Dir_Temp := g_oCacic.getCacicPath + p_Dir_Temp;
1309 1304  
1310 1305 v_versao_disponivel := '';
1311 1306 v_versao_atual := '';
... ... @@ -1345,11 +1340,9 @@ Begin
1345 1340 else
1346 1341 Begin
1347 1342 strHashLocal := g_oCacic.getFileHash(p_Dir_Inst + p_File + '.exe');
  1343 +
1348 1344 strHashRemoto := GetValorDatMemoria('Configs.TE_HASH_'+UpperCase(p_File), v_tstrCipherOpened);
1349   - // TESTE
1350   - //if (UpperCase(p_File) = 'GER_COLS') or (UpperCase(p_File) = 'CACIC2') then
1351   - // strHashLocal := strHashRemoto;
1352   - //
  1345 +
1353 1346 log_DEBUG('Ver_UPD => '+p_File+' [strHashLocal]: '+strHashLocal+' [strHashRemoto]: '+strHashRemoto);
1354 1347 if ((strHashRemoto <> '') and (strHashLocal <> strHashRemoto)) or (v_Tamanho_Arquivo = '0') or (v_Tamanho_Arquivo = '-1') or (trim(GetVersionInfo(p_Dir_Inst + p_File + '.exe'))='0.0.0.0') then
1355 1348 Begin
... ... @@ -1555,7 +1548,7 @@ End;
1555 1548  
1556 1549 procedure Patrimnio1Click(Sender: TObject);
1557 1550 begin
1558   - SetValorDatMemoria('Patrimonio.dt_ultima_renovacao_patrim','', v_tstrCipherOpened);
  1551 + SetValorDatMemoria('Patrimonio.dt_ultima_renovacao','0', v_tstrCipherOpened);
1559 1552 if ChecaAgente(g_oCacic.getCacicPath + 'modulos', 'ini_cols.exe') then
1560 1553 g_oCacic.createSampleProcess( g_oCacic.getCacicPath + 'modulos\ini_cols.exe /CacicPath='+g_oCacic.getCacicPath+' /p_ModulosOpcoes=col_patr,wait,user#', CACIC_PROCESS_WAIT );
1561 1554  
... ... @@ -2436,6 +2429,7 @@ Begin
2436 2429 SetValorDatMemoria('Configs.TE_JANELAS_EXCECAO' ,g_oCacic.deCrypt(XML_RetornaValor('te_janelas_excecao' , strRetorno)) , v_tstrCipherOpened);
2437 2430 SetValorDatMemoria('TcpIp.TE_ENDERECOS_MAC_INVALIDOS' ,g_oCacic.deCrypt(XML_RetornaValor('te_enderecos_mac_invalidos' , strRetorno)) , v_tstrCipherOpened);
2438 2431 SetValorDatMemoria('Configs.NU_PORTA_SRCACIC' ,g_oCacic.deCrypt(XML_RetornaValor('nu_porta_srcacic' , strRetorno)) , v_tstrCipherOpened);
  2432 + SetValorDatMemoria('Configs.ID_LOCAL' ,g_oCacic.deCrypt(XML_RetornaValor('id_local' , strRetorno)) , v_tstrCipherOpened);
2439 2433 SetValorDatMemoria('Configs.NU_TIMEOUT_SRCACIC' ,g_oCacic.deCrypt(XML_RetornaValor('nu_timeout_srcacic' , strRetorno)) , v_tstrCipherOpened);
2440 2434 SetValorDatMemoria('Configs.CS_PERMITIR_DESATIVAR_SRCACIC' ,g_oCacic.deCrypt(XML_RetornaValor('cs_permitir_desativar_srcacic' , strRetorno)) , v_tstrCipherOpened);
2441 2435 SetValorDatMemoria('Configs.DT_HR_COLETA_FORCADA' ,stringreplace(stringreplace(stringreplace(g_oCacic.deCrypt(XML_RetornaValor('dt_hr_coleta_forcada' , strRetorno)),'-','',[rfReplaceAll]),' ','',[rfReplaceAll]),':','',[rfReplaceAll]), v_tstrCipherOpened);
... ... @@ -2509,6 +2503,7 @@ Begin
2509 2503 // /ip_serv_cacic => Endereço IP do Módulo Gerente. Ex.: 10.71.0.212
2510 2504 // /cacic_dir => Diretório para instalação do Cacic na estação. Ex.: Cacic
2511 2505 // /coletas => Chamada para ativação das coletas
  2506 + // /recuperaSR => Chamada para tentativa de recuperação do módulo srCACIC
2512 2507 // /patrimonio => Chamada para ativação do Formulário de Patrimônio
2513 2508 // UpdatePrincipal => Atualização do Agente Principal
2514 2509 // Chamada com parâmetros pelo chkcacic.exe ou linha de comando
... ... @@ -2544,6 +2539,19 @@ Begin
2544 2539 Sair;
2545 2540 end;
2546 2541  
  2542 + // Chamada efetuada pelo Cacic2.exe quando o usuário clica no menu "Ativar Suporte Remoto" e o módulo srCACICsrv.exe não
  2543 + // tem seu HashCode validado
  2544 + If FindCmdLineSwitch('recuperaSR', True) Then
  2545 + Begin
  2546 + log_DEBUG('Opção /recuperaSR recebida...');
  2547 + v_acao_gercols := 'Verificando/Recuperando srCACIC.';
  2548 + log_DEBUG('Chamando Verificador/Atualizador...');
  2549 + Ver_UPD('srcacicsrv','Suporte Remoto Seguro',g_oCacic.getCacicPath + 'modulos\','',false);
  2550 + Finalizar(false);
  2551 + CriaTXT(g_oCacic.getCacicPath+'temp','recuperaSR');
  2552 + Sair;
  2553 + End;
  2554 +
2547 2555 For intAux := 1 to ParamCount do
2548 2556 Begin
2549 2557 if LowerCase(Copy(ParamStr(intAux),1,15)) = '/ip_serv_cacic=' then
... ... @@ -3258,9 +3266,10 @@ Begin
3258 3266 CriaTXT(g_oCacic.getCacicPath,'ger_erro');
3259 3267 Finalizar(false);
3260 3268 SetValorDatMemoria('Erro_Fatal_Descricao', v_acao_gercols, v_tstrCipherOpened);
  3269 + Sair;
3261 3270 End;
3262 3271 End;
3263   - g_oCacic.Free;
  3272 +// g_oCacic.Free;
3264 3273 End;
3265 3274  
3266 3275 begin
... ...
ger_cols/ger_cols.res
No preview for this file type
ini_cols/ini_cols.res
No preview for this file type
main.dfm
... ... @@ -1435,15 +1435,271 @@ object FormularioGeral: TFormularioGeral
1435 1435 Left = 674
1436 1436 Top = 114
1437 1437 Bitmap = {
1438   - 494C010103000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
1439   - 0000000000003600000028000000400000001000000001002000000000000010
  1438 + 494C010104000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
  1439 + 0000000000003600000028000000400000003000000001002000000000000030
  1440 + 0000000000000000000000000000000000000000000000000000000000000000
  1441 + 0000000000000000000000000000000000000000000000000000000000000000
  1442 + 0000000000000000000000000000000000000000000000000000000000000000
  1443 + 0000000000000000000000000000000000000000000000000000000000000000
  1444 + 0000000000000000000000000000000000000000000000000000000000000000
  1445 + 0000000000000000000000000000000000000000000000000000000000000000
  1446 + 0000000000000000000000000000000000000000000000000000000000000000
  1447 + 0000000000000000000000000000000000000000000000000000000000000000
  1448 + 0000000000000000000000000000000000000000000000000000000000000000
  1449 + 0000000000000000000000000000000000000000000000000000000000000000
  1450 + 0000000000000000000000000000000000000000000000000000000000000000
  1451 + 0000000000000000000000000000000000000000000000000000000000000000
  1452 + 0000000000000000000000000000000000000000000000000000000000000000
  1453 + 0000000000000000000000000000000000000000000000000000000000000000
  1454 + 0000000000000000000000000000000000000000000000000000000000000000
  1455 + 0000000000000000000000000000000000000000000000000000000000000000
  1456 + 0000000000000000000000000000000000000000000000000000000000000000
  1457 + 0000000000000000000000000000000000000000000000000000000000000000
  1458 + 0000000000000000000000000000000000000000000000000000000000000000
  1459 + 0000000000000000000000000000000000000000000000000000000000000000
  1460 + 0000000000000000000000000000000000000000000000000000000000000000
  1461 + 0000000000000000000000000000000000000000000000000000000000000000
  1462 + 0000000000000000000000000000000000000000000000000000000000000000
  1463 + 0000000000000000000000000000000000000000000000000000000000000000
  1464 + 0000000000000000000000000000000000000000000000000000000000000000
  1465 + 0000000000000000000000000000000000000000000000000000000000000000
  1466 + 0000000000000000000000000000000000000000000000000000000000000000
  1467 + 0000000000000000000000000000000000000000000000000000000000000000
  1468 + 0000000000000000000000000000000000000000000000000000000000000000
  1469 + 0000000000000000000000000000000000000000000000000000000000000000
  1470 + 0000000000000000000000000000000000000000000000000000000000000000
  1471 + 0000000000000000000000000000000000000000000000000000000000000000
  1472 + 0000000000000000000000000000000000000000000000000000000000000000
  1473 + 0000000000000000000000000000000000000000000000000000000000000000
  1474 + 0000000000000000000000000000000000000000000000000000000000000000
  1475 + 0000000000000000000000000000000000000000000000000000000000000000
  1476 + 0000000000000000000000000000000000000000000000000000000000000000
  1477 + 0000000000000000000000000000000000000000000000000000000000000000
  1478 + 0000000000000000000000000000000000000000000000000000000000000000
  1479 + 0000000000000000000000000000000000000000000000000000000000000000
  1480 + 0000000000000000000000000000000000000000000000000000000000000000
  1481 + 0000000000000000000000000000000000000000000000000000000000000000
  1482 + 0000000000000000000000000000000000000000000000000000000000000000
  1483 + 0000000000000000000000000000000000000000000000000000000000000000
  1484 + 0000000000000000000000000000000000000000000000000000000000000000
  1485 + 0000000000000000000000000000000000000000000000000000000000000000
  1486 + 0000000000000000000000000000000000000000000000000000000000000000
  1487 + 0000000000000000000000000000000000000000000000000000000000000000
  1488 + 0000000000000000000000000000000000000000000000000000000000000000
  1489 + 0000000000000000000000000000000000000000000000000000000000000000
  1490 + 0000000000000000000000000000000000000000000000000000000000000000
  1491 + 0000000000000000000000000000000000000000000000000000000000000000
  1492 + 0000000000000000000000000000000000000000000000000000000000000000
  1493 + 0000000000000000000000000000000000000000000000000000000000000000
  1494 + 0000000000000000000000000000000000000000000000000000000000000000
  1495 + 0000000000000000000000000000000000000000000000000000000000000000
  1496 + 0000000000000000000000000000000000000000000000000000000000000000
  1497 + 0000000000000000000000000000000000000000000000000000000000000000
  1498 + 0000000000000000000000000000000000000000000000000000000000000000
  1499 + 0000000000000000000000000000000000000000000000000000000000000000
  1500 + 0000000000000000000000000000000000000000000000000000000000000000
  1501 + 0000000000000000000000000000000000000000000000000000000000000000
  1502 + 0000000000000000000000000000000000000000000000000000000000000000
  1503 + 0000000000000000000000000000000000000000000000000000000000000000
  1504 + 0000000000000000000000000000000000000000000000000000000000000000
  1505 + 0000000000000000000000000000000000000000000000000000000000000000
  1506 + 0000000000000000000000000000000000000000000000000000000000000000
  1507 + 0000000000000000000000000000000000000000000000000000000000000000
  1508 + 0000000000000000000000000000000000000000000000000000000000000000
  1509 + 0000000000000000000000000000000000000000000000000000000000000000
  1510 + 0000000000000000000000000000000000000000000000000000000000000000
  1511 + 0000000000000000000000000000000000000000000000000000000000000000
  1512 + 0000000000000000000000000000000000000000000000000000000000000000
  1513 + 0000000000000000000000000000000000000000000000000000000000000000
  1514 + 0000000000000000000000000000000000000000000000000000000000000000
  1515 + 0000000000000000000000000000000000000000000000000000000000000000
  1516 + 0000000000000000000000000000000000000000000000000000000000000000
  1517 + 0000000000000000000000000000000000000000000000000000000000000000
  1518 + 0000000000000000000000000000000000000000000000000000000000000000
  1519 + 0000000000000000000000000000000000000000000000000000000000000000
  1520 + 0000000000000000000000000000000000000000000000000000000000000000
  1521 + 0000000000000000000000000000000000000000000000000000000000000000
  1522 + 0000000000000000000000000000000000000000000000000000000000000000
  1523 + 0000000000000000000000000000000000000000000000000000000000000000
  1524 + 0000000000000000000000000000000000000000000000000000000000000000
  1525 + 0000000000000000000000000000000000000000000000000000000000000000
  1526 + 0000000000000000000000000000000000000000000000000000000000000000
  1527 + 0000000000000000000000000000000000000000000000000000000000000000
  1528 + 0000000000000000000000000000000000000000000000000000000000000000
  1529 + 0000000000000000000000000000000000000000000000000000000000000000
  1530 + 0000000000000000000000000000000000000000000000000000000000000000
  1531 + 0000000000000000000000000000000000000000000000000000000000000000
  1532 + 0000000000000000000000000000000000000000000000000000000000000000
  1533 + 0000000000000000000000000000000000000000000000000000000000000000
  1534 + 0000000000000000000000000000000000000000000000000000000000000000
  1535 + 0000000000000000000000000000000000000000000000000000000000000000
  1536 + 0000000000000000000000000000000000000000000000000000000000000000
  1537 + 0000000000000000000000000000000000000000000000000000000000000000
  1538 + 0000000000000000000000000000000000000000000000000000000000000000
  1539 + 0000000000000000000000000000000000000000000000000000000000000000
  1540 + 0000000000000000000000000000000000000000000000000000000000000000
  1541 + 0000000000000000000000000000000000000000000000000000000000000000
  1542 + 0000000000000000000000000000000000000000000000000000000000000000
  1543 + 0000000000000000000000000000000000000000000000000000000000000000
  1544 + 0000000000000000000000000000000000000000000000000000000000000000
  1545 + 0000000000000000000000000000000000000000000000000000000000000000
  1546 + 0000000000000000000000000000000000000000000000000000000000000000
  1547 + 0000000000000000000000000000000000000000000000000000000000000000
  1548 + 0000000000000000000000000000000000000000000000000000000000000000
  1549 + 0000000000000000000000000000000000000000000000000000000000000000
  1550 + 0000000000000000000000000000000000000000000000000000000000000000
  1551 + 0000000000000000000000000000000000000000000000000000000000000000
  1552 + 0000000000000000000000000000000000000000000000000000000000000000
  1553 + 0000000000000000000000000000000000000000000000000000000000000000
  1554 + 0000000000000000000000000000000000000000000000000000000000000000
  1555 + 0000000000000000000000000000000000000000000000000000000000000000
  1556 + 0000000000000000000000000000000000000000000000000000000000000000
  1557 + 0000000000000000000000000000000000000000000000000000000000000000
  1558 + 0000000000000000000000000000000000000000000000000000000000000000
  1559 + 0000000000000000000000000000000000000000000000000000000000000000
  1560 + 0000000000000000000000000000000000000000000000000000000000000000
  1561 + 0000000000000000000000000000000000000000000000000000000000000000
  1562 + 0000000000000000000000000000000000000000000000000000000000000000
  1563 + 0000000000000000000000000000000000000000000000000000000000000000
  1564 + 0000000000000000000000000000000000000000000000000000000000000000
  1565 + 0000000000000000000000000000000000000000000000000000000000000000
  1566 + 0000000000000000000000000000000000000000000000000000000000000000
  1567 + 0000000000000000000000000000000000000000000000000000000000000000
  1568 + 0000000000000000000000000000000000000000000000000000000000000000
  1569 + 0000000000000000000000000000000000000000000000000000000000000000
  1570 + 0000000000000000000000000000000000000000000000000000000000000000
  1571 + 0000000000000000000000000000000000000000000000000000000000000000
  1572 + 0000000000000000000000000000000000000000000000000000000000000000
  1573 + 0000000000000000000000000000000000000000000000000000000000000000
  1574 + 0000000000000000000000000000000000000000000000000000000000000000
  1575 + 0000000000000000000000000000000000000000000000000000000000000000
  1576 + 0000000000000000000000000000000000000000000000000000000000000000
  1577 + 0000000000000000000000000000000000000000000000000000000000000000
  1578 + 0000000000000000000000000000000000000000000000000000000000000000
  1579 + 0000000000000000000000000000000000000000000000000000000000000000
  1580 + 0000000000000000000000000000000000000000000000000000000000000000
  1581 + 0000000000000000000000000000000000000000000000000000000000000000
  1582 + 0000000000000000000000000000000000000000000000000000000000000000
  1583 + 0000000000000000000000000000000000000000000000000000000000000000
  1584 + 0000000000000000000000000000000000000000000000000000000000000000
  1585 + 0000000000000000000000000000000000000000000000000000000000000000
  1586 + 0000000000000000000000000000000000000000000000000000000000000000
  1587 + 0000000000000000000000000000000000000000000000000000000000000000
  1588 + 0000000000000000000000000000000000000000000000000000000000000000
  1589 + 0000000000000000000000000000000000000000000000000000000000000000
  1590 + 0000000000000000000000000000000000000000000000000000000000000000
  1591 + 0000000000000000000000000000000000000000000000000000000000000000
  1592 + 0000000000000000000000000000000000000000000000000000000000000000
  1593 + 0000000000000000000000000000000000000000000000000000000000000000
  1594 + 0000000000000000000000000000000000000000000000000000000000000000
  1595 + 0000000000000000000000000000000000000000000000000000000000000000
  1596 + 0000000000000000000000000000000000000000000000000000000000000000
  1597 + 0000000000000000000000000000000000000000000000000000000000000000
  1598 + 0000000000000000000000000000000000000000000000000000000000000000
  1599 + 0000000000000000000000000000000000000000000000000000000000000000
  1600 + 0000000000000000000000000000000000000000000000000000000000000000
  1601 + 0000000000000000000000000000000000000000000000000000000000000000
  1602 + 0000000000000000000000000000000000000000000000000000000000000000
  1603 + 0000000000000000000000000000000000000000000000000000000000000000
  1604 + 0000000000000000000000000000000000000000000000000000000000000000
  1605 + 0000000000000000000000000000000000000000000000000000000000000000
  1606 + 0000000000000000000000000000000000000000000000000000000000000000
  1607 + 0000000000000000000000000000000000000000000000000000000000000000
  1608 + 0000000000000000000000000000000000000000000000000000000000000000
  1609 + 0000000000000000000000000000000000000000000000000000000000000000
  1610 + 0000000000000000000000000000000000000000000000000000000000000000
  1611 + 0000000000000000000000000000000000000000000000000000000000000000
  1612 + 0000000000000000000000000000000000000000000000000000000000000000
  1613 + 0000000000000000000000000000000000000000000000000000000000000000
  1614 + 0000000000000000000000000000000000000000000000000000000000000000
  1615 + 0000000000000000000000000000000000000000000000000000000000000000
  1616 + 0000000000000000000000000000000000000000000000000000000000000000
  1617 + 0000000000000000000000000000000000000000000000000000000000000000
  1618 + 0000000000000000000000000000000000000000000000000000000000000000
  1619 + 0000000000000000000000000000000000000000000000000000000000000000
  1620 + 0000000000000000000000000000000000000000000000000000000000000000
  1621 + 0000000000000000000000000000000000000000000000000000000000000000
  1622 + 0000000000000000000000000000000000000000000000000000000000000000
  1623 + 0000000000000000000000000000000000000000000000000000000000000000
  1624 + 0000000000000000000000000000000000000000000000000000000000000000
  1625 + 0000000000000000000000000000000000000000000000000000000000000000
  1626 + 0000000000000000000000000000000000000000000000000000000000000000
  1627 + 0000000000000000000000000000000000000000000000000000000000000000
  1628 + 0000000000000000000000000000000000000000000000000000000000000000
  1629 + 0000000000000000000000000000000000000000000000000000000000000000
  1630 + 0000000000000000000000000000000000000000000000000000000000000000
  1631 + 0000000000000000000000000000000000000000000000000000000000000000
  1632 + 0000000000000000000000000000000000000000000000000000000000000000
  1633 + 0000000000000000000000000000000000000000000000000000000000000000
  1634 + 0000000000000000000000000000000000000000000000000000000000000000
  1635 + 0000000000000000000000000000000000000000000000000000000000000000
  1636 + 0000000000000000000000000000000000000000000000000000000000000000
  1637 + 0000000000000000000000000000000000000000000000000000000000000000
  1638 + 0000000000000000000000000000000000000000000000000000000000000000
  1639 + 0000000000000000000000000000000000000000000000000000000000000000
  1640 + 0000000000000000000000000000000000000000000000000000000000000000
  1641 + 0000000000000000000000000000000000000000000000000000000000000000
  1642 + 0000000000000000000000000000000000000000000000000000000000000000
  1643 + 0000000000000000000000000000000000000000000000000000000000000000
  1644 + 0000000000000000000000000000000000000000000000000000000000000000
  1645 + 0000000000000000000000000000000000000000000000000000000000000000
  1646 + 0000000000000000000000000000000000000000000000000000000000000000
  1647 + 0000000000000000000000000000000000000000000000000000000000000000
  1648 + 0000000000000000000000000000000000000000000000000000000000000000
  1649 + 0000000000000000000000000000000000000000000000000000000000000000
  1650 + 0000000000000000000000000000000000000000000000000000000000000000
  1651 + 0000000000000000000000000000000000000000000000000000000000000000
  1652 + 0000000000000000000000000000000000000000000000000000000000000000
  1653 + 0000000000000000000000000000000000000000000000000000000000000000
  1654 + 0000000000000000000000000000000000000000000000000000000000000000
  1655 + 0000000000000000000000000000000000000000000000000000000000000000
  1656 + 0000000000000000000000000000000000000000000000000000000000000000
  1657 + 0000000000000000000000000000000000000000000000000000000000000000
  1658 + 0000000000000000000000000000000000000000000000000000000000000000
  1659 + 0000000000000000000000000000000000000000000000000000000000000000
  1660 + 0000000000000000000000000000000000000000000000000000000000000000
  1661 + 0000000000000000000000000000000000000000000000000000000000000000
  1662 + 0000000000000000000000000000000000000000000000000000000000000000
  1663 + 0000000000000000000000000000000000000000000000000000000000000000
  1664 + 0000000000000000000000000000000000000000000000000000000000000000
  1665 + 0000000000000000000000000000000000000000000000000000000000000000
  1666 + 0000000000000000000000000000000000000000000000000000000000000000
  1667 + 0000000000000000000000000000000000000000000000000000000000000000
  1668 + 0000000000000000000000000000000000000000000000000000000000000000
  1669 + 0000000000000000000000000000000000000000000000000000000000000000
  1670 + 0000000000000000000000000000000000000000000000000000000000000000
  1671 + 0000000000000000000000000000000000000000000000000000000000000000
  1672 + 0000000000000000000000000000000000000000000000000000000000000000
  1673 + 0000000000000000000000000000000000000000000000000000000000000000
  1674 + 0000000000000000000000000000000000000000000000000000000000000000
  1675 + 0000000000000000000000000000000000000000000000000000000000000000
  1676 + 0000000000000000000000000000000000000000000000000000000000000000
  1677 + 0000000000000000000000000000000000000000000000000000000000000000
  1678 + 0000000000000000000000000000000000000000000000000000000000000000
  1679 + 0000000000000000000000000000000000000000000000000000000000000000
  1680 + 0000000000000000000000000000000000000000000000000000000000000000
  1681 + 0000000000000000000000000000000000000000000000000000000000000000
  1682 + 0000000000000000000000000000000000000000000000000000000000000000
  1683 + 0000000000000000000000000000000000000000000000000000000000000000
  1684 + 0000000000000000000000000000000000000000000000000000000000000000
  1685 + 0000000000000000000000000000000000000000000000000000000000000000
  1686 + 0000000000000000000000000000000000000000000000000000000000000000
  1687 + 0000000000000000000000000000000000000000000000000000000000000000
  1688 + 0000000000000000000000000000000000000000000000000000000000000000
  1689 + 0000000000000000000000000000000000000000000000000000000000000000
  1690 + 0000000000000000000000000000000000000000000000000000000000000000
  1691 + 0000000000000000000000000000000000000000000000000000000000000000
  1692 + 0000000000000000000000000000000000000000000000000000000000000000
  1693 + 0000000000000000000000000000000000000000000000000000000000000000
  1694 + 0000000000000000000000000000000000000000000000000000000000000000
  1695 + 0000000000000000000000000000000000000000000000000000000000000000
1440 1696 00000000000000000000000000000000000000000000021C7800000000000000
1441 1697 0000000000000000000000000000000000000000000000000000000000000000
1442 1698 0000000000000000000000125B000000000000000000C0C4D7FF000000000000
1443 1699 00001E1E1EFF0000000000000000000000000000000000000000000000000000
1444 1700 00000000000000000000F0F1F5FF0000000000000000C0C4D7FF000000000000
1445 1701 0000000000000000000000000000000000000000000000000000000000000000
1446   - 00000000000000000000F0F1F5FF000000000000000000000000000000000000
  1702 + 00000000000000000000F0F1F5FF0000000000000000404040FF000000000000
1447 1703 0000000000000000000000000000000000000000000000000000000000000000
1448 1704 000000000000000000000000000000000000000000000032FD00000000000000
1449 1705 0000000000000000000000000000000000000000000000000000000000000000
... ... @@ -1451,127 +1707,135 @@ object FormularioGeral: TFormularioGeral
1451 1707 00001E1E1EFFB9B9B9FF00000000000000000000000000000000000000000000
1452 1708 000000000000405EDCFF002BDCFF00000000404B7BFF0032FDFF000000000000
1453 1709 00000000000000000000000000001E1E1EFF1E1E1EFF1E1E1EFF000000000000
1454   - 000000000000405EDCFF002BDCFF000000000000000000000000000000000000
  1710 + 000000000000405EDCFF002BDCFF0000000000000000003AFFFF000000000000
1455 1711 0000000000000000000000000000000000000000000000000000000000000000
1456   - 000000000000000000000000000000000000305159000032FD00163886000000
  1712 + 0000000000000025B6FF223172FF00000000305159000032FD00163886000000
1457 1713 0000000000000000000000000000000000000000000000000000000000000000
1458 1714 000000000000163886000032FD001E333A000C32A8FF0131F6FFC0C7E3FF0000
1459 1715 00001E1E1EFF1E1E1EFFC0C0C0FF000000000000000000000000000000000000
1460 1716 000000000000032FDBFF002EF0FFC0C3CCFF0C32A8FF0131F6FFC0C7E3FF0000
1461 1717 000000000000000000001E1E1EFF0000FFFF0000FFFF1E1E1EFF000000000000
1462   - 000000000000032FDBFF002EF0FFC0C3CCFF0000000000000000000000000000
  1718 + 000000000000032FDBFF002EF0FFC0C3CCFF1A2179FF0037FFFF313476FF0000
1463 1719 0000000000000000000000000000000000000000000000000000000000000000
1464   - 00000000000000000000000000000000000083DADC009DFFFE0083DADC000000
  1720 + 000000000000002CFFFF0028FCFF0000000083DADC009DFFFE0083DADC000000
1465 1721 00000000000025375E005078C900679AFE00679AFE004B71BB00000000000000
1466 1722 00000000000092F3F3009DFFFE005F9DA00098F8F7FF6AB1B3FFB8D3D3FF0000
1467 1723 00001E1E1EFF62F6FFFF1E1E1EFF2E4065FFAFBFDEFFD0D7E8FF000000000000
1468 1724 000000000000A6FCFCFF88E3E3FFD7E9EAFF98F8F7FF6AB1B3FFB8D3D3FF0000
1469 1725 000000000000CCD2DDFF1E1E1EFF0000FFFF0000FFFF1E1E1EFF000000000000
1470   - 000000000000A6FCFCFF88E3E3FFD7E9EAFF0000000000000000000000000000
1471   - 0000000000000000000000000000000000000000000000000000000000000000
1472   - 0000000000000000000000000000000000001126080098FDFC0030554500354F
  1726 + 000000000000A6FCFCFF88E3E3FFD7E9EAFF7DD0CEFF365860FF72BCB8FF438D
  1727 + C6FF64C9FCFF95DFF9FFA7E2EDFFA7E0EAFFA7DFE8FFA5E0E8FF88D2F4FF61C7
  1728 + F4FF0000000096F6EAFFA5FFF8FF000000001126080098FDFC0030554500354F
1473 1729 85006DA2FF00679AFE00679AFE0039558E004262A400679AFE00679AFE006DA2
1474 1730 FF0000000000345951008FEEEB0011211100487E6AFF9BFEFDFFA8B9B8FFD2DB
1475 1731 EEFF1E1E1EFF4AE9F4FF5EEDFFFF1E1E1EFF5074B9FF679AFEFF6BA0FFFF3B59
1476 1732 95FF000000008FE6E7FF8AE5E4FFC4C9C6FF487E6AFF9BFEFDFFA8B9B8FFD2DB
1477 1733 EEFF689CFAFF679AFEFF6394F3FF2F4673FF334C7DFF679AFEFF6BA0FFFF3B59
1478   - 95FF000000008FE6E7FF8AE5E4FFC4C9C6FF0000000000000000000000000000
1479   - 0000000000000000000000000000000000000000000000000000000000000000
1480   - 0000000000000000000000000000000000000000000070E136001D2C49002EB8
  1734 + 95FF000000008FE6E7FF8AE5E4FFC4C9C6FF3D5D53FFA5FFFFFF5B9699FF617B
  1735 + 9AFFF1B982FFF8CBA2FFF9E2C6FFBEC1B1FFC2C7BDFFD6CFC0FFFFDDC0FF8381
  1736 + 88FF00000000A8FFFFFF82D4D8FF000000000000000070E136001D2C49002EB8
1481 1737 E700679AFE00679AFE002A3F6900679AFE00679AFE002F477700679AFE00679A
1482 1738 FE002EB8E7001E333A0070E1360000000000587251FF51A42AFF41639EFF5097
1483 1739 E8FF1E1E1EFF45E8F2FF5EEAFFFF5FEEFFFF1E1E1EFF4F72B0FF679AFEFF6498
1484 1740 FAFF4B93DFFF468F25FF61C330FF00000000587251FF51A42AFF41639EFF5097
1485 1741 E8FF679AFEFF679AFEFF1E1E1EFF0000FFFF0000FFFF1E1E1EFF679AFEFF6498
1486   - FAFF4B93DFFF468F25FF61C330FF000000000000000000000000000000000000
1487   - 0000000000000000000000000000000000000000000000000000000000000000
1488   - 000000000000000000000000000000000000000000004262A400679AFE0030C0
  1742 + FAFF4B93DFFF468F25FF61C330FF00000000000000004A9526FF355159FF4E9B
  1743 + E7FFECC195FFD0ECFDFFE0EDF2FF7EB1C8FF8EBDD2FF86BCD5FFAED1E2FF9A98
  1744 + B8FF4775CCFF4DA11BFF4C9820FF00000000000000004262A400679AFE0030C0
1489 1745 F00030C0F0006494F800679AFE00679AFE00679AFE00679AFE005F91F0002EB8
1490 1746 E70030C8F9006DA2FF004B71BB0000000000D2D2D4FF2F5B1EFF3FA2E2FF3F99
1491 1747 D9FF42A0E3FF1E1E1EFF5EEAFFFF5EEAFFFF61F2FFFF1E1E1EFF4E72B8FF33B5
1492 1748 E9FF33B9EDFF36577FFFA3AEB5FF00000000D2D2D4FF2F5B1EFF3FA2E2FF3F99
1493 1749 D9FF42A0E3FF679AFEFF1E1E1EFF0000FFFF0000FFFF1E1E1EFF5F95F3FF33B5
1494   - E9FF33B9EDFF36577FFFA3AEB5FF000000000000000000000000000000000000
1495   - 0000000000000000000000000000000000000000000000000000000000000000
1496   - 000000000000000000000000000000000000679AFE00679AFE00679AFE00679A
  1750 + E9FF33B9EDFF36577FFFA3AEB5FF0000000000000000315F23FF449BEAFF4389
  1751 + CEFF93A8B1FFFFE8BFFFE0EAE9FF8CC6DAFF95CADDFFDDDDCFFFEED7BDFF30AF
  1752 + E0FF2DBDE9FF375848FF0000000000000000679AFE00679AFE00679AFE00679A
1497 1753 FE005F91F000679AFE00679AFE00679AFE00679AFE00679AFE00679AFE005690
1498 1754 E600679AFE00679AFE00679AFE005A88E2006090EEFF679AFEFF679AFEFF40A1
1499 1755 E1FF5C93EFFF1E1E1EFF5FEDFFFF5EEAFFFF5EEAFFFF60F1FFFF1E1E1EFF2C8D
1500 1756 B1FF6498FAFF679AFEFF679AFEFFCBD0DAFF6090EEFF679AFEFF679AFEFF40A1
1501 1757 E1FF5C93EFFF679AFEFF1E1E1EFF0000FFFF0000FFFF1E1E1EFF679AFEFF38B0
1502   - EAFF6498FAFF679AFEFF679AFEFFCBD0DAFF0000000000000000000000000000
1503   - 0000000000000000000000000000000000000000000000000000000000000000
1504   - 0000000000000000000000000000000000004262A400679AFE00679AFE00679A
  1758 + EAFF6498FAFF679AFEFF679AFEFFCBD0DAFF4568ACFF699EFFFF669AFFFF4998
  1759 + E4FF5785DDFFC5B4B0FFFEE4C3FFFFE0B7FFFFE3BCFFF3D5BAFF7F9BE3FF2CB1
  1760 + DEFF6C96FFFF699EFFFF6FA6FFFF000000004262A400679AFE00679AFE00679A
1505 1761 FE005A88E2005078C9004262A400679AFE00679AFE005781D9004B71BB005781
1506 1762 D900679AFE00679AFE00679AFE004669B0006597F9FF679AFEFF679AFEFF1E1E
1507 1763 1EFF55EBFFFF55EAFFFF5EEAFFFF1E1E1EFF1E1E1EFF1E1E1EFF1E1E1EFF1E1E
1508 1764 1EFF5F8DE7FF679AFEFF679AFEFF526385FF6597F9FF679AFEFF679AFEFF679A
1509 1765 FEFF6394F6FF6090EFFF1E1E1EFF0000FFFF0000FFFF0000FFFF1E1E1EFF6395
1510   - F7FF679AFEFF679AFEFF679AFEFF526385FF0000000000000000000000000000
1511   - 0000000000000000000000000000000000000000000000000000000000000000
1512   - 000000000000000000000000000000000000000000003D5C99005E8DE900679A
  1766 + F7FF679AFEFF679AFEFF679AFEFF526385FF5680D6FF6698FFFF6699FFFF6699
  1767 + FFFF6A9FFFFF699DFFFF8C95B7FFFFEAC1FFFBDAB3FF689DFFFF6A9FFFFF6A9F
  1768 + FFFF6699FFFF6699FFFF6DA4FFFF181F2AFF000000003D5C99005E8DE900679A
1513 1769 FE00679AFE00679AFE00679AFE00679AFE00679AFE00679AFE00679AFE00679A
1514 1770 FE00679AFE005A88E20025375E000000000004070BFF6190F0FF6698FCFF1E1E
1515 1771 1EFF4FE9F5FF5EEAFFFF5EEAFFFF5FEEFFFF1E1E1EFF1E1E1EFF1E1E1EFF1E1E
1516 1772 1EFF1E1E1EFF6496F7FF263A5EFFD0D0D0FF04070BFF6190F0FF6698FCFF679A
1517 1773 FEFF6BA0FFFF679AFEFF679AFEFF2F4F90FF0000FFFF0000FFFF0000FFFF1E1E
1518   - 1EFF6699FDFF6496F7FF263A5EFFD0D0D0FF0000000000000000000000000000
1519   - 0000000000000000000000000000000000000000000000000000000000000000
1520   - 0000000000000000000000000000000000000000000000000000000000000000
  1774 + 1EFF6699FDFF6496F7FF263A5EFFD0D0D0FF262626FF679AF0FF6FA6FFFF6BA1
  1775 + FFFF5F8FEFFF9997A5FFF7DCBFFF8EBCD9FF9EBFCFFFE2C4ACFF5E84D3FF6495
  1776 + F9FF6EA5FFFF699EFFFF141B29FF000000000000000000000000000000000000
1521 1777 0000000000000000000000000000000000000000000000000000000000000000
1522 1778 000000000000000000000000000000000000404040FF000000FF000000FF0203
1523 1779 03FF034F5EFF5EEBFFFF5EEAFFFF5EEAFFFF23E2F8FF1F2228FF0F1626FF0206
1524 1780 0CFF000000FF000000FF000000FF00000000404040FF000000FF000000FF0203
1525 1781 03FF0000FFFF0000FFFF1E1E1EFF476BB2FF2A3F6AFF0000FFFF0000FFFF1E1E
1526   - 1EFF000000FF000000FF000000FF000000000000000000000000000000000000
1527   - 0000000000000000000000000000000000000000000000000000000000000000
1528   - 0000000000000000000000000000000000000000000000092E00000724000007
  1782 + 1EFF000000FF000000FF000000FF000000005A5A5AFF000000FF000000FF0000
  1783 + 00FF675B54FFFFDEB4FFE1F1F6FF8EC1D0FF9BCADAFFF3E1CCFFE7CBB3FF0000
  1784 + 00FF000000FF000000FF000000FF000000000000000000092E00000724000007
1529 1785 2400000724000007240000072400000724000007240000072400000724000007
1530 1786 2400000724000007240000092E000000000000000000000109FF000109FF0001
1531 1787 09FF1E1E1EFF5AEFFDFF5EEAFFFF5EEAFFFF5EEAFFFF149DADFF0D0D0EFF0001
1532 1788 09FF000109FF000109FF000105FF0000000000000000000109FF000109FF0001
1533 1789 09FF0000FFFF0000FFFF1E1E1EFF1E1E1EFF000109FF1E1E1EFF0000FFFF1E1E
1534   - 1EFF000109FF000109FF000105FF000000000000000000000000000000000000
1535   - 0000000000000000000000000000000000000000000000000000000000000000
1536   - 00000000000000000000000000000000000000000000000000004DBCB1004DBC
  1790 + 1EFF000109FF000109FF000105FF0000000000000000000207FF000104FF0001
  1791 + 04FFFBC78DFFFAECC8FFFAE8C0FFFEDEA9FFFCE3B8FFFAE6C3FFFFF8DAFF644A
  1792 + 35FF000104FF000104FF525256FF0000000000000000000000004DBCB1004DBC
1537 1793 B1004DBCB1004DBCB1004DBCB1004DBCB1004DBCB1004DBCB1004DBCB1004DBC
1538 1794 B1004DBCB1004DBCB1000000000000000000000000001B3C7DFF144486FF1444
1539 1795 86FF1E1E1EFF0AA2B7FF5EEAFFFF5EEAFFFF5EEAFFFF5EEAFFFF10353AFF1E1E
1540 1796 1EFF144486FF134081FFD0D2E0FF00000000000000001B3C7DFF144486FF1444
1541 1797 86FF0000FFFF0000FFFF0000FFFF1E1E1EFF1E1E1EFF0000FFFF0000FFFF1E1E
1542   - 1EFF1E1E1EFF134081FFD0D2E0FF000000000000000000000000000000000000
1543   - 0000000000000000000000000000000000000000000000000000000000000000
1544   - 0000000000000000000000000000000000000000000000000000296355002757
  1798 + 1EFF1E1E1EFF134081FFD0D2E0FF0000000000000000424857FF317D92FF2C72
  1799 + A8FF3599D9FF4DB1EAFF5CBBF0FF5CBAEDFF5BB9ECFF5BB9EBFF429FDAFF2A87
  1800 + C5FF2D7288FF20566AFF00000000000000000000000000000000296355002757
1545 1801 BC006DC1830027636C00325B7F0034662900113562003C6C960060B150001247
1546 1802 A1005693AB0000000000000000000000000000000000000000005E8A57FF061C
1547 1803 62FF355B54FF1D311FFF5DEEFFFF5EEAFFFF5EEAFFFF5EEAFFFF2AC4D5FF1D1F
1548 1804 1CFF0B165DFFE9FAF5FF000000000000000000000000000000005E8A57FF061C
1549 1805 62FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF1E1E
1550   - 1EFF1E1E1EFFE9FAF5FF00000000000000000000000000000000000000000000
1551   - 0000000000000000000000000000000000000000000000000000000000000000
1552   - 00000000000000000000000000000000000000000000000000001854B8006ABD
  1806 + 1EFF1E1E1EFFE9FAF5FF00000000000000000000000000000000346A29FF326A
  1807 + B6FF61A7D4FF53A5D9FF51A5D9FF4FA5D9FF50A5D9FF50A4D9FF5BA5D7FF65A7
  1808 + D3FF01168FFF83BEBEFF000000000000000000000000000000001854B8006ABD
1553 1809 FE006ECE4F000B3AB70073C1D4005AB32B000333EE0089E9FF006BD335000026
1554 1810 C10077C7CB004E9F2A00000000000000000000000000D0D7F5FF54AE4DFF1946
1555 1811 E0FF88ECB6FF418E54FF54F0FFFF5EEAFFFF5EEAFFFF5EEAFFFF5EEAFFFF1768
1556 1812 74FF1E1E1EFF78D39AFF000000000000000000000000D0D7F5FF54AE4DFF1946
1557 1813 E0FF5FA87CFF1E1E1EFF1E1E1EFF1E1E1EFF1E1E1EFF1E1E1EFF1E1E1EFF1E1E
1558   - 1EFF1E1E1EFF78D39AFF00000000000000000000000000000000000000000000
1559   - 0000000000000000000000000000000000000000000000000000000000000000
1560   - 0000000000000000000000000000000000000000000000000000000000000000
  1814 + 1EFF1E1E1EFF78D39AFF00000000000000000000000000000000266A74FF3A79
  1815 + FFFF89EA7FFF1F5E6EFF3370FFFF89ED84FF2E7452FF1F54FFFF8EF0A4FF357F
  1816 + 52FF1B4EFDFF83E1B0FF00000000000000000000000000000000000000000000
1561 1817 000075CD91003B855B000000000000000000000000000000000063B55900205C
1562 1818 8E000000000000000000000000000000000000000000000000006BC061FF1E4A
1563 1819 CFFF77CBC0FF639D64FF1E1E1EFF1E1E1EFF1E1E1EFF1E1E1EFF1E1E1EFF1E1E
1564 1820 1EFF555555FF1E1E1EFF000000000000000000000000000000006BC061FF1E4A
1565 1821 CFFF77CBC0FF639D64FF1E1E1EFF1E1E1EFF1E1E1EFF1E1E1EFF1E1E1EFF1E1E
1566   - 1EFF557FEFFF88E1B9FF00000000000000000000000000000000000000000000
1567   - 0000000000000000000000000000000000000000000000000000000000000000
1568   - 000000000000000000000000000000000000424D3E000000000000003E000000
1569   - 2800000040000000100000000100010000000000800000000000000000000000
1570   - 000000000000000000000000FFFFFF00BFFDB7FDBFFD0000BFFD33F93E390000
1571   - 1FF811F81C380000183810381838000000080008000800008001000100010000
1572   - 8001000100010000000000000000000000000000000000000001000000000000
1573   - 80010001000100008001800180010000C003800180010000C007C003C0030000
1574   - C003800380030000F3CFC003C003000000000000000000000000000000000000
  1822 + 1EFF557FEFFF88E1B9FF000000000000000000000000000000004F8F44FF1B3D
  1823 + C0FF7ABCB0FF519442FF1B3CBAFF71B6BAFF60A549FF1538ABFF6BA9C5FF63A7
  1824 + 47FF1338A6FF89C4C9FF0000000000000000424D3E000000000000003E000000
  1825 + 2800000040000000300000000100010000000000800100000000000000000000
  1826 + 000000000000000000000000FFFFFF0000000000000000000000000000000000
  1827 + 0000000000000000000000000000000000000000000000000000000000000000
  1828 + 0000000000000000000000000000000000000000000000000000000000000000
  1829 + 0000000000000000000000000000000000000000000000000000000000000000
  1830 + 0000000000000000000000000000000000000000000000000000000000000000
  1831 + 0000000000000000000000000000000000000000000000000000000000000000
  1832 + 0000000000000000000000000000000000000000000000000000000000000000
  1833 + 0000000000000000000000000000000000000000000000000000000000000000
  1834 + 00000000000000000000000000000000BFFDB7FDBFFDBFFFBFFD33F93E39BFF9
  1835 + 1FF811F81C381FF9183810381838000900080008000800098001000100018001
  1836 + 8001000100018003000000000000000100000000000000000001000000000001
  1837 + 80010001000100018001800180018001C003800180018003C007C003C003C003
  1838 + C00380038003C003F3CFC003C003C00300000000000000000000000000000000
1575 1839 000000000000}
1576 1840 end
1577 1841 end
... ...
main.pas
... ... @@ -40,6 +40,7 @@ uses
40 40 CACIC_Library,
41 41 ImgList,
42 42 Graphics;
  43 +
43 44 //IdTCPServer;
44 45 //IdFTPServer;
45 46  
... ... @@ -53,7 +54,7 @@ var
53 54 v_versao,
54 55 v_DataCacic2DAT,
55 56 v_Tamanho_Arquivo,
56   - strConfigsPatrimonio : string;
  57 + strConfigsPatrimonio : string;
57 58  
58 59 var
59 60 BatchFile : TStringList;
... ... @@ -63,10 +64,11 @@ var
63 64  
64 65 var
65 66 g_intTaskBarAtual,
66   - g_intTaskBarAnterior : integer;
  67 + g_intTaskBarAnterior : integer;
67 68  
68 69 var
69   - boolDebugs : Boolean;
  70 + boolDebugs,
  71 + boolWinIniChange : Boolean;
70 72  
71 73 var
72 74 g_oCacic: TCACIC;
... ... @@ -185,7 +187,7 @@ type
185 187 procedure Mnu_InfosPatrimoniaisClick(Sender: TObject);
186 188 procedure HabilitaTCP;
187 189 procedure HabilitaPatrimonio;
188   - procedure HabilitaSuporteRemoto;
  190 + procedure HabilitaSuporteRemoto;
189 191 procedure Matar(v_dir,v_files: string);
190 192 Procedure DelValorReg(Chave: String);
191 193  
... ... @@ -219,7 +221,7 @@ type
219 221 Function RetornaValorVetorUON1(id1 : string) : String;
220 222 Function RetornaValorVetorUON1a(id1a : string) : String;
221 223 Function RetornaValorVetorUON2(id2, idLocal: string) : String;
222   - procedure Invoca_GerCols(Sender: TObject;p_acao:string);
  224 + procedure Invoca_GerCols(p_acao:string);
223 225 function GetVersionInfo(p_File: string):string;
224 226 function VerFmt(const MS, LS: DWORD): string;
225 227 procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
... ... @@ -228,16 +230,22 @@ type
228 230 // Shutdown do Windows e "derrubar" o Cacic.
229 231 procedure WMQueryEndSession(var Msg : TWMQueryEndSession); Message WM_QUERYENDSESSION;
230 232 procedure WMMENUSELECT(var msg: TWMMENUSELECT); message WM_MENUSELECT;
  233 + protected
  234 + procedure WndProc(var Message: TMessage); override;
231 235 public
232 236 Function Implode(p_Array : TStrings ; p_Separador : String) : String;
233 237 function GetFolderDate(Folder: string): TDateTime;
234 238 Function CipherClose : String;
  239 + Procedure CipherCloseGenerico(p_TstrCipherOpened : TStrings; p_StrFileName : String);
235 240 Function CipherOpen : TStrings;
  241 + Procedure CipherOpenGenerico(var p_TstrCipherOpened : TStrings; p_StrFileName : String);
236 242 Function Explode(Texto, Separador : String) : TStrings;
237 243 Function GetValorDatMemoria(p_Chave : String; p_tstrCipherOpened : TStrings) : String;
238 244 Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String; p_tstrCipherOpened : TStrings);
239 245 function URLDecode(const S: string): string;
240 246 Function XML_RetornaValor(Tag : String; Fonte : String): String;
  247 + Procedure EqualizaInformacoesPatrimoniais;
  248 + Function SetValorChaveRegEdit(Chave: String; Dado: Variant): Variant;
241 249 end;
242 250  
243 251 var FormularioGeral : TFormularioGeral;
... ... @@ -248,8 +256,14 @@ implementation
248 256  
249 257 {$R *.dfm}
250 258  
251   -Uses StrUtils, Inifiles, frmConfiguracoes, frmSenha, frmLog,
252   - Math,LibXmlParser,WinVNC;
  259 +Uses StrUtils,
  260 + Inifiles,
  261 + frmConfiguracoes,
  262 + frmSenha,
  263 + frmLog,
  264 + Math,
  265 + LibXmlParser,
  266 + WinVNC;
253 267  
254 268 // Estruturas de dados para armazenar os itens da uon1, uon1a e uon2
255 269 type
... ... @@ -302,6 +316,17 @@ begin
302 316 (VetorUON2[I].id_local = idLocal) Then Result := VetorUON2[I].nm2;
303 317 end;
304 318  
  319 +procedure TFormularioGeral.WndProc(var Message: TMessage);
  320 +begin
  321 + case Message.Msg of
  322 + WM_WININICHANGE :
  323 + Begin
  324 + // Esta mensagem é recebida quando efetuado LogOff/LogOn em máquinas com VISTA,
  325 + boolWinIniChange := true;
  326 + End;
  327 + end;
  328 + inherited;
  329 +end;
305 330 procedure TFormularioGeral.MontaVetoresPatrimonio(p_strConfigs : String);
306 331 var Parser : TXmlParser;
307 332 i : integer;
... ... @@ -473,6 +498,7 @@ Begin
473 498 if (tstrJANELAS.Count > 0) then
474 499 for intAux := 0 to tstrJANELAS.Count-1 Do
475 500 Begin
  501 +
476 502 h := FormularioGeral.FindWindowByTitle(tstrJANELAS[intAux]);
477 503 if h <> 0 then intContaJANELAS := 1;
478 504 break;
... ... @@ -546,8 +572,10 @@ var
546 572 Found: Integer;
547 573 Date: TDateTime;
548 574 begin
549   - if Folder[Length(folder)] = '\' then
550   - Delete(Folder, Length(folder), 1);
  575 +
  576 + if (Folder[Length(folder)] = '\') then
  577 + Folder := Copy(Folder,0,Length(Folder)-1);
  578 +
551 579 Result := 0;
552 580 Found := FindFirst(Folder, faDirectory, Rec);
553 581 try
... ... @@ -610,6 +638,42 @@ begin
610 638 log_DEBUG(g_oCacic.getCacicPath + g_oCacic.getDatFileName+' fechado com sucesso!');
611 639 end;
612 640  
  641 +Procedure TFormularioGeral.CipherCloseGenerico(p_TstrCipherOpened : TStrings; p_StrFileName : String);
  642 +var v_DatFile : TextFile;
  643 + intAux : integer;
  644 + v_strCipherOpenImploded ,
  645 + v_strCipherClosed : string;
  646 +begin
  647 +
  648 + log_DEBUG('Fechando '+p_StrFileName);
  649 + if boolDebugs then
  650 + for intAux := 0 to (p_TstrCipherOpened.Count-1) do
  651 + log_DEBUG('Posição ['+inttostr(intAux)+']='+p_TstrCipherOpened[intAux]);
  652 +
  653 + try
  654 + FileSetAttr (p_StrFileName,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
  655 +
  656 + log_DEBUG('Localizando arquivo: '+p_StrFileName);
  657 + AssignFile(v_DatFile,p_StrFileName); {Associa o arquivo a uma variável do tipo TextFile}
  658 + {$IOChecks off}
  659 + log_DEBUG('Abrindo arquivo: '+p_StrFileName);
  660 + ReWrite(v_DatFile); {Abre o arquivo texto}
  661 + {$IOChecks on}
  662 + log_DEBUG('Append(2) no arquivo: '+p_StrFileName);
  663 + Append(v_DatFile);
  664 + log_DEBUG('Criando vetor para criptografia.');
  665 + v_strCipherOpenImploded := Implode(p_TstrCipherOpened,g_oCacic.getSeparatorKey);
  666 +
  667 + log_DEBUG('Salvando a string "'+v_strCipherOpenImploded+'" em '+p_StrFileName);
  668 + v_strCipherClosed := g_oCacic.enCrypt(v_strCipherOpenImploded);
  669 + Writeln(v_DatFile,v_strCipherClosed); {Grava a string Texto no arquivo texto}
  670 + CloseFile(v_DatFile);
  671 + except
  672 + log_diario('ERRO NA GRAVAÇÃO DO ARQUIVO DE CONFIGURAÇÕES.('+ p_StrFileName+')');
  673 + end;
  674 + log_DEBUG(p_StrFileName+' fechado com sucesso!');
  675 +end;
  676 +
613 677 function TFormularioGeral.Get_File_Size(sFileToExamine: string; bInKBytes: Boolean): string;
614 678 var
615 679 SearchRec: TSearchRec;
... ... @@ -694,6 +758,54 @@ begin
694 758 else log_DEBUG(g_oCacic.getCacicPath + g_oCacic.getDatFileName + ' ainda não alterado! Não foi necessário reabrí-lo.');
695 759 end;
696 760  
  761 +Procedure TFormularioGeral.CipherOpenGenerico(var p_TstrCipherOpened : TStrings; p_StrFileName : String);
  762 +var v_DatFile : TextFile;
  763 + strClosedAUX,
  764 + strOpenedAUX : String;
  765 +begin
  766 + if FileExists(p_StrFileName) then
  767 + begin
  768 + log_DEBUG(p_StrFileName+' já existe!');
  769 + AssignFile(v_DatFile,p_StrFileName);
  770 + log_DEBUG('Abrindo '+p_StrFileName);
  771 +
  772 + {$IOChecks off}
  773 + Reset(v_DatFile);
  774 + {$IOChecks on}
  775 +
  776 + log_DEBUG('Verificação de Existência.');
  777 + if (IOResult <> 0)then // Arquivo não existe, será recriado.
  778 + begin
  779 + log_DEBUG('Recriando "'+p_StrFileName+'"');
  780 + Rewrite (v_DatFile);
  781 + log_DEBUG('Inserindo Primeira Linha.');
  782 + Append(v_DatFile);
  783 + end;
  784 +
  785 + log_DEBUG('Lendo '+p_StrFileName);
  786 +
  787 + Readln(v_DatFile,strClosedAUX);
  788 +
  789 + log_DEBUG('Povoando Variável');
  790 + while not EOF(v_DatFile) do Readln(v_DatFile,strClosedAUX);
  791 + log_DEBUG('Fechando '+p_StrFileName);
  792 + CloseFile(v_DatFile);
  793 + log_DEBUG('Chamando Criptografia de conteúdo');
  794 + strOpenedAUX := g_oCacic.deCrypt(strClosedAUX);
  795 + end;
  796 + if (trim(strOpenedAUX)<>'') then
  797 + p_TstrCipherOpened := explode(strOpenedAUX,g_oCacic.getSeparatorKey)
  798 + else
  799 + Begin
  800 + p_TstrCipherOpened := explode('Configs.ID_SO'+g_oCacic.getSeparatorKey+ g_oCacic.getWindowsStrId() +g_oCacic.getSeparatorKey+
  801 + 'Configs.Endereco_WS'+g_oCacic.getSeparatorKey+'/cacic2/ws/',g_oCacic.getSeparatorKey+'Patrimonio.dt_ultima_renovacao'+g_oCacic.getSeparatorKey+ '0');
  802 + log_DEBUG(p_StrFileName+' Inexistente. Criado o DAT em memória.');
  803 + End;
  804 +
  805 + if p_TstrCipherOpened.Count mod 2 = 0 then
  806 + p_TstrCipherOpened.Add('');
  807 +end;
  808 +
697 809 Procedure TFormularioGeral.SetValorDatMemoria(p_Chave : string; p_Valor : String; p_tstrCipherOpened : TStrings);
698 810 var v_Aux : string;
699 811 begin
... ... @@ -718,6 +830,57 @@ begin
718 830 log_DEBUG('Resgatando Chave: "'+p_Chave+'" de MemoryDAT => "'+Result+'"');
719 831 end;
720 832  
  833 +function TFormularioGeral.SetValorChaveRegEdit(Chave: String; Dado: Variant): Variant;
  834 +var RegEditSet: TRegistry;
  835 + RegDataType: TRegDataType;
  836 + strRootKey, strKey, strValue : String;
  837 + ListaAuxSet : TStrings;
  838 + I : Integer;
  839 +begin
  840 + ListaAuxSet := g_oCacic.explode(Chave, '\');
  841 + strRootKey := ListaAuxSet[0];
  842 + For I := 1 To ListaAuxSet.Count - 2 Do
  843 + strKey := strKey + ListaAuxSet[I] + '\';
  844 + strValue := ListaAuxSet[ListaAuxSet.Count - 1];
  845 +
  846 + RegEditSet := TRegistry.Create;
  847 + try
  848 + log_DEBUG('Em TFormularioGeral.SetValorChaveRegEdit: Abrindo Registry para Escrita => Root: "'+strRootKey+ '" Key: "'+strKey+'"');
  849 + RegEditSet.Access := KEY_WRITE;
  850 + RegEditSet.Rootkey := GetRootKey(strRootKey);
  851 +
  852 + if RegEditSet.OpenKey(strKey, True) then
  853 + Begin
  854 + RegDataType := RegEditSet.GetDataType(strValue);
  855 +
  856 + // Sempre será String
  857 + RegDataType := rdString;
  858 +
  859 + if RegDataType = rdString then
  860 + begin
  861 + RegEditSet.WriteString(strValue, Dado);
  862 + end
  863 + else if RegDataType = rdExpandString then
  864 + begin
  865 + RegEditSet.WriteExpandString(strValue, Dado);
  866 + end
  867 + else if RegDataType = rdInteger then
  868 + begin
  869 + RegEditSet.WriteInteger(strValue, Dado);
  870 + end
  871 + else
  872 + begin
  873 + RegEditSet.WriteString(strValue, Dado);
  874 + end;
  875 +
  876 + end;
  877 + finally
  878 + RegEditSet.CloseKey;
  879 + end;
  880 + ListaAuxSet.Free;
  881 + RegEditSet.Free;
  882 +end;
  883 +
721 884 function TFormularioGeral.VerFmt(const MS, LS: DWORD): string;
722 885 // Format the version number from the given DWORDs containing the info
723 886 begin
... ... @@ -912,26 +1075,26 @@ begin
912 1075 while result=0 do
913 1076 begin
914 1077 log_DEBUG('Tentativa de Exclusão de "'+v_dir + SearchRec.Name+'"');
915   - DeleteFile(v_dir+SearchRec.Name);
  1078 + DeleteFile(PAnsiChar(v_dir+SearchRec.Name));
916 1079 Result:=FindNext(SearchRec);
917 1080 end;
918 1081 end;
919 1082  
920 1083 procedure TFormularioGeral.HabilitaTCP;
921 1084 Begin
  1085 + FormularioGeral.EqualizaInformacoesPatrimoniais;
922 1086 // Desabilita/Habilita a opção de Informações de TCP/IP
923   - Mnu_InfosTCP.Enabled := False;
924   - if (getValorDatMemoria('TcpIp.TE_NOME_HOST' ,v_tstrCipherOpened) +
925   - getValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened) +
926   - getValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened) +
927   - getValorDatMemoria('TcpIp.TE_DOMINIO_DNS' ,v_tstrCipherOpened) +
928   - getValorDatMemoria('TcpIp.TE_DNS_PRIMARIO' ,v_tstrCipherOpened) +
929   - getValorDatMemoria('TcpIp.TE_DNS_SECUNDARIO' ,v_tstrCipherOpened) +
930   - getValorDatMemoria('TcpIp.TE_GATEWAY' ,v_tstrCipherOpened) +
931   - getValorDatMemoria('TcpIp.TE_MASCARA' ,v_tstrCipherOpened) +
932   - getValorDatMemoria('TcpIp.TE_SERV_DHCP' ,v_tstrCipherOpened) +
933   - getValorDatMemoria('TcpIp.TE_WINS_PRIMARIO' ,v_tstrCipherOpened) +
934   - getValorDatMemoria('TcpIp.TE_WINS_SECUNDARIO',v_tstrCipherOpened) <> '') then Mnu_InfosTCP.Enabled := True;
  1087 + Mnu_InfosTCP.Enabled := (getValorDatMemoria('TcpIp.TE_NOME_HOST' ,v_tstrCipherOpened) +
  1088 + getValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened) +
  1089 + getValorDatMemoria('TcpIp.ID_IP_REDE' ,v_tstrCipherOpened) +
  1090 + getValorDatMemoria('TcpIp.TE_DOMINIO_DNS' ,v_tstrCipherOpened) +
  1091 + getValorDatMemoria('TcpIp.TE_DNS_PRIMARIO' ,v_tstrCipherOpened) +
  1092 + getValorDatMemoria('TcpIp.TE_DNS_SECUNDARIO' ,v_tstrCipherOpened) +
  1093 + getValorDatMemoria('TcpIp.TE_GATEWAY' ,v_tstrCipherOpened) +
  1094 + getValorDatMemoria('TcpIp.TE_MASCARA' ,v_tstrCipherOpened) +
  1095 + getValorDatMemoria('TcpIp.TE_SERV_DHCP' ,v_tstrCipherOpened) +
  1096 + getValorDatMemoria('TcpIp.TE_WINS_PRIMARIO' ,v_tstrCipherOpened) +
  1097 + getValorDatMemoria('TcpIp.TE_WINS_SECUNDARIO',v_tstrCipherOpened) <> '');
935 1098 End;
936 1099  
937 1100 Function TFormularioGeral.Explode(Texto, Separador : String) : TStrings;
... ... @@ -978,17 +1141,13 @@ end;
978 1141 procedure TFormularioGeral.HabilitaPatrimonio;
979 1142 Begin
980 1143 // Desabilita/Habilita a opção de Informações Patrimoniais
981   - Mnu_InfosPatrimoniais.Enabled := False;
982   - if (getValorDatMemoria('Configs.CS_COLETA_PATRIMONIO',v_tstrCipherOpened) = 'S') then Mnu_InfosPatrimoniais.Enabled := True;
  1144 + Mnu_InfosPatrimoniais.Enabled := (getValorDatMemoria('Configs.CS_COLETA_PATRIMONIO',v_tstrCipherOpened) = 'S');
983 1145 End;
984 1146  
985 1147 procedure TFormularioGeral.HabilitaSuporteRemoto;
986 1148 Begin
987 1149 // Desabilita/Habilita a opção de Suporte Remoto
988   - Mnu_SuporteRemoto.Enabled := False;
989   - if (getValorDatMemoria('Configs.CS_SUPORTE_REMOTO',v_tstrCipherOpened) = 'S') and
990   - (FileExists(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe')) then
991   - Mnu_SuporteRemoto.Enabled := True;
  1150 + Mnu_SuporteRemoto.Enabled := (getValorDatMemoria('Configs.CS_SUPORTE_REMOTO',v_tstrCipherOpened) = 'S') and (FileExists(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe'));
992 1151 End;
993 1152  
994 1153  
... ... @@ -1071,13 +1230,16 @@ var strAux,
1071 1230 v_Aguarde : TextFile;
1072 1231 v_SystemDrive : TStrings;
1073 1232 begin
  1233 +
1074 1234 // Essas variáveis ajudarão a controlar o redesenho do ícone no systray,
1075 1235 // evitando o "roubo" do foco.
1076 1236 g_intTaskBarAtual := 0;
1077 1237 g_intTaskBarAnterior := 0;
1078   -
  1238 + boolWinIniChange := false;
  1239 +
1079 1240 // Não mostrar o formulário...
1080 1241 Application.ShowMainForm:=false;
  1242 +
1081 1243 g_oCacic := TCACIC.Create;
1082 1244  
1083 1245 g_oCacic.setBoolCipher(true);
... ... @@ -1086,7 +1248,6 @@ begin
1086 1248  
1087 1249  
1088 1250 Try
1089   -
1090 1251 g_oCacic.setCacicPath(getValorChaveRegIni('Cacic2','cacic_dir',g_oCacic.getWinDir + 'chksis.ini')) ;
1091 1252  
1092 1253 if not DirectoryExists(g_oCacic.getCacicPath + 'Temp') then
... ... @@ -1121,9 +1282,9 @@ begin
1121 1282 Writeln(v_Aguarde,'Futuramente penso em colocar aqui o pID, para possibilitar finalização via software externo...');
1122 1283 Append(v_Aguarde);
1123 1284  
1124   - v_DataCacic2DAT := '';
1125   - v_tstrCipherOpened := TStrings.Create;
1126   - v_tstrCipherOpened := CipherOpen;
  1285 + v_DataCacic2DAT := '';
  1286 + v_tstrCipherOpened := TStrings.Create;
  1287 + v_tstrCipherOpened := CipherOpen;
1127 1288  
1128 1289 if FileExists(g_oCacic.getCacicPath + 'cacic2.ini') then
1129 1290 Begin
... ... @@ -1146,6 +1307,13 @@ begin
1146 1307 Matar(g_oCacic.getCacicPath,'cacic2.ini');
1147 1308 End;
1148 1309  
  1310 + // Procedimento para que sejam igualadas as informações de patrimônio caso seja usado o MapaCACIC
  1311 + EqualizaInformacoesPatrimoniais;
  1312 +
  1313 + // Inicializo bloqueando o módulo de suporte remoto seguro na FireWall nativa.
  1314 + if FileExists(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe') then
  1315 + g_oCacic.addApplicationToFirewall('srCACIC - Suporte Remoto Seguro do Sistema CACIC',g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe', false);
  1316 +
1149 1317 if (ParamCount > 0) then //Caso o Cacic2 seja chamado com passagem de parâmetros...
1150 1318 Begin
1151 1319 // Parâmetros possíveis (aceitos)
... ... @@ -1190,7 +1358,7 @@ begin
1190 1358 ShutdownEmExecucao := False;
1191 1359  
1192 1360 // Não mostrar o formulário...
1193   - Application.ShowMainForm:=false;
  1361 + //Application.ShowMainForm:=false;
1194 1362  
1195 1363 Try
1196 1364 // A chamada abaixo define os valores usados pelo agente principal.
... ... @@ -1200,6 +1368,7 @@ begin
1200 1368 End;
1201 1369  
1202 1370 InicializaTray;
  1371 +
1203 1372 CipherClose;
1204 1373 End
1205 1374 else
... ... @@ -1211,14 +1380,43 @@ begin
1211 1380 Except
1212 1381 log_diario('PROBLEMAS NA INICIALIZAÇÃO (2)');
1213 1382 End;
1214   -
1215 1383 end;
1216 1384  
  1385 +Procedure TFormularioGeral.EqualizaInformacoesPatrimoniais;
  1386 +var tstrAUX : TStrings;
  1387 +Begin
  1388 + tstrAUX := TStrings.Create;
  1389 + CipherOpenGenerico(tstrAUX,g_ocacic.getCacicPath + 'MapaCACIC.dat');
  1390 +
  1391 + // Caso as informações patrimoniais coletadas pelo MapaCACIC sejam mais atuais, obtenho-as...
  1392 + if (getValorDatMemoria('Patrimonio.dt_ultima_renovacao',v_tstrCipherOpened) = '') or
  1393 + (StrToInt64(getValorDatMemoria('Patrimonio.dt_ultima_renovacao',tstrAUX)) > StrToInt64(getValorDatMemoria('Patrimonio.dt_ultima_renovacao',v_tstrCipherOpened))) then
  1394 + Begin
  1395 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1' , getValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1' ,tstrAUX), v_tstrCipherOpened);
  1396 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1a', getValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1a',tstrAUX), v_tstrCipherOpened);
  1397 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2' , getValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2' ,tstrAUX), v_tstrCipherOpened);
  1398 + SetValorDatMemoria('Patrimonio.id_local' , getValorDatMemoria('Patrimonio.id_local' ,tstrAUX), v_tstrCipherOpened);
  1399 + SetValorDatMemoria('Patrimonio.te_localizacao_complementar' , getValorDatMemoria('Patrimonio.te_localizacao_complementar' ,tstrAUX), v_tstrCipherOpened);
  1400 + SetValorDatMemoria('Patrimonio.te_info_patrimonio1' , getValorDatMemoria('Patrimonio.te_info_patrimonio1' ,tstrAUX), v_tstrCipherOpened);
  1401 + SetValorDatMemoria('Patrimonio.te_info_patrimonio2' , getValorDatMemoria('Patrimonio.te_info_patrimonio2' ,tstrAUX), v_tstrCipherOpened);
  1402 + SetValorDatMemoria('Patrimonio.te_info_patrimonio3' , getValorDatMemoria('Patrimonio.te_info_patrimonio3' ,tstrAUX), v_tstrCipherOpened);
  1403 + SetValorDatMemoria('Patrimonio.te_info_patrimonio4' , getValorDatMemoria('Patrimonio.te_info_patrimonio4' ,tstrAUX), v_tstrCipherOpened);
  1404 + SetValorDatMemoria('Patrimonio.te_info_patrimonio5' , getValorDatMemoria('Patrimonio.te_info_patrimonio5' ,tstrAUX), v_tstrCipherOpened);
  1405 + SetValorDatMemoria('Patrimonio.te_info_patrimonio6' , getValorDatMemoria('Patrimonio.te_info_patrimonio6' ,tstrAUX), v_tstrCipherOpened);
  1406 + SetValorDatMemoria('Patrimonio.ultima_rede_obtida' , getValorDatMemoria('Patrimonio.ultima_rede_obtida' ,tstrAUX), v_tstrCipherOpened);
  1407 + SetValorDatMemoria('Patrimonio.dt_ultima_renovacao' , getValorDatMemoria('Patrimonio.dt_ultima_renovacao' ,tstrAUX), v_tstrCipherOpened);
  1408 + SetValorDatMemoria('Patrimonio.Configs' , getValorDatMemoria('Patrimonio.Configs' ,tstrAUX), v_tstrCipherOpened);
  1409 +
  1410 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio1', getValorDatMemoria('Patrimonio.te_info_patrimonio1',tstrAUX));
  1411 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio4', getValorDatMemoria('Patrimonio.te_info_patrimonio4',tstrAUX));
  1412 + End;
  1413 + tstrAUX.Free;
  1414 +End;
  1415 +
1217 1416 procedure TFormularioGeral.SetaVariaveisGlobais;
1218 1417 var v_aux : string;
1219 1418 Begin
1220 1419 Try
1221   -
1222 1420 // Inicialização do indicador de SENHA JÁ INFORMADA
1223 1421 SetValorDatMemoria('Configs.SJI','',v_tstrCipherOpened);
1224 1422  
... ... @@ -1239,9 +1437,13 @@ Begin
1239 1437 Timer_Nu_Exec_Apos.Interval := strtoint(getValorDatMemoria('Configs.NU_EXEC_APOS',v_tstrCipherOpened)) * 60000;
1240 1438  
1241 1439 // Se for a primeiríssima execução do agente naquela máquina (após sua instalação) já faz todas as coletas configuradas, sem esperar os minutos definidos pelo administrador.
  1440 + // Também armazena os Hash-Codes dos módulos principais, evitando novo download...
1242 1441 If (getValorDatMemoria('Configs.NU_EXEC_APOS',v_tstrCipherOpened) = '12345') then // Flag usada na inicialização. Só entra nesse if se for a primeira execução do cacic após carregado.
1243 1442 begin
1244 1443 Timer_Nu_Exec_Apos.Interval := 60000; // 60 segundos para chamar Ger_Cols /coletas
  1444 + SetValorDatMemoria('Configs.TE_HASH_CACIC2' , g_oCacic.getFileHash(ParamStr(0)) ,v_tstrCipherOpened);
  1445 + SetValorDatMemoria('Configs.TE_HASH_GER_COLS', g_oCacic.getFileHash(g_oCacic.getCacicPath + 'modulos\ger_cols.exe'),v_tstrCipherOpened);
  1446 + SetValorDatMemoria('Configs.TE_HASH_CHKSIS' , g_oCacic.getFileHash(g_oCacic.getWinDir + 'chksis.exe') ,v_tstrCipherOpened);
1245 1447 end
1246 1448 else log_diario('Executar as ações automaticamente a cada ' +getValorDatMemoria('Configs.NU_INTERVALO_EXEC',v_tstrCipherOpened) + ' horas.');
1247 1449  
... ... @@ -1322,8 +1524,7 @@ begin
1322 1524 If (getValorDatMemoria('Configs.SJI',v_tstrCipherOpened) = 'S') Then Finaliza;
1323 1525 end;
1324 1526  
1325   -procedure TFormularioGeral.Invoca_GerCols(Sender: TObject;p_acao:string);
1326   -var v_versao : string;
  1527 +procedure TFormularioGeral.Invoca_GerCols(p_acao:string);
1327 1528 begin
1328 1529 Matar(g_oCacic.getCacicPath + 'temp\','*.txt');
1329 1530 Matar(g_oCacic.getCacicPath + 'temp\','*.ini');
... ... @@ -1335,6 +1536,7 @@ begin
1335 1536 CipherClose;
1336 1537 log_diario('Invocando Gerente de Coletas com ação: "'+p_acao+'"');
1337 1538 Timer_Nu_Exec_Apos.Enabled := False;
  1539 + Log_DEBUG('Criando Processo Ger_Cols...');
1338 1540 g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'modulos\GER_COLS.EXE /'+p_acao+' /CacicPath='+g_oCacic.getCacicPath,false,SW_HIDE);
1339 1541 End
1340 1542 else
... ... @@ -1441,7 +1643,7 @@ begin
1441 1643  
1442 1644  
1443 1645 log_DEBUG('Primeira chamada ao Gerente de Coletas...');
1444   - Invoca_GerCols(nil,'coletas');
  1646 + Invoca_GerCols('coletas');
1445 1647 sleep(3000); // Pausa para início do Gerente de Coletas e criação do arquivo temp\aguarde_GER.txt
1446 1648  
1447 1649 InicializaTray;
... ... @@ -1545,7 +1747,7 @@ begin
1545 1747  
1546 1748 // Agora o Gerente de Coletas será invocado para fazer a atualização da versão do Agente Principal
1547 1749 log_diario('Invocando Gerente de Coletas para Atualização do Agente Principal.');
1548   - Invoca_GerCols(nil,'UpdatePrincipal');
  1750 + Invoca_GerCols('UpdatePrincipal');
1549 1751 log_diario('Finalizando... (Atualização em aproximadamente 20 segundos).');
1550 1752 Finaliza;
1551 1753 End;
... ... @@ -1561,7 +1763,7 @@ begin
1561 1763 if (intContaExec = 2) then
1562 1764 Begin
1563 1765 log_DEBUG('Segunda chamada ao Gerente de Coletas...');
1564   - Invoca_GerCols(nil,'coletas');
  1766 + Invoca_GerCols('coletas');
1565 1767 intContaExec := 3;
1566 1768 End;
1567 1769  
... ... @@ -1602,37 +1804,43 @@ begin
1602 1804 end;
1603 1805  
1604 1806 procedure TFormularioGeral.Mnu_InfosPatrimoniaisClick(Sender: TObject);
1605   -var v_abre_janela_patrimonio : boolean;
  1807 +var boolAbreJanelaPatrimonio : boolean;
  1808 + tstrAUX : TStrings;
1606 1809 begin
1607   -v_abre_janela_patrimonio := true;
1608   -If (( getValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1' ,v_tstrCipherOpened)+
1609   - getValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2' ,v_tstrCipherOpened)+
1610   - getValorDatMemoria('Patrimonio.te_localizacao_complementar' ,v_tstrCipherOpened)+
1611   - getValorDatMemoria('Patrimonio.te_info_patrimonio1' ,v_tstrCipherOpened)+
1612   - getValorDatMemoria('Patrimonio.te_info_patrimonio2' ,v_tstrCipherOpened)+
1613   - getValorDatMemoria('Patrimonio.te_info_patrimonio3' ,v_tstrCipherOpened)+
1614   - getValorDatMemoria('Patrimonio.te_info_patrimonio4' ,v_tstrCipherOpened)+
1615   - getValorDatMemoria('Patrimonio.te_info_patrimonio5' ,v_tstrCipherOpened)+
1616   - getValorDatMemoria('Patrimonio.te_info_patrimonio6' ,v_tstrCipherOpened)+
1617   - getValorDatMemoria('Patrimonio.ultima_rede_obtida' ,v_tstrCipherOpened))<>'') then
1618   - Begin
1619   - SetValorDatMemoria('Configs.SJI','',v_tstrCipherOpened);
1620   - CriaFormSenha(nil);
1621   - formSenha.ShowModal;
1622   - if (getValorDatMemoria('Configs.SJI',v_tstrCipherOpened)<>'S') then
1623   - Begin
1624   - v_abre_janela_patrimonio := false;
1625   - End;
1626   - End;
  1810 + tstrAUX := TStrings.Create;
  1811 + tstrAUX := v_tstrCipherOpened;
  1812 +
  1813 + boolAbreJanelaPatrimonio := true;
  1814 + If (( getValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1' ,tstrAUX)+
  1815 + getValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2' ,tstrAUX)+
  1816 + getValorDatMemoria('Patrimonio.te_localizacao_complementar' ,tstrAUX)+
  1817 + getValorDatMemoria('Patrimonio.te_info_patrimonio1' ,tstrAUX)+
  1818 + getValorDatMemoria('Patrimonio.te_info_patrimonio2' ,tstrAUX)+
  1819 + getValorDatMemoria('Patrimonio.te_info_patrimonio3' ,tstrAUX)+
  1820 + getValorDatMemoria('Patrimonio.te_info_patrimonio4' ,tstrAUX)+
  1821 + getValorDatMemoria('Patrimonio.te_info_patrimonio5' ,tstrAUX)+
  1822 + getValorDatMemoria('Patrimonio.te_info_patrimonio6' ,tstrAUX)+
  1823 + getValorDatMemoria('Patrimonio.ultima_rede_obtida' ,tstrAUX))<>'') then
  1824 + Begin
  1825 + SetValorDatMemoria('Configs.SJI','',tstrAUX);
  1826 + CriaFormSenha(nil);
  1827 + formSenha.ShowModal;
  1828 + if (getValorDatMemoria('Configs.SJI',tstrAUX)<>'S') then
  1829 + Begin
  1830 + boolAbreJanelaPatrimonio := false;
  1831 + End;
  1832 + End;
1627 1833  
1628   -if (v_abre_janela_patrimonio) then
1629   - begin
1630   - if (ChecaGERCOLS) then
1631   - Begin
1632   - ChecaCONFIGS;
1633   - Invoca_GerCols(nil,'patrimonio');
1634   - End;
1635   - end;
  1834 + tstrAUX.Free;
  1835 +
  1836 + if (boolAbreJanelaPatrimonio) then
  1837 + begin
  1838 + if (ChecaGERCOLS) then
  1839 + Begin
  1840 + ChecaCONFIGS;
  1841 + Invoca_GerCols('patrimonio');
  1842 + End;
  1843 + end;
1636 1844 end;
1637 1845  
1638 1846 //=======================================================================
... ... @@ -1643,28 +1851,30 @@ procedure TFormularioGeral.InicializaTray;
1643 1851 var Icon : TIcon;
1644 1852 v_intStatus : integer;
1645 1853 v_strHint : String;
1646   -const NORMAL = 0;
1647   - OCUPADO = 1;
1648   - DESCONFIGURADO = 2;
  1854 +const NORMAL = 0; // Normal
  1855 + OCUPADO = 1; // Raio - Coletando
  1856 + DESCONFIGURADO = 2; // Interrogação - Identificando Host
  1857 + AGUARDE = 3; // Ampulheta - Aguardando ação local (recuperação de agentes, etc.)
1649 1858 begin
1650 1859 Icon := TIcon.Create;
1651 1860  
1652 1861 // Monto a frase a ser colocada no Hint
1653 1862 v_strHint := 'CACIC v:' + getVersionInfo(ParamStr(0));
1654 1863 if not (getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened) = '') then
1655   - v_strHint := v_strHint + char(13) + char(10);
1656   - v_strHint := v_strHint + 'IP: '+ getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened);
  1864 + v_strHint := v_strHint + chr(13) + chr(10) + 'IP: '+ getValorDatMemoria('TcpIp.TE_IP',v_tstrCipherOpened);
1657 1865  
1658 1866 // Mostro a versão no painel de Informações Gerais
1659 1867 pnVersao.Caption := 'V. ' + getVersionInfo(ParamStr(0));
1660 1868  
1661 1869 // Estrutura do tray icon sendo criada.
1662 1870 NotifyStruc.cbSize := SizeOf(NotifyStruc);
1663   - NotifyStruc.Wnd := Handle;
  1871 + NotifyStruc.Wnd := self.Handle;
1664 1872 NotifyStruc.uID := 1;
1665 1873 NotifyStruc.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE;
1666 1874 NotifyStruc.uCallbackMessage := WM_MYMESSAGE; //User defined message
1667 1875  
  1876 + //RegisterClass(@NotifyStruc);
  1877 +
1668 1878 // Tento apagar os arquivos indicadores de ações de coletas
1669 1879 FormularioGeral.Matar(g_oCacic.getCacicPath+'temp\','aguarde_GER.txt');
1670 1880 FormularioGeral.Matar(g_oCacic.getCacicPath+'temp\','aguarde_INI.txt');
... ... @@ -1677,20 +1887,33 @@ begin
1677 1887 Begin
1678 1888 if not (FormularioGeral.getValorDatMemoria('Configs.ConexaoOK',v_tstrCipherOpened)='S') then
1679 1889 Begin
1680   - v_strHint := v_strHint + ' SERVIDOR NÃO ENCONTRADO!';
  1890 + v_strHint := v_strHint + ' IDENTIFICANDO HOSPEDEIRO...';
1681 1891 v_intStatus := DESCONFIGURADO;
1682 1892 End;
1683 1893 End
1684 1894 else
1685 1895 Begin
1686   - v_intStatus := OCUPADO;
1687   - v_strHint := 'Aguarde...';
  1896 + if FileExists(g_oCacic.getCacicPath+'temp\recuperasr.txt') then
  1897 + Begin
  1898 + v_intStatus := AGUARDE;
  1899 + v_strHint := 'Aguarde...';
  1900 + End
  1901 + else
  1902 + Begin
  1903 + v_strHint := v_strHint + chr(13) + chr(10) + ' Coletas em Execução...';
  1904 + v_intStatus := OCUPADO;
  1905 + End;
1688 1906 End;
1689 1907  
1690 1908 imgList_Icones.GetIcon(v_intStatus,Icon);
1691 1909  
1692 1910 NotifyStruc.hIcon := Icon.Handle;
1693   -
  1911 + {
  1912 + if Self.Icon.Handle > 0 then
  1913 + NotifyStruc.hIcon := Icon.Handle
  1914 + else
  1915 + NotifyStruc.hIcon := Application.Icon.Handle;
  1916 + }
1694 1917 log_DEBUG('Setando o HINT do Systray para: "'+v_strHint+'"');
1695 1918  
1696 1919 // Atualiza o conteúdo do tip da bandeja
... ... @@ -1698,14 +1921,17 @@ begin
1698 1921  
1699 1922 if (getValorDatMemoria('Configs.IN_EXIBE_BANDEJA',v_tstrCipherOpened) <> 'N') Then
1700 1923 Begin
  1924 + log_DEBUG('Adicionando Ícone da aplicação ao Systray...');
1701 1925 Shell_NotifyIcon(NIM_ADD, @NotifyStruc);
1702 1926 End
1703 1927 else
1704 1928 Begin
  1929 + log_DEBUG('Retirando Ícone do Systray...');
1705 1930 Shell_NotifyIcon(HIDE_WINDOW,@NotifyStruc);
1706 1931 Shell_NotifyIcon(NIM_Delete,@NotifyStruc);
1707 1932 End;
1708   - Shell_NotifyIcon(nim_Modify,@NotifyStruc);
  1933 + log_DEBUG('Aplicando Modificação de Ícone do Systray...');
  1934 + Shell_NotifyIcon(NIM_MODIFY,@NotifyStruc);
1709 1935  
1710 1936 Application.ProcessMessages;
1711 1937  
... ... @@ -1725,8 +1951,10 @@ end;
1725 1951 procedure TFormularioGeral.TrayMessage(var Msg: TMessage);
1726 1952 var Posicao : TPoint;
1727 1953 begin
  1954 +
1728 1955 if (Msg.LParam=WM_RBUTTONDOWN) then
1729 1956 Begin
  1957 +
1730 1958 Mnu_InfosPatrimoniais.Enabled := False;
1731 1959 // Habilita a opção de menu caso a coleta de patrimonio esteja habilitado.
1732 1960 HabilitaPatrimonio;
... ... @@ -1786,7 +2014,7 @@ begin
1786 2014  
1787 2015 CipherClose;
1788 2016 CipherOpen;
1789   -
  2017 +
1790 2018 ST_VL_NomeHost.Caption := getValorDatMemoria('TcpIp.TE_NOME_HOST' ,v_tstrCipherOpened);
1791 2019 ST_VL_IPEstacao.Caption := getValorDatMemoria('TcpIp.TE_IP' ,v_tstrCipherOpened);
1792 2020 ST_VL_MacAddress.Caption := getValorDatMemoria('TcpIp.TE_NODE_ADDRESS' ,v_tstrCipherOpened);
... ... @@ -1804,6 +2032,7 @@ begin
1804 2032 v_conta_perfis := 1;
1805 2033 v_conta_infos_coletadas := 0;
1806 2034 v_tripa_perfis := '*';
  2035 +
1807 2036 while v_tripa_perfis <> '' do
1808 2037 begin
1809 2038  
... ... @@ -1843,6 +2072,7 @@ begin
1843 2072  
1844 2073 End;
1845 2074 End;
  2075 + Application.ProcessMessages;
1846 2076 End;
1847 2077 End;
1848 2078 End;
... ... @@ -1885,6 +2115,8 @@ begin
1885 2115 IfThen(v_array_infos_coletadas[3]='0','Sem Coleta para Envio ao Gerente WEB!',
1886 2116 IfThen(v_array_infos_coletadas[3]='99999999','Problema no Processo de Coleta!','Status Desconhecido!'))));
1887 2117 listaColetas.Items[intAux-1].SubItems.Add(strAux);
  2118 +
  2119 + Application.ProcessMessages;
1888 2120 End;
1889 2121 End
1890 2122 End
... ... @@ -1894,7 +2126,9 @@ begin
1894 2126 listSistemasMonitorados.Items[0].Caption := 'Não Há Coletas Registradas Nesta Data';
1895 2127 End;
1896 2128  
1897   - strConfigsPatrimonio := GetValorDatMemoria('Patrimonio.Configs' , v_tstrCipherOpened);
  2129 + FormularioGeral.EqualizaInformacoesPatrimoniais;
  2130 +
  2131 + strConfigsPatrimonio := GetValorDatMemoria('Patrimonio.Configs', v_tstrCipherOpened);
1898 2132 MontaVetoresPatrimonio(strConfigsPatrimonio);
1899 2133  
1900 2134 if (strConfigsPatrimonio = '') then
... ... @@ -1919,6 +2153,7 @@ begin
1919 2153 st_vl_Etiqueta3.Caption := GetValorDatMemoria('Patrimonio.te_localizacao_complementar',v_tstrCipherOpened);
1920 2154  
1921 2155  
  2156 + FormularioGeral.Log_DEBUG('Decriptografia de in_exibir_etiqueta4 => "'+g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta4', strConfigsPatrimonio))+'"');
1922 2157 if (g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta4', strConfigsPatrimonio)) = 'S') then
1923 2158 begin
1924 2159 st_lb_Etiqueta4.Caption := g_oCacic.deCrypt(XML_RetornaValor('te_etiqueta4', strConfigsPatrimonio));
... ... @@ -1932,6 +2167,7 @@ begin
1932 2167 st_vl_etiqueta4.Visible := false;
1933 2168 End;
1934 2169  
  2170 + FormularioGeral.Log_DEBUG('Decriptografia de in_exibir_etiqueta5 => "'+g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta5', strConfigsPatrimonio))+'"');
1935 2171 if (g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta5', strConfigsPatrimonio)) = 'S') then
1936 2172 begin
1937 2173 st_lb_Etiqueta5.Caption := g_oCacic.deCrypt(XML_RetornaValor('te_etiqueta5', strConfigsPatrimonio));
... ... @@ -1945,7 +2181,7 @@ begin
1945 2181 st_vl_etiqueta5.Visible := false;
1946 2182 End;
1947 2183  
1948   -
  2184 + FormularioGeral.Log_DEBUG('Decriptografia de in_exibir_etiqueta6 => "'+g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta6', strConfigsPatrimonio))+'"');
1949 2185 if (g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta6', strConfigsPatrimonio)) = 'S') then
1950 2186 begin
1951 2187 st_lb_Etiqueta6.Caption := g_oCacic.deCrypt(XML_RetornaValor('te_etiqueta6', strConfigsPatrimonio));
... ... @@ -1959,7 +2195,7 @@ begin
1959 2195 st_vl_etiqueta6.Visible := false;
1960 2196 End;
1961 2197  
1962   -
  2198 + FormularioGeral.Log_DEBUG('Decriptografia de in_exibir_etiqueta7 => "'+g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta7', strConfigsPatrimonio))+'"');
1963 2199 if (g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta7', strConfigsPatrimonio)) = 'S') then
1964 2200 begin
1965 2201 st_lb_Etiqueta7.Caption := g_oCacic.deCrypt(XML_RetornaValor('te_etiqueta7', strConfigsPatrimonio));
... ... @@ -1973,7 +2209,7 @@ begin
1973 2209 st_vl_etiqueta7.Visible := false;
1974 2210 End;
1975 2211  
1976   -
  2212 + FormularioGeral.Log_DEBUG('Decriptografia de in_exibir_etiqueta8 => "'+g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta8', strConfigsPatrimonio))+'"');
1977 2213 if (g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta8', strConfigsPatrimonio)) = 'S') then
1978 2214 begin
1979 2215 st_lb_Etiqueta8.Caption := g_oCacic.deCrypt(XML_RetornaValor('te_etiqueta8', strConfigsPatrimonio));
... ... @@ -1987,7 +2223,7 @@ begin
1987 2223 st_vl_etiqueta8.Visible := false;
1988 2224 End;
1989 2225  
1990   -
  2226 + FormularioGeral.Log_DEBUG('Decriptografia de in_exibir_etiqueta9 => "'+g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta9', strConfigsPatrimonio))+'"');
1991 2227 if (g_oCacic.deCrypt(XML_RetornaValor('in_exibir_etiqueta9', strConfigsPatrimonio)) = 'S') then
1992 2228 begin
1993 2229 st_lb_Etiqueta9.Caption := g_oCacic.deCrypt(XML_RetornaValor('te_etiqueta9', strConfigsPatrimonio));
... ... @@ -2021,10 +2257,10 @@ begin
2021 2257 WHILE Parser.Scan DO
2022 2258 Begin
2023 2259 if (Parser.CurPartType in [ptContent, ptCData]) Then // Process Parser.CurContent field here
2024   - begin
  2260 + begin
2025 2261 if (UpperCase(Parser.CurName) = UpperCase(Tag)) then
2026 2262 Result := RemoveZerosFimString(Parser.CurContent);
2027   - end;
  2263 + end;
2028 2264 end;
2029 2265 Parser.Free;
2030 2266 log_DEBUG('XML Parser retornando: "'+Result+'" para Tag "'+Tag+'"');
... ... @@ -2183,24 +2419,23 @@ begin
2183 2419 end;
2184 2420 }
2185 2421 procedure TFormularioGeral.Mnu_SuporteRemotoClick(Sender: TObject);
2186   -var boolAux : boolean;
2187   - v_strPalavraChave,
  2422 +var v_strPalavraChave,
2188 2423 v_strTeSO,
2189 2424 v_strTeNodeAddress,
2190 2425 v_strNuPortaSR,
2191 2426 v_strNuTimeOutSR : String;
2192   - fileAguarde : TextFile;
  2427 + intPausaRecupera : integer;
  2428 + fileAguarde : TextFile;
2193 2429 begin
2194 2430 if boolServerON then // Ordeno ao SrCACICsrv que auto-finalize
2195 2431 Begin
2196 2432 Log_Diario('Desativando Suporte Remoto Seguro.');
2197 2433  
2198   - {
2199   - WinExec(PChar(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -kill'), SW_NORMAL);
2200   - }
2201   -
2202 2434 g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -kill',false,SW_HIDE);
2203 2435  
  2436 + // Bloqueio o módulo de suporte remoto seguro na FireWall nativa.
  2437 + g_oCacic.addApplicationToFirewall('srCACIC - Suporte Remoto Seguro do Sistema CACIC',g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe', false);
  2438 +
2204 2439 boolServerON := false;
2205 2440 End
2206 2441 else
... ... @@ -2229,15 +2464,6 @@ begin
2229 2464 v_strNuPortaSR := trim(FormularioGeral.getValorDatMemoria('Configs.NU_PORTA_SRCACIC' , v_tstrCipherOpened));
2230 2465 v_strNuTimeOutSR := trim(FormularioGeral.getValorDatMemoria('Configs.NU_TIMEOUT_SRCACIC' , v_tstrCipherOpened));
2231 2466  
2232   - log_DEBUG('Invocando "'+g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -start [' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened)) + ']' +
2233   - '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' +
2234   - '[' + v_strTeSO + ']' +
2235   - '[' + v_strTeNodeAddress + ']' +
2236   - '[' + v_strPalavraChave + ']' +
2237   - '[' + g_oCacic.getCacicPath + 'Temp\' + ']' +
2238   - '[' + v_strNuPortaSR + ']' +
2239   - '[' + v_strNuTimeOutSR + ']');
2240   -
2241 2467 // Detectar versão do Windows antes de fazer a chamada seguinte...
2242 2468 try
2243 2469 AssignFile(fileAguarde,g_oCacic.getCacicPath + 'Temp\aguarde_srCACIC.txt');
... ... @@ -2255,33 +2481,61 @@ begin
2255 2481 Finally
2256 2482 End;
2257 2483  
2258   - {
2259   - WinExec(PChar(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -start [' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened)) + ']' +
2260   - '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' +
2261   - '[' + v_strTeSO + ']' +
2262   - '[' + v_strTeNodeAddress + ']' +
2263   - '[' + v_strPalavraChave + ']' +
2264   - '[' + g_oCacic.getCacicPath + 'Temp\' + ']' +
2265   - '[' + v_strNuPortaSR + ']' +
2266   - '[' + v_strNuTimeOutSR + ']'),SW_NORMAL);
2267   - }
2268   - g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -start [' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened)) + ']' +
2269   - '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' +
2270   - '[' + v_strTeSO + ']' +
2271   - '[' + v_strTeNodeAddress + ']' +
2272   - '[' + v_strPalavraChave + ']' +
2273   - '[' + g_oCacic.getCacicPath + 'Temp\' + ']' +
2274   - '[' + v_strNuPortaSR + ']' +
2275   - '[' + v_strNuTimeOutSR + ']',false,SW_NORMAL);
2276   -
2277   - BoolServerON := true;
2278   - End;
  2484 + log_DEBUG('Verificando validade do módulo srCACICsrv para chamada!');
  2485 +
  2486 + log_DEBUG('g_oCacic.getFileHash('+g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe'+') = "'+g_oCacic.getFileHash(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe'+'"'));
  2487 +
  2488 + log_DEBUG('FormularioGeral.GetValorDatMemoria(Configs.TE_HASH_SRCACICSRV) = "'+FormularioGeral.GetValorDatMemoria('Configs.TE_HASH_SRCACICSRV', v_tstrCipherOpened)+'"');
2279 2489  
  2490 + // Executarei o srCACICsrv após batimento do HASHCode
  2491 + if (g_oCacic.getFileHash(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe') = FormularioGeral.GetValorDatMemoria('Configs.TE_HASH_SRCACICSRV', v_tstrCipherOpened)) then
  2492 + Begin
  2493 + log_DEBUG('Invocando "'+g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -start [' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened)) + ']' +
  2494 + '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' +
  2495 + '[' + v_strTeSO + ']' +
  2496 + '[' + v_strTeNodeAddress + ']' +
  2497 + '[' + v_strPalavraChave + ']' +
  2498 + '[' + g_oCacic.getCacicPath + 'Temp\' + ']' +
  2499 + '[' + v_strNuPortaSR + ']' +
  2500 + '[' + v_strNuTimeOutSR + ']');
  2501 +
  2502 + // Libero o módulo de suporte remoto seguro na FireWall nativa.
  2503 + g_oCacic.addApplicationToFirewall('srCACIC - Suporte Remoto Seguro do Sistema CACIC',g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe', true);
  2504 +
  2505 + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -start [' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened)) + ']' +
  2506 + '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' +
  2507 + '[' + v_strTeSO + ']' +
  2508 + '[' + v_strTeNodeAddress + ']' +
  2509 + '[' + v_strPalavraChave + ']' +
  2510 + '[' + g_oCacic.getCacicPath + 'Temp\' + ']' +
  2511 + '[' + v_strNuPortaSR + ']' +
  2512 + '[' + v_strNuTimeOutSR + ']',false,SW_NORMAL);
  2513 + BoolServerON := true;
  2514 + End
  2515 + else
  2516 + Begin
  2517 + Log_Diario('Execução de srCACICsrv impedida por falta de integridade!');
  2518 + Log_Diario('Providenciando nova cópia.');
  2519 + Matar(g_oCacic.getCacicPath + 'modulos\','srcacicsrv.exe');
  2520 + Invoca_GerCols('recuperaSR');
  2521 + intPausaRecupera := 0;
  2522 + while (intPausaRecupera < 10) do
  2523 + Begin
  2524 + Sleep(3000);
  2525 + if FileExists(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe') then
  2526 + intPausaRecupera := 10;
  2527 + inc(intPausaRecupera);
  2528 + End;
  2529 + if FileExists(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe') then
  2530 + Mnu_SuporteRemotoClick(nil);
  2531 + End;
  2532 + End;
2280 2533 end;
2281 2534  
2282 2535 procedure TFormularioGeral.Popup_Menu_ContextoPopup(Sender: TObject);
2283 2536 begin
2284 2537 VerificaDebugs;
  2538 +
2285 2539 if (getValorDatMemoria('Configs.CS_SUPORTE_REMOTO',v_tstrCipherOpened) = 'S') and
2286 2540 (FileExists(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe')) then
2287 2541 Mnu_SuporteRemoto.Enabled := true
... ... @@ -2314,19 +2568,20 @@ begin
2314 2568 end;
2315 2569  
2316 2570 procedure TFormularioGeral.Timer_InicializaTrayTimer(Sender: TObject);
2317   -begin
  2571 +Begin
  2572 +
2318 2573 Timer_InicializaTray.Enabled := false;
2319 2574  
2320 2575 g_intTaskBarAtual := FindWindow('Shell_TrayWnd', Nil);
2321   - Log_DEBUG('g_intTaskBarAnterior: '+ intToStr(g_intTaskBarAnterior));
2322   - Log_DEBUG('g_intTaskBarAtual: ' + intToStr(g_intTaskBarAtual));
2323 2576  
2324   - if (g_intTaskBarAnterior = 0) and (g_intTaskBarAtual > 0) then
2325   - InicializaTray;
  2577 + if ((g_intTaskBarAnterior = 0) and (g_intTaskBarAtual > 0)) or
  2578 + (boolWinIniChange) then
  2579 + Begin
  2580 + InicializaTray;
  2581 + End;
2326 2582  
2327 2583 g_intTaskBarAnterior := g_intTaskBarAtual;
2328 2584  
2329 2585 Timer_InicializaTray.Enabled := true;
2330 2586 end;
2331   -
2332 2587 end.
... ...
mapa/acesso.dfm
... ... @@ -143,10 +143,12 @@ object frmAcesso: TfrmAcesso
143 143 00000007C000FC000000000FC000FC000000002FC000FC000000000FC000F800
144 144 00000007C000F80000000007C000F80000000007C000F80000000007C000FC00
145 145 0000000FC000FC000000000FC000FDAD8035B5BFC000}
  146 + KeyPreview = True
146 147 OldCreateOrder = False
147 148 Position = poDesktopCenter
148 149 OnActivate = FormActivate
149 150 OnCreate = FormCreate
  151 + OnKeyDown = FormKeyDown
150 152 OnShow = FormShow
151 153 PixelsPerInch = 96
152 154 TextHeight = 13
... ... @@ -156,7 +158,7 @@ object frmAcesso: TfrmAcesso
156 158 Width = 300
157 159 Height = 12
158 160 AutoSize = False
159   - Caption = 'Servidor: ABCDEFGHIJKLMNOP'
  161 + Caption = 'Servidor de Aplica'#231#227'o: ABCDEFGHIJKLMNOP'
160 162 Font.Charset = DEFAULT_CHARSET
161 163 Font.Color = clWindowText
162 164 Font.Height = -9
... ... @@ -253,8 +255,8 @@ object frmAcesso: TfrmAcesso
253 255 Alignment = taCenter
254 256 AutoSize = False
255 257 Caption =
256   - 'ATEN'#199#195'O: O usu'#225'rio deve estar cadastrado no Gerente WEB com n'#237've' +
257   - 'l "T'#233'cnico"'
  258 + 'ATEN'#199#195'O: O usu'#225'rio deve estar cadastrado no Gerente WEB e deve t' +
  259 + 'er acesso PRIM'#193'RIO ou SECUND'#193'RIO a este local'
258 260 Font.Charset = DEFAULT_CHARSET
259 261 Font.Color = clNavy
260 262 Font.Height = -11
... ...
mapa/acesso.pas
... ... @@ -57,6 +57,9 @@ type
57 57 Shift: TShiftState);
58 58 procedure tm_MensagemTimer(Sender: TObject);
59 59 procedure FormActivate(Sender: TObject);
  60 + Procedure VerificaVersao;
  61 + procedure FormKeyDown(Sender: TObject; var Key: Word;
  62 + Shift: TShiftState);
60 63 private
61 64 { Private declarations }
62 65 public
... ... @@ -84,6 +87,7 @@ begin
84 87 Request_mapa.Values['nm_acesso'] := frmMapaCacic.g_oCacic.enCrypt(edNomeUsuarioAcesso.Text);
85 88 Request_mapa.Values['te_senha'] := frmMapaCacic.g_oCacic.EnCrypt(edSenhaAcesso.Text);
86 89 Request_mapa.Values['cs_MapaCacic'] := frmMapaCacic.g_oCacic.EnCrypt('S');
  90 + Request_mapa.Values['te_operacao'] := frmMapaCacic.g_oCacic.EnCrypt('Autentication');
87 91 Request_mapa.Values['te_versao_mapa'] := frmMapaCacic.g_oCacic.EnCrypt(frmMapaCacic.getVersionInfo(ParamStr(0)));
88 92  
89 93 strRetorno := frmMapaCacic.ComunicaServidor('mapa_acesso.php', Request_mapa, 'Autenticando o Acesso...');
... ... @@ -91,13 +95,6 @@ begin
91 95  
92 96 if (frmMapaCacic.XML_RetornaValor('STATUS', strRetorno)='OK') then
93 97 Begin
94   - str_local_Aux := trim(frmMapaCacic.g_oCacic.deCrypt(frmMapaCacic.XML_RetornaValor('TE_VERSAO_MAPA',strRetorno)));
95   - if (str_local_Aux <> '') then
96   - Begin
97   - MessageDLG(#13#10#13#10+'ATENÇÃO! Foi disponibilizada a versão "'+str_local_Aux+'".'+#13#10#13#10+'Acesse o gerente cacic na opção "Repositório" e baixe o programa "MapaCACIC"!'+#13#10,mtWarning,[mbOK],0);
98   - btCancela.Click;
99   - End;
100   -
101 98 str_local_Aux := trim(frmMapaCacic.g_oCacic.deCrypt(frmMapaCacic.XML_RetornaValor('ID_USUARIO',strRetorno)));
102 99 if (str_local_Aux <> '') then
103 100 Begin
... ... @@ -107,7 +104,7 @@ begin
107 104 End
108 105 else
109 106 Begin
110   - str_local_Aux := 'Usuário/Senha incorretos ou Nível de acesso não permitido!';
  107 + str_local_Aux := 'Usuário/Senha incorretos ou Usuário sem Acesso Primário/Secundário a este local!';
111 108 End
112 109 End
113 110 else
... ... @@ -135,12 +132,41 @@ begin
135 132 Application.ProcessMessages;
136 133  
137 134 if (frmMapaCacic.boolAcessoOK) then
138   - Close
  135 + self.Close
139 136 else
140 137 Begin
141 138 edNomeUsuarioAcesso.AutoSelect := false;
142 139 edNomeUsuarioAcesso.SetFocus;
  140 + End;
  141 +end;
  142 +
  143 +Procedure TfrmAcesso.VerificaVersao;
  144 +var Request_mapa : TStringList;
  145 + strRetorno,
  146 + strAUX : String;
  147 + boolVersaoOK : Boolean;
  148 +begin
  149 + boolVersaoOK := false;
  150 + Request_mapa:=TStringList.Create;
  151 +
  152 + // Envio dos dados ao DataBase...
  153 + Request_mapa.Values['cs_MapaCacic'] := frmMapaCacic.g_oCacic.EnCrypt('S');
  154 + Request_mapa.Values['te_operacao'] := frmMapaCacic.g_oCacic.EnCrypt('Autentication');
  155 + Request_mapa.Values['te_versao_mapa'] := frmMapaCacic.g_oCacic.EnCrypt(frmMapaCacic.getVersionInfo(ParamStr(0)));
  156 +
  157 + strRetorno := frmMapaCacic.ComunicaServidor('mapa_acesso.php', Request_mapa, 'Verificando Versão...');
  158 + Request_mapa.free;
  159 +
  160 + if (frmMapaCacic.XML_RetornaValor('STATUS', strRetorno)='OK') then
  161 + Begin
  162 + strAUX := trim(frmMapaCacic.g_oCacic.deCrypt(frmMapaCacic.XML_RetornaValor('TE_VERSAO_MAPA',strRetorno)));
  163 + if (strAUX = '') then
  164 + boolVersaoOK := true
  165 + else
  166 + MessageDLG(#13#10#13#10+'ATENÇÃO! Foi disponibilizada a versão "'+strAUX+'".'+#13#10#13#10+'Acesse o gerente cacic na opção "Repositório" e baixe o programa "MapaCACIC"!'+#13#10,mtWarning,[mbOK],0);
143 167 End
  168 + else
  169 + MessageDLG(#13#10#13#10+'ATENÇÃO! Há problema na comunicação com o módulo Gerente WEB.'+#13#10#13#10,mtWarning,[mbOK],0);
144 170 end;
145 171  
146 172  
... ... @@ -148,16 +174,17 @@ procedure TfrmAcesso.btCancelaClick(Sender: TObject);
148 174 begin
149 175 lbMsg_Erro_Senha.Caption := 'Aguarde... Finalizando!';
150 176 Application.ProcessMessages;
151   - Application.Terminate;
  177 + Self.Close;
  178 + boolFinalizar := true;
152 179 end;
153 180  
154 181 procedure TfrmAcesso.FormCreate(Sender: TObject);
155 182 begin
156   - intPausaPadrao := 3000; //(3 mil milisegundos = 3 segundos)
157   - frmAcesso.lbVersao.Caption := 'Versão: ' + frmMapaCacic.GetVersionInfo(ParamStr(0));
158   -// frmMapaCacic.tStringsCipherOpened := frmMapaCacic.CipherOpen(frmMapaCacic.g_oCacic.getCacicPath + frmMapaCacic.g_oCacic.getDatFileName);
159   - frmMapaCacic.lbNomeServidorWEB.Caption := 'Servidor: '+frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsCipherOpened);
160   - frmMapaCacic.lbMensagens.Caption := 'Entrada de Dados para Autenticação no Módulo Gerente WEB Cacic';
  183 + intPausaPadrao := 3000; //(3 mil milisegundos = 3 segundos)
  184 + frmAcesso.lbVersao.Caption := 'Versão: ' + frmMapaCacic.GetVersionInfo(ParamStr(0));
  185 + frmMapaCacic.lbNomeServidorWEB.Caption := 'Servidor de Aplicação: '+frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsMapaCACIC);
  186 + frmMapaCacic.lbMensagens.Caption := 'Entrada de Dados para Autenticação no Módulo Gerente WEB Cacic';
  187 + VerificaVersao;
161 188 end;
162 189  
163 190 procedure TfrmAcesso.edNomeUsuarioAcessoKeyUp(Sender: TObject;
... ... @@ -195,7 +222,7 @@ end;
195 222 procedure TfrmAcesso.FormActivate(Sender: TObject);
196 223 var strAux : String;
197 224 begin
198   - strAux := 'Servidor: ' + frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsCipherOpened);
  225 + strAux := 'Servidor de Aplicação: ' + frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsMapaCACIC);
199 226 if not (strAux = '') then
200 227 Begin
201 228 frmAcesso.lbNomeServidorWEB.Caption := strAux;
... ... @@ -207,4 +234,16 @@ begin
207 234 End;
208 235 end;
209 236  
  237 +procedure TfrmAcesso.FormKeyDown(Sender: TObject; var Key: Word;
  238 + Shift: TShiftState);
  239 +begin
  240 + IF (key = VK_RETURN) then
  241 + Begin
  242 + if (edNomeUsuarioAcesso.Focused) and (trim(edNomeUsuarioAcesso.Text) <> '') then
  243 + edSenhaAcesso.SetFocus
  244 + else if (edSenhaAcesso.Focused) and (trim(edSenhaAcesso.Text) <> '') then
  245 + btAcessoClick(nil);
  246 + End;
  247 +end;
  248 +
210 249 end.
... ...
mapa/main_mapa.dfm
... ... @@ -148,6 +148,7 @@ object frmMapaCacic: TfrmMapaCacic
148 148 Visible = True
149 149 OnActivate = FormActivate
150 150 OnClose = FormClose
  151 + OnCreate = FormCreate
151 152 PixelsPerInch = 96
152 153 TextHeight = 13
153 154 object lbNomeServidorWEB: TLabel
... ...
mapa/main_mapa.pas
... ... @@ -54,7 +54,8 @@ var
54 54 var v_Aguarde : TextFile;
55 55  
56 56 var
57   - boolDebugs : boolean;
  57 + boolDebugs,
  58 + boolFinalizar : boolean;
58 59  
59 60 type
60 61 TfrmMapaCacic = class(TForm)
... ... @@ -89,13 +90,12 @@ type
89 90 lbVersao: TLabel;
90 91  
91 92 procedure mapa;
92   - procedure Grava_Debugs(strMsg : String);
93 93 function SetValorChaveRegEdit(Chave: String; Dado: Variant): Variant;
94 94 function GetValorChaveRegEdit(Chave: String): Variant;
95 95 function GetRootKey(strRootKey: String): HKEY;
96 96 Function RemoveCaracteresEspeciais(Texto, p_Fill : String; p_start, p_end:integer) : String;
97   - Function CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings) : String;
98   - Function CipherOpen(p_DatFileName : string) : TStrings;
  97 + Procedure CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings);
  98 + Procedure CipherOpen(p_DatFileName : string; var p_tstrCipherOpened : TStrings);
99 99 Function GetValorDatMemoria(p_Chave : String; p_tstrCipherOpened : TStrings) : String;
100 100 procedure MontaCombos(p_strConfigs : String);
101 101 procedure MontaInterface(p_strConfigs : String);
... ... @@ -128,8 +128,9 @@ type
128 128 function SearchFile(p_Drive,p_File:string) : boolean;
129 129 procedure GetSubDirs(Folder:string; sList:TStringList);
130 130 procedure Mensagem(p_strMsg : String; p_boolAlerta : boolean; p_intPausaSegundos : integer);
131   - procedure FormActivate(Sender: TObject);
132 131 procedure cb_id_unid_organizacional_nivel1aChange(Sender: TObject);
  132 + procedure FormActivate(Sender: TObject);
  133 + procedure FormCreate(Sender: TObject);
133 134 private
134 135 strId_unid_organizacional_nivel1,
135 136 strId_unid_organizacional_nivel1a,
... ... @@ -146,9 +147,8 @@ type
146 147 boolAcessoOK : boolean;
147 148 strId_usuario : String;
148 149 g_oCacic : TCACIC;
149   - tStringsDadosPatrimonio,
150   - tStringsCipherOpened,
151   - tStringsTripa1 : TStrings;
  150 + tStringsCACIC,
  151 + tStringsMapaCACIC : TStrings;
152 152 end;
153 153  
154 154 var
... ... @@ -290,43 +290,6 @@ procedure TfrmMapaCacic.log_DEBUG(p_msg:string);
290 290 Begin
291 291 if boolDebugs then log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg);
292 292 End;
293   -procedure TfrmMapaCacic.Grava_Debugs(strMsg : String);
294   -var
295   - DebugsFile : TextFile;
296   - strDataArqLocal, strDataAtual, v_file_debugs : string;
297   -begin
298   - try
299   - v_file_debugs := g_oCacic.getCacicPath + '\debug_mapa.txt';
300   - FileSetAttr (v_file_debugs,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
301   - AssignFile(DebugsFile,v_file_debugs); {Associa o arquivo a uma variável do tipo TextFile}
302   -
303   - {$IOChecks off}
304   - Reset(DebugsFile); {Abre o arquivo texto}
305   - {$IOChecks on}
306   -
307   - if (IOResult <> 0) then // Arquivo não existe, será recriado.
308   - begin
309   - Rewrite(DebugsFile);
310   - Append(DebugsFile);
311   - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Debug <=======================');
312   - end;
313   - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(v_file_debugs)));
314   - DateTimeToString(strDataAtual , 'yyyymmdd', Date);
315   -
316   - if (strDataAtual <> strDataArqLocal) then // Se o arquivo não é da data atual...
317   - begin
318   - Rewrite(DebugsFile); //Cria/Recria o arquivo
319   - Append(DebugsFile);
320   - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Debug <=======================');
321   - end;
322   -
323   - Append(DebugsFile);
324   - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + strMsg); {Grava a string Texto no arquivo texto}
325   - CloseFile(DebugsFile); {Fecha o arquivo texto}
326   - except
327   - log_diario('Erro na gravação do Debug!');
328   - end;
329   -end;
330 293  
331 294 // Função criada devido a divergências entre os valores retornados pelos métodos dos componentes MSI e seus Reports.
332 295 function TfrmMapaCacic.Parse(p_ClassName, p_SectionName, p_DataName:string; p_Report : TStringList) : String;
... ... @@ -411,7 +374,7 @@ procedure TfrmMapaCacic.Finalizar(p_pausa:boolean);
411 374 Begin
412 375 Mensagem('Finalizando MapaCacic...',false,0);
413 376  
414   - CipherClose(g_oCacic.getCacicPath + g_oCacic.getDatFileName, tStringsCipherOpened);
  377 + CipherClose(g_oCacic.getCacicPath + 'MapaCACIC.dat', tStringsMapaCACIC);
415 378 Apaga_Temps;
416 379 if p_pausa then sleep(2000); // Pausa de 2 segundos para conclusão de operações de arquivos.
417 380 Sair;
... ... @@ -488,14 +451,14 @@ Begin
488 451 tStringListAuxRequest.Values['cs_compress'] := '0';
489 452  
490 453  
491   - strEnderecoWS := GetValorDatMemoria('Configs.Endereco_WS', tStringsCipherOpened);
492   - strEnderecoServidor := GetValorDatMemoria('Configs.EnderecoServidor', tStringsCipherOpened);
  454 + strEnderecoWS := GetValorDatMemoria('Configs.Endereco_WS', tStringsCACIC);
  455 + strEnderecoServidor := GetValorDatMemoria('Configs.EnderecoServidor', tStringsCACIC);
493 456  
494 457 if (trim(strEnderecoWS)='') then
495 458 strEnderecoWS := '/cacic2/ws/';
496 459  
497 460 if (trim(strEnderecoServidor)='') then
498   - strEnderecoServidor := Trim(GetValorChaveRegIni('Cacic2','ip_serv_cacic',g_oCacic.getCacicPath + 'MapaCacic.ini'));
  461 + strEnderecoServidor := Trim(GetValorChaveRegIni('Cacic2','ip_serv_cacic',g_oCacic.getCacicPath + 'cacic2.ini'));
499 462  
500 463 strEndereco := 'http://' + strEnderecoServidor + strEnderecoWS + URL;
501 464  
... ... @@ -634,7 +597,7 @@ begin
634 597 end;
635 598 end;
636 599  
637   -Function TfrmMapaCacic.CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings) : String;
  600 +Procedure TfrmMapaCacic.CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings);
638 601 var strCipherOpenImploded : string;
639 602 txtFileDatFile : TextFile;
640 603 begin
... ... @@ -658,7 +621,7 @@ begin
658 621 end;
659 622 end;
660 623  
661   -Function TfrmMapaCacic.CipherOpen(p_DatFileName : string) : TStrings;
  624 +Procedure TfrmMapaCacic.CipherOpen(p_DatFileName : string; var p_tstrCipherOpened : TStrings);
662 625 var v_DatFile : TextFile;
663 626 v_strCipherOpened,
664 627 v_strCipherClosed : string;
... ... @@ -683,17 +646,17 @@ begin
683 646 strCipherOpened:= g_oCacic.deCrypt(v_strCipherClosed);
684 647 end;
685 648 if (trim(strCipherOpened)<>'') then
686   - Result := g_oCacic.explode(strCipherOpened,'=CacicIsFree=')
  649 + p_tstrCipherOpened := g_oCacic.explode(strCipherOpened,'=CacicIsFree=')
687 650 else
688   - Result := g_oCacic.explode('Configs.ID_SO'+g_oCacic.getSeparatorKey+g_oCacic.getWindowsStrId() +g_oCacic.getSeparatorKey+'Configs.Endereco_WS'+g_oCacic.getSeparatorKey+'/cacic2/ws/',g_oCacic.getSeparatorKey);
  651 + p_tstrCipherOpened := g_oCacic.explode('Configs.ID_SO'+g_oCacic.getSeparatorKey+g_oCacic.getWindowsStrId() +g_oCacic.getSeparatorKey+'Configs.Endereco_WS'+g_oCacic.getSeparatorKey+'/cacic2/ws/',g_oCacic.getSeparatorKey+'Patrimonio.dt_ultima_renovacao'+g_oCacic.getSeparatorKey+'0');
689 652  
690   - if Result.Count mod 2 = 0 then
691   - Result.Add('');
  653 + if p_tstrCipherOpened.Count mod 2 = 0 then
  654 + p_tstrCipherOpened.Add('');
692 655  
693 656 log_DEBUG('MemoryDAT aberto com sucesso!');
694 657 if boolDebugs then
695   - for intLoop := 0 to (Result.Count-1) do
696   - log_DEBUG('Posição ['+inttostr(intLoop)+'] do MemoryDAT: '+Result[intLoop]);
  658 + for intLoop := 0 to (p_tstrCipherOpened.Count-1) do
  659 + log_DEBUG('Posição ['+inttostr(intLoop)+'] do MemoryDAT: '+p_tstrCipherOpened[intLoop]);
697 660  
698 661 end;
699 662  
... ... @@ -702,7 +665,7 @@ begin
702 665 log_DEBUG('Gravando Chave: "'+p_Chave+ '" => "'+p_Valor+'"');
703 666 // Exemplo: p_Chave => Configs.nu_ip_servidor : p_Valor => 10.71.0.120
704 667 if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then
705   - p_tstrCipherOpened[tStringsCipherOpened.IndexOf(p_Chave)+1] := p_Valor
  668 + p_tstrCipherOpened[p_tstrCipherOpened.IndexOf(p_Chave)+1] := p_Valor
706 669 else
707 670 Begin
708 671 p_tstrCipherOpened.Add(p_Chave);
... ... @@ -803,71 +766,71 @@ end;
803 766  
804 767 procedure TfrmMapaCacic.RecuperaValoresAnteriores(p_strConfigs : String);
805 768 begin
806   - Mensagem('Recuperando Valores Anteriores...',false,intPausaPadrao div 3);
  769 + Mensagem('Recuperando Valores Anteriores...',false,intPausaPadrao div 3);
807 770  
808   - strId_unid_organizacional_nivel1 := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1',tStringsCipherOpened);
809   - if (strId_unid_organizacional_nivel1='') then
810   - strId_unid_organizacional_nivel1 := g_oCacic.deCrypt(XML.XML_RetornaValor('ID_UON1', p_strConfigs));
  771 + strId_unid_organizacional_nivel1 := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1',tStringsMapaCACIC);
  772 + if (strId_unid_organizacional_nivel1='') then
  773 + strId_unid_organizacional_nivel1 := g_oCacic.deCrypt(XML.XML_RetornaValor('ID_UON1', p_strConfigs));
811 774  
812   - strId_unid_organizacional_nivel1a := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1a',tStringsCipherOpened);
813   - if (strId_unid_organizacional_nivel1a='') then
814   - strId_unid_organizacional_nivel1a := g_oCacic.deCrypt(XML.XML_RetornaValor('ID_UON1a', p_strConfigs));
  775 + strId_unid_organizacional_nivel1a := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1a',tStringsMapaCACIC);
  776 + if (strId_unid_organizacional_nivel1a='') then
  777 + strId_unid_organizacional_nivel1a := g_oCacic.deCrypt(XML.XML_RetornaValor('ID_UON1a', p_strConfigs));
815 778  
816   - strId_unid_organizacional_nivel2 := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2',tStringsCipherOpened);
817   - if (strId_unid_organizacional_nivel2='') then
818   - strId_unid_organizacional_nivel2 := g_oCacic.deCrypt(XML.XML_RetornaValor('ID_UON2', p_strConfigs));
  779 + strId_unid_organizacional_nivel2 := GetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2',tStringsMapaCACIC);
  780 + if (strId_unid_organizacional_nivel2='') then
  781 + strId_unid_organizacional_nivel2 := g_oCacic.deCrypt(XML.XML_RetornaValor('ID_UON2', p_strConfigs));
819 782  
820   - strId_Local := GetValorDatMemoria('Patrimonio.id_local',tStringsCipherOpened);
821   - if (strId_Local='') then
822   - strId_Local := g_oCacic.deCrypt(XML.XML_RetornaValor('ID_LOCAL', p_strConfigs));
  783 + strId_Local := GetValorDatMemoria('Patrimonio.id_local',tStringsMapaCACIC);
  784 + if (strId_Local='') then
  785 + strId_Local := g_oCacic.deCrypt(XML.XML_RetornaValor('ID_LOCAL', p_strConfigs));
823 786  
824   - Try
825   - cb_id_unid_organizacional_nivel1.ItemIndex := cb_id_unid_organizacional_nivel1.Items.IndexOf(RetornaValorVetorUON1(strId_unid_organizacional_nivel1));
826   - cb_id_unid_organizacional_nivel1Change(Nil); // Para filtrar os valores do combo2 de acordo com o valor selecionado no combo1
827   - cb_id_unid_organizacional_nivel1a.ItemIndex := cb_id_unid_organizacional_nivel1a.Items.IndexOf(RetornaValorVetorUON1(strId_unid_organizacional_nivel1));
828   - Except
829   - end;
  787 + Try
  788 + cb_id_unid_organizacional_nivel1.ItemIndex := cb_id_unid_organizacional_nivel1.Items.IndexOf(RetornaValorVetorUON1(strId_unid_organizacional_nivel1));
  789 + cb_id_unid_organizacional_nivel1Change(Nil); // Para filtrar os valores do combo2 de acordo com o valor selecionado no combo1
  790 + cb_id_unid_organizacional_nivel1a.ItemIndex := cb_id_unid_organizacional_nivel1a.Items.IndexOf(RetornaValorVetorUON1(strId_unid_organizacional_nivel1));
  791 + Except
  792 + end;
830 793  
831   - Try
832   - cb_id_unid_organizacional_nivel1a.ItemIndex := cb_id_unid_organizacional_nivel1a.Items.IndexOf(RetornaValorVetorUON1a(strId_unid_organizacional_nivel1a));
833   - cb_id_unid_organizacional_nivel1aChange(Nil); // Para filtrar os valores do combo3 de acordo com o valor selecionado no combo2
834   - cb_id_unid_organizacional_nivel2.ItemIndex := cb_id_unid_organizacional_nivel2.Items.IndexOf(RetornaValorVetorUON2(strId_unid_organizacional_nivel2,strId_Local));
835   - Except
836   - end;
  794 + Try
  795 + cb_id_unid_organizacional_nivel1a.ItemIndex := cb_id_unid_organizacional_nivel1a.Items.IndexOf(RetornaValorVetorUON1a(strId_unid_organizacional_nivel1a));
  796 + cb_id_unid_organizacional_nivel1aChange(Nil); // Para filtrar os valores do combo3 de acordo com o valor selecionado no combo2
  797 + cb_id_unid_organizacional_nivel2.ItemIndex := cb_id_unid_organizacional_nivel2.Items.IndexOf(RetornaValorVetorUON2(strId_unid_organizacional_nivel2,strId_Local));
  798 + Except
  799 + end;
837 800  
838   - lbEtiqueta1.Caption := g_oCacic.deCrypt(XML.XML_RetornaValor('te_etiqueta1', p_strConfigs));
839   - lbEtiqueta1a.Caption := g_oCacic.deCrypt(XML.XML_RetornaValor('te_etiqueta1a', p_strConfigs));
  801 + lbEtiqueta1.Caption := g_oCacic.deCrypt(XML.XML_RetornaValor('te_etiqueta1', p_strConfigs));
  802 + lbEtiqueta1a.Caption := g_oCacic.deCrypt(XML.XML_RetornaValor('te_etiqueta1a', p_strConfigs));
840 803  
841   - strTe_localizacao_complementar := GetValorDatMemoria('Patrimonio.te_localizacao_complementar',tStringsCipherOpened);
842   - if (strTe_localizacao_complementar='') then strTe_localizacao_complementar := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_LOC_COMPL', p_strConfigs));
  804 + strTe_localizacao_complementar := GetValorDatMemoria('Patrimonio.te_localizacao_complementar',tStringsMapaCACIC);
  805 + if (strTe_localizacao_complementar='') then strTe_localizacao_complementar := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_LOC_COMPL', p_strConfigs));
843 806  
844   - // Tentarei buscar informação gravada no Registry
845   - strTe_info_patrimonio1 := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio1');
846   - if (strTe_info_patrimonio1='') then
847   - Begin
848   - strTe_info_patrimonio1 := GetValorDatMemoria('Patrimonio.te_info_patrimonio1',tStringsCipherOpened);
849   - End;
850   - if (strTe_info_patrimonio1='') then strTe_info_patrimonio1 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO1', p_strConfigs));
  807 + // Tentarei buscar informação gravada no Registry
  808 + strTe_info_patrimonio1 := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio1');
  809 + if (strTe_info_patrimonio1='') then
  810 + Begin
  811 + strTe_info_patrimonio1 := GetValorDatMemoria('Patrimonio.te_info_patrimonio1',tStringsMapaCACIC);
  812 + End;
  813 + if (strTe_info_patrimonio1='') then strTe_info_patrimonio1 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO1', p_strConfigs));
851 814  
852   - strTe_info_patrimonio2 := GetValorDatMemoria('Patrimonio.te_info_patrimonio2',tStringsCipherOpened);
853   - if (strTe_info_patrimonio2='') then strTe_info_patrimonio2 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO2', p_strConfigs));
  815 + strTe_info_patrimonio2 := GetValorDatMemoria('Patrimonio.te_info_patrimonio2',tStringsMapaCACIC);
  816 + if (strTe_info_patrimonio2='') then strTe_info_patrimonio2 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO2', p_strConfigs));
854 817  
855   - strTe_info_patrimonio3 := GetValorDatMemoria('Patrimonio.te_info_patrimonio3',tStringsCipherOpened);
856   - if (strTe_info_patrimonio3='') then strTe_info_patrimonio3 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO3', p_strConfigs));
  818 + strTe_info_patrimonio3 := GetValorDatMemoria('Patrimonio.te_info_patrimonio3',tStringsMapaCACIC);
  819 + if (strTe_info_patrimonio3='') then strTe_info_patrimonio3 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO3', p_strConfigs));
857 820  
858   - // Tentarei buscar informação gravada no Registry
859   - strTe_info_patrimonio4 := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio4');
860   - if (strTe_info_patrimonio4='') then
861   - Begin
862   - strTe_info_patrimonio4 := GetValorDatMemoria('Patrimonio.te_info_patrimonio4',tStringsCipherOpened);
863   - End;
864   - if (strTe_info_patrimonio4='') then strTe_info_patrimonio4 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO4', p_strConfigs));
  821 + // Tentarei buscar informação gravada no Registry
  822 + strTe_info_patrimonio4 := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio4');
  823 + if (strTe_info_patrimonio4='') then
  824 + Begin
  825 + strTe_info_patrimonio4 := GetValorDatMemoria('Patrimonio.te_info_patrimonio4',tStringsMapaCACIC);
  826 + End;
  827 + if (strTe_info_patrimonio4='') then strTe_info_patrimonio4 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO4', p_strConfigs));
865 828  
866   - strTe_info_patrimonio5 := GetValorDatMemoria('Patrimonio.te_info_patrimonio5',tStringsCipherOpened);
867   - if (strTe_info_patrimonio5='') then strTe_info_patrimonio5 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO5', p_strConfigs));
  829 + strTe_info_patrimonio5 := GetValorDatMemoria('Patrimonio.te_info_patrimonio5',tStringsMapaCACIC);
  830 + if (strTe_info_patrimonio5='') then strTe_info_patrimonio5 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO5', p_strConfigs));
868 831  
869   - strTe_info_patrimonio6 := GetValorDatMemoria('Patrimonio.te_info_patrimonio6',tStringsCipherOpened);
870   - if (strTe_info_patrimonio6='') then strTe_info_patrimonio6 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO6', p_strConfigs));
  832 + strTe_info_patrimonio6 := GetValorDatMemoria('Patrimonio.te_info_patrimonio6',tStringsMapaCACIC);
  833 + if (strTe_info_patrimonio6='') then strTe_info_patrimonio6 := g_oCacic.deCrypt(XML.XML_RetornaValor('TE_INFO6', p_strConfigs));
871 834 end;
872 835  
873 836 procedure TfrmMapaCacic.MontaCombos(p_strConfigs : String);
... ... @@ -1014,7 +977,7 @@ begin
1014 977  
1015 978 if (Length(VetorUON1) = 0) then
1016 979 Begin
1017   - frmMapaCacic.Mensagem('ATENÇÃO! Verifique se esta subrede foi cadastrada no CACIC.',true,intPausaPadrao * 2);
  980 + frmMapaCacic.Mensagem('ATENÇÃO! Não encontrei Entidades, Linhas de Negócio ou Órgãos cadastrados para esta subrede.',true,intPausaPadrao * 2);
1018 981 Finalizar(true);
1019 982 End;
1020 983  
... ... @@ -1103,6 +1066,8 @@ begin
1103 1066 strIdUON1a := tstrAux[0];
1104 1067 strIdLocal := tstrAux[1];
1105 1068  
  1069 + tstrAux.Free;
  1070 +
1106 1071 Log_debug('strIdLocal = '+strIdLocal);
1107 1072 cb_id_unid_organizacional_nivel2.Items.Clear;
1108 1073 cb_id_unid_organizacional_nivel2.Enabled := false;
... ... @@ -1145,85 +1110,78 @@ var strIdUON1,
1145 1110 tstrListAux : TStringList;
1146 1111 tstrAux : TStrings;
1147 1112 begin
1148   - Matar(g_oCacic.getCacicPath,'aguarde_CACIC.txt');
  1113 + tstrAux := TStrings.Create;
  1114 + tstrAux := g_oCacic.explode(VetorUON2Filtrado[cb_id_unid_organizacional_nivel2.ItemIndex],'#');
  1115 + Try
  1116 + strIdUON1 := VetorUON1[cb_id_unid_organizacional_nivel1.ItemIndex].id1;
  1117 + strIdUON2 := tstrAux[0];
  1118 + strIdLocal := tstrAux[1];
  1119 + Except
  1120 + end;
1149 1121  
1150   - if FileExists(g_oCacic.getCacicPath + 'aguarde_CACIC.txt') then
1151   - MessageDLG(#13#10+'ATENÇÃO!'+#13#10#13#10+
1152   - 'Para o envio das informações, é necessário finalizar o Agente Principal do CACIC.',mtError,[mbOK],0)
1153   - else
1154   - Begin
1155   - tstrAux := TStrings.Create;
1156   - tstrAux := g_oCacic.explode(VetorUON2Filtrado[cb_id_unid_organizacional_nivel2.ItemIndex],'#');
1157   - Try
1158   - strIdUON1 := VetorUON1[cb_id_unid_organizacional_nivel1.ItemIndex].id1;
1159   - strIdUON2 := tstrAux[0];
1160   - strIdLocal := tstrAux[1];
1161   - Except
1162   - end;
1163   -
1164   - tstrAux := g_oCacic.explode(VetorUON1aFiltrado[cb_id_unid_organizacional_nivel1a.ItemIndex],'#');
1165   - Try
1166   - strIdUON1a := tstrAux[0];
1167   - Except
1168   - end;
1169   -
1170   - tstrAux.Free;
1171   - Mensagem('Enviando Informações Coletadas ao Banco de Dados...',false,intPausaPadrao div 3);
1172   - // Envio dos Dados Coletados ao Banco de Dados
1173   - tstrListAux := TStringList.Create;
1174   - tstrListAux.Values['te_node_address'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCipherOpened));
1175   - tstrListAux.Values['id_so'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('Configs.ID_SO' , frmMapaCacic.tStringsCipherOpened));
1176   - tstrListAux.Values['te_so'] := g_oCacic.enCrypt(g_oCacic.getWindowsStrId());
1177   - tstrListAux.Values['id_ip_rede'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.ID_IP_REDE' , frmMapaCacic.tStringsCipherOpened));
1178   - tstrListAux.Values['te_ip'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_IP' , frmMapaCacic.tStringsCipherOpened));
1179   - tstrListAux.Values['te_nome_computador'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR' , frmMapaCacic.tStringsCipherOpened));
1180   - tstrListAux.Values['te_workgroup'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_WORKGROUP' , frmMapaCacic.tStringsCipherOpened));
1181   - tstrListAux.Values['id_usuario'] := g_oCacic.enCrypt(frmMapaCacic.strId_usuario);
1182   - tstrListAux.Values['id_unid_organizacional_nivel1'] := g_oCacic.enCrypt(strIdUON1);
1183   - tstrListAux.Values['id_unid_organizacional_nivel1a']:= g_oCacic.enCrypt(strIdUON1A);
1184   - tstrListAux.Values['id_unid_organizacional_nivel2'] := g_oCacic.enCrypt(strIdUON2);
1185   - tstrListAux.Values['te_localizacao_complementar' ] := g_oCacic.enCrypt(ed_te_localizacao_complementar.Text);
1186   - tstrListAux.Values['te_info_patrimonio1' ] := g_oCacic.enCrypt(ed_te_info_patrimonio1.Text);
1187   - tstrListAux.Values['te_info_patrimonio2' ] := g_oCacic.enCrypt(ed_te_info_patrimonio2.Text);
1188   - tstrListAux.Values['te_info_patrimonio3' ] := g_oCacic.enCrypt(ed_te_info_patrimonio3.Text);
1189   - tstrListAux.Values['te_info_patrimonio4' ] := g_oCacic.enCrypt(ed_te_info_patrimonio4.Text);
1190   - tstrListAux.Values['te_info_patrimonio5' ] := g_oCacic.enCrypt(ed_te_info_patrimonio5.Text);
1191   - tstrListAux.Values['te_info_patrimonio6' ] := g_oCacic.enCrypt(ed_te_info_patrimonio6.Text);
1192   -
1193   - log_DEBUG('Informações para contato com mapa_set_patrimonio:');
1194   - log_DEBUG('te_node_address: '+tstrListAux.Values['te_node_address']);
1195   - log_DEBUG('id_so: '+tstrListAux.Values['id_so']);
1196   - log_DEBUG('te_so: '+tstrListAux.Values['te_so']);
1197   - log_DEBUG('id_ip_rede: '+tstrListAux.Values['id_ip_rede']);
1198   - log_DEBUG('te_ip: '+tstrListAux.Values['te_ip']);
1199   - log_DEBUG('te_nome_computador: '+tstrListAux.Values['te_nome_computador']);
1200   - log_DEBUG('te_workgroup: '+tstrListAux.Values['te_workgroup']);
1201   -
1202   - strRetorno := frmMapaCacic.ComunicaServidor('mapa_set_patrimonio.php', tstrListAux, '');
1203   - tstrListAux.Free;
1204   -
1205   - if not (frmMapaCacic.XML_RetornaValor('STATUS', strRetorno)='OK') then
1206   - Mensagem('ATENÇÃO: PROBLEMAS NO ENVIO DAS INFORMAÇÕES COLETADAS AO BANCO DE DADOS...',true,intPausaPadrao)
1207   - else
1208   - Begin
1209   - Mensagem('Salvando Informações Coletadas em Base Local...',false,intPausaPadrao div 3);
1210   - SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1', strIdUON1, tStringsCipherOpened);
1211   - SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1a', strIdUON1a, tStringsCipherOpened);
1212   - SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2' , strIdUON2, tStringsCipherOpened);
1213   - SetValorDatMemoria('Patrimonio.id_local' , strIdLocal, tStringsCipherOpened);
1214   - SetValorDatMemoria('Patrimonio.te_localizacao_complementar' , ed_te_localizacao_complementar.Text, tStringsCipherOpened);
1215   - SetValorDatMemoria('Patrimonio.te_info_patrimonio1' , ed_te_info_patrimonio1.Text, tStringsCipherOpened);
1216   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio1', ed_te_info_patrimonio1.Text);
1217   - SetValorDatMemoria('Patrimonio.te_info_patrimonio2' , ed_te_info_patrimonio2.Text, tStringsCipherOpened);
1218   - SetValorDatMemoria('Patrimonio.te_info_patrimonio3' , ed_te_info_patrimonio3.Text, tStringsCipherOpened);
1219   - SetValorDatMemoria('Patrimonio.te_info_patrimonio4' , ed_te_info_patrimonio4.Text, tStringsCipherOpened);
1220   - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio4', ed_te_info_patrimonio4.Text);
1221   - SetValorDatMemoria('Patrimonio.te_info_patrimonio5' , ed_te_info_patrimonio5.Text, tStringsCipherOpened);
1222   - SetValorDatMemoria('Patrimonio.te_info_patrimonio6' , ed_te_info_patrimonio6.Text, tStringsCipherOpened);
1223   - SetValorDatMemoria('Patrimonio.ultima_rede_obtida' , GetValorDatMemoria('TcpIp.ID_IP_REDE',frmMapaCacic.tStringsCipherOpened),tStringsCipherOpened);
1224   - End;
1225   - Finalizar(true);
1226   - End;
  1122 + tstrAux := g_oCacic.explode(VetorUON1aFiltrado[cb_id_unid_organizacional_nivel1a.ItemIndex],'#');
  1123 + Try
  1124 + strIdUON1a := tstrAux[0];
  1125 + Except
  1126 + end;
  1127 +
  1128 + tstrAux.Free;
  1129 + Mensagem('Enviando Informações Coletadas ao Banco de Dados...',false,intPausaPadrao div 3);
  1130 + // Envio dos Dados Coletados ao Banco de Dados
  1131 + tstrListAux := TStringList.Create;
  1132 + tstrListAux.Values['te_node_address'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCACIC));
  1133 + tstrListAux.Values['id_so'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('Configs.ID_SO' , frmMapaCacic.tStringsCACIC));
  1134 + tstrListAux.Values['te_so'] := g_oCacic.enCrypt(g_oCacic.getWindowsStrId());
  1135 + tstrListAux.Values['id_ip_rede'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.ID_IP_REDE' , frmMapaCacic.tStringsCACIC));
  1136 + tstrListAux.Values['te_ip'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_IP' , frmMapaCacic.tStringsCACIC));
  1137 + tstrListAux.Values['te_nome_computador'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR' , frmMapaCacic.tStringsCACIC));
  1138 + tstrListAux.Values['te_workgroup'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_WORKGROUP' , frmMapaCacic.tStringsCACIC));
  1139 + tstrListAux.Values['id_usuario'] := g_oCacic.enCrypt(frmMapaCacic.strId_usuario);
  1140 + tstrListAux.Values['id_unid_organizacional_nivel1'] := g_oCacic.enCrypt(strIdUON1);
  1141 + tstrListAux.Values['id_unid_organizacional_nivel1a']:= g_oCacic.enCrypt(strIdUON1A);
  1142 + tstrListAux.Values['id_unid_organizacional_nivel2'] := g_oCacic.enCrypt(strIdUON2);
  1143 + tstrListAux.Values['te_localizacao_complementar' ] := g_oCacic.enCrypt(ed_te_localizacao_complementar.Text);
  1144 + tstrListAux.Values['te_info_patrimonio1' ] := g_oCacic.enCrypt(ed_te_info_patrimonio1.Text);
  1145 + tstrListAux.Values['te_info_patrimonio2' ] := g_oCacic.enCrypt(ed_te_info_patrimonio2.Text);
  1146 + tstrListAux.Values['te_info_patrimonio3' ] := g_oCacic.enCrypt(ed_te_info_patrimonio3.Text);
  1147 + tstrListAux.Values['te_info_patrimonio4' ] := g_oCacic.enCrypt(ed_te_info_patrimonio4.Text);
  1148 + tstrListAux.Values['te_info_patrimonio5' ] := g_oCacic.enCrypt(ed_te_info_patrimonio5.Text);
  1149 + tstrListAux.Values['te_info_patrimonio6' ] := g_oCacic.enCrypt(ed_te_info_patrimonio6.Text);
  1150 +
  1151 + log_DEBUG('Informações para contato com mapa_set_patrimonio:');
  1152 + log_DEBUG('te_node_address: '+tstrListAux.Values['te_node_address']);
  1153 + log_DEBUG('id_so: '+tstrListAux.Values['id_so']);
  1154 + log_DEBUG('te_so: '+tstrListAux.Values['te_so']);
  1155 + log_DEBUG('id_ip_rede: '+tstrListAux.Values['id_ip_rede']);
  1156 + log_DEBUG('te_ip: '+tstrListAux.Values['te_ip']);
  1157 + log_DEBUG('te_nome_computador: '+tstrListAux.Values['te_nome_computador']);
  1158 + log_DEBUG('te_workgroup: '+tstrListAux.Values['te_workgroup']);
  1159 +
  1160 + strRetorno := frmMapaCacic.ComunicaServidor('mapa_set_patrimonio.php', tstrListAux, '');
  1161 + tstrListAux.Free;
  1162 +
  1163 + if not (frmMapaCacic.XML_RetornaValor('STATUS', strRetorno)='OK') then
  1164 + Mensagem('ATENÇÃO: PROBLEMAS NO ENVIO DAS INFORMAÇÕES COLETADAS AO BANCO DE DADOS...',true,intPausaPadrao)
  1165 + else
  1166 + Begin
  1167 + Mensagem('Salvando Informações Coletadas em Base Local...',false,intPausaPadrao div 3);
  1168 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1' , strIdUON1, tStringsMapaCACIC);
  1169 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel1a', strIdUON1a, tStringsMapaCACIC);
  1170 + SetValorDatMemoria('Patrimonio.id_unid_organizacional_nivel2' , strIdUON2, tStringsMapaCACIC);
  1171 + SetValorDatMemoria('Patrimonio.id_local' , strIdLocal, tStringsMapaCACIC);
  1172 + SetValorDatMemoria('Patrimonio.te_localizacao_complementar' , ed_te_localizacao_complementar.Text, tStringsMapaCACIC);
  1173 + SetValorDatMemoria('Patrimonio.te_info_patrimonio1' , ed_te_info_patrimonio1.Text, tStringsMapaCACIC);
  1174 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio1', ed_te_info_patrimonio1.Text);
  1175 + SetValorDatMemoria('Patrimonio.te_info_patrimonio2' , ed_te_info_patrimonio2.Text, tStringsMapaCACIC);
  1176 + SetValorDatMemoria('Patrimonio.te_info_patrimonio3' , ed_te_info_patrimonio3.Text, tStringsMapaCACIC);
  1177 + SetValorDatMemoria('Patrimonio.te_info_patrimonio4' , ed_te_info_patrimonio4.Text, tStringsMapaCACIC);
  1178 + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SOFTWARE\Dataprev\Patrimonio\te_info_patrimonio4', ed_te_info_patrimonio4.Text);
  1179 + SetValorDatMemoria('Patrimonio.te_info_patrimonio5' , ed_te_info_patrimonio5.Text, tStringsMapaCACIC);
  1180 + SetValorDatMemoria('Patrimonio.te_info_patrimonio6' , ed_te_info_patrimonio6.Text, tStringsMapaCACIC);
  1181 + SetValorDatMemoria('Patrimonio.ultima_rede_obtida' , GetValorDatMemoria('TcpIp.ID_IP_REDE',frmMapaCacic.tStringsCACIC),tStringsMapaCACIC);
  1182 + SetValorDatMemoria('Patrimonio.dt_ultima_renovacao' , FormatDateTime('yyyymmddhhnnss', Now),tStringsMapaCACIC);
  1183 + End;
  1184 + Finalizar(true);
1227 1185 end;
1228 1186  
1229 1187 procedure TfrmMapaCacic.MontaInterface(p_strConfigs : String);
... ... @@ -1460,9 +1418,12 @@ end;
1460 1418  
1461 1419 procedure TfrmMapaCacic.mapa;
1462 1420 var strConfigs : String;
  1421 + tstrAUX : TStrings;
1463 1422 begin
  1423 + tstrAUX := TStrings.Create;
  1424 +
1464 1425 Try
1465   - strConfigs := GetValorDatMemoria('Patrimonio.Configs', frmMapaCacic.tStringsCipherOpened);
  1426 + strConfigs := GetValorDatMemoria('Patrimonio.Configs', frmMapaCacic.tStringsMapaCACIC);
1466 1427 gbLeiaComAtencao.Visible := true;
1467 1428 gbInformacoesSobreComputador.Visible := true;
1468 1429 MontaCombos(strConfigs);
... ... @@ -1480,128 +1441,137 @@ var intAux : integer;
1480 1441 v_strCacicPath : String;
1481 1442 Request_mapa : TStringList;
1482 1443 begin
1483   - g_oCacic := TCACIC.Create();
1484   -
1485   - g_oCacic.setBoolCipher(true);
1486   - frmMapaCacic.lbVersao.Caption := 'Versão: ' + frmMapaCacic.GetVersionInfo(ParamStr(0));
1487   - log_DEBUG('Versão do MapaCacic: '+frmMapaCacic.lbVersao.Caption);
1488   -
1489   - if (g_oCacic.isWindowsNTPlataform()) and (not g_oCacic.isWindowsAdmin()) then
  1444 + if not boolFinalizar then
1490 1445 Begin
1491   - MessageDLG(#13#10+'ATENÇÃO! Essa aplicação requer execução com nível administrativo.',mtError,[mbOK],0);
1492   - Sair;
1493   - End
1494   - else
1495   - Begin
1496   - frmMapaCacic.tStringsCipherOpened := TStrings.Create;
  1446 + g_oCacic := TCACIC.Create();
1497 1447  
1498   - // Buscarei o caminho do Sistema em \WinDIR\chkSIS.DAT
1499   - frmMapaCacic.tStringsCipherOpened := CipherOpen(g_oCacic.getWinDir + 'chksis.dat');
1500   - v_strCacicPath := GetValorDatMemoria('cacic2.cacic_dir',frmMapaCacic.tStringsCipherOpened);
  1448 + g_oCacic.setBoolCipher(true);
  1449 + frmMapaCacic.lbVersao.Caption := 'Versão: ' + frmMapaCacic.GetVersionInfo(ParamStr(0));
1501 1450  
1502   - if not (v_strCacicPath = '') then
  1451 + if (g_oCacic.isWindowsNTPlataform()) and (not g_oCacic.isWindowsAdmin()) then
  1452 + MessageDLG(#13#10+'ATENÇÃO! Essa aplicação requer execução com nível administrativo.',mtError,[mbOK],0)
  1453 + else
1503 1454 Begin
1504   - g_oCacic.setCacicPath(v_strCacicPath);
1505   -
1506   - // A existência e bloqueio do arquivo abaixo evitará que o Cacic2.exe entre em ação
1507   - AssignFile(v_Aguarde,g_oCacic.getCacicPath + 'temp\aguarde_MAPACACIC.txt'); {Associa o arquivo a uma variável do tipo TextFile}
1508   - {$IOChecks off}
1509   - Reset(v_Aguarde); {Abre o arquivo texto}
1510   - {$IOChecks on}
1511   - if (IOResult <> 0) then // Arquivo não existe, será recriado.
1512   - Rewrite (v_Aguarde);
1513   -
1514   - Append(v_Aguarde);
1515   - Writeln(v_Aguarde,'Apenas um pseudo-cookie para o Cacic2 esperar o término de MapaCACIC');
1516   - Append(v_Aguarde);
1517   -
1518   - frmMapaCacic.tStringsCipherOpened := frmMapaCacic.CipherOpen(frmMapaCacic.g_oCacic.getCacicPath + frmMapaCacic.g_oCacic.getDatFileName);
1519   - frmMapaCacic.lbNomeServidorWEB.Caption := 'Servidor: '+frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsCipherOpened);
1520   - frmMapaCacic.lbMensagens.Caption := 'Entrada de Dados para Autenticação no Módulo Gerente WEB Cacic';
1521   - if (frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCipherOpened)='') then
1522   - Begin
1523   - frmMapaCacic.boolAcessoOK := false;
1524   - MessageDLG(#13#10+'Atenção! É necessário executar as coletas do Sistema Cacic.' + #13#10 + #13#10 +
1525   - 'Caso o Sistema Cacic já esteja instalado, clique com botão direito' + #13#10 +
1526   - 'sobre o ícone da bandeja, escolha a opção "Executar Agora" e aguarde' + #13#10 +
1527   - 'o fim do processo.',mtError,[mbOK],0);
1528   - frmMapaCacic.Finalizar(false);
1529   - End
1530   - else
  1455 + frmMapaCacic.tStringsMapaCACIC := TStrings.Create;
  1456 +
  1457 + // Buscarei o caminho do Sistema em \WinDIR\chkSIS.DAT
  1458 + CipherOpen(g_oCacic.getWinDir + 'chksis.dat',frmMapaCacic.tStringsMapaCACIC);
  1459 + v_strCacicPath := GetValorDatMemoria('cacic2.cacic_dir',frmMapaCacic.tStringsMapaCACIC);
  1460 +
  1461 + if not (v_strCacicPath = '') then
1531 1462 Begin
1532   - Matar(g_oCacic.getCacicPath,'aguarde_CACIC.txt');
  1463 + frmMapaCacic.tStringsCACIC := TStrings.Create;
  1464 + g_oCacic.setCacicPath(v_strCacicPath);
1533 1465  
1534   - if FileExists(g_oCacic.getCacicPath + 'aguarde_CACIC.txt') then
1535   - Begin
1536   - MessageDLG(#13#10+'ATENÇÃO! É necessário finalizar o Agente Principal do CACIC.',mtError,[mbOK],0);
1537   - Sair;
1538   - End;
  1466 + // A existência e bloqueio do arquivo abaixo evitará que o Cacic2.exe entre em ação
  1467 + AssignFile(v_Aguarde,g_oCacic.getCacicPath + 'temp\aguarde_MAPACACIC.txt'); {Associa o arquivo a uma variável do tipo TextFile}
  1468 + {$IOChecks off}
  1469 + Reset(v_Aguarde); {Abre o arquivo texto}
  1470 + {$IOChecks on}
  1471 + if (IOResult <> 0) then // Arquivo não existe, será recriado.
  1472 + Rewrite (v_Aguarde);
1539 1473  
1540   - boolDebugs := false;
1541   - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then
1542   - Begin
1543   - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then
1544   - Begin
1545   - boolDebugs := true;
1546   - log_DEBUG('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.');
1547   - End;
1548   - End;
  1474 + Append(v_Aguarde);
  1475 + Writeln(v_Aguarde,'Apenas um pseudo-cookie para o Cacic2 esperar o término de MapaCACIC');
  1476 + Append(v_Aguarde);
  1477 +
  1478 + CipherOpen(frmMapaCacic.g_oCacic.getCacicPath + frmMapaCacic.g_oCacic.getDatFileName,frmMapaCacic.tStringsCACIC);
  1479 +
  1480 + if not FileExists(frmMapaCacic.g_oCacic.getCacicPath + 'MapaCACIC.dat') then
  1481 + CopyFile(PChar(frmMapaCacic.g_oCacic.getCacicPath + frmMapaCacic.g_oCacic.getDatFileName), PChar(frmMapaCacic.g_oCacic.getCacicPath + 'MapaCACIC.dat'), true);
1549 1482  
1550   - // Acessar...
1551   - CriaFormSenha(nil);
1552   - frmAcesso.ShowModal;
  1483 + frmMapaCacic.CipherOpen(frmMapaCacic.g_oCacic.getCacicPath + 'MapaCACIC.dat',frmMapaCacic.tStringsMapaCACIC);
1553 1484  
1554   - if not (boolAcessoOK) then
1555   - Finalizar(true)
  1485 + // Sobreponho as informações do MapaCACIC com informações do CACIC, caso sejam mais antigas
  1486 + if (GetValorDatMemoria('Patrimonio.dt_ultima_renovacao',tStringsMapaCACIC) = '') or
  1487 + (StrToInt64(GetValorDatMemoria('Patrimonio.dt_ultima_renovacao',tStringsMapaCACIC)) < StrToInt64(GetValorDatMemoria('Patrimonio.dt_ultima_renovacao',tStringsCACIC))) then
  1488 + frmMapaCacic.tStringsMapaCACIC := frmMapaCacic.tStringsCACIC;
  1489 +
  1490 + frmMapaCacic.lbNomeServidorWEB.Caption := 'Servidor de Aplicação: '+frmMapaCacic.GetValorDatMemoria('Configs.EnderecoServidor', frmMapaCacic.tStringsCACIC);
  1491 + frmMapaCacic.lbMensagens.Caption := 'Entrada de Dados para Autenticação no Módulo Gerente WEB Cacic';
  1492 + if (frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCACIC)='') then
  1493 + Begin
  1494 + frmMapaCacic.boolAcessoOK := false;
  1495 + MessageDLG(#13#10+'Atenção! É necessário executar as coletas do Sistema Cacic.' + #13#10 + #13#10 +
  1496 + 'Caso o Sistema Cacic já esteja instalado, clique com botão direito' + #13#10 +
  1497 + 'sobre o ícone da bandeja, escolha a opção "Executar Agora" e aguarde' + #13#10 +
  1498 + 'o fim do processo.',mtError,[mbOK],0);
  1499 + frmMapaCacic.Finalizar(false);
  1500 + End
1556 1501 else
1557 1502 Begin
1558   - pnMensagens.Visible := true;
1559   - Mensagem('Efetuando Comunicação com o Módulo Gerente WEB em "'+GetValorDatMemoria('Configs.EnderecoServidor', tStringsCipherOpened)+'"...',false,intPausaPadrao div 3);
1560   - frmAcesso.Free;
1561   -
1562   - // Povoamento com dados de configurações da interface patrimonial
1563   - // Solicita ao servidor as configurações para a Coleta de Informações de Patrimônio
1564   - Request_mapa := TStringList.Create;
1565   - Request_mapa.Values['te_node_address'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCipherOpened));
1566   - Request_mapa.Values['id_so'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('Configs.ID_SO' , frmMapaCacic.tStringsCipherOpened));
1567   - Request_mapa.Values['te_so'] := g_oCacic.enCrypt(g_oCacic.getWindowsStrId());
1568   - Request_mapa.Values['id_ip_rede'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.ID_IP_REDE' , frmMapaCacic.tStringsCipherOpened));
1569   - Request_mapa.Values['te_ip'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_IP' , frmMapaCacic.tStringsCipherOpened));
1570   - Request_mapa.Values['te_nome_computador']:= g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', frmMapaCacic.tStringsCipherOpened));
1571   - Request_mapa.Values['te_workgroup'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_WORKGROUP' , frmMapaCacic.tStringsCipherOpened));
1572   - Request_mapa.Values['id_usuario'] := g_oCacic.enCrypt(frmMapaCacic.strId_usuario);
1573   -
1574   - strRetorno := frmMapaCacic.ComunicaServidor('mapa_get_patrimonio.php', Request_mapa, '.');
1575   -
1576   - log_DEBUG('Retorno: "'+strRetorno+'"');
1577   -
1578   - if (frmMapaCacic.XML_RetornaValor('STATUS', strRetorno)='OK') then
1579   - Begin
1580   - Mensagem('Comunicação Efetuada com Sucesso! Salvando Configurações Obtidas...',false,intPausaPadrao div 3);
1581   - frmMapaCacic.SetValorDatMemoria('Patrimonio.Configs', strRetorno, frmMapaCacic.tStringsCipherOpened)
1582   - End
1583   - else
  1503 +
  1504 + boolDebugs := false;
  1505 + if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then
1584 1506 Begin
1585   - Mensagem('PROBLEMAS NA COMUNICAÇÃO COM O MÓDULO GERENTE WEB...',true,intPausaPadrao);
1586   - Finalizar(true);
  1507 + if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then
  1508 + Begin
  1509 + boolDebugs := true;
  1510 + log_DEBUG('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.');
  1511 + End;
1587 1512 End;
1588 1513  
1589   - Request_mapa.Free;
  1514 + log_DEBUG('Versão do MapaCacic: '+frmMapaCacic.lbVersao.Caption);
  1515 +
  1516 + // Acessar...
  1517 + CriaFormSenha(nil);
  1518 + frmAcesso.ShowModal;
1590 1519  
1591   - mapa;
  1520 + if boolFinalizar then
  1521 + Finalizar(false)
  1522 + else if boolAcessoOK then
  1523 + Begin
  1524 + pnMensagens.Visible := true;
  1525 + Mensagem('Efetuando Comunicação com o Módulo Gerente WEB em "'+GetValorDatMemoria('Configs.EnderecoServidor', tStringsCACIC)+'"...',false,intPausaPadrao div 3);
  1526 + frmAcesso.Free;
  1527 +
  1528 + // Povoamento com dados de configurações da interface patrimonial
  1529 + // Solicita ao servidor as configurações para a Coleta de Informações de Patrimônio
  1530 + Request_mapa := TStringList.Create;
  1531 + Request_mapa.Values['te_node_address'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , frmMapaCacic.tStringsCACIC));
  1532 + Request_mapa.Values['id_so'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('Configs.ID_SO' , frmMapaCacic.tStringsCACIC));
  1533 + Request_mapa.Values['te_so'] := g_oCacic.enCrypt(g_oCacic.getWindowsStrId());
  1534 + Request_mapa.Values['id_ip_rede'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.ID_IP_REDE' , frmMapaCacic.tStringsCACIC));
  1535 + Request_mapa.Values['te_ip'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_IP' , frmMapaCacic.tStringsCACIC));
  1536 + Request_mapa.Values['te_nome_computador']:= g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_NOME_COMPUTADOR', frmMapaCacic.tStringsCACIC));
  1537 + Request_mapa.Values['te_workgroup'] := g_oCacic.enCrypt(frmMapaCacic.GetValorDatMemoria('TcpIp.TE_WORKGROUP' , frmMapaCacic.tStringsCACIC));
  1538 + Request_mapa.Values['id_usuario'] := g_oCacic.enCrypt(frmMapaCacic.strId_usuario);
  1539 +
  1540 + strRetorno := frmMapaCacic.ComunicaServidor('mapa_get_patrimonio.php', Request_mapa, '.');
  1541 +
  1542 + log_DEBUG('Retorno: "'+strRetorno+'"');
  1543 +
  1544 + if (frmMapaCacic.XML_RetornaValor('STATUS', strRetorno)='OK') then
  1545 + Begin
  1546 + Mensagem('Comunicação Efetuada com Sucesso! Salvando Configurações Obtidas...',false,intPausaPadrao div 3);
  1547 + frmMapaCacic.SetValorDatMemoria('Patrimonio.Configs', strRetorno, frmMapaCacic.tStringsMapaCACIC)
  1548 + End
  1549 + else
  1550 + Begin
  1551 + Mensagem('PROBLEMAS NA COMUNICAÇÃO COM O MÓDULO GERENTE WEB...',true,intPausaPadrao);
  1552 + Finalizar(true);
  1553 + End;
  1554 +
  1555 + Request_mapa.Free;
  1556 +
  1557 + mapa;
  1558 + End;
1592 1559 End;
  1560 + End
  1561 + else
  1562 + Begin
  1563 + frmMapaCacic.boolAcessoOK := false;
  1564 + MessageDLG(#13#10+'Atenção! É necessário reinstalar o CACIC nesta estação.' + #13#10 + #13#10 +
  1565 + 'A estrutura encontra-se corrompida.' + #13#10,mtError,[mbOK],0);
  1566 + frmMapaCacic.Finalizar(false);
1593 1567 End;
1594   - End
1595   - else
1596   - Begin
1597   - frmMapaCacic.boolAcessoOK := false;
1598   - MessageDLG(#13#10+'Atenção! É necessário reinstalar o CACIC nesta estação.' + #13#10 + #13#10 +
1599   - 'A estrutura encontra-se corrompida.' + #13#10,mtError,[mbOK],0);
1600   - frmMapaCacic.Finalizar(false);
1601 1568 End;
1602   - End;
1603   -
  1569 + End;
1604 1570 end;
1605 1571  
  1572 +procedure TfrmMapaCacic.FormCreate(Sender: TObject);
  1573 +begin
  1574 + boolFinalizar := false;
  1575 +end;
1606 1576  
1607 1577 end.
... ...
mapa/mapacacic.dpr
... ... @@ -51,10 +51,11 @@ begin
51 51 end;
52 52 FreeMemory(0);
53 53 end
54   - else begin
55   - Application.Initialize;
56   - Application.CreateForm(TfrmMapaCacic, frmMapaCacic);
57   - Application.Run;
58   - end;
  54 + else
  55 + begin
  56 + Application.Initialize;
  57 + Application.CreateForm(TfrmMapaCacic, frmMapaCacic);
  58 + Application.Run;
  59 + end;
59 60 oCacic.Free();
60 61 end.
... ...
mapa/mapacacic.res
No preview for this file type
vaca/vaca.res
No preview for this file type
vacon/vacon.res
No preview for this file type