Commit 873da8f1b38c7f8aa15a65a6baf42830c41f9db1
1 parent
8fb42f4a
Exists in
master
O ChkCacic passa a interpretar as opcoes "/serv=" e "/dir=" em linha de comando.
git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@102 fecfc0c7-e812-0410-ae72-849f08638ee7
Showing
8 changed files
with
357 additions
and
217 deletions
Show diff stats
chkcacic/FormConfig.dcu
No preview for this file type
chkcacic/FormConfig.dfm
1 | 1 | object Configs: TConfigs |
2 | - Left = 258 | |
3 | - Top = 175 | |
2 | + Left = 260 | |
3 | + Top = 102 | |
4 | 4 | BorderIcons = [] |
5 | 5 | BorderStyle = bsSingle |
6 | 6 | Caption = 'Configura'#231#245'es do CHKCACIC' |
7 | - ClientHeight = 331 | |
8 | - ClientWidth = 453 | |
7 | + ClientHeight = 382 | |
8 | + ClientWidth = 490 | |
9 | 9 | Color = clBtnFace |
10 | 10 | Font.Charset = DEFAULT_CHARSET |
11 | 11 | Font.Color = clWindowText |
... | ... | @@ -16,24 +16,11 @@ object Configs: TConfigs |
16 | 16 | Position = poScreenCenter |
17 | 17 | PixelsPerInch = 96 |
18 | 18 | TextHeight = 13 |
19 | - object Label2: TLabel | |
20 | - Left = 402 | |
21 | - Top = 312 | |
22 | - Width = 27 | |
23 | - Height = 12 | |
24 | - Caption = 'Label1' | |
25 | - Font.Charset = DEFAULT_CHARSET | |
26 | - Font.Color = clWindowText | |
27 | - Font.Height = -9 | |
28 | - Font.Name = 'Arial' | |
29 | - Font.Style = [] | |
30 | - ParentFont = False | |
31 | - end | |
32 | - object GroupBox2: TGroupBox | |
19 | + object gbOpcional: TGroupBox | |
33 | 20 | Left = 5 |
34 | 21 | Top = 83 |
35 | - Width = 444 | |
36 | - Height = 202 | |
22 | + Width = 480 | |
23 | + Height = 219 | |
37 | 24 | Caption = 'Opcional' |
38 | 25 | Font.Charset = DEFAULT_CHARSET |
39 | 26 | Font.Color = clWindowText |
... | ... | @@ -43,8 +30,8 @@ object Configs: TConfigs |
43 | 30 | ParentFont = False |
44 | 31 | TabOrder = 3 |
45 | 32 | object Label1: TLabel |
46 | - Left = 63 | |
47 | - Top = -1 | |
33 | + Left = 265 | |
34 | + Top = 25 | |
48 | 35 | Width = 200 |
49 | 36 | Height = 13 |
50 | 37 | Caption = '(N'#227'o aplic'#225'vel ao ChkCacic do NetLogon)' |
... | ... | @@ -71,8 +58,8 @@ object Configs: TConfigs |
71 | 58 | object Memo_te_instala_informacoes_extras: TMemo |
72 | 59 | Left = 9 |
73 | 60 | Top = 65 |
74 | - Width = 426 | |
75 | - Height = 127 | |
61 | + Width = 462 | |
62 | + Height = 144 | |
76 | 63 | Color = clInactiveBorder |
77 | 64 | Enabled = False |
78 | 65 | Font.Charset = DEFAULT_CHARSET |
... | ... | @@ -96,7 +83,7 @@ object Configs: TConfigs |
96 | 83 | object ckboxExibeInformacoes: TCheckBox |
97 | 84 | Left = 9 |
98 | 85 | Top = 23 |
99 | - Width = 424 | |
86 | + Width = 256 | |
100 | 87 | Height = 17 |
101 | 88 | Caption = 'Exibe informa'#231#245'es sobre o processo de instala'#231#227'o' |
102 | 89 | Font.Charset = DEFAULT_CHARSET |
... | ... | @@ -109,10 +96,10 @@ object Configs: TConfigs |
109 | 96 | OnClick = ckboxExibeInformacoesClick |
110 | 97 | end |
111 | 98 | end |
112 | - object GroupBox1: TGroupBox | |
99 | + object gbObrigatorio: TGroupBox | |
113 | 100 | Left = 5 |
114 | 101 | Top = 8 |
115 | - Width = 444 | |
102 | + Width = 480 | |
116 | 103 | Height = 64 |
117 | 104 | Caption = 'Obrigat'#243'rio' |
118 | 105 | Font.Charset = DEFAULT_CHARSET |
... | ... | @@ -136,7 +123,7 @@ object Configs: TConfigs |
136 | 123 | ParentFont = False |
137 | 124 | end |
138 | 125 | object Label_cacic_dir: TLabel |
139 | - Left = 236 | |
126 | + Left = 271 | |
140 | 127 | Top = 19 |
141 | 128 | Width = 103 |
142 | 129 | Height = 13 |
... | ... | @@ -158,7 +145,7 @@ object Configs: TConfigs |
158 | 145 | TabOrder = 0 |
159 | 146 | end |
160 | 147 | object Edit_cacic_dir: TEdit |
161 | - Left = 241 | |
148 | + Left = 276 | |
162 | 149 | Top = 42 |
163 | 150 | Width = 200 |
164 | 151 | Height = 21 |
... | ... | @@ -167,10 +154,10 @@ object Configs: TConfigs |
167 | 154 | Text = 'Cacic' |
168 | 155 | end |
169 | 156 | object Button_Gravar: TButton |
170 | - Left = 62 | |
171 | - Top = 292 | |
157 | + Left = 74 | |
158 | + Top = 325 | |
172 | 159 | Width = 150 |
173 | - Height = 30 | |
160 | + Height = 35 | |
174 | 161 | Caption = 'Gravar Configura'#231#245'es' |
175 | 162 | Font.Charset = DEFAULT_CHARSET |
176 | 163 | Font.Color = clWindowText |
... | ... | @@ -182,10 +169,10 @@ object Configs: TConfigs |
182 | 169 | OnClick = Button_GravarClick |
183 | 170 | end |
184 | 171 | object btSair: TButton |
185 | - Left = 242 | |
186 | - Top = 292 | |
172 | + Left = 265 | |
173 | + Top = 325 | |
187 | 174 | Width = 150 |
188 | - Height = 30 | |
175 | + Height = 35 | |
189 | 176 | Caption = 'Sair' |
190 | 177 | Font.Charset = DEFAULT_CHARSET |
191 | 178 | Font.Color = clWindowText |
... | ... | @@ -196,8 +183,31 @@ object Configs: TConfigs |
196 | 183 | TabOrder = 5 |
197 | 184 | OnClick = btSairClick |
198 | 185 | end |
186 | + object pnVersao: TPanel | |
187 | + Left = 426 | |
188 | + Top = 302 | |
189 | + Width = 58 | |
190 | + Height = 14 | |
191 | + BevelOuter = bvLowered | |
192 | + TabOrder = 6 | |
193 | + object lbVersao: TLabel | |
194 | + Left = 4 | |
195 | + Top = 1 | |
196 | + Width = 53 | |
197 | + Height = 12 | |
198 | + Alignment = taCenter | |
199 | + AutoSize = False | |
200 | + Caption = 'V:2.00.00.00' | |
201 | + Font.Charset = DEFAULT_CHARSET | |
202 | + Font.Color = clWindowText | |
203 | + Font.Height = -9 | |
204 | + Font.Name = 'Arial' | |
205 | + Font.Style = [] | |
206 | + ParentFont = False | |
207 | + end | |
208 | + end | |
199 | 209 | object PJVersionInfo1: TPJVersionInfo |
200 | 210 | Left = 5 |
201 | - Top = 293 | |
211 | + Top = 323 | |
202 | 212 | end |
203 | 213 | end | ... | ... |
chkcacic/FormConfig.pas
... | ... | @@ -21,24 +21,25 @@ interface |
21 | 21 | |
22 | 22 | uses |
23 | 23 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
24 | - Dialogs, StdCtrls,main, PJVersionInfo, NTFileSecurity; | |
24 | + Dialogs, StdCtrls,main, PJVersionInfo, NTFileSecurity, Buttons, ExtCtrls; | |
25 | 25 | |
26 | 26 | type |
27 | 27 | TConfigs = class(TForm) |
28 | 28 | Edit_ip_serv_cacic: TEdit; |
29 | 29 | Edit_cacic_dir: TEdit; |
30 | - GroupBox1: TGroupBox; | |
30 | + gbObrigatorio: TGroupBox; | |
31 | 31 | Label_ip_serv_cacic: TLabel; |
32 | 32 | Label_cacic_dir: TLabel; |
33 | - GroupBox2: TGroupBox; | |
33 | + gbOpcional: TGroupBox; | |
34 | 34 | Label1: TLabel; |
35 | 35 | Label_te_instala_informacoes_extras: TLabel; |
36 | 36 | Button_Gravar: TButton; |
37 | 37 | Memo_te_instala_informacoes_extras: TMemo; |
38 | 38 | PJVersionInfo1: TPJVersionInfo; |
39 | - Label2: TLabel; | |
40 | 39 | ckboxExibeInformacoes: TCheckBox; |
41 | 40 | btSair: TButton; |
41 | + pnVersao: TPanel; | |
42 | + lbVersao: TLabel; | |
42 | 43 | procedure Button_GravarClick(Sender: TObject); |
43 | 44 | procedure ckboxExibeInformacoesClick(Sender: TObject); |
44 | 45 | procedure btSairClick(Sender: TObject); | ... | ... |
chkcacic/MAIN.PAS
... | ... | @@ -14,8 +14,38 @@ Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LIC |
14 | 14 | Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
15 | 15 | |
16 | 16 | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17 | +===================================================================================================== | |
18 | +ChkCacic.exe : Verificador/Instalador dos agentes principais Cacic2.exe e Ger_Cols.exe | |
19 | +===================================================================================================== | |
20 | + | |
21 | +v 2.2.0.17 | |
22 | ++ Acrescentado o tratamento da passagem de opções em linha de comando | |
23 | + * chkcacic /serv=<ip_server> /dir=<local_path>c:\%windir%\cacic | |
24 | + Exemplo de uso: chkcacic /serv=UXbra001 /dir=Cacic | |
25 | + | |
26 | +v 2.2.0.16 | |
27 | +* Corrigido o fechamento do arquivo de configurações de ChkSis | |
28 | + | |
29 | +v 2.2.0.15 | |
30 | +* Substituída a mensagem "File System diferente de "NTFS" por 'File System: "<NomeFileSystem>" - Ok!' | |
31 | + | |
32 | +v 2.2.0.14 | |
33 | ++ Críticas/mensagens: | |
34 | + "ATENÇÃO! Não foi possível estabelecer comunicação com o módulo Gerente WEB em <servidor>." e | |
35 | + "ATENÇÃO: Não foi possível efetuar FTP para <agente>. Verifique o Servidor de Updates." | |
36 | ++ Opção checkbox "Exibe informações sobre o processo de instalação" ao formulário de configuração; | |
37 | ++ Botão "Sair" ao formulário de configuração; | |
38 | ++ Execução automática do Agente Principal ao fim da instalação quando a unidade origem do ChkCacic não | |
39 | + for mapeamento de rede ou unidade inválida. | |
40 | + | |
41 | +- Retirados os campos "Frase para Sucesso na Instalação" e "Frase para Insucesso na Instalação" | |
42 | + do formulário de configuração, passando essas frases a serem fixas na aplicação. | |
43 | +- Retirada a opção radiobutton "Remove Versão Anterior?"; | |
44 | + | |
45 | +===================================================================================================== | |
17 | 46 | *) |
18 | 47 | |
48 | + | |
19 | 49 | unit main; |
20 | 50 | |
21 | 51 | interface |
... | ... | @@ -31,7 +61,6 @@ uses Windows, |
31 | 61 | XML, |
32 | 62 | LibXmlParser, |
33 | 63 | IdHTTP, |
34 | - dialogs, | |
35 | 64 | PJVersionInfo, |
36 | 65 | Controls, |
37 | 66 | StdCtrls, |
... | ... | @@ -44,14 +73,16 @@ uses Windows, |
44 | 73 | DCPrijndael, |
45 | 74 | DCPbase64, |
46 | 75 | NTFileSecurity, IdFTP, |
47 | - Tlhelp32; | |
76 | + Tlhelp32, | |
77 | + dialogs; | |
48 | 78 | |
49 | 79 | var v_ip_serv_cacic, |
50 | 80 | v_cacic_dir, |
51 | - v_rem_cacic_v0x, | |
81 | +// v_rem_cacic_v0x, | |
52 | 82 | v_te_instala_frase_sucesso, |
53 | 83 | v_te_instala_frase_insucesso, |
54 | 84 | v_te_instala_informacoes_extras, |
85 | + v_exibe_informacoes, | |
55 | 86 | v_versao_local, |
56 | 87 | v_versao_remota_inteira, |
57 | 88 | v_versao_remota_capada, |
... | ... | @@ -80,22 +111,24 @@ Procedure MostraFormConfigura; |
80 | 111 | Procedure GravaConfiguracoes; |
81 | 112 | Procedure DelValorReg(Chave: String); |
82 | 113 | procedure log_diario(strMsg : String); |
114 | +procedure KillProcess(hWindowHandle: HWND); // 2.2.0.15 | |
115 | +procedure Matar(v_dir,v_files: string); // 2.2.0.16 | |
83 | 116 | Function ListFileDir(Path: string):string; |
84 | 117 | Function FTP(p_Host : String; p_Port : String; p_Username : String; p_Password : String; p_PathServer : String; p_File : String; p_Dest : String) : Boolean; |
85 | 118 | Function Explode(Texto, Separador : String) : TStrings; |
86 | 119 | Function GetRootKey(strRootKey: String): HKEY; |
87 | 120 | Function SetValorChaveRegEdit(Chave: String; Dado: Variant): Variant; |
88 | 121 | Function GetValorChaveRegEdit(Chave: String): Variant; |
89 | -function SetValorChaveRegIni(p_Secao, p_Chave, p_Valor, p_File : String): String; | |
90 | -function GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String; | |
91 | -function HomeDrive : string; | |
122 | +Function SetValorChaveRegIni(p_Secao, p_Chave, p_Valor, p_File : String): String; | |
123 | +Function GetValorChaveRegIni(p_Secao, p_Chave, p_File : String): String; | |
124 | +Function HomeDrive : string; | |
92 | 125 | Function RemoveCaracteresEspeciais(Texto : String) : String; |
93 | -function FindWindowByTitle(WindowTitle: string): Hwnd; | |
94 | -function GetVersionInfo(p_File: string):string; | |
95 | -function VerFmt(const MS, LS: DWORD): string; | |
96 | -function GetWinVer: Integer; | |
97 | -function KillTask(ExeFileName: string): Integer; | |
98 | -procedure KillProcess(hWindowHandle: HWND); | |
126 | +Function FindWindowByTitle(WindowTitle: string): Hwnd; | |
127 | +Function GetVersionInfo(p_File: string):string; | |
128 | +Function VerFmt(const MS, LS: DWORD): string; | |
129 | +Function GetWinVer: Integer; | |
130 | +Function KillTask(ExeFileName: string): Integer; | |
131 | +Function ChecaVersoesAgentes(p_strNomeAgente : String) : integer; // 2.2.0.16 | |
99 | 132 | |
100 | 133 | type |
101 | 134 | TForm1 = class(TForm) |
... | ... | @@ -115,6 +148,7 @@ implementation |
115 | 148 | uses FormConfig; |
116 | 149 | |
117 | 150 | {$R *.dfm} |
151 | + | |
118 | 152 | function IsAdmin: Boolean; |
119 | 153 | var hAccessToken: THandle; |
120 | 154 | ptgGroups: PTokenGroups; |
... | ... | @@ -629,7 +663,7 @@ end; |
629 | 663 | Procedure CriaFormConfigura; |
630 | 664 | begin |
631 | 665 | Application.CreateForm(TConfigs, FormConfig.Configs); |
632 | - FormConfig.Configs.Label2.Caption := 'v: ' + getVersionInfo(ParamStr(0)); | |
666 | + FormConfig.Configs.lbVersao.Caption := 'v: ' + getVersionInfo(ParamStr(0)); | |
633 | 667 | end; |
634 | 668 | |
635 | 669 | Procedure MostraFormConfigura; |
... | ... | @@ -722,28 +756,23 @@ begin |
722 | 756 | Writeln(chkcacic_ini,'# CHAVES E VALORES OBRIGATÓRIOS PARA USO DO CHKCACIC.EXE'); |
723 | 757 | Writeln(chkcacic_ini,'# ==================================================================================='); |
724 | 758 | Writeln(chkcacic_ini,'# ip_serv_cacic'); |
725 | - Writeln(chkcacic_ini,'# Endereço IP do servidor onde o Módulo Gerente do CACIC foi instalado'); | |
726 | - Writeln(chkcacic_ini,'# Ex.: ip_serv_cacic=10.xxx.yyy.zzz'); | |
759 | + Writeln(chkcacic_ini,'# Endereço IP ou Nome(DNS) do servidor onde o Módulo Gerente do CACIC foi instalado'); | |
760 | + Writeln(chkcacic_ini,'# Ex1.: ip_serv_cacic=10.xxx.yyy.zzz'); | |
761 | + Writeln(chkcacic_ini,'# Ex2.: ip_serv_cacic=uxesa001'); | |
727 | 762 | Writeln(chkcacic_ini,'# cacic_dir'); |
728 | 763 | Writeln(chkcacic_ini,'# Pasta a ser criada na estação para instalação do CACIC agente'); |
729 | 764 | Writeln(chkcacic_ini,'# Ex.: cacic_dir=Cacic'); |
730 | - Writeln(chkcacic_ini,'# rem_cacic_v0x'); | |
731 | - Writeln(chkcacic_ini,'# Indicador de desligamento do CACIC versão antiga (anterior à versão 2)'); | |
732 | - Writeln(chkcacic_ini,'# Ex.: rem_cacic_v0x=S'); | |
765 | + Writeln(chkcacic_ini,'# exibe_informacoes'); | |
766 | + Writeln(chkcacic_ini,'# Indicador de exibicao de informações sobre o processo de instalação'); | |
767 | + Writeln(chkcacic_ini,'# Ex.: exibe_informacoes=N'); | |
733 | 768 | Writeln(chkcacic_ini,''); |
734 | 769 | Writeln(chkcacic_ini,''); |
735 | 770 | Writeln(chkcacic_ini,'# CHAVES E VALORES OPCIONAIS PARA USO DO CHKCACIC.EXE'); |
736 | 771 | Writeln(chkcacic_ini,'# (ATENÇÃO: NÃO PREENCHER EM CASO DE CHKCACIC.INI PARA O NETLOGON!)'); |
737 | 772 | Writeln(chkcacic_ini,'# ==================================================================================='); |
738 | - Writeln(chkcacic_ini,'# te_instala_frase_sucesso'); | |
739 | - Writeln(chkcacic_ini,'# Frase a ser mostrada quando instalação/recuperação efetuada com sucesso'); | |
740 | - Writeln(chkcacic_ini,'# Ex.: te_instala_frase_sucesso=Instalação/Recuperação do CACIC efetuada com sucesso! Obrigado!'); | |
741 | - Writeln(chkcacic_ini,'# te_instala_frase_insucesso'); | |
742 | - Writeln(chkcacic_ini,'# Frase a ser mostrada quando instalação/recuperação efetuada sem sucesso'); | |
743 | - Writeln(chkcacic_ini,'# Ex.: te_instala_frase_insucesso=Instalação/Recuperação do CACIC efetuada sem sucesso! Por favor, entre em contato com:'); | |
744 | 773 | Writeln(chkcacic_ini,'# te_instala_informacoes_extras'); |
745 | 774 | Writeln(chkcacic_ini,'# Informações a serem mostradas na janela de Instalação/Recuperação'); |
746 | - Writeln(chkcacic_ini,'# Ex.: Dataprev-UF / Suporte Técnico'); | |
775 | + Writeln(chkcacic_ini,'# Ex.: Empresa-UF / Suporte Técnico'); | |
747 | 776 | Writeln(chkcacic_ini,'# Emails: email_do_suporte@xxxxxx.yyy.zz, outro_email@outro_dominio.xxx.yy'); |
748 | 777 | Writeln(chkcacic_ini,'# Telefones: (xx) yyyy-zzzz / (xx) yyyy-zzzz'); |
749 | 778 | Writeln(chkcacic_ini,'# Endereço: Rua Nome_da_Rua, Nº 99999'); |
... | ... | @@ -797,20 +826,21 @@ begin |
797 | 826 | // Atribuição dos valores do form FormConfig às variáveis... |
798 | 827 | v_ip_serv_cacic := Configs.Edit_ip_serv_cacic.text; |
799 | 828 | v_cacic_dir := Configs.Edit_cacic_dir.text; |
800 | - v_rem_cacic_v0x := 'S'; | |
801 | - v_te_instala_frase_sucesso := Configs.Edit_te_instala_frase_sucesso.text; | |
802 | - v_te_instala_frase_insucesso := Configs.Edit_te_instala_frase_insucesso.text; | |
829 | + if Configs.ckboxExibeInformacoes.Checked then | |
830 | + v_exibe_informacoes := 'S' | |
831 | + else | |
832 | + v_exibe_informacoes := 'N'; | |
833 | + | |
803 | 834 | v_te_instala_informacoes_extras := Configs.Memo_te_instala_informacoes_extras.Text; |
804 | 835 | |
805 | 836 | // Escrita dos parâmetros obrigatórios |
806 | 837 | Writeln(chkcacic_ini,'ip_serv_cacic='+v_ip_serv_cacic); |
807 | 838 | Writeln(chkcacic_ini,'cacic_dir='+v_cacic_dir); |
808 | - Writeln(chkcacic_ini,'rem_cacic_v0x='+v_rem_cacic_v0x); | |
839 | + Writeln(chkcacic_ini,'exibe_informacoes='+v_exibe_informacoes); | |
809 | 840 | |
810 | 841 | // Escrita dos valores opcionais quando existirem |
811 | - if (v_te_instala_frase_sucesso <>'') then Writeln(chkcacic_ini,'te_instala_frase_sucesso='+ v_te_instala_frase_sucesso); | |
812 | - if (v_te_instala_frase_insucesso <>'') then Writeln(chkcacic_ini,'te_instala_frase_insucesso='+ v_te_instala_frase_insucesso); | |
813 | - if (v_te_instala_informacoes_extras <>'') then Writeln(chkcacic_ini,'te_instala_informacoes_extras='+ StringReplace(v_te_instala_informacoes_extras,#13#10,'*13*10',[rfReplaceAll])); | |
842 | + if (v_te_instala_informacoes_extras <>'') then | |
843 | + Writeln(chkcacic_ini,'te_instala_informacoes_extras='+ StringReplace(v_te_instala_informacoes_extras,#13#10,'*13*10',[rfReplaceAll])); | |
814 | 844 | CloseFile(chkcacic_ini); {Fecha o arquivo texto} |
815 | 845 | except |
816 | 846 | end; |
... | ... | @@ -849,11 +879,88 @@ begin |
849 | 879 | |
850 | 880 | end; |
851 | 881 | |
882 | +// Dica obtida em http://www.webmundi.com/delphi/dfuncaof.asp?SubTipo=Sistema | |
883 | +Function DriveType(Unidade: String):String; | |
884 | +Var StrDrive, | |
885 | + StrDriveType : String; | |
886 | + intDriveType : Integer; | |
887 | +begin | |
888 | + StrDrive := Unidade; | |
889 | + If StrDrive[Length(StrDrive)] <> '\' Then | |
890 | + StrDrive := StrDrive + ':\'; | |
891 | + | |
892 | + intDriveType := GetDriveType(PChar(StrDrive)); | |
893 | + Case intDriveType Of | |
894 | + 0 : StrDriveType := 'ERRO'; | |
895 | + 1 : StrDriveType := 'ERRO'; | |
896 | + DRIVE_REMOVABLE : StrDriveType := 'FLOPPY'; | |
897 | + DRIVE_FIXED : StrDriveType := 'HD'; | |
898 | + DRIVE_REMOTE : StrDriveType := 'REDE'; | |
899 | + DRIVE_CDROM : StrDriveType := 'CDROM'; | |
900 | + DRIVE_RAMDISK : StrDriveType := 'RAM'; | |
901 | + end; | |
902 | + Result := StrDriveType; | |
903 | +End; | |
904 | + | |
905 | +Function ChecaVersoesAgentes(p_strNomeAgente : String) : integer; // 2.2.0.16 | |
906 | +var v_versao_INI, | |
907 | + v_versao_EXE, | |
908 | + strNomeAgente : String; | |
909 | + v_array_NomeAgente : TStrings; | |
910 | + intAux : integer; | |
911 | +Begin | |
912 | + v_array_NomeAgente := explode(p_strNomeAgente,'\'); | |
913 | + intAux := v_array_NomeAgente.Count; | |
914 | + // V: 2.2.0.16 | |
915 | + // Verifico existência do arquivo "versoes_agentes.ini" para comparação das versões dos agentes principais | |
916 | + if FileExists(ExtractFilePath(Application.Exename)+'versoes_agentes.ini') then | |
917 | + if (GetValorChaveRegIni('versoes_agentes',v_array_NomeAgente[intAux-1],ExtractFilePath(Application.Exename)+'versoes_agentes.ini')<>'') then | |
918 | + Begin | |
919 | + v_versao_INI := GetValorChaveRegIni('versoes_agentes',v_array_NomeAgente[intAux-1],ExtractFilePath(Application.Exename)+'versoes_agentes.ini'); | |
920 | + v_versao_EXE := GetVersionInfo(p_strNomeAgente); | |
921 | + if (v_versao_INI = v_versao_EXE) then | |
922 | + Result := 1 | |
923 | + else | |
924 | + Result := 2; | |
925 | + End | |
926 | + else | |
927 | + Result := 0; | |
928 | +End; | |
929 | +// Dica baixada de http://procedure.blig.ig.com.br/ | |
930 | +// Adaptada por Anderson Peterle - v:2.2.0.16 - 03/2007 | |
931 | +procedure Matar(v_dir,v_files: string); | |
932 | +var SearchRec: TSearchRec; | |
933 | + Result: Integer; | |
934 | +begin | |
935 | + Result:=FindFirst(v_dir+v_files, faAnyFile, SearchRec); | |
936 | + while result=0 do | |
937 | + begin | |
938 | + log_diario('Excluindo: '+v_dir + SearchRec.Name); | |
939 | + if DeleteFile(v_dir+'\'+SearchRec.Name) then | |
940 | + log_diario('Exclusão de ' + v_dir + '\' + SearchRec.Name + ' efetuada com sucesso!') | |
941 | + else | |
942 | + Begin | |
943 | + log_diario('Exclusão não efetuada! Provavelmente já esteja sendo executado...'); | |
944 | + log_diario('Tentarei finalizar Tarefa/Processo...'); | |
945 | + if (GetWinVer <= 5) then // Até | |
946 | + KillTask(SearchRec.Name) | |
947 | + else | |
948 | + KillProcess(FindWindow(PChar(SearchRec.Name),nil)); | |
949 | + | |
950 | + if DeleteFile(v_dir+'\'+SearchRec.Name) then | |
951 | + log_diario('Exclusão Impossibilitada de ' + v_dir + '\' + SearchRec.Name + '!'); | |
952 | + End; | |
953 | + | |
954 | + Result:=FindNext(SearchRec); | |
955 | + end; | |
956 | +end; | |
957 | + | |
852 | 958 | procedure chkcacic; |
853 | 959 | var bool_download_CACIC2, |
854 | 960 | bool_download_GER_COLS, |
855 | 961 | bool_configura, |
856 | - bool_ExistsAutoRun : boolean; | |
962 | + bool_ExistsAutoRun, | |
963 | + bool_CommandLine : boolean; | |
857 | 964 | |
858 | 965 | v_te_serv_updates, |
859 | 966 | v_nu_porta_serv_updates, |
... | ... | @@ -862,7 +969,8 @@ var bool_download_CACIC2, |
862 | 969 | v_te_path_serv_updates, |
863 | 970 | v_te_texto_janela_instalacao, |
864 | 971 | v_modulos, |
865 | - v_retorno : String; | |
972 | + v_retorno, | |
973 | + strAux : String; | |
866 | 974 | |
867 | 975 | Request_Config : TStringList; |
868 | 976 | v_array_modulos : TStrings; |
... | ... | @@ -870,31 +978,60 @@ var bool_download_CACIC2, |
870 | 978 | IdHTTP1: TIdHTTP; |
871 | 979 | intAux : integer; |
872 | 980 | begin |
981 | + v_te_instala_frase_sucesso := 'INSTALAÇÃO/ATUALIZAÇÃO EFETUADA COM SUCESSO!'; | |
982 | + v_te_instala_frase_insucesso := '***** INSTALAÇÃO/ATUALIZAÇÃO NÃO EFETUADA COM SUCESSO *****'; | |
983 | + bool_CommandLine := false; | |
984 | + | |
873 | 985 | Try |
874 | 986 | v_home_drive := MidStr(HomeDrive,1,3); //x:\ |
875 | 987 | |
876 | - If not (FileExists(ExtractFilePath(Application.Exename) + '\chkcacic.ini')) then | |
877 | - Begin | |
878 | - log_diario('Abrindo formulário de configurações'); | |
879 | - CriaFormConfigura; | |
880 | - MostraFormConfigura; | |
881 | - End; | |
988 | + // 2.2.0.17 - Tratamento de opções passados em linha de comando | |
989 | + // Grande dica do grande Cláudio Filho (OpenOffice.org) | |
990 | + if (ParamCount > 0) then | |
991 | + Begin | |
992 | + For intAux := 1 to ParamCount do | |
993 | + Begin | |
994 | + if LowerCase(Copy(ParamStr(intAux),1,6)) = '/serv=' then | |
995 | + begin | |
996 | + strAux := Trim(Copy(ParamStr(intAux),7,Length((ParamStr(intAux))))); | |
997 | + v_ip_serv_cacic := Trim(Copy(strAux,0,Pos('/', strAux) - 1)); | |
998 | + If v_ip_serv_cacic = '' Then v_ip_serv_cacic := strAux; | |
999 | + end; | |
1000 | + if LowerCase(Copy(ParamStr(intAux),1,5)) = '/dir=' then | |
1001 | + begin | |
1002 | + strAux := Trim(Copy(ParamStr(intAux),6,Length((ParamStr(intAux))))); | |
1003 | + v_cacic_dir := Trim(Copy(strAux,0,Pos('/', strAux) - 1)); | |
1004 | + If v_cacic_dir = '' Then v_cacic_dir := strAux; | |
1005 | + end; | |
1006 | + | |
1007 | + end; | |
1008 | + if not(v_ip_serv_cacic='') and | |
1009 | + not(v_cacic_dir='')then | |
1010 | + bool_CommandLine := true; | |
1011 | + End; | |
1012 | + | |
1013 | + if not bool_CommandLine then | |
1014 | + Begin | |
1015 | + If not (FileExists(ExtractFilePath(Application.Exename) + '\chkcacic.ini')) then | |
1016 | + Begin | |
1017 | + log_diario('Abrindo formulário de configurações'); | |
1018 | + CriaFormConfigura; | |
1019 | + MostraFormConfigura; | |
1020 | + End; | |
1021 | + | |
1022 | + bool_download_CACIC2 := false; | |
1023 | + bool_download_GER_COLS := false; | |
1024 | + v_ip_serv_cacic := GetValorChaveRegIni('Cacic2', 'ip_serv_cacic' , ExtractFilePath(Application.Exename) + '\chkcacic.ini'); | |
1025 | + v_cacic_dir := GetValorChaveRegIni('Cacic2', 'cacic_dir' , ExtractFilePath(Application.Exename) + '\chkcacic.ini'); | |
1026 | + v_exibe_informacoes := GetValorChaveRegIni('Cacic2', 'exibe_informacoes', ExtractFilePath(Application.Exename) + '\chkcacic.ini'); | |
1027 | + v_te_instala_informacoes_extras := StringReplace(GetValorChaveRegIni('Cacic2', 'te_instala_informacoes_extras', ExtractFilePath(Application.Exename) + '\chkcacic.ini'),'*13*10',#13#10,[rfReplaceAll]); | |
1028 | + End; | |
882 | 1029 | |
883 | - bool_download_CACIC2 := false; | |
884 | - bool_download_GER_COLS := false; | |
885 | - v_ip_serv_cacic := GetValorChaveRegIni('Cacic2', 'ip_serv_cacic', ExtractFilePath(Application.Exename) + '\chkcacic.ini'); | |
886 | - v_cacic_dir := GetValorChaveRegIni('Cacic2', 'cacic_dir', ExtractFilePath(Application.Exename) + '\chkcacic.ini'); | |
887 | - v_rem_cacic_v0x := GetValorChaveRegIni('Cacic2', 'rem_cacic_v0x', ExtractFilePath(Application.Exename) + '\chkcacic.ini'); | |
888 | - v_te_instala_frase_sucesso := GetValorChaveRegIni('Cacic2', 'te_instala_frase_sucesso', ExtractFilePath(Application.Exename) + '\chkcacic.ini'); | |
889 | - v_te_instala_frase_insucesso := GetValorChaveRegIni('Cacic2', 'te_instala_frase_insucesso', ExtractFilePath(Application.Exename) + '\chkcacic.ini'); | |
890 | - v_te_instala_informacoes_extras := StringReplace(GetValorChaveRegIni('Cacic2', 'te_instala_informacoes_extras', ExtractFilePath(Application.Exename) + '\chkcacic.ini'),'*13*10',#13#10,[rfReplaceAll]); | |
891 | 1030 | Dir := v_home_drive + v_cacic_dir; // Ex.: c:\cacic\ |
892 | 1031 | |
893 | 1032 | // Verifico se o S.O. é NT Like e se o Usuário está com privilégio administrativo... |
894 | 1033 | if (GetWinVer >= 6) and |
895 | - not (v_te_instala_frase_sucesso + | |
896 | - v_te_instala_frase_insucesso + | |
897 | - v_te_instala_informacoes_extras = '') and | |
1034 | + (v_exibe_informacoes = 'S') and | |
898 | 1035 | not IsAdmin then // Se NT/2000/XP/... |
899 | 1036 | Begin |
900 | 1037 | MessageDLG(#13#10+'ATENÇÃO! Essa aplicação requer execução com nível administrativo.',mtError,[mbOK],0); |
... | ... | @@ -938,15 +1075,18 @@ begin |
938 | 1075 | |
939 | 1076 | |
940 | 1077 | if (ParamCount > 0) and (LowerCase(Copy(ParamStr(1),1,7)) = '/config') then bool_configura := true; |
941 | - while (v_ip_serv_cacic = '') or (v_cacic_dir = '') or (v_rem_cacic_v0x = '') or bool_configura do | |
1078 | + | |
1079 | + while (v_ip_serv_cacic = '') or (v_cacic_dir = '') or bool_configura do | |
942 | 1080 | Begin |
943 | 1081 | log_diario('Abrindo formulário de configurações'); |
944 | 1082 | bool_configura := false; |
945 | 1083 | CriaFormConfigura; |
946 | 1084 | Configs.Edit_ip_serv_cacic.text := v_ip_serv_cacic; |
947 | 1085 | Configs.Edit_cacic_dir.text := v_cacic_dir; |
948 | - Configs.Edit_te_instala_frase_sucesso.text := v_te_instala_frase_sucesso; | |
949 | - Configs.Edit_te_instala_frase_insucesso.text := v_te_instala_frase_insucesso; | |
1086 | + if v_exibe_informacoes = 'S' then | |
1087 | + Configs.ckboxExibeInformacoes.Checked := true | |
1088 | + else | |
1089 | + Configs.ckboxExibeInformacoes.Checked := false; | |
950 | 1090 | Configs.Memo_te_instala_informacoes_extras.text := v_te_instala_informacoes_extras; |
951 | 1091 | MostraFormConfigura; |
952 | 1092 | End; |
... | ... | @@ -954,8 +1094,8 @@ begin |
954 | 1094 | if (ParamCount > 0) and (LowerCase(Copy(ParamStr(1),1,7)) = '/config') then application.Terminate; |
955 | 1095 | |
956 | 1096 | // Caso o parâmetro rem_cacic_v0x seja "S/s" removo a chave/valor de execução do Cacic antigo |
957 | - if (LowerCase(v_rem_cacic_v0x)='s') then | |
958 | - DelValorReg('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic'); | |
1097 | + //if (LowerCase(v_rem_cacic_v0x)='s') then | |
1098 | + // DelValorReg('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic'); | |
959 | 1099 | |
960 | 1100 | // Verifico a existência do diretório configurado para o Cacic, normalmente CACIC |
961 | 1101 | if not DirectoryExists(Dir) then |
... | ... | @@ -967,6 +1107,8 @@ begin |
967 | 1107 | // Para eliminar versão 20014 e anteriores que provavelmente não fazem corretamente o AutoUpdate |
968 | 1108 | if not DirectoryExists(Dir+'\modulos') then |
969 | 1109 | begin |
1110 | + Matar(Dir, '\cacic2.exe'); | |
1111 | + { | |
970 | 1112 | if DeleteFile(Dir + '\cacic2.exe') then |
971 | 1113 | log_diario('Exclusão de '+Dir + '\cacic2.exe' + ' efetuada com sucesso!') |
972 | 1114 | else |
... | ... | @@ -980,7 +1122,7 @@ begin |
980 | 1122 | if DeleteFile(Dir + '\cacic2.exe') then |
981 | 1123 | log_diario('Exclusão Impossibilitada de '+Dir + '\cacic2.exe' + '!'); |
982 | 1124 | End; |
983 | - | |
1125 | + } | |
984 | 1126 | ForceDirectories(Dir + '\modulos'); |
985 | 1127 | log_diario('Criando pasta '+Dir+'\modulos'); |
986 | 1128 | end; |
... | ... | @@ -1042,6 +1184,8 @@ begin |
1042 | 1184 | log_diario(':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'); |
1043 | 1185 | Except |
1044 | 1186 | Begin |
1187 | + if v_exibe_informacoes = 'S' then | |
1188 | + MessageDLG(#13#10+'ATENÇÃO! Não foi possível estabelecer comunicação com o módulo Gerente WEB em "'+v_ip_serv_cacic+'".',mtError,[mbOK],0); | |
1045 | 1189 | log_diario('**********************************************************'); |
1046 | 1190 | log_diario('Oops! Não Foi Possível Comunicar com o Módulo Gerente WEB!'); |
1047 | 1191 | log_diario('**********************************************************'); |
... | ... | @@ -1050,104 +1194,79 @@ begin |
1050 | 1194 | Request_Config.Free; |
1051 | 1195 | Response_Config.Free; |
1052 | 1196 | |
1053 | - // Verificação de versão do cacic2.exe e exclusão em caso de versão antiga | |
1197 | + // Verificação de versão do cacic2.exe e exclusão em caso de versão antiga/diferente da atual | |
1054 | 1198 | If (FileExists(Dir + '\cacic2.exe')) Then |
1055 | 1199 | Begin |
1056 | - v_versao_local := trim(GetVersionInfo(Dir + '\cacic2.exe')); | |
1057 | - v_versao_local := StringReplace(v_versao_local,'.','',[rfReplaceAll]); | |
1058 | - | |
1059 | - v_versao_remota_inteira := XML_RetornaValor('CACIC2' , v_retorno); | |
1060 | - v_versao_remota_capada := Copy(v_versao_remota_inteira,1,StrLen(PAnsiChar(v_versao_remota_inteira))-4); | |
1200 | + intAux := ChecaVersoesAgentes(Dir + '\cacic2.exe'); | |
1201 | + // 0 => Arquivo de versões inexistente | |
1202 | + // 1 => Versões iguais | |
1203 | + // 2 => Versões diferentes | |
1204 | + if (intAux = 0) then | |
1205 | + Begin | |
1206 | + v_versao_local := trim(GetVersionInfo(Dir + '\cacic2.exe')); | |
1207 | + v_versao_local := StringReplace(v_versao_local,'.','',[rfReplaceAll]); | |
1061 | 1208 | |
1062 | - if not (v_versao_remota_inteira = '') then | |
1063 | - log_diario('Versão remota de "cacic2.exe": '+v_versao_remota_capada + '('+v_versao_remota_inteira+')'); | |
1209 | + v_versao_remota_inteira := XML_RetornaValor('CACIC2' , v_retorno); | |
1210 | + v_versao_remota_capada := Copy(v_versao_remota_inteira,1,StrLen(PAnsiChar(v_versao_remota_inteira))-4); | |
1064 | 1211 | |
1065 | - if (v_versao_local ='0000') or // Provavelmente versão muito antiga ou corrompida | |
1066 | - (v_versao_local ='2208') or | |
1067 | - (v_versao_local <> v_versao_remota_capada) then | |
1068 | - Begin | |
1069 | - log_diario('Excluindo versão "'+v_versao_local+'" de Cacic2.exe'); | |
1070 | - if DeleteFile(Dir + '\cacic2.exe') then | |
1071 | - log_diario('Exclusão de '+Dir + '\cacic2.exe'+' efetuada com sucesso!') | |
1072 | - else | |
1073 | - Begin | |
1074 | - log_diario('Exclusão não efetuada! Provavelmente já esteja sendo executado...'); | |
1075 | - log_diario('Tentarei finalizar Tarefa/Processo...'); | |
1076 | - if (GetWinVer <= 5) then // Até | |
1077 | - KillTask('cacic2.exe') | |
1078 | - else | |
1079 | - KillProcess(FindWindow('cacic2.exe',nil)); | |
1080 | - if DeleteFile(Dir + '\cacic2.exe') then | |
1081 | - log_diario('Exclusão Impossibilitada de '+Dir + '\cacic2.exe' + '!'); | |
1082 | - End; | |
1212 | + if not (v_versao_remota_inteira = '') then | |
1213 | + log_diario('Versão remota de "cacic2.exe": '+v_versao_remota_capada + '('+v_versao_remota_inteira+')'); | |
1083 | 1214 | End; |
1215 | + | |
1216 | + if (intAux = 2) or // Caso haja diferença na comparação de versões com "versoes_agentes.ini"... | |
1217 | + (v_versao_local ='0000') or // Provavelmente versão muito antiga ou corrompida | |
1218 | + (v_versao_local ='2208') then | |
1219 | + Matar(Dir, '\cacic2.exe'); | |
1084 | 1220 | End; |
1085 | 1221 | |
1086 | - // Verificação de versão do ger_cols.exe e exclusão em caso de versão antiga | |
1222 | + // Verificação de versão do ger_cols.exe e exclusão em caso de versão antiga/diferente da atual | |
1087 | 1223 | If (FileExists(Dir + '\modulos\ger_cols.exe')) Then |
1088 | - Begin | |
1089 | - v_versao_local := trim(GetVersionInfo(Dir + '\modulos\ger_cols.exe')); | |
1090 | - v_versao_local := StringReplace(v_versao_local,'.','',[rfReplaceAll]); | |
1224 | + Begin | |
1225 | + intAux := ChecaVersoesAgentes(Dir + '\cacic2.exe'); | |
1226 | + // 0 => Arquivo de versões inexistente | |
1227 | + // 1 => Versões iguais | |
1228 | + // 2 => Versões diferentes | |
1229 | + if (intAux = 0) then | |
1230 | + Begin | |
1231 | + v_versao_local := trim(GetVersionInfo(Dir + '\modulos\ger_cols.exe')); | |
1232 | + v_versao_local := StringReplace(v_versao_local,'.','',[rfReplaceAll]); | |
1091 | 1233 | |
1092 | - v_versao_remota_inteira := XML_RetornaValor('GER_COLS' , v_retorno); | |
1093 | - v_versao_remota_capada := Copy(v_versao_remota_inteira,1,StrLen(PAnsiChar(v_versao_remota_inteira))-4); | |
1234 | + v_versao_remota_inteira := XML_RetornaValor('GER_COLS' , v_retorno); | |
1235 | + v_versao_remota_capada := Copy(v_versao_remota_inteira,1,StrLen(PAnsiChar(v_versao_remota_inteira))-4); | |
1094 | 1236 | |
1095 | - if not (v_versao_remota_inteira = '') then | |
1096 | - log_diario('Versão remota de "ger_cols.exe": '+v_versao_remota_capada+ '('+v_versao_remota_inteira+')'); | |
1237 | + if not (v_versao_remota_inteira = '') then | |
1238 | + log_diario('Versão remota de "ger_cols.exe": '+v_versao_remota_capada+ '('+v_versao_remota_inteira+')'); | |
1239 | + End; | |
1097 | 1240 | |
1098 | - if (v_versao_local ='0000') or // Provavelmente versão muito antiga ou corrompida | |
1099 | - (v_versao_local <> v_versao_remota_capada) then | |
1100 | - Begin | |
1101 | - log_diario('Excluindo versão "'+v_versao_local+'" de Ger_Cols.exe'); | |
1102 | - if DeleteFile(Dir + '\modulos\ger_cols.exe') then | |
1103 | - log_diario('Exclusão de '+Dir + '\modulos\ger_cols.exe'+' efetuada com sucesso!') | |
1104 | - else | |
1105 | - Begin | |
1106 | - log_diario('Exclusão não efetuada! Provavelmente já esteja sendo executado...'); | |
1107 | - log_diario('Tentarei finalizar Tarefa/Processo...'); | |
1108 | - if (GetWinVer <= 5) then // Até | |
1109 | - KillTask('ger_cols.exe') | |
1110 | - else | |
1111 | - KillProcess(FindWindow('ger_cols.exe',nil)); | |
1112 | - if DeleteFile(Dir + '\modulos\ger_cols.exe') then | |
1113 | - log_diario('Exclusão Impossibilitada de '+Dir + '\modulos\ger_cols.exe' + '!'); | |
1114 | - End; | |
1115 | - End; | |
1116 | - End; | |
1241 | + if (intAux = 2) or // Caso haja diferença na comparação de versões com "versoes_agentes.ini"... | |
1242 | + (v_versao_local ='0000') then // Provavelmente versão muito antiga ou corrompida | |
1243 | + Matar(Dir + '\modulos\', 'ger_cols.exe'); | |
1244 | + End; | |
1117 | 1245 | |
1118 | 1246 | |
1119 | - // Verificação de versão do chksis.exe e exclusão em caso de versão antiga | |
1247 | + // Verificação de versão do chksis.exe e exclusão em caso de versão antiga/diferente da atual | |
1120 | 1248 | If (FileExists(HomeDrive + '\chksis.exe')) Then |
1121 | - Begin | |
1122 | - v_versao_local := trim(GetVersionInfo(HomeDrive + '\chksis.exe')); | |
1123 | - v_versao_local := StringReplace(v_versao_local,'.','',[rfReplaceAll]); | |
1124 | - | |
1125 | - v_versao_remota_inteira := XML_RetornaValor('CHKSIS' , v_retorno); | |
1126 | - v_versao_remota_capada := Copy(v_versao_remota_inteira,1,StrLen(PAnsiChar(v_versao_remota_inteira))-4); | |
1249 | + Begin | |
1250 | + intAux := ChecaVersoesAgentes(HomeDrive + '\chksis.exe'); | |
1251 | + // 0 => Arquivo de versões inexistente | |
1252 | + // 1 => Versões iguais | |
1253 | + // 2 => Versões diferentes | |
1254 | + if (intAux = 0) then | |
1255 | + Begin | |
1256 | + v_versao_local := trim(GetVersionInfo(HomeDrive + '\chksis.exe')); | |
1257 | + v_versao_local := StringReplace(v_versao_local,'.','',[rfReplaceAll]); | |
1127 | 1258 | |
1128 | - if not (v_versao_remota_inteira = '') then | |
1129 | - log_diario('Versão remota de "chksis.exe": '+v_versao_remota_capada+ '('+v_versao_remota_inteira+')'); | |
1259 | + v_versao_remota_inteira := XML_RetornaValor('CHKSIS' , v_retorno); | |
1260 | + v_versao_remota_capada := Copy(v_versao_remota_inteira,1,StrLen(PAnsiChar(v_versao_remota_inteira))-4); | |
1130 | 1261 | |
1131 | - if (v_versao_local ='0000') or // Provavelmente versão muito antiga ou corrompida | |
1132 | - (v_versao_local <> v_versao_remota_capada) then | |
1133 | - Begin | |
1134 | - log_diario('Excluindo versão "'+v_versao_local+'" de ChkSis.exe'); | |
1135 | - if DeleteFile(HomeDrive + '\chksis.exe') then | |
1136 | - log_diario('Exclusão de '+HomeDrive + '\chksis.exe'+' efetuada com sucesso!') | |
1137 | - else | |
1138 | - Begin | |
1139 | - log_diario('Exclusão não efetuada! Provavelmente já esteja sendo executado...'); | |
1140 | - log_diario('Tentarei finalizar Tarefa/Processo...'); | |
1141 | - if (GetWinVer <= 5) then // Até | |
1142 | - KillTask('chksis.exe') | |
1143 | - else | |
1144 | - KillProcess(FindWindow('chksis.exe',nil)); | |
1145 | - if DeleteFile(HomeDrive + '\chksis.exe') then | |
1146 | - log_diario('Exclusão Impossibilitada de '+HomeDrive + '\chksis.exe' + '!'); | |
1147 | - End; | |
1262 | + if not (v_versao_remota_inteira = '') then | |
1263 | + log_diario('Versão remota de "chksis.exe": '+v_versao_remota_capada+ '('+v_versao_remota_inteira+')'); | |
1264 | + End; | |
1148 | 1265 | |
1149 | - End; | |
1150 | - End; | |
1266 | + if (intAux = 2) or // Caso haja diferença na comparação de versões com "versoes_agentes.ini"... | |
1267 | + (v_versao_local ='0000') then // Provavelmente versão muito antiga ou corrompida | |
1268 | + Matar(HomeDrive,'chksis.exe'); | |
1269 | + End; | |
1151 | 1270 | |
1152 | 1271 | // Tento detectar o ChkSis.EXE e copio ou faço FTP caso não exista |
1153 | 1272 | If not FileExists(HomeDrive + '\chksis.exe') Then |
... | ... | @@ -1160,14 +1279,15 @@ begin |
1160 | 1279 | End |
1161 | 1280 | else |
1162 | 1281 | Begin |
1282 | + if not FTP(v_te_serv_updates, | |
1283 | + v_nu_porta_serv_updates, | |
1284 | + v_nm_usuario_login_serv_updates, | |
1285 | + v_te_senha_login_serv_updates, | |
1286 | + v_te_path_serv_updates, | |
1287 | + 'chksis.exe', | |
1288 | + HomeDrive) and (v_exibe_informacoes = 'S') then | |
1289 | + MessageDLG(#13#10+'ATENÇÃO! Não foi possível efetuar FTP para "'+HomeDrive + '\chksis.exe".'+#13#10+'Verifique o Servidor de Updates.',mtError,[mbOK],0); | |
1163 | 1290 | |
1164 | - FTP(v_te_serv_updates, | |
1165 | - v_nu_porta_serv_updates, | |
1166 | - v_nm_usuario_login_serv_updates, | |
1167 | - v_te_senha_login_serv_updates, | |
1168 | - v_te_path_serv_updates, | |
1169 | - 'chksis.exe', | |
1170 | - HomeDrive); | |
1171 | 1291 | If not FileExists(HomeDrive + '\chksis.exe') Then |
1172 | 1292 | Begin |
1173 | 1293 | log_diario('Problemas Efetuando Download de ChkSis.exe(FTP):'); |
... | ... | @@ -1212,13 +1332,14 @@ begin |
1212 | 1332 | End |
1213 | 1333 | else |
1214 | 1334 | begin |
1215 | - FTP(v_te_serv_updates, | |
1216 | - v_nu_porta_serv_updates, | |
1217 | - v_nm_usuario_login_serv_updates, | |
1218 | - v_te_senha_login_serv_updates, | |
1219 | - v_te_path_serv_updates, | |
1220 | - 'cacic2.exe', | |
1221 | - Dir); | |
1335 | + if not FTP(v_te_serv_updates, | |
1336 | + v_nu_porta_serv_updates, | |
1337 | + v_nm_usuario_login_serv_updates, | |
1338 | + v_te_senha_login_serv_updates, | |
1339 | + v_te_path_serv_updates, | |
1340 | + 'cacic2.exe', | |
1341 | + Dir) and (v_exibe_informacoes = 'S') then | |
1342 | + MessageDLG(#13#10+'ATENÇÃO! Não foi possível efetuar FTP para "'+Dir + '\cacic2.exe".'+#13#10+'Verifique o Servidor de Updates.',mtError,[mbOK],0); | |
1222 | 1343 | |
1223 | 1344 | bool_download_CACIC2 := true; |
1224 | 1345 | |
... | ... | @@ -1248,13 +1369,14 @@ begin |
1248 | 1369 | End |
1249 | 1370 | else |
1250 | 1371 | begin |
1251 | - FTP(v_te_serv_updates, | |
1252 | - v_nu_porta_serv_updates, | |
1253 | - v_nm_usuario_login_serv_updates, | |
1254 | - v_te_senha_login_serv_updates, | |
1255 | - v_te_path_serv_updates, | |
1256 | - 'ger_cols.exe', | |
1257 | - Dir + '\modulos'); | |
1372 | + if not FTP(v_te_serv_updates, | |
1373 | + v_nu_porta_serv_updates, | |
1374 | + v_nm_usuario_login_serv_updates, | |
1375 | + v_te_senha_login_serv_updates, | |
1376 | + v_te_path_serv_updates, | |
1377 | + 'ger_cols.exe', | |
1378 | + Dir + '\modulos') and (v_exibe_informacoes = 'S') then | |
1379 | + MessageDLG(#13#10+'ATENÇÃO! Não foi possível efetuar FTP para "'+Dir + '\modulos\ger_cols.exe".'+#13#10+'Verifique o Servidor de Updates.',mtError,[mbOK],0); | |
1258 | 1380 | |
1259 | 1381 | bool_download_GER_COLS := true; |
1260 | 1382 | If (not FileExists(Dir + '\modulos\ger_cols.exe')) Then |
... | ... | @@ -1303,13 +1425,16 @@ begin |
1303 | 1425 | |
1304 | 1426 | // Igualo as chaves ip_serv_cacic dos arquivos chksis.ini e cacic2.ini! |
1305 | 1427 | SetValorDatMemoria('Configs.EnderecoServidor', v_ip_serv_cacic); |
1306 | - log_diario('Fechando Arquivo de Configurações do CACIC'); | |
1428 | + log_diario('Fechando Arquivo de Configurações do Cacic'); | |
1307 | 1429 | CipherClose(v_DatFileName); |
1308 | - log_diario('Abrindo Arquivo de Configurações do CHKSIS'); | |
1430 | + | |
1431 | + log_diario('Abrindo Arquivo de Configurações do ChkSis'); | |
1309 | 1432 | CipherOpen(HomeDrive + '\chksis.dat'); |
1310 | 1433 | SetValorDatMemoria('Cacic2.ip_serv_cacic', v_ip_serv_cacic); |
1311 | - // SetValorChaveRegIni('Cacic2', 'ip_serv_cacic', v_ip_serv_cacic, HomeDrive + '\chksis.ini'); | |
1312 | - | |
1434 | + CipherClose(HomeDrive + '\chksis.dat'); | |
1435 | + // Volto a gravar o chksis.ini para o difícil caso de leitura por versões antigas | |
1436 | + SetValorChaveRegIni('Cacic2', 'ip_serv_cacic', v_ip_serv_cacic, HomeDrive + '\chksis.ini'); | |
1437 | + log_diario('Fechando Arquivo de Configurações do ChkSis'); | |
1313 | 1438 | |
1314 | 1439 | // Se NT/2K/XP... |
1315 | 1440 | // If NT Like... |
... | ... | @@ -1344,15 +1469,19 @@ begin |
1344 | 1469 | v_te_texto_janela_instalacao := v_te_instala_informacoes_extras; |
1345 | 1470 | if (GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2')=Dir + '\cacic2.exe') then |
1346 | 1471 | Begin |
1347 | - if (v_te_instala_frase_sucesso<>'') then | |
1348 | - Begin | |
1349 | - MessageDlg(#13#10+#13#10+v_te_instala_frase_sucesso+#13#10+#13#10+v_te_texto_janela_instalacao,mtInformation,[mbok],0); | |
1350 | - End; | |
1472 | + if (v_exibe_informacoes = 'S') then | |
1473 | + MessageDlg(#13#10+#13#10+v_te_instala_frase_sucesso+#13#10+#13#10+#13#10 + '======================================================' + #13#10 + v_te_texto_janela_instalacao+ '======================================================',mtInformation,[mbok],0); | |
1351 | 1474 | End |
1352 | - else if (v_te_instala_frase_insucesso<>'') then | |
1353 | - MessageDlg(#13#10+#13#10+v_te_instala_frase_insucesso+#13#10+#13#10 + v_te_texto_janela_instalacao,mtInformation,[mbok],0); | |
1354 | - | |
1355 | - if not bool_ExistsAutoRun then | |
1475 | + else if (v_exibe_informacoes = 'S') then | |
1476 | + MessageDlg(#13#10+#13#10+v_te_instala_frase_insucesso+#13#10+#13#10+#13#10 + '======================================================' + #13#10 + v_te_texto_janela_instalacao+ '======================================================',mtInformation,[mbok],0); | |
1477 | + | |
1478 | + // Se eu não encontrei a chave de autoexecução ou | |
1479 | + // Se a unidade origem de chamada ao ChkCacic refere-se a Floppy, CDROM ou Flash | |
1480 | + // Eu executo o agente principal | |
1481 | + strAux := DriveType(Copy(ExtractFilePath(Application.Exename),1,1)); | |
1482 | + if not bool_ExistsAutoRun or | |
1483 | + (not(strAux = 'ERRO') and | |
1484 | + not(strAux = 'REDE')) then | |
1356 | 1485 | Begin |
1357 | 1486 | log_diario('Executando '+Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic); |
1358 | 1487 | WinExec(PChar(Dir + '\cacic2.exe /ip_serv_cacic=' + v_ip_serv_cacic+ ' /execute'), SW_HIDE); |
... | ... | @@ -1362,7 +1491,7 @@ begin |
1362 | 1491 | |
1363 | 1492 | End |
1364 | 1493 | else |
1365 | - log_diario('ATENÇÃO: A Instalação NÃO Foi Realizada com Sucesso!'); | |
1494 | + log_diario('ATENÇÃO: A Instalação NÃO Foi Realizada com Sucesso ou Atualização Desnecessária!'); | |
1366 | 1495 | End; |
1367 | 1496 | Except |
1368 | 1497 | log_diario('Falha na instalação'); |
... | ... | @@ -1502,7 +1631,7 @@ begin |
1502 | 1631 | // Set total permissions to local groups |
1503 | 1632 | v_FS_Security.SetSecurity; |
1504 | 1633 | end |
1505 | - else Log_diario('File System diferente de "NTFS"'); | |
1634 | + else Log_diario('File System: "' + v_FS_Security.FileSystemName+'" - Ok!'); | |
1506 | 1635 | |
1507 | 1636 | v_FS_Security.Free; |
1508 | 1637 | end; | ... | ... |
chkcacic/chkcacic.dof
... | ... | @@ -115,7 +115,7 @@ AutoIncBuild=0 |
115 | 115 | MajorVer=2 |
116 | 116 | MinorVer=2 |
117 | 117 | Release=0 |
118 | -Build=15 | |
118 | +Build=17 | |
119 | 119 | Debug=0 |
120 | 120 | PreRelease=0 |
121 | 121 | Special=0 |
... | ... | @@ -126,7 +126,7 @@ CodePage=1252 |
126 | 126 | [Version Info Keys] |
127 | 127 | CompanyName=Dataprev-ES |
128 | 128 | FileDescription= |
129 | -FileVersion=2.2.0.15 | |
129 | +FileVersion=2.2.0.17 | |
130 | 130 | InternalName= |
131 | 131 | LegalCopyright= |
132 | 132 | LegalTrademarks= | ... | ... |
chkcacic/chkcacic.res
No preview for this file type
chkcacic/main.dcu
No preview for this file type