From 315361afa74f91810a8b48750123ebdade106d2e Mon Sep 17 00:00:00 2001 From: anderson.peterle@previdencia.gov.br Date: Thu, 10 Mar 2011 19:27:31 +0000 Subject: [PATCH] Exclusão para posterior reposição com versão 2.6-Beta-2 --- col_soft/col_soft.cfg | 38 -------------------------------------- col_soft/col_soft.dof | 136 ---------------------------------------------------------------------------------------------------------------------------------------- col_soft/col_soft.dpr | 746 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- col_soft/col_soft.res | Bin 16300 -> 0 bytes col_soft/col_soft_icon.ico | Bin 15134 -> 0 bytes col_soft/coleta_software.pas | 258 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ col_soft/main_soft.ddp | Bin 51 -> 0 bytes col_soft/main_soft.dfm | 22 ---------------------- col_soft/main_soft.pas | 458 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 9 files changed, 0 insertions(+), 1658 deletions(-) delete mode 100755 col_soft/col_soft.cfg delete mode 100755 col_soft/col_soft.dof delete mode 100755 col_soft/col_soft.dpr delete mode 100755 col_soft/col_soft.res delete mode 100755 col_soft/col_soft_icon.ico delete mode 100755 col_soft/coleta_software.pas delete mode 100755 col_soft/main_soft.ddp delete mode 100755 col_soft/main_soft.dfm delete mode 100755 col_soft/main_soft.pas diff --git a/col_soft/col_soft.cfg b/col_soft/col_soft.cfg deleted file mode 100755 index bce8f6c..0000000 --- a/col_soft/col_soft.cfg +++ /dev/null @@ -1,38 +0,0 @@ --$A8 --$B- --$C+ --$D+ --$E- --$F- --$G+ --$H+ --$I+ --$J- --$K- --$L+ --$M- --$N+ --$O+ --$P+ --$Q- --$R- --$S- --$T- --$U- --$V+ --$W- --$X+ --$YD --$Z1 --cg --AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; --H+ --W+ --M --$M16384,1048576 --K$00400000 --LE"c:\arquivos de programas\borland\delphi7\Projects\Bpl" --LN"c:\arquivos de programas\borland\delphi7\Projects\Bpl" --w-UNSAFE_TYPE --w-UNSAFE_CODE --w-UNSAFE_CAST diff --git a/col_soft/col_soft.dof b/col_soft/col_soft.dof deleted file mode 100755 index bf44b2d..0000000 --- a/col_soft/col_soft.dof +++ /dev/null @@ -1,136 +0,0 @@ -[FileVersion] -Version=7.0 -[Compiler] -A=8 -B=0 -C=1 -D=1 -E=0 -F=0 -G=1 -H=1 -I=1 -J=0 -K=0 -L=1 -M=0 -N=1 -O=1 -P=1 -Q=0 -R=0 -S=0 -T=0 -U=0 -V=1 -W=0 -X=1 -Y=1 -Z=1 -ShowHints=1 -ShowWarnings=1 -UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; -NamespacePrefix= -SymbolDeprecated=1 -SymbolLibrary=1 -SymbolPlatform=1 -UnitLibrary=1 -UnitPlatform=1 -UnitDeprecated=1 -HResultCompat=1 -HidingMember=1 -HiddenVirtual=1 -Garbage=1 -BoundsError=1 -ZeroNilCompat=1 -StringConstTruncated=1 -ForLoopVarVarPar=1 -TypedConstVarPar=1 -AsgToTypedConst=1 -CaseLabelRange=1 -ForVariable=1 -ConstructingAbstract=1 -ComparisonFalse=1 -ComparisonTrue=1 -ComparingSignedUnsigned=1 -CombiningSignedUnsigned=1 -UnsupportedConstruct=1 -FileOpen=1 -FileOpenUnitSrc=1 -BadGlobalSymbol=1 -DuplicateConstructorDestructor=1 -InvalidDirective=1 -PackageNoLink=1 -PackageThreadVar=1 -ImplicitImport=1 -HPPEMITIgnored=1 -NoRetVal=1 -UseBeforeDef=1 -ForLoopVarUndef=1 -UnitNameMismatch=1 -NoCFGFileFound=1 -MessageDirective=1 -ImplicitVariants=1 -UnicodeToLocale=1 -LocaleToUnicode=1 -ImagebaseMultiple=1 -SuspiciousTypecast=1 -PrivatePropAccessor=1 -UnsafeType=0 -UnsafeCode=0 -UnsafeCast=0 -[Linker] -MapFile=0 -OutputObjs=0 -ConsoleApp=1 -DebugInfo=0 -RemoteSymbols=0 -MinStackSize=16384 -MaxStackSize=1048576 -ImageBase=4194304 -ExeDescription= -[Directories] -OutputDir= -UnitOutputDir= -PackageDLLOutputDir= -PackageDCPOutputDir= -SearchPath= -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 -Conditionals= -DebugSourceDirs= -UsePackages=0 -[Parameters] -RunParams= -HostApplication= -Launcher= -UseLauncher=0 -DebugCWD= -[Language] -ActiveLang= -ProjectLang= -RootDir=C:\Arquivos de programas\Borland\Delphi7\Bin\ -[Version Info] -IncludeVerInfo=1 -AutoIncBuild=0 -MajorVer=2 -MinorVer=5 -Release=0 -Build=773 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1046 -CodePage=1252 -[Version Info Keys] -CompanyName=Dataprev - Emp. de TI da Prev.Social - URES -FileDescription=Coletor de Informações de Softwares Básicos do Sistema CACIC -FileVersion=2.5.0.773 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName=Col_SOFT -ProductVersion=2.6 -Comments=Baseado na licença GPL (General Public License) diff --git a/col_soft/col_soft.dpr b/col_soft/col_soft.dpr deleted file mode 100755 index c535eff..0000000 --- a/col_soft/col_soft.dpr +++ /dev/null @@ -1,746 +0,0 @@ -(** ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -Copyright 2000, 2001, 2002, 2003, 2004, 2005 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil - -Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de Informações Computacionais - -O CACIC é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença, ou (na sua opinião) qualquer versão. - -Este programa é distribuido na esperança que possa ser util, mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer -MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes. - -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 -Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -NOTA: O componente MiTeC System Information Component (MSIC) é baseado na classe TComponent e contém alguns subcomponentes baseados na classe TPersistent - Este componente é apenas freeware e não open-source, e foi baixado de http://www.mitec.cz/Downloads/MSIC.zip ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -*) - -program col_soft; -{$R *.res} -{$APPTYPE CONSOLE} -uses - Windows, - Classes, - SysUtils, - Registry, - MSI_SOFTWARE, - MSI_ENGINES, - MSI_OS, - MSI_XML_Reports, - CACIC_Library in '..\CACIC_Library.pas'; - -var - v_strCipherClosed : String; - v_Debugs : boolean; - -var - v_tstrCipherOpened, - v_tstrCipherOpened1, - tstrTripa1 : TStrings; - -var - intAux : integer; - -var - g_oCacic : TCACIC; - -const - CACIC_APP_NAME = 'col_soft'; - -procedure log_diario(strMsg : String); -var - HistoricoLog : TextFile; - strDataArqLocal, strDataAtual : string; -begin - try - FileSetAttr (g_oCacic.getCacicPath + 'cacic2.log',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 - AssignFile(HistoricoLog,g_oCacic.getCacicPath + 'cacic2.log'); {Associa o arquivo a uma variável do tipo TextFile} - {$IOChecks off} - Reset(HistoricoLog); {Abre o arquivo texto} - {$IOChecks on} - if (IOResult <> 0) then // Arquivo não existe, será recriado. - begin - Rewrite (HistoricoLog); - Append(HistoricoLog); - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <======================='); - end; - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(g_oCacic.getCacicPath + 'cacic2.log'))); - DateTimeToString(strDataAtual , 'yyyymmdd', Date); - if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual... - begin - Rewrite (HistoricoLog); //Cria/Recria o arquivo - Append(HistoricoLog); - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <======================='); - end; - Append(HistoricoLog); - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now)+ '[Coletor SOFT] '+strMsg); {Grava a string Texto no arquivo texto} - CloseFile(HistoricoLog); {Fecha o arquivo texto} - except - log_diario('Erro na gravação do log!'); - end; -end; - -Function CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings) : String; -var v_strCipherOpenImploded : string; - v_DatFile : TextFile; -begin - try - FileSetAttr (p_DatFileName,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 - AssignFile(v_DatFile,p_DatFileName); {Associa o arquivo a uma variável do tipo TextFile} - - // Criação do arquivo .DAT - Rewrite (v_DatFile); - Append(v_DatFile); - - v_strCipherOpenImploded := g_oCacic.implode(p_tstrCipherOpened,g_oCacic.getSeparatorKey); - v_strCipherClosed := g_oCacic.enCrypt(v_strCipherOpenImploded); - - Writeln(v_DatFile,v_strCipherClosed); {Grava a string Texto no arquivo texto} - - CloseFile(v_DatFile); - except - end; -end; - -Function CipherOpen(p_DatFileName : string) : TStrings; -var v_DatFile : TextFile; - v_strCipherOpened, - v_strCipherClosed : string; -begin - v_strCipherOpened := ''; - if FileExists(p_DatFileName) then - begin - AssignFile(v_DatFile,p_DatFileName); - {$IOChecks off} - Reset(v_DatFile); - {$IOChecks on} - if (IOResult <> 0) then // Arquivo não existe, será recriado. - begin - Rewrite (v_DatFile); - Append(v_DatFile); - end; - - Readln(v_DatFile,v_strCipherClosed); - while not EOF(v_DatFile) do Readln(v_DatFile,v_strCipherClosed); - CloseFile(v_DatFile); - v_strCipherOpened:= g_oCacic.deCrypt(v_strCipherClosed); - end; - if (trim(v_strCipherOpened)<>'') then - Result := g_oCacic.explode(v_strCipherOpened,g_oCacic.getSeparatorKey) - else - Result := g_oCacic.explode('Configs.Endereco_WS'+g_oCacic.getSeparatorKey+'/cacic2/ws/',g_oCacic.getSeparatorKey); - - if Result.Count mod 2 <> 0 then - Result.Add(''); -end; - -Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String; p_tstrCipherOpened : TStrings); -begin - // Exemplo: p_Chave => Configs.nu_ip_servidor : p_Valor => 10.71.0.120 - if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then - p_tstrCipherOpened[v_tstrCipherOpened.IndexOf(p_Chave)+1] := p_Valor - else - Begin - p_tstrCipherOpened.Add(p_Chave); - p_tstrCipherOpened.Add(p_Valor); - End; -end; - -Function GetValorDatMemoria(p_Chave : String; p_tstrCipherOpened : TStrings) : String; -begin - if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then - Result := p_tstrCipherOpened[p_tstrCipherOpened.IndexOf(p_Chave)+1] - else - Result := ''; -end; - -function GetFolderDate(Folder: string): TDateTime; -var - Rec: TSearchRec; - Found: Integer; - Date: TDateTime; -begin - - if Folder[Length(folder)] = '\' then - Delete(Folder, Length(folder), 1); - Result := 0; - Found := FindFirst(Folder, faDirectory, Rec); - try - if Found = 0 then - begin - Date := FileDateToDateTime(Rec.Time); - Result := Date; - end; - finally - FindClose(Rec); - end; -end; - - - -// Converte caracteres básicos da tabela Ansi para Ascii -// Solução temporária. -function AnsiToAscii( StrANSI: String ): String; -var i: Integer; - StrASCII, Carac : string; - Letras_ANSI : array[150..255] of String; -begin - Letras_ANSI[150] := ' '; - Letras_ANSI[169] := '©'; - Letras_ANSI[174] := '®'; - Letras_ANSI[181] := 'µ'; - Letras_ANSI[192] := 'A'; - Letras_ANSI[193] := 'A'; - Letras_ANSI[194] := 'A'; - Letras_ANSI[195] := 'A'; - Letras_ANSI[196] := 'A'; - Letras_ANSI[197] := 'A'; - Letras_ANSI[198] := 'A'; - Letras_ANSI[199] := 'C'; - Letras_ANSI[200] := 'E'; - Letras_ANSI[201] := 'E'; - Letras_ANSI[202] := 'E'; - Letras_ANSI[203] := 'E'; - Letras_ANSI[204] := 'I'; - Letras_ANSI[205] := 'I'; - Letras_ANSI[206] := 'I'; - Letras_ANSI[207] := 'I'; - Letras_ANSI[208] := 'D'; - Letras_ANSI[209] := 'N'; - Letras_ANSI[210] := 'O'; - Letras_ANSI[211] := 'O'; - Letras_ANSI[212] := 'O'; - Letras_ANSI[213] := 'O'; - Letras_ANSI[214] := 'O'; - Letras_ANSI[215] := 'x'; - Letras_ANSI[216] := 'O'; - Letras_ANSI[217] := 'U'; - Letras_ANSI[218] := 'U'; - Letras_ANSI[219] := 'U'; - Letras_ANSI[220] := 'U'; - Letras_ANSI[221] := 'Y'; - Letras_ANSI[222] := 'd'; - Letras_ANSI[223] := 'b'; - Letras_ANSI[224] := 'a'; - Letras_ANSI[225] := 'a'; - Letras_ANSI[226] := 'a'; - Letras_ANSI[227] := 'a'; - Letras_ANSI[228] := 'a'; - Letras_ANSI[229] := 'a'; - Letras_ANSI[230] := 'a'; - Letras_ANSI[231] := 'c'; - Letras_ANSI[232] := 'e'; - Letras_ANSI[233] := 'e'; - Letras_ANSI[234] := 'e'; - Letras_ANSI[235] := 'e'; - Letras_ANSI[236] := 'i'; - Letras_ANSI[237] := 'i'; - Letras_ANSI[238] := 'i'; - Letras_ANSI[239] := 'i'; - Letras_ANSI[240] := 'o'; - Letras_ANSI[241] := 'n'; - Letras_ANSI[242] := 'o'; - Letras_ANSI[243] := 'o'; - Letras_ANSI[244] := 'o'; - Letras_ANSI[245] := 'o'; - Letras_ANSI[246] := 'o'; - Letras_ANSI[247] := 'o'; - Letras_ANSI[248] := 'o'; - Letras_ANSI[249] := 'u'; - Letras_ANSI[250] := 'u'; - Letras_ANSI[251] := 'u'; - Letras_ANSI[252] := 'u'; - Letras_ANSI[253] := 'y'; - Letras_ANSI[254] := 'b'; - Letras_ANSI[255] := 'y'; - - i := 1; - StrASCII := ''; - while (i <= Length(StrANSI)) do - begin - if (Copy(StrANSI,i,2)='&#') then - Begin - Carac := Letras_ANSI[StrToInt(Copy(StrANSI,i+2,3))]; - i := i+ 5; - End - else if (Copy(StrANSI,i,4)='>') then - Begin - Carac := '?'; - i := i+ 3; - End - else if (Copy(StrANSI,i,6)='"') then - Begin - Carac := '-'; - i := i+ 5; - End - else if (Copy(StrANSI,i,6)=''') then - Begin - Carac := ''; - i := i+ 5; - End - else if (Copy(StrANSI,i,5)='&') then - Begin - Carac := ''; - i := i+ 4; - End - else Carac := Copy(StrANSI,i,1); - StrASCII := StrASCII + Carac; - i := i+1; - End; - Result := StrASCII; -end; - -procedure Grava_Debugs(strMsg : String); -var - DebugsFile : TextFile; - strDataArqLocal, strDataAtual, v_file_debugs : string; -begin - try - v_file_debugs := g_oCacic.getCacicPath + 'Temp\Debugs\debug_'+StringReplace(ExtractFileName(StrUpper(PChar(ParamStr(0)))),'.EXE','',[rfReplaceAll])+'.txt'; - FileSetAttr (v_file_debugs,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 - AssignFile(DebugsFile,v_file_debugs); {Associa o arquivo a uma variável do tipo TextFile} - - {$IOChecks off} - Reset(DebugsFile); {Abre o arquivo texto} - {$IOChecks on} - - if (IOResult <> 0) then // Arquivo não existe, será recriado. - begin - Rewrite(DebugsFile); - Append(DebugsFile); - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Debug <======================='); - end; - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(v_file_debugs))); - DateTimeToString(strDataAtual , 'yyyymmdd', Date); - - if (strDataAtual <> strDataArqLocal) then // Se o arquivo não é da data atual... - begin - Rewrite(DebugsFile); //Cria/Recria o arquivo - Append(DebugsFile); - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Debug <======================='); - end; - - Append(DebugsFile); - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + strMsg); {Grava a string Texto no arquivo texto} - CloseFile(DebugsFile); {Fecha o arquivo texto} - except - log_diario('Erro na gravação do Debug!'); - end; -end; - -Function RemoveCaracteresEspeciais(Texto : String) : String; -var I : Integer; - strAux : String; -Begin - For I := 0 To Length(Texto) Do - if ord(Texto[I]) in [32..126] Then - strAux := strAux + Texto[I] - else strAux := strAux + ' '; // Coloca um espaço onde houver caracteres especiais - Result := strAux; -end; - - -function GetRootKey(strRootKey: String): HKEY; -begin - if Trim(strRootKey) = 'HKEY_LOCAL_MACHINE' Then Result := HKEY_LOCAL_MACHINE - else if Trim(strRootKey) = 'HKEY_CLASSES_ROOT' Then Result := HKEY_CLASSES_ROOT - else if Trim(strRootKey) = 'HKEY_CURRENT_USER' Then Result := HKEY_CURRENT_USER - else if Trim(strRootKey) = 'HKEY_USERS' Then Result := HKEY_USERS - else if Trim(strRootKey) = 'HKEY_CURRENT_CONFIG' Then Result := HKEY_CURRENT_CONFIG - else if Trim(strRootKey) = 'HKEY_DYN_DATA' Then Result := HKEY_DYN_DATA; -end; - -// Função adaptada de http://www.latiumsoftware.com/en/delphi/00004.php -//Para buscar do RegEdit... -function GetValorChaveRegEdit(Chave: String): Variant; -var RegEditGet: TRegistry; - RegDataType: TRegDataType; - strRootKey, strKey, strValue, s: String; - ListaAuxGet : TStrings; - DataSize, Len, I : Integer; -begin - try - Result := ''; - ListaAuxGet := g_oCacic.explode(Chave, '\'); - - strRootKey := ListaAuxGet[0]; - For I := 1 To ListaAuxGet.Count - 2 Do strKey := strKey + ListaAuxGet[I] + '\'; - strValue := ListaAuxGet[ListaAuxGet.Count - 1]; - if (strValue = '(Padrão)') then strValue := ''; //Para os casos de se querer buscar o valor default (Padrão) - RegEditGet := TRegistry.Create; - - RegEditGet.Access := KEY_READ; - RegEditGet.Rootkey := GetRootKey(strRootKey); - if RegEditGet.OpenKeyReadOnly(strKey) then //teste - Begin - RegDataType := RegEditGet.GetDataType(strValue); - if (RegDataType = rdString) or (RegDataType = rdExpandString) then Result := RegEditGet.ReadString(strValue) - else if RegDataType = rdInteger then Result := RegEditGet.ReadInteger(strValue) - else if (RegDataType = rdBinary) or (RegDataType = rdUnknown) - then - begin - DataSize := RegEditGet.GetDataSize(strValue); - if DataSize = -1 then exit; - SetLength(s, DataSize); - Len := RegEditGet.ReadBinaryData(strValue, PChar(s)^, DataSize); - if Len <> DataSize then exit; - Result := RemoveCaracteresEspeciais(s); - end - end; - finally - RegEditGet.CloseKey; - RegEditGet.Free; - ListaAuxGet.Free; - - end; -end; - -function GetAllEnvVars():String; -var - Variable: Boolean; - Str: PChar; - Res, Retorno: string; -begin - Str :=GetEnvironmentStrings; - Res :=''; - Retorno := ''; - Variable:=False; - while True do begin - if Str^=#0 then - begin - if Variable then Retorno := Retorno + Res + '#'; - Variable:=True; - Inc(Str); - Res:=''; - if Str^=#0 then - Break - else - Res:=Res+str^; - end - else - if Variable then Res:=Res+Str^; - Inc(str); - end; - Result := Retorno; -end; - - - -function GetVersaoIE: string; -var strVersao: string; -begin - // Detalhes das versões em http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q164539& - strVersao := ''; - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Version')); - Result := strVersao; -end; - - - -function GetVersaoAcrobatReader: String; -var Reg_GVAR : TRegistry; - Lista_GVAR: TStringList; - strChave : String; -Begin - Reg_GVAR := TRegistry.Create; - Reg_GVAR.LazyWrite := False; - Lista_GVAR := TStringList.Create; - Reg_GVAR.Rootkey := HKEY_LOCAL_MACHINE; - strChave := '\Software\Adobe\Acrobat Reader'; - Reg_GVAR.OpenKeyReadOnly(strChave); - Reg_GVAR.GetKeyNames(Lista_GVAR); - Reg_GVAR.CloseKey; - If Lista_GVAR.Count > 0 Then - Begin - Lista_GVAR.Sort; - Result := Lista_GVAR.Strings[Lista_GVAR.Count - 1]; - end; - Lista_GVAR.Free; - Reg_GVAR.Free; -end; - -function GetVersaoJRE: String; -var strVersao: string; -begin - strVersao := ''; - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\CurrentVersion')); - Result := strVersao; -end; - -function GetVersaoMozilla: String; -var strVersao: string; -begin - strVersao := ''; - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\mozilla.org\Mozilla\CurrentVersion')); - Result := strVersao; -end; - -procedure Executa_Col_Soft; -var te_versao_mozilla, te_versao_ie, te_versao_jre, te_versao_acrobat_reader, - UVC,ValorChaveRegistro, te_inventario_softwares, te_variaveis_ambiente, - strDisplayName, - strKeyName : String; - InfoSoft, v_Report : TStringList; - i : integer; - v_SOFTWARE : TMiTeC_Software; - v_ENGINES : TMiTeC_Engines; - v_OS : TMiTeC_OperatingSystem; - registrySoftwares : TRegistry; -begin - Try - log_diario('Coletando informações de Softwares Básicos.'); - SetValorDatMemoria('Col_Soft.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); - te_versao_mozilla := GetVersaoMozilla; - te_versao_ie := GetVersaoIE; - te_versao_jre := GetVersaoJRE; - te_versao_acrobat_reader := GetVersaoAcrobatReader; - te_inventario_softwares := ''; - InfoSoft := TStringList.Create; - - if not g_oCacic.isWindowsGEVista then - Begin - Try - v_SOFTWARE := TMiTeC_Software.Create(nil); - v_SOFTWARE.RefreshData; - MSI_XML_Reports.Software_XML_Report(v_SOFTWARE,true,InfoSoft); - - // Caso exista a pasta ..temp/debugs, será criado o arquivo diário debug_.txt - // Usar esse recurso apenas para debug de coletas mal-sucedidas através do componente MSI-Mitec. - if v_Debugs then - Begin - v_Report := TStringList.Create; - - MSI_XML_Reports.Software_XML_Report(v_SOFTWARE,true,v_Report); - v_SOFTWARE.Free; - - v_OS := TMiTeC_OperatingSystem.Create(nil); - v_OS.RefreshData; - - MSI_XML_Reports.OperatingSystem_XML_Report(v_OS,true,v_Report); - v_OS.Free; - End - - except - log_diario('Problema em Software Report!'); - end; - - for i := 0 to v_SOFTWARE.Count - 1 do - begin - if (trim(Copy(InfoSoft[i],1,14))='
',InfoSoft[i])-16); - End; - end; - - v_SOFTWARE.Free; - end - else - Begin - // Chave para 64Bits - strKeyName := 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'; - - registrySoftwares := TRegistry.Create; - with registrySoftwares do - begin - RootKey:=HKEY_LOCAL_MACHINE; - if OpenKey(strKeyName,False)=True then GetKeyNames(InfoSoft); - CloseKey; - - for i:=0 to InfoSoft.Count-1 do - begin - RootKey:=HKEY_LOCAL_MACHINE; - OpenKey(strKeyName + '\'+InfoSoft[i],False); - strDisplayName := ReadString('DisplayName'); - if (strDisplayName <> '') then - Begin - if (Copy(strDisplayName,1,1)='{') then - begin - OpenKey(strKeyName + '\'+InfoSoft[i]+'\'+strDisplayName,False); - strDisplayName := ReadString('DisplayName'); - end; - - if (te_inventario_softwares <> '') then - te_inventario_softwares := te_inventario_softwares + '#'; - te_inventario_softwares := te_inventario_softwares + strDisplayName; - end; - CloseKey; - end; - end; - - // Caso a consulta acima tenha retornado vazio, tentarei a chave para 32Bits - strKeyName := 'Software\Microsoft\Windows\CurrentVersion\Uninstall'; - - with registrySoftwares do - begin - RootKey:=HKEY_LOCAL_MACHINE; - if OpenKey(strKeyName,False)=True then GetKeyNames(InfoSoft); - CloseKey; - - for i:=0 to InfoSoft.Count-1 do - begin - RootKey:=HKEY_LOCAL_MACHINE; - OpenKey(strKeyName + '\'+InfoSoft[i],False); - strDisplayName := ReadString('DisplayName'); - if (strDisplayName <> '') then - Begin - if (Copy(strDisplayName,1,1)='{') then - begin - OpenKey(strKeyName + '\'+InfoSoft[i]+'\'+strDisplayName,False); - strDisplayName := ReadString('DisplayName'); - end; - - if (te_inventario_softwares <> '') then - te_inventario_softwares := te_inventario_softwares + '#'; - te_inventario_softwares := te_inventario_softwares + strDisplayName; - end; - CloseKey; - end; - end; - - // - end; - - try - te_inventario_softwares := AnsiToAscii(te_inventario_softwares); - except - log_diario('Falha após a Conversão ANSIxASCII'); - end; - - InfoSoft.Free; - - // Pego todas as variáveis de ambiente. - te_variaveis_ambiente := GetAllEnvVars(); - - v_ENGINES := TMiTeC_Engines.Create(nil); - v_ENGINES.RefreshData; - - // Caso exista a pasta ..temp/debugs, será criado o arquivo diário debug_.txt - // Usar esse recurso apenas para debug de coletas mal-sucedidas através do componente MSI-Mitec. - if (v_Debugs) then - Begin - MSI_XML_Reports.Engines_XML_Report(v_ENGINES,true,v_Report); - End; - - // Monto a string que será comparada com o valor armazenado no registro. - UVC := v_Engines.ODBC + ';' + - v_Engines.BDE + ';' + - v_Engines.DAO + ';' + - v_Engines.ADO + ';' + - v_Engines.DirectX.Version + ';' + - te_versao_mozilla + ';' + - te_versao_ie + ';' + - te_versao_acrobat_reader + ';' + - te_versao_jre + ';' + - te_inventario_softwares + - te_variaveis_ambiente; - - - // Obtenho do registro o valor que foi previamente armazenado - ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Software',v_tstrCipherOpened)); - - SetValorDatMemoria('Col_Soft.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); - - // Se essas informações forem diferentes significa que houve alguma alteração - // na configuração. Nesse caso, gravo as informações no BD Central - // e, se não houver problemas durante esse procedimento, atualizo as - // informações no registro. - If (GetValorDatMemoria('Configs.IN_COLETA_FORCADA_SOFT',v_tstrCipherOpened)='S') or - (UVC <> ValorChaveRegistro) Then - Begin - //Envio via rede para ao Agente Gerente, para gravação no BD. - SetValorDatMemoria('Col_Soft.te_versao_bde' , v_ENGINES.BDE , v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.te_versao_dao' , v_ENGINES.DAO , v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.te_versao_ado' , v_ENGINES.ADO , v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.te_versao_odbc' , v_ENGINES.ODBC , v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.te_versao_directx' , v_ENGINES.DirectX.Version, v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.te_versao_acrobat_reader', te_versao_acrobat_reader , v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.te_versao_ie' , te_versao_ie , v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.te_versao_mozilla' , te_versao_mozilla , v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.te_versao_jre' , te_versao_jre , v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.te_inventario_softwares' , te_inventario_softwares , v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.te_variaveis_ambiente' , te_variaveis_ambiente , v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.UVC' , UVC , v_tstrCipherOpened1); - CipherClose(g_oCacic.getCacicPath + 'temp\col_soft.dat', v_tstrCipherOpened1); - end - else - Begin - SetValorDatMemoria('Col_Soft.nada', 'nada', v_tstrCipherOpened1); - CipherClose(g_oCacic.getCacicPath + 'temp\col_soft.dat', v_tstrCipherOpened1); - End; - v_ENGINES.Free; - - // Caso exista a pasta ..temp/debugs, será criado o arquivo diário debug_.txt - // Usar esse recurso apenas para debug de coletas mal-sucedidas através do componente MSI-Mitec. - if v_Debugs then - Begin - for i:=0 to v_Report.count-1 do - Begin - Grava_Debugs(v_report[i]); - End; - v_report.Free; - End; - Except - Begin - SetValorDatMemoria('Col_Soft.nada', 'nada', v_tstrCipherOpened1); - SetValorDatMemoria('Col_Soft.Fim' , '99999999', v_tstrCipherOpened1); - CipherClose(g_oCacic.getCacicPath + 'temp\col_soft.dat', v_tstrCipherOpened1); - End; - End; -end; - -var strAux : String; -begin - g_oCacic := TCACIC.Create(); - - g_oCacic.setBoolCipher(true); - - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then - if (ParamCount>0) then - Begin - strAux := ''; - For intAux := 1 to ParamCount do - Begin - if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then - begin - strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); - end; - end; - - if (strAux <> '') then - Begin - g_oCacic.setCacicPath(strAux); - - v_tstrCipherOpened := TStrings.Create; - v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); - - v_tstrCipherOpened1 := TStrings.Create; - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_soft.dat'); - - Try - v_Debugs := false; - - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then - Begin - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then - Begin - v_Debugs := true; - log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); - End; - End; - - Executa_Col_Soft; - Except - SetValorDatMemoria('Col_Soft.nada', 'nada', v_tstrCipherOpened1); - CipherClose(g_oCacic.getCacicPath + 'temp\col_soft.dat', v_tstrCipherOpened1); - End; - End; - End; - - g_oCacic.Free(); - -end. diff --git a/col_soft/col_soft.res b/col_soft/col_soft.res deleted file mode 100755 index b2516e9..0000000 Binary files a/col_soft/col_soft.res and /dev/null differ diff --git a/col_soft/col_soft_icon.ico b/col_soft/col_soft_icon.ico deleted file mode 100755 index e2b1a87..0000000 Binary files a/col_soft/col_soft_icon.ico and /dev/null differ diff --git a/col_soft/coleta_software.pas b/col_soft/coleta_software.pas deleted file mode 100755 index 7decd52..0000000 --- a/col_soft/coleta_software.pas +++ /dev/null @@ -1,258 +0,0 @@ -unit coleta_software; - -interface - -uses Windows, SysUtils, Classes, registry; - -function GetWinVer: Integer; -function GetVersaoIE: string; -function GetVersaoJRE: String; -function GetVersaoAcrobatReader: String; -function GetVersaoMozilla: String; -procedure RealizarColetaSoftware; -procedure RealizarColetaSoftwareNaoOpcional; - -implementation - -Uses registro, main, comunicacao, utils; - - -function GetWinVer: Integer; -const - { operating system (OS)constants } - cOsUnknown = 0; - cOsWin95 = 1; - cOsWin95OSR2 = 2; // Não implementado. - cOsWin98 = 3; - cOsWin98SE = 4; - cOsWinME = 5; - cOsWinNT = 6; - cOsWin2000 = 7; - cOsXP = 8; -var - osVerInfo: TOSVersionInfo; - majorVer, minorVer: Integer; -begin - - - -{ Memo1.Lines.Add(OSVersion); - Memo1.Lines.Add(CSD); - Memo1.Lines.Add(Format('%d.%d.%d',[MSystemInfo.OS.MajorVersion,MSystemInfo.OS.MinorVersion,MSystemInfo.OS.BuildNumber])); - Memo1.Lines.Add(MSystemInfo.OS.NTSpecific.HotFixes); - Memo1.Lines.Add(MSystemInfo.OS.Version); - Memo1.Lines.Add(MSystemInfo.OS.CSDEx); - Memo1.Lines.Add(MSystemInfo.OS.ProductID); - Memo1.Lines.Add(MSystemInfo.os.LanguageID); - -} - Result := cOsUnknown; - { set operating system type flag } - osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); - if GetVersionEx(osVerInfo) then - begin - majorVer := osVerInfo.dwMajorVersion; - minorVer := osVerInfo.dwMinorVersion; - case osVerInfo.dwPlatformId of - VER_PLATFORM_WIN32_NT: { Windows NT/2000 } - begin - if majorVer <= 4 then - Result := cOsWinNT - else if (majorVer = 5) and (minorVer = 0) then - Result := cOsWin2000 - else if (majorVer = 5) and (minorVer = 1) then - Result := cOsXP - else - Result := cOsUnknown; - end; - VER_PLATFORM_WIN32_WINDOWS: { Windows 9x/ME } - begin - if (majorVer = 4) and (minorVer = 0) then - Result := cOsWin95 - else if (majorVer = 4) and (minorVer = 10) then - begin - if osVerInfo.szCSDVersion[1] = 'A' then - Result := cOsWin98SE - else - Result := cOsWin98; - end - else if (majorVer = 4) and (minorVer = 90) then - Result := cOsWinME - else - Result := cOsUnknown; - end; - else - Result := cOsUnknown; - end; - end - else - Result := cOsUnknown; -end; - - -function GetVersaoIE: string; -var strVersao: string; -begin - // Detalhes das versões em http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q164539& - strVersao := ''; - strVersao := Trim(Registro.GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Version')); - Result := strVersao; -end; - - - -function GetVersaoAcrobatReader: String; -var Reg_GVAR : TRegistry; - Lista_GVAR: TStringList; - strChave : String; -Begin - Reg_GVAR := TRegistry.Create; - Reg_GVAR.LazyWrite := False; - Lista_GVAR := TStringList.Create; - Reg_GVAR.Rootkey := HKEY_LOCAL_MACHINE; - strChave := '\Software\Adobe\Acrobat Reader'; - Reg_GVAR.OpenKeyReadOnly(strChave); - Reg_GVAR.GetKeyNames(Lista_GVAR); - Reg_GVAR.CloseKey; - If Lista_GVAR.Count > 0 Then - Begin - Lista_GVAR.Sort; - Result := Lista_GVAR.Strings[Lista_GVAR.Count - 1]; - end; - Lista_GVAR.Free; - Reg_GVAR.Free; -end; - - - - -function GetVersaoJRE: String; -var strVersao: string; -begin - strVersao := ''; - strVersao := Trim(Registro.GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\CurrentVersion')); - Result := strVersao; -end; - - -function GetVersaoMozilla: String; -var strVersao: string; -begin - strVersao := ''; - strVersao := Trim(Registro.GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\mozilla.org\Mozilla\CurrentVersion')); - Result := strVersao; -end; - - - -procedure RealizarColetaSoftware; -var Request_RCS: TStringList; - te_versao_mozilla, te_versao_ie, te_versao_jre, te_versao_acrobat_reader, - ValorChaveColetado, ValorChaveRegistro : String; -begin - if (CS_COLETA_SOFTWARE) Then - Begin - main.frmMain.Log_Historico('* Coletando informações de software.'); - Try main.frmMain.MSystemInfo.Engines.GetInfo; except end; - - te_versao_mozilla := GetVersaoMozilla; - te_versao_ie := GetVersaoIE; - te_versao_jre := GetVersaoJRE; - te_versao_acrobat_reader := GetVersaoAcrobatReader; - - - // Monto a string que será comparada com o valor armazenado no registro. - ValorChaveColetado := main.frmMain.MSystemInfo.Engines.ODBC + ';' + - main.frmMain.MSystemInfo.Engines.BDE + ';' + - main.frmMain.MSystemInfo.Engines.DAO + ';' + - main.frmMain.MSystemInfo.Engines.ADO + ';' + - main.frmMain.MSystemInfo.Engines.DirectX.Version + ';' + - te_versao_mozilla + ';' + - te_versao_ie + ';' + - te_versao_acrobat_reader + ';' + - te_versao_jre; - - // Obtenho do registro o valor que foi previamente armazenado - ValorChaveRegistro := Trim(Registro.GetValorChaveRegIni('Coleta','Software',p_path_cacic_ini)); - - // Se essas informações forem diferentes significa que houve alguma alteração - // na configuração. Nesse caso, gravo as informações no BD Central - // e, se não houver problemas durante esse procedimento, atualizo as - // informações no registro. - If (IN_COLETA_FORCADA or (ValorChaveColetado <> ValorChaveRegistro)) Then - Begin - //Envio via rede para ao Agente Gerente, para gravação no BD. - Request_RCS:=TStringList.Create; - Request_RCS.Values['te_node_address'] := TE_NODE_ADDRESS; - Request_RCS.Values['id_so'] := ID_SO; - Request_RCS.Values['te_nome_computador'] := TE_NOME_COMPUTADOR; - Request_RCS.Values['te_versao_bde'] := main.frmMain.MSystemInfo.Engines.BDE; - Request_RCS.Values['te_versao_dao'] := main.frmMain.MSystemInfo.Engines.DAO ; - Request_RCS.Values['te_versao_ado'] := main.frmMain.MSystemInfo.Engines.ADO; - Request_RCS.Values['te_versao_odbc'] := main.frmMain.MSystemInfo.Engines.ODBC; - Request_RCS.Values['te_versao_directx'] := main.frmMain.MSystemInfo.Engines.DirectX.Version; - Request_RCS.Values['te_versao_acrobat_reader'] := te_versao_acrobat_reader; - Request_RCS.Values['te_versao_ie'] := te_versao_ie; - Request_RCS.Values['te_versao_mozilla'] := te_versao_mozilla; - Request_RCS.Values['te_versao_jre'] := te_versao_jre; - - // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD - //Sobreponho a informação no registro para posterior comparação, na próxima execução. - if (comunicacao.ComunicaServidor('set_software.php', Request_RCS, '>> Enviando informações de software para o servidor.') <> '0') Then - Begin - Registro.SetValorChaveRegIni('Coleta','Software', ValorChaveColetado,p_path_cacic_ini); - end; - Request_RCS.Free; - end; - end - else main.frmMain.Log_Historico('Coleta de informações de software não configurada.'); -end; - - - - - - -// Essa coleta não é opcional, ou seja, o administrador não tem como desabilitá-la. -// Por isso foi necessário criá-la de forma independente da procedure RealizarColetaSoftware. -procedure RealizarColetaSoftwareNaoOpcional; -var Request_RCSN: TStringList; - te_versao_cacic, ValorChaveColetado, ValorChaveRegistro : String; -begin - - main.frmMain.Log_Historico('* Coletando informações básicas de software.'); - te_versao_cacic := utils.getVersionInfo(ParamStr(0)); - - // Monto a string que será comparada com o valor armazenado no registro. - ValorChaveColetado := te_versao_cacic; - - // Obtenho do registro o valor que foi previamente armazenado - ValorChaveRegistro := Trim(Registro.GetValorChaveRegIni('Coleta','SoftwareNaoOpcional',p_path_cacic_ini)); - - // Se essas informações forem diferentes significa que houve alguma alteração - // na configuração. Nesse caso, gravo as informações no BD Central - // e, se não houver problemas durante esse procedimento, atualizo as - // informações no registro. - - If (IN_COLETA_FORCADA or (ValorChaveColetado <> ValorChaveRegistro)) Then - Begin - //Envio via rede para ao Agente Gerente, para gravação no BD. - Request_RCSN:=TStringList.Create; - Request_RCSN.Values['te_node_address'] := TE_NODE_ADDRESS; - Request_RCSN.Values['id_so'] := ID_SO; - Request_RCSN.Values['te_nome_computador'] := TE_NOME_COMPUTADOR; - Request_RCSN.Values['te_versao_cacic'] := te_versao_cacic; - - // Somente atualizo o registro caso não tenha havido nenhum erro durante o envio das informações para o BD - //Sobreponho a informação no registro para posterior comparação, na próxima execução. - if (comunicacao.ComunicaServidor('set_software_nao_opcional.php', Request_RCSN, '>> Enviando informações básicas de software para o servidor.') <> '0') Then - Begin - Registro.SetValorChaveRegIni('Coleta','SoftwareNaoOpcional', ValorChaveColetado,p_path_cacic_ini); - end; - Request_RCSN.Free; - end; -end; - - - -end. diff --git a/col_soft/main_soft.ddp b/col_soft/main_soft.ddp deleted file mode 100755 index 4370276..0000000 Binary files a/col_soft/main_soft.ddp and /dev/null differ diff --git a/col_soft/main_soft.dfm b/col_soft/main_soft.dfm deleted file mode 100755 index 8ca426c..0000000 --- a/col_soft/main_soft.dfm +++ /dev/null @@ -1,22 +0,0 @@ -object frm_col_soft: Tfrm_col_soft - Left = 910 - Top = 714 - Width = 112 - Height = 27 - Caption = 'CACIC - Coletor Software' - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - OldCreateOrder = False - OnCreate = FormCreate - PixelsPerInch = 96 - TextHeight = 13 - object MSystemInfo1: TMSystemInfo - ExceptionModes = [emDefault] - Left = 120 - Top = 96 - end -end diff --git a/col_soft/main_soft.pas b/col_soft/main_soft.pas deleted file mode 100755 index 2543f48..0000000 --- a/col_soft/main_soft.pas +++ /dev/null @@ -1,458 +0,0 @@ -(** ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -Copyright 2000, 2001, 2002, 2003, 2004, 2005 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil - -Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de Informações Computacionais - -O CACIC é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença, ou (na sua opinião) qualquer versão. - -Este programa é distribuido na esperança que possa ser util, mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer -MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes. - -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 -Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -NOTA: O componente MiTeC System Information Component (MSIC) é baseado na classe TComponent e contém alguns subcomponentes baseados na classe TPersistent - Este componente é apenas freeware e não open-source, e foi baixado de http://www.mitec.cz/Downloads/MSIC.zip ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -*) - -unit main_soft; - -interface - -uses Windows, IniFiles, Forms, Classes, SysUtils, Registry, MSI_GUI; -var p_path_cacic, p_path_cacic_ini : string; - -type - Tfrm_col_soft = class(TForm) - MSystemInfo1: TMSystemInfo; - procedure FormCreate(Sender: TObject); - private - procedure Executa_Col_Soft; - procedure Log_Historico(strMsg : String); - function GetAllEnvVars():String; - function SetValorChaveRegIni(p_Secao: String; p_Chave: String; p_Valor: String; p_Path : String): String; - Function Crip(PNome: String): String; - Function DesCrip(PNome: String): String; - function GetValorChaveRegIni(p_SectionName, p_KeyName, p_IniFileName : String) : String; - function GetValorChaveRegEdit(Chave: String): Variant; - Function Explode(Texto, Separador : String) : TStrings; - Function GetRootKey(strRootKey: String): HKEY; - Function RemoveCaracteresEspeciais(Texto : String) : String; - function GetVersaoIE: string; - function GetVersaoAcrobatReader: String; - function GetVersaoJRE: String; - function GetVersaoMozilla: String; - public - { Public declarations } - end; - -var - frm_col_soft: Tfrm_col_soft; - -implementation - -uses StrUtils; - -{$R *.dfm} - -function Tfrm_col_soft.GetAllEnvVars():String; -var - Variable: Boolean; - Str: PChar; - Res, Retorno: string; -begin - Str :=GetEnvironmentStrings; - Res :=''; - Retorno := ''; - Variable:=False; - while True do begin - if Str^=#0 then - begin - if Variable then Retorno := Retorno + Res + '#'; - Variable:=True; - Inc(Str); - Res:=''; - if Str^=#0 then - Break - else - Res:=Res+str^; - end - else - if Variable then Res:=Res+Str^; - Inc(str); - end; - Result := Retorno; -end; - - -//Para gravar no Arquivo INI... -function Tfrm_col_soft.SetValorChaveRegIni(p_Secao: String; p_Chave: String; p_Valor: String; p_Path : String): String; -var Reg_Ini : TIniFile; -begin - FileSetAttr (p_Path,0); - Reg_Ini := TIniFile.Create(p_Path); -// Reg_Ini.WriteString(frm_col_soft.Crip(p_Secao), frm_col_soft.Crip(p_Chave), frm_col_soft.Crip(p_Valor)); - Reg_Ini.WriteString(p_Secao, p_Chave, p_Valor); - Reg_Ini.Free; -end; - -//Para buscar do Arquivo INI... -// Marreta devido a limitações do KERNEL w9x no tratamento de arquivos texto e suas seções -function Tfrm_col_soft.GetValorChaveRegIni(p_SectionName, p_KeyName, p_IniFileName : String) : String; -var - FileText : TStringList; - i, j, v_Size_Section, v_Size_Key : integer; - v_SectionName, v_KeyName : string; - begin - Result := ''; - v_SectionName := '[' + p_SectionName + ']'; - v_Size_Section := strLen(PChar(v_SectionName)); - v_KeyName := p_KeyName + '='; - v_Size_Key := strLen(PChar(v_KeyName)); - FileText := TStringList.Create; - try - FileText.LoadFromFile(p_IniFileName); - For i := 0 To FileText.Count - 1 Do - Begin - if (LowerCase(Trim(PChar(Copy(FileText[i],1,v_Size_Section)))) = LowerCase(Trim(PChar(v_SectionName)))) then - Begin - For j := i to FileText.Count - 1 Do - Begin - if (LowerCase(Trim(PChar(Copy(FileText[j],1,v_Size_Key)))) = LowerCase(Trim(PChar(v_KeyName)))) then - Begin - Result := PChar(Copy(FileText[j],v_Size_Key + 1,strLen(PChar(FileText[j]))-v_Size_Key)); - Break; - End; - End; - End; - if (Result <> '') then break; - End; - finally - FileText.Free; - end; - end; - - -Function Tfrm_col_soft.Explode(Texto, Separador : String) : TStrings; -var - strItem : String; - ListaAuxUTILS : TStrings; - NumCaracteres, I : Integer; -Begin - ListaAuxUTILS := TStringList.Create; - strItem := ''; - NumCaracteres := Length(Texto); - For I := 0 To NumCaracteres Do - If (Texto[I] = Separador) or (I = NumCaracteres) Then - Begin - If (I = NumCaracteres) then strItem := strItem + Texto[I]; - ListaAuxUTILS.Add(Trim(strItem)); - strItem := ''; - end - Else strItem := strItem + Texto[I]; - Explode := ListaAuxUTILS; -end; - -function Tfrm_col_soft.GetRootKey(strRootKey: String): HKEY; -begin - if Trim(strRootKey) = 'HKEY_LOCAL_MACHINE' Then Result := HKEY_LOCAL_MACHINE - else if Trim(strRootKey) = 'HKEY_CLASSES_ROOT' Then Result := HKEY_CLASSES_ROOT - else if Trim(strRootKey) = 'HKEY_CURRENT_USER' Then Result := HKEY_CURRENT_USER - else if Trim(strRootKey) = 'HKEY_USERS' Then Result := HKEY_USERS - else if Trim(strRootKey) = 'HKEY_CURRENT_CONFIG' Then Result := HKEY_CURRENT_CONFIG - else if Trim(strRootKey) = 'HKEY_DYN_DATA' Then Result := HKEY_DYN_DATA; -end; - -Function Tfrm_col_soft.RemoveCaracteresEspeciais(Texto : String) : String; -var I : Integer; - strAux : String; -Begin - For I := 0 To Length(Texto) Do - if ord(Texto[I]) in [32..126] Then - strAux := strAux + Texto[I] - else strAux := strAux + ' '; // Coloca um espaço onde houver caracteres especiais - Result := strAux; -end; - - - -function Tfrm_col_soft.GetVersaoIE: string; -var strVersao: string; -begin - // Detalhes das versões em http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q164539& - strVersao := ''; - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Version')); - Result := strVersao; -end; - -// Função adaptada de http://www.latiumsoftware.com/en/delphi/00004.php -//Para buscar do RegEdit... -function Tfrm_col_soft.GetValorChaveRegEdit(Chave: String): Variant; -var RegEditGet: TRegistry; - RegDataType: TRegDataType; - strRootKey, strKey, strValue, s: String; - ListaAuxGet : TStrings; - DataSize, Len, I : Integer; -begin - try - Result := ''; - ListaAuxGet := Explode(Chave, '\'); - - strRootKey := ListaAuxGet[0]; - For I := 1 To ListaAuxGet.Count - 2 Do strKey := strKey + ListaAuxGet[I] + '\'; - strValue := ListaAuxGet[ListaAuxGet.Count - 1]; - if (strValue = '(Padrão)') then strValue := ''; //Para os casos de se querer buscar o valor default (Padrão) - RegEditGet := TRegistry.Create; - - RegEditGet.Access := KEY_READ; - RegEditGet.Rootkey := GetRootKey(strRootKey); - if RegEditGet.OpenKeyReadOnly(strKey) then //teste - Begin - RegDataType := RegEditGet.GetDataType(strValue); - if (RegDataType = rdString) or (RegDataType = rdExpandString) then Result := RegEditGet.ReadString(strValue) - else if RegDataType = rdInteger then Result := RegEditGet.ReadInteger(strValue) - else if (RegDataType = rdBinary) or (RegDataType = rdUnknown) - then - begin - DataSize := RegEditGet.GetDataSize(strValue); - if DataSize = -1 then exit; - SetLength(s, DataSize); - Len := RegEditGet.ReadBinaryData(strValue, PChar(s)^, DataSize); - if Len <> DataSize then exit; - Result := RemoveCaracteresEspeciais(s); - end - end; - finally - RegEditGet.CloseKey; - RegEditGet.Free; - ListaAuxGet.Free; - - end; -end; - - -function Tfrm_col_soft.GetVersaoAcrobatReader: String; -var Reg_GVAR : TRegistry; - Lista_GVAR: TStringList; - strChave : String; -Begin - Reg_GVAR := TRegistry.Create; - Reg_GVAR.LazyWrite := False; - Lista_GVAR := TStringList.Create; - Reg_GVAR.Rootkey := HKEY_LOCAL_MACHINE; - strChave := '\Software\Adobe\Acrobat Reader'; - Reg_GVAR.OpenKeyReadOnly(strChave); - Reg_GVAR.GetKeyNames(Lista_GVAR); - Reg_GVAR.CloseKey; - If Lista_GVAR.Count > 0 Then - Begin - Lista_GVAR.Sort; - Result := Lista_GVAR.Strings[Lista_GVAR.Count - 1]; - end; - Lista_GVAR.Free; - Reg_GVAR.Free; -end; - -function Tfrm_col_soft.GetVersaoJRE: String; -var strVersao: string; -begin - strVersao := ''; - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\CurrentVersion')); - Result := strVersao; -end; - -function Tfrm_col_soft.GetVersaoMozilla: String; -var strVersao: string; -begin - strVersao := ''; - strVersao := Trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\Software\mozilla.org\Mozilla\CurrentVersion')); - Result := strVersao; -end; - -procedure Tfrm_col_soft.Executa_Col_Soft; -var te_versao_mozilla, te_versao_ie, te_versao_jre, te_versao_acrobat_reader, - ValorChaveColetado,ValorChaveRegistro, te_inventario_softwares, te_variaveis_ambiente : String; - InfoSoft : TStringList; - i : integer; -begin - Try - Log_Historico('* Coletando informações de Softwares Básicos.'); - - Try MSystemInfo1.Engines.GetInfo; except end; - te_versao_mozilla := GetVersaoMozilla; - te_versao_ie := GetVersaoIE; - te_versao_jre := GetVersaoJRE; - te_versao_acrobat_reader := GetVersaoAcrobatReader; - - Try MSystemInfo1.Software.GetInfo; except end; - InfoSoft := TStringList.Create; - Try MSystemInfo1.Software.Report(InfoSoft,false); except end; - - for i := 0 to InfoSoft.Count - 1 do - begin - if (trim(MidStr(InfoSoft[i],13,Pos('type=',InfoSoft[i])-15))<>'') then - Begin - if (te_inventario_softwares <> '') then te_inventario_softwares := te_inventario_softwares + '#'; - te_inventario_softwares := te_inventario_softwares + MidStr(InfoSoft[i],13,Pos('type=',InfoSoft[i])-15); - End; - end; - InfoSoft.Free; - - // Pego todas as variáveis de ambiente. - te_variaveis_ambiente := GetAllEnvVars(); - - // Monto a string que será comparada com o valor armazenado no registro. - ValorChaveColetado := MSystemInfo1.Engines.ODBC + ';' + - MSystemInfo1.Engines.BDE + ';' + - MSystemInfo1.Engines.DAO + ';' + - MSystemInfo1.Engines.ADO + ';' + - MSystemInfo1.Engines.DirectX.Version + ';' + - te_versao_mozilla + ';' + - te_versao_ie + ';' + - te_versao_acrobat_reader + ';' + - te_versao_jre + ';' + - te_inventario_softwares + - te_variaveis_ambiente; - - // Obtenho do registro o valor que foi previamente armazenado - ValorChaveRegistro := Trim(GetValorChaveRegIni('Coleta','Software',p_path_cacic_ini)); - - - // Se essas informações forem diferentes significa que houve alguma alteração - // na configuração. Nesse caso, gravo as informações no BD Central - // e, se não houver problemas durante esse procedimento, atualizo as - // informações no registro. - If (GetValorChaveRegIni('Configs','IN_COLETA_FORCADA_SOFT',p_path_cacic_ini)='S') or - (ValorChaveColetado <> ValorChaveRegistro) Then - Begin - //Envio via rede para ao Agente Gerente, para gravação no BD. - 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'); - 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'); - 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'); - 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'); - 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'); - 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'); - 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'); - 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'); - 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'); - 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'); - 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'); - 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'); - end - else - 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'); - Application.Terminate; - Except - 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'); - Application.Terminate; - End; -end; - - -procedure Tfrm_col_soft.Log_Historico(strMsg : String); -var - HistoricoLog : TextFile; - strDataArqLocal, strDataAtual : string; -begin - try - FileSetAttr (p_path_cacic + 'cacic2.log',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 - AssignFile(HistoricoLog,p_path_cacic + 'cacic2.log'); {Associa o arquivo a uma variável do tipo TextFile} - {$IOChecks off} - Reset(HistoricoLog); {Abre o arquivo texto} - {$IOChecks on} - if (IOResult <> 0) then // Arquivo não existe, será recriado. - begin - Rewrite (HistoricoLog); - Append(HistoricoLog); - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <======================='); - end; - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(p_path_cacic + 'cacic2.log'))); - DateTimeToString(strDataAtual , 'yyyymmdd', Date); - if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual... - begin - Rewrite (HistoricoLog); //Cria/Recria o arquivo - Append(HistoricoLog); - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <======================='); - end; - Append(HistoricoLog); - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + strMsg); {Grava a string Texto no arquivo texto} - CloseFile(HistoricoLog); {Fecha o arquivo texto} -// FileSetAttr (ExtractFilePath(Application.Exename) + '\cacic2.log',6); // Muda o atributo para arquivo de SISTEMA e OCULTO - - except - Log_Historico('Erro na gravação do log!'); - end; -end; -// Simples rotinas de Criptografação e Descriptografação -// Baixadas de http://www.costaweb.com.br/forum/delphi/474.shtml -Function Tfrm_col_soft.Crip(PNome: String): String; -Var - TamI, TamF: Integer; - SenA, SenM, SenD: String; -Begin - SenA := Trim(PNome); - TamF := Length(SenA); - if (TamF > 1) then - begin - SenM := ''; - SenD := ''; - For TamI := TamF Downto 1 do - Begin - SenM := SenM + Copy(SenA,TamI,1); - End; - SenD := Chr(TamF+95)+Copy(SenM,1,1)+Copy(SenA,1,1)+Copy(SenM,2,TamF-2)+Chr(75+TamF); - end - else SenD := SenA; - Result := SenD; -End; - -Function Tfrm_col_soft.DesCrip(PNome: String): String; -Var - TamI, TamF: Integer; - SenA, SenM, SenD: String; -Begin - SenA := Trim(PNome); - TamF := Length(SenA) - 2; - if (TamF > 1) then - begin - SenM := ''; - SenD := ''; - SenA := Copy(SenA,2,TamF); - SenM := Copy(SenA,1,1)+Copy(SenA,3,TamF)+Copy(SenA,2,1); - For TamI := TamF Downto 1 do - Begin - SenD := SenD + Copy(SenM,TamI,1); - End; - end - else SenD := SenA; - Result := SenD; -End; - - -procedure Tfrm_col_soft.FormCreate(Sender: TObject); -var tstrTripa1 : TStrings; - intAux : integer; -begin - - //Pegarei o nível anterior do diretório, que deve ser, por exemplo \Cacic, para leitura do cacic2.ini - tstrTripa1 := explode(ExtractFilePath(Application.Exename),'\'); - p_path_cacic := ''; - For intAux := 0 to tstrTripa1.Count -2 do - begin - p_path_cacic := p_path_cacic + tstrTripa1[intAux] + '\'; - end; - p_path_cacic_ini := p_path_cacic + 'cacic2.ini'; - Application.ShowMainForm := false; - - Try - Executa_Col_Soft; - Except - 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'); - Application.Terminate; - End; -end; -end. - -- libgit2 0.21.2