Commit e32a719b4d802681401bc49b24f1097ff173acc9
1 parent
eb8d42dd
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@961 fecfc0c7-e812-0410-ae72-849f08638ee7
Showing
5 changed files
with
0 additions
and
1199 deletions
Show diff stats
col_hard/col_hard.cfg
| ... | ... | @@ -1,35 +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" |
col_hard/col_hard.dof
| ... | ... | @@ -1,136 +0,0 @@ |
| 1 | -[FileVersion] | |
| 2 | -Version=7.0 | |
| 3 | -[Compiler] | |
| 4 | -A=8 | |
| 5 | -B=0 | |
| 6 | -C=1 | |
| 7 | -D=1 | |
| 8 | -E=0 | |
| 9 | -F=0 | |
| 10 | -G=1 | |
| 11 | -H=1 | |
| 12 | -I=1 | |
| 13 | -J=0 | |
| 14 | -K=0 | |
| 15 | -L=1 | |
| 16 | -M=0 | |
| 17 | -N=1 | |
| 18 | -O=1 | |
| 19 | -P=1 | |
| 20 | -Q=0 | |
| 21 | -R=0 | |
| 22 | -S=0 | |
| 23 | -T=0 | |
| 24 | -U=0 | |
| 25 | -V=1 | |
| 26 | -W=0 | |
| 27 | -X=1 | |
| 28 | -Y=1 | |
| 29 | -Z=1 | |
| 30 | -ShowHints=1 | |
| 31 | -ShowWarnings=1 | |
| 32 | -UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; | |
| 33 | -NamespacePrefix= | |
| 34 | -SymbolDeprecated=1 | |
| 35 | -SymbolLibrary=1 | |
| 36 | -SymbolPlatform=1 | |
| 37 | -UnitLibrary=1 | |
| 38 | -UnitPlatform=1 | |
| 39 | -UnitDeprecated=1 | |
| 40 | -HResultCompat=1 | |
| 41 | -HidingMember=1 | |
| 42 | -HiddenVirtual=1 | |
| 43 | -Garbage=1 | |
| 44 | -BoundsError=1 | |
| 45 | -ZeroNilCompat=1 | |
| 46 | -StringConstTruncated=1 | |
| 47 | -ForLoopVarVarPar=1 | |
| 48 | -TypedConstVarPar=1 | |
| 49 | -AsgToTypedConst=1 | |
| 50 | -CaseLabelRange=1 | |
| 51 | -ForVariable=1 | |
| 52 | -ConstructingAbstract=1 | |
| 53 | -ComparisonFalse=1 | |
| 54 | -ComparisonTrue=1 | |
| 55 | -ComparingSignedUnsigned=1 | |
| 56 | -CombiningSignedUnsigned=1 | |
| 57 | -UnsupportedConstruct=1 | |
| 58 | -FileOpen=1 | |
| 59 | -FileOpenUnitSrc=1 | |
| 60 | -BadGlobalSymbol=1 | |
| 61 | -DuplicateConstructorDestructor=1 | |
| 62 | -InvalidDirective=1 | |
| 63 | -PackageNoLink=1 | |
| 64 | -PackageThreadVar=1 | |
| 65 | -ImplicitImport=1 | |
| 66 | -HPPEMITIgnored=1 | |
| 67 | -NoRetVal=1 | |
| 68 | -UseBeforeDef=1 | |
| 69 | -ForLoopVarUndef=1 | |
| 70 | -UnitNameMismatch=1 | |
| 71 | -NoCFGFileFound=1 | |
| 72 | -MessageDirective=1 | |
| 73 | -ImplicitVariants=1 | |
| 74 | -UnicodeToLocale=1 | |
| 75 | -LocaleToUnicode=1 | |
| 76 | -ImagebaseMultiple=1 | |
| 77 | -SuspiciousTypecast=1 | |
| 78 | -PrivatePropAccessor=1 | |
| 79 | -UnsafeType=1 | |
| 80 | -UnsafeCode=1 | |
| 81 | -UnsafeCast=1 | |
| 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;dclOfficeXP | |
| 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= | |
| 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 Hardware do Sistema CACIC | |
| 129 | -FileVersion=2.5.0.773 | |
| 130 | -InternalName= | |
| 131 | -LegalCopyright= | |
| 132 | -LegalTrademarks= | |
| 133 | -OriginalFilename= | |
| 134 | -ProductName=Col_Hard | |
| 135 | -ProductVersion=2.6 | |
| 136 | -Comments=Baseado na licença GPL (General Public License) |
col_hard/col_hard.dpr
| ... | ... | @@ -1,1028 +0,0 @@ |
| 1 | -(** | |
| 2 | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 3 | -Copyright 2000, 2001, 2002, 2003, 2004, 2005 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil | |
| 4 | - | |
| 5 | -Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de Informações Computacionais | |
| 6 | - | |
| 7 | -O CACIC é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como | |
| 8 | -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença, ou (na sua opinião) qualquer versão. | |
| 9 | - | |
| 10 | -Este programa é distribuido na esperança que possa ser util, mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer | |
| 11 | -MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes. | |
| 12 | - | |
| 13 | -Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software | |
| 14 | -Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 15 | - | |
| 16 | -NOTA: O componente MiTeC System Information Component (MSIC) é baseado na classe TComponent e contém alguns subcomponentes baseados na classe TPersistent | |
| 17 | - Este componente é apenas freeware e não open-source, e foi baixado de http://www.mitec.cz/Downloads/MSIC.zip | |
| 18 | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 19 | -*) | |
| 20 | - | |
| 21 | -program col_hard; | |
| 22 | -{$R *.res} | |
| 23 | -{$APPTYPE CONSOLE} | |
| 24 | - | |
| 25 | -uses | |
| 26 | - Windows, | |
| 27 | - Registry, | |
| 28 | - SysUtils, | |
| 29 | - Classes, | |
| 30 | - IniFiles, | |
| 31 | - MSI_SMBIOS, | |
| 32 | - MSI_Devices, | |
| 33 | - MSI_CPU, | |
| 34 | - MSI_DISPLAY, | |
| 35 | - MSI_MEDIA, | |
| 36 | - MSI_NETWORK, | |
| 37 | - MSI_XML_Reports, | |
| 38 | - PJVersionInfo, | |
| 39 | - CACIC_Library in '..\CACIC_Library.pas'; | |
| 40 | - | |
| 41 | -var | |
| 42 | - v_mensagem, | |
| 43 | - v_strCipherClosed : String; | |
| 44 | - v_debugs : boolean; | |
| 45 | - v_tstrCipherOpened, | |
| 46 | - v_tstrCipherOpened1, | |
| 47 | - tstrTripa1 : TStrings; | |
| 48 | - intAux : integer; | |
| 49 | - g_oCacic : TCACIC; | |
| 50 | - | |
| 51 | - | |
| 52 | -// Dica baixada de http://www.marcosdellantonio.net/2007/06/14/operador-if-ternario-em-delphi-e-c/ | |
| 53 | -// Fiz isso para não ter que acrescentar o componente Math ao USES! | |
| 54 | -function iif(condicao : boolean; resTrue, resFalse : Variant) : Variant; | |
| 55 | - Begin | |
| 56 | - if condicao then | |
| 57 | - Result := resTrue | |
| 58 | - else | |
| 59 | - Result := resFalse; | |
| 60 | - End; | |
| 61 | - | |
| 62 | -procedure log_diario(strMsg : String); | |
| 63 | -var | |
| 64 | - HistoricoLog : TextFile; | |
| 65 | - strDataArqLocal, strDataAtual : string; | |
| 66 | -begin | |
| 67 | - try | |
| 68 | - FileSetAttr (g_oCacic.getCacicPath + 'cacic2.log',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 | |
| 69 | - AssignFile(HistoricoLog,g_oCacic.getCacicPath + 'cacic2.log'); {Associa o arquivo a uma variável do tipo TextFile} | |
| 70 | - {$IOChecks off} | |
| 71 | - Reset(HistoricoLog); {Abre o arquivo texto} | |
| 72 | - {$IOChecks on} | |
| 73 | - if (IOResult <> 0) then // Arquivo não existe, será recriado. | |
| 74 | - begin | |
| 75 | - Rewrite (HistoricoLog); | |
| 76 | - Append(HistoricoLog); | |
| 77 | - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log <======================='); | |
| 78 | - end; | |
| 79 | - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(g_oCacic.getCacicPath + 'cacic2.log'))); | |
| 80 | - DateTimeToString(strDataAtual , 'yyyymmdd', Date); | |
| 81 | - if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual... | |
| 82 | - begin | |
| 83 | - Rewrite (HistoricoLog); //Cria/Recria o arquivo | |
| 84 | - Append(HistoricoLog); | |
| 85 | - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log <======================='); | |
| 86 | - end; | |
| 87 | - Append(HistoricoLog); | |
| 88 | - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now)+ '[Coletor HARD] '+strMsg); {Grava a string Texto no arquivo texto} | |
| 89 | - CloseFile(HistoricoLog); {Fecha o arquivo texto} | |
| 90 | -// FileSetAttr (ExtractFilePath(Application.Exename) + '\cacic2.log',6); // Muda o atributo para arquivo de SISTEMA e OCULTO | |
| 91 | - | |
| 92 | - except | |
| 93 | - log_diario('Erro na gravação do log!'); | |
| 94 | - end; | |
| 95 | -end; | |
| 96 | - | |
| 97 | - | |
| 98 | - | |
| 99 | -Function CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings) : String; | |
| 100 | -var v_strCipherOpenImploded : string; | |
| 101 | - v_DatFile : TextFile; | |
| 102 | -begin | |
| 103 | - try | |
| 104 | - FileSetAttr (p_DatFileName,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 | |
| 105 | - AssignFile(v_DatFile,p_DatFileName); {Associa o arquivo a uma variável do tipo TextFile} | |
| 106 | - | |
| 107 | - // Criação do arquivo .DAT | |
| 108 | - Rewrite (v_DatFile); | |
| 109 | - Append(v_DatFile); | |
| 110 | - | |
| 111 | - v_strCipherOpenImploded := g_oCacic.implode(p_tstrCipherOpened,g_oCacic.getSeparatorKey); | |
| 112 | - v_strCipherClosed := g_oCacic.enCrypt(v_strCipherOpenImploded); | |
| 113 | - | |
| 114 | - Writeln(v_DatFile,v_strCipherClosed); {Grava a string Texto no arquivo texto} | |
| 115 | - | |
| 116 | - CloseFile(v_DatFile); | |
| 117 | - except | |
| 118 | - end; | |
| 119 | -end; | |
| 120 | - | |
| 121 | -Function CipherOpen(p_DatFileName : string) : TStrings; | |
| 122 | -var v_DatFile : TextFile; | |
| 123 | - v_strCipherOpened, | |
| 124 | - v_strCipherClosed : string; | |
| 125 | -begin | |
| 126 | - v_strCipherOpened := ''; | |
| 127 | - if FileExists(p_DatFileName) then | |
| 128 | - begin | |
| 129 | - AssignFile(v_DatFile,p_DatFileName); | |
| 130 | - {$IOChecks off} | |
| 131 | - Reset(v_DatFile); | |
| 132 | - {$IOChecks on} | |
| 133 | - if (IOResult <> 0) then // Arquivo não existe, será recriado. | |
| 134 | - begin | |
| 135 | - Rewrite (v_DatFile); | |
| 136 | - Append(v_DatFile); | |
| 137 | - end; | |
| 138 | - | |
| 139 | - Readln(v_DatFile,v_strCipherClosed); | |
| 140 | - while not EOF(v_DatFile) do Readln(v_DatFile,v_strCipherClosed); | |
| 141 | - CloseFile(v_DatFile); | |
| 142 | - v_strCipherOpened:= g_oCacic.deCrypt(v_strCipherClosed); | |
| 143 | - end; | |
| 144 | - if (trim(v_strCipherOpened)<>'') then | |
| 145 | - Result := g_oCacic.explode(v_strCipherOpened,g_oCacic.getSeparatorKey) | |
| 146 | - else | |
| 147 | - 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); | |
| 148 | - | |
| 149 | - if Result.Count mod 2 <> 0 then | |
| 150 | - Result.Add(''); | |
| 151 | -end; | |
| 152 | - | |
| 153 | -Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String; p_tstrCipherOpened : TStrings); | |
| 154 | -begin | |
| 155 | - // Exemplo: p_Chave => Configs.nu_ip_servidor : p_Valor => 10.71.0.120 | |
| 156 | - if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then | |
| 157 | - p_tstrCipherOpened[v_tstrCipherOpened.IndexOf(p_Chave)+1] := p_Valor | |
| 158 | - else | |
| 159 | - Begin | |
| 160 | - p_tstrCipherOpened.Add(p_Chave); | |
| 161 | - p_tstrCipherOpened.Add(p_Valor); | |
| 162 | - End; | |
| 163 | -end; | |
| 164 | -Function GetValorDatMemoria(p_Chave : String; p_tstrCipherOpened : TStrings) : String; | |
| 165 | -begin | |
| 166 | - if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then | |
| 167 | - Result := p_tstrCipherOpened[p_tstrCipherOpened.IndexOf(p_Chave)+1] | |
| 168 | - else | |
| 169 | - Result := ''; | |
| 170 | -end; | |
| 171 | -function VerFmt(const MS, LS: DWORD): string; | |
| 172 | - // Format the version number from the given DWORDs containing the info | |
| 173 | -begin | |
| 174 | - Result := Format('%d.%d.%d.%d', | |
| 175 | - [HiWord(MS), LoWord(MS), HiWord(LS), LoWord(LS)]) | |
| 176 | -end; | |
| 177 | - | |
| 178 | -function GetVersionInfo(p_File: string):string; | |
| 179 | -var PJVersionInfo1: TPJVersionInfo; | |
| 180 | -begin | |
| 181 | - PJVersionInfo1 := TPJVersionInfo.Create(nil); | |
| 182 | - PJVersionInfo1.FileName := PChar(p_File); | |
| 183 | - Result := VerFmt(PJVersionInfo1.FixedFileInfo.dwFileVersionMS, PJVersionInfo1.FixedFileInfo.dwFileVersionLS); | |
| 184 | - PJVersionInfo1.Free; | |
| 185 | -end; | |
| 186 | - | |
| 187 | -procedure log_DEBUG(p_msg:string); | |
| 188 | -Begin | |
| 189 | - if v_Debugs then log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg); | |
| 190 | -End; | |
| 191 | - | |
| 192 | -// Função criada devido a divergências entre os valores retornados pelos métodos dos componentes MSI e seus Reports. | |
| 193 | -function Parse(p_ClassName, p_SectionName, p_DataName:string; p_Report : TStringList) : String; | |
| 194 | -var intClasses, intSections, intDatas, v_achei_SectionName, v_array_SectionName_Count : integer; | |
| 195 | - v_ClassName, v_DataName, v_string_consulta : string; | |
| 196 | - v_array_SectionName : tstrings; | |
| 197 | -begin | |
| 198 | - Log_DEBUG('p_ClassName => "'+p_ClassName+'" p_SectionName => "'+p_SectionName+'" p_DataName => "'+p_DataName+'"'); | |
| 199 | - Result := ''; | |
| 200 | - if (p_SectionName <> '') then | |
| 201 | - Begin | |
| 202 | - v_array_SectionName := g_oCacic.explode(p_SectionName,'/'); | |
| 203 | - v_array_SectionName_Count := v_array_SectionName.Count; | |
| 204 | - End | |
| 205 | - else v_array_SectionName_Count := 0; | |
| 206 | - | |
| 207 | - v_achei_SectionName := 0; | |
| 208 | - v_ClassName := 'classname="' + p_ClassName + '">'; | |
| 209 | - v_DataName := '<data name="' + p_DataName + '"'; | |
| 210 | - intClasses := 0; | |
| 211 | - try | |
| 212 | - While intClasses < p_Report.Count Do | |
| 213 | - Begin | |
| 214 | - if (pos(v_ClassName,p_Report[intClasses])>0) then | |
| 215 | - Begin | |
| 216 | - intSections := intClasses; | |
| 217 | - While intSections < p_Report.Count Do | |
| 218 | - Begin | |
| 219 | - | |
| 220 | - if (p_SectionName<>'') then | |
| 221 | - Begin | |
| 222 | - v_string_consulta := '<section name="' + v_array_SectionName[v_achei_SectionName]+'">'; | |
| 223 | - if (pos(v_string_consulta,p_Report[intSections])>0) then v_achei_SectionName := v_achei_SectionName+1; | |
| 224 | - End; | |
| 225 | - | |
| 226 | - if (v_achei_SectionName = v_array_SectionName_Count) then | |
| 227 | - Begin | |
| 228 | - | |
| 229 | - intDatas := intSections; | |
| 230 | - While intDatas < p_Report.Count Do | |
| 231 | - Begin | |
| 232 | - | |
| 233 | - if (pos(v_DataName,p_Report[intDatas])>0) then | |
| 234 | - Begin | |
| 235 | - Result := Copy(p_Report[intDatas],pos('>',p_Report[intDatas])+1,length(p_Report[intDatas])); | |
| 236 | - Result := StringReplace(Result,'</data>','',[rfReplaceAll]); | |
| 237 | - intClasses := p_Report.Count; | |
| 238 | - intSections := p_Report.Count; | |
| 239 | - intDatas := p_Report.Count; | |
| 240 | - End; | |
| 241 | - intDatas := intDatas + 1; | |
| 242 | - End; //for intDatas... | |
| 243 | - End; // if pos(v_SectionName... | |
| 244 | - intSections := intSections + 1; | |
| 245 | - End; // for intSections... | |
| 246 | - End; // if pos(v_ClassName... | |
| 247 | - intClasses := intClasses + 1; | |
| 248 | - End; // for intClasses... | |
| 249 | - except | |
| 250 | - Begin | |
| 251 | - log_diario('ERRO! Problema na rotina parse'); | |
| 252 | - End; | |
| 253 | - end; | |
| 254 | - end; | |
| 255 | - | |
| 256 | -function GetFolderDate(Folder: string): TDateTime; | |
| 257 | -var | |
| 258 | - Rec: TSearchRec; | |
| 259 | - Found: Integer; | |
| 260 | - Date: TDateTime; | |
| 261 | -begin | |
| 262 | - if Folder[Length(folder)] = '\' then | |
| 263 | - Delete(Folder, Length(folder), 1); | |
| 264 | - Result := 0; | |
| 265 | - Found := FindFirst(Folder, faDirectory, Rec); | |
| 266 | - try | |
| 267 | - if Found = 0 then | |
| 268 | - begin | |
| 269 | - Date := FileDateToDateTime(Rec.Time); | |
| 270 | - Result := Date; | |
| 271 | - end; | |
| 272 | - finally | |
| 273 | - FindClose(Rec); | |
| 274 | - end; | |
| 275 | -end; | |
| 276 | - | |
| 277 | -procedure Grava_Debugs(strMsg : String); | |
| 278 | -var | |
| 279 | - DebugsFile : TextFile; | |
| 280 | - strDataArqLocal, strDataAtual, v_file_debugs : string; | |
| 281 | -begin | |
| 282 | - try | |
| 283 | - v_file_debugs := g_oCacic.getCacicPath + 'Temp\Debugs\debug_'+StringReplace(ExtractFileName(StrUpper(PChar(ParamStr(0)))),'.EXE','',[rfReplaceAll])+'.txt'; | |
| 284 | - FileSetAttr (v_file_debugs,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 | |
| 285 | - AssignFile(DebugsFile,v_file_debugs); {Associa o arquivo a uma variável do tipo TextFile} | |
| 286 | - | |
| 287 | - {$IOChecks off} | |
| 288 | - Reset(DebugsFile); {Abre o arquivo texto} | |
| 289 | - {$IOChecks on} | |
| 290 | - | |
| 291 | - if (IOResult <> 0) then // Arquivo não existe, será recriado. | |
| 292 | - begin | |
| 293 | - Rewrite(DebugsFile); | |
| 294 | - Append(DebugsFile); | |
| 295 | - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Debug <======================='); | |
| 296 | - end; | |
| 297 | - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(v_file_debugs))); | |
| 298 | - DateTimeToString(strDataAtual , 'yyyymmdd', Date); | |
| 299 | - | |
| 300 | - if (strDataAtual <> strDataArqLocal) then // Se o arquivo não é da data atual... | |
| 301 | - begin | |
| 302 | - Rewrite(DebugsFile); //Cria/Recria o arquivo | |
| 303 | - Append(DebugsFile); | |
| 304 | - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Debug <======================='); | |
| 305 | - end; | |
| 306 | - | |
| 307 | - Append(DebugsFile); | |
| 308 | - Writeln(DebugsFile,FormatDateTime('dd/mm hh:nn:ss : ', Now) + strMsg); {Grava a string Texto no arquivo texto} | |
| 309 | - CloseFile(DebugsFile); {Fecha o arquivo texto} | |
| 310 | - except | |
| 311 | - log_diario('Erro na gravação do Debug!'); | |
| 312 | - end; | |
| 313 | -end; | |
| 314 | - | |
| 315 | - | |
| 316 | - | |
| 317 | -// Converte caracteres básicos da tabela Ansi para Ascii | |
| 318 | -// Solução temporária. | |
| 319 | -function AnsiToAscii( StrANSI: String ): String; | |
| 320 | -var i: Integer; | |
| 321 | - StrASCII, Carac : string; | |
| 322 | - Letras_ANSI : array[150..255] of String; | |
| 323 | -begin | |
| 324 | - Letras_ANSI[150] := ' '; | |
| 325 | - Letras_ANSI[169] := '©'; | |
| 326 | - Letras_ANSI[174] := '®'; | |
| 327 | - Letras_ANSI[181] := 'µ'; | |
| 328 | - Letras_ANSI[192] := 'A'; | |
| 329 | - Letras_ANSI[193] := 'A'; | |
| 330 | - Letras_ANSI[194] := 'A'; | |
| 331 | - Letras_ANSI[195] := 'A'; | |
| 332 | - Letras_ANSI[196] := 'A'; | |
| 333 | - Letras_ANSI[197] := 'A'; | |
| 334 | - Letras_ANSI[198] := 'A'; | |
| 335 | - Letras_ANSI[199] := 'C'; | |
| 336 | - Letras_ANSI[200] := 'E'; | |
| 337 | - Letras_ANSI[201] := 'E'; | |
| 338 | - Letras_ANSI[202] := 'E'; | |
| 339 | - Letras_ANSI[203] := 'E'; | |
| 340 | - Letras_ANSI[204] := 'I'; | |
| 341 | - Letras_ANSI[205] := 'I'; | |
| 342 | - Letras_ANSI[206] := 'I'; | |
| 343 | - Letras_ANSI[207] := 'I'; | |
| 344 | - Letras_ANSI[208] := 'D'; | |
| 345 | - Letras_ANSI[209] := 'N'; | |
| 346 | - Letras_ANSI[210] := 'O'; | |
| 347 | - Letras_ANSI[211] := 'O'; | |
| 348 | - Letras_ANSI[212] := 'O'; | |
| 349 | - Letras_ANSI[213] := 'O'; | |
| 350 | - Letras_ANSI[214] := 'O'; | |
| 351 | - Letras_ANSI[215] := 'x'; | |
| 352 | - Letras_ANSI[216] := 'O'; | |
| 353 | - Letras_ANSI[217] := 'U'; | |
| 354 | - Letras_ANSI[218] := 'U'; | |
| 355 | - Letras_ANSI[219] := 'U'; | |
| 356 | - Letras_ANSI[220] := 'U'; | |
| 357 | - Letras_ANSI[221] := 'Y'; | |
| 358 | - Letras_ANSI[222] := 'd'; | |
| 359 | - Letras_ANSI[223] := 'b'; | |
| 360 | - Letras_ANSI[224] := 'a'; | |
| 361 | - Letras_ANSI[225] := 'a'; | |
| 362 | - Letras_ANSI[226] := 'a'; | |
| 363 | - Letras_ANSI[227] := 'a'; | |
| 364 | - Letras_ANSI[228] := 'a'; | |
| 365 | - Letras_ANSI[229] := 'a'; | |
| 366 | - Letras_ANSI[230] := 'a'; | |
| 367 | - Letras_ANSI[231] := 'c'; | |
| 368 | - Letras_ANSI[232] := 'e'; | |
| 369 | - Letras_ANSI[233] := 'e'; | |
| 370 | - Letras_ANSI[234] := 'e'; | |
| 371 | - Letras_ANSI[235] := 'e'; | |
| 372 | - Letras_ANSI[236] := 'i'; | |
| 373 | - Letras_ANSI[237] := 'i'; | |
| 374 | - Letras_ANSI[238] := 'i'; | |
| 375 | - Letras_ANSI[239] := 'i'; | |
| 376 | - Letras_ANSI[240] := 'o'; | |
| 377 | - Letras_ANSI[241] := 'n'; | |
| 378 | - Letras_ANSI[242] := 'o'; | |
| 379 | - Letras_ANSI[243] := 'o'; | |
| 380 | - Letras_ANSI[244] := 'o'; | |
| 381 | - Letras_ANSI[245] := 'o'; | |
| 382 | - Letras_ANSI[246] := 'o'; | |
| 383 | - Letras_ANSI[247] := 'o'; | |
| 384 | - Letras_ANSI[248] := 'o'; | |
| 385 | - Letras_ANSI[249] := 'u'; | |
| 386 | - Letras_ANSI[250] := 'u'; | |
| 387 | - Letras_ANSI[251] := 'u'; | |
| 388 | - Letras_ANSI[252] := 'u'; | |
| 389 | - Letras_ANSI[253] := 'y'; | |
| 390 | - Letras_ANSI[254] := 'b'; | |
| 391 | - Letras_ANSI[255] := 'y'; | |
| 392 | - | |
| 393 | - i := 1; | |
| 394 | - StrASCII := ''; | |
| 395 | - while (i <= Length(StrANSI)) do | |
| 396 | - begin | |
| 397 | - if (Copy(StrANSI,i,2)='&#') then | |
| 398 | - Begin | |
| 399 | - Carac := Letras_ANSI[StrToInt(Copy(StrANSI,i+2,3))]; | |
| 400 | - i := i+ 5; | |
| 401 | - End | |
| 402 | - else if (Copy(StrANSI,i,4)='>') then | |
| 403 | - Begin | |
| 404 | - Carac := '?'; | |
| 405 | - i := i+ 3; | |
| 406 | - End | |
| 407 | - else if (Copy(StrANSI,i,6)='"') then | |
| 408 | - Begin | |
| 409 | - Carac := '-'; | |
| 410 | - i := i+ 5; | |
| 411 | - End | |
| 412 | - else if (Copy(StrANSI,i,6)=''') then | |
| 413 | - Begin | |
| 414 | - Carac := ''; | |
| 415 | - i := i+ 5; | |
| 416 | - End | |
| 417 | - else if (Copy(StrANSI,i,5)='&') then | |
| 418 | - Begin | |
| 419 | - Carac := ''; | |
| 420 | - i := i+ 4; | |
| 421 | - End | |
| 422 | - else Carac := Copy(StrANSI,i,1); | |
| 423 | - StrASCII := StrASCII + Carac; | |
| 424 | - i := i+1; | |
| 425 | - End; | |
| 426 | - Result := StrASCII; | |
| 427 | -end; | |
| 428 | -// Baixada de http://www.geocities.com/SiliconValley/Bay/1058/fdelphi.html | |
| 429 | -Function Rat(OQue: String; Onde: String) : Integer; | |
| 430 | -// Procura uma string dentro de outra, da direita para esquerda | |
| 431 | -// Retorna a posição onde foi encontrada ou 0 caso não seja encontrada | |
| 432 | -var | |
| 433 | -Pos : Integer; | |
| 434 | -Tam1 : Integer; | |
| 435 | -Tam2 : Integer; | |
| 436 | -Achou : Boolean; | |
| 437 | -begin | |
| 438 | -Tam1 := Length(OQue); | |
| 439 | -Tam2 := Length(Onde); | |
| 440 | -Pos := Tam2-Tam1+1; | |
| 441 | -Achou := False; | |
| 442 | -while (Pos >= 1) and not Achou do | |
| 443 | - begin | |
| 444 | - if Copy(Onde, Pos, Tam1) = OQue then | |
| 445 | - begin | |
| 446 | - Achou := True | |
| 447 | - end | |
| 448 | - else | |
| 449 | - begin | |
| 450 | - Pos := Pos - 1; | |
| 451 | - end; | |
| 452 | - end; | |
| 453 | -Result := Pos; | |
| 454 | -end; | |
| 455 | - | |
| 456 | -Function TrataExcecoesMacAddress(p_mac:String; p_excecao:String): String; | |
| 457 | -var tstrEXCECOES : TStrings; | |
| 458 | -var intAux1, v_conta_EXCECOES : integer; | |
| 459 | - | |
| 460 | -Begin | |
| 461 | - Result := ''; | |
| 462 | - v_conta_EXCECOES := 0; | |
| 463 | - if (p_excecao <> '') then | |
| 464 | - Begin | |
| 465 | - tstrEXCECOES := g_oCacic.explode(p_excecao,','); // Excecoes a serem tratadas | |
| 466 | - for intAux1 := 0 to tstrEXCECOES.Count-1 Do | |
| 467 | - Begin | |
| 468 | - if (rat(tstrEXCECOES[intAux1],p_mac) > 0) then | |
| 469 | - Begin | |
| 470 | - v_conta_EXCECOES := 1; | |
| 471 | - break; | |
| 472 | - End; | |
| 473 | - End; | |
| 474 | - End; | |
| 475 | - if (v_conta_EXCECOES = 0) then | |
| 476 | - Begin | |
| 477 | - Result := p_mac; | |
| 478 | - End; | |
| 479 | -End; | |
| 480 | - | |
| 481 | -procedure Executa_Col_Hard; | |
| 482 | -var v_te_cpu_fabricante, | |
| 483 | - v_te_cpu_desc, | |
| 484 | - v_te_cpu_serial, | |
| 485 | - v_te_cpu_frequencia, | |
| 486 | - v_te_placa_rede_desc, | |
| 487 | - v_te_placa_som_desc, | |
| 488 | - v_te_cdrom_desc, | |
| 489 | - v_te_teclado_desc, | |
| 490 | - v_te_modem_desc, | |
| 491 | - v_te_mouse_desc, | |
| 492 | - v_te_mem_ram_desc, | |
| 493 | - v_te_mem_ram_tipo, | |
| 494 | - v_qt_placa_video_mem, | |
| 495 | - v_te_placa_video_resolucao, | |
| 496 | - v_te_placa_video_desc, | |
| 497 | - v_qt_placa_video_cores, | |
| 498 | - v_te_bios_fabricante, | |
| 499 | - v_te_bios_data, | |
| 500 | - v_te_bios_desc, | |
| 501 | - v_te_placa_mae_fabricante, | |
| 502 | - v_te_placa_mae_desc, | |
| 503 | - UVC, | |
| 504 | - ValorChaveRegistro, | |
| 505 | - v_DataName, | |
| 506 | - v_SectionName, | |
| 507 | - v_Macs_Invalidos, | |
| 508 | - v_Mac_Address, | |
| 509 | - v_Tripa_CDROM, | |
| 510 | - v_Tripa_TCPIP, | |
| 511 | - v_Tripa_CPU, | |
| 512 | - strAux, | |
| 513 | - v_PhysicalAddress, | |
| 514 | - v_IPAddress, | |
| 515 | - v_IPMask, | |
| 516 | - v_Gateway_IPAddress, | |
| 517 | - v_DHCP_IPAddress, | |
| 518 | - v_PrimaryWINS_IPAddress, | |
| 519 | - v_SecondaryWINS_IPAddress : String; | |
| 520 | - i, j, count : Integer; | |
| 521 | - v_qt_mem_ram : WORD; | |
| 522 | - v_CPU : TMiTeC_CPU; | |
| 523 | - v_DISPLAY : TMiTeC_Display; | |
| 524 | - v_MEDIA : TMiTeC_Media; | |
| 525 | - v_DEVICES : TMiTeC_Devices; | |
| 526 | - v_TCP : TMiTeC_TCPIP; | |
| 527 | - v_SMBIOS : TMiTeC_SMBIOS; | |
| 528 | - v_MemoriaRAM : TMemoryStatus; | |
| 529 | - v_Report, | |
| 530 | - v_tstrCPU, | |
| 531 | - v_tstrCDROM, | |
| 532 | - v_tstrTCPIP : TStringList; | |
| 533 | - | |
| 534 | - v_cpu_freq : TStrings; | |
| 535 | - v_registry : TRegistry; | |
| 536 | - | |
| 537 | -begin | |
| 538 | - | |
| 539 | - v_Debugs := false; | |
| 540 | - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 541 | - Begin | |
| 542 | - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 543 | - Begin | |
| 544 | - v_Debugs := true; | |
| 545 | - //log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 546 | - End; | |
| 547 | - End; | |
| 548 | - | |
| 549 | - Try | |
| 550 | - SetValorDatMemoria('Col_Hard.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); | |
| 551 | - v_Report := TStringList.Create; | |
| 552 | - log_diario('Coletando informações de Hardware.'); | |
| 553 | - | |
| 554 | - v_cpu_freq := TStringList.Create; | |
| 555 | - v_tstrCPU := TStringList.Create; | |
| 556 | - v_tstrCDROM := TStringList.Create; | |
| 557 | - v_tstrTCPIP := TStringList.Create; | |
| 558 | - | |
| 559 | - Try | |
| 560 | - Begin | |
| 561 | - Log_Debug('Instanciando SMBIOS para obter frequencia de CPU...'); | |
| 562 | - v_SMBIOS := TMiTeC_SMBIOS.Create(nil); | |
| 563 | - v_SMBIOS.RefreshData; | |
| 564 | - v_te_cpu_frequencia := 'ND'; | |
| 565 | - if(v_SMBIOS.Processor[0].Frequency > 0) then | |
| 566 | - v_te_cpu_frequencia := inttostr(v_SMBIOS.Processor[0].Frequency) + 'Mhz' // Frequancia de CPU via BIOS | |
| 567 | - else begin | |
| 568 | - v_registry := TRegistry.Create; | |
| 569 | - try | |
| 570 | - v_registry.RootKey := HKEY_LOCAL_MACHINE; | |
| 571 | - try | |
| 572 | - if(v_registry.Openkey('HARDWARE\DESCRIPTION\System\CentralProcessor\0\', False)) then begin | |
| 573 | - v_te_cpu_frequencia := inttostr(v_registry.ReadInteger('~MHz'))+'Mhz'; // Frequencia de CPU via Regitry | |
| 574 | - v_registry.CloseKey; | |
| 575 | - end; | |
| 576 | - except | |
| 577 | - log_diario('CPU - informação de frequência ['+v_te_cpu_frequencia+'] não disponível (by SMBIOS/Registry): '); | |
| 578 | - end; | |
| 579 | - finally | |
| 580 | - v_registry.Free; | |
| 581 | - end; | |
| 582 | - end; | |
| 583 | - v_SMBIOS.Free; | |
| 584 | - | |
| 585 | - Log_Debug('CPU - frequência estática (by SMBIOS/Registry): '+v_te_cpu_frequencia); | |
| 586 | - | |
| 587 | - Log_Debug('Instanciando v_CPU...'); | |
| 588 | - v_CPU := TMiTeC_CPU.Create(nil); | |
| 589 | - Log_Debug('Atualização de dados de CPU...'); | |
| 590 | - v_CPU.RefreshData; | |
| 591 | - Log_Debug('Dados de CPU atualizados - OK!'); | |
| 592 | - | |
| 593 | - // Obtem dados de CPU | |
| 594 | - Try | |
| 595 | - for i:=0 to v_CPU.CPUCount-1 do begin | |
| 596 | - v_te_cpu_serial := v_CPU.SerialNumber; | |
| 597 | - v_te_cpu_desc := v_CPU.CPUName; | |
| 598 | - if(v_te_cpu_desc = '') then | |
| 599 | - v_te_cpu_desc := v_CPU.MarketingName; | |
| 600 | - | |
| 601 | - v_te_cpu_fabricante := cVendorNames[v_CPU.Vendor].Prefix; | |
| 602 | - | |
| 603 | - Log_Debug('CPU - frequência dinâmica (by CPU): '+inttostr(v_CPU.Frequency) + 'Mhz'); | |
| 604 | - | |
| 605 | - // Se pegou ao menos a descrição, adiciona-se à tripa... | |
| 606 | - if (v_te_cpu_desc <> '') then | |
| 607 | - Begin | |
| 608 | - v_tstrCPU.Add('te_cpu_desc###' + v_te_cpu_desc + '#FIELD#' + | |
| 609 | - 'te_cpu_fabricante###' + v_te_cpu_fabricante + '#FIELD#' + | |
| 610 | - 'te_cpu_serial###' + v_te_cpu_serial + '#FIELD#' + | |
| 611 | - 'te_cpu_frequencia###' + v_te_cpu_frequencia); | |
| 612 | - Log_Debug('Adicionando a tstrCPU: "'+v_tstrCPU[v_tstrCPU.count-1]); | |
| 613 | - Log_DEBUG('Tamanho de v_tstrCPU 0: '+intToStr(v_tstrCPU.Count)); | |
| 614 | - End; | |
| 615 | - end; | |
| 616 | - Except | |
| 617 | - log_diario('Problemas ao coletar dados de CPU!'); | |
| 618 | - end; | |
| 619 | - v_CPU.Free; | |
| 620 | - Log_DEBUG('Tamanho de v_tstrCPU 1: '+intToStr(v_tstrCPU.Count)); | |
| 621 | - | |
| 622 | - // Media informations | |
| 623 | - Try | |
| 624 | - v_MEDIA := TMiTeC_Media.Create(nil); | |
| 625 | - v_MEDIA.RefreshData; | |
| 626 | - if v_Media.SoundCardIndex>-1 then begin | |
| 627 | - //n:=Tree.Items.AddChild(r,Media.Devices[Media.SoundCardIndex]); | |
| 628 | - v_te_placa_som_desc := v_Media.Devices[v_Media.SoundCardIndex]; | |
| 629 | - end; | |
| 630 | - except log_diario('Problemas ao coletar dados de Aúdio'); | |
| 631 | - end; | |
| 632 | - | |
| 633 | - Log_Debug('Dados de aúdio coletados - OK!'); | |
| 634 | - | |
| 635 | - // Devices informations | |
| 636 | - Try | |
| 637 | - Log_Debug('Instanciando v_DEVICES...'); | |
| 638 | - v_DEVICES := TMiTeC_Devices.Create(nil); | |
| 639 | - Log_Debug('RefreshingData...'); | |
| 640 | - v_DEVICES.RefreshData; | |
| 641 | - if v_Debugs then MSI_XML_Reports.Devices_XML_Report(v_DEVICES,TRUE,v_Report); | |
| 642 | - Log_Debug('v_DEVICES.DeviceCount = '+intToStr(v_DEVICES.DeviceCount)); | |
| 643 | - i := 0; | |
| 644 | - While i < v_DEVICES.DeviceCount do | |
| 645 | - Begin | |
| 646 | - v_mensagem := 'Obtendo Descrição de CDROM'; | |
| 647 | - Log_Debug('Percorrendo v_DEVICES.Devices['+intToStr(i)+']...'); | |
| 648 | - | |
| 649 | - if v_DEVICES.Devices[i].DeviceClass=dcCDROM then | |
| 650 | - Begin | |
| 651 | - // Vamos tentar de tudo! :)))) | |
| 652 | - v_te_cdrom_desc := Trim(v_DEVICES.Devices[i].Name); | |
| 653 | - if Trim(v_te_cdrom_desc)='' then | |
| 654 | - v_te_cdrom_desc := v_DEVICES.Devices[i].FriendlyName; | |
| 655 | - if Trim(v_te_cdrom_desc)='' then | |
| 656 | - v_te_cdrom_desc := v_DEVICES.Devices[i].Description; | |
| 657 | - | |
| 658 | - if (v_te_cdrom_desc <> '') then | |
| 659 | - Begin | |
| 660 | - v_tstrCDROM.Add('te_cdrom_desc###'+v_te_cdrom_desc); | |
| 661 | - Log_Debug('Adicionando a tstrCDROM: "'+v_tstrCDROM[v_tstrCDROM.count-1]+'"'); | |
| 662 | - Log_Debug('CDROM Informations - OK!'); | |
| 663 | - End; | |
| 664 | - End; | |
| 665 | - | |
| 666 | - | |
| 667 | - v_mensagem := 'Obtendo Descrição de Modem'; | |
| 668 | - if v_DEVICES.Devices[i].DeviceClass=dcModem then | |
| 669 | - Begin | |
| 670 | - if Trim(v_DEVICES.Devices[i].FriendlyName)='' then | |
| 671 | - v_te_modem_desc := Trim(v_DEVICES.Devices[i].Description) | |
| 672 | - else | |
| 673 | - v_te_modem_desc := Trim(v_DEVICES.Devices[i].FriendlyName); | |
| 674 | - | |
| 675 | - Log_Debug('MODEM Informations - OK!'); | |
| 676 | - End; | |
| 677 | - | |
| 678 | - v_mensagem := 'Obtendo Descrição de Mouse'; | |
| 679 | - if v_DEVICES.Devices[i].DeviceClass=dcMouse then | |
| 680 | - Begin | |
| 681 | - if Trim(v_DEVICES.Devices[i].FriendlyName)='' then | |
| 682 | - v_te_mouse_desc := Trim(v_DEVICES.Devices[i].Description) | |
| 683 | - else | |
| 684 | - v_te_mouse_desc := Trim(v_DEVICES.Devices[i].FriendlyName); | |
| 685 | - | |
| 686 | - Log_Debug('MOUSE Informations - OK!'); | |
| 687 | - End; | |
| 688 | - | |
| 689 | - v_mensagem := 'Obtendo Descrição de Teclado'; | |
| 690 | - if v_DEVICES.Devices[i].DeviceClass=dcKeyboard then | |
| 691 | - Begin | |
| 692 | - if Trim(v_DEVICES.Devices[i].FriendlyName)='' then | |
| 693 | - v_te_teclado_desc := Trim(v_DEVICES.Devices[i].Description) | |
| 694 | - else | |
| 695 | - v_te_teclado_desc := Trim(v_DEVICES.Devices[i].FriendlyName); | |
| 696 | - | |
| 697 | - Log_Debug('KEYBOARD Informations - OK!'); | |
| 698 | - End; | |
| 699 | - | |
| 700 | - v_mensagem := 'Obtendo Descrição de Vídeo'; | |
| 701 | - if v_DEVICES.Devices[i].DeviceClass=dcDisplay then | |
| 702 | - Begin | |
| 703 | - if Trim(v_DEVICES.Devices[i].FriendlyName)='' then | |
| 704 | - v_te_placa_video_desc := Trim(v_DEVICES.Devices[i].Description) | |
| 705 | - else | |
| 706 | - v_te_placa_video_desc := Trim(v_DEVICES.Devices[i].FriendlyName); | |
| 707 | - | |
| 708 | - Log_Debug('DISPLAY Informations - OK!'); | |
| 709 | - End; | |
| 710 | - | |
| 711 | - i := i+1; | |
| 712 | - End; | |
| 713 | - except log_diario('Problema em DEVICES Details!'); | |
| 714 | - end; | |
| 715 | - v_DEVICES.Free; | |
| 716 | - | |
| 717 | - | |
| 718 | - // Memory informations | |
| 719 | - Try | |
| 720 | - Begin | |
| 721 | - v_MemoriaRAM.dwLength := SizeOf(v_MemoriaRAM); | |
| 722 | - GlobalMemoryStatus(v_MemoriaRAM); | |
| 723 | - v_qt_mem_ram := v_MemoriaRAM.dwTotalPhys div 1024000; | |
| 724 | - Log_Debug('MEMORY Informations - OK!'); | |
| 725 | - End; | |
| 726 | - except log_diario('Problema em MEMORY Details!'); | |
| 727 | - end; | |
| 728 | - | |
| 729 | - Try | |
| 730 | - Begin | |
| 731 | - v_SMBIOS := TMiTeC_SMBIOS.Create(nil); | |
| 732 | - v_SMBIOS.RefreshData; | |
| 733 | - with v_SMBIOS do begin | |
| 734 | - if v_SMBIOS.MemoryDeviceCount>0 then begin | |
| 735 | - for i:=0 to v_SMBIOS.MemoryDeviceCount-1 do | |
| 736 | - if (v_SMBIOS.MemoryDevice[i].Size>0) then begin | |
| 737 | - if v_SMBIOS.MemoryDevice[i].Device>smmdUnknown then | |
| 738 | - v_te_mem_ram_tipo:=MemoryDeviceTypes[v_SMBIOS.MemoryDevice[i].Device] | |
| 739 | - else | |
| 740 | - v_te_mem_ram_tipo:=MemoryFormFactors[v_SMBIOS.MemoryDevice[i].FormFactor]; | |
| 741 | - | |
| 742 | - if (v_te_mem_ram_desc <> '') then | |
| 743 | - v_te_mem_ram_desc := v_te_mem_ram_desc + ' - '; | |
| 744 | - | |
| 745 | - v_te_mem_ram_desc := v_te_mem_ram_desc + 'Slot '+ inttostr(i) + ': ' | |
| 746 | - + v_SMBIOS.MemoryDevice[i].Manufacturer + ' ' | |
| 747 | - + inttostr(v_SMBIOS.MemoryDevice[i].Size) + 'MB ' | |
| 748 | - + '(' + v_te_mem_ram_tipo +')'; | |
| 749 | - end; | |
| 750 | - end | |
| 751 | - else if v_SMBIOS.MemoryModuleCount > -1 then | |
| 752 | - Begin | |
| 753 | - for i:=0 to v_SMBIOS.MemoryModuleCount-1 do begin | |
| 754 | - if (v_SMBIOS.MemoryModule[i].Size <> 0) then begin | |
| 755 | - v_te_mem_ram_tipo := v_SMBIOS.GetMemoryTypeStr(v_SMBIOS.MemoryModule[i].Types); | |
| 756 | - if (v_te_mem_ram_desc <> '') then | |
| 757 | - v_te_mem_ram_desc := v_te_mem_ram_desc + ' - '; | |
| 758 | - v_te_mem_ram_desc := v_te_mem_ram_desc + 'Slot '+ inttostr(i) + ': ' | |
| 759 | - + v_SMBIOS.MemoryDevice[i].Manufacturer + ' ' | |
| 760 | - + inttostr(v_SMBIOS.MemoryModule[i].Size) + 'MB ' | |
| 761 | - + '(' + v_te_mem_ram_tipo +')'; | |
| 762 | - end; | |
| 763 | - end; | |
| 764 | - end; | |
| 765 | - end; | |
| 766 | - | |
| 767 | - if (trim(v_te_placa_mae_fabricante)='') then begin | |
| 768 | - v_te_placa_mae_fabricante := v_SMBIOS.MainBoardManufacturer; | |
| 769 | - if (trim(v_te_placa_mae_fabricante)='') then | |
| 770 | - v_te_placa_mae_fabricante := v_SMBIOS.SystemManufacturer; | |
| 771 | - end; | |
| 772 | - | |
| 773 | - if (trim(v_te_placa_mae_desc)='') then begin | |
| 774 | - v_te_placa_mae_desc := v_SMBIOS.MainBoardModel; | |
| 775 | - if (trim(v_te_placa_mae_desc)='') then | |
| 776 | - v_te_placa_mae_desc := v_SMBIOS.SystemModel; | |
| 777 | - end; | |
| 778 | - | |
| 779 | - | |
| 780 | - v_te_bios_data := v_SMBIOS.BIOSDate; | |
| 781 | - v_te_bios_fabricante := v_SMBIOS.BIOSVendor; | |
| 782 | - v_te_bios_desc := v_SMBIOS.BIOSVersion; | |
| 783 | - | |
| 784 | - v_SMBIOS.Free; | |
| 785 | - Log_Debug('SMBIOS Informations - OK!'); | |
| 786 | - End; | |
| 787 | - Except log_diario('Problema em SMBIOS Details!'); | |
| 788 | - End; | |
| 789 | - | |
| 790 | - // Display informations | |
| 791 | - Try | |
| 792 | - Begin | |
| 793 | - v_DISPLAY := TMiTeC_Display.Create(nil); | |
| 794 | - v_DISPLAY.RefreshData; | |
| 795 | - | |
| 796 | - if (trim(v_te_placa_video_desc)='') then v_te_placa_video_desc := v_DISPLAY.Adapter; | |
| 797 | - v_qt_placa_video_cores := IntToStr(v_DISPLAY.ColorDepth); | |
| 798 | - v_qt_placa_video_mem := IntToStr(v_DISPLAY.Memory div 1048576 ) + 'MB'; | |
| 799 | - v_te_placa_video_resolucao := IntToStr(v_DISPLAY.HorzRes) + 'x' + IntToStr(v_DISPLAY.VertRes); | |
| 800 | - | |
| 801 | - v_DISPLAY.Free; | |
| 802 | - Log_Debug('VIDEO Informations - OK!'); | |
| 803 | - End; | |
| 804 | - Except log_diario('Problema em VIDEO Details!'); | |
| 805 | - End; | |
| 806 | - | |
| 807 | - // Network informations | |
| 808 | - Try | |
| 809 | - Begin | |
| 810 | - v_TCP := TMiTeC_TCPIP.Create(nil); | |
| 811 | - v_TCP.RefreshData; | |
| 812 | - | |
| 813 | - v_mensagem := 'Ativando TCP Getinfo...'; | |
| 814 | - | |
| 815 | - i := 0; | |
| 816 | - v_Macs_Invalidos := trim(GetValorDatMemoria('TCPIP.TE_ENDERECOS_MAC_INVALIDOS',v_tstrCipherOpened)); | |
| 817 | - | |
| 818 | - // Avalia quantidade de placas de rede e obtem respectivos dados | |
| 819 | - if v_TCP.AdapterCount>0 then | |
| 820 | - for i:=0 to v_TCP.AdapterCount-1 do begin | |
| 821 | - v_te_placa_rede_desc := v_TCP.Adapter[i].Name; | |
| 822 | - v_PhysicalAddress := v_TCP.Adapter[i].Address; | |
| 823 | - v_IPAddress := v_TCP.Adapter[i].IPAddress[0]; | |
| 824 | - v_IPMask := v_TCP.Adapter[i].IPAddressMask[0]; | |
| 825 | - v_Gateway_IPAddress := v_TCP.Adapter[i].Gateway_IPAddress[0]; | |
| 826 | - v_DHCP_IPAddress := v_TCP.Adapter[i].DHCP_IPAddress[0]; | |
| 827 | - v_PrimaryWINS_IPAddress := v_TCP.Adapter[i].PrimaryWINS_IPAddress[0]; | |
| 828 | - v_SecondaryWINS_IPAddress := v_TCP.Adapter[i].SecondaryWINS_IPAddress[0]; | |
| 829 | - | |
| 830 | - if (trim( v_te_placa_rede_desc + | |
| 831 | - v_PhysicalAddress + | |
| 832 | - v_IPAddress + | |
| 833 | - v_IPMask + | |
| 834 | - v_Gateway_IPAddress + | |
| 835 | - v_DHCP_IPAddress + | |
| 836 | - v_PrimaryWINS_IPAddress + | |
| 837 | - v_SecondaryWINS_IPAddress)<>'') then | |
| 838 | - Begin | |
| 839 | - v_tstrTCPIP.Add('te_placa_rede_desc###' + v_te_placa_rede_desc +'#FIELD#'+ | |
| 840 | - 'te_node_address###' + v_PhysicalAddress +'#FIELD#'+ | |
| 841 | - 'te_ip###' + v_IPAddress +'#FIELD#'+ | |
| 842 | - 'te_mascara###' + v_IPMask +'#FIELD#'+ | |
| 843 | - 'te_gateway###' + v_Gateway_IPAddress +'#FIELD#'+ | |
| 844 | - 'te_serv_dhcp###' + v_DHCP_IPAddress +'#FIELD#'+ | |
| 845 | - 'te_wins_primario###' + v_PrimaryWINS_IPAddress +'#FIELD#'+ | |
| 846 | - 'te_wins_secundario###' + v_SecondaryWINS_IPAddress); | |
| 847 | - Log_Debug('Adicionando a tstrTCPIP: "'+v_tstrTCPIP[v_tstrTCPIP.count-1]+'"'); | |
| 848 | - End | |
| 849 | - End; | |
| 850 | - v_TCP.Free; | |
| 851 | - Log_Debug('TCPIP Informations - OK!'); | |
| 852 | - End; | |
| 853 | - Except log_diario('Problema em TCP Details!'); | |
| 854 | - End; | |
| 855 | - | |
| 856 | - // Caso exista a pasta ..temp/debugs, será criado o arquivo diário debug_<coletor>.txt | |
| 857 | - // Usar esse recurso apenas para debug de coletas mal-sucedidas através do componente MSI-Mitec. | |
| 858 | - if v_Debugs then | |
| 859 | - Begin | |
| 860 | - i := 0; | |
| 861 | - while i < v_Report.count-1 do | |
| 862 | - Begin | |
| 863 | - Grava_Debugs(v_report[i]); | |
| 864 | - i := i + 1; | |
| 865 | - End; | |
| 866 | - v_report.Free; | |
| 867 | - End; | |
| 868 | - End; | |
| 869 | - Except | |
| 870 | - End; | |
| 871 | - | |
| 872 | - // Crio as Tripas dos múltiplos ítens... | |
| 873 | - v_Tripa_CPU := ''; | |
| 874 | - v_tstrCPU.Sort; | |
| 875 | - Log_DEBUG('Tamanho de v_tstrCPU 2: '+intToStr(v_tstrCPU.Count)); | |
| 876 | - i := 0; | |
| 877 | - while (i < v_tstrCPU.Count) do | |
| 878 | - Begin | |
| 879 | - v_Tripa_CPU := v_Tripa_CPU + iif(v_Tripa_CPU = '','','#CPU#'); | |
| 880 | - v_Tripa_CPU := v_Tripa_CPU + v_tstrCPU[i]; | |
| 881 | - i := i + 1; | |
| 882 | - End; | |
| 883 | - | |
| 884 | - v_Tripa_CDROM := ''; | |
| 885 | - v_tstrCDROM.Sort; | |
| 886 | - Log_DEBUG('Tamanho de v_tstrCDROM: '+intToStr(v_tstrCDROM.Count)); | |
| 887 | - i := 0; | |
| 888 | - while (i < v_tstrCDROM.Count) do | |
| 889 | - Begin | |
| 890 | - v_Tripa_CDROM := v_Tripa_CDROM + iif(v_Tripa_CDROM = '','','#CDROM#'); | |
| 891 | - v_Tripa_CDROM := v_Tripa_CDROM + v_tstrCDROM[i]; | |
| 892 | - i := i + 1; | |
| 893 | - End; | |
| 894 | - | |
| 895 | - v_Tripa_TCPIP := ''; | |
| 896 | - v_tstrTCPIP.Sort; | |
| 897 | - Log_DEBUG('Tamanho de v_tstrTCPIP: '+intToStr(v_tstrTCPIP.Count)); | |
| 898 | - i := 0; | |
| 899 | - while (i < v_tstrTCPIP.Count) do | |
| 900 | - Begin | |
| 901 | - v_Tripa_TCPIP := v_Tripa_TCPIP + iif(v_Tripa_TCPIP = '','','#TCPIP#'); | |
| 902 | - v_Tripa_TCPIP := v_Tripa_TCPIP + v_tstrTCPIP[i]; | |
| 903 | - i := i + 1; | |
| 904 | - End; | |
| 905 | - | |
| 906 | - Try | |
| 907 | - // Monto a string que será comparada com o valor armazenado no registro. | |
| 908 | - v_mensagem := 'Montando pacote para comparações...'; | |
| 909 | - UVC := g_oCacic.trimEspacosExcedentes(v_Tripa_TCPIP + ';' + | |
| 910 | - v_Tripa_CPU + ';' + | |
| 911 | - v_Tripa_CDROM + ';' + | |
| 912 | - v_te_mem_ram_desc + ';' + | |
| 913 | - IntToStr(v_qt_mem_ram) + ';' + | |
| 914 | - v_te_bios_desc + ';' + | |
| 915 | - v_te_bios_data + ';' + | |
| 916 | - v_te_bios_fabricante + ';' + | |
| 917 | - v_te_placa_mae_fabricante + ';' + | |
| 918 | - v_te_placa_mae_desc + ';' + | |
| 919 | - v_te_placa_video_desc + ';' + | |
| 920 | - v_te_placa_video_resolucao + ';' + | |
| 921 | - v_qt_placa_video_cores + ';' + | |
| 922 | - v_qt_placa_video_mem + ';' + | |
| 923 | - v_te_placa_som_desc + ';' + | |
| 924 | - v_te_teclado_desc + ';' + | |
| 925 | - v_te_modem_desc + ';' + | |
| 926 | - v_te_mouse_desc); | |
| 927 | - Except log_diario('Problema em comparação de envio!'); | |
| 928 | - End; | |
| 929 | - | |
| 930 | - // Obtenho do registro o valor que foi previamente armazenado | |
| 931 | - ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.Hardware',v_tstrCipherOpened)); | |
| 932 | - | |
| 933 | - SetValorDatMemoria('Col_Hard.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); | |
| 934 | - | |
| 935 | - // Se essas informações forem diferentes significa que houve alguma alteração | |
| 936 | - // na configuração de hardware. Nesse caso, gravo as informações no BD Central | |
| 937 | - // e, se não houver problemas durante esse procedimento, atualizo as | |
| 938 | - // informações no registro. | |
| 939 | - If (GetValorDatMemoria('Configs.IN_COLETA_FORCADA_HARD',v_tstrCipherOpened)='S') or | |
| 940 | - (g_oCacic.trimEspacosExcedentes(UVC) <> g_oCacic.trimEspacosExcedentes(ValorChaveRegistro)) Then | |
| 941 | - Begin | |
| 942 | - Try | |
| 943 | - //Envio via rede para ao Agente Gerente, para gravação no BD. | |
| 944 | - SetValorDatMemoria('Col_Hard.te_Tripa_TCPIP' , g_oCacic.trimEspacosExcedentes( v_Tripa_TCPIP ), v_tstrCipherOpened1); | |
| 945 | - SetValorDatMemoria('Col_Hard.te_Tripa_CPU' , g_oCacic.trimEspacosExcedentes( v_Tripa_CPU ), v_tstrCipherOpened1); | |
| 946 | - SetValorDatMemoria('Col_Hard.te_Tripa_CDROM' , g_oCacic.trimEspacosExcedentes( v_Tripa_CDROM ), v_tstrCipherOpened1); | |
| 947 | - SetValorDatMemoria('Col_Hard.te_placa_mae_fabricante' , g_oCacic.trimEspacosExcedentes( v_te_placa_mae_fabricante ) , v_tstrCipherOpened1); | |
| 948 | - SetValorDatMemoria('Col_Hard.te_placa_mae_desc' , g_oCacic.trimEspacosExcedentes( v_te_placa_mae_desc ) , v_tstrCipherOpened1); | |
| 949 | - SetValorDatMemoria('Col_Hard.qt_mem_ram' , g_oCacic.trimEspacosExcedentes( IntToStr(v_qt_mem_ram) ) , v_tstrCipherOpened1); | |
| 950 | - SetValorDatMemoria('Col_Hard.te_mem_ram_desc' , g_oCacic.trimEspacosExcedentes( v_te_mem_ram_desc ) , v_tstrCipherOpened1); | |
| 951 | - SetValorDatMemoria('Col_Hard.te_bios_desc' , g_oCacic.trimEspacosExcedentes( v_te_bios_desc ) , v_tstrCipherOpened1); | |
| 952 | - SetValorDatMemoria('Col_Hard.te_bios_data' , g_oCacic.trimEspacosExcedentes( v_te_bios_data ) , v_tstrCipherOpened1); | |
| 953 | - SetValorDatMemoria('Col_Hard.te_bios_fabricante' , g_oCacic.trimEspacosExcedentes( v_te_bios_fabricante ) , v_tstrCipherOpened1); | |
| 954 | - SetValorDatMemoria('Col_Hard.qt_placa_video_cores' , g_oCacic.trimEspacosExcedentes( v_qt_placa_video_cores ) , v_tstrCipherOpened1); | |
| 955 | - SetValorDatMemoria('Col_Hard.te_placa_video_desc' , g_oCacic.trimEspacosExcedentes( v_te_placa_video_desc ) , v_tstrCipherOpened1); | |
| 956 | - SetValorDatMemoria('Col_Hard.qt_placa_video_mem' , g_oCacic.trimEspacosExcedentes( v_qt_placa_video_mem ) , v_tstrCipherOpened1); | |
| 957 | - SetValorDatMemoria('Col_Hard.te_placa_video_resolucao', g_oCacic.trimEspacosExcedentes( v_te_placa_video_resolucao ) , v_tstrCipherOpened1); | |
| 958 | - SetValorDatMemoria('Col_Hard.te_placa_som_desc' , g_oCacic.trimEspacosExcedentes( v_te_placa_som_desc ) , v_tstrCipherOpened1); | |
| 959 | - SetValorDatMemoria('Col_Hard.te_teclado_desc' , g_oCacic.trimEspacosExcedentes( v_te_teclado_desc ) , v_tstrCipherOpened1); | |
| 960 | - SetValorDatMemoria('Col_Hard.te_mouse_desc' , g_oCacic.trimEspacosExcedentes( v_te_mouse_desc ) , v_tstrCipherOpened1); | |
| 961 | - SetValorDatMemoria('Col_Hard.te_modem_desc' , g_oCacic.trimEspacosExcedentes( v_te_modem_desc ) , v_tstrCipherOpened1); | |
| 962 | - SetValorDatMemoria('Col_Hard.UVC' , g_oCacic.trimEspacosExcedentes( UVC ) , v_tstrCipherOpened1); | |
| 963 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_hard.dat', v_tstrCipherOpened1); | |
| 964 | - Except log_diario('Problema em gravação de dados no DAT!'); | |
| 965 | - End; | |
| 966 | - end | |
| 967 | - else | |
| 968 | - Begin | |
| 969 | - SetValorDatMemoria('Col_Hard.nada','nada', v_tstrCipherOpened1); | |
| 970 | - SetValorDatMemoria('Col_Hard.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); | |
| 971 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_hard.dat', v_tstrCipherOpened1); | |
| 972 | - End; | |
| 973 | - Except | |
| 974 | - Begin | |
| 975 | - SetValorDatMemoria('Col_Hard.nada','nada', v_tstrCipherOpened1); | |
| 976 | - SetValorDatMemoria('Col_Hard.Fim' , '99999999', v_tstrCipherOpened1); | |
| 977 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_hard.dat', v_tstrCipherOpened1); | |
| 978 | - log_diario('Problema na execução => ' + v_mensagem); | |
| 979 | - End; | |
| 980 | - End; | |
| 981 | - g_oCacic.Free(); | |
| 982 | -end; | |
| 983 | - | |
| 984 | -// ATENÇÃO: Caso haja falha na execução deste agente pela estação de trabalho, | |
| 985 | -// a provável causa será a falta da Runtime Library RTL70.BPL, que | |
| 986 | -// costuma ser "confundida" com vírus e apagada por alguns anti-vírus | |
| 987 | -// como o Avasti. | |
| 988 | -// SOLUÇÃO: Baixar a partir do endereço http://nwvault.ign.com/View.php?view=Other.Detail&id=119 o pacote | |
| 989 | -// D70_Installer.zip, descompactar e executar na estação de trabalho. | |
| 990 | -var strAux : String; | |
| 991 | -const CACIC_APP_NAME = 'col_hard'; | |
| 992 | -begin | |
| 993 | - g_oCacic := TCACIC.Create(); | |
| 994 | - g_oCacic.setBoolCipher(true); | |
| 995 | - | |
| 996 | - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then | |
| 997 | - if (ParamCount>0) then | |
| 998 | - Begin | |
| 999 | - strAux := ''; | |
| 1000 | - For intAux := 1 to ParamCount do | |
| 1001 | - Begin | |
| 1002 | - if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then | |
| 1003 | - begin | |
| 1004 | - strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); | |
| 1005 | - //log_DEBUG('Parâmetro /CacicPath recebido com valor="'+strAux+'"'); | |
| 1006 | - end; | |
| 1007 | - end; | |
| 1008 | - | |
| 1009 | - if (strAux <> '') then | |
| 1010 | - Begin | |
| 1011 | - g_oCacic.setCacicPath(strAux); | |
| 1012 | - | |
| 1013 | - v_tstrCipherOpened := TStrings.Create; | |
| 1014 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 1015 | - | |
| 1016 | - v_tstrCipherOpened1 := TStrings.Create; | |
| 1017 | - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_hard.dat'); | |
| 1018 | - | |
| 1019 | - Try | |
| 1020 | - Executa_Col_Hard; | |
| 1021 | - Except | |
| 1022 | - SetValorDatMemoria('Col_Hard.nada', 'nada', v_tstrCipherOpened1); | |
| 1023 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_hard.dat', v_tstrCipherOpened1); | |
| 1024 | - End; | |
| 1025 | - Halt(0); | |
| 1026 | - End; | |
| 1027 | - End; | |
| 1028 | -end. |
col_hard/col_hard.res
No preview for this file type
col_hard/col_hard_icon.ico
No preview for this file type