Commit db508f0567380fca3d1ddd241dbf6296772c0d0d

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

Exclusão para posterior reposição com versão 2.6-Beta-2

git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@966 fecfc0c7-e812-0410-ae72-849f08638ee7
ini_cols/icon_ini_cols.ico
No preview for this file type
ini_cols/ini_cols.cfg
... ... @@ -1,38 +0,0 @@
1   --$A8
2   --$B-
3   --$C+
4   --$D+
5   --$E-
6   --$F-
7   --$G+
8   --$H+
9   --$I+
10   --$J-
11   --$K-
12   --$L+
13   --$M-
14   --$N+
15   --$O+
16   --$P+
17   --$Q-
18   --$R-
19   --$S-
20   --$T-
21   --$U-
22   --$V+
23   --$W-
24   --$X+
25   --$YD
26   --$Z1
27   --cc
28   --AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
29   --H+
30   --W+
31   --M
32   --$M16384,1048576
33   --K$00400000
34   --LE"c:\arquivos de programas\borland\delphi7\Projects\Bpl"
35   --LN"c:\arquivos de programas\borland\delphi7\Projects\Bpl"
36   --w-UNSAFE_TYPE
37   --w-UNSAFE_CODE
38   --w-UNSAFE_CAST
ini_cols/ini_cols.dof
... ... @@ -1,136 +0,0 @@
1   -[FileVersion]
2   -Version=7.0
3   -[Compiler]
4   -A=8
5   -B=0
6   -C=1
7   -D=1
8   -E=0
9   -F=0
10   -G=1
11   -H=1
12   -I=1
13   -J=0
14   -K=0
15   -L=1
16   -M=0
17   -N=1
18   -O=1
19   -P=1
20   -Q=0
21   -R=0
22   -S=0
23   -T=0
24   -U=0
25   -V=1
26   -W=0
27   -X=1
28   -Y=1
29   -Z=1
30   -ShowHints=1
31   -ShowWarnings=1
32   -UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
33   -NamespacePrefix=
34   -SymbolDeprecated=1
35   -SymbolLibrary=1
36   -SymbolPlatform=1
37   -UnitLibrary=1
38   -UnitPlatform=1
39   -UnitDeprecated=1
40   -HResultCompat=1
41   -HidingMember=1
42   -HiddenVirtual=1
43   -Garbage=1
44   -BoundsError=1
45   -ZeroNilCompat=1
46   -StringConstTruncated=1
47   -ForLoopVarVarPar=1
48   -TypedConstVarPar=1
49   -AsgToTypedConst=1
50   -CaseLabelRange=1
51   -ForVariable=1
52   -ConstructingAbstract=1
53   -ComparisonFalse=1
54   -ComparisonTrue=1
55   -ComparingSignedUnsigned=1
56   -CombiningSignedUnsigned=1
57   -UnsupportedConstruct=1
58   -FileOpen=1
59   -FileOpenUnitSrc=1
60   -BadGlobalSymbol=1
61   -DuplicateConstructorDestructor=1
62   -InvalidDirective=1
63   -PackageNoLink=1
64   -PackageThreadVar=1
65   -ImplicitImport=1
66   -HPPEMITIgnored=1
67   -NoRetVal=1
68   -UseBeforeDef=1
69   -ForLoopVarUndef=1
70   -UnitNameMismatch=1
71   -NoCFGFileFound=1
72   -MessageDirective=1
73   -ImplicitVariants=1
74   -UnicodeToLocale=1
75   -LocaleToUnicode=1
76   -ImagebaseMultiple=1
77   -SuspiciousTypecast=1
78   -PrivatePropAccessor=1
79   -UnsafeType=0
80   -UnsafeCode=0
81   -UnsafeCast=0
82   -[Linker]
83   -MapFile=0
84   -OutputObjs=0
85   -ConsoleApp=0
86   -DebugInfo=0
87   -RemoteSymbols=0
88   -MinStackSize=16384
89   -MaxStackSize=1048576
90   -ImageBase=4194304
91   -ExeDescription=Inicializador de Coletas do CACIC
92   -[Directories]
93   -OutputDir=
94   -UnitOutputDir=
95   -PackageDLLOutputDir=
96   -PackageDCPOutputDir=
97   -SearchPath=
98   -Packages=dclact
99   -Conditionals=
100   -DebugSourceDirs=
101   -UsePackages=0
102   -[Parameters]
103   -RunParams=
104   -HostApplication=
105   -Launcher=
106   -UseLauncher=0
107   -DebugCWD=
108   -[Language]
109   -ActiveLang=
110   -ProjectLang=
111   -RootDir=C:\Arquivos de programas\Borland\Delphi7\Bin\
112   -[Version Info]
113   -IncludeVerInfo=1
114   -AutoIncBuild=0
115   -MajorVer=2
116   -MinorVer=5
117   -Release=0
118   -Build=773
119   -Debug=0
120   -PreRelease=0
121   -Special=0
122   -Private=0
123   -DLL=0
124   -Locale=1046
125   -CodePage=1252
126   -[Version Info Keys]
127   -CompanyName=Dataprev - Emp. de TI da Prev.Social - URES
128   -FileDescription=Inicializador de Coletas do Sistema CACIC
129   -FileVersion=2.5.0.773
130   -InternalName=
131   -LegalCopyright=
132   -LegalTrademarks=
133   -OriginalFilename=
134   -ProductName=Ini_COLS
135   -ProductVersion=2.6
136   -Comments=Baseado na licença GPL (General Public License)
ini_cols/ini_cols.dpr
... ... @@ -1,334 +0,0 @@
1   -(**
2   ----------------------------------------------------------------------------------------------------------------------------------------------------------------
3   -Copyright 2000, 2001, 2002, 2003, 2004, 2005 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil
4   -
5   -Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de Informações Computacionais
6   -
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   -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença, ou (na sua opinião) qualquer versão.
9   -
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   -MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes.
12   -
13   -Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software
14   -Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15   ----------------------------------------------------------------------------------------------------------------------------------------------------------------
16   -*)
17   -
18   -program ini_cols;
19   -{$R *.res}
20   -
21   -uses
22   - Windows,
23   - SysUtils,
24   - Classes,
25   - idFTPCommon,
26   - idFTP,
27   - PJVersionInfo,
28   - CACIC_Library in '..\CACIC_Library.pas';
29   -
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;
48   -
49   -var
50   - g_oCacic : TCACIC;
51   -
52   -const
53   - CACIC_APP_NAME = 'ini_cols';
54   -
55   -function VerFmt(const MS, LS: DWORD): string;
56   - // Format the version number from the given DWORDs containing the info
57   -begin
58   - Result := Format('%d.%d.%d.%d',
59   - [HiWord(MS), LoWord(MS), HiWord(LS), LoWord(LS)])
60   -end;
61   -
62   -function GetVersionInfo(p_File: string):string;
63   -var PJVersionInfo1: TPJVersionInfo;
64   -begin
65   - PJVersionInfo1 := TPJVersionInfo.Create(nil);
66   - PJVersionInfo1.FileName := PChar(p_File);
67   - Result := VerFmt(PJVersionInfo1.FixedFileInfo.dwFileVersionMS, PJVersionInfo1.FixedFileInfo.dwFileVersionLS);
68   - PJVersionInfo1.Free;
69   -end;
70   -
71   -function GetFolderDate(Folder: string): TDateTime;
72   -var
73   - Rec: TSearchRec;
74   - Found: Integer;
75   - Date: TDateTime;
76   -begin
77   - if Folder[Length(folder)] = '\' then
78   - Delete(Folder, Length(folder), 1);
79   - Result := 0;
80   - Found := FindFirst(Folder, faDirectory, Rec);
81   - try
82   - if Found = 0 then
83   - begin
84   - Date := FileDateToDateTime(Rec.Time);
85   - Result := Date;
86   - end;
87   - finally
88   - FindClose(Rec);
89   - end;
90   -end;
91   -
92   -procedure log_diario(strMsg : String);
93   -var
94   - HistoricoLog : TextFile;
95   - strDataArqLocal, strDataAtual : string;
96   -begin
97   - try
98   - FileSetAttr (g_oCacic.getCacicPath + 'cacic2.log',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
99   - AssignFile(HistoricoLog,g_oCacic.getCacicPath + 'cacic2.log'); {Associa o arquivo a uma variável do tipo TextFile}
100   - {$IOChecks off}
101   - Reset(HistoricoLog); {Abre o arquivo texto}
102   - {$IOChecks on}
103   - if (IOResult <> 0) then // Arquivo não existe, será recriado.
104   - begin
105   - Rewrite (HistoricoLog);
106   - Append(HistoricoLog);
107   - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <=======================');
108   - end;
109   - if (trim(strMsg) <> '') then
110   - begin
111   - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(g_oCacic.getCacicPath + 'cacic2.log')));
112   - DateTimeToString(strDataAtual , 'yyyymmdd', Date);
113   - if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual...
114   - begin
115   - Rewrite (HistoricoLog); //Cria/Recria o arquivo
116   - Append(HistoricoLog);
117   - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <=======================');
118   - end;
119   - Append(HistoricoLog);
120   - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now)+ '[Inicializador de Coletas] '+strMsg); {Grava a string Texto no arquivo texto}
121   - CloseFile(HistoricoLog); {Fecha o arquivo texto}
122   - end
123   - else CloseFile(HistoricoLog);;
124   -
125   - except
126   -
127   - end;
128   -
129   -end;
130   -
131   -procedure log_DEBUG(p_msg:string);
132   -Begin
133   - if v_Debugs then log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg);
134   -End;
135   -
136   -// Dica baixada de http://procedure.blig.ig.com.br/
137   -procedure Matar(v_dir,v_files: string);
138   -var
139   -SearchRec: TSearchRec;
140   -Result: Integer;
141   -begin
142   - Result:=FindFirst(v_dir+v_files, faAnyFile, SearchRec);
143   - while result=0 do
144   - begin
145   - log_DEBUG('Excluindo: '+v_dir + SearchRec.Name);
146   - DeleteFile(v_dir+SearchRec.Name);
147   - Result:=FindNext(SearchRec);
148   - end;
149   -end;
150   -
151   -Function GetValorDatMemoria(p_Chave : String) : String;
152   -begin
153   - if (v_tstrCipherOpened.IndexOf(p_Chave)<>-1) then
154   - Result := v_tstrCipherOpened[v_tstrCipherOpened.IndexOf(p_Chave)+1]
155   - else
156   - Result := '';
157   -end;
158   -
159   -Function CipherOpen(p_DatFileName : string) : TStrings;
160   -var v_DatFile : TextFile;
161   - v_strCipherOpened,
162   - v_strCipherClosed : string;
163   - oCacic : TCACIC;
164   -begin
165   - v_strCipherOpened := '';
166   - if FileExists(p_DatFileName) then
167   - begin
168   - AssignFile(v_DatFile,p_DatFileName);
169   - {$IOChecks off}
170   - Reset(v_DatFile);
171   - {$IOChecks on}
172   - if (IOResult <> 0) then // Arquivo não existe, será recriado.
173   - begin
174   - Rewrite (v_DatFile);
175   - Append(v_DatFile);
176   - end;
177   -
178   - Readln(v_DatFile,v_strCipherClosed);
179   - while not EOF(v_DatFile) do Readln(v_DatFile,v_strCipherClosed);
180   - CloseFile(v_DatFile);
181   - v_strCipherOpened:= g_oCacic.deCrypt(v_strCipherClosed);
182   - log_DEBUG('Rotina de Abertura do cacic2.dat RESTAURANDO estado da criptografia.');
183   - end;
184   -
185   - if (trim(v_strCipherOpened)<>'') then
186   - Result := g_oCacic.explode(v_strCipherOpened,g_oCacic.getSeparatorKey)
187   - else
188   - Result := g_oCacic.explode('Configs.ID_SO'+g_oCacic.getSeparatorKey+ oCacic.getWindowsStrId() +g_oCacic.getSeparatorKey+'Configs.Endereco_WS'+g_oCacic.getSeparatorKey+'/cacic2/ws/',g_oCacic.getSeparatorkey);
189   -
190   -
191   - if Result.Count mod 2 <> 0 then
192   - Begin
193   - log_DEBUG('Vetor MemoryDAT com tamanho IMPAR... Ajustando.');
194   - Result.Add('');
195   - End;
196   -end;
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;
199   -var IdFTP : TIdFTP;
200   -begin
201   - Try
202   - IdFTP := TIdFTP.Create(IdFTP);
203   - IdFTP.Host := p_Host;
204   - IdFTP.Username := p_Username;
205   - IdFTP.Password := p_Password;
206   - IdFTP.Port := strtoint(p_Port);
207   - IdFTP.TransferType := ftBinary;
208   - Try
209   - if IdFTP.Connected = true then
210   - begin
211   - IdFTP.Disconnect;
212   - end;
213   - IdFTP.Connect(true);
214   - IdFTP.ChangeDir(p_PathServer);
215   - Try
216   - IdFTP.Get(p_File, p_Dest + '\' + p_File, True);
217   - result := true;
218   - Except
219   - result := false;
220   - End;
221   - Except
222   - result := false;
223   - end;
224   - Except
225   - result := false;
226   - End;
227   -end;
228   -
229   -var strAux : String;
230   -begin
231   - g_oCacic := TCACIC.Create();
232   -
233   - g_oCacic.setBoolCipher(true);
234   -
235   - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) 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
253   - Begin
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;
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)))));
312   - End;
313   -
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   - Sleep(500);
328   - End;
329   - except
330   - end;
331   - End;
332   - End;
333   - g_oCacic.Free();
334   -end.
ini_cols/ini_cols.res
No preview for this file type