mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 11:46:50 +00:00
- Fix problem with uTorrent deinstallation
- Closing of keys at list updating svn path=/trunk/; revision=42946
This commit is contained in:
parent
e7f2c45f58
commit
d3bda8e821
3 changed files with 27 additions and 8 deletions
|
@ -31,7 +31,7 @@ GetApplicationString(HKEY hKey, LPWSTR lpKeyName, LPWSTR lpString)
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
IsInstalledApplication(LPWSTR lpRegName)
|
IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey)
|
||||||
{
|
{
|
||||||
DWORD dwSize = MAX_PATH, dwType;
|
DWORD dwSize = MAX_PATH, dwType;
|
||||||
WCHAR szName[MAX_PATH];
|
WCHAR szName[MAX_PATH];
|
||||||
|
@ -39,7 +39,7 @@ IsInstalledApplication(LPWSTR lpRegName)
|
||||||
HKEY hKey, hSubKey;
|
HKEY hKey, hSubKey;
|
||||||
INT ItemIndex = 0;
|
INT ItemIndex = 0;
|
||||||
|
|
||||||
if (RegOpenKeyW(HKEY_LOCAL_MACHINE,
|
if (RegOpenKeyW(IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
|
||||||
L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
|
L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
|
||||||
&hKey) != ERROR_SUCCESS)
|
&hKey) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -247,7 +247,6 @@ EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc)
|
||||||
ItemIndex++;
|
ItemIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey(hSubKey);
|
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -80,7 +80,7 @@ BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumP
|
||||||
BOOL GetApplicationString(HKEY hKey, LPWSTR lpKeyName, LPWSTR lpString);
|
BOOL GetApplicationString(HKEY hKey, LPWSTR lpKeyName, LPWSTR lpString);
|
||||||
BOOL ShowInstalledAppInfo(INT Index);
|
BOOL ShowInstalledAppInfo(INT Index);
|
||||||
BOOL UninstallApplication(INT Index, BOOL bModify);
|
BOOL UninstallApplication(INT Index, BOOL bModify);
|
||||||
BOOL IsInstalledApplication(LPWSTR lpRegName);
|
BOOL IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey);
|
||||||
|
|
||||||
/* winmain.c */
|
/* winmain.c */
|
||||||
extern HWND hMainWnd;
|
extern HWND hMainWnd;
|
||||||
|
|
|
@ -15,6 +15,21 @@ HIMAGELIST hImageTreeView = NULL;
|
||||||
INT SelectedEnumType = ENUM_ALL_COMPONENTS;
|
INT SelectedEnumType = ENUM_ALL_COMPONENTS;
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FreeInstalledAppList(VOID)
|
||||||
|
{
|
||||||
|
INT Count = ListView_GetItemCount(hListView) - 1;
|
||||||
|
HKEY hKey;
|
||||||
|
|
||||||
|
while (Count >= 0)
|
||||||
|
{
|
||||||
|
hKey = ListViewGetlParam(Count);
|
||||||
|
if (hKey)
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
Count--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CALLBACK
|
CALLBACK
|
||||||
EnumInstalledAppProc(INT ItemIndex, LPWSTR lpName, LPWSTR lpKeyName, LPARAM lParam)
|
EnumInstalledAppProc(INT ItemIndex, LPWSTR lpName, LPWSTR lpKeyName, LPARAM lParam)
|
||||||
|
@ -56,7 +71,8 @@ EnumAvailableAppProc(APPLICATION_INFO Info)
|
||||||
PAPPLICATION_INFO ItemInfo;
|
PAPPLICATION_INFO ItemInfo;
|
||||||
INT Index;
|
INT Index;
|
||||||
|
|
||||||
if (!IsInstalledApplication(Info.szRegName))
|
if (!IsInstalledApplication(Info.szRegName, FALSE) &&
|
||||||
|
!IsInstalledApplication(Info.szRegName, TRUE))
|
||||||
{
|
{
|
||||||
ItemInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(APPLICATION_INFO));
|
ItemInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(APPLICATION_INFO));
|
||||||
if (!ItemInfo) return FALSE;
|
if (!ItemInfo) return FALSE;
|
||||||
|
@ -98,6 +114,11 @@ UpdateApplicationsList(INT EnumType)
|
||||||
|
|
||||||
if (EnumType == -1) EnumType = SelectedEnumType;
|
if (EnumType == -1) EnumType = SelectedEnumType;
|
||||||
|
|
||||||
|
if (IS_INSTALLED_ENUM(SelectedEnumType))
|
||||||
|
FreeInstalledAppList();
|
||||||
|
else if (IS_AVAILABLE_ENUM(SelectedEnumType))
|
||||||
|
FreeAvailableAppList();
|
||||||
|
|
||||||
if (IS_INSTALLED_ENUM(EnumType))
|
if (IS_INSTALLED_ENUM(EnumType))
|
||||||
{
|
{
|
||||||
/* Enum installed applications and updates */
|
/* Enum installed applications and updates */
|
||||||
|
@ -106,9 +127,6 @@ UpdateApplicationsList(INT EnumType)
|
||||||
}
|
}
|
||||||
else if (IS_AVAILABLE_ENUM(EnumType))
|
else if (IS_AVAILABLE_ENUM(EnumType))
|
||||||
{
|
{
|
||||||
if (IS_AVAILABLE_ENUM(SelectedEnumType))
|
|
||||||
FreeAvailableAppList();
|
|
||||||
|
|
||||||
/* Enum availabled applications */
|
/* Enum availabled applications */
|
||||||
EnumAvailableApplications(EnumType, EnumAvailableAppProc);
|
EnumAvailableApplications(EnumType, EnumAvailableAppProc);
|
||||||
}
|
}
|
||||||
|
@ -608,6 +626,8 @@ MainWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (IS_AVAILABLE_ENUM(SelectedEnumType))
|
if (IS_AVAILABLE_ENUM(SelectedEnumType))
|
||||||
FreeAvailableAppList();
|
FreeAvailableAppList();
|
||||||
|
if (IS_INSTALLED_ENUM(SelectedEnumType))
|
||||||
|
FreeInstalledAppList();
|
||||||
if (hImageListView) ImageList_Destroy(hImageListView);
|
if (hImageListView) ImageList_Destroy(hImageListView);
|
||||||
if (hImageTreeView) ImageList_Destroy(hImageTreeView);
|
if (hImageTreeView) ImageList_Destroy(hImageTreeView);
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue