From d07c496b4019d1c71ba6c7bfbbbe3dafbeef983b Mon Sep 17 00:00:00 2001 From: hsong-rh Date: Tue, 3 Jul 2018 16:06:43 -0400 Subject: [PATCH] Fix to generate correct applications & patches info for windows scanning. https://bugzilla.redhat.com/show_bug.cgi?id=1597363 --- lib/metadata/util/win32/Win32Software.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/metadata/util/win32/Win32Software.rb b/lib/metadata/util/win32/Win32Software.rb index d057976c..0d1e1983 100644 --- a/lib/metadata/util/win32/Win32Software.rb +++ b/lib/metadata/util/win32/Win32Software.rb @@ -52,12 +52,13 @@ class Software ] def initialize(_c, fs) - @patches = @applications = [] - @patch_install_dates = @product_keys = {} + @patches = [] + @applications = [] + @patch_install_dates = {} + @product_keys = {} reg_doc = initialize_registry_doc(fs) - - registry_applications(reg_doc) + registry_applications(reg_doc, fs) registry_patches(reg_doc) end @@ -96,13 +97,13 @@ def initialize_registry_doc(fs) reg_doc end - def registry_applications(registry_doc) + def registry_applications(registry_doc, fs) # Get the applications reg_node = MIQRexml.findRegElement("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData", registry_doc.root) registry_applications_user_data(reg_node) if reg_node ["HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\App Paths", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths"].each do |reg_path| - registry_applications_app_paths(registry_doc, reg_path) + registry_applications_app_paths(registry_doc, reg_path, fs) end ["HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"].each do |reg_path| @@ -124,7 +125,7 @@ def registry_applications_user_data(reg_node) end end - def registry_applications_app_paths(registry_doc, registry_path) + def registry_applications_app_paths(registry_doc, registry_path, fs) return unless (reg_node = MIQRexml.findRegElement(registry_path, registry_doc.root)) postProcessApps(reg_node, fs) reg_node.each_element_with_attribute(:keyname) do |e| @@ -179,7 +180,7 @@ def registry_patches_packages(hotfix, element) return if element.attributes.nil? || element.attributes[:keyname].nil? if element.attributes[:keyname][0, 8] == 'Package_' # don't add this package if the ID is nil - return if (hotfix_id = hotfix_id(e)).nil? + return if (hotfix_id = hotfix_id(element)).nil? hotfix[hotfix_id] ||= begin