Commit 315361afa74f91810a8b48750123ebdade106d2e

Authored by anderson.peterle@previdencia.gov.br
1 parent 2b432a45
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@963 fecfc0c7-e812-0410-ae72-849f08638ee7
col_soft/col_soft.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   --cg
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
col_soft/col_soft.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=1
86   -DebugInfo=0
87   -RemoteSymbols=0
88   -MinStackSize=16384
89   -MaxStackSize=1048576
90   -ImageBase=4194304
91   -ExeDescription=
92   -[Directories]
93   -OutputDir=
94   -UnitOutputDir=
95   -PackageDLLOutputDir=
96   -PackageDCPOutputDir=
97   -SearchPath=
98   -Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOffice2k;MSI_D7_Rtl
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=Coletor de Informações de Softwares Básicos do Sistema CACIC
129   -FileVersion=2.5.0.773
130   -InternalName=
131   -LegalCopyright=
132   -LegalTrademarks=
133   -OriginalFilename=
134   -ProductName=Col_SOFT
135   -ProductVersion=2.6
136   -Comments=Baseado na licença GPL (General Public License)
col_soft/col_soft.dpr
... ... @@ -1,746 +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   -NOTA: O componente MiTeC System Information Component (MSIC) é baseado na classe TComponent e contém alguns subcomponentes baseados na classe TPersistent
17   - Este componente é apenas freeware e não open-source, e foi baixado de http://www.mitec.cz/Downloads/MSIC.zip
18   ----------------------------------------------------------------------------------------------------------------------------------------------------------------
19   -*)
20   -
21   -program col_soft;
22   -{$R *.res}
23   -{$APPTYPE CONSOLE}
24   -uses
25   - Windows,
26   - Classes,
27   - SysUtils,
28   - Registry,
29   - MSI_SOFTWARE,
30   - MSI_ENGINES,
31   - MSI_OS,
32   - MSI_XML_Reports,
33   - CACIC_Library in '..\CACIC_Library.pas';
34   -
35   -var
36   - v_strCipherClosed : String;
37   - v_Debugs : boolean;
38   -
39   -var
40   - v_tstrCipherOpened,
41   - v_tstrCipherOpened1,
42   - tstrTripa1 : TStrings;
43   -
44   -var
45   - intAux : integer;
46   -
47   -var
48   - g_oCacic : TCACIC;
49   -
50   -const
51   - CACIC_APP_NAME = 'col_soft';
52   -
53   -procedure log_diario(strMsg : String);
54   -var
55   - HistoricoLog : TextFile;
56   - strDataArqLocal, strDataAtual : string;
57   -begin
58   - try
59   - FileSetAttr (g_oCacic.getCacicPath + 'cacic2.log',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
60   - AssignFile(HistoricoLog,g_oCacic.getCacicPath + 'cacic2.log'); {Associa o arquivo a uma variável do tipo TextFile}
61   - {$IOChecks off}
62   - Reset(HistoricoLog); {Abre o arquivo texto}
63   - {$IOChecks on}
64   - if (IOResult <> 0) then // Arquivo não existe, será recriado.
65   - begin
66   - Rewrite (HistoricoLog);
67   - Append(HistoricoLog);
68   - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <=======================');
69   - end;
70   - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(g_oCacic.getCacicPath + 'cacic2.log')));
71   - DateTimeToString(strDataAtual , 'yyyymmdd', Date);
72   - if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual...
73   - begin
74   - Rewrite (HistoricoLog); //Cria/Recria o arquivo
75   - Append(HistoricoLog);
76   - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <=======================');
77   - end;
78   - Append(HistoricoLog);
79   - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now)+ '[Coletor SOFT] '+strMsg); {Grava a string Texto no arquivo texto}
80   - CloseFile(HistoricoLog); {Fecha o arquivo texto}
81   - except
82   - log_diario('Erro na gravação do log!');
83   - end;
84   -end;
85   -
86   -Function CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings) : String;
87   -var v_strCipherOpenImploded : string;
88   - v_DatFile : TextFile;
89   -begin
90   - try
91   - FileSetAttr (p_DatFileName,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
92   - AssignFile(v_DatFile,p_DatFileName); {Associa o arquivo a uma variável do tipo TextFile}
93   -
94   - // Criação do arquivo .DAT
95   - Rewrite (v_DatFile);
96   - Append(v_DatFile);
97   -
98   - v_strCipherOpenImploded := g_oCacic.implode(p_tstrCipherOpened,g_oCacic.getSeparatorKey);
99   - v_strCipherClosed := g_oCacic.enCrypt(v_strCipherOpenImploded);
100   -
101   - Writeln(v_DatFile,v_strCipherClosed); {Grava a string Texto no arquivo texto}
102   -
103   - CloseFile(v_DatFile);
104   - except
105   - end;
106   -end;
107   -
108   -Function CipherOpen(p_DatFileName : string) : TStrings;
109   -var v_DatFile : TextFile;
110   - v_strCipherOpened,
111   - v_strCipherClosed : string;
112   -begin
113   - v_strCipherOpened := '';
114   - if FileExists(p_DatFileName) then
115   - begin
116   - AssignFile(v_DatFile,p_DatFileName);
117   - {$IOChecks off}
118   - Reset(v_DatFile);
119   - {$IOChecks on}
120   - if (IOResult <> 0) then // Arquivo não existe, será recriado.
121   - begin
122   - Rewrite (v_DatFile);
123   - Append(v_DatFile);
124   - end;
125   -
126   - Readln(v_DatFile,v_strCipherClosed);
127   - while not EOF(v_DatFile) do Readln(v_DatFile,v_strCipherClosed);
128   - CloseFile(v_DatFile);
129   - v_strCipherOpened:= g_oCacic.deCrypt(v_strCipherClosed);
130   - end;
131   - if (trim(v_strCipherOpened)<>'') then
132   - Result := g_oCacic.explode(v_strCipherOpened,g_oCacic.getSeparatorKey)
133   - else
134   - Result := g_oCacic.explode('Configs.Endereco_WS'+g_oCacic.getSeparatorKey+'/cacic2/ws/',g_oCacic.getSeparatorKey);
135   -
136   - if Result.Count mod 2 <> 0 then
137   - Result.Add('');
138   -end;
139   -
140   -Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String; p_tstrCipherOpened : TStrings);
141   -begin
142   - // Exemplo: p_Chave => Configs.nu_ip_servidor : p_Valor => 10.71.0.120
143   - if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then
144   - p_tstrCipherOpened[v_tstrCipherOpened.IndexOf(p_Chave)+1] := p_Valor
145   - else
146   - Begin
147   - p_tstrCipherOpened.Add(p_Chave);
148   - p_tstrCipherOpened.Add(p_Valor);
149   - End;
150   -end;
151   -
152   -Function GetValorDatMemoria(p_Chave : String; p_tstrCipherOpened : TStrings) : String;
153   -begin
154   - if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then
155   - Result := p_tstrCipherOpened[p_tstrCipherOpened.IndexOf(p_Chave)+1]
156   - else
157   - Result := '';
158   -end;
159   -
160   -function GetFolderDate(Folder: string): TDateTime;
161   -var
162   - Rec: TSearchRec;
163   - Found: Integer;
164   - Date: TDateTime;
165   -begin
166   -
167   - if Folder[Length(folder)] = '\' then
168   - Delete(Folder, Length(folder), 1);
169   - Result := 0;
170   - Found := FindFirst(Folder, faDirectory, Rec);
171   - try
172   - if Found = 0 then
173   - begin
174   - Date := FileDateToDateTime(Rec.Time);
175   - Result := Date;
176   - end;
177   - finally
178   - FindClose(Rec);
179   - end;
180   -end;
181   -
182   -
183   -
184   -// Converte caracteres básicos da tabela Ansi para Ascii
185   -// Solução temporária.
186   -function AnsiToAscii( StrANSI: String ): String;
187   -var i: Integer;
188   - StrASCII, Carac : string;
189   - Letras_ANSI : array[150..255] of String;
190   -begin
191   - Letras_ANSI[150] := ' ';
192   - Letras_ANSI[169] := '©';
193   - Letras_ANSI[174] := '®';
194   - Letras_ANSI[181] := 'µ';
195   - Letras_ANSI[192] := 'A';
196   - Letras_ANSI[193] := 'A';
197   - Letras_ANSI[194] := 'A';
198   - Letras_ANSI[195] := 'A';
199   - Letras_ANSI[196] := 'A';
200   - Letras_ANSI[197] := 'A';
201   - Letras_ANSI[198] := 'A';
202   - Letras_ANSI[199] := 'C';
203   - Letras_ANSI[200] := 'E';
204   - Letras_ANSI[201] := 'E';
205   - Letras_ANSI[202] := 'E';
206   - Letras_ANSI[203] := 'E';
207   - Letras_ANSI[204] := 'I';
208   - Letras_ANSI[205] := 'I';
209   - Letras_ANSI[206] := 'I';
210   - Letras_ANSI[207] := 'I';
211   - Letras_ANSI[208] := 'D';
212   - Letras_ANSI[209] := 'N';
213   - Letras_ANSI[210] := 'O';
214   - Letras_ANSI[211] := 'O';
215   - Letras_ANSI[212] := 'O';
216   - Letras_ANSI[213] := 'O';
217   - Letras_ANSI[214] := 'O';
218   - Letras_ANSI[215] := 'x';
219   - Letras_ANSI[216] := 'O';
220   - Letras_ANSI[217] := 'U';
221   - Letras_ANSI[218] := 'U';
222   - Letras_ANSI[219] := 'U';
223   - Letras_ANSI[220] := 'U';
224   - Letras_ANSI[221] := 'Y';
225   - Letras_ANSI[222] := 'd';
226   - Letras_ANSI[223] := 'b';
227   - Letras_ANSI[224] := 'a';
228   - Letras_ANSI[225] := 'a';
229   - Letras_ANSI[226] := 'a';
230   - Letras_ANSI[227] := 'a';
231   - Letras_ANSI[228] := 'a';
232   - Letras_ANSI[229] := 'a';
233   - Letras_ANSI[230] := 'a';
234   - Letras_ANSI[231] := 'c';
235   - Letras_ANSI[232] := 'e';
236   - Letras_ANSI[233] := 'e';
237   - Letras_ANSI[234] := 'e';
238   - Letras_ANSI[235] := 'e';
239   - Letras_ANSI[236] := 'i';
240   - Letras_ANSI[237] := 'i';
241   - Letras_ANSI[238] := 'i';
242   - Letras_ANSI[239] := 'i';
243   - Letras_ANSI[240] := 'o';
244   - Letras_ANSI[241] := 'n';
245   - Letras_ANSI[242] := 'o';
246   - Letras_ANSI[243] := 'o';
247   - Letras_ANSI[244] := 'o';
248   - Letras_ANSI[245] := 'o';
249   - Letras_ANSI[246] := 'o';
250   - Letras_ANSI[247] := 'o';
251   - Letras_ANSI[248] := 'o';
252   - Letras_ANSI[249] := 'u';
253   - Letras_ANSI[250] := 'u';
254   - Letras_ANSI[251] := 'u';
255   - Letras_ANSI[252] := 'u';
256   - Letras_ANSI[253] := 'y';
257   - Letras_ANSI[254] := 'b';
258   - Letras_ANSI[255] := 'y';
259   -
260   - i := 1;
261   - StrASCII := '';
262   - while (i <= Length(StrANSI)) do
263   - begin
264   - if (Copy(StrANSI,i,2)='&#') then
265   - Begin
266   - Carac := Letras_ANSI[StrToInt(Copy(StrANSI,i+2,3))];
267   - i := i+ 5;
268   - End
269   - else if (Copy(StrANSI,i,4)='&gt;') then
270   - Begin
271   - Carac := '?';
272   - i := i+ 3;
273   - End
274   - else if (Copy(StrANSI,i,6)='&quot;') then
275   - Begin
276   - Carac := '-';
277   - i := i+ 5;
278   - End
279   - else if (Copy(StrANSI,i,6)='&apos;') then
280   - Begin
281   - Carac := '';
282   - i := i+ 5;
283   - End
284   - else if (Copy(StrANSI,i,5)='&amp;') then
285   - Begin
286   - Carac := '';
287   - i := i+ 4;
288   - End
289   - else Carac := Copy(StrANSI,i,1);
290   - StrASCII := StrASCII + Carac;
291   - i := i+1;
292   - End;
293   - Result := StrASCII;
294   -end;
295   -
296   -procedure Grava_Debugs(strMsg : String);
297   -var
298   - DebugsFile : TextFile;
299   - strDataArqLocal, strDataAtual, v_file_debugs : string;
300   -begin
301   - try
302   - v_file_debugs := g_oCacic.getCacicPath + 'Temp\Debugs\debug_'+StringReplace(ExtractFileName(StrUpper(PChar(ParamStr(0)))),'.EXE','',[rfReplaceAll])+'.txt';
303   - FileSetAttr (v_file_debugs,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
304   - AssignFile(DebugsFile,v_file_debugs); {Associa o arquivo a uma variável do tipo TextFile}
305   -
306   - {$IOChecks off}
307   - Reset(DebugsFile); {Abre o arquivo texto}
308   - {$IOChecks on}
309   -
310   - if (IOResult <> 0) then // Arquivo não existe, será recriado.
311   - begin
312   - Rewrite(DebugsFile);
313   - Append(DebugsFile);
314   - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Debug <=======================');
315   - end;
316   - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(v_file_debugs)));
317   - DateTimeToString(strDataAtual , 'yyyymmdd', Date);
318   -
319   - if (strDataAtual <> strDataArqLocal) then // Se o arquivo não é da data atual...
320   - begin
321   - Rewrite(DebugsFile); //Cria/Recria o arquivo
322   - Append(DebugsFile);
323   - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Debug <=======================');
324   - end;
325   -
326   - Append(DebugsFile);
327   - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + strMsg); {Grava a string Texto no arquivo texto}
328   - CloseFile(DebugsFile); {Fecha o arquivo texto}
329   - except
330   - log_diario('Erro na gravação do Debug!');
331   - end;
332   -end;
333   -
334   -Function RemoveCaracteresEspeciais(Texto : String) : String;
335   -var I : Integer;
336   - strAux : String;
337   -Begin
338   - For I := 0 To Length(Texto) Do
339   - if ord(Texto[I]) in [32..126] Then
340   - strAux := strAux + Texto[I]
341   - else strAux := strAux + ' '; // Coloca um espaço onde houver caracteres especiais
342   - Result := strAux;
343   -end;
344   -
345   -
346   -function GetRootKey(strRootKey: String): HKEY;
347   -begin
348   - if Trim(strRootKey) = 'HKEY_LOCAL_MACHINE' Then Result := HKEY_LOCAL_MACHINE
349   - else if Trim(strRootKey) = 'HKEY_CLASSES_ROOT' Then Result := HKEY_CLASSES_ROOT
350   - else if Trim(strRootKey) = 'HKEY_CURRENT_USER' Then Result := HKEY_CURRENT_USER
351   - else if Trim(strRootKey) = 'HKEY_USERS' Then Result := HKEY_USERS
352   - else if Trim(strRootKey) = 'HKEY_CURRENT_CONFIG' Then Result := HKEY_CURRENT_CONFIG
353   - else if Trim(strRootKey) = 'HKEY_DYN_DATA' Then Result := HKEY_DYN_DATA;
354   -end;
355   -
356   -// Função adaptada de http://www.latiumsoftware.com/en/delphi/00004.php
357   -//Para buscar do RegEdit...
358   -function GetValorChaveRegEdit(Chave: String): Variant;
359   -var RegEditGet: TRegistry;
360   - RegDataType: TRegDataType;
361   - strRootKey, strKey, strValue, s: String;
362   - ListaAuxGet : TStrings;
363   - DataSize, Len, I : Integer;
364   -begin
365   - try
366   - Result := '';
367   - ListaAuxGet := g_oCacic.explode(Chave, '\');
368   -
369   - strRootKey := ListaAuxGet[0];
370   - For I := 1 To ListaAuxGet.Count - 2 Do strKey := strKey + ListaAuxGet[I] + '\';
371   - strValue := ListaAuxGet[ListaAuxGet.Count - 1];
372   - if (strValue = '(Padrão)') then strValue := ''; //Para os casos de se querer buscar o valor default (Padrão)
373   - RegEditGet := TRegistry.Create;
374   -
375   - RegEditGet.Access := KEY_READ;
376   - RegEditGet.Rootkey := GetRootKey(strRootKey);
377   - if RegEditGet.OpenKeyReadOnly(strKey) then //teste
378   - Begin
379   - RegDataType := RegEditGet.GetDataType(strValue);
380   - if (RegDataType = rdString) or (RegDataType = rdExpandString) then Result := RegEditGet.ReadString(strValue)
381   - else if RegDataType = rdInteger then Result := RegEditGet.ReadInteger(strValue)
382   - else if (RegDataType = rdBinary) or (RegDataType = rdUnknown)
383   - then
384   - begin
385   - DataSize := RegEditGet.GetDataSize(strValue);
386   - if DataSize = -1 then exit;
387   - SetLength(s, DataSize);
388   - Len := RegEditGet.ReadBinaryData(strValue, PChar(s)^, DataSize);
389   - if Len <> DataSize then exit;
390   - Result := RemoveCaracteresEspeciais(s);
391   - end
392   - end;
393   - finally
394   - RegEditGet.CloseKey;
395   - RegEditGet.Free;
396   - ListaAuxGet.Free;
397   -
398   - end;
399   -end;
400   -
401   -function GetAllEnvVars():String;
402   -var
403   - Variable: Boolean;
404   - Str: PChar;
405   - Res, Retorno: string;
406   -begin
407   - Str :=GetEnvironmentStrings;
408   - Res :='';
409   - Retorno := '';
410   - Variable:=False;
411   - while True do begin
412   - if Str^=#0 then
413   - begin
414   - if Variable then Retorno := Retorno + Res + '#';
415   - Variable:=True;
416   - Inc(Str);
417   - Res:='';
418   - if Str^=#0 then
419   - Break
420   - else
421   - Res:=Res+str^;
422   - end
423   - else
424   - if Variable then Res:=Res+Str^;
425   - Inc(str);
426   - end;
427   - Result := Retorno;
428   -end;
429   -
430   -
431   -
432   -function GetVersaoIE: string;
433   -var strVersao: string;
434   -begin
435   - // Detalhes das versões em http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q164539&
436   - strVersao := '';
437   - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Version'));
438   - Result := strVersao;
439   -end;
440   -
441   -
442   -
443   -function GetVersaoAcrobatReader: String;
444   -var Reg_GVAR : TRegistry;
445   - Lista_GVAR: TStringList;
446   - strChave : String;
447   -Begin
448   - Reg_GVAR := TRegistry.Create;
449   - Reg_GVAR.LazyWrite := False;
450   - Lista_GVAR := TStringList.Create;
451   - Reg_GVAR.Rootkey := HKEY_LOCAL_MACHINE;
452   - strChave := '\Software\Adobe\Acrobat Reader';
453   - Reg_GVAR.OpenKeyReadOnly(strChave);
454   - Reg_GVAR.GetKeyNames(Lista_GVAR);
455   - Reg_GVAR.CloseKey;
456   - If Lista_GVAR.Count > 0 Then
457   - Begin
458   - Lista_GVAR.Sort;
459   - Result := Lista_GVAR.Strings[Lista_GVAR.Count - 1];
460   - end;
461   - Lista_GVAR.Free;
462   - Reg_GVAR.Free;
463   -end;
464   -
465   -function GetVersaoJRE: String;
466   -var strVersao: string;
467   -begin
468   - strVersao := '';
469   - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\CurrentVersion'));
470   - Result := strVersao;
471   -end;
472   -
473   -function GetVersaoMozilla: String;
474   -var strVersao: string;
475   -begin
476   - strVersao := '';
477   - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\mozilla.org\Mozilla\CurrentVersion'));
478   - Result := strVersao;
479   -end;
480   -
481   -procedure Executa_Col_Soft;
482   -var te_versao_mozilla, te_versao_ie, te_versao_jre, te_versao_acrobat_reader,
483   - UVC,ValorChaveRegistro, te_inventario_softwares, te_variaveis_ambiente,
484   - strDisplayName,
485   - strKeyName : String;
486   - InfoSoft, v_Report : TStringList;
487   - i : integer;
488   - v_SOFTWARE : TMiTeC_Software;
489   - v_ENGINES : TMiTeC_Engines;
490   - v_OS : TMiTeC_OperatingSystem;
491   - registrySoftwares : TRegistry;
492   -begin
493   - Try
494   - log_diario('Coletando informações de Softwares Básicos.');
495   - SetValorDatMemoria('Col_Soft.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
496   - te_versao_mozilla := GetVersaoMozilla;
497   - te_versao_ie := GetVersaoIE;
498   - te_versao_jre := GetVersaoJRE;
499   - te_versao_acrobat_reader := GetVersaoAcrobatReader;
500   - te_inventario_softwares := '';
501   - InfoSoft := TStringList.Create;
502   -
503   - if not g_oCacic.isWindowsGEVista then
504   - Begin
505   - Try
506   - v_SOFTWARE := TMiTeC_Software.Create(nil);
507   - v_SOFTWARE.RefreshData;
508   - MSI_XML_Reports.Software_XML_Report(v_SOFTWARE,true,InfoSoft);
509   -
510   - // Caso exista a pasta ..temp/debugs, será criado o arquivo diário debug_<coletor>.txt
511   - // Usar esse recurso apenas para debug de coletas mal-sucedidas através do componente MSI-Mitec.
512   - if v_Debugs then
513   - Begin
514   - v_Report := TStringList.Create;
515   -
516   - MSI_XML_Reports.Software_XML_Report(v_SOFTWARE,true,v_Report);
517   - v_SOFTWARE.Free;
518   -
519   - v_OS := TMiTeC_OperatingSystem.Create(nil);
520   - v_OS.RefreshData;
521   -
522   - MSI_XML_Reports.OperatingSystem_XML_Report(v_OS,true,v_Report);
523   - v_OS.Free;
524   - End
525   -
526   - except
527   - log_diario('Problema em Software Report!');
528   - end;
529   -
530   - for i := 0 to v_SOFTWARE.Count - 1 do
531   - begin
532   - if (trim(Copy(InfoSoft[i],1,14))='<section name=') then
533   - Begin
534   - if (te_inventario_softwares <> '') then
535   - te_inventario_softwares := te_inventario_softwares + '#';
536   - te_inventario_softwares := te_inventario_softwares + Copy(InfoSoft[i],16,Pos('">',InfoSoft[i])-16);
537   - End;
538   - end;
539   -
540   - v_SOFTWARE.Free;
541   - end
542   - else
543   - Begin
544   - // Chave para 64Bits
545   - strKeyName := 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall';
546   -
547   - registrySoftwares := TRegistry.Create;
548   - with registrySoftwares do
549   - begin
550   - RootKey:=HKEY_LOCAL_MACHINE;
551   - if OpenKey(strKeyName,False)=True then GetKeyNames(InfoSoft);
552   - CloseKey;
553   -
554   - for i:=0 to InfoSoft.Count-1 do
555   - begin
556   - RootKey:=HKEY_LOCAL_MACHINE;
557   - OpenKey(strKeyName + '\'+InfoSoft[i],False);
558   - strDisplayName := ReadString('DisplayName');
559   - if (strDisplayName <> '') then
560   - Begin
561   - if (Copy(strDisplayName,1,1)='{') then
562   - begin
563   - OpenKey(strKeyName + '\'+InfoSoft[i]+'\'+strDisplayName,False);
564   - strDisplayName := ReadString('DisplayName');
565   - end;
566   -
567   - if (te_inventario_softwares <> '') then
568   - te_inventario_softwares := te_inventario_softwares + '#';
569   - te_inventario_softwares := te_inventario_softwares + strDisplayName;
570   - end;
571   - CloseKey;
572   - end;
573   - end;
574   -
575   - // Caso a consulta acima tenha retornado vazio, tentarei a chave para 32Bits
576   - strKeyName := 'Software\Microsoft\Windows\CurrentVersion\Uninstall';
577   -
578   - with registrySoftwares do
579   - begin
580   - RootKey:=HKEY_LOCAL_MACHINE;
581   - if OpenKey(strKeyName,False)=True then GetKeyNames(InfoSoft);
582   - CloseKey;
583   -
584   - for i:=0 to InfoSoft.Count-1 do
585   - begin
586   - RootKey:=HKEY_LOCAL_MACHINE;
587   - OpenKey(strKeyName + '\'+InfoSoft[i],False);
588   - strDisplayName := ReadString('DisplayName');
589   - if (strDisplayName <> '') then
590   - Begin
591   - if (Copy(strDisplayName,1,1)='{') then
592   - begin
593   - OpenKey(strKeyName + '\'+InfoSoft[i]+'\'+strDisplayName,False);
594   - strDisplayName := ReadString('DisplayName');
595   - end;
596   -
597   - if (te_inventario_softwares <> '') then
598   - te_inventario_softwares := te_inventario_softwares + '#';
599   - te_inventario_softwares := te_inventario_softwares + strDisplayName;
600   - end;
601   - CloseKey;
602   - end;
603   - end;
604   -
605   - //
606   - end;
607   -
608   - try
609   - te_inventario_softwares := AnsiToAscii(te_inventario_softwares);
610   - except
611   - log_diario('Falha após a Conversão ANSIxASCII');
612   - end;
613   -
614   - InfoSoft.Free;
615   -
616   - // Pego todas as variáveis de ambiente.
617   - te_variaveis_ambiente := GetAllEnvVars();
618   -
619   - v_ENGINES := TMiTeC_Engines.Create(nil);
620   - v_ENGINES.RefreshData;
621   -
622   - // Caso exista a pasta ..temp/debugs, será criado o arquivo diário debug_<coletor>.txt
623   - // Usar esse recurso apenas para debug de coletas mal-sucedidas através do componente MSI-Mitec.
624   - if (v_Debugs) then
625   - Begin
626   - MSI_XML_Reports.Engines_XML_Report(v_ENGINES,true,v_Report);
627   - End;
628   -
629   - // Monto a string que será comparada com o valor armazenado no registro.
630   - UVC := v_Engines.ODBC + ';' +
631   - v_Engines.BDE + ';' +
632   - v_Engines.DAO + ';' +
633   - v_Engines.ADO + ';' +
634   - v_Engines.DirectX.Version + ';' +
635   - te_versao_mozilla + ';' +
636   - te_versao_ie + ';' +
637   - te_versao_acrobat_reader + ';' +
638   - te_versao_jre + ';' +
639   - te_inventario_softwares +
640   - te_variaveis_ambiente;
641   -
642   -
643   - // Obtenho do registro o valor que foi previamente armazenado
644   - ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Software',v_tstrCipherOpened));
645   -
646   - SetValorDatMemoria('Col_Soft.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);
647   -
648   - // Se essas informações forem diferentes significa que houve alguma alteração
649   - // na configuração. Nesse caso, gravo as informações no BD Central
650   - // e, se não houver problemas durante esse procedimento, atualizo as
651   - // informações no registro.
652   - If (GetValorDatMemoria('Configs.IN_COLETA_FORCADA_SOFT',v_tstrCipherOpened)='S') or
653   - (UVC <> ValorChaveRegistro) Then
654   - Begin
655   - //Envio via rede para ao Agente Gerente, para gravação no BD.
656   - SetValorDatMemoria('Col_Soft.te_versao_bde' , v_ENGINES.BDE , v_tstrCipherOpened1);
657   - SetValorDatMemoria('Col_Soft.te_versao_dao' , v_ENGINES.DAO , v_tstrCipherOpened1);
658   - SetValorDatMemoria('Col_Soft.te_versao_ado' , v_ENGINES.ADO , v_tstrCipherOpened1);
659   - SetValorDatMemoria('Col_Soft.te_versao_odbc' , v_ENGINES.ODBC , v_tstrCipherOpened1);
660   - SetValorDatMemoria('Col_Soft.te_versao_directx' , v_ENGINES.DirectX.Version, v_tstrCipherOpened1);
661   - SetValorDatMemoria('Col_Soft.te_versao_acrobat_reader', te_versao_acrobat_reader , v_tstrCipherOpened1);
662   - SetValorDatMemoria('Col_Soft.te_versao_ie' , te_versao_ie , v_tstrCipherOpened1);
663   - SetValorDatMemoria('Col_Soft.te_versao_mozilla' , te_versao_mozilla , v_tstrCipherOpened1);
664   - SetValorDatMemoria('Col_Soft.te_versao_jre' , te_versao_jre , v_tstrCipherOpened1);
665   - SetValorDatMemoria('Col_Soft.te_inventario_softwares' , te_inventario_softwares , v_tstrCipherOpened1);
666   - SetValorDatMemoria('Col_Soft.te_variaveis_ambiente' , te_variaveis_ambiente , v_tstrCipherOpened1);
667   - SetValorDatMemoria('Col_Soft.UVC' , UVC , v_tstrCipherOpened1);
668   - CipherClose(g_oCacic.getCacicPath + 'temp\col_soft.dat', v_tstrCipherOpened1);
669   - end
670   - else
671   - Begin
672   - SetValorDatMemoria('Col_Soft.nada', 'nada', v_tstrCipherOpened1);
673   - CipherClose(g_oCacic.getCacicPath + 'temp\col_soft.dat', v_tstrCipherOpened1);
674   - End;
675   - v_ENGINES.Free;
676   -
677   - // Caso exista a pasta ..temp/debugs, será criado o arquivo diário debug_<coletor>.txt
678   - // Usar esse recurso apenas para debug de coletas mal-sucedidas através do componente MSI-Mitec.
679   - if v_Debugs then
680   - Begin
681   - for i:=0 to v_Report.count-1 do
682   - Begin
683   - Grava_Debugs(v_report[i]);
684   - End;
685   - v_report.Free;
686   - End;
687   - Except
688   - Begin
689   - SetValorDatMemoria('Col_Soft.nada', 'nada', v_tstrCipherOpened1);
690   - SetValorDatMemoria('Col_Soft.Fim' , '99999999', v_tstrCipherOpened1);
691   - CipherClose(g_oCacic.getCacicPath + 'temp\col_soft.dat', v_tstrCipherOpened1);
692   - End;
693   - End;
694   -end;
695   -
696   -var strAux : String;
697   -begin
698   - g_oCacic := TCACIC.Create();
699   -
700   - g_oCacic.setBoolCipher(true);
701   -
702   - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then
703   - if (ParamCount>0) then
704   - Begin
705   - strAux := '';
706   - For intAux := 1 to ParamCount do
707   - Begin
708   - if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then
709   - begin
710   - strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux)))));
711   - end;
712   - end;
713   -
714   - if (strAux <> '') then
715   - Begin
716   - g_oCacic.setCacicPath(strAux);
717   -
718   - v_tstrCipherOpened := TStrings.Create;
719   - v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName);
720   -
721   - v_tstrCipherOpened1 := TStrings.Create;
722   - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_soft.dat');
723   -
724   - Try
725   - v_Debugs := false;
726   -
727   - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then
728   - Begin
729   - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then
730   - Begin
731   - v_Debugs := true;
732   - log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.');
733   - End;
734   - End;
735   -
736   - Executa_Col_Soft;
737   - Except
738   - SetValorDatMemoria('Col_Soft.nada', 'nada', v_tstrCipherOpened1);
739   - CipherClose(g_oCacic.getCacicPath + 'temp\col_soft.dat', v_tstrCipherOpened1);
740   - End;
741   - End;
742   - End;
743   -
744   - g_oCacic.Free();
745   -
746   -end.
col_soft/col_soft.res
No preview for this file type
col_soft/col_soft_icon.ico
No preview for this file type
col_soft/coleta_software.pas
... ... @@ -1,258 +0,0 @@
1   -unit coleta_software;
2   -
3   -interface
4   -
5   -uses Windows, SysUtils, Classes, registry;
6   -
7   -function GetWinVer: Integer;
8   -function GetVersaoIE: string;
9   -function GetVersaoJRE: String;
10   -function GetVersaoAcrobatReader: String;
11   -function GetVersaoMozilla: String;
12   -procedure RealizarColetaSoftware;
13   -procedure RealizarColetaSoftwareNaoOpcional;
14   -
15   -implementation
16   -
17   -Uses registro, main, comunicacao, utils;
18   -
19   -
20   -function GetWinVer: Integer;
21   -const
22   - { operating system (OS)constants }
23   - cOsUnknown = 0;
24   - cOsWin95 = 1;
25   - cOsWin95OSR2 = 2; // Não implementado.
26   - cOsWin98 = 3;
27   - cOsWin98SE = 4;
28   - cOsWinME = 5;
29   - cOsWinNT = 6;
30   - cOsWin2000 = 7;
31   - cOsXP = 8;
32   -var
33   - osVerInfo: TOSVersionInfo;
34   - majorVer, minorVer: Integer;
35   -begin
36   -
37   -
38   -
39   -{ Memo1.Lines.Add(OSVersion);
40   - Memo1.Lines.Add(CSD);
41   - Memo1.Lines.Add(Format('%d.%d.%d',[MSystemInfo.OS.MajorVersion,MSystemInfo.OS.MinorVersion,MSystemInfo.OS.BuildNumber]));
42   - Memo1.Lines.Add(MSystemInfo.OS.NTSpecific.HotFixes);
43   - Memo1.Lines.Add(MSystemInfo.OS.Version);
44   - Memo1.Lines.Add(MSystemInfo.OS.CSDEx);
45   - Memo1.Lines.Add(MSystemInfo.OS.ProductID);
46   - Memo1.Lines.Add(MSystemInfo.os.LanguageID);
47   -
48   -}
49   - Result := cOsUnknown;
50   - { set operating system type flag }
51   - osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
52   - if GetVersionEx(osVerInfo) then
53   - begin
54   - majorVer := osVerInfo.dwMajorVersion;
55   - minorVer := osVerInfo.dwMinorVersion;
56   - case osVerInfo.dwPlatformId of
57   - VER_PLATFORM_WIN32_NT: { Windows NT/2000 }
58   - begin
59   - if majorVer <= 4 then
60   - Result := cOsWinNT
61   - else if (majorVer = 5) and (minorVer = 0) then
62   - Result := cOsWin2000
63   - else if (majorVer = 5) and (minorVer = 1) then
64   - Result := cOsXP
65   - else
66   - Result := cOsUnknown;
67   - end;
68   - VER_PLATFORM_WIN32_WINDOWS: { Windows 9x/ME }
69   - begin
70   - if (majorVer = 4) and (minorVer = 0) then
71   - Result := cOsWin95
72   - else if (majorVer = 4) and (minorVer = 10) then
73   - begin
74   - if osVerInfo.szCSDVersion[1] = 'A' then
75   - Result := cOsWin98SE
76   - else
77   - Result := cOsWin98;
78   - end
79   - else if (majorVer = 4) and (minorVer = 90) then
80   - Result := cOsWinME
81   - else
82   - Result := cOsUnknown;
83   - end;
84   - else
85   - Result := cOsUnknown;
86   - end;
87   - end
88   - else
89   - Result := cOsUnknown;
90   -end;
91   -
92   -
93   -function GetVersaoIE: string;
94   -var strVersao: string;
95   -begin
96   - // Detalhes das versões em http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q164539&
97   - strVersao := '';
98   - strVersao := Trim(Registro.GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Version'));
99   - Result := strVersao;
100   -end;
101   -
102   -
103   -
104   -function GetVersaoAcrobatReader: String;
105   -var Reg_GVAR : TRegistry;
106   - Lista_GVAR: TStringList;
107   - strChave : String;
108   -Begin
109   - Reg_GVAR := TRegistry.Create;
110   - Reg_GVAR.LazyWrite := False;
111   - Lista_GVAR := TStringList.Create;
112   - Reg_GVAR.Rootkey := HKEY_LOCAL_MACHINE;
113   - strChave := '\Software\Adobe\Acrobat Reader';
114   - Reg_GVAR.OpenKeyReadOnly(strChave);
115   - Reg_GVAR.GetKeyNames(Lista_GVAR);
116   - Reg_GVAR.CloseKey;
117   - If Lista_GVAR.Count > 0 Then
118   - Begin
119   - Lista_GVAR.Sort;
120   - Result := Lista_GVAR.Strings[Lista_GVAR.Count - 1];
121   - end;
122   - Lista_GVAR.Free;
123   - Reg_GVAR.Free;
124   -end;
125   -
126   -
127   -
128   -
129   -function GetVersaoJRE: String;
130   -var strVersao: string;
131   -begin
132   - strVersao := '';
133   - strVersao := Trim(Registro.GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\CurrentVersion'));
134   - Result := strVersao;
135   -end;
136   -
137   -
138   -function GetVersaoMozilla: String;
139   -var strVersao: string;
140   -begin
141   - strVersao := '';
142   - strVersao := Trim(Registro.GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\mozilla.org\Mozilla\CurrentVersion'));
143   - Result := strVersao;
144   -end;
145   -
146   -
147   -
148   -procedure RealizarColetaSoftware;
149   -var Request_RCS: TStringList;
150   - te_versao_mozilla, te_versao_ie, te_versao_jre, te_versao_acrobat_reader,
151   - ValorChaveColetado, ValorChaveRegistro : String;
152   -begin
153   - if (CS_COLETA_SOFTWARE) Then
154   - Begin
155   - main.frmMain.Log_Historico('* Coletando informações de software.');
156   - Try main.frmMain.MSystemInfo.Engines.GetInfo; except end;
157   -
158   - te_versao_mozilla := GetVersaoMozilla;
159   - te_versao_ie := GetVersaoIE;
160   - te_versao_jre := GetVersaoJRE;
161   - te_versao_acrobat_reader := GetVersaoAcrobatReader;
162   -
163   -
164   - // Monto a string que será comparada com o valor armazenado no registro.
165   - ValorChaveColetado := main.frmMain.MSystemInfo.Engines.ODBC + ';' +
166   - main.frmMain.MSystemInfo.Engines.BDE + ';' +
167   - main.frmMain.MSystemInfo.Engines.DAO + ';' +
168   - main.frmMain.MSystemInfo.Engines.ADO + ';' +
169   - main.frmMain.MSystemInfo.Engines.DirectX.Version + ';' +
170   - te_versao_mozilla + ';' +
171   - te_versao_ie + ';' +
172   - te_versao_acrobat_reader + ';' +
173   - te_versao_jre;
174   -
175   - // Obtenho do registro o valor que foi previamente armazenado
176   - ValorChaveRegistro := Trim(Registro.GetValorChaveRegIni('Coleta','Software',p_path_cacic_ini));
177   -
178   - // Se essas informações forem diferentes significa que houve alguma alteração
179   - // na configuração. Nesse caso, gravo as informações no BD Central
180   - // e, se não houver problemas durante esse procedimento, atualizo as
181   - // informações no registro.
182   - If (IN_COLETA_FORCADA or (ValorChaveColetado <> ValorChaveRegistro)) Then
183   - Begin
184   - //Envio via rede para ao Agente Gerente, para gravação no BD.
185   - Request_RCS:=TStringList.Create;
186   - Request_RCS.Values['te_node_address'] := TE_NODE_ADDRESS;
187   - Request_RCS.Values['id_so'] := ID_SO;
188   - Request_RCS.Values['te_nome_computador'] := TE_NOME_COMPUTADOR;
189   - Request_RCS.Values['te_versao_bde'] := main.frmMain.MSystemInfo.Engines.BDE;
190   - Request_RCS.Values['te_versao_dao'] := main.frmMain.MSystemInfo.Engines.DAO ;
191   - Request_RCS.Values['te_versao_ado'] := main.frmMain.MSystemInfo.Engines.ADO;
192   - Request_RCS.Values['te_versao_odbc'] := main.frmMain.MSystemInfo.Engines.ODBC;
193   - Request_RCS.Values['te_versao_directx'] := main.frmMain.MSystemInfo.Engines.DirectX.Version;
194   - Request_RCS.Values['te_versao_acrobat_reader'] := te_versao_acrobat_reader;
195   - Request_RCS.Values['te_versao_ie'] := te_versao_ie;
196   - Request_RCS.Values['te_versao_mozilla'] := te_versao_mozilla;
197   - Request_RCS.Values['te_versao_jre'] := te_versao_jre;
198   -
199   - // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD
200   - //Sobreponho a informação no registro para posterior comparação, na próxima execução.
201   - if (comunicacao.ComunicaServidor('set_software.php', Request_RCS, '>> Enviando informações de software para o servidor.') <> '0') Then
202   - Begin
203   - Registro.SetValorChaveRegIni('Coleta','Software', ValorChaveColetado,p_path_cacic_ini);
204   - end;
205   - Request_RCS.Free;
206   - end;
207   - end
208   - else main.frmMain.Log_Historico('Coleta de informações de software não configurada.');
209   -end;
210   -
211   -
212   -
213   -
214   -
215   -
216   -// Essa coleta não é opcional, ou seja, o administrador não tem como desabilitá-la.
217   -// Por isso foi necessário criá-la de forma independente da procedure RealizarColetaSoftware.
218   -procedure RealizarColetaSoftwareNaoOpcional;
219   -var Request_RCSN: TStringList;
220   - te_versao_cacic, ValorChaveColetado, ValorChaveRegistro : String;
221   -begin
222   -
223   - main.frmMain.Log_Historico('* Coletando informações básicas de software.');
224   - te_versao_cacic := utils.getVersionInfo(ParamStr(0));
225   -
226   - // Monto a string que será comparada com o valor armazenado no registro.
227   - ValorChaveColetado := te_versao_cacic;
228   -
229   - // Obtenho do registro o valor que foi previamente armazenado
230   - ValorChaveRegistro := Trim(Registro.GetValorChaveRegIni('Coleta','SoftwareNaoOpcional',p_path_cacic_ini));
231   -
232   - // Se essas informações forem diferentes significa que houve alguma alteração
233   - // na configuração. Nesse caso, gravo as informações no BD Central
234   - // e, se não houver problemas durante esse procedimento, atualizo as
235   - // informações no registro.
236   -
237   - If (IN_COLETA_FORCADA or (ValorChaveColetado <> ValorChaveRegistro)) Then
238   - Begin
239   - //Envio via rede para ao Agente Gerente, para gravação no BD.
240   - Request_RCSN:=TStringList.Create;
241   - Request_RCSN.Values['te_node_address'] := TE_NODE_ADDRESS;
242   - Request_RCSN.Values['id_so'] := ID_SO;
243   - Request_RCSN.Values['te_nome_computador'] := TE_NOME_COMPUTADOR;
244   - Request_RCSN.Values['te_versao_cacic'] := te_versao_cacic;
245   -
246   - // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD
247   - //Sobreponho a informação no registro para posterior comparação, na próxima execução.
248   - if (comunicacao.ComunicaServidor('set_software_nao_opcional.php', Request_RCSN, '>> Enviando informações básicas de software para o servidor.') <> '0') Then
249   - Begin
250   - Registro.SetValorChaveRegIni('Coleta','SoftwareNaoOpcional', ValorChaveColetado,p_path_cacic_ini);
251   - end;
252   - Request_RCSN.Free;
253   - end;
254   -end;
255   -
256   -
257   -
258   -end.
col_soft/main_soft.ddp
No preview for this file type
col_soft/main_soft.dfm
... ... @@ -1,22 +0,0 @@
1   -object frm_col_soft: Tfrm_col_soft
2   - Left = 910
3   - Top = 714
4   - Width = 112
5   - Height = 27
6   - Caption = 'CACIC - Coletor Software'
7   - Color = clBtnFace
8   - Font.Charset = DEFAULT_CHARSET
9   - Font.Color = clWindowText
10   - Font.Height = -11
11   - Font.Name = 'MS Sans Serif'
12   - Font.Style = []
13   - OldCreateOrder = False
14   - OnCreate = FormCreate
15   - PixelsPerInch = 96
16   - TextHeight = 13
17   - object MSystemInfo1: TMSystemInfo
18   - ExceptionModes = [emDefault]
19   - Left = 120
20   - Top = 96
21   - end
22   -end
col_soft/main_soft.pas
... ... @@ -1,458 +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   -NOTA: O componente MiTeC System Information Component (MSIC) é baseado na classe TComponent e contém alguns subcomponentes baseados na classe TPersistent
17   - Este componente é apenas freeware e não open-source, e foi baixado de http://www.mitec.cz/Downloads/MSIC.zip
18   ----------------------------------------------------------------------------------------------------------------------------------------------------------------
19   -*)
20   -
21   -unit main_soft;
22   -
23   -interface
24   -
25   -uses Windows, IniFiles, Forms, Classes, SysUtils, Registry, MSI_GUI;
26   -var p_path_cacic, p_path_cacic_ini : string;
27   -
28   -type
29   - Tfrm_col_soft = class(TForm)
30   - MSystemInfo1: TMSystemInfo;
31   - procedure FormCreate(Sender: TObject);
32   - private
33   - procedure Executa_Col_Soft;
34   - procedure Log_Historico(strMsg : String);
35   - function GetAllEnvVars():String;
36   - function SetValorChaveRegIni(p_Secao: String; p_Chave: String; p_Valor: String; p_Path : String): String;
37   - Function Crip(PNome: String): String;
38   - Function DesCrip(PNome: String): String;
39   - function GetValorChaveRegIni(p_SectionName, p_KeyName, p_IniFileName : String) : String;
40   - function GetValorChaveRegEdit(Chave: String): Variant;
41   - Function Explode(Texto, Separador : String) : TStrings;
42   - Function GetRootKey(strRootKey: String): HKEY;
43   - Function RemoveCaracteresEspeciais(Texto : String) : String;
44   - function GetVersaoIE: string;
45   - function GetVersaoAcrobatReader: String;
46   - function GetVersaoJRE: String;
47   - function GetVersaoMozilla: String;
48   - public
49   - { Public declarations }
50   - end;
51   -
52   -var
53   - frm_col_soft: Tfrm_col_soft;
54   -
55   -implementation
56   -
57   -uses StrUtils;
58   -
59   -{$R *.dfm}
60   -
61   -function Tfrm_col_soft.GetAllEnvVars():String;
62   -var
63   - Variable: Boolean;
64   - Str: PChar;
65   - Res, Retorno: string;
66   -begin
67   - Str :=GetEnvironmentStrings;
68   - Res :='';
69   - Retorno := '';
70   - Variable:=False;
71   - while True do begin
72   - if Str^=#0 then
73   - begin
74   - if Variable then Retorno := Retorno + Res + '#';
75   - Variable:=True;
76   - Inc(Str);
77   - Res:='';
78   - if Str^=#0 then
79   - Break
80   - else
81   - Res:=Res+str^;
82   - end
83   - else
84   - if Variable then Res:=Res+Str^;
85   - Inc(str);
86   - end;
87   - Result := Retorno;
88   -end;
89   -
90   -
91   -//Para gravar no Arquivo INI...
92   -function Tfrm_col_soft.SetValorChaveRegIni(p_Secao: String; p_Chave: String; p_Valor: String; p_Path : String): String;
93   -var Reg_Ini : TIniFile;
94   -begin
95   - FileSetAttr (p_Path,0);
96   - Reg_Ini := TIniFile.Create(p_Path);
97   -// Reg_Ini.WriteString(frm_col_soft.Crip(p_Secao), frm_col_soft.Crip(p_Chave), frm_col_soft.Crip(p_Valor));
98   - Reg_Ini.WriteString(p_Secao, p_Chave, p_Valor);
99   - Reg_Ini.Free;
100   -end;
101   -
102   -//Para buscar do Arquivo INI...
103   -// Marreta devido a limitações do KERNEL w9x no tratamento de arquivos texto e suas seções
104   -function Tfrm_col_soft.GetValorChaveRegIni(p_SectionName, p_KeyName, p_IniFileName : String) : String;
105   -var
106   - FileText : TStringList;
107   - i, j, v_Size_Section, v_Size_Key : integer;
108   - v_SectionName, v_KeyName : string;
109   - begin
110   - Result := '';
111   - v_SectionName := '[' + p_SectionName + ']';
112   - v_Size_Section := strLen(PChar(v_SectionName));
113   - v_KeyName := p_KeyName + '=';
114   - v_Size_Key := strLen(PChar(v_KeyName));
115   - FileText := TStringList.Create;
116   - try
117   - FileText.LoadFromFile(p_IniFileName);
118   - For i := 0 To FileText.Count - 1 Do
119   - Begin
120   - if (LowerCase(Trim(PChar(Copy(FileText[i],1,v_Size_Section)))) = LowerCase(Trim(PChar(v_SectionName)))) then
121   - Begin
122   - For j := i to FileText.Count - 1 Do
123   - Begin
124   - if (LowerCase(Trim(PChar(Copy(FileText[j],1,v_Size_Key)))) = LowerCase(Trim(PChar(v_KeyName)))) then
125   - Begin
126   - Result := PChar(Copy(FileText[j],v_Size_Key + 1,strLen(PChar(FileText[j]))-v_Size_Key));
127   - Break;
128   - End;
129   - End;
130   - End;
131   - if (Result <> '') then break;
132   - End;
133   - finally
134   - FileText.Free;
135   - end;
136   - end;
137   -
138   -
139   -Function Tfrm_col_soft.Explode(Texto, Separador : String) : TStrings;
140   -var
141   - strItem : String;
142   - ListaAuxUTILS : TStrings;
143   - NumCaracteres, I : Integer;
144   -Begin
145   - ListaAuxUTILS := TStringList.Create;
146   - strItem := '';
147   - NumCaracteres := Length(Texto);
148   - For I := 0 To NumCaracteres Do
149   - If (Texto[I] = Separador) or (I = NumCaracteres) Then
150   - Begin
151   - If (I = NumCaracteres) then strItem := strItem + Texto[I];
152   - ListaAuxUTILS.Add(Trim(strItem));
153   - strItem := '';
154   - end
155   - Else strItem := strItem + Texto[I];
156   - Explode := ListaAuxUTILS;
157   -end;
158   -
159   -function Tfrm_col_soft.GetRootKey(strRootKey: String): HKEY;
160   -begin
161   - if Trim(strRootKey) = 'HKEY_LOCAL_MACHINE' Then Result := HKEY_LOCAL_MACHINE
162   - else if Trim(strRootKey) = 'HKEY_CLASSES_ROOT' Then Result := HKEY_CLASSES_ROOT
163   - else if Trim(strRootKey) = 'HKEY_CURRENT_USER' Then Result := HKEY_CURRENT_USER
164   - else if Trim(strRootKey) = 'HKEY_USERS' Then Result := HKEY_USERS
165   - else if Trim(strRootKey) = 'HKEY_CURRENT_CONFIG' Then Result := HKEY_CURRENT_CONFIG
166   - else if Trim(strRootKey) = 'HKEY_DYN_DATA' Then Result := HKEY_DYN_DATA;
167   -end;
168   -
169   -Function Tfrm_col_soft.RemoveCaracteresEspeciais(Texto : String) : String;
170   -var I : Integer;
171   - strAux : String;
172   -Begin
173   - For I := 0 To Length(Texto) Do
174   - if ord(Texto[I]) in [32..126] Then
175   - strAux := strAux + Texto[I]
176   - else strAux := strAux + ' '; // Coloca um espaço onde houver caracteres especiais
177   - Result := strAux;
178   -end;
179   -
180   -
181   -
182   -function Tfrm_col_soft.GetVersaoIE: string;
183   -var strVersao: string;
184   -begin
185   - // Detalhes das versões em http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q164539&
186   - strVersao := '';
187   - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Version'));
188   - Result := strVersao;
189   -end;
190   -
191   -// Função adaptada de http://www.latiumsoftware.com/en/delphi/00004.php
192   -//Para buscar do RegEdit...
193   -function Tfrm_col_soft.GetValorChaveRegEdit(Chave: String): Variant;
194   -var RegEditGet: TRegistry;
195   - RegDataType: TRegDataType;
196   - strRootKey, strKey, strValue, s: String;
197   - ListaAuxGet : TStrings;
198   - DataSize, Len, I : Integer;
199   -begin
200   - try
201   - Result := '';
202   - ListaAuxGet := Explode(Chave, '\');
203   -
204   - strRootKey := ListaAuxGet[0];
205   - For I := 1 To ListaAuxGet.Count - 2 Do strKey := strKey + ListaAuxGet[I] + '\';
206   - strValue := ListaAuxGet[ListaAuxGet.Count - 1];
207   - if (strValue = '(Padrão)') then strValue := ''; //Para os casos de se querer buscar o valor default (Padrão)
208   - RegEditGet := TRegistry.Create;
209   -
210   - RegEditGet.Access := KEY_READ;
211   - RegEditGet.Rootkey := GetRootKey(strRootKey);
212   - if RegEditGet.OpenKeyReadOnly(strKey) then //teste
213   - Begin
214   - RegDataType := RegEditGet.GetDataType(strValue);
215   - if (RegDataType = rdString) or (RegDataType = rdExpandString) then Result := RegEditGet.ReadString(strValue)
216   - else if RegDataType = rdInteger then Result := RegEditGet.ReadInteger(strValue)
217   - else if (RegDataType = rdBinary) or (RegDataType = rdUnknown)
218   - then
219   - begin
220   - DataSize := RegEditGet.GetDataSize(strValue);
221   - if DataSize = -1 then exit;
222   - SetLength(s, DataSize);
223   - Len := RegEditGet.ReadBinaryData(strValue, PChar(s)^, DataSize);
224   - if Len <> DataSize then exit;
225   - Result := RemoveCaracteresEspeciais(s);
226   - end
227   - end;
228   - finally
229   - RegEditGet.CloseKey;
230   - RegEditGet.Free;
231   - ListaAuxGet.Free;
232   -
233   - end;
234   -end;
235   -
236   -
237   -function Tfrm_col_soft.GetVersaoAcrobatReader: String;
238   -var Reg_GVAR : TRegistry;
239   - Lista_GVAR: TStringList;
240   - strChave : String;
241   -Begin
242   - Reg_GVAR := TRegistry.Create;
243   - Reg_GVAR.LazyWrite := False;
244   - Lista_GVAR := TStringList.Create;
245   - Reg_GVAR.Rootkey := HKEY_LOCAL_MACHINE;
246   - strChave := '\Software\Adobe\Acrobat Reader';
247   - Reg_GVAR.OpenKeyReadOnly(strChave);
248   - Reg_GVAR.GetKeyNames(Lista_GVAR);
249   - Reg_GVAR.CloseKey;
250   - If Lista_GVAR.Count > 0 Then
251   - Begin
252   - Lista_GVAR.Sort;
253   - Result := Lista_GVAR.Strings[Lista_GVAR.Count - 1];
254   - end;
255   - Lista_GVAR.Free;
256   - Reg_GVAR.Free;
257   -end;
258   -
259   -function Tfrm_col_soft.GetVersaoJRE: String;
260   -var strVersao: string;
261   -begin
262   - strVersao := '';
263   - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\CurrentVersion'));
264   - Result := strVersao;
265   -end;
266   -
267   -function Tfrm_col_soft.GetVersaoMozilla: String;
268   -var strVersao: string;
269   -begin
270   - strVersao := '';
271   - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\mozilla.org\Mozilla\CurrentVersion'));
272   - Result := strVersao;
273   -end;
274   -
275   -procedure Tfrm_col_soft.Executa_Col_Soft;
276   -var te_versao_mozilla, te_versao_ie, te_versao_jre, te_versao_acrobat_reader,
277   - ValorChaveColetado,ValorChaveRegistro, te_inventario_softwares, te_variaveis_ambiente : String;
278   - InfoSoft : TStringList;
279   - i : integer;
280   -begin
281   - Try
282   - Log_Historico('* Coletando informações de Softwares Básicos.');
283   -
284   - Try MSystemInfo1.Engines.GetInfo; except end;
285   - te_versao_mozilla := GetVersaoMozilla;
286   - te_versao_ie := GetVersaoIE;
287   - te_versao_jre := GetVersaoJRE;
288   - te_versao_acrobat_reader := GetVersaoAcrobatReader;
289   -
290   - Try MSystemInfo1.Software.GetInfo; except end;
291   - InfoSoft := TStringList.Create;
292   - Try MSystemInfo1.Software.Report(InfoSoft,false); except end;
293   -
294   - for i := 0 to InfoSoft.Count - 1 do
295   - begin
296   - if (trim(MidStr(InfoSoft[i],13,Pos('type=',InfoSoft[i])-15))<>'') then
297   - Begin
298   - if (te_inventario_softwares <> '') then te_inventario_softwares := te_inventario_softwares + '#';
299   - te_inventario_softwares := te_inventario_softwares + MidStr(InfoSoft[i],13,Pos('type=',InfoSoft[i])-15);
300   - End;
301   - end;
302   - InfoSoft.Free;
303   -
304   - // Pego todas as variáveis de ambiente.
305   - te_variaveis_ambiente := GetAllEnvVars();
306   -
307   - // Monto a string que será comparada com o valor armazenado no registro.
308   - ValorChaveColetado := MSystemInfo1.Engines.ODBC + ';' +
309   - MSystemInfo1.Engines.BDE + ';' +
310   - MSystemInfo1.Engines.DAO + ';' +
311   - MSystemInfo1.Engines.ADO + ';' +
312   - MSystemInfo1.Engines.DirectX.Version + ';' +
313   - te_versao_mozilla + ';' +
314   - te_versao_ie + ';' +
315   - te_versao_acrobat_reader + ';' +
316   - te_versao_jre + ';' +
317   - te_inventario_softwares +
318   - te_variaveis_ambiente;
319   -
320   - // Obtenho do registro o valor que foi previamente armazenado
321   - ValorChaveRegistro := Trim(GetValorChaveRegIni('Coleta','Software',p_path_cacic_ini));
322   -
323   -
324   - // Se essas informações forem diferentes significa que houve alguma alteração
325   - // na configuração. Nesse caso, gravo as informações no BD Central
326   - // e, se não houver problemas durante esse procedimento, atualizo as
327   - // informações no registro.
328   - If (GetValorChaveRegIni('Configs','IN_COLETA_FORCADA_SOFT',p_path_cacic_ini)='S') or
329   - (ValorChaveColetado <> ValorChaveRegistro) Then
330   - Begin
331   - //Envio via rede para ao Agente Gerente, para gravação no BD.
332   - frm_col_soft.SetValorChaveRegIni('Col_Soft','te_versao_bde' , frm_col_soft.MSystemInfo1.Engines.BDE , frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
333   - frm_col_soft.SetValorChaveRegIni('Col_Soft','te_versao_dao' , frm_col_soft.MSystemInfo1.Engines.DAO , frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
334   - frm_col_soft.SetValorChaveRegIni('Col_Soft','te_versao_ado' , frm_col_soft.MSystemInfo1.Engines.ADO , frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
335   - frm_col_soft.SetValorChaveRegIni('Col_Soft','te_versao_odbc' , frm_col_soft.MSystemInfo1.Engines.ODBC , frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
336   - frm_col_soft.SetValorChaveRegIni('Col_Soft','te_versao_directx' , frm_col_soft.MSystemInfo1.Engines.DirectX.Version, frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
337   - frm_col_soft.SetValorChaveRegIni('Col_Soft','te_versao_acrobat_reader', te_versao_acrobat_reader , frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
338   - frm_col_soft.SetValorChaveRegIni('Col_Soft','te_versao_ie' , te_versao_ie , frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
339   - frm_col_soft.SetValorChaveRegIni('Col_Soft','te_versao_mozilla' , te_versao_mozilla , frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
340   - frm_col_soft.SetValorChaveRegIni('Col_Soft','te_versao_jre' , te_versao_jre , frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
341   - frm_col_soft.SetValorChaveRegIni('Col_Soft','te_inventario_softwares' , te_inventario_softwares , frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
342   - frm_col_soft.SetValorChaveRegIni('Col_Soft','te_variaveis_ambiente' , te_variaveis_ambiente , frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
343   - frm_col_soft.SetValorChaveRegIni('Col_Soft','ValorChaveColetado' , ValorChaveColetado , frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
344   - end
345   - else
346   - frm_col_soft.SetValorChaveRegIni('Col_Soft','nada', 'nada', frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
347   - Application.Terminate;
348   - Except
349   - frm_col_soft.SetValorChaveRegIni('Col_Soft','nada', 'nada', frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
350   - Application.Terminate;
351   - End;
352   -end;
353   -
354   -
355   -procedure Tfrm_col_soft.Log_Historico(strMsg : String);
356   -var
357   - HistoricoLog : TextFile;
358   - strDataArqLocal, strDataAtual : string;
359   -begin
360   - try
361   - FileSetAttr (p_path_cacic + 'cacic2.log',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000
362   - AssignFile(HistoricoLog,p_path_cacic + 'cacic2.log'); {Associa o arquivo a uma variável do tipo TextFile}
363   - {$IOChecks off}
364   - Reset(HistoricoLog); {Abre o arquivo texto}
365   - {$IOChecks on}
366   - if (IOResult <> 0) then // Arquivo não existe, será recriado.
367   - begin
368   - Rewrite (HistoricoLog);
369   - Append(HistoricoLog);
370   - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <=======================');
371   - end;
372   - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(p_path_cacic + 'cacic2.log')));
373   - DateTimeToString(strDataAtual , 'yyyymmdd', Date);
374   - if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual...
375   - begin
376   - Rewrite (HistoricoLog); //Cria/Recria o arquivo
377   - Append(HistoricoLog);
378   - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <=======================');
379   - end;
380   - Append(HistoricoLog);
381   - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + strMsg); {Grava a string Texto no arquivo texto}
382   - CloseFile(HistoricoLog); {Fecha o arquivo texto}
383   -// FileSetAttr (ExtractFilePath(Application.Exename) + '\cacic2.log',6); // Muda o atributo para arquivo de SISTEMA e OCULTO
384   -
385   - except
386   - Log_Historico('Erro na gravação do log!');
387   - end;
388   -end;
389   -// Simples rotinas de Criptografação e Descriptografação
390   -// Baixadas de http://www.costaweb.com.br/forum/delphi/474.shtml
391   -Function Tfrm_col_soft.Crip(PNome: String): String;
392   -Var
393   - TamI, TamF: Integer;
394   - SenA, SenM, SenD: String;
395   -Begin
396   - SenA := Trim(PNome);
397   - TamF := Length(SenA);
398   - if (TamF > 1) then
399   - begin
400   - SenM := '';
401   - SenD := '';
402   - For TamI := TamF Downto 1 do
403   - Begin
404   - SenM := SenM + Copy(SenA,TamI,1);
405   - End;
406   - SenD := Chr(TamF+95)+Copy(SenM,1,1)+Copy(SenA,1,1)+Copy(SenM,2,TamF-2)+Chr(75+TamF);
407   - end
408   - else SenD := SenA;
409   - Result := SenD;
410   -End;
411   -
412   -Function Tfrm_col_soft.DesCrip(PNome: String): String;
413   -Var
414   - TamI, TamF: Integer;
415   - SenA, SenM, SenD: String;
416   -Begin
417   - SenA := Trim(PNome);
418   - TamF := Length(SenA) - 2;
419   - if (TamF > 1) then
420   - begin
421   - SenM := '';
422   - SenD := '';
423   - SenA := Copy(SenA,2,TamF);
424   - SenM := Copy(SenA,1,1)+Copy(SenA,3,TamF)+Copy(SenA,2,1);
425   - For TamI := TamF Downto 1 do
426   - Begin
427   - SenD := SenD + Copy(SenM,TamI,1);
428   - End;
429   - end
430   - else SenD := SenA;
431   - Result := SenD;
432   -End;
433   -
434   -
435   -procedure Tfrm_col_soft.FormCreate(Sender: TObject);
436   -var tstrTripa1 : TStrings;
437   - intAux : integer;
438   -begin
439   -
440   - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini
441   - tstrTripa1 := explode(ExtractFilePath(Application.Exename),'\');
442   - p_path_cacic := '';
443   - For intAux := 0 to tstrTripa1.Count -2 do
444   - begin
445   - p_path_cacic := p_path_cacic + tstrTripa1[intAux] + '\';
446   - end;
447   - p_path_cacic_ini := p_path_cacic + 'cacic2.ini';
448   - Application.ShowMainForm := false;
449   -
450   - Try
451   - Executa_Col_Soft;
452   - Except
453   - frm_col_soft.SetValorChaveRegIni('Col_Soft','nada', 'nada', frm_col_soft.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_soft.ini');
454   - Application.Terminate;
455   - End;
456   -end;
457   -end.
458   -