Commit 2b432a4584d98dc809ae6904b9e0a099466e25ae
1 parent
e32a719b
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@962 fecfc0c7-e812-0410-ae72-849f08638ee7
Showing
6 changed files
with
0 additions
and
1177 deletions
Show diff stats
col_moni/ShellLinker.pas
| ... | ... | @@ -1,76 +0,0 @@ |
| 1 | -unit ShellLinker; | |
| 2 | - | |
| 3 | -interface | |
| 4 | -uses ActiveX, Windows, ShlObj; | |
| 5 | - | |
| 6 | -//uses | |
| 7 | -// Windows, ShlObj; | |
| 8 | -//uses | |
| 9 | -// SysUtils, ComObj, ActiveX, ShellApi, Classes, Menus; | |
| 10 | - | |
| 11 | -type | |
| 12 | - TShowState = (ssNormal, ssMinimized, ssMaximized, ssHide); | |
| 13 | - | |
| 14 | - TLinkInfo = record | |
| 15 | - Target: String; // Path to link target file - empty for virtual folders | |
| 16 | - ClsID: PItemIDList; // Absolute CLSID (PIDL) of target | |
| 17 | - WorkDir: String; // Working directory - empty for virtual folders | |
| 18 | - Parameters: String; // Parameters sent to path - empty for virtual folders | |
| 19 | - Description: String; // Description of link | |
| 20 | - IconPath: String; // File containing icon - often same as Target | |
| 21 | - IconIndex: Integer; // Index of icon in the icon file | |
| 22 | - HotKey: Word; // HotKey (like Alt+Shift+F) - numeric | |
| 23 | - ShowState: TShowState; // Normal, minimized, or maximized | |
| 24 | - end; | |
| 25 | - | |
| 26 | - TLinkHotKey = record | |
| 27 | - Modifiers: Word; | |
| 28 | - Key: Word; | |
| 29 | - end; | |
| 30 | -function CreateShellLink(FileName, Target, Description, StartIn, Parameters, | |
| 31 | - IconPath: String; IconIndex: Integer; HotKey: Word; ShowState: TShowState; | |
| 32 | - ItemIDList: PItemIDList): Boolean; | |
| 33 | - | |
| 34 | - | |
| 35 | -implementation | |
| 36 | - | |
| 37 | -function ShowStateToCmdShow(ShowState: TShowState): Integer; | |
| 38 | -begin | |
| 39 | - case ShowState of | |
| 40 | - ssMinimized: Result := SW_SHOWMINNOACTIVE; | |
| 41 | - ssMaximized: Result := SW_SHOWMAXIMIZED; | |
| 42 | - ssHide: Result := SW_HIDE; | |
| 43 | - else | |
| 44 | - Result := SW_SHOWNORMAL; | |
| 45 | - end; | |
| 46 | -end; | |
| 47 | - | |
| 48 | -function CreateShellLink(FileName, Target, Description, StartIn, Parameters, | |
| 49 | - IconPath: String; IconIndex: Integer; HotKey: Word; ShowState: TShowState; | |
| 50 | - ItemIDList: PItemIDList): Boolean; | |
| 51 | -var | |
| 52 | - sl: IShellLink; | |
| 53 | - ppf: IPersistFile; | |
| 54 | - wcLinkName: array[0..MAX_PATH] of WideChar; | |
| 55 | -begin | |
| 56 | - CoInitialize(nil); // Initialize COM | |
| 57 | - CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_INPROC_SERVER, IID_IShellLinkA, sl); | |
| 58 | - sl.QueryInterface(IPersistFile, ppf); | |
| 59 | - sl.SetPath(PChar(Target)); | |
| 60 | - if ItemIDList <> nil then | |
| 61 | - sl.SetIDList(ItemIDList); | |
| 62 | - sl.SetDescription(PChar(Description)); | |
| 63 | - sl.SetWorkingDirectory(PChar(StartIn)); | |
| 64 | - sl.SetArguments(PChar(Parameters)); | |
| 65 | - sl.SetIconLocation(PChar(IconPath), IconIndex); | |
| 66 | - if HotKey <> 0 then | |
| 67 | - sl.SetHotkey(HotKey); | |
| 68 | - sl.SetShowCmd(ShowStateToCmdShow(ShowState)); | |
| 69 | - // Save shell link | |
| 70 | - MultiByteToWideChar(CP_ACP, 0, PChar(FileName), -1, wcLinkName, MAX_PATH); | |
| 71 | - Result := (ppf.Save(wcLinkName, true) = S_OK); | |
| 72 | - CoUninitialize; | |
| 73 | -end; | |
| 74 | - | |
| 75 | -end. | |
| 76 | - |
col_moni/col_moni.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_moni/col_moni.dof
| ... | ... | @@ -1,136 +0,0 @@ |
| 1 | -[FileVersion] | |
| 2 | -Version=7.0 | |
| 3 | -[Compiler] | |
| 4 | -A=8 | |
| 5 | -B=0 | |
| 6 | -C=1 | |
| 7 | -D=1 | |
| 8 | -E=0 | |
| 9 | -F=0 | |
| 10 | -G=1 | |
| 11 | -H=1 | |
| 12 | -I=1 | |
| 13 | -J=0 | |
| 14 | -K=0 | |
| 15 | -L=1 | |
| 16 | -M=0 | |
| 17 | -N=1 | |
| 18 | -O=1 | |
| 19 | -P=1 | |
| 20 | -Q=0 | |
| 21 | -R=0 | |
| 22 | -S=0 | |
| 23 | -T=0 | |
| 24 | -U=0 | |
| 25 | -V=1 | |
| 26 | -W=0 | |
| 27 | -X=1 | |
| 28 | -Y=1 | |
| 29 | -Z=1 | |
| 30 | -ShowHints=1 | |
| 31 | -ShowWarnings=1 | |
| 32 | -UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; | |
| 33 | -NamespacePrefix= | |
| 34 | -SymbolDeprecated=1 | |
| 35 | -SymbolLibrary=1 | |
| 36 | -SymbolPlatform=1 | |
| 37 | -UnitLibrary=1 | |
| 38 | -UnitPlatform=1 | |
| 39 | -UnitDeprecated=1 | |
| 40 | -HResultCompat=1 | |
| 41 | -HidingMember=1 | |
| 42 | -HiddenVirtual=1 | |
| 43 | -Garbage=1 | |
| 44 | -BoundsError=1 | |
| 45 | -ZeroNilCompat=1 | |
| 46 | -StringConstTruncated=1 | |
| 47 | -ForLoopVarVarPar=1 | |
| 48 | -TypedConstVarPar=1 | |
| 49 | -AsgToTypedConst=1 | |
| 50 | -CaseLabelRange=1 | |
| 51 | -ForVariable=1 | |
| 52 | -ConstructingAbstract=1 | |
| 53 | -ComparisonFalse=1 | |
| 54 | -ComparisonTrue=1 | |
| 55 | -ComparingSignedUnsigned=1 | |
| 56 | -CombiningSignedUnsigned=1 | |
| 57 | -UnsupportedConstruct=1 | |
| 58 | -FileOpen=1 | |
| 59 | -FileOpenUnitSrc=1 | |
| 60 | -BadGlobalSymbol=1 | |
| 61 | -DuplicateConstructorDestructor=1 | |
| 62 | -InvalidDirective=1 | |
| 63 | -PackageNoLink=1 | |
| 64 | -PackageThreadVar=1 | |
| 65 | -ImplicitImport=1 | |
| 66 | -HPPEMITIgnored=1 | |
| 67 | -NoRetVal=1 | |
| 68 | -UseBeforeDef=1 | |
| 69 | -ForLoopVarUndef=1 | |
| 70 | -UnitNameMismatch=1 | |
| 71 | -NoCFGFileFound=1 | |
| 72 | -MessageDirective=1 | |
| 73 | -ImplicitVariants=1 | |
| 74 | -UnicodeToLocale=1 | |
| 75 | -LocaleToUnicode=1 | |
| 76 | -ImagebaseMultiple=1 | |
| 77 | -SuspiciousTypecast=1 | |
| 78 | -PrivatePropAccessor=1 | |
| 79 | -UnsafeType=0 | |
| 80 | -UnsafeCode=0 | |
| 81 | -UnsafeCast=0 | |
| 82 | -[Linker] | |
| 83 | -MapFile=0 | |
| 84 | -OutputObjs=0 | |
| 85 | -ConsoleApp=1 | |
| 86 | -DebugInfo=0 | |
| 87 | -RemoteSymbols=0 | |
| 88 | -MinStackSize=16384 | |
| 89 | -MaxStackSize=1048576 | |
| 90 | -ImageBase=4194304 | |
| 91 | -ExeDescription= | |
| 92 | -[Directories] | |
| 93 | -OutputDir= | |
| 94 | -UnitOutputDir= | |
| 95 | -PackageDLLOutputDir= | |
| 96 | -PackageDCPOutputDir= | |
| 97 | -SearchPath= | |
| 98 | -Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOffice2k;MSI_D7_Rtl | |
| 99 | -Conditionals= | |
| 100 | -DebugSourceDirs= | |
| 101 | -UsePackages=0 | |
| 102 | -[Parameters] | |
| 103 | -RunParams= | |
| 104 | -HostApplication= | |
| 105 | -Launcher= | |
| 106 | -UseLauncher=0 | |
| 107 | -DebugCWD= | |
| 108 | -[Language] | |
| 109 | -ActiveLang= | |
| 110 | -ProjectLang= | |
| 111 | -RootDir=C:\Arquivos de programas\Borland\Delphi7\Bin\ | |
| 112 | -[Version Info] | |
| 113 | -IncludeVerInfo=1 | |
| 114 | -AutoIncBuild=0 | |
| 115 | -MajorVer=2 | |
| 116 | -MinorVer=5 | |
| 117 | -Release=0 | |
| 118 | -Build=773 | |
| 119 | -Debug=0 | |
| 120 | -PreRelease=0 | |
| 121 | -Special=0 | |
| 122 | -Private=0 | |
| 123 | -DLL=0 | |
| 124 | -Locale=1046 | |
| 125 | -CodePage=1252 | |
| 126 | -[Version Info Keys] | |
| 127 | -CompanyName=Dataprev - Emp. de TI da Prev.Social - URES | |
| 128 | -FileDescription=Coletor de Informações de Sistemas Monitorados do pelo CACIC | |
| 129 | -FileVersion=2.5.0.773 | |
| 130 | -InternalName= | |
| 131 | -LegalCopyright= | |
| 132 | -LegalTrademarks= | |
| 133 | -OriginalFilename= | |
| 134 | -ProductName=Col_MONI | |
| 135 | -ProductVersion=2.6 | |
| 136 | -Comments=Baseado na licença GPL (General Public License) |
col_moni/col_moni.dpr
| ... | ... | @@ -1,927 +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_moni; | |
| 19 | -{$R *.res} | |
| 20 | - | |
| 21 | -uses | |
| 22 | - Windows, | |
| 23 | - sysutils, | |
| 24 | - inifiles, | |
| 25 | - Registry, | |
| 26 | - Classes, | |
| 27 | - PJVersionInfo, | |
| 28 | - CACIC_Library in '..\CACIC_Library.pas'; | |
| 29 | - | |
| 30 | -var | |
| 31 | - v_Res_Search, | |
| 32 | - v_Drive, | |
| 33 | - v_File, | |
| 34 | - v_strCipherClosed : String; | |
| 35 | - PJVersionInfo1 : TPJVersionInfo; | |
| 36 | - | |
| 37 | -var | |
| 38 | - v_Debugs : boolean; | |
| 39 | - | |
| 40 | -var | |
| 41 | - v_tstrCipherOpened, | |
| 42 | - v_tstrCipherOpened1, | |
| 43 | - tstrTripa1 : TStrings; | |
| 44 | - | |
| 45 | -var | |
| 46 | - intAux : integer; | |
| 47 | - | |
| 48 | -var | |
| 49 | - g_oCacic : TCACIC; | |
| 50 | - | |
| 51 | -const | |
| 52 | - CACIC_APP_NAME = 'col_moni'; | |
| 53 | - | |
| 54 | -procedure GetSubDirs(Folder:string; sList:TStringList); | |
| 55 | - var | |
| 56 | - sr:TSearchRec; | |
| 57 | -begin | |
| 58 | - if FindFirst(Folder+'*.*',faDirectory,sr)=0 then | |
| 59 | - try | |
| 60 | - repeat | |
| 61 | - if(sr.Attr and faDirectory)=faDirectory then | |
| 62 | - sList.Add(sr.Name); | |
| 63 | - until FindNext(sr)<>0; | |
| 64 | - finally | |
| 65 | - FindClose(sr); | |
| 66 | - end; | |
| 67 | -end; | |
| 68 | -//Para buscar do Arquivo INI... | |
| 69 | -// Marreta devido a limitações do KERNEL w9x no tratamento de arquivos texto e suas seções | |
| 70 | -function GetValorChaveRegIni(p_SectionName, p_KeyName, p_IniFileName : String) : String; | |
| 71 | -var | |
| 72 | - FileText : TStringList; | |
| 73 | - i, j, v_Size_Section, v_Size_Key : integer; | |
| 74 | - v_SectionName, v_KeyName : string; | |
| 75 | - begin | |
| 76 | - Result := ''; | |
| 77 | - v_SectionName := '[' + p_SectionName + ']'; | |
| 78 | - v_Size_Section := strLen(PChar(v_SectionName)); | |
| 79 | - v_KeyName := p_KeyName + '='; | |
| 80 | - v_Size_Key := strLen(PChar(v_KeyName)); | |
| 81 | - FileText := TStringList.Create; | |
| 82 | - try | |
| 83 | - FileText.LoadFromFile(p_IniFileName); | |
| 84 | - For i := 0 To FileText.Count - 1 Do | |
| 85 | - Begin | |
| 86 | - if (LowerCase(Trim(PChar(Copy(FileText[i],1,v_Size_Section)))) = LowerCase(Trim(PChar(v_SectionName)))) then | |
| 87 | - Begin | |
| 88 | - For j := i to FileText.Count - 1 Do | |
| 89 | - Begin | |
| 90 | - if (LowerCase(Trim(PChar(Copy(FileText[j],1,v_Size_Key)))) = LowerCase(Trim(PChar(v_KeyName)))) then | |
| 91 | - Begin | |
| 92 | - Result := PChar(Copy(FileText[j],v_Size_Key + 1,strLen(PChar(FileText[j]))-v_Size_Key)); | |
| 93 | - Break; | |
| 94 | - End; | |
| 95 | - End; | |
| 96 | - End; | |
| 97 | - if (Result <> '') then break; | |
| 98 | - End; | |
| 99 | - finally | |
| 100 | - FileText.Free; | |
| 101 | - end; | |
| 102 | - end; | |
| 103 | - | |
| 104 | -function VerFmt(const MS, LS: DWORD): string; | |
| 105 | - // Format the version number from the given DWORDs containing the info | |
| 106 | -begin | |
| 107 | - Result := Format('%d.%d.%d.%d', | |
| 108 | - [HiWord(MS), LoWord(MS), HiWord(LS), LoWord(LS)]) | |
| 109 | -end; | |
| 110 | -procedure log_diario(strMsg : String); | |
| 111 | -var | |
| 112 | - HistoricoLog : TextFile; | |
| 113 | - strDataArqLocal, strDataAtual : string; | |
| 114 | -begin | |
| 115 | - try | |
| 116 | - FileSetAttr (g_oCacic.getCacicPath + 'cacic2.log',0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 | |
| 117 | - AssignFile(HistoricoLog,g_oCacic.getCacicPath + 'cacic2.log'); {Associa o arquivo a uma variável do tipo TextFile} | |
| 118 | - {$IOChecks off} | |
| 119 | - Reset(HistoricoLog); {Abre o arquivo texto} | |
| 120 | - {$IOChecks on} | |
| 121 | - if (IOResult <> 0) then // Arquivo não existe, será recriado. | |
| 122 | - begin | |
| 123 | - Rewrite (HistoricoLog); | |
| 124 | - Append(HistoricoLog); | |
| 125 | - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <======================='); | |
| 126 | - end; | |
| 127 | - DateTimeToString(strDataArqLocal, 'yyyymmdd', FileDateToDateTime(Fileage(g_oCacic.getCacicPath + 'cacic2.log'))); | |
| 128 | - DateTimeToString(strDataAtual , 'yyyymmdd', Date); | |
| 129 | - if (strDataAtual <> strDataArqLocal) then // Se o arquivo INI não é da data atual... | |
| 130 | - begin | |
| 131 | - Rewrite (HistoricoLog); //Cria/Recria o arquivo | |
| 132 | - Append(HistoricoLog); | |
| 133 | - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now) + '======================> Iniciando o Log do CACIC <======================='); | |
| 134 | - end; | |
| 135 | - Append(HistoricoLog); | |
| 136 | - Writeln(HistoricoLog,FormatDateTime('dd/mm hh:nn:ss : ', Now)+ '[Coletor MONI] '+strMsg); {Grava a string Texto no arquivo texto} | |
| 137 | - CloseFile(HistoricoLog); {Fecha o arquivo texto} | |
| 138 | - except | |
| 139 | - log_diario('Erro na gravação do log!'); | |
| 140 | - end; | |
| 141 | -end; | |
| 142 | - | |
| 143 | -function GetVersionInfo(p_File: string):string; | |
| 144 | -var v_versao : string; | |
| 145 | -begin | |
| 146 | - PJVersionInfo1 := TPJVersionInfo.Create(nil); | |
| 147 | - PJVersionInfo1.FileName := p_File; | |
| 148 | - v_versao := VerFmt(PJVersionInfo1.FixedFileInfo.dwFileVersionMS, PJVersionInfo1.FixedFileInfo.dwFileVersionLS); | |
| 149 | - PJVersionInfo1.Free; | |
| 150 | - Result := v_versao; | |
| 151 | -end; | |
| 152 | - | |
| 153 | -// Baixada de http://www.infoeng.hpg.ig.com.br/borland_delphi_dicas_2.htm | |
| 154 | -function LetrasDrives: string; | |
| 155 | -var | |
| 156 | -Drives: DWord; | |
| 157 | -I, Tipo: byte; | |
| 158 | -v_Unidade : string; | |
| 159 | -begin | |
| 160 | -Result := ''; | |
| 161 | -Drives := GetLogicalDrives; | |
| 162 | -if Drives <> 0 then | |
| 163 | -for I := 65 to 90 do | |
| 164 | - if ((Drives shl (31 - (I - 65))) shr 31) = 1 then | |
| 165 | - Begin | |
| 166 | - v_Unidade := Char(I) + ':\'; | |
| 167 | - Tipo := GetDriveType(PChar(v_Unidade)); | |
| 168 | - case Tipo of | |
| 169 | - DRIVE_FIXED: Result := Result + Char(I); | |
| 170 | - end; | |
| 171 | - End; | |
| 172 | -end; | |
| 173 | - | |
| 174 | -// By Muad Dib 2003 | |
| 175 | -// at http://www.planet-source-code.com. | |
| 176 | -// Excelente!!! | |
| 177 | -function SearchFile(p_Drive,p_File:string) : boolean; | |
| 178 | -var sr:TSearchRec; | |
| 179 | - sDirList:TStringList; | |
| 180 | - i:integer; | |
| 181 | -begin | |
| 182 | - Result := false; | |
| 183 | - v_Res_Search := ''; | |
| 184 | - if FindFirst(p_Drive+p_File,faAnyFile,sr) = 0 then | |
| 185 | - Begin | |
| 186 | - v_Res_Search := p_Drive+p_File; | |
| 187 | - Result := true; | |
| 188 | - End | |
| 189 | - else | |
| 190 | - Begin | |
| 191 | - repeat | |
| 192 | - until FindNext(sr)<>0; | |
| 193 | - FindClose(sr); | |
| 194 | - sDirList:= TStringList.Create; | |
| 195 | - try | |
| 196 | - GetSubDirs(p_Drive,sDirList); | |
| 197 | - for i:=0 to sDirList.Count-1 do | |
| 198 | - if (sDirList[i]<>'.') and (sDirList[i]<>'..') then | |
| 199 | - begin | |
| 200 | - //Application.ProcessMessages; | |
| 201 | - if (SearchFile(IncludeTrailingPathDelimiter(p_Drive+sDirList[i]),p_File)) then | |
| 202 | - Begin | |
| 203 | - Result := true; | |
| 204 | - Break; | |
| 205 | - End; | |
| 206 | - end; | |
| 207 | - finally | |
| 208 | - sDirList.Free; | |
| 209 | - End; | |
| 210 | - end; | |
| 211 | -end; | |
| 212 | - | |
| 213 | -Function CipherClose(p_DatFileName : string; p_tstrCipherOpened : TStrings) : String; | |
| 214 | -var v_strCipherOpenImploded : string; | |
| 215 | - v_DatFile : TextFile; | |
| 216 | -begin | |
| 217 | - try | |
| 218 | - FileSetAttr (p_DatFileName,0); // Retira os atributos do arquivo para evitar o erro FILE ACCESS DENIED em máquinas 2000 | |
| 219 | - AssignFile(v_DatFile,p_DatFileName); {Associa o arquivo a uma variável do tipo TextFile} | |
| 220 | - | |
| 221 | - // Criação do arquivo .DAT | |
| 222 | - Rewrite (v_DatFile); | |
| 223 | - Append(v_DatFile); | |
| 224 | - | |
| 225 | - v_strCipherOpenImploded := g_oCacic.implode(p_tstrCipherOpened,g_oCacic.getSeparatorKey); | |
| 226 | - v_strCipherClosed := g_oCacic.enCrypt(v_strCipherOpenImploded); | |
| 227 | - | |
| 228 | - Writeln(v_DatFile,v_strCipherClosed); {Grava a string Texto no arquivo texto} | |
| 229 | - | |
| 230 | - CloseFile(v_DatFile); | |
| 231 | - except | |
| 232 | - end; | |
| 233 | -end; | |
| 234 | - | |
| 235 | -Function CipherOpen(p_DatFileName : string) : TStrings; | |
| 236 | -var v_DatFile : TextFile; | |
| 237 | - v_strCipherOpened, | |
| 238 | - v_strCipherClosed : string; | |
| 239 | -begin | |
| 240 | - v_strCipherOpened := ''; | |
| 241 | - if FileExists(p_DatFileName) then | |
| 242 | - begin | |
| 243 | - AssignFile(v_DatFile,p_DatFileName); | |
| 244 | - {$IOChecks off} | |
| 245 | - Reset(v_DatFile); | |
| 246 | - {$IOChecks on} | |
| 247 | - if (IOResult <> 0) then // Arquivo não existe, será recriado. | |
| 248 | - begin | |
| 249 | - Rewrite (v_DatFile); | |
| 250 | - Append(v_DatFile); | |
| 251 | - end; | |
| 252 | - | |
| 253 | - Readln(v_DatFile,v_strCipherClosed); | |
| 254 | - while not EOF(v_DatFile) do Readln(v_DatFile,v_strCipherClosed); | |
| 255 | - CloseFile(v_DatFile); | |
| 256 | - v_strCipherOpened:= g_oCacic.deCrypt(v_strCipherClosed); | |
| 257 | - end; | |
| 258 | - if (trim(v_strCipherOpened)<>'') then | |
| 259 | - Result := g_oCacic.explode(v_strCipherOpened,g_oCacic.getSeparatorKey) | |
| 260 | - else | |
| 261 | - 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); | |
| 262 | - | |
| 263 | - if Result.Count mod 2 <> 0 then | |
| 264 | - Result.Add(''); | |
| 265 | -end; | |
| 266 | - | |
| 267 | -Procedure SetValorDatMemoria(p_Chave : string; p_Valor : String; p_tstrCipherOpened : TStrings); | |
| 268 | -begin | |
| 269 | - // Exemplo: p_Chave => Configs.nu_ip_servidor : p_Valor => 10.71.0.120 | |
| 270 | - if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then | |
| 271 | - p_tstrCipherOpened[v_tstrCipherOpened.IndexOf(p_Chave)+1] := p_Valor | |
| 272 | - else | |
| 273 | - Begin | |
| 274 | - p_tstrCipherOpened.Add(p_Chave); | |
| 275 | - p_tstrCipherOpened.Add(p_Valor); | |
| 276 | - End; | |
| 277 | -end; | |
| 278 | -procedure log_DEBUG(p_msg:string); | |
| 279 | -Begin | |
| 280 | - if v_Debugs then log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg); | |
| 281 | -End; | |
| 282 | - | |
| 283 | -Function GetValorDatMemoria(p_Chave : String; p_tstrCipherOpened : TStrings) : String; | |
| 284 | -begin | |
| 285 | - if (p_tstrCipherOpened.IndexOf(p_Chave)<>-1) then | |
| 286 | - Result := p_tstrCipherOpened[p_tstrCipherOpened.IndexOf(p_Chave)+1] | |
| 287 | - else | |
| 288 | - Result := ''; | |
| 289 | -end; | |
| 290 | - | |
| 291 | -function GetRootKey(strRootKey: String): HKEY; | |
| 292 | -begin | |
| 293 | - if Trim(strRootKey) = 'HKEY_LOCAL_MACHINE' Then Result := HKEY_LOCAL_MACHINE | |
| 294 | - else if Trim(strRootKey) = 'HKEY_CLASSES_ROOT' Then Result := HKEY_CLASSES_ROOT | |
| 295 | - else if Trim(strRootKey) = 'HKEY_CURRENT_USER' Then Result := HKEY_CURRENT_USER | |
| 296 | - else if Trim(strRootKey) = 'HKEY_USERS' Then Result := HKEY_USERS | |
| 297 | - else if Trim(strRootKey) = 'HKEY_CURRENT_CONFIG' Then Result := HKEY_CURRENT_CONFIG | |
| 298 | - else if Trim(strRootKey) = 'HKEY_DYN_DATA' Then Result := HKEY_DYN_DATA; | |
| 299 | -end; | |
| 300 | - | |
| 301 | -Function RemoveCaracteresEspeciais(Texto : String) : String; | |
| 302 | -var I : Integer; | |
| 303 | - strAux : String; | |
| 304 | -Begin | |
| 305 | - For I := 0 To Length(Texto) Do | |
| 306 | - if ord(Texto[I]) in [32..126] Then | |
| 307 | - strAux := strAux + Texto[I] | |
| 308 | - else strAux := strAux + ' '; // Coloca um espaço onde houver caracteres especiais | |
| 309 | - Result := strAux; | |
| 310 | -end; | |
| 311 | - | |
| 312 | -function GetValorChaveRegEdit(Chave: String): Variant; | |
| 313 | -var RegEditGet: TRegistry; | |
| 314 | - RegDataType: TRegDataType; | |
| 315 | - strRootKey, strKey, strValue, s: String; | |
| 316 | - ListaAuxGet : TStrings; | |
| 317 | - DataSize, Len, I : Integer; | |
| 318 | -begin | |
| 319 | - try | |
| 320 | - Result := ''; | |
| 321 | - ListaAuxGet := g_oCacic.explode(Chave, '\'); | |
| 322 | - | |
| 323 | - strRootKey := ListaAuxGet[0]; | |
| 324 | - For I := 1 To ListaAuxGet.Count - 2 Do strKey := strKey + ListaAuxGet[I] + '\'; | |
| 325 | - strValue := ListaAuxGet[ListaAuxGet.Count - 1]; | |
| 326 | - if (strValue = '(Padrão)') then strValue := ''; //Para os casos de se querer buscar o valor default (Padrão) | |
| 327 | - RegEditGet := TRegistry.Create; | |
| 328 | - | |
| 329 | - RegEditGet.Access := KEY_READ; | |
| 330 | - RegEditGet.Rootkey := GetRootKey(strRootKey); | |
| 331 | - if RegEditGet.OpenKeyReadOnly(strKey) then //teste | |
| 332 | - Begin | |
| 333 | - RegDataType := RegEditGet.GetDataType(strValue); | |
| 334 | - if (RegDataType = rdString) or (RegDataType = rdExpandString) then Result := RegEditGet.ReadString(strValue) | |
| 335 | - else if RegDataType = rdInteger then Result := RegEditGet.ReadInteger(strValue) | |
| 336 | - else if (RegDataType = rdBinary) or (RegDataType = rdUnknown) | |
| 337 | - then | |
| 338 | - begin | |
| 339 | - DataSize := RegEditGet.GetDataSize(strValue); | |
| 340 | - if DataSize = -1 then exit; | |
| 341 | - SetLength(s, DataSize); | |
| 342 | - Len := RegEditGet.ReadBinaryData(strValue, PChar(s)^, DataSize); | |
| 343 | - if Len <> DataSize then exit; | |
| 344 | - Result := RemoveCaracteresEspeciais(s); | |
| 345 | - end | |
| 346 | - end; | |
| 347 | - finally | |
| 348 | - RegEditGet.CloseKey; | |
| 349 | - RegEditGet.Free; | |
| 350 | - ListaAuxGet.Free; | |
| 351 | - | |
| 352 | - end; | |
| 353 | -end; | |
| 354 | - | |
| 355 | -function LastPos(SubStr, S: string): Integer; | |
| 356 | -var | |
| 357 | - Found, Len, Pos: integer; | |
| 358 | -begin | |
| 359 | - Pos := Length(S); | |
| 360 | - Len := Length(SubStr); | |
| 361 | - Found := 0; | |
| 362 | - while (Pos > 0) and (Found = 0) do | |
| 363 | - begin | |
| 364 | - if Copy(S, Pos, Len) = SubStr then | |
| 365 | - Found := Pos; | |
| 366 | - Dec(Pos); | |
| 367 | - end; | |
| 368 | - LastPos := Found; | |
| 369 | -end; | |
| 370 | - | |
| 371 | - | |
| 372 | -procedure Executa_Col_moni; | |
| 373 | -var tstrTripa2, tstrTripa3, v_array1, v_array2, v_array3, v_array4 : TStrings; | |
| 374 | - strAux, strAux1, strAux3, strAux4, strTripa, ValorChavePerfis, UVC, v_LetrasDrives, v_Data : String; | |
| 375 | - intAux4, v1, v3, v_achei : Integer; | |
| 376 | - | |
| 377 | -begin | |
| 378 | - Try | |
| 379 | - SetValorDatMemoria('Col_Moni.Inicio', FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); | |
| 380 | - // Verifica se deverá ser realizada a coleta de informações de sistemas monitorados neste | |
| 381 | - // computador, perguntando ao agente gerente. | |
| 382 | - log_diario('Coletando informações de Sistemas Monitorados.'); | |
| 383 | - ShortDateFormat := 'dd/mm/yyyy'; | |
| 384 | - intAux4 := 1; | |
| 385 | - strAux3 := ''; | |
| 386 | - ValorChavePerfis := '*'; | |
| 387 | - v_LetrasDrives := LetrasDrives; | |
| 388 | - | |
| 389 | - while ValorChavePerfis <> '' do | |
| 390 | - begin | |
| 391 | - strAux3 := 'SIS' + trim(inttostr(intAux4)); | |
| 392 | - strTripa := ''; // Conterá as informações a serem enviadas ao Gerente. | |
| 393 | - // Obtenho do registro o valor que foi previamente armazenado | |
| 394 | - ValorChavePerfis := Trim(GetValorDatMemoria('Coletas.'+strAux3,v_tstrCipherOpened)); | |
| 395 | - | |
| 396 | - if (ValorChavePerfis <> '') then | |
| 397 | - Begin | |
| 398 | - //Atenção, OS ELEMENTOS DEVEM ESTAR DE ACORDO COM A ORDEM QUE SÃO TRATADOS NO MÓDULO GERENTE. | |
| 399 | - tstrTripa2 := g_oCacic.explode(ValorChavePerfis,','); | |
| 400 | - if (strAux <> '') then strAux := strAux + '#'; | |
| 401 | - strAux := strAux + trim(tstrTripa2[0]) + ','; | |
| 402 | - | |
| 403 | - | |
| 404 | - /////////////////////////////////////////// | |
| 405 | - ///// Coleta de Informação de Licença ///// | |
| 406 | - /////////////////////////////////////////// | |
| 407 | - | |
| 408 | - //Vazio | |
| 409 | - if (trim(tstrTripa2[2])='0') then | |
| 410 | - Begin | |
| 411 | - strAux := strAux + ','; | |
| 412 | - End; | |
| 413 | - | |
| 414 | - //Caminho\Chave\Valor em Registry | |
| 415 | - if (trim(tstrTripa2[2])='1') then | |
| 416 | - Begin | |
| 417 | - strAux4 := ''; | |
| 418 | - log_debug('Buscando informação de LICENÇA em '+tstrTripa2[3]); | |
| 419 | - Try | |
| 420 | - strAux4 := Trim(GetValorChaveRegEdit(trim(tstrTripa2[3]))); | |
| 421 | - Except | |
| 422 | - End; | |
| 423 | - if (strAux4 = '') then strAux4 := '?'; | |
| 424 | - strAux := strAux + strAux4 + ','; | |
| 425 | - End; | |
| 426 | - | |
| 427 | - //Nome/Seção/Chave de Arquivo INI | |
| 428 | - if (trim(tstrTripa2[2])='2') then | |
| 429 | - Begin | |
| 430 | - log_debug('Buscando informação de LICENÇA em '+tstrTripa2[3]); | |
| 431 | - Try | |
| 432 | - if (LastPos('/',trim(tstrTripa2[3]))>0) then | |
| 433 | - Begin | |
| 434 | - tstrTripa3 := g_oCacic.explode(trim(tstrTripa2[3]),'/'); | |
| 435 | - // | |
| 436 | - for v1:=1 to length(v_LetrasDrives) do | |
| 437 | - Begin | |
| 438 | - v_File := trim(tstrTripa3[0]); | |
| 439 | - if (LastPos(':\',v_File)>0) then | |
| 440 | - Begin | |
| 441 | - v_Drive := Copy(v_File,1,3); | |
| 442 | - v_File := Copy(v_File,4,Length(v_File)); | |
| 443 | - End | |
| 444 | - else | |
| 445 | - Begin | |
| 446 | - v_Drive := v_LetrasDrives[v1] + ':'; | |
| 447 | - if (Copy(v_File,1,1)<>'\') then v_Drive := v_Drive + '\'; | |
| 448 | - v_File := Copy(v_File,1,Length(v_File)); | |
| 449 | - End; | |
| 450 | - | |
| 451 | - strAux1 := ExtractShortPathName(v_Drive + v_File); | |
| 452 | - if (strAux1 = '') then | |
| 453 | - begin | |
| 454 | - if (SearchFile(v_Drive,v_File)) then | |
| 455 | - Begin | |
| 456 | - strAux1 := v_Res_Search; | |
| 457 | - break; | |
| 458 | - End; | |
| 459 | - end | |
| 460 | - else break; | |
| 461 | - End; | |
| 462 | - | |
| 463 | - strAux4 := Trim(GetValorChaveRegIni(tstrTripa3[1],tstrTripa3[2],strAux1)); | |
| 464 | - if (strAux4 = '') then strAux4 := '?'; | |
| 465 | - strAux := strAux + strAux4 + ','; | |
| 466 | - End; | |
| 467 | - | |
| 468 | - if (LastPos('/',trim(tstrTripa2[3]))=0) then | |
| 469 | - Begin | |
| 470 | - strAux := strAux + 'Parâm.Lic.Incorreto,'; | |
| 471 | - End | |
| 472 | - Except | |
| 473 | - strAux := strAux + 'Parâm.Lic.Incorreto,'; | |
| 474 | - End; | |
| 475 | - End; | |
| 476 | - | |
| 477 | - | |
| 478 | - | |
| 479 | - ////////////////////////////////////////////// | |
| 480 | - ///// Coleta de Informação de Instalação ///// | |
| 481 | - ////////////////////////////////////////////// | |
| 482 | - | |
| 483 | - //Vazio | |
| 484 | - if (trim(tstrTripa2[5])='0') then | |
| 485 | - Begin | |
| 486 | - strAux := strAux + ','; | |
| 487 | - End; | |
| 488 | - | |
| 489 | - //Nome de Executável OU Nome de Arquivo de Configuração (CADPF!!!) | |
| 490 | - if (trim(tstrTripa2[5])='1') or (trim(tstrTripa2[5]) = '2') then | |
| 491 | - Begin | |
| 492 | - strAux1 := ''; | |
| 493 | - for v1:=1 to length(v_LetrasDrives) do | |
| 494 | - Begin | |
| 495 | - v_File := trim(tstrTripa2[6]); | |
| 496 | - log_debug('Buscando informação de INSTALAÇÃO em '+tstrTripa2[6]); | |
| 497 | - if (LastPos(':\',v_File)>0) then | |
| 498 | - Begin | |
| 499 | - v_Drive := Copy(v_File,1,3); | |
| 500 | - v_File := Copy(v_File,4,Length(v_File)); | |
| 501 | - End | |
| 502 | - else | |
| 503 | - Begin | |
| 504 | - v_Drive := v_LetrasDrives[v1] + ':'; | |
| 505 | - if (Copy(v_File,1,1)<>'\') then v_Drive := v_Drive + '\'; | |
| 506 | - v_File := Copy(v_File,1,Length(v_File)); | |
| 507 | - End; | |
| 508 | - | |
| 509 | - strAux1 := ExtractShortPathName(v_Drive + v_File); | |
| 510 | - if (strAux1 = '') then | |
| 511 | - begin | |
| 512 | - if (SearchFile(v_Drive,v_File)) then | |
| 513 | - Begin | |
| 514 | - strAux1 := v_Res_Search; | |
| 515 | - break; | |
| 516 | - End; | |
| 517 | - end | |
| 518 | - else break; | |
| 519 | - | |
| 520 | - End; | |
| 521 | - | |
| 522 | - if (strAux1 <> '') then strAux := strAux + 'S,'; | |
| 523 | - if (strAux1 = '') then strAux := strAux + 'N,'; | |
| 524 | - strAux1 := ''; | |
| 525 | - End; | |
| 526 | - | |
| 527 | - //Caminho\Chave\Valor em Registry | |
| 528 | - if (trim(tstrTripa2[5])='3') then | |
| 529 | - Begin | |
| 530 | - strAux1 := ''; | |
| 531 | - Try | |
| 532 | - log_debug('Buscando informação de INSTALAÇÃO em '+tstrTripa2[6]); | |
| 533 | - strAux1 := Trim(GetValorChaveRegEdit(trim(tstrTripa2[6]))); | |
| 534 | - Except | |
| 535 | - End; | |
| 536 | - if (strAux1 <> '') then strAux := strAux + 'S,'; | |
| 537 | - if (strAux1 = '') then strAux := strAux + 'N,'; | |
| 538 | - strAux1 := ''; | |
| 539 | - End; | |
| 540 | - | |
| 541 | - | |
| 542 | - | |
| 543 | - ////////////////////////////////////////// | |
| 544 | - ///// Coleta de Informação de Versão ///// | |
| 545 | - ////////////////////////////////////////// | |
| 546 | - | |
| 547 | - //Vazio | |
| 548 | - if (trim(tstrTripa2[7])='0') then | |
| 549 | - Begin | |
| 550 | - strAux := strAux + ','; | |
| 551 | - End; | |
| 552 | - | |
| 553 | - //Data de Arquivo | |
| 554 | - if (trim(tstrTripa2[7])='1') then | |
| 555 | - Begin | |
| 556 | - strAux1 := ''; | |
| 557 | - log_debug('Buscando informação de VERSÃO em '+tstrTripa2[8]); | |
| 558 | - for v1:=1 to length(v_LetrasDrives) do | |
| 559 | - Begin | |
| 560 | - v_File := trim(tstrTripa2[8]); | |
| 561 | - if (LastPos(':\',v_File)>0) then | |
| 562 | - Begin | |
| 563 | - v_Drive := Copy(v_File,1,3); | |
| 564 | - v_File := Copy(v_File,4,Length(v_File)); | |
| 565 | - End | |
| 566 | - else | |
| 567 | - Begin | |
| 568 | - v_Drive := v_LetrasDrives[v1] + ':'; | |
| 569 | - if (Copy(v_File,1,1)<>'\') then v_Drive := v_Drive + '\'; | |
| 570 | - v_File := Copy(v_File,1,Length(v_File)); | |
| 571 | - End; | |
| 572 | - | |
| 573 | - strAux1 := ExtractShortPathName(v_Drive + v_File); | |
| 574 | - if (strAux1 = '') then | |
| 575 | - begin | |
| 576 | - if (SearchFile(v_Drive,v_File)) then | |
| 577 | - Begin | |
| 578 | - strAux1 := v_Res_Search; | |
| 579 | - break; | |
| 580 | - End; | |
| 581 | - end | |
| 582 | - else break; | |
| 583 | - End; | |
| 584 | - | |
| 585 | - if (strAux1 <> '') then | |
| 586 | - Begin | |
| 587 | - v_Data := StringReplace(DateToStr(FileDateToDateTime(FileAge(strAux1))),'.','/',[rfReplaceAll]); | |
| 588 | - v_Data := StringReplace(v_Data,'-','/',[rfReplaceAll]); | |
| 589 | - strAux := strAux + v_Data + ','; | |
| 590 | - v_Data := ''; | |
| 591 | - End; | |
| 592 | - | |
| 593 | - if (strAux1 = '') then strAux := strAux + '?,'; | |
| 594 | - strAux1 := ''; | |
| 595 | - End; | |
| 596 | - | |
| 597 | - //Caminho\Chave\Valor em Registry | |
| 598 | - if (trim(tstrTripa2[7])='2') then | |
| 599 | - Begin | |
| 600 | - strAux1 := ''; | |
| 601 | - log_debug('Buscando informação de VERSÃO em '+tstrTripa2[8]); | |
| 602 | - Try | |
| 603 | - strAux1 := Trim(GetValorChaveRegEdit(trim(tstrTripa2[8]))); | |
| 604 | - Except | |
| 605 | - End; | |
| 606 | - if (strAux1 <> '') then strAux := strAux + strAux1 + ','; | |
| 607 | - if (strAux1 = '') then strAux := strAux + '?,'; | |
| 608 | - strAux1 := ''; | |
| 609 | - End; | |
| 610 | - | |
| 611 | - | |
| 612 | - //Nome/Seção/Chave de Arquivo INI | |
| 613 | - if (trim(tstrTripa2[7])='3') then | |
| 614 | - Begin | |
| 615 | - Try | |
| 616 | - log_debug('Buscando informação de VERSÃO em '+tstrTripa2[8]); | |
| 617 | - if (LastPos('/',trim(tstrTripa2[8]))>0) then | |
| 618 | - Begin | |
| 619 | - tstrTripa3 := g_oCacic.explode(trim(tstrTripa2[8]),'/'); | |
| 620 | - // | |
| 621 | - for v1:=1 to length(v_LetrasDrives) do | |
| 622 | - Begin | |
| 623 | - v_File := trim(tstrTripa3[0]); | |
| 624 | - if (LastPos(':\',v_File)>0) then | |
| 625 | - Begin | |
| 626 | - v_Drive := Copy(v_File,1,3); | |
| 627 | - v_File := Copy(v_File,4,Length(v_File)); | |
| 628 | - End | |
| 629 | - else | |
| 630 | - Begin | |
| 631 | - v_Drive := v_LetrasDrives[v1] + ':'; | |
| 632 | - if (Copy(v_File,1,1)<>'\') then v_Drive := v_Drive + '\'; | |
| 633 | - v_File := Copy(v_File,1,Length(v_File)); | |
| 634 | - End; | |
| 635 | - | |
| 636 | - strAux1 := ExtractShortPathName(v_Drive + v_File); | |
| 637 | - if (strAux1 = '') then | |
| 638 | - begin | |
| 639 | - if (SearchFile(v_Drive,v_File)) then | |
| 640 | - Begin | |
| 641 | - strAux1 := v_Res_Search; | |
| 642 | - break; | |
| 643 | - End; | |
| 644 | - end | |
| 645 | - else break; | |
| 646 | - End; | |
| 647 | - | |
| 648 | - // | |
| 649 | - strAux4 := Trim(GetValorChaveRegIni(tstrTripa3[1],tstrTripa3[2],strAux1)); | |
| 650 | - if (strAux4 = '') then strAux4 := '?'; | |
| 651 | - strAux := strAux + strAux4 + ','; | |
| 652 | - End | |
| 653 | - else | |
| 654 | - Begin | |
| 655 | - strAux := strAux + 'Parâm.Versao Incorreto,'; | |
| 656 | - End; | |
| 657 | - Except | |
| 658 | - End; | |
| 659 | - End; | |
| 660 | - | |
| 661 | - | |
| 662 | - //Versão de Executável | |
| 663 | - if (trim(tstrTripa2[7])='4') then | |
| 664 | - Begin | |
| 665 | - log_debug('Buscando informação de VERSÃO em '+tstrTripa2[8]); | |
| 666 | - Try | |
| 667 | - v_achei := 0; | |
| 668 | - for v1:=1 to length(v_LetrasDrives) do | |
| 669 | - Begin | |
| 670 | - if v_achei = 0 then | |
| 671 | - Begin | |
| 672 | - v_File := trim(tstrTripa2[8]); | |
| 673 | - if (LastPos(':\',v_File)>0) then | |
| 674 | - Begin | |
| 675 | - v_Drive := Copy(v_File,1,3); | |
| 676 | - v_File := Copy(v_File,4,Length(v_File)); | |
| 677 | - End | |
| 678 | - else | |
| 679 | - Begin | |
| 680 | - v_Drive := v_LetrasDrives[v1] + ':'; | |
| 681 | - if (Copy(v_File,1,1)<>'\') then v_Drive := v_Drive + '\'; | |
| 682 | - v_File := Copy(v_File,1,Length(v_File)); | |
| 683 | - End; | |
| 684 | - | |
| 685 | - strAux1 := ExtractShortPathName(v_Drive + v_File); | |
| 686 | - if (strAux1 = '') then | |
| 687 | - begin | |
| 688 | - if (SearchFile(v_Drive,v_File)) then | |
| 689 | - Begin | |
| 690 | - strAux1 := v_Res_Search; | |
| 691 | - v_achei := 1; | |
| 692 | - End; | |
| 693 | - end | |
| 694 | - else v_achei := 1; | |
| 695 | - End; | |
| 696 | - End; | |
| 697 | - Except | |
| 698 | - End; | |
| 699 | - | |
| 700 | - if (strAux1 <> '') then | |
| 701 | - Begin | |
| 702 | - strAux := strAux + getVersionInfo(strAux1); | |
| 703 | - End | |
| 704 | - else strAux := strAux + '?'; | |
| 705 | - | |
| 706 | - strAux := strAux + ','; | |
| 707 | - | |
| 708 | - End; | |
| 709 | - | |
| 710 | - | |
| 711 | - ////////////////////////////////////////// | |
| 712 | - ///// Coleta de Informação de Engine ///// | |
| 713 | - ////////////////////////////////////////// | |
| 714 | - | |
| 715 | - //Vazio | |
| 716 | - if (trim(tstrTripa2[9])='.') then | |
| 717 | - Begin | |
| 718 | - strAux := strAux + ','; | |
| 719 | - End; | |
| 720 | - | |
| 721 | - //Arquivo para Versão de Engine | |
| 722 | - //O ponto é proposital para quando o último parâmetro vem vazio do Gerente!!! :) | |
| 723 | - if (trim(tstrTripa2[9])<>'.') then | |
| 724 | - Begin | |
| 725 | - log_debug('Buscando informação de ENGINE em '+tstrTripa2[9]); | |
| 726 | - for v1:=1 to length(v_LetrasDrives) do | |
| 727 | - Begin | |
| 728 | - v_File := trim(tstrTripa2[9]); | |
| 729 | - if (LastPos(':\',v_File)>0) then | |
| 730 | - Begin | |
| 731 | - v_Drive := Copy(v_File,1,3); | |
| 732 | - v_File := Copy(v_File,4,Length(v_File)); | |
| 733 | - End | |
| 734 | - else | |
| 735 | - Begin | |
| 736 | - v_Drive := v_LetrasDrives[v1] + ':'; | |
| 737 | - if (Copy(v_File,1,1)<>'\') then v_Drive := v_Drive + '\'; | |
| 738 | - v_File := Copy(v_File,1,Length(v_File)); | |
| 739 | - End; | |
| 740 | - | |
| 741 | - strAux1 := ExtractShortPathName(v_Drive + v_File); | |
| 742 | - if (strAux1 = '') then | |
| 743 | - begin | |
| 744 | - if (SearchFile(v_Drive,v_File)) then | |
| 745 | - Begin | |
| 746 | - strAux1 := v_Res_Search; | |
| 747 | - break; | |
| 748 | - End; | |
| 749 | - end | |
| 750 | - else break; | |
| 751 | - End; | |
| 752 | - if (strAux1 <> '') then | |
| 753 | - Begin | |
| 754 | - tstrTripa3 := g_oCacic.explode(getVersionInfo(strAux1), '.'); // Pego só os dois primeiros dígitos. Por exemplo: 6.640.0.1001 vira 6.640. | |
| 755 | - strAux := strAux + tstrTripa3[0] + '.' + tstrTripa3[1]; | |
| 756 | - End; | |
| 757 | - End; | |
| 758 | - | |
| 759 | - | |
| 760 | - /////////////////////////////////////////// | |
| 761 | - ///// Coleta de Informação de Pattern ///// | |
| 762 | - /////////////////////////////////////////// | |
| 763 | - | |
| 764 | - //Arquivo para Versão de Pattern | |
| 765 | - //O ponto é proposital para quando o último parâmetro vem vazio do Gerente!!! :) | |
| 766 | - strAux1 := ''; | |
| 767 | - if (trim(tstrTripa2[10])<>'.') then | |
| 768 | - Begin | |
| 769 | - log_debug('Buscando informação de PATTERN em '+tstrTripa2[9]); | |
| 770 | - for v1:=1 to length(v_LetrasDrives) do | |
| 771 | - Begin | |
| 772 | - v_File := trim(tstrTripa2[10]); | |
| 773 | - if (LastPos(':\',v_File)>0) then | |
| 774 | - Begin | |
| 775 | - v_Drive := Copy(v_File,1,3); | |
| 776 | - v_File := Copy(v_File,4,Length(v_File)); | |
| 777 | - End | |
| 778 | - else | |
| 779 | - Begin | |
| 780 | - v_Drive := v_LetrasDrives[v1] + ':'; | |
| 781 | - if (Copy(v_File,1,1)<>'\') then v_Drive := v_Drive + '\'; | |
| 782 | - v_File := Copy(v_File,1,Length(v_File)); | |
| 783 | - End; | |
| 784 | - | |
| 785 | - strAux1 := ExtractShortPathName(v_Drive + v_File); | |
| 786 | - if (strAux1 = '') then | |
| 787 | - begin | |
| 788 | - if (SearchFile(v_Drive, v_File)) then | |
| 789 | - Begin | |
| 790 | - strAux1 := v_Res_Search; | |
| 791 | - break; | |
| 792 | - End; | |
| 793 | - end | |
| 794 | - else break; | |
| 795 | - | |
| 796 | - End; | |
| 797 | - End; | |
| 798 | - if (strAux1 <> '') then | |
| 799 | - Begin | |
| 800 | - tstrTripa3 := g_oCacic.explode(getVersionInfo(strAux1), '.'); // Pego só os dois primeiros dígitos. Por exemplo: 6.640.0.1001 vira 6.640. | |
| 801 | - strAux := strAux + tstrTripa3[0] + '.' + tstrTripa3[1]; | |
| 802 | - End; | |
| 803 | - if (strAux1 = '') then strAux := strAux + ','; | |
| 804 | - strAux1 := ''; | |
| 805 | - End; | |
| 806 | - intAux4 := intAux4 + 1; | |
| 807 | - End; | |
| 808 | - | |
| 809 | - UVC := Trim(GetValorDatMemoria('Coletas.Sistemas_Monitorados',v_tstrCipherOpened)); | |
| 810 | - | |
| 811 | - SetValorDatMemoria('Col_Moni.Fim' , FormatDateTime('hh:nn:ss', Now), v_tstrCipherOpened1); | |
| 812 | - | |
| 813 | - If (GetValorDatMemoria('Configs.IN_COLETA_FORCADA_MONI',v_tstrCipherOpened)='S') or (trim(strAux) <> trim(UVC)) Then | |
| 814 | - Begin | |
| 815 | - if (trim(UVC) <> '') then | |
| 816 | - begin | |
| 817 | - v_array1 := g_oCacic.explode(strAux, '#'); | |
| 818 | - strAux := ''; | |
| 819 | - v_array3 := g_oCacic.explode(UVC, '#'); | |
| 820 | - for v1 := 0 to (v_array1.count)-1 do | |
| 821 | - Begin | |
| 822 | - v_array2 := g_oCacic.explode(v_array1[v1], ','); | |
| 823 | - v_achei := 0; | |
| 824 | - for v3 := 0 to (v_array3.count)-1 do | |
| 825 | - Begin | |
| 826 | - v_array4 := g_oCacic.explode(v_array3[v3], ','); | |
| 827 | - if (v_array4=v_array2) then v_achei := 1; | |
| 828 | - End; | |
| 829 | - if (v_achei = 0) then | |
| 830 | - Begin | |
| 831 | - if (strAUX <> '') then strAUX := strAUX + '#'; | |
| 832 | - strAUX := strAUX + v_array1[v1]; | |
| 833 | - End; | |
| 834 | - End; | |
| 835 | - end; | |
| 836 | - log_debug('Coleta anterior: '+UVC); | |
| 837 | - log_debug('Coleta atual...: '+strAux); | |
| 838 | - SetValorDatMemoria('Col_Moni.UVC', strAux, v_tstrCipherOpened1); | |
| 839 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_moni.dat', v_tstrCipherOpened1); | |
| 840 | - end | |
| 841 | - else | |
| 842 | - Begin | |
| 843 | - log_debug('Nenhuma Coleta Efetuada'); | |
| 844 | - SetValorDatMemoria('Col_Moni.nada', 'nada', v_tstrCipherOpened1); | |
| 845 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_moni.dat', v_tstrCipherOpened1); | |
| 846 | - End; | |
| 847 | - | |
| 848 | - Except | |
| 849 | - Begin | |
| 850 | - SetValorDatMemoria('Col_Moni.nada', 'nada', v_tstrCipherOpened1); | |
| 851 | - SetValorDatMemoria('Col_Moni.Fim', '99999999', v_tstrCipherOpened1); | |
| 852 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_moni.dat', v_tstrCipherOpened1); | |
| 853 | - End; | |
| 854 | - End; | |
| 855 | -END; | |
| 856 | - | |
| 857 | -function GetFolderDate(Folder: string): TDateTime; | |
| 858 | -var | |
| 859 | - Rec: TSearchRec; | |
| 860 | - Found: Integer; | |
| 861 | - Date: TDateTime; | |
| 862 | -begin | |
| 863 | - if Folder[Length(folder)] = '\' then | |
| 864 | - Delete(Folder, Length(folder), 1); | |
| 865 | - Result := 0; | |
| 866 | - Found := FindFirst(Folder, faDirectory, Rec); | |
| 867 | - try | |
| 868 | - if Found = 0 then | |
| 869 | - begin | |
| 870 | - Date := FileDateToDateTime(Rec.Time); | |
| 871 | - Result := Date; | |
| 872 | - end; | |
| 873 | - finally | |
| 874 | - FindClose(Rec); | |
| 875 | - end; | |
| 876 | -end; | |
| 877 | - | |
| 878 | -var strAux : String; | |
| 879 | -begin | |
| 880 | - g_oCacic := TCACIC.Create(); | |
| 881 | - | |
| 882 | - g_oCacic.setBoolCipher(true); | |
| 883 | - | |
| 884 | - if( not g_oCacic.isAppRunning( CACIC_APP_NAME ) ) then | |
| 885 | - if (ParamCount>0) then | |
| 886 | - Begin | |
| 887 | - strAux := ''; | |
| 888 | - For intAux := 1 to ParamCount do | |
| 889 | - Begin | |
| 890 | - if LowerCase(Copy(ParamStr(intAux),1,11)) = '/cacicpath=' then | |
| 891 | - begin | |
| 892 | - strAux := Trim(Copy(ParamStr(intAux),12,Length((ParamStr(intAux))))); | |
| 893 | - log_DEBUG('Parâmetro /CacicPath recebido com valor="'+strAux+'"'); | |
| 894 | - end; | |
| 895 | - end; | |
| 896 | - | |
| 897 | - if (strAux <> '') then | |
| 898 | - Begin | |
| 899 | - g_oCacic.setCacicPath(strAux); | |
| 900 | - v_Debugs := false; | |
| 901 | - if DirectoryExists(g_oCacic.getCacicPath + 'Temp\Debugs') then | |
| 902 | - Begin | |
| 903 | - if (FormatDateTime('ddmmyyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs')) = FormatDateTime('ddmmyyyy', date)) then | |
| 904 | - Begin | |
| 905 | - v_Debugs := true; | |
| 906 | - log_diario('Pasta "' + g_oCacic.getCacicPath + 'Temp\Debugs" com data '+FormatDateTime('dd-mm-yyyy', GetFolderDate(g_oCacic.getCacicPath + 'Temp\Debugs'))+' encontrada. DEBUG ativado.'); | |
| 907 | - End; | |
| 908 | - End; | |
| 909 | - | |
| 910 | - v_tstrCipherOpened := TStrings.Create; | |
| 911 | - v_tstrCipherOpened := CipherOpen(g_oCacic.getCacicPath + g_oCacic.getDatFileName); | |
| 912 | - | |
| 913 | - v_tstrCipherOpened1 := TStrings.Create; | |
| 914 | - v_tstrCipherOpened1 := CipherOpen(g_oCacic.getCacicPath + 'temp\col_moni.dat'); | |
| 915 | - | |
| 916 | - Try | |
| 917 | - Executa_Col_moni; | |
| 918 | - Except | |
| 919 | - SetValorDatMemoria('Col_Moni.nada', 'nada', v_tstrCipherOpened1); | |
| 920 | - CipherClose(g_oCacic.getCacicPath + 'temp\col_moni.dat', v_tstrCipherOpened1); | |
| 921 | - End; | |
| 922 | - End; | |
| 923 | - End; | |
| 924 | - | |
| 925 | - g_oCacic.Free(); | |
| 926 | - | |
| 927 | -end. |
col_moni/col_moni.res
No preview for this file type
col_moni/col_moni_icon.ico
No preview for this file type