Skip to content

Commit

Permalink
Fix to generate correct applications & patches info for windows scann…
Browse files Browse the repository at this point in the history
  • Loading branch information
hsong-rh committed Jul 3, 2018
1 parent 818219e commit d07c496
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/metadata/util/win32/Win32Software.rb
Expand Up @@ -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

Expand Down Expand Up @@ -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|
Expand All @@ -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|
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d07c496

Please sign in to comment.