Vinzenz Feenstra has uploaded a new change for review.

Change subject: win32: Also report 64-Bit applications Win-x64
......................................................................

win32: Also report 64-Bit applications Win-x64

Up until now we did not report entries from the 64-Bit view of the
registry. This commit reports those entries and also deduplicates the
entries.

Change-Id: I99e08710257331f5dce36ca64653de6f88139592
Bug-Url: https://bugzilla.redhat.com/1105056
Signed-off-by: Vinzenz Feenstra <[email protected]>
---
M ovirt-guest-agent/GuestAgentWin32.py
1 file changed, 22 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-guest-agent 
refs/changes/48/28548/1

diff --git a/ovirt-guest-agent/GuestAgentWin32.py 
b/ovirt-guest-agent/GuestAgentWin32.py
index 016c8d9..910c910 100644
--- a/ovirt-guest-agent/GuestAgentWin32.py
+++ b/ovirt-guest-agent/GuestAgentWin32.py
@@ -330,23 +330,29 @@
         return False
 
     def getApplications(self):
-        retval = []
+        retval = set()
+        # Constants according to
+        # http://msdn.microsoft.com/en-us/library/windows/desktop/ms724878.aspx
+        KEY_WOW64_32KEY = 0x0100
+        KEY_WOW64_64KEY = 0x0200
         key_path = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
-        rootkey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, key_path)
-        items = _winreg.QueryInfoKey(rootkey)[0]
-        for idx in range(items):
-            cur_key_path = _winreg.EnumKey(rootkey, idx)
-            cur_key = _winreg.OpenKey(rootkey, cur_key_path)
-            try:
-                if self._is_item_update(cur_key):
-                    continue
-                display_name = QueryStringValue(cur_key, u'DisplayName')
-                if len(display_name) == 0:
-                    continue
-                retval.append(display_name)
-            except:
-                pass
-        return retval
+        for view_flag in (KEY_WOW64_32KEY, KEY_WOW64_64KEY):
+            rootkey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, key_path,
+                                      view_flag | _winreg.KEY_READ)
+            items = _winreg.QueryInfoKey(rootkey)[0]
+            for idx in range(items):
+                cur_key_path = _winreg.EnumKey(rootkey, idx)
+                cur_key = _winreg.OpenKey(rootkey, cur_key_path)
+                try:
+                    if self._is_item_update(cur_key):
+                        continue
+                    display_name = QueryStringValue(cur_key, u'DisplayName')
+                    if len(display_name) == 0:
+                        continue
+                    retval.add(display_name)
+                except:
+                    pass
+        return list(retval)
 
     def getAvailableRAM(self):
         # Returns the available physical memory (including the system cache).


-- 
To view, visit http://gerrit.ovirt.org/28548
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99e08710257331f5dce36ca64653de6f88139592
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-guest-agent
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to