Commit eb8d42dd711267e6e582e54d3a31c0850758cfe6

Authored by anderson.peterle@previdencia.gov.br
1 parent e663a2b2
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@960 fecfc0c7-e812-0410-ae72-849f08638ee7
col_comp/col_comp.cfg
@@ -1,38 +0,0 @@ @@ -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_comp/col_comp.dof
@@ -1,136 +0,0 @@ @@ -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=2070  
125 -CodePage=1252  
126 -[Version Info Keys]  
127 -CompanyName=Dataprev - Emp. de TI da Prev.Social - URES  
128 -FileDescription=Coletor de Informações de Compartilhamento do Sistema CACIC  
129 -FileVersion=2.5.0.773  
130 -InternalName=  
131 -LegalCopyright=  
132 -LegalTrademarks=  
133 -OriginalFilename=  
134 -ProductName=Col_COMP  
135 -ProductVersion=2.6  
136 -Comments=Baseado na licença GPL (General Public License)  
col_comp/col_comp.dpr
@@ -1,390 +0,0 @@ @@ -1,390 +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 col_comp;  
19 -{$R *.res}  
20 -  
21 -uses  
22 - Windows,  
23 - SysUtils,  
24 - Classes,  
25 - Registry,  
26 - CACIC_Library in '..\CACIC_Library.pas';  
27 -  
28 -var  
29 - v_strCipherClosed : String;  
30 -  
31 -var  
32 - v_tstrCipherOpened,  
33 - v_tstrCipherOpened1 : TStrings;  
34 -  
35 -var  
36 - g_oCacic : TCACIC;  
37 -  
38 -procedure log_diario(strMsg : String);  
39 -var  
40 - HistoricoLog : TextFile;  
41 - strDataArqLocal, strDataAtual : string;  
42 -begin  
43 - try  
44 - FileSetAttr (g_oCacic.getCacicPath + 'cacic2.log',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000  
45 - AssignFile(HistoricoLog,g_oCacic.getCacicPath + 'cacic2.log'); {Associa o arquivo a uma variável do tipo TextFile}  
46 - {$IOChecks off}  
47 - Reset(HistoricoLog); {Abre o arquivo texto}  
48 - {$IOChecks on}  
49 - if (IOResult <> 0) then // Arquivo não existe, será recriado.  
50 - begin  
51 - Rewrite (HistoricoLog);  
52 - Append(HistoricoLog);  
53 - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <=======================');  
54 - end;  
55 - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(g_oCacic.getCacicPath + 'cacic2.log')));  
56 - DateTimeToString(strDataAtual , 'yyyymmdd', Date);  
57 - if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual...  
58 - begin  
59 - Rewrite (HistoricoLog); //Cria/Recria o arquivo  
60 - Append(HistoricoLog);  
61 - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <=======================');  
62 - end;  
63 - Append(HistoricoLog);  
64 - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now)+ '[Coletor COMP] '+strMsg); {Grava a string Texto no arquivo texto}  
65 - CloseFile(HistoricoLog); {Fecha o arquivo texto}  
66 -  
67 - except  
68 - log_diario('Erro na gravação do log!');  
69 - end;  
70 -end;  
71 -  
72 -Function CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings) : String;  
73 -var v_strCipherOpenImploded : string;  
74 - v_DatFile : TextFile;  
75 -begin  
76 - try  
77 - FileSetAttr (p_DatFileName,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000  
78 - AssignFile(v_DatFile,p_DatFileName); {Associa o arquivo a uma variável do tipo TextFile}  
79 -  
80 - // Criação do arquivo .DAT  
81 - Rewrite (v_DatFile);  
82 - Append(v_DatFile);  
83 -  
84 - v_strCipherOpenImploded := g_oCacic.implode(p_tstrCipherOpened,g_oCacic.getSeparatorKey);  
85 - v_strCipherClosed := g_oCacic.enCrypt(v_strCipherOpenImploded);  
86 - Writeln(v_DatFile,v_strCipherClosed); {Grava a string Texto no arquivo texto}  
87 - CloseFile(v_DatFile);  
88 - except  
89 - end;  
90 -end;  
91 -  
92 -Function CipherOpen(p_DatFileName : string) : TStrings;  
93 -var v_DatFile : TextFile;  
94 - v_strCipherOpened,  
95 - v_strCipherClosed : string;  
96 -begin  
97 - v_strCipherOpened := '';  
98 - if FileExists(p_DatFileName) then  
99 - begin  
100 - AssignFile(v_DatFile,p_DatFileName);  
101 - {$IOChecks off}  
102 - Reset(v_DatFile);  
103 - {$IOChecks on}  
104 - if (IOResult <> 0) then // Arquivo não existe, será recriado.  
105 - begin  
106 - Rewrite (v_DatFile);  
107 - Append(v_DatFile);  
108 - end;  
109 -  
110 - Readln(v_DatFile,v_strCipherClosed);  
111 - while not EOF(v_DatFile) do Readln(v_DatFile,v_strCipherClosed);  
112 - CloseFile(v_DatFile);  
113 - v_strCipherOpened:= g_oCacic.deCrypt(v_strCipherClosed);  
114 - end;  
115 - if (trim(v_strCipherOpened)<>'') then  
116 - Result := g_oCacic.explode(v_strCipherOpened,g_oCacic.getSeparatorKey)  
117 - else  
118 - Result := g_oCacic.explode('Configs.ID_SO'+g_oCacic.getSeparatorKey+g_oCacic.getWindowsStrId() +g_oCacic.getSeparatorKey+'Configs.Endereco_WS'+g_oCacic.getSeparatorKey+'/cacic2/ws/',g_oCacic.getSeparatorKey);  
119 -  
120 -  
121 - if Result.Count mod 2 <> 0 then  
122 - Result.Add('');  
123 -end;  
124 -  
125 -Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String; p_tstrCipherOpened : TStrings);  
126 -begin  
127 - // Exemplo: p_Chave => Configs.nu_ip_servidor : p_Valor => 10.71.0.120  
128 - if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then  
129 - p_tstrCipherOpened[v_tstrCipherOpened.IndexOf(p_Chave)+1] := p_Valor  
130 - else  
131 - Begin  
132 - p_tstrCipherOpened.Add(p_Chave);  
133 - p_tstrCipherOpened.Add(p_Valor);  
134 - End;  
135 -  
136 -end;  
137 -  
138 -Function GetValorDatMemoria(p_Chave : String) : String;  
139 -begin  
140 - if (v_tstrCipherOpened.IndexOf(p_Chave)<>-1) then  
141 - Result := v_tstrCipherOpened[v_tstrCipherOpened.IndexOf(p_Chave)+1]  
142 - else  
143 - Result := '';  
144 -end;  
145 -  
146 -function GetRootKey(strRootKey: String): HKEY;  
147 -begin  
148 - /// Encontrar uma maneira mais elegante de fazer esses testes.  
149 - if Trim(strRootKey) = 'HKEY_LOCAL_MACHINE' Then Result := HKEY_LOCAL_MACHINE  
150 - else if Trim(strRootKey) = 'HKEY_CLASSES_ROOT' Then Result := HKEY_CLASSES_ROOT  
151 - else if Trim(strRootKey) = 'HKEY_CURRENT_USER' Then Result := HKEY_CURRENT_USER  
152 - else if Trim(strRootKey) = 'HKEY_USERS' Then Result := HKEY_USERS  
153 - else if Trim(strRootKey) = 'HKEY_CURRENT_CONFIG' Then Result := HKEY_CURRENT_CONFIG  
154 - else if Trim(strRootKey) = 'HKEY_DYN_DATA' Then Result := HKEY_DYN_DATA;  
155 -end;  
156 -  
157 -Function RemoveCaracteresEspeciais(Texto : String) : String;  
158 -var I : Integer;  
159 - strAux : String;  
160 -Begin  
161 - For I := 0 To Length(Texto) Do  
162 - if ord(Texto[I]) in [32..126] Then  
163 - strAux := strAux + Texto[I]  
164 - else strAux := strAux + ' '; // Coloca um espaço onde houver caracteres especiais  
165 - Result := strAux;  
166 -end;  
167 -  
168 -function GetValorChaveRegEdit(Chave: String): Variant;  
169 -var RegEditGet: TRegistry;  
170 - RegDataType: TRegDataType;  
171 - strRootKey, strKey, strValue, s: String;  
172 - ListaAuxGet : TStrings;  
173 - DataSize, Len, I : Integer;  
174 -begin  
175 - try  
176 - Result := '';  
177 - ListaAuxGet := g_oCacic.explode(Chave, '\');  
178 -  
179 - strRootKey := ListaAuxGet[0];  
180 - For I := 1 To ListaAuxGet.Count - 2 Do strKey := strKey + ListaAuxGet[I] + '\';  
181 - strValue := ListaAuxGet[ListaAuxGet.Count - 1];  
182 - if (strValue = '(Padrão)') then strValue := ''; //Para os casos de se querer buscar o valor default (Padrão)  
183 - RegEditGet := TRegistry.Create;  
184 -  
185 - RegEditGet.Access := KEY_READ;  
186 - RegEditGet.Rootkey := GetRootKey(strRootKey);  
187 - if RegEditGet.OpenKeyReadOnly(strKey) then //teste  
188 - Begin  
189 - RegDataType := RegEditGet.GetDataType(strValue);  
190 - if (RegDataType = rdString) or (RegDataType = rdExpandString) then Result := RegEditGet.ReadString(strValue)  
191 - else if RegDataType = rdInteger then Result := RegEditGet.ReadInteger(strValue)  
192 - else if (RegDataType = rdBinary) or (RegDataType = rdUnknown)  
193 - then  
194 - begin  
195 - DataSize := RegEditGet.GetDataSize(strValue);  
196 - if DataSize = -1 then exit;  
197 - SetLength(s, DataSize);  
198 - Len := RegEditGet.ReadBinaryData(strValue, PChar(s)^, DataSize);  
199 - if Len <> DataSize then exit;  
200 - Result := RemoveCaracteresEspeciais(s);  
201 - end  
202 - end;  
203 - finally  
204 - RegEditGet.CloseKey;  
205 - RegEditGet.Free;  
206 - ListaAuxGet.Free;  
207 -  
208 - end;  
209 -end;  
210 -  
211 -procedure Executa_Col_comp;  
212 -  
213 - function RetornaValorShareNT(ValorReg : String; LimiteEsq : String; LimiteDir : String) : String;  
214 - var intAux, intAux2 : Integer;  
215 - Begin  
216 - intAux := Pos(LimiteEsq, ValorReg) + Length(LimiteEsq);  
217 - if (LimiteDir = 'Fim') Then intAux2 := Length(ValorReg) - 1  
218 - Else intAux2 := Pos(LimiteDir, ValorReg) - intAux - 1;  
219 - result := Trim(Copy(ValorReg, intAux, intAux2));  
220 - end;  
221 -  
222 -var Reg_RCC : TRegistry;  
223 - ChaveRegistro, ValorChaveRegistro, nm_compartilhamento, nm_dir_compart,  
224 - in_senha_escrita, in_senha_leitura, te_comentario, strTripaDados, strAux,  
225 - cs_tipo_permissao, cs_tipo_compart : String;  
226 - I, intAux: Integer;  
227 - Lista_RCC : TStringList;  
228 -Begin  
229 - Try  
230 - Begin  
231 - SetValorDatMemoria('Col_Comp.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);  
232 - nm_compartilhamento := '';  
233 - nm_dir_compart := '';  
234 - cs_tipo_compart := ' ';  
235 - cs_tipo_permissao := ' ';  
236 - in_senha_leitura := '';  
237 - in_senha_escrita := '';  
238 - log_diario('Coletando informações de Compartilhamentos.');  
239 - Reg_RCC := TRegistry.Create;  
240 - Reg_RCC.LazyWrite := False;  
241 - Lista_RCC := TStringList.Create;  
242 - Reg_RCC.Rootkey := HKEY_LOCAL_MACHINE;  
243 - strTripaDados := '';  
244 -  
245 - if Win32Platform = VER_PLATFORM_WIN32_NT then  
246 - Begin // 2k, xp, nt.  
247 - ChaveRegistro := '\System\ControlSet001\Services\lanmanserver\Shares\';  
248 - Reg_RCC.OpenKeyReadOnly(ChaveRegistro);  
249 - Reg_RCC.GetValueNames(Lista_RCC);  
250 - Reg_RCC.CloseKey;  
251 - For I := 0 To Lista_RCC.Count - 1 Do  
252 - Begin  
253 - nm_compartilhamento := Lista_RCC.Strings[i];  
254 - strAux := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE' + ChaveRegistro + nm_compartilhamento);  
255 - nm_dir_compart := RetornaValorShareNT(strAux, 'Path=', 'Permissions=');  
256 - te_comentario := RetornaValorShareNT(strAux, 'Remark=', 'Type=');  
257 - cs_tipo_compart := RetornaValorShareNT(strAux, 'Type=', 'Fim');  
258 - if (cs_tipo_compart = '0') Then cs_tipo_compart := 'D' Else cs_tipo_compart := 'I';  
259 - if (strTripaDados <> '') then  
260 - strTripaDados := strTripaDados + '<REG>'; // Delimitador de REGISTRO  
261 -  
262 - strTripaDados := strTripaDados + nm_compartilhamento + '<FIELD>' +  
263 - nm_dir_compart + '<FIELD>' +  
264 - cs_tipo_compart + '<FIELD>' +  
265 - te_comentario;  
266 - end;  
267 - end  
268 - Else  
269 - Begin  
270 - ChaveRegistro := '\Software\Microsoft\Windows\CurrentVersion\Network\LanMan\';  
271 - Reg_RCC.OpenKeyReadOnly(ChaveRegistro);  
272 - Reg_RCC.GetKeyNames(Lista_RCC);  
273 - Reg_RCC.CloseKey;  
274 - For I := 0 To Lista_RCC.Count - 1 Do  
275 - Begin  
276 - nm_compartilhamento := Lista_RCC.Strings[i];  
277 - Reg_RCC.OpenKey(ChaveRegistro + nm_compartilhamento, True);  
278 - nm_dir_compart := Reg_RCC.ReadString('Path');  
279 - te_comentario := Reg_RCC.ReadString('Remark');  
280 - if (Reg_RCC.GetDataSize('Parm1enc') = 0) Then in_senha_escrita := '0' Else in_senha_escrita := '1';  
281 - if (Reg_RCC.GetDataSize('Parm2enc') = 0) Then in_senha_leitura := '0' Else in_senha_leitura := '1';  
282 - if (Reg_RCC.ReadInteger('Type') = 0) Then cs_tipo_compart := 'D' Else cs_tipo_compart := 'I';  
283 - intAux := Reg_RCC.ReadInteger('Flags');  
284 - Case intAux of //http://www.la2600.org/talks/chronology/enigma/19971107.html  
285 - 401 : cs_tipo_permissao := 'S'; // Somente Leitura.  
286 - 258 : cs_tipo_permissao := 'C'; // Completo.  
287 - 259 : cs_tipo_permissao := 'D'; // Depende de senha.  
288 - end;  
289 - Reg_RCC.CloseKey;  
290 - {  
291 - strXML := strXML + '<compart>' +  
292 - '<nm_compartilhamento>' + nm_compartilhamento + '</nm_compartilhamento>' +  
293 - '<nm_dir_compart>' + nm_dir_compart + '</nm_dir_compart>' +  
294 - '<cs_tipo_compart>' + cs_tipo_compart + '</cs_tipo_compart>' +  
295 - '<cs_tipo_permissao>' + cs_tipo_permissao + '</cs_tipo_permissao>' +  
296 - '<in_senha_leitura>' + in_senha_leitura + '</in_senha_leitura>' +  
297 - '<in_senha_escrita>' + in_senha_escrita + '</in_senha_escrita>' +  
298 - '<te_comentario>' + te_comentario + '</te_comentario>' +  
299 - '</compart>';  
300 - }  
301 - if (strTripaDados <> '') then  
302 - strTripaDados := strTripaDados + '<REG>'; // Delimitador de REGISTRO  
303 -  
304 - strTripaDados := strTripaDados + nm_compartilhamento + '<FIELD>' +  
305 - nm_dir_compart + '<FIELD>' +  
306 - cs_tipo_compart + '<FIELD>' +  
307 - te_comentario + '<FIELD>' +  
308 - in_senha_leitura + '<FIELD>' +  
309 - in_senha_escrita + '<FIELD>' +  
310 - cs_tipo_permissao;  
311 - end;  
312 - end;  
313 -  
314 - Reg_RCC.Free;  
315 - Lista_RCC.Free;  
316 -  
317 -  
318 - // Obtenho do registro o valor que foi previamente armazenado  
319 - ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Compartilhamentos'));  
320 -  
321 - SetValorDatMemoria('Col_Comp.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1);  
322 -  
323 - // Se essas informações forem diferentes significa que houve alguma alteração  
324 - // na configuração. Nesse caso, gravo as informações no BD Central e, se não houver  
325 - // problemas durante esse procedimento, atualizo as informações no registro.  
326 - If ((GetValorDatMemoria('Configs.IN_COLETA_FORCADA_COMP')='S') or (strTripaDados <> ValorChaveRegistro)) and  
327 - (strTripaDados <> '') Then  
328 - Begin  
329 - SetValorDatMemoria('Col_Comp.UVC', strTripaDados, v_tstrCipherOpened1);  
330 - CipherClose(g_oCacic.getCacicPath + 'temp\col_comp.dat', v_tstrCipherOpened1);  
331 - End  
332 - else  
333 - SetValorDatMemoria('Col_Comp.nada', 'nada', v_tstrCipherOpened1);  
334 -  
335 - CipherClose(g_oCacic.getCacicPath + 'temp\col_comp.dat', v_tstrCipherOpened1);  
336 - End;  
337 - Except  
338 - Begin  
339 - SetValorDatMemoria('Col_Comp.nada', 'nada', v_tstrCipherOpened1);  
340 - SetValorDatMemoria('Col_Comp.Fim', '99999999', v_tstrCipherOpened1);  
341 - CipherClose(g_oCacic.getCacicPath + 'temp\col_comp.dat', v_tstrCipherOpened1);  
342 - End;  
343 - End;  
344 -end;  
345 -  
346 -var tstrTripa1 : TStrings;  
347 - intAux : integer;  
348 - strAux : String;  
349 -  
350 -const  
351 - CACIC_APP_NAME = 'col_comp';  
352 -  
353 -begin  
354 - g_oCacic := TCACIC.Create();  
355 -  
356 - g_oCacic.setBoolCipher(true);  
357 -  
358 - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then  
359 - if (ParamCount>0) then  
360 - Begin  
361 - strAux := '';  
362 - For intAux := 1 to ParamCount do  
363 - Begin  
364 - if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then  
365 - begin  
366 - strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux)))));  
367 - end;  
368 - end;  
369 -  
370 - if (strAux <> '') then  
371 - Begin  
372 - g_oCacic.setCacicPath(strAux);  
373 -  
374 - v_tstrCipherOpened := TStrings.Create;  
375 - v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName);  
376 -  
377 - v_tstrCipherOpened1 := TStrings.Create;  
378 - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_comp.dat');  
379 -  
380 - Try  
381 - Executa_Col_comp;  
382 - Except  
383 - SetValorDatMemoria('Col_Comp.nada', 'nada', v_tstrCipherOpened1);  
384 - CipherClose(g_oCacic.getCacicPath + 'temp\col_comp.dat', v_tstrCipherOpened1);  
385 - End;  
386 - Halt(0);  
387 - End;  
388 - End;  
389 - g_oCacic.Free();  
390 -end.  
col_comp/col_comp.res
No preview for this file type
col_comp/col_comp_icon.ico
No preview for this file type
col_comp/main_comp.ddp
No preview for this file type
col_comp/main_comp.dfm
@@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
1 -object frmcol_comp: Tfrmcol_comp  
2 - Left = 912  
3 - Top = 715  
4 - Width = 112  
5 - Height = 27  
6 - Caption = 'CACIC - Coletor Compartilhamentos'  
7 - Color = clBtnFace  
8 - TransparentColor = True  
9 - Font.Charset = DEFAULT_CHARSET  
10 - Font.Color = clWindowText  
11 - Font.Height = -11  
12 - Font.Name = 'MS Sans Serif'  
13 - Font.Style = []  
14 - OldCreateOrder = False  
15 - OnCreate = FormCreate  
16 - PixelsPerInch = 96  
17 - TextHeight = 13  
18 -end  
col_comp/main_comp.pas
@@ -1,424 +0,0 @@ @@ -1,424 +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 -unit main_comp;  
19 -  
20 -interface  
21 -  
22 -uses Windows, Forms, IniFiles, SysUtils, Classes, Registry;  
23 -var p_path_cacic, p_path_cacic_ini : string;  
24 -type  
25 - Tfrmcol_comp = class(TForm)  
26 - procedure Executa_Col_comp;  
27 - procedure Log_Historico(strMsg : String);  
28 - Function Crip(PNome: String): String;  
29 - Function DesCrip(PNome: String): String;  
30 - function SetValorChaveRegIni(p_Secao: String; p_Chave: String; p_Valor: String; p_Path : String): String;  
31 -// function GetValorChaveRegIni(p_Secao: String; p_Chave : String; p_Path : String): String;  
32 - function GetValorChaveRegIni(p_SectionName, p_KeyName, p_IniFileName : String) : String;  
33 - function GetValorChaveRegEdit(Chave: String): Variant;  
34 - function GetRootKey(strRootKey: String): HKEY;  
35 - Function Explode(Texto, Separador : String) : TStrings;  
36 - Function RemoveCaracteresEspeciais(Texto : String) : String;  
37 - procedure FormCreate(Sender: TObject);  
38 - private  
39 - { Private declarations }  
40 - public  
41 - { Public declarations }  
42 - end;  
43 -  
44 -var  
45 - frmcol_comp: Tfrmcol_comp;  
46 -  
47 -implementation  
48 -  
49 -{$R *.dfm}  
50 -  
51 -//Para gravar no Arquivo INI...  
52 -function Tfrmcol_comp.SetValorChaveRegIni(p_Secao: String; p_Chave: String; p_Valor: String; p_Path : String): String;  
53 -var Reg_Ini : TIniFile;  
54 -begin  
55 - FileSetAttr (p_Path,0);  
56 - Reg_Ini := TIniFile.Create(p_Path);  
57 -// Reg_Ini.WriteString(frmcol_comp.Crip(p_Secao), frmcol_comp.Crip(p_Chave), frmcol_comp.Crip(p_Valor));  
58 - Reg_Ini.WriteString(p_Secao, p_Chave, p_Valor);  
59 - Reg_Ini.Free;  
60 -end;  
61 -  
62 -//Para buscar do Arquivo INI...  
63 -//function Tfrmcol_comp.GetValorChaveRegIni(p_Secao: String; p_Chave : String; p_Path : String): String;  
64 -//var Reg_Ini: TIniFile;  
65 -//begin  
66 -// FileSetAttr (p_Path,0);  
67 -// Reg_Ini := TIniFile.Create(p_Path);  
68 -//// Result := frmcol_comp.DesCrip(Reg_Ini.ReadString(frmcol_comp.Crip(p_Secao), frmcol_comp.Crip(p_Chave), ''));  
69 -// Result := Reg_Ini.ReadString(p_Secao, p_Chave, '');  
70 -// Reg_Ini.Free;  
71 -//end;  
72 -//Para buscar do Arquivo INI...  
73 -// Marreta devido a limitações do KERNEL w9x no tratamento de arquivos texto e suas seções  
74 -function Tfrmcol_comp.GetValorChaveRegIni(p_SectionName, p_KeyName, p_IniFileName : String) : String;  
75 -var  
76 - FileText : TStringList;  
77 - i, j, v_Size_Section, v_Size_Key : integer;  
78 - v_SectionName, v_KeyName : string;  
79 - begin  
80 - Result := '';  
81 - v_SectionName := '[' + p_SectionName + ']';  
82 - v_Size_Section := strLen(PChar(v_SectionName));  
83 - v_KeyName := p_KeyName + '=';  
84 - v_Size_Key := strLen(PChar(v_KeyName));  
85 - FileText := TStringList.Create;  
86 - try  
87 - FileText.LoadFromFile(p_IniFileName);  
88 - For i := 0 To FileText.Count - 1 Do  
89 - Begin  
90 - if (LowerCase(Trim(PChar(Copy(FileText[i],1,v_Size_Section)))) = LowerCase(Trim(PChar(v_SectionName)))) then  
91 - Begin  
92 - For j := i to FileText.Count - 1 Do  
93 - Begin  
94 - if (LowerCase(Trim(PChar(Copy(FileText[j],1,v_Size_Key)))) = LowerCase(Trim(PChar(v_KeyName)))) then  
95 - Begin  
96 - Result := PChar(Copy(FileText[j],v_Size_Key + 1,strLen(PChar(FileText[j]))-v_Size_Key));  
97 - Break;  
98 - End;  
99 - End;  
100 - End;  
101 - if (Result <> '') then break;  
102 - End;  
103 - finally  
104 - FileText.Free;  
105 - end;  
106 - end;  
107 -  
108 -  
109 -Function Tfrmcol_comp.Explode(Texto, Separador : String) : TStrings;  
110 -var  
111 - strItem : String;  
112 - ListaAuxUTILS : TStrings;  
113 - NumCaracteres, I : Integer;  
114 -Begin  
115 - ListaAuxUTILS := TStringList.Create;  
116 - strItem := '';  
117 - NumCaracteres := Length(Texto);  
118 - For I := 0 To NumCaracteres Do  
119 - If (Texto[I] = Separador) or (I = NumCaracteres) Then  
120 - Begin  
121 - If (I = NumCaracteres) then strItem := strItem + Texto[I];  
122 - ListaAuxUTILS.Add(Trim(strItem));  
123 - strItem := '';  
124 - end  
125 - Else strItem := strItem + Texto[I];  
126 - Explode := ListaAuxUTILS;  
127 -//Não estava sendo liberado  
128 -// ListaAuxUTILS.Free;  
129 -//Ao ativar esta liberação tomei uma baita surra!!!! 11/05/2004 - 20:30h - Uma noite muito escura! :) Anderson Peterle  
130 -end;  
131 -  
132 -function Tfrmcol_comp.GetRootKey(strRootKey: String): HKEY;  
133 -begin  
134 - /// Encontrar uma maneira mais elegante de fazer esses testes.  
135 - if Trim(strRootKey) = 'HKEY_LOCAL_MACHINE' Then Result := HKEY_LOCAL_MACHINE  
136 - else if Trim(strRootKey) = 'HKEY_CLASSES_ROOT' Then Result := HKEY_CLASSES_ROOT  
137 - else if Trim(strRootKey) = 'HKEY_CURRENT_USER' Then Result := HKEY_CURRENT_USER  
138 - else if Trim(strRootKey) = 'HKEY_USERS' Then Result := HKEY_USERS  
139 - else if Trim(strRootKey) = 'HKEY_CURRENT_CONFIG' Then Result := HKEY_CURRENT_CONFIG  
140 - else if Trim(strRootKey) = 'HKEY_DYN_DATA' Then Result := HKEY_DYN_DATA;  
141 -end;  
142 -  
143 -Function Tfrmcol_comp.RemoveCaracteresEspeciais(Texto : String) : String;  
144 -var I : Integer;  
145 - strAux : String;  
146 -Begin  
147 - For I := 0 To Length(Texto) Do  
148 - if ord(Texto[I]) in [32..126] Then  
149 - strAux := strAux + Texto[I]  
150 - else strAux := strAux + ' '; // Coloca um espaço onde houver caracteres especiais  
151 - Result := strAux;  
152 -end;  
153 -  
154 -function Tfrmcol_comp.GetValorChaveRegEdit(Chave: String): Variant;  
155 -var RegEditGet: TRegistry;  
156 - RegDataType: TRegDataType;  
157 - strRootKey, strKey, strValue, s: String;  
158 - ListaAuxGet : TStrings;  
159 - DataSize, Len, I : Integer;  
160 -begin  
161 - try  
162 - Result := '';  
163 - ListaAuxGet := frmcol_comp.Explode(Chave, '\');  
164 -  
165 - strRootKey := ListaAuxGet[0];  
166 - For I := 1 To ListaAuxGet.Count - 2 Do strKey := strKey + ListaAuxGet[I] + '\';  
167 - strValue := ListaAuxGet[ListaAuxGet.Count - 1];  
168 - if (strValue = '(Padrão)') then strValue := ''; //Para os casos de se querer buscar o valor default (Padrão)  
169 - RegEditGet := TRegistry.Create;  
170 -  
171 - RegEditGet.Access := KEY_READ;  
172 - RegEditGet.Rootkey := GetRootKey(strRootKey);  
173 - if RegEditGet.OpenKeyReadOnly(strKey) then //teste  
174 - Begin  
175 - RegDataType := RegEditGet.GetDataType(strValue);  
176 - if (RegDataType = rdString) or (RegDataType = rdExpandString) then Result := RegEditGet.ReadString(strValue)  
177 - else if RegDataType = rdInteger then Result := RegEditGet.ReadInteger(strValue)  
178 - else if (RegDataType = rdBinary) or (RegDataType = rdUnknown)  
179 - then  
180 - begin  
181 - DataSize := RegEditGet.GetDataSize(strValue);  
182 - if DataSize = -1 then exit;  
183 - SetLength(s, DataSize);  
184 - Len := RegEditGet.ReadBinaryData(strValue, PChar(s)^, DataSize);  
185 - if Len <> DataSize then exit;  
186 - Result := frmcol_comp.RemoveCaracteresEspeciais(s);  
187 - end  
188 - end;  
189 - finally  
190 - RegEditGet.CloseKey;  
191 - RegEditGet.Free;  
192 - ListaAuxGet.Free;  
193 -  
194 - end;  
195 -end;  
196 -  
197 -  
198 -// Simples rotinas de Criptografação e Descriptografação  
199 -// Baixadas de http://www.costaweb.com.br/forum/delphi/474.shtml  
200 -Function Tfrmcol_comp.Crip(PNome: String): String;  
201 -Var  
202 - TamI, TamF: Integer;  
203 - SenA, SenM, SenD: String;  
204 -Begin  
205 - SenA := Trim(PNome);  
206 - TamF := Length(SenA);  
207 - if (TamF > 1) then  
208 - begin  
209 - SenM := '';  
210 - SenD := '';  
211 - For TamI := TamF Downto 1 do  
212 - Begin  
213 - SenM := SenM + Copy(SenA,TamI,1);  
214 - End;  
215 - SenD := Chr(TamF+95)+Copy(SenM,1,1)+Copy(SenA,1,1)+Copy(SenM,2,TamF-2)+Chr(75+TamF);  
216 - end  
217 - else SenD := SenA;  
218 - Result := SenD;  
219 -End;  
220 -  
221 -Function Tfrmcol_comp.DesCrip(PNome: String): String;  
222 -Var  
223 - TamI, TamF: Integer;  
224 - SenA, SenM, SenD: String;  
225 -Begin  
226 - SenA := Trim(PNome);  
227 - TamF := Length(SenA) - 2;  
228 - if (TamF > 1) then  
229 - begin  
230 - SenM := '';  
231 - SenD := '';  
232 - SenA := Copy(SenA,2,TamF);  
233 - SenM := Copy(SenA,1,1)+Copy(SenA,3,TamF)+Copy(SenA,2,1);  
234 - For TamI := TamF Downto 1 do  
235 - Begin  
236 - SenD := SenD + Copy(SenM,TamI,1);  
237 - End;  
238 - end  
239 - else SenD := SenA;  
240 - Result := SenD;  
241 -End;  
242 -  
243 -procedure Tfrmcol_comp.Log_Historico(strMsg : String);  
244 -var  
245 - HistoricoLog : TextFile;  
246 - strDataArqLocal, strDataAtual : string;  
247 -begin  
248 - try  
249 - FileSetAttr (p_path_cacic + 'cacic2.log',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000  
250 - AssignFile(HistoricoLog,p_path_cacic + 'cacic2.log'); {Associa o arquivo a uma variável do tipo TextFile}  
251 - {$IOChecks off}  
252 - Reset(HistoricoLog); {Abre o arquivo texto}  
253 - {$IOChecks on}  
254 - if (IOResult <> 0) then // Arquivo não existe, será recriado.  
255 - begin  
256 - Rewrite (HistoricoLog);  
257 - Append(HistoricoLog);  
258 - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <=======================');  
259 - end;  
260 - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(p_path_cacic + 'cacic2.log')));  
261 - DateTimeToString(strDataAtual , 'yyyymmdd', Date);  
262 - if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual...  
263 - begin  
264 - Rewrite (HistoricoLog); //Cria/Recria o arquivo  
265 - Append(HistoricoLog);  
266 - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <=======================');  
267 - end;  
268 - Append(HistoricoLog);  
269 - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + strMsg); {Grava a string Texto no arquivo texto}  
270 - CloseFile(HistoricoLog); {Fecha o arquivo texto}  
271 -// FileSetAttr (ExtractFilePath(Application.Exename) + '\cacic2.log',6); // Muda o atributo para arquivo de SISTEMA e OCULTO  
272 -  
273 - except  
274 - Log_Historico('Erro na gravação do log!');  
275 - end;  
276 -end;  
277 -  
278 -  
279 -  
280 -procedure Tfrmcol_comp.Executa_Col_comp;  
281 -function RetornaValorShareNT(ValorReg : String; LimiteEsq : String; LimiteDir : String) : String;  
282 -var intAux, intAux2 : Integer;  
283 -Begin  
284 - intAux := Pos(LimiteEsq, ValorReg) + Length(LimiteEsq);  
285 - if (LimiteDir = 'Fim') Then intAux2 := Length(ValorReg) - 1  
286 - Else intAux2 := Pos(LimiteDir, ValorReg) - intAux - 1;  
287 - result := Trim(Copy(ValorReg, intAux, intAux2));  
288 -end;  
289 -var Reg_RCC : TRegistry;  
290 - ChaveRegistro, ValorChaveRegistro, nm_compartilhamento, nm_dir_compart,  
291 - in_senha_escrita, in_senha_leitura, te_comentario, strXML, strAux,  
292 - cs_tipo_permissao, cs_tipo_compart : String;  
293 - I, intAux: Integer;  
294 - Lista_RCC : TStringList;  
295 -Begin  
296 - Try  
297 - nm_compartilhamento := '';  
298 - nm_dir_compart := '';  
299 - cs_tipo_compart := ' ';  
300 - cs_tipo_permissao := ' ';  
301 - in_senha_leitura := '';  
302 - in_senha_escrita := '';  
303 - Log_Historico('* Coletando informações de Compartilhamentos.');  
304 - Reg_RCC := TRegistry.Create;  
305 - Reg_RCC.LazyWrite := False;  
306 - Lista_RCC := TStringList.Create;  
307 - Reg_RCC.Rootkey := HKEY_LOCAL_MACHINE;  
308 - {  
309 - strXML := '<?xml version="1.0" encoding="ISO-8859-1"?>' +  
310 - '<comparts>' +  
311 - '<te_node_address>' + GetValorChaveRegIni('TcpIp' ,'TE_NODE_ADDRESS' ,p_path_cacic_ini) + '</te_node_address>' +  
312 - '<te_nome_computador>' + GetValorChaveRegIni('TcpIp' ,'TE_NOME_COMPUTADOR',p_path_cacic_ini) + '</te_nome_computador>' +  
313 - '<te_workgroup>' + GetValorChaveRegIni('TcpIp' ,'TE_WORKGROUP' ,p_path_cacic_ini) + '</te_workgroup>' +  
314 - '<id_so>' + GetValorChaveRegIni('Configs','ID_SO' ,p_path_cacic_ini) + '</id_so>';  
315 - }  
316 -  
317 - strXML := '<?xml version="1.0" encoding="ISO-8859-1"?><comparts>';  
318 -  
319 - if Win32Platform = VER_PLATFORM_WIN32_NT then  
320 - Begin // 2k, xp, nt.  
321 - ChaveRegistro := '\System\ControlSet001\Services\lanmanserver\Shares\';  
322 - Reg_RCC.OpenKeyReadOnly(ChaveRegistro);  
323 - Reg_RCC.GetValueNames(Lista_RCC);  
324 - Reg_RCC.CloseKey;  
325 - For I := 0 To Lista_RCC.Count - 1 Do  
326 - Begin  
327 - nm_compartilhamento := Lista_RCC.Strings[i];  
328 - strAux := GetValorChaveRegEdit('HKEY_LOCAL_MACHINE' + ChaveRegistro + nm_compartilhamento);  
329 - nm_dir_compart := RetornaValorShareNT(strAux, 'Path=', 'Permissions=');  
330 - te_comentario := RetornaValorShareNT(strAux, 'Remark=', 'Type=');  
331 - cs_tipo_compart := RetornaValorShareNT(strAux, 'Type=', 'Fim');  
332 - if (cs_tipo_compart = '0') Then cs_tipo_compart := 'D' Else cs_tipo_compart := 'I';  
333 - strXML := strXML + '<compart>' +  
334 - '<nm_compartilhamento>' + nm_compartilhamento + '</nm_compartilhamento>' +  
335 - '<nm_dir_compart>' + nm_dir_compart + '</nm_dir_compart>' +  
336 - '<cs_tipo_compart>' + cs_tipo_compart + '</cs_tipo_compart>' +  
337 - '<te_comentario>' + te_comentario + '</te_comentario>' +  
338 - '</compart>';  
339 - end;  
340 - end  
341 - Else  
342 - Begin  
343 - ChaveRegistro := '\Software\Microsoft\Windows\CurrentVersion\Network\LanMan\';  
344 - Reg_RCC.OpenKeyReadOnly(ChaveRegistro);  
345 - Reg_RCC.GetKeyNames(Lista_RCC);  
346 - Reg_RCC.CloseKey;  
347 - For I := 0 To Lista_RCC.Count - 1 Do  
348 - Begin  
349 - nm_compartilhamento := Lista_RCC.Strings[i];  
350 - Reg_RCC.OpenKey(ChaveRegistro + nm_compartilhamento, True);  
351 - nm_dir_compart := Reg_RCC.ReadString('Path');  
352 - te_comentario := Reg_RCC.ReadString('Remark');  
353 - if (Reg_RCC.GetDataSize('Parm1enc') = 0) Then in_senha_escrita := '0' Else in_senha_escrita := '1';  
354 - if (Reg_RCC.GetDataSize('Parm2enc') = 0) Then in_senha_leitura := '0' Else in_senha_leitura := '1';  
355 - if (Reg_RCC.ReadInteger('Type') = 0) Then cs_tipo_compart := 'D' Else cs_tipo_compart := 'I';  
356 - intAux := Reg_RCC.ReadInteger('Flags');  
357 - Case intAux of //http://www.la2600.org/talks/chronology/enigma/19971107.html  
358 - 401 : cs_tipo_permissao := 'S'; // Somente Leitura.  
359 - 258 : cs_tipo_permissao := 'C'; // Completo.  
360 - 259 : cs_tipo_permissao := 'D'; // Depende de senha.  
361 - end;  
362 - Reg_RCC.CloseKey;  
363 - strXML := strXML + '<compart>' +  
364 - '<nm_compartilhamento>' + nm_compartilhamento + '</nm_compartilhamento>' +  
365 - '<nm_dir_compart>' + nm_dir_compart + '</nm_dir_compart>' +  
366 - '<cs_tipo_compart>' + cs_tipo_compart + '</cs_tipo_compart>' +  
367 - '<cs_tipo_permissao>' + cs_tipo_permissao + '</cs_tipo_permissao>' +  
368 - '<in_senha_leitura>' + in_senha_leitura + '</in_senha_leitura>' +  
369 - '<in_senha_escrita>' + in_senha_escrita + '</in_senha_escrita>' +  
370 - '<te_comentario>' + te_comentario + '</te_comentario>' +  
371 - '</compart>';  
372 - end;  
373 - end;  
374 -  
375 - if (Lista_RCC.Count = 0) then strXML := strXML + '<compart>' +  
376 - '<nm_compartilhamento></nm_compartilhamento>' +  
377 - '<nm_dir_compart></nm_dir_compart>' +  
378 - '<cs_tipo_compart></cs_tipo_compart>' +  
379 - '<te_comentario></te_comentario>' +  
380 - '</compart>';  
381 -  
382 - Reg_RCC.Free;  
383 - Lista_RCC.Free;  
384 - strXML := strXML + '</comparts>';  
385 - // Obtenho do registro o valor que foi previamente armazenado  
386 - ValorChaveRegistro := Trim(GetValorChaveRegIni('Coleta','Compartilhamentos',p_path_cacic_ini));  
387 - // Se essas informações forem diferentes significa que houve alguma alteração  
388 - // na configuração. Nesse caso, gravo as informações no BD Central e, se não houver  
389 - // problemas durante esse procedimento, atualizo as informações no registro.  
390 - If (GetValorChaveRegIni('Configs','IN_COLETA_FORCADA_COMP',p_path_cacic_ini)='S') or (strXML <> ValorChaveRegistro) Then  
391 - Begin  
392 - frmcol_comp.SetValorChaveRegIni('Col_Comp','Compartilhamentos', strXML, frmcol_comp.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_comp.ini');  
393 - End  
394 - else frmcol_comp.SetValorChaveRegIni('Col_Comp','nada', 'nada', frmcol_comp.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_comp.ini');  
395 - application.Terminate;  
396 - Except  
397 - frmcol_comp.SetValorChaveRegIni('Col_Comp','nada', 'nada', frmcol_comp.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_comp.ini');  
398 - application.Terminate;  
399 - End;  
400 -end;  
401 -  
402 -procedure Tfrmcol_comp.FormCreate(Sender: TObject);  
403 -var tstrTripa1 : TStrings;  
404 - intAux : integer;  
405 -begin  
406 - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini  
407 - tstrTripa1 := explode(ExtractFilePath(Application.Exename),'\');  
408 - p_path_cacic := '';  
409 - For intAux := 0 to tstrTripa1.Count -2 do  
410 - begin  
411 - p_path_cacic := p_path_cacic + tstrTripa1[intAux] + '\';  
412 - end;  
413 - p_path_cacic_ini := p_path_cacic + 'cacic2.ini';  
414 - Application.ShowMainForm := false;  
415 - Try  
416 - Executa_Col_comp;  
417 - Except  
418 - frmcol_comp.SetValorChaveRegIni('Col_Comp','nada', 'nada', frmcol_comp.GetValorChaveRegIni('Configs','P_PATH_COLETAS_INI',p_path_cacic + 'cacic2.ini')+'col_comp.ini');  
419 - application.Terminate;  
420 - End;  
421 -end;  
422 -  
423 -end.  
424 -