From fd7c18236b80e540cc1c1957223cac8fdff742f9 Mon Sep 17 00:00:00 2001 From: Eric Menezes Noronha Date: Thu, 21 Aug 2014 13:42:27 -0300 Subject: [PATCH] Correção de bug ao coletar registro em máquinas de 64 bits. --- Mapa/Mapa.dfm | 129 ++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------- Mapa/Mapa.pas | 35 +++++++++-------------------------- gercols/gercols.dpr | 16 +++++++++++----- gercols/gercols.dproj | 2 +- gercols/gercols.res | Bin 4756 -> 0 bytes main.dfm | 15 +++++++-------- main.pas | 9 ++++----- 7 files changed, 62 insertions(+), 144 deletions(-) diff --git a/Mapa/Mapa.dfm b/Mapa/Mapa.dfm index fce55d5..0564988 100644 --- a/Mapa/Mapa.dfm +++ b/Mapa/Mapa.dfm @@ -162,7 +162,7 @@ object frmMapaCacic: TfrmMapaCacic 780 374) object lbEtiqueta2: TLabel - Left = 277 + Left = 420 Top = 33 Width = 250 Height = 13 @@ -180,8 +180,8 @@ object frmMapaCacic: TfrmMapaCacic Visible = False end object lbEtiqueta3: TLabel - Left = 511 - Top = 33 + Left = 420 + Top = 82 Width = 250 Height = 13 Hint = 'Insira o n'#250'mero do patrim'#244'nio do segundo monitor, se o tiver.' @@ -199,7 +199,7 @@ object frmMapaCacic: TfrmMapaCacic end object lbEtiqueta4: TLabel Left = 43 - Top = 80 + Top = 82 Width = 250 Height = 13 Hint = 'Este '#233' o usu'#225'rio logado atualmente' @@ -268,8 +268,8 @@ object frmMapaCacic: TfrmMapaCacic Visible = False end object lbEtiqueta5: TLabel - Left = 420 - Top = 82 + Left = 43 + Top = 133 Width = 250 Height = 13 Hint = 'Nome do usu'#225'rio logado.' @@ -284,7 +284,7 @@ object frmMapaCacic: TfrmMapaCacic Visible = False end object lbEtiqueta7: TLabel - Left = 420 + Left = 661 Top = 129 Width = 69 Height = 13 @@ -302,7 +302,7 @@ object frmMapaCacic: TfrmMapaCacic Visible = False end object lbEtiqueta6: TLabel - Left = 43 + Left = 420 Top = 129 Width = 175 Height = 13 @@ -321,42 +321,6 @@ object frmMapaCacic: TfrmMapaCacic ShowHint = True Visible = False end - object lbEtiquetaTel: TLabel - Left = 514 - Top = 129 - Width = 69 - Height = 13 - Hint = 'Digite o telefone do seu local de trabalho.' - AutoSize = False - Caption = 'Telefone' - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ParentFont = False - ParentShowHint = False - ShowHint = True - Visible = False - end - object lbEtiqueta8: TLabel - Left = 632 - Top = 129 - Width = 69 - Height = 13 - Hint = 'Digite o ramal do seu local de trabalho.' - AutoSize = False - Caption = 'Ramal' - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ParentFont = False - ParentShowHint = False - ShowHint = True - Visible = False - end object edTeInfoPatrimonio4: TEdit Left = 43 Top = 99 @@ -376,9 +340,9 @@ object frmMapaCacic: TfrmMapaCacic Visible = False end object edTeInfoPatrimonio3: TEdit - Left = 509 - Top = 52 - Width = 221 + Left = 420 + Top = 99 + Width = 312 Height = 24 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -399,13 +363,13 @@ object frmMapaCacic: TfrmMapaCacic Height = 20 Caption = 'Recarregar' Enabled = False - TabOrder = 13 + TabOrder = 11 OnClick = btCombosUpdateClick end object edTeInfoPatrimonio2: TEdit - Left = 277 + Left = 420 Top = 52 - Width = 221 + Width = 312 Height = 24 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -419,23 +383,6 @@ object frmMapaCacic: TfrmMapaCacic TabOrder = 1 Visible = False end - object edTeInfoPatrimonio8: TEdit - Left = 632 - Top = 148 - Width = 98 - Height = 24 - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -13 - Font.Name = 'MS Sans Serif' - Font.Style = [] - MaxLength = 10 - ParentFont = False - ParentShowHint = False - ShowHint = True - TabOrder = 8 - Visible = False - end object edTeInfoPatrimonio9: TEdit Left = 43 Top = 201 @@ -451,13 +398,13 @@ object frmMapaCacic: TfrmMapaCacic ParentFont = False ParentShowHint = False ShowHint = True - TabOrder = 9 + TabOrder = 7 Visible = False end object edTeInfoPatrimonio1: TEdit Left = 43 Top = 52 - Width = 221 + Width = 310 Height = 24 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -472,8 +419,8 @@ object frmMapaCacic: TfrmMapaCacic Visible = False end object edTeInfoPatrimonio5: TEdit - Left = 420 - Top = 99 + Left = 43 + Top = 152 Width = 310 Height = 24 Enabled = False @@ -495,7 +442,7 @@ object frmMapaCacic: TfrmMapaCacic Width = 774 Height = 83 Caption = 'Termo de Responsabilidade' - TabOrder = 11 + TabOrder = 9 object rdConcordaTermos: TRadioButton Left = 3 Top = 23 @@ -527,14 +474,14 @@ object frmMapaCacic: TfrmMapaCacic Font.Name = 'Arial' Font.Style = [fsBold] ParentFont = False - TabOrder = 12 + TabOrder = 10 Visible = False OnClick = AtualizaPatrimonio end object edTeInfoPatrimonio6: TEdit - Left = 43 - Top = 148 - Width = 310 + Left = 420 + Top = 152 + Width = 229 Height = 24 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -549,8 +496,8 @@ object frmMapaCacic: TfrmMapaCacic Visible = False end object edTeInfoPatrimonio7: TEdit - Left = 420 - Top = 148 + Left = 663 + Top = 152 Width = 67 Height = 24 Font.Charset = DEFAULT_CHARSET @@ -580,23 +527,7 @@ object frmMapaCacic: TfrmMapaCacic ParentFont = False ParentShowHint = False ShowHint = True - TabOrder = 10 - Visible = False - end - object edTeInfoPatrimonioTel: TMaskEdit - Left = 514 - Top = 148 - Width = 89 - Height = 24 - EditMask = '!\(999\)99999-9999;0;_' - Font.Charset = DEFAULT_CHARSET - Font.Color = clBlack - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - MaxLength = 15 - ParentFont = False - TabOrder = 7 + TabOrder = 8 Visible = False end end @@ -644,13 +575,13 @@ object frmMapaCacic: TfrmMapaCacic Width = 40 Height = 20 BevelWidth = 2 - Caption = 'X' + Caption = 'Close' Color = clRed Enabled = False - Font.Charset = DEFAULT_CHARSET + Font.Charset = ANSI_CHARSET Font.Color = clInfoBk - Font.Height = 20 - Font.Name = 'Arial Black' + Font.Height = -13 + Font.Name = 'Tahoma' Font.Style = [] ParentBackground = False ParentFont = False diff --git a/Mapa/Mapa.pas b/Mapa/Mapa.pas index 52246bb..8ac427a 100644 --- a/Mapa/Mapa.pas +++ b/Mapa/Mapa.pas @@ -85,7 +85,6 @@ type edTeInfoPatrimonio3: TEdit; btCombosUpdate: TButton; edTeInfoPatrimonio2: TEdit; - edTeInfoPatrimonio8: TEdit; edTeInfoPatrimonio9: TEdit; edTeInfoPatrimonio1: TEdit; edTeInfoPatrimonio5: TEdit; @@ -97,9 +96,6 @@ type lbEtiqueta6: TLabel; edTeInfoPatrimonio7: TEdit; btKonamiCode: TPanel; - edTeInfoPatrimonioTel: TMaskEdit; - lbEtiquetaTel: TLabel; - lbEtiqueta8: TLabel; edTeInfoPatrimonio10: TEdit; procedure FormCreate(Sender: TObject); @@ -170,7 +166,7 @@ End; procedure TfrmMapaCacic.Finalizar; Begin Visible := false; - + if FileExists(objCACIC.getLocalFolderName + '\temp\aguarde_MAPACACIC.txt') then objCACIC.deleteFileOrFolder(objCacic.getLocalFolderName + '\temp\aguarde_MAPACACIC.txt'); @@ -401,8 +397,6 @@ if edTeInfoPatrimonio5.text <> '' then '[UserName]' + edTeInfoPatrimonio5.Text + '[/UserName]' + '[Coordenacao_Setor]' + edTeInfoPatrimonio6.Text + '[/Coordenacao_Setor]' + '[Sala]' + edTeInfoPatrimonio7.Text + '[/Sala]' + - '[Tel]' + edTeInfoPatrimonioTel.text + '[/Tel]' + - '[Ramal]' + edTeInfoPatrimonio8.text + '[/Ramal]' + '[ComputerName]' + edTeInfoPatrimonio9.text + '[/ComputerName]' + '[IPComputer]' + edTeInfoPatrimonio10.text + '[/IPComputer]' , ',','[[COMMA]]',[rfReplaceAll]); @@ -553,19 +547,6 @@ Begin edTeInfoPatrimonio7.visible := True; // end; - lbEtiquetaTel.Visible := true; - edTeInfoPatrimonioTel.Hint := objCacic.getValueFromTags('te_help_etiqueta_tel', strConfigsPatrimonioInterface); - edTeInfoPatrimonioTel.Text := strTeInfoPatrimonioTel; - edTeInfoPatrimonioTel.visible := True; - - edTeInfoPatrimonio8.Text := strTeInfoPatrimonio8; - if edTeInfoPatrimonio8.Text <> '' then - begin - lbEtiqueta8.Visible := true; - edTeInfoPatrimonio8.Visible := true; - end; - lbEtiqueta8.Visible := true; - edTeInfoPatrimonio8.Visible := true; //-----------------------NOME DO COMPUTADOR PARA O EDTEXT----------------------- edTeInfoPatrimonio9.Text := NomeComputador; if edTeInfoPatrimonio9.Text <> '' then @@ -729,8 +710,14 @@ begin objCacic.writeDailyLog('SEM PRIVILÉGIOS: Necessário ser administrador "local" ou de Domínio!'); Finalizar; End; - Finally - End; + Except + on E:Exception do + Begin + objCacic.writeExceptionLog(E.Message,e.ClassName + 'Erro ao criar formulario.'); + objCACIC.writeDailyLog('Erro ao criar formulario.'); + Finalizar; + End; //on E:Exception do + end; end; @@ -957,8 +944,6 @@ begin ldap.Timeout := 5000; if ldap.Login and ldap.Bind then //Loga no LDAP e autentica no LDAP com Usuário e senha repassado. (BindSasl é mais seguro que Bind) begin - // 41680200020 - ldap.Search(base, False, identificador+ '=' + strTeInfoPatrimonio2, retorno); //Faz a pesquisa, com o CPF repassado. result := LDAPResultdump(ldap.SearchResult); objCACIC.writeDailyLog('Nome Usuário: Conexão estabelecida, pesquisa realizada.'); @@ -971,8 +956,6 @@ begin Except on E:Exception do Begin - MessageDlg(#13#13+'Problemas para pegar nome do usuário.'+#13#13+ - 'Por favor, digite seu nome no campo solicitado',mtError, [mbOK], 0); objCacic.writeExceptionLog(E.Message,e.ClassName); objCACIC.writeDailyLog('Nome Usuário: Falha ao tentar recuperar o nome.'); End; //on E:Exception do diff --git a/gercols/gercols.dpr b/gercols/gercols.dpr index 78958b0..944f9ed 100644 --- a/gercols/gercols.dpr +++ b/gercols/gercols.dpr @@ -677,8 +677,8 @@ var SubRegistry: TRegistry; saida: String; begin - Registry := TRegistry.Create; - SubRegistry := TRegistry.Create; + Registry := TRegistry.Create(KEY_WOW64_64KEY); + SubRegistry := TRegistry.Create(KEY_WOW64_64KEY); Registry.RootKey := HKEY_LOCAL_MACHINE; if Registry.OpenKeyReadOnly(Key) then begin Try @@ -736,16 +736,22 @@ end; Function SoftwareList: String; var strChave: String; + strChave6432: String; outString: String; + outString6432: String; begin // Esse registro é onde vamos buscar a chave do SO - strChave := '\Software\Microsoft\Windows\CurrentVersion\Uninstall'; - + strChave := '\Software\Microsoft\Windows\CurrentVersion\Uninstall'; + strChave6432 := '\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'; // Passo aqui o registro e a profundidade dos campos que quero ver + outString6432 := DisplayKeys(strChave6432, 3); outString := DisplayKeys(strChave, 3); // objCacic.setValueToFile('collects', 'colsoft_puro', outString, 'c:\Cacic\colsoft.inf'); // Retorno uma string com todas as tags coletadas do registro - Result := outString; + if ((outString <> outString6432) and (outString6432 <> '')) then + Result := outString + outString6432 + else + result := outString; end; // Procedimento que executa a coleta de hardware diff --git a/gercols/gercols.dproj b/gercols/gercols.dproj index ffd9cd0..d6d77fc 100644 --- a/gercols/gercols.dproj +++ b/gercols/gercols.dproj @@ -38,7 +38,7 @@ Delphi.Personality VCLApplication -C:\vendors_lib\JVCL345CompleteJCL231-Build4197\jcl\lib\d7\debugFalseTrueFalseTrueFalse2817FalseFalseFalseFalseFalse10461252Dataprev-Emp. de TI da Prev Social - URES/SESSSistema CACIC - Módulo Gerente de Coletas2.8.1.7Ger_COLS3.0Licença: GNU/LGPLgercols.dpr +C:\vendors_lib\JVCL345CompleteJCL231-Build4197\jcl\lib\d7\debugFalseTrueFalseTrueFalse2818FalseFalseFalseFalseFalse10461252Dataprev-Emp. de TI da Prev Social - URES/SESSSistema CACIC - Módulo Gerente de Coletas2.8.1.8Ger_COLS3.0Licença: GNU/LGPLgercols.dpr diff --git a/gercols/gercols.res b/gercols/gercols.res index c6a9079..1d6f1a9 100644 Binary files a/gercols/gercols.res and b/gercols/gercols.res differ diff --git a/main.dfm b/main.dfm index bdd4480..7a4e486 100755 --- a/main.dfm +++ b/main.dfm @@ -1376,13 +1376,6 @@ object FormularioGeral: TFormularioGeral Spacing = 1 end end - object timerNuIntervalo: TTimer - Enabled = False - Interval = 5000 - OnTimer = timerNuIntervaloTimer - Left = 226 - Top = 570 - end object timerNuExecApos: TTimer Enabled = False Interval = 1 @@ -1755,7 +1748,7 @@ object FormularioGeral: TFormularioGeral 000000000000} end object timerCheckNoMinuto: TTimer - Interval = 60000 + Interval = 600000 OnTimer = timerCheckNoMinutoTimer Left = 36 Top = 566 @@ -1776,4 +1769,10 @@ object FormularioGeral: TFormularioGeral Left = 392 Top = 568 end + object timerNuIntervalo: TTimer + Enabled = False + Interval = 1 + Left = 232 + Top = 568 + end end diff --git a/main.pas b/main.pas index dec55ae..7ef1f44 100755 --- a/main.pas +++ b/main.pas @@ -1,4 +1,4 @@ -(** +(** --------------------------------------------------------------------------------------------------------------------------------------------------------------- Copyright 2000, 2001, 2002, 2003, 2004, 2005 Dataprev - Empresa de Tecnologia e Informa��es da Previd�ncia Social, Brasil @@ -114,7 +114,6 @@ type Pn_Linha4_TCPIP: TPanel; Pn_Linha6_TCPIP: TPanel; Pn_Linha5_TCPIP: TPanel; - timerNuIntervalo: TTimer; timerNuExecApos: TTimer; Popup_Menu_Contexto: TPopupMenu; Mnu_LogAtividades: TMenuItem; @@ -173,6 +172,7 @@ type cn: TSHChangeNotify; imgIconList: TImageList; timerCheckNoMinuto: TTimer; + timerNuIntervalo: TTimer; TrayIcon1: TTrayIcon; ApplicationEvents1: TApplicationEvents; Panel1: TPanel; @@ -1350,7 +1350,6 @@ begin End else objCACIC.writeDailyLog('Não foi possível invocar o Mapa Cacic!'); - End; End; End; end; @@ -2656,7 +2655,7 @@ begin ARect.Left := LEFT_MENU_ITEM; ACanvas.FillRect(ARect); - DrawText(ACanvas.Handle, PChar('Configura��es'), -1, ARect, DT_LEFT or DT_VCENTER or DT_SINGLELINE{ or DT_NOCLIP}); + DrawText(ACanvas.Handle, PChar('Configuracoes'), -1, ARect, DT_LEFT or DT_VCENTER or DT_SINGLELINE{ or DT_NOCLIP}); end; procedure TFormularioGeral.Mnu_ExecutarAgoraDrawItem(Sender: TObject; @@ -2684,7 +2683,7 @@ begin ARect.Left := LEFT_MENU_ITEM; ACanvas.FillRect(ARect); - DrawText(ACanvas.Handle, PChar('Informa��es Gerais'), -1, ARect, DT_LEFT or DT_VCENTER or DT_SINGLELINE{ or DT_NOCLIP}); + DrawText(ACanvas.Handle, PChar('Informacoes Gerais'), -1, ARect, DT_LEFT or DT_VCENTER or DT_SINGLELINE{ or DT_NOCLIP}); end; procedure TFormularioGeral.Mnu_SuporteRemotoDrawItem(Sender: TObject; -- libgit2 0.21.2