Commit e663a2b29a8cd20d7349010e885a222d04fc7b47
1 parent
d5ad630e
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@959 fecfc0c7-e812-0410-ae72-849f08638ee7
Showing
5 changed files
with
0 additions
and
624 deletions
Show diff stats
col_anvi/col_anvi.cfg
| ... | ... | @@ -1,38 +0,0 @@ |
| 1 | --$A8 | |
| 2 | --$B- | |
| 3 | --$C+ | |
| 4 | --$D+ | |
| 5 | --$E- | |
| 6 | --$F- | |
| 7 | --$G+ | |
| 8 | --$H+ | |
| 9 | --$I+ | |
| 10 | --$J- | |
| 11 | --$K- | |
| 12 | --$L+ | |
| 13 | --$M- | |
| 14 | --$N+ | |
| 15 | --$O+ | |
| 16 | --$P+ | |
| 17 | --$Q- | |
| 18 | --$R- | |
| 19 | --$S- | |
| 20 | --$T- | |
| 21 | --$U- | |
| 22 | --$V+ | |
| 23 | --$W- | |
| 24 | --$X+ | |
| 25 | --$YD | |
| 26 | --$Z1 | |
| 27 | --cg | |
| 28 | --AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; | |
| 29 | --H+ | |
| 30 | --W+ | |
| 31 | --M | |
| 32 | --$M16384,1048576 | |
| 33 | --K$00400000 | |
| 34 | --LE"c:\arquivos de programas\borland\delphi7\Projects\Bpl" | |
| 35 | --LN"c:\arquivos de programas\borland\delphi7\Projects\Bpl" | |
| 36 | --w-UNSAFE_TYPE | |
| 37 | --w-UNSAFE_CODE | |
| 38 | --w-UNSAFE_CAST |
col_anvi/col_anvi.dof
| ... | ... | @@ -1,136 +0,0 @@ |
| 1 | -[FileVersion] | |
| 2 | -Version=7.0 | |
| 3 | -[Compiler] | |
| 4 | -A=8 | |
| 5 | -B=0 | |
| 6 | -C=1 | |
| 7 | -D=1 | |
| 8 | -E=0 | |
| 9 | -F=0 | |
| 10 | -G=1 | |
| 11 | -H=1 | |
| 12 | -I=1 | |
| 13 | -J=0 | |
| 14 | -K=0 | |
| 15 | -L=1 | |
| 16 | -M=0 | |
| 17 | -N=1 | |
| 18 | -O=1 | |
| 19 | -P=1 | |
| 20 | -Q=0 | |
| 21 | -R=0 | |
| 22 | -S=0 | |
| 23 | -T=0 | |
| 24 | -U=0 | |
| 25 | -V=1 | |
| 26 | -W=0 | |
| 27 | -X=1 | |
| 28 | -Y=1 | |
| 29 | -Z=1 | |
| 30 | -ShowHints=1 | |
| 31 | -ShowWarnings=1 | |
| 32 | -UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; | |
| 33 | -NamespacePrefix= | |
| 34 | -SymbolDeprecated=1 | |
| 35 | -SymbolLibrary=1 | |
| 36 | -SymbolPlatform=1 | |
| 37 | -UnitLibrary=1 | |
| 38 | -UnitPlatform=1 | |
| 39 | -UnitDeprecated=1 | |
| 40 | -HResultCompat=1 | |
| 41 | -HidingMember=1 | |
| 42 | -HiddenVirtual=1 | |
| 43 | -Garbage=1 | |
| 44 | -BoundsError=1 | |
| 45 | -ZeroNilCompat=1 | |
| 46 | -StringConstTruncated=1 | |
| 47 | -ForLoopVarVarPar=1 | |
| 48 | -TypedConstVarPar=1 | |
| 49 | -AsgToTypedConst=1 | |
| 50 | -CaseLabelRange=1 | |
| 51 | -ForVariable=1 | |
| 52 | -ConstructingAbstract=1 | |
| 53 | -ComparisonFalse=1 | |
| 54 | -ComparisonTrue=1 | |
| 55 | -ComparingSignedUnsigned=1 | |
| 56 | -CombiningSignedUnsigned=1 | |
| 57 | -UnsupportedConstruct=1 | |
| 58 | -FileOpen=1 | |
| 59 | -FileOpenUnitSrc=1 | |
| 60 | -BadGlobalSymbol=1 | |
| 61 | -DuplicateConstructorDestructor=1 | |
| 62 | -InvalidDirective=1 | |
| 63 | -PackageNoLink=1 | |
| 64 | -PackageThreadVar=1 | |
| 65 | -ImplicitImport=1 | |
| 66 | -HPPEMITIgnored=1 | |
| 67 | -NoRetVal=1 | |
| 68 | -UseBeforeDef=1 | |
| 69 | -ForLoopVarUndef=1 | |
| 70 | -UnitNameMismatch=1 | |
| 71 | -NoCFGFileFound=1 | |
| 72 | -MessageDirective=1 | |
| 73 | -ImplicitVariants=1 | |
| 74 | -UnicodeToLocale=1 | |
| 75 | -LocaleToUnicode=1 | |
| 76 | -ImagebaseMultiple=1 | |
| 77 | -SuspiciousTypecast=1 | |
| 78 | -PrivatePropAccessor=1 | |
| 79 | -UnsafeType=0 | |
| 80 | -UnsafeCode=0 | |
| 81 | -UnsafeCast=0 | |
| 82 | -[Linker] | |
| 83 | -MapFile=0 | |
| 84 | -OutputObjs=0 | |
| 85 | -ConsoleApp=1 | |
| 86 | -DebugInfo=0 | |
| 87 | -RemoteSymbols=0 | |
| 88 | -MinStackSize=16384 | |
| 89 | -MaxStackSize=1048576 | |
| 90 | -ImageBase=4194304 | |
| 91 | -ExeDescription= | |
| 92 | -[Directories] | |
| 93 | -OutputDir= | |
| 94 | -UnitOutputDir= | |
| 95 | -PackageDLLOutputDir= | |
| 96 | -PackageDCPOutputDir= | |
| 97 | -SearchPath= | |
| 98 | -Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOffice2k;MSI_D7_Rtl | |
| 99 | -Conditionals= | |
| 100 | -DebugSourceDirs= | |
| 101 | -UsePackages=0 | |
| 102 | -[Parameters] | |
| 103 | -RunParams= | |
| 104 | -HostApplication= | |
| 105 | -Launcher= | |
| 106 | -UseLauncher=0 | |
| 107 | -DebugCWD= | |
| 108 | -[Language] | |
| 109 | -ActiveLang= | |
| 110 | -ProjectLang= | |
| 111 | -RootDir=C:\Arquivos de programas\Borland\Delphi7\Bin\ | |
| 112 | -[Version Info] | |
| 113 | -IncludeVerInfo=1 | |
| 114 | -AutoIncBuild=0 | |
| 115 | -MajorVer=2 | |
| 116 | -MinorVer=5 | |
| 117 | -Release=0 | |
| 118 | -Build=773 | |
| 119 | -Debug=0 | |
| 120 | -PreRelease=0 | |
| 121 | -Special=0 | |
| 122 | -Private=0 | |
| 123 | -DLL=0 | |
| 124 | -Locale=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 AntiVírus do Sistema CACIC | |
| 129 | -FileVersion=2.5.0.773 | |
| 130 | -InternalName= | |
| 131 | -LegalCopyright= | |
| 132 | -LegalTrademarks= | |
| 133 | -OriginalFilename= | |
| 134 | -ProductName=Col_ANVI | |
| 135 | -ProductVersion=2.6 | |
| 136 | -Comments=Baseado na licença GPL (General Public License) |
col_anvi/col_anvi.dpr
| ... | ... | @@ -1,450 +0,0 @@ |
| 1 | -(** | |
| 2 | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 3 | -Copyright 2000, 2001, 2002, 2003, 2004, 2005 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil | |
| 4 | - | |
| 5 | -Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de Informações Computacionais | |
| 6 | - | |
| 7 | -O CACIC é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como | |
| 8 | -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença, ou (na sua opinião) qualquer versão. | |
| 9 | - | |
| 10 | -Este programa é distribuido na esperança que possa ser util, mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer | |
| 11 | -MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes. | |
| 12 | - | |
| 13 | -Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software | |
| 14 | -Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 15 | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 16 | -*) | |
| 17 | - | |
| 18 | -program col_anvi; | |
| 19 | -{$R *.res} | |
| 20 | - | |
| 21 | -uses | |
| 22 | - Windows, | |
| 23 | - classes, | |
| 24 | - sysutils, | |
| 25 | - Registry, | |
| 26 | - TLHELP32, | |
| 27 | - ShellAPI, | |
| 28 | - PJVersionInfo, | |
| 29 | - CACIC_Library in '..\CACIC_Library.pas'; | |
| 30 | - | |
| 31 | -var | |
| 32 | - v_strCipherClosed : String; | |
| 33 | - | |
| 34 | -var | |
| 35 | - v_Debugs : boolean; | |
| 36 | - | |
| 37 | -var | |
| 38 | - v_tstrCipherOpened, | |
| 39 | - v_tstrCipherOpened1 : TStrings; | |
| 40 | - | |
| 41 | -var | |
| 42 | - g_oCacic : TCACIC; | |
| 43 | - | |
| 44 | -function VerFmt(const MS, LS: DWORD): string; | |
| 45 | - // Format the version number from the given DWORDs containing the info | |
| 46 | -begin | |
| 47 | - Result := Format('%d.%d.%d.%d', | |
| 48 | - [HiWord(MS), LoWord(MS), HiWord(LS), LoWord(LS)]) | |
| 49 | -end; | |
| 50 | - | |
| 51 | -procedure log_diario(strMsg : String); | |
| 52 | -var | |
| 53 | - HistoricoLog : TextFile; | |
| 54 | - strDataArqLocal, strDataAtual : string; | |
| 55 | -begin | |
| 56 | - try | |
| 57 | - FileSetAttr (g_oCacic.getCacicPath + '\cacic2.log',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 | |
| 58 | - AssignFile(HistoricoLog,g_oCacic.getCacicPath + '\cacic2.log'); {Associa o arquivo a uma variável do tipo TextFile} | |
| 59 | - {$IOChecks off} | |
| 60 | - Reset(HistoricoLog); {Abre o arquivo texto} | |
| 61 | - {$IOChecks on} | |
| 62 | - if (IOResult <> 0) then // Arquivo não existe, será recriado. | |
| 63 | - begin | |
| 64 | - Rewrite (HistoricoLog); | |
| 65 | - Append(HistoricoLog); | |
| 66 | - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <======================='); | |
| 67 | - end; | |
| 68 | - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(g_oCacic.getCacicPath + '\cacic2.log'))); | |
| 69 | - DateTimeToString(strDataAtual , 'yyyymmdd', Date); | |
| 70 | - if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual... | |
| 71 | - begin | |
| 72 | - Rewrite (HistoricoLog); //Cria/Recria o arquivo | |
| 73 | - Append(HistoricoLog); | |
| 74 | - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <======================='); | |
| 75 | - end; | |
| 76 | - Append(HistoricoLog); | |
| 77 | - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '[Coletor ANVI] '+strMsg); {Grava a string Texto no arquivo texto} | |
| 78 | - CloseFile(HistoricoLog); {Fecha o arquivo texto} | |
| 79 | -// FileSetAttr (ExtractFilePath(Application.Exename) + '\cacic2.log',6); // Muda o atributo para arquivo de SISTEMA e OCULTO | |
| 80 | - | |
| 81 | - except | |
| 82 | - log_diario('Erro na gravação do log!'); | |
| 83 | - end; | |
| 84 | -end; | |
| 85 | - | |
| 86 | -function GetVersionInfo(p_File: string):string; | |
| 87 | -var PJVersionInfo1: TPJVersionInfo; | |
| 88 | -begin | |
| 89 | - PJVersionInfo1 := TPJVersionInfo.Create(nil); | |
| 90 | - PJVersionInfo1.FileName := PChar(p_File); | |
| 91 | - Result := VerFmt(PJVersionInfo1.FixedFileInfo.dwFileVersionMS, PJVersionInfo1.FixedFileInfo.dwFileVersionLS); | |
| 92 | - PJVersionInfo1.Free; | |
| 93 | -end; | |
| 94 | - | |
| 95 | - | |
| 96 | -// Pad a string with zeros so that it is a multiple of size | |
| 97 | -function PadWithZeros(const str : string; size : integer) : string; | |
| 98 | -var | |
| 99 | - origsize, i : integer; | |
| 100 | -begin | |
| 101 | - Result := str; | |
| 102 | - origsize := Length(Result); | |
| 103 | - if ((origsize mod size) <> 0) or (origsize = 0) then | |
| 104 | - begin | |
| 105 | - SetLength(Result,((origsize div size)+1)*size); | |
| 106 | - for i := origsize+1 to Length(Result) do | |
| 107 | - Result[i] := #0; | |
| 108 | - end; | |
| 109 | -end; | |
| 110 | - | |
| 111 | -Procedure CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings); | |
| 112 | -var v_strCipherOpenImploded : string; | |
| 113 | - v_DatFile : TextFile; | |
| 114 | -begin | |
| 115 | - try | |
| 116 | - FileSetAttr (p_DatFileName,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 | |
| 117 | - AssignFile(v_DatFile,p_DatFileName); {Associa o arquivo a uma variável do tipo TextFile} | |
| 118 | - | |
| 119 | - // Criação do arquivo .DAT | |
| 120 | - Rewrite (v_DatFile); | |
| 121 | - Append(v_DatFile); | |
| 122 | - | |
| 123 | - v_strCipherOpenImploded := g_oCacic.implode(p_tstrCipherOpened,g_oCacic.getSeparatorKey); | |
| 124 | - v_strCipherClosed := g_oCacic.enCrypt(v_strCipherOpenImploded); | |
| 125 | - Writeln(v_DatFile,v_strCipherClosed); {Grava a string Texto no arquivo texto} | |
| 126 | - CloseFile(v_DatFile); | |
| 127 | - except | |
| 128 | - end; | |
| 129 | -end; | |
| 130 | - | |
| 131 | -Function CipherOpen(p_DatFileName : string) : TStrings; | |
| 132 | -var v_DatFile : TextFile; | |
| 133 | - v_strCipherOpened, | |
| 134 | - v_strCipherClosed : string; | |
| 135 | -begin | |
| 136 | - v_strCipherOpened := ''; | |
| 137 | - if FileExists(p_DatFileName) then | |
| 138 | - begin | |
| 139 | - AssignFile(v_DatFile,p_DatFileName); | |
| 140 | - {$IOChecks off} | |
| 141 | - Reset(v_DatFile); | |
| 142 | - {$IOChecks on} | |
| 143 | - if (IOResult <> 0) then // Arquivo não existe, será recriado. | |
| 144 | - begin | |
| 145 | - Rewrite (v_DatFile); | |
| 146 | - Append(v_DatFile); | |
| 147 | - end; | |
| 148 | - | |
| 149 | - Readln(v_DatFile,v_strCipherClosed); | |
| 150 | - while not EOF(v_DatFile) do Readln(v_DatFile,v_strCipherClosed); | |
| 151 | - CloseFile(v_DatFile); | |
| 152 | - v_strCipherOpened:= g_oCacic.deCrypt(v_strCipherClosed); | |
| 153 | - end; | |
| 154 | - if (trim(v_strCipherOpened)<>'') then | |
| 155 | - Result := g_oCacic.explode(v_strCipherOpened,g_oCacic.getSeparatorKey) | |
| 156 | - else | |
| 157 | - 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); | |
| 158 | - | |
| 159 | - if Result.Count mod 2 <> 0 then | |
| 160 | - Result.Add(''); | |
| 161 | -end; | |
| 162 | - | |
| 163 | -Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String; p_tstrCipherOpened : TStrings); | |
| 164 | -begin | |
| 165 | - // Exemplo: p_Chave => Configs.nu_ip_servidor : p_Valor => 10.71.0.120 | |
| 166 | - if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then | |
| 167 | - p_tstrCipherOpened[p_tstrCipherOpened.IndexOf(p_Chave)+1] := p_Valor | |
| 168 | - else | |
| 169 | - Begin | |
| 170 | - p_tstrCipherOpened.Add(p_Chave); | |
| 171 | - p_tstrCipherOpened.Add(p_Valor); | |
| 172 | - End; | |
| 173 | -end; | |
| 174 | - | |
| 175 | -procedure log_DEBUG(p_msg:string); | |
| 176 | -Begin | |
| 177 | - if v_Debugs then log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg); | |
| 178 | -End; | |
| 179 | - | |
| 180 | -function GetRootKey(strRootKey: String): HKEY; | |
| 181 | -begin | |
| 182 | - /// Encontrar uma maneira mais elegante de fazer esses testes. | |
| 183 | - if Trim(strRootKey) = 'HKEY_LOCAL_MACHINE' Then Result := HKEY_LOCAL_MACHINE | |
| 184 | - else if Trim(strRootKey) = 'HKEY_CLASSES_ROOT' Then Result := HKEY_CLASSES_ROOT | |
| 185 | - else if Trim(strRootKey) = 'HKEY_CURRENT_USER' Then Result := HKEY_CURRENT_USER | |
| 186 | - else if Trim(strRootKey) = 'HKEY_USERS' Then Result := HKEY_USERS | |
| 187 | - else if Trim(strRootKey) = 'HKEY_CURRENT_CONFIG' Then Result := HKEY_CURRENT_CONFIG | |
| 188 | - else if Trim(strRootKey) = 'HKEY_DYN_DATA' Then Result := HKEY_DYN_DATA; | |
| 189 | -end; | |
| 190 | - | |
| 191 | -Function RemoveCaracteresEspeciais(Texto : String) : String; | |
| 192 | -var I : Integer; | |
| 193 | - strAux : String; | |
| 194 | -Begin | |
| 195 | - For I := 0 To Length(Texto) Do | |
| 196 | - if ord(Texto[I]) in [32..126] Then | |
| 197 | - strAux := strAux + Texto[I] | |
| 198 | - else strAux := strAux + ' '; // Coloca um espaço onde houver caracteres especiais | |
| 199 | - Result := strAux; | |
| 200 | -end; | |
| 201 | - | |
| 202 | -function GetValorChaveRegEdit(Chave: String): Variant; | |
| 203 | -var RegEditGet: TRegistry; | |
| 204 | - RegDataType: TRegDataType; | |
| 205 | - strRootKey, strKey, strValue, s: String; | |
| 206 | - ListaAuxGet : TStrings; | |
| 207 | - DataSize, Len, I : Integer; | |
| 208 | -begin | |
| 209 | - try | |
| 210 | - Result := ''; | |
| 211 | - ListaAuxGet := g_oCacic.explode(Chave, '\'); | |
| 212 | - | |
| 213 | - strRootKey := ListaAuxGet[0]; | |
| 214 | - For I := 1 To ListaAuxGet.Count - 2 Do strKey := strKey + ListaAuxGet[I] + '\'; | |
| 215 | - strValue := ListaAuxGet[ListaAuxGet.Count - 1]; | |
| 216 | - if (strValue = '(Padrão)') then strValue := ''; //Para os casos de se querer buscar o valor default (Padrão) | |
| 217 | - RegEditGet := TRegistry.Create; | |
| 218 | - | |
| 219 | - RegEditGet.Access := KEY_READ; | |
| 220 | - RegEditGet.Rootkey := GetRootKey(strRootKey); | |
| 221 | - if RegEditGet.OpenKeyReadOnly(strKey) then //teste | |
| 222 | - Begin | |
| 223 | - RegDataType := RegEditGet.GetDataType(strValue); | |
| 224 | - if (RegDataType = rdString) or (RegDataType = rdExpandString) then Result := RegEditGet.ReadString(strValue) | |
| 225 | - else if RegDataType = rdInteger then Result := RegEditGet.ReadInteger(strValue) | |
| 226 | - else if (RegDataType = rdBinary) or (RegDataType = rdUnknown) | |
| 227 | - then | |
| 228 | - begin | |
| 229 | - DataSize := RegEditGet.GetDataSize(strValue); | |
| 230 | - if DataSize = -1 then exit; | |
| 231 | - SetLength(s, DataSize); | |
| 232 | - Len := RegEditGet.ReadBinaryData(strValue, PChar(s)^, DataSize); | |
| 233 | - if Len <> DataSize then exit; | |
| 234 | - Result := RemoveCaracteresEspeciais(s); | |
| 235 | - end | |
| 236 | - end; | |
| 237 | - finally | |
| 238 | - RegEditGet.CloseKey; | |
| 239 | - RegEditGet.Free; | |
| 240 | - ListaAuxGet.Free; | |
| 241 | - | |
| 242 | - end; | |
| 243 | -end; | |
| 244 | - | |
| 245 | -function ProgramaRodando(NomePrograma: String): Boolean; | |
| 246 | -var | |
| 247 | - IsRunning, ContinueTest: Boolean; | |
| 248 | - FSnapshotHandle: THandle; | |
| 249 | - FProcessEntry32: TProcessEntry32; | |
| 250 | -begin | |
| 251 | - IsRunning := False; | |
| 252 | - FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); | |
| 253 | - FProcessEntry32.dwSize := Sizeof(FProcessEntry32); | |
| 254 | - ContinueTest := Process32First(FSnapshotHandle, FProcessEntry32); | |
| 255 | - while ContinueTest do | |
| 256 | - begin | |
| 257 | - IsRunning := UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(NomePrograma); | |
| 258 | - if IsRunning then ContinueTest := False | |
| 259 | - else ContinueTest := Process32Next(FSnapshotHandle, FProcessEntry32); | |
| 260 | - end; | |
| 261 | - CloseHandle(FSnapshotHandle); | |
| 262 | - Result := IsRunning; | |
| 263 | -end; | |
| 264 | - | |
| 265 | -Function GetValorDatMemoria(p_Chave : String; p_tstrCipherOpened : TStrings) : String; | |
| 266 | -begin | |
| 267 | - if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then | |
| 268 | - Result := p_tstrCipherOpened[p_tstrCipherOpened.IndexOf(p_Chave)+1] | |
| 269 | - else | |
| 270 | - Result := ''; | |
| 271 | -end; | |
| 272 | - | |
| 273 | -function GetFolderDate(Folder: string): TDateTime; | |
| 274 | -var | |
| 275 | - Rec: TSearchRec; | |
| 276 | - Found: Integer; | |
| 277 | - Date: TDateTime; | |
| 278 | -begin | |
| 279 | - if Folder[Length(folder)] = '\' then | |
| 280 | - Delete(Folder, Length(folder), 1); | |
| 281 | - Result := 0; | |
| 282 | - Found := FindFirst(Folder, faDirectory, Rec); | |
| 283 | - try | |
| 284 | - if Found = 0 then | |
| 285 | - begin | |
| 286 | - Date := FileDateToDateTime(Rec.Time); | |
| 287 | - Result := Date; | |
| 288 | - end; | |
| 289 | - finally | |
| 290 | - FindClose(Rec); | |
| 291 | - end; | |
| 292 | -end; | |
| 293 | - | |
| 294 | -procedure Executa_Col_Anvi; | |
| 295 | -var Lista1_RCO : TStringList; | |
| 296 | - Lista2_RCO : TStrings; | |
| 297 | - nu_versao_engine, dt_hr_instalacao, nu_versao_pattern, ChaveRegistro, te_servidor, in_ativo, | |
| 298 | - NomeExecutavel, UVC, ValorChaveRegistro, strAux, strDirTrend : String; | |
| 299 | - searchResult : TSearchRec; // Necessário apenas para Win9x | |
| 300 | -begin | |
| 301 | - Try | |
| 302 | - SetValorDatMemoria('Col_Anvi.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); | |
| 303 | - nu_versao_engine := ''; | |
| 304 | - nu_versao_pattern := ''; | |
| 305 | - log_diario('Coletando informações de Antivírus OfficeScan.'); | |
| 306 | - If g_oCacic.isWindows9xME() Then { Windows 9x/ME } | |
| 307 | - Begin | |
| 308 | - ChaveRegistro := 'HKEY_LOCAL_MACHINE\Software\TrendMicro\OfficeScanCorp\CurrentVersion'; | |
| 309 | - NomeExecutavel := 'pccwin97.exe'; | |
| 310 | - dt_hr_instalacao := GetValorChaveRegEdit(ChaveRegistro + '\Install Date') + GetValorChaveRegEdit(ChaveRegistro + '\Install Time'); | |
| 311 | - log_DEBUG('Data/Hora de Instalação: '+dt_hr_instalacao); | |
| 312 | - strDirTrend := GetValorChaveRegEdit(ChaveRegistro + '\Application Path'); | |
| 313 | - If FileExists(strDirTrend + '\filter32.vxd') Then | |
| 314 | - Begin | |
| 315 | - // Em máquinas Windows 9X a versão do engine e do pattern não são gravadas no registro. Tenho que pegar direto dos arquivos. | |
| 316 | - Lista2_RCO := g_oCacic.explode(getVersionInfo(strDirTrend + 'filter32.vxd'), '.'); // Pego só os dois primeiros dígitos. Por exemplo: 6.640.0.1001 vira 6.640. | |
| 317 | - nu_versao_engine := Lista2_RCO[0] + '.' + Lista2_RCO[1]; | |
| 318 | - Lista2_RCO.Free; | |
| 319 | - end | |
| 320 | - Else nu_versao_engine := '0'; | |
| 321 | - | |
| 322 | - // A gambiarra para coletar a versão do pattern é obter a maior extensão do arquivo lpt$vpn | |
| 323 | - if FindFirst(strDirTrend + '\lpt$vpn.*', faAnyFile, searchResult) = 0 then | |
| 324 | - begin | |
| 325 | - Lista1_RCO := TStringList.Create; | |
| 326 | - repeat Lista1_RCO.Add(ExtractFileExt(searchResult.Name)); | |
| 327 | - until FindNext(searchResult) <> 0; | |
| 328 | - Sysutils.FindClose(searchResult); | |
| 329 | - Lista1_RCO.Sort; // Ordeno, para, em seguida, obter o último. | |
| 330 | - strAux := Lista1_RCO[Lista1_RCO.Count - 1]; | |
| 331 | - Lista1_RCO.Free; | |
| 332 | - nu_versao_pattern := Copy(strAux, 2, Length(strAux)); // Removo o '.' da extensão. | |
| 333 | - end; | |
| 334 | - | |
| 335 | - end | |
| 336 | - Else | |
| 337 | - Begin // NT a XP | |
| 338 | - ChaveRegistro := 'HKEY_LOCAL_MACHINE\Software\TrendMicro\PC-cillinNTCorp\CurrentVersion'; | |
| 339 | - NomeExecutavel := 'ntrtscan.exe'; | |
| 340 | - dt_hr_instalacao := GetValorChaveRegEdit(ChaveRegistro + '\InstDate') + GetValorChaveRegEdit(ChaveRegistro + '\InstTime'); | |
| 341 | - nu_versao_engine := GetValorChaveRegEdit(ChaveRegistro + '\Misc.\EngineZipVer'); | |
| 342 | - nu_versao_pattern := GetValorChaveRegEdit(ChaveRegistro + '\Misc.\PatternVer'); | |
| 343 | - nu_versao_pattern := Copy(nu_versao_pattern, 2, Length(nu_versao_pattern)-3); | |
| 344 | - end; | |
| 345 | - | |
| 346 | - log_DEBUG('Versão de Engine obtida.: '+nu_versao_engine); | |
| 347 | - log_DEBUG('Versão de Pattern obtida: '+nu_versao_pattern); | |
| 348 | - | |
| 349 | - te_servidor := GetValorChaveRegEdit(ChaveRegistro + '\Server'); | |
| 350 | - If (ProgramaRodando(NomeExecutavel)) Then in_ativo := '1' Else in_ativo := '0'; | |
| 351 | - | |
| 352 | - log_DEBUG('Valor para Estado Ativo.: ' + in_ativo); | |
| 353 | - | |
| 354 | - // Monto a string que será comparada com o valor armazenado no registro. | |
| 355 | - UVC := Trim(nu_versao_engine + ';' + | |
| 356 | - nu_versao_pattern + ';' + | |
| 357 | - te_servidor + ';' + | |
| 358 | - dt_hr_instalacao + ';' + | |
| 359 | - in_ativo); | |
| 360 | - // Obtenho do registro o valor que foi previamente armazenado | |
| 361 | - ValorChaveRegistro := Trim(GetValorDatMemoria('Coletas.OfficeScan',v_tstrCipherOpened)); | |
| 362 | - | |
| 363 | - SetValorDatMemoria('Col_Anvi.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); | |
| 364 | - | |
| 365 | - log_DEBUG('Registro Anterior: ' + ValorChaveRegistro); | |
| 366 | - log_DEBUG('Registro Atual...: ' + UVC); | |
| 367 | - // Se essas informações forem diferentes significa que houve alguma alteração | |
| 368 | - // na configuração. Nesse caso, gravo as informações no BD Central | |
| 369 | - // e, se não houver problemas durante esse procedimento, atualizo as | |
| 370 | - // informações no registro. | |
| 371 | - If (GetValorDatMemoria('Configs.IN_COLETA_FORCADA_ANVI',v_tstrCipherOpened)='S') or (UVC <> ValorChaveRegistro) Then | |
| 372 | - Begin | |
| 373 | - SetValorDatMemoria('Col_Anvi.nu_versao_engine' , nu_versao_engine , v_tstrCipherOpened1); | |
| 374 | - SetValorDatMemoria('Col_Anvi.nu_versao_pattern' , nu_versao_pattern, v_tstrCipherOpened1); | |
| 375 | - SetValorDatMemoria('Col_Anvi.dt_hr_instalacao' , dt_hr_instalacao , v_tstrCipherOpened1); | |
| 376 | - SetValorDatMemoria('Col_Anvi.te_servidor' , te_servidor , v_tstrCipherOpened1); | |
| 377 | - SetValorDatMemoria('Col_Anvi.in_ativo' , in_ativo , v_tstrCipherOpened1); | |
| 378 | - SetValorDatMemoria('Col_Anvi.UVC' , UVC , v_tstrCipherOpened1); | |
| 379 | - CipherClose(g_oCacic.getCacicPath + '\temp\col_anvi.dat' , v_tstrCipherOpened1); | |
| 380 | - end | |
| 381 | - else | |
| 382 | - Begin | |
| 383 | - SetValorDatMemoria('Col_Anvi.nada', 'nada', v_tstrCipherOpened1); | |
| 384 | - CipherClose(g_oCacic.getCacicPath + '\temp\col_anvi.dat', v_tstrCipherOpened1); | |
| 385 | - End; | |
| 386 | - Except | |
| 387 | - Begin | |
| 388 | - SetValorDatMemoria('Col_Anvi.nada', 'nada', v_tstrCipherOpened1); | |
| 389 | - SetValorDatMemoria('Col_Anvi.Fim', '99999999', v_tstrCipherOpened1); | |
| 390 | - CipherClose(g_oCacic.getCacicPath + '\temp\col_anvi.dat', v_tstrCipherOpened1); | |
| 391 | - End; | |
| 392 | - End; | |
| 393 | -end; | |
| 394 | - | |
| 395 | -var tstrTripa1 : TStrings; | |
| 396 | - intAux : integer; | |
| 397 | - strAux : String; | |
| 398 | -const | |
| 399 | - CACIC_APP_NAME = 'col_anvi'; | |
| 400 | - | |
| 401 | -begin | |
| 402 | - g_oCacic := TCACIC.Create(); | |
| 403 | - | |
| 404 | - g_oCacic.setBoolCipher(true); | |
| 405 | - | |
| 406 | - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then | |
| 407 | - if (ParamCount>0) then | |
| 408 | - Begin | |
| 409 | - strAux := ''; | |
| 410 | - For intAux := 1 to ParamCount do | |
| 411 | - Begin | |
| 412 | - if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then | |
| 413 | - begin | |
| 414 | - strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); | |
| 415 | - log_DEBUG('Parâmetro /CacicPath recebido com valor="'+strAux+'"'); | |
| 416 | - end; | |
| 417 | - end; | |
| 418 | - | |
| 419 | - if (strAux <> '') then | |
| 420 | - Begin | |
| 421 | - g_oCacic.setCacicPath(strAux); | |
| 422 | - | |
| 423 | - v_Debugs := false; | |
| 424 | - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 425 | - Begin | |
| 426 | - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 427 | - Begin | |
| 428 | - v_Debugs := true; | |
| 429 | - log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 430 | - End; | |
| 431 | - End; | |
| 432 | - | |
| 433 | - v_tstrCipherOpened := TStrings.Create; | |
| 434 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 435 | - | |
| 436 | - v_tstrCipherOpened1 := TStrings.Create; | |
| 437 | - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_anvi.dat'); | |
| 438 | - | |
| 439 | - Try | |
| 440 | - Executa_Col_Anvi; | |
| 441 | - Except | |
| 442 | - Begin | |
| 443 | - SetValorDatMemoria('Col_Anvi.nada', 'nada', v_tstrCipherOpened1); | |
| 444 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_anvi.dat', v_tstrCipherOpened1); | |
| 445 | - End; | |
| 446 | - End; | |
| 447 | - End; | |
| 448 | - End; | |
| 449 | - g_oCacic.Free(); | |
| 450 | -end. |
col_anvi/col_anvi.res
No preview for this file type
col_anvi/col_anvi_icon.ico
No preview for this file type