mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 01:12:06 +00:00
[RAPPS]
* Added constants in resource.h for stringtables * Removed "Installed apps" from the TreeView * Added intallation status to the RichEdit using existing check * Changed IsInstalledApplication signature to accept access righta This is needed for the 64 bit systems. svn path=/branches/GSoC_2017/rapps/; revision=74920
This commit is contained in:
parent
18da595008
commit
8b189b4be3
|
@ -17,6 +17,12 @@
|
|||
InsertRichEditText(b, d); \
|
||||
} \
|
||||
|
||||
#define ADD_TEXT_NEWL(a, b) \
|
||||
LoadStringW(hInst, a, szText, _countof(szText)); \
|
||||
InsertRichEditText(L"\n", 0); \
|
||||
InsertRichEditText(szText, b); \
|
||||
InsertRichEditText(L"\n", 0);
|
||||
|
||||
#define GET_STRING1(a, b) \
|
||||
if (!ParserGetString(a, b, _countof(b), FindFileData.cFileName)) \
|
||||
continue;
|
||||
|
@ -25,6 +31,16 @@
|
|||
if (!ParserGetString(a, b, _countof(b), FindFileData.cFileName)) \
|
||||
b[0] = '\0';
|
||||
|
||||
//App is "installed" if the RegName is in the registry
|
||||
#define APP_INSTALL_CHECK_K(Info, key) \
|
||||
(*Info->szRegName && (IsInstalledApplicationEx(Info->szRegName, FALSE, key) \
|
||||
|| IsInstalledApplicationEx(Info->szRegName, TRUE, key)))
|
||||
|
||||
//Check both registry keys in 64bit system
|
||||
//TODO: check system type beforehand to avoid double checks?
|
||||
#define APP_INSTALL_CHECK(Info) \
|
||||
(APP_INSTALL_CHECK_K(Info, KEY_WOW64_32KEY) || APP_INSTALL_CHECK_K(Info, KEY_WOW64_64KEY))
|
||||
|
||||
LIST_ENTRY CachedEntriesHead = { &CachedEntriesHead, &CachedEntriesHead };
|
||||
PLIST_ENTRY pCachedEntry = &CachedEntriesHead;
|
||||
|
||||
|
@ -37,8 +53,13 @@ ShowAvailableAppInfo(INT Index)
|
|||
if (!Info) return FALSE;
|
||||
|
||||
NewRichEditText(Info->szName, CFE_BOLD);
|
||||
|
||||
InsertRichEditText(L"\n", 0);
|
||||
if (APP_INSTALL_CHECK(Info))
|
||||
{
|
||||
ADD_TEXT_NEWL(IDS_STATUS_INSTALLED, CFE_ITALIC);
|
||||
} else
|
||||
{
|
||||
ADD_TEXT_NEWL(IDS_STATUS_NOTINSTALLED, CFE_ITALIC);
|
||||
}
|
||||
|
||||
ADD_TEXT(IDS_AINFO_VERSION, Info->szVersion, CFE_BOLD, 0);
|
||||
ADD_TEXT(IDS_AINFO_LICENSE, Info->szLicense, CFE_BOLD, 0);
|
||||
|
|
|
@ -90,7 +90,6 @@ public:
|
|||
return m_hWnd;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual VOID OnLink(ENLINK *Link)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -372,33 +372,28 @@ private:
|
|||
|
||||
VOID InitCategoriesList(VOID)
|
||||
{
|
||||
HTREEITEM hRootItem1, hRootItem2;
|
||||
HTREEITEM hRootItem;
|
||||
|
||||
hRootItem1 = AddCategory(TVI_ROOT, IDS_INSTALLED, IDI_CATEGORY);
|
||||
AddCategory(hRootItem1, IDS_APPLICATIONS, IDI_APPS);
|
||||
AddCategory(hRootItem1, IDS_UPDATES, IDI_APPUPD);
|
||||
|
||||
hRootItem2 = AddCategory(TVI_ROOT, IDS_AVAILABLEFORINST, IDI_CATEGORY);
|
||||
AddCategory(hRootItem2, IDS_CAT_AUDIO, IDI_CAT_AUDIO);
|
||||
AddCategory(hRootItem2, IDS_CAT_VIDEO, IDI_CAT_VIDEO);
|
||||
AddCategory(hRootItem2, IDS_CAT_GRAPHICS, IDI_CAT_GRAPHICS);
|
||||
AddCategory(hRootItem2, IDS_CAT_GAMES, IDI_CAT_GAMES);
|
||||
AddCategory(hRootItem2, IDS_CAT_INTERNET, IDI_CAT_INTERNET);
|
||||
AddCategory(hRootItem2, IDS_CAT_OFFICE, IDI_CAT_OFFICE);
|
||||
AddCategory(hRootItem2, IDS_CAT_DEVEL, IDI_CAT_DEVEL);
|
||||
AddCategory(hRootItem2, IDS_CAT_EDU, IDI_CAT_EDU);
|
||||
AddCategory(hRootItem2, IDS_CAT_ENGINEER, IDI_CAT_ENGINEER);
|
||||
AddCategory(hRootItem2, IDS_CAT_FINANCE, IDI_CAT_FINANCE);
|
||||
AddCategory(hRootItem2, IDS_CAT_SCIENCE, IDI_CAT_SCIENCE);
|
||||
AddCategory(hRootItem2, IDS_CAT_TOOLS, IDI_CAT_TOOLS);
|
||||
AddCategory(hRootItem2, IDS_CAT_DRIVERS, IDI_CAT_DRIVERS);
|
||||
AddCategory(hRootItem2, IDS_CAT_LIBS, IDI_CAT_LIBS);
|
||||
AddCategory(hRootItem2, IDS_CAT_OTHER, IDI_CAT_OTHER);
|
||||
hRootItem = AddCategory(TVI_ROOT, IDS_AVAILABLEFORINST, IDI_CATEGORY);
|
||||
AddCategory(hRootItem, IDS_CAT_AUDIO, IDI_CAT_AUDIO);
|
||||
AddCategory(hRootItem, IDS_CAT_VIDEO, IDI_CAT_VIDEO);
|
||||
AddCategory(hRootItem, IDS_CAT_GRAPHICS, IDI_CAT_GRAPHICS);
|
||||
AddCategory(hRootItem, IDS_CAT_GAMES, IDI_CAT_GAMES);
|
||||
AddCategory(hRootItem, IDS_CAT_INTERNET, IDI_CAT_INTERNET);
|
||||
AddCategory(hRootItem, IDS_CAT_OFFICE, IDI_CAT_OFFICE);
|
||||
AddCategory(hRootItem, IDS_CAT_DEVEL, IDI_CAT_DEVEL);
|
||||
AddCategory(hRootItem, IDS_CAT_EDU, IDI_CAT_EDU);
|
||||
AddCategory(hRootItem, IDS_CAT_ENGINEER, IDI_CAT_ENGINEER);
|
||||
AddCategory(hRootItem, IDS_CAT_FINANCE, IDI_CAT_FINANCE);
|
||||
AddCategory(hRootItem, IDS_CAT_SCIENCE, IDI_CAT_SCIENCE);
|
||||
AddCategory(hRootItem, IDS_CAT_TOOLS, IDI_CAT_TOOLS);
|
||||
AddCategory(hRootItem, IDS_CAT_DRIVERS, IDI_CAT_DRIVERS);
|
||||
AddCategory(hRootItem, IDS_CAT_LIBS, IDI_CAT_LIBS);
|
||||
AddCategory(hRootItem, IDS_CAT_OTHER, IDI_CAT_OTHER);
|
||||
|
||||
m_TreeView->SetImageList(hImageTreeView, TVSIL_NORMAL);
|
||||
m_TreeView->Expand(hRootItem2, TVE_EXPAND);
|
||||
m_TreeView->Expand(hRootItem1, TVE_EXPAND);
|
||||
m_TreeView->SelectItem(hRootItem1);
|
||||
m_TreeView->Expand(hRootItem, TVE_EXPAND);
|
||||
m_TreeView->SelectItem(hRootItem);
|
||||
}
|
||||
|
||||
BOOL CreateStatusBar()
|
||||
|
@ -1138,17 +1133,10 @@ private:
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Only add a ListView entry if...
|
||||
- no RegName was supplied (so we cannot determine whether the application is installed or not) or
|
||||
- a RegName was supplied and the application is not installed
|
||||
*/
|
||||
if (!*Info->szRegName || (!IsInstalledApplication(Info->szRegName, FALSE) && !IsInstalledApplication(Info->szRegName, TRUE)))
|
||||
{
|
||||
Index = ListViewAddItem(Info->Category, 0, Info->szName, (LPARAM) Info);
|
||||
Index = ListViewAddItem(Info->Category, 0, Info->szName, (LPARAM) Info);
|
||||
|
||||
ListView_SetItemText(hListView, Index, 1, Info->szVersion);
|
||||
ListView_SetItemText(hListView, Index, 2, Info->szDesc);
|
||||
}
|
||||
ListView_SetItemText(hListView, Index, 1, Info->szVersion);
|
||||
ListView_SetItemText(hListView, Index, 2, Info->szDesc);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1183,14 +1171,15 @@ private:
|
|||
|
||||
ImageList_AddIcon(hImageListView, hIcon);
|
||||
DestroyIcon(hIcon);
|
||||
|
||||
/*
|
||||
if (IS_INSTALLED_ENUM(EnumType))
|
||||
{
|
||||
/* Enum installed applications and updates */
|
||||
/ Enum installed applications and updates
|
||||
EnumInstalledApplications(EnumType, TRUE, s_EnumInstalledAppProc);
|
||||
EnumInstalledApplications(EnumType, FALSE, s_EnumInstalledAppProc);
|
||||
}
|
||||
else if (IS_AVAILABLE_ENUM(EnumType))
|
||||
|
||||
else */if (IS_AVAILABLE_ENUM(EnumType))
|
||||
{
|
||||
/* Enum available applications */
|
||||
EnumAvailableApplications(EnumType, s_EnumAvailableAppProc);
|
||||
|
|
|
@ -28,9 +28,8 @@ GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR lpString)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey)
|
||||
IsInstalledApplicationEx(LPWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow)
|
||||
{
|
||||
DWORD dwSize = MAX_PATH, dwType;
|
||||
WCHAR szName[MAX_PATH];
|
||||
|
@ -38,8 +37,8 @@ IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey)
|
|||
HKEY hKey, hSubKey;
|
||||
INT ItemIndex = 0;
|
||||
|
||||
if (RegOpenKeyW(IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
|
||||
L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
|
||||
if (RegOpenKeyExW(IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
|
||||
L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall", 0, keyWow | KEY_ENUMERATE_SUB_KEYS,
|
||||
&hKey) != ERROR_SUCCESS)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -47,8 +46,9 @@ IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey)
|
|||
|
||||
while (RegEnumKeyExW(hKey, ItemIndex, szName, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
if (RegOpenKeyW(hKey, szName, &hSubKey) == ERROR_SUCCESS)
|
||||
if (RegOpenKeyExW(hKey, szName, 0, keyWow | KEY_READ, &hSubKey) == ERROR_SUCCESS)
|
||||
{
|
||||
|
||||
dwType = REG_SZ;
|
||||
dwSize = sizeof(szDisplayName);
|
||||
if (RegQueryValueExW(hSubKey,
|
||||
|
@ -63,15 +63,13 @@ IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey)
|
|||
RegCloseKey(hSubKey);
|
||||
RegCloseKey(hKey);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RegCloseKey(hSubKey);
|
||||
dwSize = MAX_PATH;
|
||||
ItemIndex++;
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumP
|
|||
BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR lpString);
|
||||
BOOL ShowInstalledAppInfo(INT Index);
|
||||
BOOL UninstallApplication(INT Index, BOOL bModify);
|
||||
BOOL IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey);
|
||||
BOOL IsInstalledApplicationEx(LPWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow);
|
||||
VOID RemoveAppFromRegistry(INT Index);
|
||||
|
||||
/* winmain.c */
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
#define IDS_TOOLTIP_SETTINGS 203
|
||||
#define IDS_TOOLTIP_REFRESH 204
|
||||
#define IDS_TOOLTIP_EXIT 205
|
||||
#define IDS_TOOLTIP_UPDATE_DB 206
|
||||
#define IDS_TOOLTIP_UPDATE_DB 206
|
||||
|
||||
/* Columns info */
|
||||
#define IDS_APP_NAME 250
|
||||
|
@ -162,6 +162,15 @@
|
|||
#define IDS_CAT_TOOLS 713
|
||||
#define IDS_CAT_VIDEO 714
|
||||
|
||||
/* App installation status */
|
||||
#define IDS_STATUS_INSTALLED 800
|
||||
#define IDS_STATUS_NOTINSTALLED 801
|
||||
#define IDS_STATUS_DOWNLOADED 802
|
||||
#define IDS_STATUS_UPDATE_AVAILABLE 803
|
||||
#define IDS_STATUS_DOWNLOADING 804
|
||||
#define IDS_STATUS_INSTALLING 805
|
||||
|
||||
|
||||
/* Accelerators */
|
||||
#define HOTKEYS 715
|
||||
|
||||
|
|
Loading…
Reference in a new issue