Commit c52c6d6f1d935a9293aa44ff1147e51d4770f99e
1 parent
4d566bb7
Exists in
master
Reuso de codigos da library generica, pequenas correcoes e faxina de codigo.
git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@775 fecfc0c7-e812-0410-ae72-849f08638ee7
Showing
11 changed files
with
666 additions
and
563 deletions
Show diff stats
CACIC_Library.pas
| ... | ... | @@ -132,17 +132,20 @@ type |
| 132 | 132 | protected |
| 133 | 133 | /// Mantem o caminho físico de instalação do agente cacic |
| 134 | 134 | g_cacic_path: string; |
| 135 | + g_boolCipher : boolean; | |
| 135 | 136 | |
| 136 | 137 | public |
| 137 | 138 | Windows : TCACIC_Windows; /// objeto de informacoes de windows |
| 138 | 139 | Debug : TCACIC_Debug; /// objeto de tratamento de debug |
| 139 | 140 | procedure setCacicPath(p_cacic_path: string); |
| 141 | + procedure setBoolCipher(p_boolCipher : boolean); | |
| 140 | 142 | function deCrypt(p_Data : String) : String; |
| 141 | 143 | function enCrypt(p_Data : String) : String; |
| 142 | 144 | function explode(p_String, p_Separador : String) : TStrings; |
| 143 | 145 | function implode(p_Array : TStrings ; p_Separador : String) : String; |
| 144 | 146 | function getCacicPath() : String; |
| 145 | 147 | function getCipherKey() : String; |
| 148 | + function getBoolCipher() : boolean; | |
| 146 | 149 | function getIV() : String; |
| 147 | 150 | function getKeySize() : integer; |
| 148 | 151 | function getBlockSize() : integer; |
| ... | ... | @@ -307,6 +310,26 @@ begin |
| 307 | 310 | end; |
| 308 | 311 | |
| 309 | 312 | {*------------------------------------------------------------------------------ |
| 313 | + Atribui valor booleano à variável indicadora do status da criptografia | |
| 314 | + | |
| 315 | + @param p_boolCipher Valor booleano para atribuição à variável para status da | |
| 316 | + criptografia. | |
| 317 | +-------------------------------------------------------------------------------} | |
| 318 | +procedure TCACIC.setBoolCipher(p_boolCipher : boolean); | |
| 319 | +Begin | |
| 320 | + Self.g_boolCipher := p_boolCipher; | |
| 321 | +End; | |
| 322 | +{*------------------------------------------------------------------------------ | |
| 323 | + Obtém o status da criptografia (TRUE -> Ligada / FALSE -> Desligada) | |
| 324 | + | |
| 325 | + @return boolean contendo o status para a criptografia | |
| 326 | +-------------------------------------------------------------------------------} | |
| 327 | +function TCACIC.getBoolCipher() : boolean; | |
| 328 | +Begin | |
| 329 | + Result := Self.g_boolCipher; | |
| 330 | +End; | |
| 331 | + | |
| 332 | +{*------------------------------------------------------------------------------ | |
| 310 | 333 | Atribui o caminho físico de instalação do agente cacic |
| 311 | 334 | |
| 312 | 335 | @param p_cacic_path Caminho físico de instalação do agente cacic |
| ... | ... | @@ -756,29 +779,35 @@ var |
| 756 | 779 | l_Data, l_Key, l_IV : string; |
| 757 | 780 | begin |
| 758 | 781 | Try |
| 759 | - // Pad Key, IV and Data with zeros as appropriate | |
| 760 | - l_Key := PadWithZeros(CACIC_CIPHERKEY,CACIC_KEYSIZE); | |
| 761 | - l_IV := PadWithZeros(CACIC_IV,CACIC_BLOCKSIZE); | |
| 762 | - l_Data := PadWithZeros(p_Data,CACIC_BLOCKSIZE); | |
| 763 | - | |
| 764 | - // Create the cipher and initialise according to the key length | |
| 765 | - l_Cipher := TDCP_rijndael.Create(nil); | |
| 766 | - if Length(CACIC_CIPHERKEY) <= 16 then | |
| 767 | - l_Cipher.Init(l_Key[1],128,@l_IV[1]) | |
| 768 | - else if Length(CACIC_CIPHERKEY) <= 24 then | |
| 769 | - l_Cipher.Init(l_Key[1],192,@l_IV[1]) | |
| 770 | - else | |
| 771 | - l_Cipher.Init(l_Key[1],256,@l_IV[1]); | |
| 772 | - | |
| 773 | - // Encrypt the data | |
| 774 | - l_Cipher.EncryptCBC(l_Data[1],l_Data[1],Length(l_Data)); | |
| 775 | - | |
| 776 | - // Free the cipher and clear sensitive information | |
| 777 | - l_Cipher.Free; | |
| 778 | - FillChar(l_Key[1],Length(l_Key),0); | |
| 779 | - | |
| 780 | - // Return the Base64 encoded result | |
| 781 | - Result := Base64EncodeStr(l_Data); | |
| 782 | + if self.g_boolCipher then | |
| 783 | + Begin | |
| 784 | + // Pad Key, IV and Data with zeros as appropriate | |
| 785 | + l_Key := PadWithZeros(CACIC_CIPHERKEY,CACIC_KEYSIZE); | |
| 786 | + l_IV := PadWithZeros(CACIC_IV,CACIC_BLOCKSIZE); | |
| 787 | + l_Data := PadWithZeros(p_Data,CACIC_BLOCKSIZE); | |
| 788 | + | |
| 789 | + // Create the cipher and initialise according to the key length | |
| 790 | + l_Cipher := TDCP_rijndael.Create(nil); | |
| 791 | + if Length(CACIC_CIPHERKEY) <= 16 then | |
| 792 | + l_Cipher.Init(l_Key[1],128,@l_IV[1]) | |
| 793 | + else if Length(CACIC_CIPHERKEY) <= 24 then | |
| 794 | + l_Cipher.Init(l_Key[1],192,@l_IV[1]) | |
| 795 | + else | |
| 796 | + l_Cipher.Init(l_Key[1],256,@l_IV[1]); | |
| 797 | + | |
| 798 | + // Encrypt the data | |
| 799 | + l_Cipher.EncryptCBC(l_Data[1],l_Data[1],Length(l_Data)); | |
| 800 | + | |
| 801 | + // Free the cipher and clear sensitive information | |
| 802 | + l_Cipher.Free; | |
| 803 | + FillChar(l_Key[1],Length(l_Key),0); | |
| 804 | + | |
| 805 | + // Return the Base64 encoded result | |
| 806 | + Result := Base64EncodeStr(l_Data); | |
| 807 | + End | |
| 808 | + Else | |
| 809 | + // Return the original value | |
| 810 | + Result := p_Data; | |
| 782 | 811 | Except |
| 783 | 812 | // LogDiario('Erro no Processo de Criptografia'); |
| 784 | 813 | End; |
| ... | ... | @@ -790,31 +819,37 @@ var |
| 790 | 819 | l_Data, l_Key, l_IV : string; |
| 791 | 820 | begin |
| 792 | 821 | Try |
| 793 | - // Pad Key and IV with zeros as appropriate | |
| 794 | - l_Key := PadWithZeros(CACIC_CIPHERKEY,CACIC_KEYSIZE); | |
| 795 | - l_IV := PadWithZeros(CACIC_IV,CACIC_BLOCKSIZE); | |
| 796 | - | |
| 797 | - // Decode the Base64 encoded string | |
| 798 | - l_Data := Base64DecodeStr(p_Data); | |
| 799 | - | |
| 800 | - // Create the cipher and initialise according to the key length | |
| 801 | - l_Cipher := TDCP_rijndael.Create(nil); | |
| 802 | - if Length(CACIC_CIPHERKEY) <= 16 then | |
| 803 | - l_Cipher.Init(l_Key[1],128,@l_IV[1]) | |
| 804 | - else if Length(CACIC_CIPHERKEY) <= 24 then | |
| 805 | - l_Cipher.Init(l_Key[1],192,@l_IV[1]) | |
| 806 | - else | |
| 807 | - l_Cipher.Init(l_Key[1],256,@l_IV[1]); | |
| 808 | - | |
| 809 | - // Decrypt the data | |
| 810 | - l_Cipher.DecryptCBC(l_Data[1],l_Data[1],Length(l_Data)); | |
| 811 | - | |
| 812 | - // Free the cipher and clear sensitive information | |
| 813 | - l_Cipher.Free; | |
| 814 | - FillChar(l_Key[1],Length(l_Key),0); | |
| 815 | - | |
| 816 | - // Return the result | |
| 817 | - Result := l_Data; | |
| 822 | + if self.g_boolCipher then | |
| 823 | + Begin | |
| 824 | + // Pad Key and IV with zeros as appropriate | |
| 825 | + l_Key := PadWithZeros(CACIC_CIPHERKEY,CACIC_KEYSIZE); | |
| 826 | + l_IV := PadWithZeros(CACIC_IV,CACIC_BLOCKSIZE); | |
| 827 | + | |
| 828 | + // Decode the Base64 encoded string | |
| 829 | + l_Data := Base64DecodeStr(p_Data); | |
| 830 | + | |
| 831 | + // Create the cipher and initialise according to the key length | |
| 832 | + l_Cipher := TDCP_rijndael.Create(nil); | |
| 833 | + if Length(CACIC_CIPHERKEY) <= 16 then | |
| 834 | + l_Cipher.Init(l_Key[1],128,@l_IV[1]) | |
| 835 | + else if Length(CACIC_CIPHERKEY) <= 24 then | |
| 836 | + l_Cipher.Init(l_Key[1],192,@l_IV[1]) | |
| 837 | + else | |
| 838 | + l_Cipher.Init(l_Key[1],256,@l_IV[1]); | |
| 839 | + | |
| 840 | + // Decrypt the data | |
| 841 | + l_Cipher.DecryptCBC(l_Data[1],l_Data[1],Length(l_Data)); | |
| 842 | + | |
| 843 | + // Free the cipher and clear sensitive information | |
| 844 | + l_Cipher.Free; | |
| 845 | + FillChar(l_Key[1],Length(l_Key),0); | |
| 846 | + | |
| 847 | + // Return the result (unCrypted) | |
| 848 | + Result := l_Data | |
| 849 | + End | |
| 850 | + Else | |
| 851 | + // Return the original value | |
| 852 | + Result := p_Data | |
| 818 | 853 | Except |
| 819 | 854 | // LogDiario('Erro no Processo de Decriptografia'); |
| 820 | 855 | End; | ... | ... |
cacic2.dpr
col_moni/col_moni.dpr
| ... | ... | @@ -6,7 +6,7 @@ Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de In |
| 6 | 6 | |
| 7 | 7 | O CACIC é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como |
| 8 | 8 | publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença, ou (na sua opinião) qualquer versão. |
| 9 | - | |
| 9 | + | |
| 10 | 10 | Este programa é distribuido na esperança que possa ser util, mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer |
| 11 | 11 | MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes. |
| 12 | 12 | |
| ... | ... | @@ -28,7 +28,6 @@ uses |
| 28 | 28 | CACIC_Library in '..\CACIC_Library.pas'; |
| 29 | 29 | |
| 30 | 30 | var |
| 31 | - v_path_cacic, | |
| 32 | 31 | v_Res_Search, |
| 33 | 32 | v_Drive, |
| 34 | 33 | v_File, |
| ... | ... | @@ -876,44 +875,52 @@ begin |
| 876 | 875 | end; |
| 877 | 876 | end; |
| 878 | 877 | |
| 878 | +var strAux : String; | |
| 879 | 879 | begin |
| 880 | 880 | g_oCacic := TCACIC.Create(); |
| 881 | 881 | |
| 882 | + g_oCacic.setBoolCipher(true); | |
| 883 | + | |
| 882 | 884 | if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then |
| 883 | 885 | if (ParamCount>0) then |
| 884 | - Begin | |
| 885 | - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini | |
| 886 | - tstrTripa1 := g_oCacic.explode(ExtractFilePath(ParamStr(0)),'\'); | |
| 887 | - v_path_cacic := ''; | |
| 888 | - For intAux := 0 to tstrTripa1.Count -2 do | |
| 889 | - begin | |
| 890 | - v_path_cacic := v_path_cacic + tstrTripa1[intAux] + '\'; | |
| 891 | - end; | |
| 892 | - | |
| 893 | - g_oCacic.setCacicPath(v_path_cacic); | |
| 894 | - v_Debugs := false; | |
| 895 | - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 896 | - Begin | |
| 897 | - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 898 | - Begin | |
| 899 | - v_Debugs := true; | |
| 900 | - log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 901 | - End; | |
| 902 | - End; | |
| 903 | - | |
| 904 | - v_tstrCipherOpened := TStrings.Create; | |
| 905 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getDatFileName); | |
| 906 | - | |
| 907 | - v_tstrCipherOpened1 := TStrings.Create; | |
| 908 | - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_moni.dat'); | |
| 909 | - | |
| 910 | - Try | |
| 911 | - Executa_Col_moni; | |
| 912 | - Except | |
| 913 | - SetValorDatMemoria('Col_Moni.nada', 'nada', v_tstrCipherOpened1); | |
| 914 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_moni.dat', v_tstrCipherOpened1); | |
| 915 | - End; | |
| 916 | - End; | |
| 886 | + Begin | |
| 887 | + strAux := ''; | |
| 888 | + For intAux := 1 to ParamCount do | |
| 889 | + Begin | |
| 890 | + if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then | |
| 891 | + begin | |
| 892 | + strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); | |
| 893 | + log_DEBUG('Parâmetro /CacicPath recebido com valor="'+strAux+'"'); | |
| 894 | + end; | |
| 895 | + end; | |
| 896 | + | |
| 897 | + if (strAux <> '') then | |
| 898 | + Begin | |
| 899 | + g_oCacic.setCacicPath(strAux); | |
| 900 | + v_Debugs := false; | |
| 901 | + if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 902 | + Begin | |
| 903 | + if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 904 | + Begin | |
| 905 | + v_Debugs := true; | |
| 906 | + log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 907 | + End; | |
| 908 | + End; | |
| 909 | + | |
| 910 | + v_tstrCipherOpened := TStrings.Create; | |
| 911 | + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 912 | + | |
| 913 | + v_tstrCipherOpened1 := TStrings.Create; | |
| 914 | + v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_moni.dat'); | |
| 915 | + | |
| 916 | + Try | |
| 917 | + Executa_Col_moni; | |
| 918 | + Except | |
| 919 | + SetValorDatMemoria('Col_Moni.nada', 'nada', v_tstrCipherOpened1); | |
| 920 | + CipherClose(g_oCacic.getCacicPath + 'temp\col_moni.dat', v_tstrCipherOpened1); | |
| 921 | + End; | |
| 922 | + End; | |
| 923 | + End; | |
| 917 | 924 | |
| 918 | 925 | g_oCacic.Free(); |
| 919 | 926 | ... | ... |
col_patr/col_patr.dpr
| ... | ... | @@ -32,12 +32,12 @@ const |
| 32 | 32 | |
| 33 | 33 | var |
| 34 | 34 | hwind:HWND; |
| 35 | - g_oCacic : TCACIC; | |
| 35 | + oCacic : TCACIC; | |
| 36 | 36 | |
| 37 | 37 | begin |
| 38 | - g_oCacic := TCACIC.Create(); | |
| 38 | + oCacic := TCACIC.Create(); | |
| 39 | 39 | |
| 40 | - if( g_oCacic.isAppRunning( CACIC_APP_NAME ) ) | |
| 40 | + if( oCacic.isAppRunning( CACIC_APP_NAME ) ) | |
| 41 | 41 | then begin |
| 42 | 42 | hwind := 0; |
| 43 | 43 | repeat // The string 'My app' must match your App Title (below) |
| ... | ... | @@ -55,6 +55,6 @@ begin |
| 55 | 55 | Application.Run; |
| 56 | 56 | end; |
| 57 | 57 | |
| 58 | - g_oCacic.Free(); | |
| 58 | + oCacic.Free(); | |
| 59 | 59 | |
| 60 | 60 | end. | ... | ... |
col_patr/main_col_patr.pas
| ... | ... | @@ -906,93 +906,96 @@ var boolColeta : boolean; |
| 906 | 906 | tstrTripa1 : TStrings; |
| 907 | 907 | i,intAux : integer; |
| 908 | 908 | v_Aux, |
| 909 | - v_path_cacic : String; | |
| 909 | + strAux : String; | |
| 910 | 910 | Begin |
| 911 | 911 | g_oCacic := TCACIC.Create(); |
| 912 | 912 | |
| 913 | + g_oCacic.setBoolCipher(true); | |
| 914 | + | |
| 913 | 915 | if (ParamCount>0) then |
| 914 | 916 | Begin |
| 915 | 917 | FormPatrimonio.lbVersao.Caption := 'Versão: ' + GetVersionInfo(ParamStr(0)); |
| 916 | - | |
| 917 | - v_option := 'system'; | |
| 918 | - For intAux := 1 to ParamCount do | |
| 919 | - Begin | |
| 920 | - if LowerCase(Copy(ParamStr(intAux),1,10)) = '/p_option=' then | |
| 921 | - v_option := Trim(Copy(ParamStr(intAux),11,Length((ParamStr(intAux))))); | |
| 922 | - End; | |
| 923 | - | |
| 924 | - tstrTripa1 := g_oCacic.explode(ExtractFilePath(Application.Exename),'\'); //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic | |
| 925 | - v_path_cacic := ''; | |
| 926 | - For i := 0 to tstrTripa1.Count -2 do | |
| 927 | - v_path_cacic := v_path_cacic + tstrTripa1[i] + '\'; | |
| 928 | - | |
| 929 | - g_oCacic.setCacicPath(v_path_cacic); | |
| 930 | - v_Debugs := false; | |
| 931 | - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 932 | 918 | Begin |
| 933 | - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 919 | + strAux := ''; | |
| 920 | + For intAux := 1 to ParamCount do | |
| 934 | 921 | Begin |
| 935 | - v_Debugs := true; | |
| 936 | - log_DEBUG('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 937 | - End; | |
| 938 | - End; | |
| 939 | - | |
| 940 | - v_tstrCipherOpened := TStrings.Create; | |
| 941 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + 'cacic2.dat'); | |
| 942 | - | |
| 943 | - v_tstrCipherOpened1 := TStrings.Create; | |
| 944 | - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_patr.dat'); | |
| 945 | - | |
| 946 | - // Os valores possíveis serão 0-DESLIGADO 1-LIGADO 2-ESPERA PARA LIGAR (Será transformado em "1") 3-Ainda se comunicará com o Gerente WEB | |
| 947 | - l_cs_cipher := false; | |
| 948 | - v_Aux := GetValorDatMemoria('Configs.CS_CIPHER', v_tstrCipherOpened); | |
| 949 | - if (v_Aux='1')then | |
| 950 | - Begin | |
| 951 | - l_cs_cipher := true; | |
| 952 | - End; | |
| 953 | - | |
| 954 | - Try | |
| 955 | - boolColeta := false; | |
| 956 | - if (GetValorDatMemoria('Patrimonio.in_alteracao_fisica',v_tstrCipherOpened)= 'S') then | |
| 957 | - Begin | |
| 958 | - // Solicita o cadastramento de informações de patrimõnio caso seja detectado remanejamento para uma nova rede. | |
| 959 | - MessageDlg('Atenção: foi identificada uma alteração na 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); | |
| 960 | - boolColeta := true; | |
| 961 | - End | |
| 962 | - Else if (GetValorDatMemoria('Patrimonio.in_renovacao_informacoes',v_tstrCipherOpened)= 'S') and (v_option='system') then | |
| 963 | - Begin | |
| 964 | - // Solicita o cadastramento de informações de patrimõnio caso tenha completado o prazo configurado para renovação de informações. | |
| 965 | - 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); | |
| 966 | - boolColeta := true; | |
| 967 | - end | |
| 968 | - Else if (GetValorDatMemoria('Patrimonio.dt_ultima_renovacao_patrim',v_tstrCipherOpened)= '') then | |
| 969 | - Begin | |
| 970 | - // Solicita o cadastramento de informações de patrimõnio caso ainda não tenha sido cadastrado. | |
| 971 | - boolColeta := true; | |
| 972 | - end; | |
| 973 | - | |
| 974 | - if boolColeta then | |
| 922 | + if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then | |
| 923 | + begin | |
| 924 | + strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); | |
| 925 | + log_DEBUG('Parâmetro /CacicPath recebido com valor="'+strAux+'"'); | |
| 926 | + end; | |
| 927 | + end; | |
| 928 | + | |
| 929 | + if (strAux <> '') then | |
| 975 | 930 | Begin |
| 976 | - SetValorDatMemoria('Col_Patr.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); | |
| 977 | - log_diario('Coletando informações de Patrimônio e Localização Física.'); | |
| 978 | - v_configs := GetValorDatMemoria('Patrimonio.Configs',v_tstrCipherOpened); | |
| 979 | - log_DEBUG('Configurações obtidas: '+v_configs); | |
| 980 | - | |
| 981 | - MontaInterface; | |
| 982 | - MontaCombos; | |
| 983 | - RecuperaValoresAnteriores; | |
| 984 | - | |
| 931 | + g_oCacic.setCacicPath(strAux); | |
| 932 | + v_Debugs := false; | |
| 933 | + if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 934 | + Begin | |
| 935 | + if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 936 | + Begin | |
| 937 | + v_Debugs := true; | |
| 938 | + log_DEBUG('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 939 | + End; | |
| 940 | + End; | |
| 941 | + | |
| 942 | + v_tstrCipherOpened := TStrings.Create; | |
| 943 | + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 944 | + | |
| 945 | + v_tstrCipherOpened1 := TStrings.Create; | |
| 946 | + v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_patr.dat'); | |
| 947 | + | |
| 948 | + // Os valores possíveis serão 0-DESLIGADO 1-LIGADO 2-ESPERA PARA LIGAR (Será transformado em "1") 3-Ainda se comunicará com o Gerente WEB | |
| 949 | + l_cs_cipher := false; | |
| 950 | + v_Aux := GetValorDatMemoria('Configs.CS_CIPHER', v_tstrCipherOpened); | |
| 951 | + if (v_Aux='1')then | |
| 952 | + Begin | |
| 953 | + l_cs_cipher := true; | |
| 954 | + End; | |
| 955 | + | |
| 956 | + Try | |
| 957 | + boolColeta := false; | |
| 958 | + if (GetValorDatMemoria('Patrimonio.in_alteracao_fisica',v_tstrCipherOpened)= 'S') then | |
| 959 | + Begin | |
| 960 | + // Solicita o cadastramento de informações de patrimõnio caso seja detectado remanejamento para uma nova rede. | |
| 961 | + MessageDlg('Atenção: foi identificada uma alteração na 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); | |
| 962 | + boolColeta := true; | |
| 963 | + End | |
| 964 | + Else if (GetValorDatMemoria('Patrimonio.in_renovacao_informacoes',v_tstrCipherOpened)= 'S') and (v_option='system') then | |
| 965 | + Begin | |
| 966 | + // Solicita o cadastramento de informações de patrimõnio caso tenha completado o prazo configurado para renovação de informações. | |
| 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 | + boolColeta := true; | |
| 969 | + end | |
| 970 | + Else if (GetValorDatMemoria('Patrimonio.dt_ultima_renovacao_patrim',v_tstrCipherOpened)= '') then | |
| 971 | + Begin | |
| 972 | + // Solicita o cadastramento de informações de patrimõnio caso ainda não tenha sido cadastrado. | |
| 973 | + boolColeta := true; | |
| 974 | + end; | |
| 975 | + | |
| 976 | + if boolColeta then | |
| 977 | + Begin | |
| 978 | + SetValorDatMemoria('Col_Patr.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); | |
| 979 | + log_diario('Coletando informações de Patrimônio e Localização Física.'); | |
| 980 | + v_configs := GetValorDatMemoria('Patrimonio.Configs',v_tstrCipherOpened); | |
| 981 | + log_DEBUG('Configurações obtidas: '+v_configs); | |
| 982 | + | |
| 983 | + MontaInterface; | |
| 984 | + MontaCombos; | |
| 985 | + RecuperaValoresAnteriores; | |
| 986 | + | |
| 987 | + End; | |
| 988 | + Except | |
| 989 | + SetValorDatMemoria('Col_Patr.nada','nada', v_tstrCipherOpened1); | |
| 990 | + SetValorDatMemoria('Col_Patr.Fim', '99999999', v_tstrCipherOpened1); | |
| 991 | + CipherClose(g_oCacic.getCacicPath + 'temp\col_patr.dat', v_tstrCipherOpened1); | |
| 992 | + g_oCacic.Free(); | |
| 993 | + Application.Terminate; | |
| 994 | + End; | |
| 985 | 995 | End; |
| 986 | - Except | |
| 987 | - SetValorDatMemoria('Col_Patr.nada','nada', v_tstrCipherOpened1); | |
| 988 | - SetValorDatMemoria('Col_Patr.Fim', '99999999', v_tstrCipherOpened1); | |
| 989 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_patr.dat', v_tstrCipherOpened1); | |
| 990 | - g_oCacic.Free(); | |
| 991 | - Application.Terminate; | |
| 992 | - End; | |
| 993 | - End; | |
| 994 | -end; | |
| 995 | - | |
| 996 | + End; | |
| 997 | + end; | |
| 998 | +End; | |
| 996 | 999 | |
| 997 | 1000 | |
| 998 | 1001 | end. | ... | ... |
col_soft/col_soft.dpr
| ... | ... | @@ -78,7 +78,6 @@ begin |
| 78 | 78 | Append(HistoricoLog); |
| 79 | 79 | Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now)+ '[Coletor SOFT] '+strMsg); {Grava a string Texto no arquivo texto} |
| 80 | 80 | CloseFile(HistoricoLog); {Fecha o arquivo texto} |
| 81 | - | |
| 82 | 81 | except |
| 83 | 82 | log_diario('Erro na gravação do log!'); |
| 84 | 83 | end; |
| ... | ... | @@ -623,43 +622,53 @@ begin |
| 623 | 622 | End; |
| 624 | 623 | end; |
| 625 | 624 | |
| 626 | -var v_path_cacic : String; | |
| 625 | +var strAux : String; | |
| 627 | 626 | begin |
| 628 | 627 | g_oCacic := TCACIC.Create(); |
| 629 | 628 | |
| 629 | + g_oCacic.setBoolCipher(true); | |
| 630 | + | |
| 630 | 631 | if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then |
| 631 | 632 | if (ParamCount>0) then |
| 632 | - Begin | |
| 633 | - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini | |
| 634 | - tstrTripa1 := g_oCacic.explode(ExtractFilePath(ParamStr(0)),'\'); | |
| 635 | - v_path_cacic := ''; | |
| 636 | - For intAux := 0 to tstrTripa1.Count -2 do | |
| 637 | - v_path_cacic := v_path_cacic + tstrTripa1[intAux] + '\'; | |
| 638 | - | |
| 639 | - v_tstrCipherOpened := TStrings.Create; | |
| 640 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getDatFileName); | |
| 641 | - | |
| 642 | - v_tstrCipherOpened1 := TStrings.Create; | |
| 643 | - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_soft.dat'); | |
| 644 | - | |
| 645 | - Try | |
| 646 | - v_Debugs := false; | |
| 633 | + Begin | |
| 634 | + strAux := ''; | |
| 635 | + For intAux := 1 to ParamCount do | |
| 636 | + Begin | |
| 637 | + if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then | |
| 638 | + begin | |
| 639 | + strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); | |
| 640 | + end; | |
| 641 | + end; | |
| 647 | 642 | |
| 648 | - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 643 | + if (strAux <> '') then | |
| 649 | 644 | Begin |
| 650 | - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 651 | - Begin | |
| 652 | - v_Debugs := true; | |
| 653 | - log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 654 | - End; | |
| 645 | + g_oCacic.setCacicPath(strAux); | |
| 646 | + | |
| 647 | + v_tstrCipherOpened := TStrings.Create; | |
| 648 | + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 649 | + | |
| 650 | + v_tstrCipherOpened1 := TStrings.Create; | |
| 651 | + v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_soft.dat'); | |
| 652 | + | |
| 653 | + Try | |
| 654 | + v_Debugs := false; | |
| 655 | + | |
| 656 | + if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 657 | + Begin | |
| 658 | + if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 659 | + Begin | |
| 660 | + v_Debugs := true; | |
| 661 | + log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 662 | + End; | |
| 663 | + End; | |
| 664 | + | |
| 665 | + Executa_Col_Soft; | |
| 666 | + Except | |
| 667 | + SetValorDatMemoria('Col_Soft.nada', 'nada', v_tstrCipherOpened1); | |
| 668 | + CipherClose(g_oCacic.getCacicPath + 'temp\col_soft.dat', v_tstrCipherOpened1); | |
| 669 | + End; | |
| 655 | 670 | End; |
| 656 | - | |
| 657 | - Executa_Col_Soft; | |
| 658 | - Except | |
| 659 | - SetValorDatMemoria('Col_Soft.nada', 'nada', v_tstrCipherOpened1); | |
| 660 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_soft.dat', v_tstrCipherOpened1); | |
| 661 | - End; | |
| 662 | - End; | |
| 671 | + End; | |
| 663 | 672 | |
| 664 | 673 | g_oCacic.Free(); |
| 665 | 674 | ... | ... |
col_undi/col_undi.dpr
| ... | ... | @@ -385,45 +385,52 @@ Begin |
| 385 | 385 | End; |
| 386 | 386 | end; |
| 387 | 387 | |
| 388 | -var v_path_cacic : String; | |
| 388 | +var strAux : String; | |
| 389 | 389 | begin |
| 390 | 390 | g_oCacic := TCACIC.Create(); |
| 391 | 391 | |
| 392 | + g_oCacic.setBoolCipher(true); | |
| 393 | + | |
| 392 | 394 | if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then |
| 393 | 395 | if (ParamCount>0) then |
| 394 | - Begin | |
| 395 | - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini | |
| 396 | - tstrTripa1 := g_oCacic.explode(ExtractFilePath(ParamStr(0)),'\'); | |
| 397 | - v_path_cacic := ''; | |
| 398 | - For intAux := 0 to tstrTripa1.Count -2 do | |
| 399 | - begin | |
| 400 | - v_path_cacic := v_path_cacic + tstrTripa1[intAux] + '\'; | |
| 401 | - end; | |
| 402 | - | |
| 403 | - v_tstrCipherOpened := TStrings.Create; | |
| 404 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getDatFileName); | |
| 405 | - | |
| 406 | - v_tstrCipherOpened1 := TStrings.Create; | |
| 407 | - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_undi.dat'); | |
| 408 | - | |
| 409 | - Try | |
| 410 | - v_Debugs := false; | |
| 411 | - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 412 | - Begin | |
| 413 | - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 414 | - Begin | |
| 415 | - v_Debugs := true; | |
| 416 | - log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 417 | - End; | |
| 418 | - End; | |
| 419 | - | |
| 420 | - Executa_Col_undi; | |
| 421 | - Except | |
| 422 | - SetValorDatMemoria('Col_Undi.nada', 'nada', v_tstrCipherOpened1); | |
| 423 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_undi.dat', v_tstrCipherOpened1); | |
| 424 | - End; | |
| 425 | - End; | |
| 426 | - | |
| 396 | + Begin | |
| 397 | + strAux := ''; | |
| 398 | + For intAux := 1 to ParamCount do | |
| 399 | + Begin | |
| 400 | + if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then | |
| 401 | + begin | |
| 402 | + strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); | |
| 403 | + end; | |
| 404 | + end; | |
| 405 | + | |
| 406 | + if (strAux <> '') then | |
| 407 | + Begin | |
| 408 | + g_oCacic.setCacicPath(strAux); | |
| 409 | + | |
| 410 | + v_tstrCipherOpened := TStrings.Create; | |
| 411 | + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 412 | + | |
| 413 | + v_tstrCipherOpened1 := TStrings.Create; | |
| 414 | + v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_undi.dat'); | |
| 415 | + | |
| 416 | + Try | |
| 417 | + v_Debugs := false; | |
| 418 | + if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 419 | + Begin | |
| 420 | + if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 421 | + Begin | |
| 422 | + v_Debugs := true; | |
| 423 | + log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 424 | + End; | |
| 425 | + End; | |
| 426 | + | |
| 427 | + Executa_Col_undi; | |
| 428 | + Except | |
| 429 | + SetValorDatMemoria('Col_Undi.nada', 'nada', v_tstrCipherOpened1); | |
| 430 | + CipherClose(g_oCacic.getCacicPath + 'temp\col_undi.dat', v_tstrCipherOpened1); | |
| 431 | + End; | |
| 432 | + End; | |
| 433 | + End; | |
| 427 | 434 | g_oCacic.Free(); |
| 428 | 435 | |
| 429 | 436 | end. | ... | ... |
ger_cols/ger_cols.dpr
| ... | ... | @@ -78,7 +78,6 @@ var |
| 78 | 78 | |
| 79 | 79 | var |
| 80 | 80 | v_Debugs, |
| 81 | - l_cs_cipher, | |
| 82 | 81 | l_cs_compress, |
| 83 | 82 | v_CS_AUTO_UPDATE : boolean; |
| 84 | 83 | |
| ... | ... | @@ -132,6 +131,7 @@ var intLimite, |
| 132 | 131 | strPalavra, |
| 133 | 132 | strCaracter : String; |
| 134 | 133 | begin |
| 134 | + log_diario('Regerando palavra-chave...'); | |
| 135 | 135 | Randomize; |
| 136 | 136 | strPalavra := ''; |
| 137 | 137 | intLimite := RandomRange(10,30); // Gerarei uma palavra com tamanho mínimo 10 e máximo 30 |
| ... | ... | @@ -350,13 +350,13 @@ begin |
| 350 | 350 | |
| 351 | 351 | v_strCipherOpenImploded := g_oCacic.implode(p_tstrCipherOpened,g_oCacic.getSeparatorKey); |
| 352 | 352 | |
| 353 | - v_cs_cipher := l_cs_cipher; | |
| 354 | - l_cs_cipher := true; | |
| 355 | - log_DEBUG('Rotina de Fechamento do cacic2.dat ATIVANDO criptografia.'); | |
| 353 | + v_cs_cipher := g_oCacic.getBoolCipher; | |
| 354 | + g_oCacic.setBoolCipher(true); | |
| 355 | + log_DEBUG('Rotina de Fechamento do ' + g_oCacic.getDatFileName + '. ATIVANDO criptografia.'); | |
| 356 | 356 | v_strCipherClosed := g_oCacic.enCrypt(v_strCipherOpenImploded); |
| 357 | 357 | |
| 358 | - l_cs_cipher := v_cs_cipher; | |
| 359 | - log_DEBUG('Rotina de Fechamento do cacic2.dat RESTAURANDO estado da criptografia.'); | |
| 358 | + g_oCacic.setBoolCipher(v_cs_cipher); | |
| 359 | + log_DEBUG('Rotina de Fechamento do ' + g_oCacic.getDatFileName + '. RESTAURANDO estado da criptografia.'); | |
| 360 | 360 | Writeln(v_DatFile,v_strCipherClosed); {Grava a string Texto no arquivo texto} |
| 361 | 361 | if v_Debugs then |
| 362 | 362 | Begin |
| ... | ... | @@ -395,12 +395,12 @@ begin |
| 395 | 395 | Readln(v_DatFile,v_strCipherClosed); |
| 396 | 396 | while not EOF(v_DatFile) do Readln(v_DatFile,v_strCipherClosed); |
| 397 | 397 | CloseFile(v_DatFile); |
| 398 | - v_cs_cipher := l_cs_cipher; | |
| 399 | - l_cs_cipher := true; | |
| 400 | - log_DEBUG('Rotina de Abertura do cacic2.dat ATIVANDO criptografia.'); | |
| 398 | + v_cs_cipher := g_oCacic.getBoolCipher; | |
| 399 | + g_oCacic.setBoolCipher(true); | |
| 400 | + log_DEBUG('Rotina de Abertura do ' + g_oCacic.getDatFileName + '. ATIVANDO criptografia.'); | |
| 401 | 401 | v_strCipherOpened:= g_oCacic.deCrypt(v_strCipherClosed); |
| 402 | - l_cs_cipher := v_cs_cipher; | |
| 403 | - log_DEBUG('Rotina de Abertura do cacic2.dat RESTAURANDO estado da criptografia.'); | |
| 402 | + g_oCacic.setBoolCipher(v_cs_cipher); | |
| 403 | + log_DEBUG('Rotina de Abertura do ' + g_oCacic.getDatFileName + '. RESTAURANDO estado da criptografia.'); | |
| 404 | 404 | end; |
| 405 | 405 | if (trim(v_strCipherOpened)<>'') then |
| 406 | 406 | Result := g_oCacic.explode(v_strCipherOpened,g_oCacic.getSeparatorKey) |
| ... | ... | @@ -418,25 +418,24 @@ begin |
| 418 | 418 | Matar(g_oCacic.getCacicPath + 'temp\','*.txt'); |
| 419 | 419 | end; |
| 420 | 420 | |
| 421 | +procedure Sair; | |
| 422 | +Begin | |
| 423 | + g_oCacic.Free; | |
| 424 | + Halt(0); | |
| 425 | +End; | |
| 426 | + | |
| 421 | 427 | procedure Finalizar(p_pausa:boolean); |
| 422 | 428 | Begin |
| 423 | - CipherClose(g_oCacic.getDatFileName, v_tstrCipherOpened); | |
| 429 | + CipherClose(g_oCacic.getCacicPath + g_oCacic.getDatFileName, v_tstrCipherOpened); | |
| 424 | 430 | Apaga_Temps; |
| 425 | 431 | if p_pausa then sleep(2000); // Pausa de 2 segundos para conclusão de operações de arquivos. |
| 426 | 432 | End; |
| 427 | 433 | |
| 428 | -procedure Sair; | |
| 429 | -Begin | |
| 430 | - log_DEBUG('Liberando Memória - FreeMemory(0)'); | |
| 431 | - FreeMemory(0); | |
| 432 | - log_DEBUG('Suspendendo - Halt(0)'); | |
| 433 | - Halt(0); | |
| 434 | -End; | |
| 435 | 434 | |
| 436 | -procedure Seta_l_cs_cipher(p_strRetorno : String); | |
| 435 | +procedure Seta_boolCipher(p_strRetorno : String); | |
| 437 | 436 | var v_Aux : string; |
| 438 | 437 | Begin |
| 439 | - l_cs_cipher := false; | |
| 438 | + g_oCacic.setBoolCipher(false); | |
| 440 | 439 | |
| 441 | 440 | v_Aux := XML_RetornaValor('cs_cipher',p_strRetorno); |
| 442 | 441 | if (p_strRetorno = '') or (v_Aux = '') then v_Aux := '3'; |
| ... | ... | @@ -444,7 +443,7 @@ Begin |
| 444 | 443 | if (v_Aux='1') then |
| 445 | 444 | Begin |
| 446 | 445 | log_DEBUG('ATIVANDO Criptografia!'); |
| 447 | - l_cs_cipher := true; | |
| 446 | + g_oCacic.setBoolCipher(true); | |
| 448 | 447 | End |
| 449 | 448 | else if (v_Aux='2') then |
| 450 | 449 | Begin |
| ... | ... | @@ -1558,7 +1557,7 @@ procedure Patrimnio1Click(Sender: TObject); |
| 1558 | 1557 | begin |
| 1559 | 1558 | SetValorDatMemoria('Patrimonio.dt_ultima_renovacao_patrim','', v_tstrCipherOpened); |
| 1560 | 1559 | if ChecaAgente(g_oCacic.getCacicPath + 'modulos', 'ini_cols.exe') then |
| 1561 | - g_oCacic.createSampleProcess( g_oCacic.getCacicPath + 'modulos\ini_cols.exe /p_ModulosOpcoes=col_patr,wait,user#', CACIC_PROCESS_WAIT ); | |
| 1560 | + g_oCacic.createSampleProcess( g_oCacic.getCacicPath + 'modulos\ini_cols.exe /CacicPath='+g_oCacic.getCacicPath+' /p_ModulosOpcoes=col_patr,wait,user#', CACIC_PROCESS_WAIT ); | |
| 1562 | 1561 | |
| 1563 | 1562 | if (FileExists(g_oCacic.getCacicPath + 'Temp\col_patr.dat')) then |
| 1564 | 1563 | Begin |
| ... | ... | @@ -1627,11 +1626,11 @@ end; |
| 1627 | 1626 | procedure ChecaCipher; |
| 1628 | 1627 | begin |
| 1629 | 1628 | // Os valores possíveis serão 0-DESLIGADO 1-LIGADO 2-ESPERA PARA LIGAR (Será transformado em "1") 3-Ainda se comunicará com o Gerente WEB |
| 1630 | - l_cs_cipher := false; | |
| 1629 | + g_oCacic.setBoolCipher(false); | |
| 1631 | 1630 | v_Aux := GetValorDatMemoria('Configs.CS_CIPHER', v_tstrCipherOpened); |
| 1632 | 1631 | if (v_Aux='1') or (v_Aux='2') then |
| 1633 | 1632 | Begin |
| 1634 | - l_cs_cipher := true; | |
| 1633 | + g_oCacic.setBoolCipher(true); | |
| 1635 | 1634 | SetValorDatMemoria('Configs.CS_CIPHER','1', v_tstrCipherOpened); |
| 1636 | 1635 | End |
| 1637 | 1636 | else |
| ... | ... | @@ -1654,17 +1653,63 @@ begin |
| 1654 | 1653 | end; |
| 1655 | 1654 | |
| 1656 | 1655 | procedure BuscaConfigs(p_mensagem_log : boolean); |
| 1657 | -var Request_SVG, v_array_campos, v_array_valores, v_Report : TStringList; | |
| 1658 | - intAux1, intAux2, intAux3, intAux4, v_conta_EXCECOES, v_index_ethernet : integer; | |
| 1659 | - strRetorno, strTripa, strAux3, ValorChaveRegistro, ValorRetornado, v_mensagem_log, | |
| 1660 | - v_mascara,te_ip,te_mascara, te_gateway, te_serv_dhcp, te_dns_primario, te_dns_secundario, te_wins_primario, te_wins_secundario, te_nome_host, te_dominio_dns, te_dominio_windows, | |
| 1661 | - v_mac_address,v_metodo_obtencao,v_nome_arquivo,IpConfigLINHA, v_enderecos_mac_invalidos, v_win_dir, v_dir_command, v_dir_ipcfg, v_win_dir_command, v_win_dir_ipcfg, v_te_serv_cacic : string; | |
| 1662 | - tstrTripa1, tstrTripa2, tstrTripa3, tstrTripa4, tstrTripa5, tstrEXCECOES : TStrings; | |
| 1663 | - IpConfigTXT, chksis_ini : textfile; | |
| 1664 | - | |
| 1665 | - v_oMachine : TMiTec_Machine; | |
| 1666 | - v_TCPIP : TMiTeC_TCPIP; | |
| 1667 | - v_NETWORK : TMiTeC_Network; | |
| 1656 | +var | |
| 1657 | + Request_SVG, | |
| 1658 | + v_array_campos, | |
| 1659 | + v_array_valores, | |
| 1660 | + v_Report : TStringList; | |
| 1661 | + | |
| 1662 | + intAux1, | |
| 1663 | + intAux2, | |
| 1664 | + intAux3, | |
| 1665 | + intAux4, | |
| 1666 | + v_conta_EXCECOES, | |
| 1667 | + v_index_ethernet : integer; | |
| 1668 | + | |
| 1669 | + strRetorno, | |
| 1670 | + strTripa, | |
| 1671 | + strAux3, | |
| 1672 | + ValorChaveRegistro, | |
| 1673 | + ValorRetornado, | |
| 1674 | + v_mensagem_log, | |
| 1675 | + v_mascara, | |
| 1676 | + te_ip, | |
| 1677 | + te_mascara, | |
| 1678 | + te_gateway, | |
| 1679 | + te_serv_dhcp, | |
| 1680 | + te_dns_primario, | |
| 1681 | + te_dns_secundario, | |
| 1682 | + te_wins_primario, | |
| 1683 | + te_wins_secundario, | |
| 1684 | + te_nome_host, | |
| 1685 | + te_dominio_dns, | |
| 1686 | + te_dominio_windows, | |
| 1687 | + v_mac_address, | |
| 1688 | + v_metodo_obtencao, | |
| 1689 | + v_nome_arquivo, | |
| 1690 | + IpConfigLINHA, | |
| 1691 | + v_enderecos_mac_invalidos, | |
| 1692 | + v_win_dir, | |
| 1693 | + v_dir_command, | |
| 1694 | + v_dir_ipcfg, | |
| 1695 | + v_win_dir_command, | |
| 1696 | + v_win_dir_ipcfg, | |
| 1697 | + v_te_serv_cacic : string; | |
| 1698 | + | |
| 1699 | + tstrTripa1, | |
| 1700 | + tstrTripa2, | |
| 1701 | + tstrTripa3, | |
| 1702 | + tstrTripa4, | |
| 1703 | + tstrTripa5, | |
| 1704 | + tstrEXCECOES : TStrings; | |
| 1705 | + | |
| 1706 | + IpConfigTXT, | |
| 1707 | + chksis_ini, | |
| 1708 | + v_txtCookie : TextFile; | |
| 1709 | + | |
| 1710 | + v_oMachine : TMiTec_Machine; | |
| 1711 | + v_TCPIP : TMiTeC_TCPIP; | |
| 1712 | + v_NETWORK : TMiTeC_Network; | |
| 1668 | 1713 | Begin |
| 1669 | 1714 | Try |
| 1670 | 1715 | ChecaCipher; |
| ... | ... | @@ -1755,12 +1800,12 @@ Begin |
| 1755 | 1800 | SetValorDatMemoria('TcpIp.TE_IP',v_tcpip.Adapter[v_index_ethernet].IPAddress[intAux1], v_tstrCipherOpened); |
| 1756 | 1801 | Try |
| 1757 | 1802 | strRetorno := ComunicaServidor('get_config.php', Request_SVG, 'Testando comunicação com o Módulo Gerente WEB.'); |
| 1758 | - Seta_l_cs_cipher(strRetorno); | |
| 1803 | + Seta_boolCipher(strRetorno); | |
| 1759 | 1804 | Seta_l_cs_compress(strRetorno); |
| 1760 | 1805 | |
| 1761 | 1806 | v_Aux := g_oCacic.deCrypt(XML_RetornaValor('te_serv_cacic', strRetorno)); |
| 1762 | 1807 | if (v_te_serv_cacic <> v_Aux) and (v_Aux <> '') then |
| 1763 | - SetValorDatMemoria('Configs.EnderecoServidor',v_Aux, v_tstrCipherOpened); | |
| 1808 | + SetValorDatMemoria('Configs.EnderecoServidor',Trim(v_Aux), v_tstrCipherOpened); | |
| 1764 | 1809 | |
| 1765 | 1810 | if (strRetorno <> '0') and (g_oCacic.deCrypt(XML_RetornaValor('te_rede_ok', strRetorno))<>'N') Then |
| 1766 | 1811 | Begin |
| ... | ... | @@ -1783,12 +1828,12 @@ Begin |
| 1783 | 1828 | Request_SVG.Values['in_teste'] := StringReplace(g_oCacic.enCrypt('OK'),'+','<MAIS>',[rfReplaceAll]); |
| 1784 | 1829 | Try |
| 1785 | 1830 | strRetorno := ComunicaServidor('get_config.php', Request_SVG, 'Teste de comunicação com o Módulo Gerente WEB.'); |
| 1786 | - Seta_l_cs_cipher(strRetorno); | |
| 1831 | + Seta_boolCipher(strRetorno); | |
| 1787 | 1832 | Seta_l_cs_compress(strRetorno); |
| 1788 | 1833 | |
| 1789 | 1834 | v_Aux := g_oCacic.deCrypt(XML_RetornaValor('te_serv_cacic', strRetorno)); |
| 1790 | 1835 | if (v_te_serv_cacic <> v_Aux) and (v_Aux <> '') then |
| 1791 | - SetValorDatMemoria('Configs.EnderecoServidor',v_Aux, v_tstrCipherOpened); | |
| 1836 | + SetValorDatMemoria('Configs.EnderecoServidor',Trim(v_Aux), v_tstrCipherOpened); | |
| 1792 | 1837 | |
| 1793 | 1838 | if (strRetorno <> '0') and (g_oCacic.deCrypt(XML_RetornaValor('te_rede_ok', strRetorno))<>'N') Then |
| 1794 | 1839 | Begin |
| ... | ... | @@ -1860,11 +1905,9 @@ Begin |
| 1860 | 1905 | |
| 1861 | 1906 | log_DEBUG(v_acao_gercols + ' Parâmetros: in_chkcacic="'+Request_SVG.Values['in_chkcacic']+'", te_fila_ftp="'+Request_SVG.Values['te_fila_ftp']+'" e id_ip_estacao="'+Request_SVG.Values['id_ip_estacao']+'"'); |
| 1862 | 1907 | strRetorno := ComunicaServidor('get_config.php', Request_SVG, v_mensagem_log); |
| 1863 | - Seta_l_cs_cipher(strRetorno); | |
| 1908 | + Seta_boolCipher(strRetorno); | |
| 1864 | 1909 | Seta_l_cs_compress(strRetorno); |
| 1865 | 1910 | |
| 1866 | - | |
| 1867 | - | |
| 1868 | 1911 | Request_SVG.Free; |
| 1869 | 1912 | if (strRetorno <> '0') Then |
| 1870 | 1913 | Begin |
| ... | ... | @@ -1972,7 +2015,7 @@ Begin |
| 1972 | 2015 | log_DEBUG('Executando "'+g_oCacic.getCacicPath + 'modulos\' + v_scripter + ' //b ' + g_oCacic.getCacicPath + 'temp\ipconfig.vbs"'); |
| 1973 | 2016 | |
| 1974 | 2017 | if ChecaAgente(g_oCacic.getCacicPath + 'modulos', v_scripter) then |
| 1975 | - WinExec(PChar(g_oCacic.getCacicPath + 'modulos\' + v_scripter + ' //b ' + g_oCacic.getCacicPath + 'temp\ipconfig.vbs'), SW_HIDE); | |
| 2018 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'modulos\' + v_scripter + ' //b ' + g_oCacic.getCacicPath + 'temp\ipconfig.vbs', false); | |
| 1976 | 2019 | Except |
| 1977 | 2020 | Begin |
| 1978 | 2021 | log_diario('Erro na geração do ipconfig.txt pelo ' + v_metodo_obtencao+'.'); |
| ... | ... | @@ -2014,7 +2057,7 @@ Begin |
| 2014 | 2057 | v_dir_ipcfg := '\'; |
| 2015 | 2058 | End; |
| 2016 | 2059 | |
| 2017 | - WinExec(PChar(v_win_dir + v_dir_command + '\cmd.exe /c ' + v_win_dir + v_dir_ipcfg + '\ipconfig.exe /all > ' + v_nome_arquivo), SW_MINIMIZE); | |
| 2060 | + g_oCacic.createSampleProcess(v_win_dir + v_dir_command + '\cmd.exe /c ' + v_win_dir + v_dir_ipcfg + '\ipconfig.exe /all > ' + v_nome_arquivo, false); | |
| 2018 | 2061 | End |
| 2019 | 2062 | else |
| 2020 | 2063 | Begin |
| ... | ... | @@ -2036,7 +2079,7 @@ Begin |
| 2036 | 2079 | v_win_dir_ipcfg := LeftStr(v_win_dir_command,2); |
| 2037 | 2080 | v_dir_ipcfg := '\'; |
| 2038 | 2081 | End; |
| 2039 | - WinExec(PChar(v_win_dir + v_dir_command + '\command.com /c ' + v_win_dir + v_dir_ipcfg + '\winipcfg.exe /all /batch ' + v_nome_arquivo), SW_MINIMIZE); | |
| 2082 | + g_oCacic.createSampleProcess(v_win_dir + v_dir_command + '\command.com /c ' + v_win_dir + v_dir_ipcfg + '\winipcfg.exe /all /batch ' + v_nome_arquivo, false); | |
| 2040 | 2083 | End; |
| 2041 | 2084 | Except log_diario('Erro na geração do ipconfig.txt pelo ' + v_metodo_obtencao+'.'); |
| 2042 | 2085 | End; |
| ... | ... | @@ -2253,8 +2296,13 @@ Begin |
| 2253 | 2296 | v_Aux := StringReplace(v_Aux ,'\' ,'<BarrInv>' ,[rfReplaceAll]); |
| 2254 | 2297 | v_Aux := StringReplace(g_oCacic.enCrypt(v_Aux) ,'+' ,'<MAIS>' ,[rfReplaceAll]); |
| 2255 | 2298 | |
| 2256 | - log_DEBUG('Invocando "'+g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -update [' + v_Aux + ']' ); | |
| 2257 | - WinExec(PChar(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -update [' + v_Aux + ']'),SW_NORMAL); | |
| 2299 | + log_DEBUG('Criando cookie para srCACICsrv com nova palavra-chave.'); | |
| 2300 | + | |
| 2301 | + AssignFile(v_txtCookie,g_oCacic.getCacicPath + 'temp\cacic_ck.txt'); | |
| 2302 | + Rewrite(v_txtCookie); | |
| 2303 | + Append(v_txtCookie); | |
| 2304 | + Writeln(v_txtCookie,v_Aux); | |
| 2305 | + CloseFile(v_txtCookie); | |
| 2258 | 2306 | End; |
| 2259 | 2307 | |
| 2260 | 2308 | |
| ... | ... | @@ -2264,12 +2312,12 @@ Begin |
| 2264 | 2312 | strRetorno := ComunicaServidor('get_config.php', Request_SVG, v_mensagem_log); |
| 2265 | 2313 | |
| 2266 | 2314 | // A versão com criptografia do Módulo Gerente WEB retornará o valor cs_cipher=1(Quando receber "1") ou cs_cipher=2(Quando receber "3") |
| 2267 | - Seta_l_cs_cipher(strRetorno); | |
| 2315 | + Seta_boolCipher(strRetorno); | |
| 2268 | 2316 | |
| 2269 | 2317 | // A versão com compressão do Módulo Gerente WEB retornará o valor cs_compress=1(Quando receber "1") ou cs_compress=2(Quando receber "3") |
| 2270 | 2318 | Seta_l_cs_compress(strRetorno); |
| 2271 | 2319 | |
| 2272 | - v_te_serv_cacic := g_oCacic.deCrypt(XML_RetornaValor('te_serv_cacic',strRetorno)); | |
| 2320 | + v_te_serv_cacic := trim(g_oCacic.deCrypt(XML_RetornaValor('te_serv_cacic',strRetorno))); | |
| 2273 | 2321 | |
| 2274 | 2322 | if (strRetorno <> '0') and |
| 2275 | 2323 | (v_te_serv_cacic<>'') and |
| ... | ... | @@ -2278,7 +2326,7 @@ Begin |
| 2278 | 2326 | v_mensagem_log := 'Novo endereço para Gerente WEB: '+v_te_serv_cacic; |
| 2279 | 2327 | SetValorDatMemoria('Configs.EnderecoServidor',v_te_serv_cacic, v_tstrCipherOpened); |
| 2280 | 2328 | log_DEBUG('Setando Criptografia para 3. (Primeiro contato)'); |
| 2281 | - Seta_l_cs_cipher(''); | |
| 2329 | + Seta_boolCipher(''); | |
| 2282 | 2330 | log_DEBUG('Refazendo comunicação'); |
| 2283 | 2331 | |
| 2284 | 2332 | // Passei a enviar sempre a versão do CACIC... |
| ... | ... | @@ -2287,7 +2335,7 @@ Begin |
| 2287 | 2335 | Request_SVG := TStringList.Create; |
| 2288 | 2336 | Request_SVG.Values['te_tripa_perfis'] := StringReplace(g_oCacic.enCrypt(''),'+','<MAIS>',[rfReplaceAll]); |
| 2289 | 2337 | strRetorno := ComunicaServidor('get_config.php', Request_SVG, v_mensagem_log); |
| 2290 | - Seta_l_cs_cipher(strRetorno); | |
| 2338 | + Seta_boolCipher(strRetorno); | |
| 2291 | 2339 | Seta_l_cs_compress(strRetorno); |
| 2292 | 2340 | End; |
| 2293 | 2341 | |
| ... | ... | @@ -2337,7 +2385,7 @@ Begin |
| 2337 | 2385 | v_acao_gercols := 'Armazenando valores obtidos no DAT Memória.'; |
| 2338 | 2386 | |
| 2339 | 2387 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2340 | - //Gravação no CACIC2.DAT dos valores de REDE, COMPUTADOR e EXECUÇÃO obtidos, para consulta pelos outros módulos... | |
| 2388 | + //Gravação no DatFileName dos valores de REDE, COMPUTADOR e EXECUÇÃO obtidos, para consulta pelos outros módulos... | |
| 2341 | 2389 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2342 | 2390 | SetValorDatMemoria('Configs.CS_AUTO_UPDATE' ,UpperCase(g_oCacic.deCrypt(XML_RetornaValor('cs_auto_update' , strRetorno))), v_tstrCipherOpened); |
| 2343 | 2391 | SetValorDatMemoria('Configs.CS_COLETA_HARDWARE' ,UpperCase(g_oCacic.deCrypt(XML_RetornaValor('cs_coleta_hardware' , strRetorno))), v_tstrCipherOpened); |
| ... | ... | @@ -2489,7 +2537,7 @@ Begin |
| 2489 | 2537 | Finalizar(false); |
| 2490 | 2538 | |
| 2491 | 2539 | if ChecaAgente(g_oCacic.getCacicPath, 'cacic2.exe') then |
| 2492 | - WinExec(PChar(g_oCacic.getCacicPath + 'cacic2.exe /atualizacao'), SW_MINIMIZE); | |
| 2540 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe /atualizacao', false); | |
| 2493 | 2541 | Sair; |
| 2494 | 2542 | end; |
| 2495 | 2543 | |
| ... | ... | @@ -2542,7 +2590,7 @@ Begin |
| 2542 | 2590 | BuscaConfigs(false); |
| 2543 | 2591 | Batchfile := TStringList.Create; |
| 2544 | 2592 | Batchfile.Add('*** Simulação de cookie para cacic2.exe recarregar os valores de configurações ***'); |
| 2545 | - // A existência deste arquivo forçará o Cacic2.exe a recarregar valores das configurações obtidas e gravadas no Cacic2.DAT | |
| 2593 | + // A existência deste arquivo forçará o Cacic2.exe a recarregar valores das configurações obtidas e gravadas no DatFileName | |
| 2546 | 2594 | Batchfile.SaveToFile(g_oCacic.getCacicPath + 'Temp\reset.txt'); |
| 2547 | 2595 | BatchFile.Free; |
| 2548 | 2596 | log_DEBUG('Configurações apanhadas no módulo Gerente WEB. Retornando ao Agente Principal...'); |
| ... | ... | @@ -2799,7 +2847,7 @@ Begin |
| 2799 | 2847 | Finalizar(false); |
| 2800 | 2848 | Matar(g_oCacic.getCacicPath + 'temp\','*.dat'); |
| 2801 | 2849 | CriaTXT(g_oCacic.getCacicPath+'temp','coletas'); |
| 2802 | - g_oCacic.createSampleProcess( g_oCacic.getCacicPath + 'modulos\ini_cols.exe /p_ModulosOpcoes=' + v_ModulosOpcoes, CACIC_PROCESS_WAIT ); | |
| 2850 | + g_oCacic.createSampleProcess( g_oCacic.getCacicPath + 'modulos\ini_cols.exe /CacicPath='+g_oCacic.getCacicPath+' /p_ModulosOpcoes=' + v_ModulosOpcoes, CACIC_PROCESS_WAIT ); | |
| 2803 | 2851 | End; |
| 2804 | 2852 | |
| 2805 | 2853 | end |
| ... | ... | @@ -3209,77 +3257,86 @@ Begin |
| 3209 | 3257 | SetValorDatMemoria('Erro_Fatal_Descricao', v_acao_gercols, v_tstrCipherOpened); |
| 3210 | 3258 | End; |
| 3211 | 3259 | End; |
| 3212 | - | |
| 3260 | + g_oCacic.Free; | |
| 3213 | 3261 | End; |
| 3214 | 3262 | |
| 3215 | -var v_path_cacic : String; | |
| 3216 | 3263 | begin |
| 3217 | 3264 | g_oCacic := TCACIC.Create(); |
| 3218 | 3265 | |
| 3219 | - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then begin | |
| 3220 | - Try | |
| 3221 | - // Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.DAT | |
| 3222 | - tstrTripa1 := g_oCacic.explode(ExtractFilePath(ParamStr(0)),'\'); | |
| 3223 | - v_path_cacic := ''; | |
| 3224 | - For intAux := 0 to tstrTripa1.Count -2 do | |
| 3225 | - v_path_cacic := v_path_cacic + tstrTripa1[intAux] + '\'; | |
| 3226 | - | |
| 3227 | - g_oCacic.setCacicPath(v_path_cacic); | |
| 3228 | - v_Debugs := false; | |
| 3229 | - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 3230 | - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 3231 | - Begin | |
| 3232 | - v_Debugs := true; | |
| 3233 | - log_DEBUG('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 3234 | - End; | |
| 3235 | - | |
| 3236 | - g_oCacic.setCacicPath(g_oCacic.getCacicPath); | |
| 3237 | - | |
| 3238 | - | |
| 3239 | - | |
| 3240 | - // De acordo com a versão do OS, determina-se o ShellCommand para chamadas externas. | |
| 3241 | - p_Shell_Command := 'cmd.exe /c '; //NT/2K/XP | |
| 3242 | - if(g_oCacic.isWindows9xME()) then | |
| 3243 | - p_Shell_Command := 'command.com /c '; | |
| 3244 | - | |
| 3245 | - if not DirectoryExists(g_oCacic.getCacicPath + 'Temp') then | |
| 3246 | - ForceDirectories(g_oCacic.getCacicPath + 'Temp'); | |
| 3247 | - | |
| 3248 | - v_tstrCipherOpened := TStrings.Create; | |
| 3249 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getDatFileName); | |
| 3250 | - | |
| 3251 | - // Não tirar desta posição | |
| 3252 | - SetValorDatMemoria('Configs.TE_SO',g_oCacic.getWindowsStrId(), v_tstrCipherOpened); | |
| 3253 | - | |
| 3254 | - log_DEBUG('Te_So obtido: "' + g_oCacic.getWindowsStrId() +'"'); | |
| 3255 | - | |
| 3256 | - v_scripter := 'wscript.exe'; | |
| 3257 | - // A existência e bloqueio do arquivo abaixo evitará que Cacic2.exe chame o Ger_Cols quando este estiver em funcionamento | |
| 3258 | - AssignFile(v_Aguarde,g_oCacic.getCacicPath + 'temp\aguarde_GER.txt'); {Associa o arquivo a uma variável do tipo TextFile} | |
| 3259 | - {$IOChecks off} | |
| 3260 | - Reset(v_Aguarde); {Abre o arquivo texto} | |
| 3261 | - {$IOChecks on} | |
| 3262 | - if (IOResult <> 0) then // Arquivo não existe, será recriado. | |
| 3263 | - Rewrite (v_Aguarde); | |
| 3266 | + if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then | |
| 3267 | + begin | |
| 3268 | + if ParamCount > 0 then | |
| 3269 | + Begin | |
| 3270 | + strAux := ''; | |
| 3271 | + v_Debugs := true; | |
| 3264 | 3272 | |
| 3265 | - Append(v_Aguarde); | |
| 3266 | - Writeln(v_Aguarde,'Apenas um pseudo-cookie para o Cacic2 esperar o término de Ger_Cols'); | |
| 3267 | - Append(v_Aguarde); | |
| 3273 | + For intAux := 1 to ParamCount do | |
| 3274 | + Begin | |
| 3275 | + if (LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=') then | |
| 3276 | + begin | |
| 3277 | + v_acao_gercols := 'Configurando CacicPath.'; | |
| 3278 | + strAux := Copy(ParamStr(intAux),12,StrLen(PChar(ParamStr(intAux)))); | |
| 3279 | + end; | |
| 3280 | + end; | |
| 3268 | 3281 | |
| 3269 | - ChecaCipher; | |
| 3270 | - ChecaCompress; | |
| 3282 | + if (strAux <> '') then | |
| 3283 | + Begin | |
| 3284 | + g_oCacic.setCacicPath(strAux); | |
| 3285 | + log_DEBUG('Parâmetro /CacicPath recebido com valor="'+strAux+'"'); | |
| 3286 | + Try | |
| 3287 | + v_Debugs := false; | |
| 3288 | + if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 3289 | + if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 3290 | + Begin | |
| 3291 | + v_Debugs := true; | |
| 3292 | + log_DEBUG('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 3293 | + End; | |
| 3271 | 3294 | |
| 3272 | - Executa_Ger_Cols; | |
| 3273 | - Finalizar(true); | |
| 3274 | - Except | |
| 3275 | - Begin | |
| 3276 | - log_diario('PROBLEMAS EM EXECUTA_GER_COLS! Ação: ' + v_acao_gercols+'.'); | |
| 3277 | - CriaTXT(g_oCacic.getCacicPath,'ger_erro'); | |
| 3278 | - Finalizar(false); | |
| 3279 | - SetValorDatMemoria('Erro_Fatal_Descricao', v_acao_gercols, v_tstrCipherOpened); | |
| 3280 | - End; | |
| 3281 | - End; | |
| 3295 | + g_oCacic.setCacicPath(g_oCacic.getCacicPath); | |
| 3296 | + | |
| 3297 | + // De acordo com a versão do OS, determina-se o ShellCommand para chamadas externas. | |
| 3298 | + p_Shell_Command := 'cmd.exe /c '; //NT/2K/XP | |
| 3299 | + if(g_oCacic.isWindows9xME()) then | |
| 3300 | + p_Shell_Command := 'command.com /c '; | |
| 3301 | + | |
| 3302 | + if not DirectoryExists(g_oCacic.getCacicPath + 'Temp') then | |
| 3303 | + ForceDirectories(g_oCacic.getCacicPath + 'Temp'); | |
| 3304 | + | |
| 3305 | + v_tstrCipherOpened := TStrings.Create; | |
| 3306 | + v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 3307 | + | |
| 3308 | + // Não tirar desta posição | |
| 3309 | + SetValorDatMemoria('Configs.TE_SO',g_oCacic.getWindowsStrId(), v_tstrCipherOpened); | |
| 3310 | + | |
| 3311 | + log_DEBUG('Te_So obtido: "' + g_oCacic.getWindowsStrId() +'"'); | |
| 3312 | + | |
| 3313 | + v_scripter := 'wscript.exe'; | |
| 3314 | + // A existência e bloqueio do arquivo abaixo evitará que Cacic2.exe chame o Ger_Cols quando este estiver em funcionamento | |
| 3315 | + AssignFile(v_Aguarde,g_oCacic.getCacicPath + 'temp\aguarde_GER.txt'); {Associa o arquivo a uma variável do tipo TextFile} | |
| 3316 | + {$IOChecks off} | |
| 3317 | + Reset(v_Aguarde); {Abre o arquivo texto} | |
| 3318 | + {$IOChecks on} | |
| 3319 | + if (IOResult <> 0) then // Arquivo não existe, será recriado. | |
| 3320 | + Rewrite (v_Aguarde); | |
| 3321 | + | |
| 3322 | + Append(v_Aguarde); | |
| 3323 | + Writeln(v_Aguarde,'Apenas um pseudo-cookie para o Cacic2 esperar o término de Ger_Cols'); | |
| 3324 | + Append(v_Aguarde); | |
| 3325 | + | |
| 3326 | + ChecaCipher; | |
| 3327 | + ChecaCompress; | |
| 3328 | + | |
| 3329 | + Executa_Ger_Cols; | |
| 3330 | + Finalizar(true); | |
| 3331 | + Except | |
| 3332 | + Begin | |
| 3333 | + log_diario('PROBLEMAS EM EXECUTA_GER_COLS! Ação: ' + v_acao_gercols+'.'); | |
| 3334 | + CriaTXT(g_oCacic.getCacicPath,'ger_erro'); | |
| 3335 | + Finalizar(false); | |
| 3336 | + SetValorDatMemoria('Erro_Fatal_Descricao', v_acao_gercols, v_tstrCipherOpened); | |
| 3337 | + End; | |
| 3338 | + End; | |
| 3339 | + End; | |
| 3340 | + End; | |
| 3282 | 3341 | End; |
| 3283 | - | |
| 3284 | - g_oCacic.Free(); | |
| 3285 | 3342 | end. | ... | ... |
ini_cols/ini_cols.dpr
| ... | ... | @@ -27,20 +27,24 @@ uses |
| 27 | 27 | PJVersionInfo, |
| 28 | 28 | CACIC_Library in '..\CACIC_Library.pas'; |
| 29 | 29 | |
| 30 | -var v_te_senha_login_serv_updates, | |
| 31 | - v_versao : string; | |
| 32 | - v_array_path_cacic : TStrings; | |
| 33 | - intAux, | |
| 34 | - v_ContaTempo, | |
| 35 | - v_Tolerancia : integer; | |
| 36 | - v_ModulosOpcoes, | |
| 37 | - v_Aux : String; | |
| 38 | - v_Debugs : Boolean; | |
| 39 | - v_Aguarde : TextFile; | |
| 40 | - | |
| 41 | -var v_tstrCipherOpened, | |
| 42 | - v_tstrModulosOpcoes, | |
| 43 | - v_tstrModuloOpcao : TStrings; | |
| 30 | +var | |
| 31 | + v_te_senha_login_serv_updates, | |
| 32 | + v_versao, | |
| 33 | + v_ModulosOpcoes : String; | |
| 34 | + | |
| 35 | +var | |
| 36 | + v_tstrCipherOpened, | |
| 37 | + v_tstrModulosOpcoes, | |
| 38 | + v_tstrModuloOpcao : TStrings; | |
| 39 | + | |
| 40 | +var | |
| 41 | + intAux, | |
| 42 | + v_ContaTempo, | |
| 43 | + v_Tolerancia : integer; | |
| 44 | + | |
| 45 | +var | |
| 46 | + v_Debugs : Boolean; | |
| 47 | + v_Aguarde : TextFile; | |
| 44 | 48 | |
| 45 | 49 | var |
| 46 | 50 | g_oCacic : TCACIC; |
| ... | ... | @@ -158,7 +162,6 @@ var v_DatFile : TextFile; |
| 158 | 162 | v_strCipherClosed : string; |
| 159 | 163 | oCacic : TCACIC; |
| 160 | 164 | begin |
| 161 | - oCacic := TCACIC.Create(); | |
| 162 | 165 | v_strCipherOpened := ''; |
| 163 | 166 | if FileExists(p_DatFileName) then |
| 164 | 167 | begin |
| ... | ... | @@ -190,8 +193,6 @@ begin |
| 190 | 193 | log_DEBUG('Vetor MemoryDAT com tamanho IMPAR... Ajustando.'); |
| 191 | 194 | Result.Add(''); |
| 192 | 195 | End; |
| 193 | - | |
| 194 | - oCacic.Free(); | |
| 195 | 196 | end; |
| 196 | 197 | |
| 197 | 198 | Function FTP(p_Host : String; p_Port : String; p_Username : String; p_Password : String; p_PathServer : String; p_File : String; p_Dest : String) : Boolean; |
| ... | ... | @@ -225,100 +226,108 @@ begin |
| 225 | 226 | End; |
| 226 | 227 | end; |
| 227 | 228 | |
| 228 | -var v_path_cacic : String; | |
| 229 | +var strAux : String; | |
| 229 | 230 | begin |
| 230 | 231 | g_oCacic := TCACIC.Create(); |
| 231 | 232 | |
| 233 | + g_oCacic.setBoolCipher(true); | |
| 234 | + | |
| 232 | 235 | if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then |
| 233 | - if (ParamCount>0) then // A passagem da chave EAS é mandatória... | |
| 234 | - Begin | |
| 235 | - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.dat | |
| 236 | - v_array_path_cacic := g_oCacic.explode(ExtractFilePath(ParamStr(0)),'\'); | |
| 237 | - v_path_cacic := ''; | |
| 238 | - For intAux := 0 to v_array_path_cacic.Count -2 do | |
| 239 | - v_path_cacic := v_path_cacic + v_array_path_cacic[intAux] + '\'; | |
| 240 | - | |
| 241 | - g_oCacic.setCacicPath(v_path_cacic); | |
| 242 | - v_Debugs := false; | |
| 243 | - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 244 | - Begin | |
| 245 | - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 246 | - Begin | |
| 247 | - v_Debugs := true; | |
| 248 | - log_DEBUG('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 249 | - End; | |
| 250 | - End; | |
| 251 | - | |
| 252 | - // A existência e bloqueio do arquivo abaixo evitará que Cacic2.exe chame o Ger_Cols quando a coleta ainda estiver sendo efetuada | |
| 253 | - AssignFile(v_Aguarde,g_oCacic.getCacicPath + 'temp\aguarde_INI.txt'); {Associa o arquivo a uma variável do tipo TextFile} | |
| 254 | - {$IOChecks off} | |
| 255 | - Reset(v_Aguarde); {Abre o arquivo texto} | |
| 256 | - {$IOChecks on} | |
| 257 | - if (IOResult <> 0) then // Arquivo não existe, será recriado. | |
| 258 | - Rewrite (v_Aguarde); | |
| 259 | - | |
| 260 | - Append(v_Aguarde); | |
| 261 | - Writeln(v_Aguarde,'Apenas um pseudo-cookie para o Cacic2 esperar o término de Ini_Cols'); | |
| 262 | - Append(v_Aguarde); | |
| 263 | - | |
| 264 | - Matar(g_oCacic.getCacicPath+'temp\','*.dat'); | |
| 265 | - Try | |
| 266 | - // Caso exista o Gerente de Coletas será verificada a versão... | |
| 267 | - // Devido a problemas na rotina de FTP na versão 2.0.1.2, | |
| 268 | - // que impossibilitava atualização de versões de todos os componentes, exceto INI_COLS | |
| 269 | - If (FileExists(g_oCacic.getCacicPath + 'modulos\ger_cols.exe')) Then | |
| 236 | + if ParamCount > 0 then | |
| 237 | + Begin | |
| 238 | + strAux := ''; | |
| 239 | + For intAux := 1 to ParamCount do | |
| 240 | + Begin | |
| 241 | + if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then | |
| 242 | + begin | |
| 243 | + strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); | |
| 244 | + log_DEBUG('Parâmetro /CacicPath recebido com valor="'+strAux+'"'); | |
| 245 | + end; | |
| 246 | + end; | |
| 247 | + | |
| 248 | + if (strAux <> '') then | |
| 249 | + Begin | |
| 250 | + g_oCacic.setCacicPath(strAux); | |
| 251 | + v_Debugs := false; | |
| 252 | + if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 270 | 253 | Begin |
| 271 | - v_versao := trim(GetVersionInfo(g_oCacic.getCacicPath + 'modulos\ger_cols.exe')); | |
| 272 | - if (v_versao = '0.0.0.0') then // Provavelmente arquivo corrompido ou versão muito antiga | |
| 273 | - Begin | |
| 274 | - Matar(g_oCacic.getCacicPath+'modulos\','ger_cols.exe'); | |
| 275 | - Sleep(5000); // Pausa 5 segundos para total exclusão de GER_COLS | |
| 276 | - CipherOpen(g_oCacic.getDatFileName); | |
| 277 | - v_te_senha_login_serv_updates := GetValorDatMemoria('Configs.te_senha_login_serv_updates'); | |
| 278 | - | |
| 279 | - FTP(GetValorDatMemoria('Configs.te_serv_updates'), | |
| 280 | - GetValorDatMemoria('Configs.nu_porta_serv_updates'), | |
| 281 | - GetValorDatMemoria('Configs.nm_usuario_login_serv_updates'), | |
| 282 | - v_te_senha_login_serv_updates, | |
| 283 | - GetValorDatMemoria('Configs.te_path_serv_updates'), | |
| 284 | - 'ger_cols.exe', | |
| 285 | - g_oCacic.getCacicPath + 'modulos'); | |
| 286 | - | |
| 287 | - // Pausa 5 segundos para total gravação de GER_COLS | |
| 288 | - Sleep(5000); | |
| 254 | + if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 255 | + Begin | |
| 256 | + v_Debugs := true; | |
| 257 | + log_DEBUG('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 258 | + End; | |
| 259 | + End; | |
| 289 | 260 | |
| 261 | + // A existência e bloqueio do arquivo abaixo evitará que Cacic2.exe chame o Ger_Cols quando a coleta ainda estiver sendo efetuada | |
| 262 | + AssignFile(v_Aguarde,g_oCacic.getCacicPath + 'temp\aguarde_INI.txt'); {Associa o arquivo a uma variável do tipo TextFile} | |
| 263 | + {$IOChecks off} | |
| 264 | + Reset(v_Aguarde); {Abre o arquivo texto} | |
| 265 | + {$IOChecks on} | |
| 266 | + if (IOResult <> 0) then // Arquivo não existe, será recriado. | |
| 267 | + Rewrite (v_Aguarde); | |
| 268 | + | |
| 269 | + Append(v_Aguarde); | |
| 270 | + Writeln(v_Aguarde,'Apenas um pseudo-cookie para o Cacic2 esperar o término de Ini_Cols'); | |
| 271 | + Append(v_Aguarde); | |
| 272 | + | |
| 273 | + Matar(g_oCacic.getCacicPath+'temp\','*.dat'); | |
| 274 | + Try | |
| 275 | + // Caso exista o Gerente de Coletas será verificada a versão... | |
| 276 | + // Devido a problemas na rotina de FTP na versão 2.0.1.2, | |
| 277 | + // que impossibilitava atualização de versões de todos os componentes, exceto INI_COLS | |
| 278 | + If (FileExists(g_oCacic.getCacicPath + 'modulos\ger_cols.exe')) Then | |
| 279 | + Begin | |
| 280 | + v_versao := trim(GetVersionInfo(g_oCacic.getCacicPath + 'modulos\ger_cols.exe')); | |
| 281 | + if (v_versao = '0.0.0.0') then // Provavelmente arquivo corrompido ou versão muito antiga | |
| 282 | + Begin | |
| 283 | + Matar(g_oCacic.getCacicPath+'modulos\','ger_cols.exe'); | |
| 284 | + Sleep(5000); // Pausa 5 segundos para total exclusão de GER_COLS | |
| 285 | + CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 286 | + v_te_senha_login_serv_updates := GetValorDatMemoria('Configs.te_senha_login_serv_updates'); | |
| 287 | + | |
| 288 | + FTP(GetValorDatMemoria('Configs.te_serv_updates'), | |
| 289 | + GetValorDatMemoria('Configs.nu_porta_serv_updates'), | |
| 290 | + GetValorDatMemoria('Configs.nm_usuario_login_serv_updates'), | |
| 291 | + v_te_senha_login_serv_updates, | |
| 292 | + GetValorDatMemoria('Configs.te_path_serv_updates'), | |
| 293 | + 'ger_cols.exe', | |
| 294 | + g_oCacic.getCacicPath + 'modulos'); | |
| 295 | + | |
| 296 | + // Pausa 5 segundos para total gravação de GER_COLS | |
| 297 | + Sleep(5000); | |
| 298 | + | |
| 299 | + End; | |
| 300 | + End; | |
| 301 | + | |
| 302 | + // Procuro pelo parâmetro p_ModulosOpcoes que deverá ter sido passado pelo Gerente de Coletas | |
| 303 | + // Contendo a formação: coletor1,wait#coletor2,nowait#coletorN,nowait# | |
| 304 | + // Observações: | |
| 305 | + // 1) Os valores "wait/nowait" determinam se o Inicializador de Coletas estará sujeito à tolerância de tempo para as coletas. | |
| 306 | + // 2) No caso de Coletor de Patrimônio, este depende de digitação e deverá trazer a opção "wait"; | |
| 307 | + // 3) Ainda no caso de Coletor de Patrimônio, quando este for invocado através do menu, o Gerente de Coletas enviará a opção "user", ficando o parâmetro p_ModulosOpcoes = "col_patr,wait,user" | |
| 308 | + For intAux := 1 to ParamCount do | |
| 309 | + Begin | |
| 310 | + if LowerCase(Copy(ParamStr(intAux),1,17)) = '/p_modulosopcoes=' then | |
| 311 | + v_ModulosOpcoes := Trim(Copy(ParamStr(intAux),18,Length((ParamStr(intAux))))); | |
| 290 | 312 | End; |
| 291 | - End; | |
| 292 | 313 | |
| 293 | - // Procuro pelo parâmetro p_ModulosOpcoes que deverá ter sido passado pelo Gerente de Coletas | |
| 294 | - // Contendo a formação: coletor1,wait#coletor2,nowait#coletorN,nowait# | |
| 295 | - // Observações: | |
| 296 | - // 1) Os valores "wait/nowait" determinam se o Inicializador de Coletas estará sujeito à tolerância de tempo para as coletas. | |
| 297 | - // 2) No caso de Coletor de Patrimônio, este depende de digitação e deverá trazer a opção "wait"; | |
| 298 | - // 3) Ainda no caso de Coletor de Patrimônio, quando este for invocado através do menu, o Gerente de Coletas enviará a opção "user", ficando o parâmetro p_ModulosOpcoes = "col_patr,wait,user" | |
| 299 | - For intAux := 1 to ParamCount do | |
| 300 | - Begin | |
| 301 | - if LowerCase(Copy(ParamStr(intAux),1,17)) = '/p_modulosopcoes=' then | |
| 302 | - v_ModulosOpcoes := Trim(Copy(ParamStr(intAux),18,Length((ParamStr(intAux))))); | |
| 303 | - End; | |
| 304 | - | |
| 305 | - log_DEBUG('Parâmetro p_ModulosOpcoes recebido: '+v_ModulosOpcoes); | |
| 306 | - v_tstrModulosOpcoes := g_oCacic.explode(v_ModulosOpcoes,'#'); | |
| 307 | - | |
| 308 | - // Tempo de tolerância para as coletas | |
| 309 | - v_Tolerancia := 5; // (minutos) | |
| 310 | - | |
| 311 | - For intAux := 0 to v_tstrModulosOpcoes.Count -1 do | |
| 312 | - Begin | |
| 313 | - v_tstrModuloOpcao := g_oCacic.explode(v_tstrModulosOpcoes[intAux],','); | |
| 314 | - v_Aux := v_tstrModuloOpcao[0]+'.exe /p_Option='+v_tstrModuloOpcao[2]; | |
| 315 | - log_DEBUG('Chamando "' + v_tstrModuloOpcao[0]+'.exe " /p_Option='+v_tstrModuloOpcao[2]); | |
| 316 | - | |
| 317 | - g_oCacic.createSampleProcess( g_oCacic.getCacicPath + '\modulos\' + v_aux, CACIC_PROCESS_WAIT ); | |
| 318 | - | |
| 319 | - End; | |
| 320 | - except | |
| 321 | - end; | |
| 314 | + log_DEBUG('Parâmetro p_ModulosOpcoes recebido: '+v_ModulosOpcoes); | |
| 315 | + v_tstrModulosOpcoes := g_oCacic.explode(v_ModulosOpcoes,'#'); | |
| 316 | + | |
| 317 | + // Tempo de tolerância para as coletas | |
| 318 | + v_Tolerancia := 5; // (minutos) | |
| 319 | + | |
| 320 | + For intAux := 0 to v_tstrModulosOpcoes.Count -1 do | |
| 321 | + Begin | |
| 322 | + v_tstrModuloOpcao := g_oCacic.explode(v_tstrModulosOpcoes[intAux],','); | |
| 323 | + strAux := v_tstrModuloOpcao[0]+'.exe /CacicPath='+g_oCacic.getCacicPath+' /p_Option='+v_tstrModuloOpcao[2]; | |
| 324 | + log_DEBUG('Chamando "' + v_tstrModuloOpcao[0]+'.exe " /p_Option='+v_tstrModuloOpcao[2]); | |
| 325 | + | |
| 326 | + g_oCacic.createSampleProcess( g_oCacic.getCacicPath + '\modulos\' + strAux, CACIC_PROCESS_WAIT ); | |
| 327 | + End; | |
| 328 | + except | |
| 329 | + end; | |
| 330 | + End; | |
| 322 | 331 | End; |
| 323 | 332 | g_oCacic.Free(); |
| 324 | 333 | end. | ... | ... |
main.pas
| ... | ... | @@ -19,45 +19,53 @@ unit main; |
| 19 | 19 | |
| 20 | 20 | interface |
| 21 | 21 | |
| 22 | -uses Windows, | |
| 23 | - Messages, | |
| 24 | - Forms, | |
| 25 | - Menus, | |
| 26 | - Classes, | |
| 27 | - SysUtils, | |
| 28 | - Controls, | |
| 29 | - StdCtrls, | |
| 30 | - ExtCtrls, | |
| 31 | - ShellAPI, | |
| 32 | - registry, | |
| 33 | - dialogs, | |
| 34 | - PJVersionInfo, | |
| 35 | - ComCtrls, | |
| 36 | - IdBaseComponent, | |
| 37 | - IdComponent, | |
| 38 | - Buttons, | |
| 39 | - CACIC_Library, | |
| 40 | - ImgList, | |
| 41 | - Graphics; | |
| 42 | - //IdTCPServer; | |
| 43 | - //IdFTPServer; | |
| 44 | - | |
| 45 | -const WM_MYMESSAGE = WM_USER+100; | |
| 22 | +uses | |
| 23 | + Windows, | |
| 24 | + Messages, | |
| 25 | + Forms, | |
| 26 | + Menus, | |
| 27 | + Classes, | |
| 28 | + SysUtils, | |
| 29 | + Controls, | |
| 30 | + StdCtrls, | |
| 31 | + ExtCtrls, | |
| 32 | + ShellAPI, | |
| 33 | + registry, | |
| 34 | + dialogs, | |
| 35 | + PJVersionInfo, | |
| 36 | + ComCtrls, | |
| 37 | + IdBaseComponent, | |
| 38 | + IdComponent, | |
| 39 | + Buttons, | |
| 40 | + CACIC_Library, | |
| 41 | + ImgList, | |
| 42 | + Graphics; | |
| 43 | + //IdTCPServer; | |
| 44 | + //IdFTPServer; | |
| 45 | + | |
| 46 | +const | |
| 47 | + WM_MYMESSAGE = WM_USER+100; | |
| 46 | 48 | |
| 47 | 49 | // Declaração das variáveis globais. |
| 48 | -var p_Shell_Command, | |
| 49 | - p_Shell_Path, | |
| 50 | - v_versao, | |
| 51 | - v_DataCacic2DAT, | |
| 52 | - v_Tamanho_Arquivo, | |
| 53 | - strConfigsPatrimonio : string; | |
| 54 | - BatchFile : TStringList; | |
| 55 | - v_tstrCipherOpened : TStrings; | |
| 56 | - boolCrypt, | |
| 57 | - boolDebugs : Boolean; | |
| 50 | +var | |
| 51 | + p_Shell_Command, | |
| 52 | + p_Shell_Path, | |
| 53 | + v_versao, | |
| 54 | + v_DataCacic2DAT, | |
| 55 | + v_Tamanho_Arquivo, | |
| 56 | + strConfigsPatrimonio : string; | |
| 57 | + | |
| 58 | +var | |
| 59 | + BatchFile : TStringList; | |
| 60 | + | |
| 61 | +var | |
| 62 | + v_tstrCipherOpened : TStrings; | |
| 63 | + | |
| 64 | +var | |
| 65 | + boolDebugs : Boolean; | |
| 58 | 66 | |
| 59 | 67 | var |
| 60 | - g_oCacic: TCACIC; | |
| 68 | + g_oCacic: TCACIC; | |
| 61 | 69 | |
| 62 | 70 | type |
| 63 | 71 | TFormularioGeral = class(TForm) |
| ... | ... | @@ -218,7 +226,6 @@ type |
| 218 | 226 | procedure WMMENUSELECT(var msg: TWMMENUSELECT); message WM_MENUSELECT; |
| 219 | 227 | public |
| 220 | 228 | Function Implode(p_Array : TStrings ; p_Separador : String) : String; |
| 221 | - function HomeDrive : string; | |
| 222 | 229 | function GetFolderDate(Folder: string): TDateTime; |
| 223 | 230 | Function CipherClose : String; |
| 224 | 231 | Function CipherOpen : TStrings; |
| ... | ... | @@ -516,14 +523,6 @@ Begin |
| 516 | 523 | |
| 517 | 524 | End; |
| 518 | 525 | |
| 519 | - | |
| 520 | -function TFormularioGeral.HomeDrive : string; | |
| 521 | -var | |
| 522 | -WinDir : array [0..144] of char; | |
| 523 | -begin | |
| 524 | -GetWindowsDirectory (WinDir, 144); | |
| 525 | -Result := StrPas (WinDir); | |
| 526 | -end; | |
| 527 | 526 | function TFormularioGeral.GetFolderDate(Folder: string): TDateTime; |
| 528 | 527 | var |
| 529 | 528 | Rec: TSearchRec; |
| ... | ... | @@ -565,33 +564,33 @@ var v_DatFile : TextFile; |
| 565 | 564 | v_strCipherClosed : string; |
| 566 | 565 | begin |
| 567 | 566 | |
| 568 | - log_DEBUG('Fechando '+g_oCacic.getDatFileName); | |
| 567 | + log_DEBUG('Fechando '+g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 569 | 568 | if boolDebugs then |
| 570 | 569 | for intAux := 0 to (v_tstrCipherOpened.Count-1) do |
| 571 | 570 | log_DEBUG('Posição ['+inttostr(intAux)+']='+v_tstrCipherOpened[intAux]); |
| 572 | 571 | |
| 573 | 572 | try |
| 574 | - FileSetAttr (g_oCacic.getDatFileName,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 | |
| 573 | + FileSetAttr (g_oCacic.getCacicPath + g_oCacic.getDatFileName,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 | |
| 575 | 574 | |
| 576 | - log_DEBUG('Localizando arquivo: '+g_oCacic.getDatFileName); | |
| 577 | - AssignFile(v_DatFile,g_oCacic.getDatFileName); {Associa o arquivo a uma variável do tipo TextFile} | |
| 575 | + log_DEBUG('Localizando arquivo: '+g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 576 | + AssignFile(v_DatFile,g_oCacic.getCacicPath + g_oCacic.getDatFileName); {Associa o arquivo a uma variável do tipo TextFile} | |
| 578 | 577 | {$IOChecks off} |
| 579 | - log_DEBUG('Abrindo arquivo: '+g_oCacic.getDatFileName); | |
| 578 | + log_DEBUG('Abrindo arquivo: '+g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 580 | 579 | ReWrite(v_DatFile); {Abre o arquivo texto} |
| 581 | 580 | {$IOChecks on} |
| 582 | - log_DEBUG('Append(2) no arquivo: '+g_oCacic.getDatFileName); | |
| 581 | + log_DEBUG('Append(2) no arquivo: '+g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 583 | 582 | Append(v_DatFile); |
| 584 | 583 | log_DEBUG('Criando vetor para criptografia.'); |
| 585 | 584 | v_strCipherOpenImploded := Implode(v_tstrCipherOpened,g_oCacic.getSeparatorKey); |
| 586 | 585 | |
| 587 | - log_DEBUG('Salvando a string "'+v_strCipherOpenImploded+'" em '+g_oCacic.getDatFileName); | |
| 586 | + log_DEBUG('Salvando a string "'+v_strCipherOpenImploded+'" em '+g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 588 | 587 | v_strCipherClosed := g_oCacic.enCrypt(v_strCipherOpenImploded); |
| 589 | 588 | Writeln(v_DatFile,v_strCipherClosed); {Grava a string Texto no arquivo texto} |
| 590 | 589 | CloseFile(v_DatFile); |
| 591 | 590 | except |
| 592 | - log_diario('ERRO NA GRAVAÇÃO DO ARQUIVO DE CONFIGURAÇÕES.('+g_oCacic.getDatFileName+')'); | |
| 591 | + log_diario('ERRO NA GRAVAÇÃO DO ARQUIVO DE CONFIGURAÇÕES.('+ g_oCacic.getCacicPath + g_oCacic.getDatFileName+')'); | |
| 593 | 592 | end; |
| 594 | - log_DEBUG(g_oCacic.getDatFileName+' fechado com sucesso!'); | |
| 593 | + log_DEBUG(g_oCacic.getCacicPath + g_oCacic.getDatFileName+' fechado com sucesso!'); | |
| 595 | 594 | end; |
| 596 | 595 | |
| 597 | 596 | function TFormularioGeral.Get_File_Size(sFileToExamine: string; bInKBytes: Boolean): string; |
| ... | ... | @@ -619,22 +618,22 @@ var v_DatFile : TextFile; |
| 619 | 618 | v_strCipherClosed : string; |
| 620 | 619 | begin |
| 621 | 620 | |
| 622 | - if (v_DataCacic2DAT = '') or (v_DataCacic2DAT <> FormatDateTime('ddmmyyyyhhnnsszzz', GetFolderDate(g_oCacic.getCacicPath + 'cacic2.dat'))) then | |
| 621 | + if (v_DataCacic2DAT = '') or (v_DataCacic2DAT <> FormatDateTime('ddmmyyyyhhnnsszzz', GetFolderDate(g_oCacic.getCacicPath + g_oCacic.getDatFileName))) then | |
| 623 | 622 | Begin |
| 624 | - v_DataCacic2DAT := FormatDateTime('ddmmyyyyhhnnsszzz', GetFolderDate(g_oCacic.getCacicPath + 'cacic2.dat')); | |
| 625 | - log_DEBUG('Abrindo '+g_oCacic.getDatFileName +' - DateTime Cacic2.dat=> '+v_DataCacic2DAT); | |
| 623 | + v_DataCacic2DAT := FormatDateTime('ddmmyyyyhhnnsszzz', GetFolderDate(g_oCacic.getCacicPath + g_oCacic.getDatFileName)); | |
| 624 | + log_DEBUG('Abrindo '+g_oCacic.getCacicPath + g_oCacic.getDatFileName +' - DateTime '+g_oCacic.getCacicPath + g_oCacic.getDatFileName+' => '+v_DataCacic2DAT); | |
| 626 | 625 | v_strCipherOpened := ''; |
| 627 | 626 | |
| 628 | - v_Tamanho_Arquivo := Get_File_Size(g_oCacic.getDatFileName,true); | |
| 627 | + v_Tamanho_Arquivo := Get_File_Size(g_oCacic.getCacicPath + g_oCacic.getDatFileName,true); | |
| 629 | 628 | |
| 630 | 629 | if (v_Tamanho_Arquivo = '0') or |
| 631 | - (v_Tamanho_Arquivo = '-1') then FormularioGeral.Matar(g_oCacic.getCacicPath,'cacic2.dat'); | |
| 630 | + (v_Tamanho_Arquivo = '-1') then FormularioGeral.Matar(g_oCacic.getCacicPath,g_oCacic.getDatFileName); | |
| 632 | 631 | |
| 633 | - if FileExists(g_oCacic.getDatFileName) then | |
| 632 | + if FileExists(g_oCacic.getCacicPath + g_oCacic.getDatFileName) then | |
| 634 | 633 | begin |
| 635 | - log_DEBUG(g_oCacic.getDatFileName+' já existe!'); | |
| 636 | - AssignFile(v_DatFile,g_oCacic.getDatFileName); | |
| 637 | - log_DEBUG('Abrindo '+g_oCacic.getDatFileName); | |
| 634 | + log_DEBUG(g_oCacic.getCacicPath + g_oCacic.getDatFileName+' já existe!'); | |
| 635 | + AssignFile(v_DatFile,g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 636 | + log_DEBUG('Abrindo '+g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 638 | 637 | |
| 639 | 638 | {$IOChecks off} |
| 640 | 639 | Reset(v_DatFile); |
| ... | ... | @@ -643,19 +642,19 @@ begin |
| 643 | 642 | log_DEBUG('Verificação de Existência.'); |
| 644 | 643 | if (IOResult <> 0)then // Arquivo não existe, será recriado. |
| 645 | 644 | begin |
| 646 | - log_DEBUG('Recriando "'+g_oCacic.getDatFileName+'"'); | |
| 645 | + log_DEBUG('Recriando "'+g_oCacic.getCacicPath + g_oCacic.getDatFileName+'"'); | |
| 647 | 646 | Rewrite (v_DatFile); |
| 648 | 647 | log_DEBUG('Inserindo Primeira Linha.'); |
| 649 | 648 | Append(v_DatFile); |
| 650 | 649 | end; |
| 651 | 650 | |
| 652 | - log_DEBUG('Lendo '+g_oCacic.getDatFileName); | |
| 651 | + log_DEBUG('Lendo '+g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 653 | 652 | |
| 654 | 653 | Readln(v_DatFile,v_strCipherClosed); |
| 655 | 654 | |
| 656 | 655 | log_DEBUG('Povoando Variável'); |
| 657 | 656 | while not EOF(v_DatFile) do Readln(v_DatFile,v_strCipherClosed); |
| 658 | - log_DEBUG('Fechando '+g_oCacic.getDatFileName); | |
| 657 | + log_DEBUG('Fechando '+g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 659 | 658 | CloseFile(v_DatFile); |
| 660 | 659 | log_DEBUG('Chamando Criptografia de conteúdo'); |
| 661 | 660 | v_strCipherOpened:= g_oCacic.deCrypt(v_strCipherClosed); |
| ... | ... | @@ -666,7 +665,7 @@ begin |
| 666 | 665 | Begin |
| 667 | 666 | v_tstrCipherOpened := explode('Configs.ID_SO'+g_oCacic.getSeparatorKey+ g_oCacic.getWindowsStrId() +g_oCacic.getSeparatorKey+ |
| 668 | 667 | 'Configs.Endereco_WS'+g_oCacic.getSeparatorKey+'/cacic2/ws/',g_oCacic.getSeparatorKey); |
| 669 | - log_DEBUG(g_oCacic.getDatFileName+' Inexistente. Criado o DAT em memória.'); | |
| 668 | + log_DEBUG(g_oCacic.getCacicPath + g_oCacic.getDatFileName+' Inexistente. Criado o DAT em memória.'); | |
| 670 | 669 | End; |
| 671 | 670 | |
| 672 | 671 | Result := v_tstrCipherOpened; |
| ... | ... | @@ -675,7 +674,7 @@ begin |
| 675 | 674 | Result.Add(''); |
| 676 | 675 | |
| 677 | 676 | End |
| 678 | - else log_DEBUG('Cacic2.dat ainda não alterado! Não foi necessário reabrí-lo.'); | |
| 677 | + else log_DEBUG(g_oCacic.getCacicPath + g_oCacic.getDatFileName + ' ainda não alterado! Não foi necessário reabrí-lo.'); | |
| 679 | 678 | end; |
| 680 | 679 | |
| 681 | 680 | Procedure TFormularioGeral.SetValorDatMemoria(p_Chave : string; p_Valor : String; p_tstrCipherOpened : TStrings); |
| ... | ... | @@ -818,8 +817,8 @@ Begin |
| 818 | 817 | InicializaTray; |
| 819 | 818 | |
| 820 | 819 | log_diario('Acionando recuperador de Módulo Gerente de Coletas.'); |
| 821 | - log_DEBUG('Recuperador de Módulo Gerente de Coletas: '+HomeDrive + '\chksis.exe'); | |
| 822 | - WinExec(PChar(HomeDrive + '\chksis.exe'),SW_HIDE); | |
| 820 | + log_DEBUG('Recuperador de Módulo Gerente de Coletas: '+g_oCacic.getWinDir + 'chksis.exe'); | |
| 821 | + g_oCacic.createSampleProcess(g_oCacic.getWinDir + 'chksis.exe',false); | |
| 823 | 822 | |
| 824 | 823 | sleep(30000); // 30 segundos de espera para download do ger_cols.exe |
| 825 | 824 | v_Tamanho_Arquivo := Get_File_Size(g_oCacic.getCacicPath + 'modulos\ger_cols.exe',true); |
| ... | ... | @@ -871,7 +870,7 @@ Begin |
| 871 | 870 | // Verifico se o endereço do servidor do cacic foi configurado. |
| 872 | 871 | if (GetValorDatMemoria('Configs.EnderecoServidor',v_tstrCipherOpened)='') then |
| 873 | 872 | Begin |
| 874 | - strAux := getValorChaveRegIni('Cacic2','ip_serv_cacic',HomeDrive + '\chksis.ini'); | |
| 873 | + strAux := getValorChaveRegIni('Cacic2','ip_serv_cacic',g_oCacic.getWinDir + 'chksis.ini'); | |
| 875 | 874 | |
| 876 | 875 | if (strAux='') then |
| 877 | 876 | begin |
| ... | ... | @@ -1048,8 +1047,6 @@ End; |
| 1048 | 1047 | procedure TFormularioGeral.FormCreate(Sender: TObject); |
| 1049 | 1048 | var strAux, |
| 1050 | 1049 | v_ip_serv_cacic, |
| 1051 | - v_cacic_dir, | |
| 1052 | - v_windir, | |
| 1053 | 1050 | strFraseVersao : string; |
| 1054 | 1051 | intAux : integer; |
| 1055 | 1052 | v_Aguarde : TextFile; |
| ... | ... | @@ -1058,33 +1055,15 @@ begin |
| 1058 | 1055 | // Não mostrar o formulário... |
| 1059 | 1056 | Application.ShowMainForm:=false; |
| 1060 | 1057 | g_oCacic := TCACIC.Create; |
| 1058 | + | |
| 1059 | + g_oCacic.setBoolCipher(true); | |
| 1060 | + | |
| 1061 | 1061 | //g_oCacic.showTrayIcon(false); |
| 1062 | - boolCrypt := true; | |
| 1062 | + | |
| 1063 | 1063 | |
| 1064 | 1064 | Try |
| 1065 | - // De acordo com a versão do OS, determino o ShellCommand para chamadas externas. | |
| 1066 | - if (g_oCacic.isWindowsNTPlataform()) then //Se NT/2K/XP... then | |
| 1067 | - Begin | |
| 1068 | - p_Shell_Path := HomeDrive + '\system32\'; //NT/2K/XP | |
| 1069 | - p_Shell_Command := 'cmd.exe'; //NT/2K/XP | |
| 1070 | - strAux := HomeDrive + '\'; //Ex.: c:\windows\ | |
| 1071 | - End | |
| 1072 | - else | |
| 1073 | - Begin | |
| 1074 | - v_windir := GetEnvironmentVariable('windir'); | |
| 1075 | - if (trim(v_windir) <> '') then v_windir := v_windir + '\'; | |
| 1076 | - p_Shell_Path := v_windir; | |
| 1077 | - p_Shell_Command := 'command.com'; | |
| 1078 | - strAux := GetEnvironmentVariable('windir') + '\'; //Ex.: c:\windows\ | |
| 1079 | - End; | |
| 1080 | - v_SystemDrive := explode(strAux,'\'); | |
| 1081 | - v_cacic_dir := v_SystemDrive[0] + '\' + getValorChaveRegIni('Cacic2','cacic_dir',strAux + 'chksis.ini') + '\'; | |
| 1082 | 1065 | |
| 1083 | - // Caminho do aplicativo | |
| 1084 | - if (v_cacic_dir <> '') then | |
| 1085 | - g_oCacic.setCacicPath(v_cacic_dir) | |
| 1086 | - else | |
| 1087 | - g_oCacic.setCacicPath(ExtractFilePath(Application.Exename)) ; | |
| 1066 | + g_oCacic.setCacicPath(getValorChaveRegIni('Cacic2','cacic_dir',g_oCacic.getWinDir + 'chksis.ini')) ; | |
| 1088 | 1067 | |
| 1089 | 1068 | if not DirectoryExists(g_oCacic.getCacicPath + 'Temp') then |
| 1090 | 1069 | begin |
| ... | ... | @@ -1281,7 +1260,7 @@ begin |
| 1281 | 1260 | begin |
| 1282 | 1261 | DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(g_oCacic.getCacicPath + 'cacic2.log'))); |
| 1283 | 1262 | DateTimeToString(strDataAtual , 'yyyymmdd', Date); |
| 1284 | - if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual... | |
| 1263 | + if (strDataAtual <> strDataArqLocal) then // Se o arquivo LOG não é da data atual... | |
| 1285 | 1264 | begin |
| 1286 | 1265 | Rewrite (HistoricoLog); //Cria/Recria o arquivo |
| 1287 | 1266 | Append(HistoricoLog); |
| ... | ... | @@ -1291,8 +1270,8 @@ begin |
| 1291 | 1270 | Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now)+ '[Agente Principal] '+strMsg); {Grava a string Texto no arquivo texto} |
| 1292 | 1271 | CloseFile(HistoricoLog); {Fecha o arquivo texto} |
| 1293 | 1272 | end |
| 1294 | - else CloseFile(HistoricoLog);; | |
| 1295 | - | |
| 1273 | + else | |
| 1274 | + CloseFile(HistoricoLog); | |
| 1296 | 1275 | except |
| 1297 | 1276 | log_diario('PROBLEMAS NA CRIAÇÃO DO ARQUIVO LOG'); |
| 1298 | 1277 | end; |
| ... | ... | @@ -1307,7 +1286,7 @@ Begin |
| 1307 | 1286 | Except |
| 1308 | 1287 | log_diario('PROBLEMAS NA FINALIZAÇÃO'); |
| 1309 | 1288 | End; |
| 1310 | - g_oCacic.Free(); | |
| 1289 | + g_oCacic.Free; | |
| 1311 | 1290 | FreeMemory(0); |
| 1312 | 1291 | Application.Terminate; |
| 1313 | 1292 | End; |
| ... | ... | @@ -1332,7 +1311,7 @@ begin |
| 1332 | 1311 | CipherClose; |
| 1333 | 1312 | log_diario('Invocando Gerente de Coletas com ação: "'+p_acao+'"'); |
| 1334 | 1313 | Timer_Nu_Exec_Apos.Enabled := False; |
| 1335 | - WinExec(PChar(g_oCacic.getCacicPath + 'modulos\GER_COLS.EXE /'+p_acao+' /p_CipherKey='+g_oCacic.getCipherKey),SW_HIDE); | |
| 1314 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'modulos\GER_COLS.EXE /'+p_acao+' /CacicPath='+g_oCacic.getCacicPath,false); | |
| 1336 | 1315 | End |
| 1337 | 1316 | else |
| 1338 | 1317 | log_diario('Não foi possível invocar o Gerente de Coletas!'); |
| ... | ... | @@ -2185,15 +2164,13 @@ begin |
| 2185 | 2164 | if boolServerON then // Ordeno ao SrCACICsrv que auto-finalize |
| 2186 | 2165 | Begin |
| 2187 | 2166 | Log_Diario('Desativando Suporte Remoto Seguro.'); |
| 2188 | - WinExec(PChar(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -kill'),SW_HIDE); | |
| 2167 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -kill',false); | |
| 2189 | 2168 | boolServerON := false; |
| 2190 | 2169 | End |
| 2191 | 2170 | else |
| 2192 | 2171 | Begin |
| 2193 | 2172 | log_DEBUG('Invocando "'+g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe"...'); |
| 2194 | 2173 | Log_Diario('Ativando Suporte Remoto Seguro.'); |
| 2195 | - boolAux := boolCrypt; | |
| 2196 | - boolCrypt := true; | |
| 2197 | 2174 | |
| 2198 | 2175 | // Alguns cuidados necessários ao tráfego e recepção de valores pelo Gerente WEB |
| 2199 | 2176 | // Some cares about send and receive at Gerente WEB |
| ... | ... | @@ -2236,15 +2213,13 @@ begin |
| 2236 | 2213 | CloseFile(fileAguarde); |
| 2237 | 2214 | Finally |
| 2238 | 2215 | End; |
| 2216 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -start [' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened)) + ']' + | |
| 2217 | + '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' + | |
| 2218 | + '[' + strTeSO + ']' + | |
| 2219 | + '[' + strTeNodeAddress + ']' + | |
| 2220 | + '[' + strPalavraChave + ']' + | |
| 2221 | + '[' + g_oCacic.getCacicPath + 'Temp\' + ']',false); | |
| 2239 | 2222 | |
| 2240 | - WinExec(PChar(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -start [' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened)) + ']' + | |
| 2241 | - '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' + | |
| 2242 | - '[' + strTeSO + ']' + | |
| 2243 | - '[' + strTeNodeAddress + ']' + | |
| 2244 | - '[' + strPalavraChave + ']' + | |
| 2245 | - '[' + g_oCacic.getCacicPath + 'Temp\aguarde_srCACIC.txt' + ']'),SW_NORMAL); | |
| 2246 | - | |
| 2247 | - boolCrypt := boolAux; | |
| 2248 | 2223 | BoolServerON := true; |
| 2249 | 2224 | End; |
| 2250 | 2225 | ... | ... |
mapa/main_mapa.pas
| ... | ... | @@ -1467,6 +1467,8 @@ var intAux : integer; |
| 1467 | 1467 | Request_mapa : TStringList; |
| 1468 | 1468 | begin |
| 1469 | 1469 | g_oCacic := TCACIC.Create(); |
| 1470 | + | |
| 1471 | + g_oCacic.setBoolCipher(true); | |
| 1470 | 1472 | frmMapaCacic.lbVersao.Caption := 'Versão: ' + frmMapaCacic.GetVersionInfo(ParamStr(0)); |
| 1471 | 1473 | log_DEBUG('Versão do MapaCacic: '+frmMapaCacic.lbVersao.Caption); |
| 1472 | 1474 | if (g_oCacic.isWindowsNTPlataform()) and (not g_oCacic.isWindowsAdmin()) then | ... | ... |