Commit 013e92c9 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

appwiz.cpl: List 32-bit applications on 64-bit platforms.

parent 178d39cc
...@@ -145,37 +145,26 @@ static void FreeAppInfo(APPINFO *info) ...@@ -145,37 +145,26 @@ static void FreeAppInfo(APPINFO *info)
* Name : ReadApplicationsFromRegistry * Name : ReadApplicationsFromRegistry
* Description: Creates a linked list of uninstallable applications from the * Description: Creates a linked list of uninstallable applications from the
* registry. * registry.
* Parameters : root - Which registry root to read from (HKCU/HKLM) * Parameters : root - Which registry root to read from
* Returns : TRUE if successful, FALSE otherwise * Returns : TRUE if successful, FALSE otherwise
*/ */
static BOOL ReadApplicationsFromRegistry(HKEY root) static BOOL ReadApplicationsFromRegistry(HKEY root)
{ {
HKEY hkeyUninst, hkeyApp; HKEY hkeyApp;
int i, id = 0; int i, id = 0;
DWORD sizeOfSubKeyName, displen, uninstlen; DWORD sizeOfSubKeyName, displen, uninstlen;
DWORD dwNoModify, dwType, value; DWORD dwNoModify, dwType, value;
WCHAR subKeyName[256]; WCHAR subKeyName[256];
WCHAR key_app[MAX_STRING_LEN]; WCHAR *command;
WCHAR *p, *command;
APPINFO *info = NULL; APPINFO *info = NULL;
LPWSTR iconPtr; LPWSTR iconPtr;
BOOL ret = FALSE;
if (RegOpenKeyExW(root, PathUninstallW, 0, KEY_READ, &hkeyUninst) !=
ERROR_SUCCESS)
return FALSE;
lstrcpyW(key_app, PathUninstallW);
lstrcatW(key_app, BackSlashW);
p = key_app+lstrlenW(PathUninstallW)+1;
sizeOfSubKeyName = sizeof(subKeyName) / sizeof(subKeyName[0]); sizeOfSubKeyName = sizeof(subKeyName) / sizeof(subKeyName[0]);
for (i = 0; RegEnumKeyExW(hkeyUninst, i, subKeyName, &sizeOfSubKeyName, NULL, for (i = 0; RegEnumKeyExW(root, i, subKeyName, &sizeOfSubKeyName, NULL,
NULL, NULL, NULL) != ERROR_NO_MORE_ITEMS; ++i) NULL, NULL, NULL) != ERROR_NO_MORE_ITEMS; ++i)
{ {
lstrcpyW(p, subKeyName); RegOpenKeyExW(root, subKeyName, 0, KEY_READ, &hkeyApp);
RegOpenKeyExW(root, key_app, 0, KEY_READ, &hkeyApp);
displen = 0; displen = 0;
uninstlen = 0; uninstlen = 0;
...@@ -313,16 +302,11 @@ static BOOL ReadApplicationsFromRegistry(HKEY root) ...@@ -313,16 +302,11 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
sizeOfSubKeyName = sizeof(subKeyName) / sizeof(subKeyName[0]); sizeOfSubKeyName = sizeof(subKeyName) / sizeof(subKeyName[0]);
} }
ret = TRUE; return TRUE;
goto end;
err: err:
RegCloseKey(hkeyApp); RegCloseKey(hkeyApp);
if (info) FreeAppInfo(info); if (info) FreeAppInfo(info);
return FALSE;
end:
RegCloseKey(hkeyUninst);
return ret;
} }
...@@ -773,7 +757,9 @@ static HIMAGELIST AddListViewImageList(HWND hWnd) ...@@ -773,7 +757,9 @@ static HIMAGELIST AddListViewImageList(HWND hWnd)
*/ */
static HIMAGELIST ResetApplicationList(BOOL bFirstRun, HWND hWnd, HIMAGELIST hImageList) static HIMAGELIST ResetApplicationList(BOOL bFirstRun, HWND hWnd, HIMAGELIST hImageList)
{ {
static const BOOL is_64bit = sizeof(void *) > sizeof(int);
HWND hWndListView; HWND hWndListView;
HKEY hkey;
hWndListView = GetDlgItem(hWnd, IDL_PROGRAMS); hWndListView = GetDlgItem(hWnd, IDL_PROGRAMS);
...@@ -796,8 +782,22 @@ static HIMAGELIST ResetApplicationList(BOOL bFirstRun, HWND hWnd, HIMAGELIST hIm ...@@ -796,8 +782,22 @@ static HIMAGELIST ResetApplicationList(BOOL bFirstRun, HWND hWnd, HIMAGELIST hIm
/* now create the image list and add the applications to the listview */ /* now create the image list and add the applications to the listview */
hImageList = AddListViewImageList(hWndListView); hImageList = AddListViewImageList(hWndListView);
ReadApplicationsFromRegistry(HKEY_LOCAL_MACHINE); if (!RegOpenKeyExW(HKEY_LOCAL_MACHINE, PathUninstallW, 0, KEY_READ, &hkey))
ReadApplicationsFromRegistry(HKEY_CURRENT_USER); {
ReadApplicationsFromRegistry(hkey);
RegCloseKey(hkey);
}
if (is_64bit &&
!RegOpenKeyExW(HKEY_LOCAL_MACHINE, PathUninstallW, 0, KEY_READ|KEY_WOW64_32KEY, &hkey))
{
ReadApplicationsFromRegistry(hkey);
RegCloseKey(hkey);
}
if (!RegOpenKeyExW(HKEY_CURRENT_USER, PathUninstallW, 0, KEY_READ, &hkey))
{
ReadApplicationsFromRegistry(hkey);
RegCloseKey(hkey);
}
AddApplicationsToList(hWndListView, hImageList); AddApplicationsToList(hWndListView, hImageList);
UpdateButtons(hWnd); UpdateButtons(hWnd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment