include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/cryptlib)
+include_directories(include)
list(APPEND SOURCE
aboutdlg.cpp
misc.cpp
settingsdlg.cpp
winmain.cpp
- rapps.h)
+ include/rapps.h
+)
add_definitions(-DUSE_CERT_PINNING)
file(GLOB_RECURSE rapps_rc_deps res/*.*)
set_module_type(rapps win32gui UNICODE)
target_link_libraries(rapps atlnew uuid wine)
add_importlibs(rapps advapi32 comctl32 gdi32 wininet user32 shell32 shlwapi ole32 msvcrt kernel32 ntdll)
-add_pch(rapps rapps.h SOURCE)
+add_pch(rapps include/rapps.h SOURCE)
add_dependencies(rapps rappsmsg)
add_message_headers(ANSI rappsmsg.mc)
add_cd_file(TARGET rapps DESTINATION reactos/system32 FOR all)
* PURPOSE: About Dialog
* PROGRAMMERS: Dmitry Chapyshev (dmitry@reactos.org)
*/
-
-#include "rapps.h"
+#include "defines.h"
static
INT_PTR CALLBACK
VOID
ShowAboutDialog(VOID)
{
- DialogBox(hInst,
- MAKEINTRESOURCE(IDD_ABOUT_DIALOG),
+ DialogBoxW(hInst,
+ MAKEINTRESOURCEW(IDD_ABOUT_DIALOG),
hMainWnd,
AboutDlgProc);
}
* Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
* Alexander Shaposhnikov (chaez.san@gmail.com)
*/
+#include "defines.h"
-#include "rapps.h"
+#include "available.h"
+#include "misc.h"
+#include "dialogs.h"
+
+#include <atlcoll.h>
+#include <atlsimpcoll.h>
+#include <atlstr.h>
// CAvailableApplicationInfo
CAvailableApplicationInfo::CAvailableApplicationInfo(const ATL::CStringW& sFileNameParam)
}
}
+// Lazily load general info from the file
VOID CAvailableApplicationInfo::RetrieveGeneralInfo()
{
Category = m_Parser.GetInt(L"Category");
return (UINT) (result <= 0) ? 0 : result;
}
-// CConfigParser
\ No newline at end of file
+// CConfigParser
* AUTHORS: David Quintana <gigaherz@gmail.com>
* Alexander Shaposhnikov <chaez.san@gmail.com>
*/
+#include "defines.h"
#include "rapps.h"
+#include "rosui.h"
+#include "crichedit.h"
#include <shlobj_undoc.h>
#include <shlguid_undoc.h>
#include <atlwin.h>
#include <wininet.h>
#include <shellutils.h>
-
#include <rosctrls.h>
-#include "rosui.h"
-#include "crichedit.h"
-
#define SEARCH_TIMER_ID 'SR'
+#define LISTVIEW_ICON_SIZE 24
+#define TREEVIEW_ICON_SIZE 24
HWND hListView = NULL;
+INT
+GetSystemColorDepth(VOID)
+{
+ DEVMODEW pDevMode;
+ INT ColorDepth;
+
+ pDevMode.dmSize = sizeof(pDevMode);
+ pDevMode.dmDriverExtra = 0;
+
+ if (!EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &pDevMode))
+ {
+ /* TODO: Error message */
+ return ILC_COLOR;
+ }
+
+ switch (pDevMode.dmBitsPerPel)
+ {
+ case 32: ColorDepth = ILC_COLOR32; break;
+ case 24: ColorDepth = ILC_COLOR24; break;
+ case 16: ColorDepth = ILC_COLOR16; break;
+ case 8: ColorDepth = ILC_COLOR8; break;
+ case 4: ColorDepth = ILC_COLOR4; break;
+ default: ColorDepth = ILC_COLOR; break;
+ }
+
+ return ColorDepth;
+}
+
class CAvailableAppView
{
static inline VOID InsertTextAfterLoaded_RichEdit(UINT uStringID,
--- /dev/null
+#pragma once
+#include <windef.h>
+#include <atlstr.h>
+#include <atlsimpcoll.h>
+#include <atlcoll.h>
+
+/* EnumType flags for EnumAvailableApplications */
+#define ENUM_ALL_AVAILABLE 0
+#define ENUM_CAT_AUDIO 1
+#define ENUM_CAT_VIDEO 2
+#define ENUM_CAT_GRAPHICS 3
+#define ENUM_CAT_GAMES 4
+#define ENUM_CAT_INTERNET 5
+#define ENUM_CAT_OFFICE 6
+#define ENUM_CAT_DEVEL 7
+#define ENUM_CAT_EDU 8
+#define ENUM_CAT_ENGINEER 9
+#define ENUM_CAT_FINANCE 10
+#define ENUM_CAT_SCIENCE 11
+#define ENUM_CAT_TOOLS 12
+#define ENUM_CAT_DRIVERS 13
+#define ENUM_CAT_LIBS 14
+#define ENUM_CAT_OTHER 15
+
+#define ENUM_AVAILABLE_MIN ENUM_ALL_AVAILABLE
+#define ENUM_AVAILABLE_MAX ENUM_CAT_OTHER
+
+#define IS_AVAILABLE_ENUM(a) (a >= ENUM_AVAILABLE_MIN && a <= ENUM_AVAILABLE_MAX)
+
+typedef enum
+{
+ None,
+ OpenSource,
+ Freeware,
+ Trial,
+ Max = Trial,
+ Min = None
+} LICENSE_TYPE, *PLICENSE_TYPE;
+
+class CConfigParser
+{
+ // Locale names cache
+ const static INT m_cchLocaleSize = 5;
+
+ static ATL::CStringW m_szLocaleID;
+ static ATL::CStringW m_szCachedINISectionLocale;
+ static ATL::CStringW m_szCachedINISectionLocaleNeutral;
+
+ const LPCWSTR STR_VERSION_CURRENT = L"CURRENT";
+ const ATL::CStringW szConfigPath;
+
+ static ATL::CStringW GetINIFullPath(const ATL::CStringW& FileName);
+ static VOID CacheINILocaleLazy();
+
+public:
+ static const ATL::CStringW& GetLocale();
+ static INT CConfigParser::GetLocaleSize();
+
+ CConfigParser(const ATL::CStringW& FileName);
+
+ UINT GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString);
+ UINT GetInt(const ATL::CStringW& KeyName);
+};
+
+typedef struct
+{
+ INT Category;
+ LICENSE_TYPE LicenseType;
+ ATL::CStringW szName;
+ ATL::CStringW szRegName;
+ ATL::CStringW szVersion;
+ ATL::CStringW szLicense;
+ ATL::CStringW szDesc;
+ ATL::CStringW szSize;
+ ATL::CStringW szUrlSite;
+ ATL::CStringW szUrlDownload;
+ ATL::CStringW szCDPath;
+ ATL::CSimpleArray<LCID> Languages;
+
+ // Caching mechanism related entries
+ ATL::CStringW sFileName;
+ FILETIME ftCacheStamp;
+
+ // Optional integrity checks (SHA-1 digests are 160 bit = 40 characters in hex string form)
+ ATL::CStringW szSHA1;
+
+} APPLICATION_INFO, *PAPPLICATION_INFO;
+
+extern ATL::CAtlList<PAPPLICATION_INFO> InfoList;
+
+typedef BOOL(CALLBACK *AVAILENUMPROC)(PAPPLICATION_INFO Info, LPCWSTR szFolderPath);
+
+struct CAvailableApplicationInfo : public APPLICATION_INFO
+{
+ ATL::CStringW szInstalledVersion;
+ CAvailableApplicationInfo(const ATL::CStringW& sFileNameParam);
+
+ // Load all info from the file
+ VOID RefreshAppInfo();
+ BOOL HasLanguageInfo() const;
+ BOOL HasNativeLanguage() const;
+ BOOL HasEnglishLanguage() const;
+ BOOL IsInstalled() const;
+ BOOL HasInstalledVersion() const;
+ BOOL HasUpdate() const;
+
+ // Set a timestamp
+ VOID SetLastWriteTime(FILETIME* ftTime);
+
+private:
+ BOOL m_IsInstalled = FALSE;
+ BOOL m_HasLanguageInfo = FALSE;
+ BOOL m_HasInstalledVersion = FALSE;
+ CConfigParser m_Parser;
+
+ inline BOOL GetString(LPCWSTR lpKeyName,
+ ATL::CStringW& ReturnedString);
+
+ // Lazily load general info from the file
+ VOID RetrieveGeneralInfo();
+ VOID RetrieveInstalledStatus();
+ VOID RetrieveInstalledVersion();
+ VOID RetrieveLanguages();
+ VOID RetrieveLicenseType();
+ inline BOOL FindInLanguages(LCID what) const;
+};
+
+class CAvailableApps
+{
+ ATL::CAtlList<CAvailableApplicationInfo*> m_InfoList;
+ ATL::CStringW m_szPath;
+ ATL::CStringW m_szCabPath;
+ ATL::CStringW m_szAppsPath;
+ ATL::CStringW m_szSearchPath;
+
+public:
+ CAvailableApps();
+ VOID FreeCachedEntries();
+ BOOL DeleteCurrentAppsDB();
+ BOOL UpdateAppsDB();
+ BOOL EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc);
+ const ATL::CStringW& GetFolderPath();
+ const ATL::CStringW& GetAppPath();
+ const ATL::CStringW& GetCabPath();
+ const LPCWSTR GetFolderPathString();
+ const LPCWSTR GetAppPathString();
+ const LPCWSTR GetCabPathString();
+};
\ No newline at end of file
#pragma once
+#include <rosctrls.h>
class CRichEdit :
public CWindow
--- /dev/null
+#pragma once
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+#define COBJMACROS
+#include <tchar.h>
+#include <stdarg.h>
+
+#include <windef.h>
+#include <winbase.h>
+#include <winreg.h>
+#include <wingdi.h>
+#include <winnls.h>
+#include <winuser.h>
+#include <wincon.h>
+#include <richedit.h>
+#include <shellapi.h>
+#include <shlobj.h>
+#include <shlwapi.h>
+#include <stdio.h>
+#include <strsafe.h>
+#include <ndk/rtlfuncs.h>
+#include <atlcoll.h>
+#include <atlsimpcoll.h>
+#include <atlstr.h>
+#include <rappsmsg.h>
+
+#include "resource.h"
+#include "winmain.h"
+
+#define APPLICATION_DATABASE_URL L"https://svn.reactos.org/packages/rappmgr.cab"
+#define MAX_STR_LEN 256
+#define ENUM_ALL_COMPONENTS 30
\ No newline at end of file
--- /dev/null
+#pragma once
+
+#include "available.h"
+
+#include <windef.h>
+#include <atlsimpcoll.h>
+
+// Download dialog (loaddlg.cpp)
+class CDowloadingAppsListView;
+
+class CDownloadManager
+{
+ static PAPPLICATION_INFO AppInfo;
+ static ATL::CSimpleArray<PAPPLICATION_INFO> AppsToInstallList;
+ static CDowloadingAppsListView DownloadsListView;
+ static INT iCurrentApp;
+
+public:
+ static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK DownloadProgressProc(HWND hWnd,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam,
+ UINT_PTR uIdSubclass,
+ DWORD_PTR dwRefData);
+
+ static DWORD WINAPI ThreadFunc(LPVOID Context);
+ static BOOL DownloadListOfApplications(const ATL::CSimpleArray<PAPPLICATION_INFO>& AppsList);
+ static BOOL DownloadApplication(PAPPLICATION_INFO pAppInfo);
+ static VOID DownloadApplicationsDB(LPCWSTR lpUrl);
+ static VOID LaunchDownloadDialog();
+};
+
+// Settings dialog (settingsdlg.cpp)
+VOID CreateSettingsDlg(HWND hwnd);
+
+// About dialog (aboutdlg.cpp)
+VOID ShowAboutDialog(VOID);
+
+// Installation dialog (installdlg.cpp)
+//BOOL InstallApplication(INT Index);
\ No newline at end of file
--- /dev/null
+#pragma once
+#include <windef.h>
+#include <atlstr.h>
+
+class CAvailableApps;
+
+HWND CreateMainWindow();
+DWORD_PTR ListViewGetlParam(INT item);
+INT ListViewAddItem(INT ItemIndex, INT IconIndex, LPWSTR lpName, LPARAM lParam);
+VOID SetStatusBarText(LPCWSTR szText);
+VOID NewRichEditText(LPCWSTR szText, DWORD flags);
+VOID InsertRichEditText(LPCWSTR szText, DWORD flags);
+
+VOID SetStatusBarText(const ATL::CStringW& szText);
+INT ListViewAddItem(INT ItemIndex, INT IconIndex, ATL::CStringW & Name, LPARAM lParam);
+VOID NewRichEditText(const ATL::CStringW& szText, DWORD flags);
+VOID InsertRichEditText(const ATL::CStringW& szText, DWORD flags);
+CAvailableApps * GetAvailableApps();
+extern HWND hListView;
+extern ATL::CStringW szSearchPattern;
\ No newline at end of file
--- /dev/null
+#pragma once
+
+#include <windef.h>
+#include <atlstr.h>
+
+#define ENUM_APPLICATIONS 31
+#define ENUM_UPDATES 32
+
+#define ENUM_INSTALLED_MIN ENUM_ALL_COMPONENTS
+#define ENUM_INSTALLED_MAX ENUM_UPDATES
+
+#define IS_INSTALLED_ENUM(a) (a >= ENUM_INSTALLED_MIN && a <= ENUM_INSTALLED_MAX)
+
+struct INSTALLED_INFO
+{
+ HKEY hRootKey;
+ HKEY hSubKey;
+ ATL::CStringW szKeyName;
+};
+typedef INSTALLED_INFO *PINSTALLED_INFO;
+typedef BOOL(CALLBACK *APPENUMPROC)(INT ItemIndex, ATL::CStringW &Name, PINSTALLED_INFO Info);
+
+BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc);
+BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString);
+BOOL GetApplicationString(HKEY hKey, LPCWSTR RegName, ATL::CStringW &String);
+
+BOOL ShowInstalledAppInfo(INT Index);
+BOOL UninstallApplication(INT Index, BOOL bModify);
+VOID RemoveAppFromRegistry(INT Index);
--- /dev/null
+#pragma once
+
+#include <windef.h>
+#include <atlstr.h>
+
+int GetWindowWidth(HWND hwnd);
+int GetWindowHeight(HWND hwnd);
+int GetClientWindowWidth(HWND hwnd);
+int GetClientWindowHeight(HWND hwnd);
+
+VOID CopyTextToClipboard(LPCWSTR lpszText);
+VOID SetWelcomeText(VOID);
+VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem);
+BOOL StartProcess(ATL::CStringW &Path, BOOL Wait);
+BOOL StartProcess(LPWSTR lpPath, BOOL Wait);
+BOOL GetStorageDirectory(ATL::CStringW &lpDirectory);
+BOOL ExtractFilesFromCab(LPCWSTR lpCabName, LPCWSTR lpOutputPath);
+VOID InitLogs(VOID);
+VOID FreeLogs(VOID);
+BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg);
+BOOL GetInstalledVersion(ATL::CStringW *pszVersion, const ATL::CStringW &szRegName);
--- /dev/null
+#pragma once
+
+#ifndef _RAPPS_H
+#define _RAPPS_H
+
+#include "defines.h"
+
+#include "dialogs.h"
+#include "installed.h"
+#include "available.h"
+#include "misc.h"
+#include "gui.h"
+
+#endif /* _RAPPS_H */
*/
#pragma once
+#include <atlwin.h>
+
template<class T, int GrowthRate = 10>
class CPointerArray
{
--- /dev/null
+#pragma once
+#include <windef.h>
+//TODO: Separate main and settings related definitions
+
+struct SETTINGS_INFO
+{
+ BOOL bSaveWndPos;
+ BOOL bUpdateAtStart;
+ BOOL bLogEnabled;
+ WCHAR szDownloadDir[MAX_PATH];
+ BOOL bDelInstaller;
+ /* Window Pos */
+ BOOL Maximized;
+ INT Left;
+ INT Top;
+ INT Width;
+ INT Height;
+ /* Proxy settings */
+ INT Proxy;
+ WCHAR szProxyServer[MAX_PATH];
+ WCHAR szNoProxyFor[MAX_PATH];
+};
+
+typedef SETTINGS_INFO *PSETTINGS_INFO;
+
+extern HWND hMainWnd;
+extern HINSTANCE hInst;
+extern INT SelectedEnumType;
+extern SETTINGS_INFO SettingsInfo;
+
+VOID SaveSettings(HWND hwnd);
+VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo);
+
+// integrity.cpp
+BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName);
\ No newline at end of file
* PURPOSE: "Download and Install" Dialog
* PROGRAMMERS: Dmitry Chapyshev (dmitry@reactos.org)
*/
+#include "defines.h"
-#include "rapps.h"
+#include "dialogs.h"
+#include "available.h"
static PAPPLICATION_INFO AppInfo;
{
case WM_INITDIALOG:
{
-
}
break;
AppInfo = (PAPPLICATION_INFO) ListViewGetlParam(Index);
if (!AppInfo) return FALSE;
- DialogBox(hInst,
- MAKEINTRESOURCE(IDD_INSTALL_DIALOG),
+ DialogBoxW(hInst,
+ MAKEINTRESOURCEW(IDD_INSTALL_DIALOG),
hMainWnd,
InstallDlgProc);
* Alexander Shaposhnikov (chaez.san@gmail.com)
*/
-#include "rapps.h"
+#include "defines.h"
+
+#include "installed.h"
+
+#include "gui.h"
+#include "misc.h"
BOOL
GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, ATL::CStringW& String)
return FALSE;
}
-BOOL
-GetInstalledVersion_WowUser(_Out_opt_ ATL::CStringW* szVersionResult,
- _In_z_ const ATL::CStringW& RegName,
- _In_ BOOL IsUserKey,
- _In_ REGSAM keyWow)
-{
- HKEY hKey;
- BOOL bHasSucceded = FALSE;
- ATL::CStringW szVersion;
- ATL::CStringW szPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + RegName;
-
- if (RegOpenKeyExW(IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
- szPath.GetString(), 0, keyWow | KEY_READ,
- &hKey) == ERROR_SUCCESS)
- {
- if (szVersionResult != NULL)
- {
- DWORD dwSize = MAX_PATH * sizeof(WCHAR);
- DWORD dwType = REG_SZ;
- if (RegQueryValueExW(hKey,
- L"DisplayVersion",
- NULL,
- &dwType,
- (LPBYTE) szVersion.GetBuffer(MAX_PATH),
- &dwSize) == ERROR_SUCCESS)
- {
- szVersion.ReleaseBuffer();
- *szVersionResult = szVersion;
- bHasSucceded = TRUE;
- }
- else
- {
- szVersion.ReleaseBuffer();
- }
- }
- else
- {
- bHasSucceded = TRUE;
- szVersion.ReleaseBuffer();
- }
-
- }
-
- RegCloseKey(hKey);
- return bHasSucceded;
-}
-
-BOOL GetInstalledVersion(ATL::CStringW* pszVersion, const ATL::CStringW& szRegName)
-{
- return (!szRegName.IsEmpty()
- && (::GetInstalledVersion_WowUser(pszVersion, szRegName, TRUE, KEY_WOW64_32KEY)
- || ::GetInstalledVersion_WowUser(pszVersion, szRegName, FALSE, KEY_WOW64_32KEY)
- || ::GetInstalledVersion_WowUser(pszVersion, szRegName, TRUE, KEY_WOW64_64KEY)
- || ::GetInstalledVersion_WowUser(pszVersion, szRegName, FALSE, KEY_WOW64_64KEY)));
-}
-
BOOL
UninstallApplication(INT Index, BOOL bModify)
{
return StartProcess(szPath, TRUE);
}
-
BOOL
ShowInstalledAppInfo(INT Index)
{
return TRUE;
}
-
VOID
RemoveAppFromRegistry(INT Index)
{
}
}
-
BOOL
EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc)
{
* PROGRAMMERS: Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
* Mark Jansen
*/
+#include "defines.h"
-#include "rapps.h"
#include <sha1.h>
BOOL VerifyInteg(const ATL::CStringW &SHA1Hash, const ATL::CStringW &FileName)
IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have been corrupted or tampered with during downloading. Running the software is not recommended."
IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection to Internet."
IDS_UNABLE_TO_WRITE "Unable to write to disk. Disk may be at capacity."
- IDS_SELECT_ALL "Select/Desellect All"
+ IDS_SELECT_ALL "Select/Deselect All"
IDS_INSTALL_SELECTED "Install Selected"
END
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-#include "rapps.h"
+#include "defines.h"
#include <shlobj_undoc.h>
#include <shlguid_undoc.h>
#include <windowsx.h>
#include "rosui.h"
+#include "dialogs.h"
+
+#ifdef USE_CERT_PINNING
+ #define CERT_ISSUER_INFO "BE\r\nGlobalSign nv-sa\r\nGlobalSign Domain Validation CA - SHA256 - G2"
+ #define CERT_SUBJECT_INFO "Domain Control Validated\r\n*.reactos.org"
+#endif
typedef enum
{
hMainWnd,
DownloadDlgProc);
}
-// CDownloadManager
\ No newline at end of file
+// CDownloadManager
* Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
* Alexander Shaposhnikov (chaez.san@gmail.com)
*/
+#include "defines.h"
-#include "rapps.h"
+#include "gui.h"
+#include "misc.h"
/* SESSION Operation */
#define EXTRACT_FILLFILELIST 0x00000001
struct FILELIST
{
LPSTR FileName;
- struct FILELIST *next;
+ FILELIST *next;
BOOL DoExtract;
};
-typedef struct
+struct SESSION
{
INT FileSize;
ERF Error;
- struct FILELIST *FileList;
+ FILELIST *FileList;
INT FileCount;
INT Operation;
CHAR Destination[MAX_PATH];
CHAR CurrentFile[MAX_PATH];
CHAR Reserved[MAX_PATH];
- struct FILELIST *FilterList;
-} SESSION;
+ FILELIST *FilterList;
+};
typedef HRESULT(WINAPI *fnExtract)(SESSION *dest, LPCSTR szCabName);
fnExtract pfnExtract;
-INT
-GetSystemColorDepth(VOID)
-{
- DEVMODE pDevMode;
- INT ColorDepth;
-
- pDevMode.dmSize = sizeof(pDevMode);
- pDevMode.dmDriverExtra = 0;
-
- if (!EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &pDevMode))
- {
- /* TODO: Error message */
- return ILC_COLOR;
- }
-
- switch (pDevMode.dmBitsPerPel)
- {
- case 32: ColorDepth = ILC_COLOR32; break;
- case 24: ColorDepth = ILC_COLOR24; break;
- case 16: ColorDepth = ILC_COLOR16; break;
- case 8: ColorDepth = ILC_COLOR8; break;
- case 4: ColorDepth = ILC_COLOR4; break;
- default: ColorDepth = ILC_COLOR; break;
- }
-
- return ColorDepth;
-}
int
GetWindowWidth(HWND hwnd)
return TRUE;
}
+BOOL
+GetInstalledVersion_WowUser(_Out_opt_ ATL::CStringW* szVersionResult,
+ _In_z_ const ATL::CStringW& RegName,
+ _In_ BOOL IsUserKey,
+ _In_ REGSAM keyWow)
+{
+ HKEY hKey;
+ BOOL bHasSucceded = FALSE;
+ ATL::CStringW szVersion;
+ ATL::CStringW szPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + RegName;
+
+ if (RegOpenKeyExW(IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
+ szPath.GetString(), 0, keyWow | KEY_READ,
+ &hKey) == ERROR_SUCCESS)
+ {
+ if (szVersionResult != NULL)
+ {
+ DWORD dwSize = MAX_PATH * sizeof(WCHAR);
+ DWORD dwType = REG_SZ;
+ if (RegQueryValueExW(hKey,
+ L"DisplayVersion",
+ NULL,
+ &dwType,
+ (LPBYTE) szVersion.GetBuffer(MAX_PATH),
+ &dwSize) == ERROR_SUCCESS)
+ {
+ szVersion.ReleaseBuffer();
+ *szVersionResult = szVersion;
+ bHasSucceded = TRUE;
+ }
+ else
+ {
+ szVersion.ReleaseBuffer();
+ }
+ }
+ else
+ {
+ bHasSucceded = TRUE;
+ szVersion.ReleaseBuffer();
+ }
+
+ }
+ RegCloseKey(hKey);
+ return bHasSucceded;
+}
+BOOL GetInstalledVersion(ATL::CStringW * pszVersion, const ATL::CStringW & szRegName)
+{
+ return (!szRegName.IsEmpty()
+ && (GetInstalledVersion_WowUser(pszVersion, szRegName, TRUE, KEY_WOW64_32KEY)
+ || GetInstalledVersion_WowUser(pszVersion, szRegName, FALSE, KEY_WOW64_32KEY)
+ || GetInstalledVersion_WowUser(pszVersion, szRegName, TRUE, KEY_WOW64_64KEY)
+ || GetInstalledVersion_WowUser(pszVersion, szRegName, FALSE, KEY_WOW64_64KEY)));
+}
+++ /dev/null
-#pragma once
-
-#ifndef _RAPPS_H
-#define _RAPPS_H
-
-#include <tchar.h>
-#include <stdarg.h>
-
-#define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
-#define COBJMACROS
-
-#include <windef.h>
-#include <winbase.h>
-#include <winreg.h>
-#include <wingdi.h>
-#include <winnls.h>
-#include <winuser.h>
-#include <wincon.h>
-#include <richedit.h>
-#include <shellapi.h>
-#include <shlobj.h>
-#include <shlwapi.h>
-#include <stdio.h>
-#include <strsafe.h>
-#include <ndk/rtlfuncs.h>
-#include <atlcoll.h>
-#include <atlsimpcoll.h>
-#include <atlstr.h>
-#include <rappsmsg.h>
-
-#include "resource.h"
-
-#ifdef USE_CERT_PINNING
- #define CERT_ISSUER_INFO "BE\r\nGlobalSign nv-sa\r\nGlobalSign Domain Validation CA - SHA256 - G2"
- #define CERT_SUBJECT_INFO "Domain Control Validated\r\n*.reactos.org"
-#endif
-
-#define APPLICATION_DATABASE_URL L"https://svn.reactos.org/packages/rappmgr.cab"
-
-#define SPLIT_WIDTH 4
-#define MAX_STR_LEN 256
-#define LISTVIEW_ICON_SIZE 24
-#define TREEVIEW_ICON_SIZE 24
-
-/* EnumType flags for EnumInstalledApplications */
-#define ENUM_ALL_COMPONENTS 30
-#define ENUM_APPLICATIONS 31
-#define ENUM_UPDATES 32
-/* EnumType flags for EnumAvailableApplications */
-#define ENUM_ALL_AVAILABLE 0
-#define ENUM_CAT_AUDIO 1
-#define ENUM_CAT_VIDEO 2
-#define ENUM_CAT_GRAPHICS 3
-#define ENUM_CAT_GAMES 4
-#define ENUM_CAT_INTERNET 5
-#define ENUM_CAT_OFFICE 6
-#define ENUM_CAT_DEVEL 7
-#define ENUM_CAT_EDU 8
-#define ENUM_CAT_ENGINEER 9
-#define ENUM_CAT_FINANCE 10
-#define ENUM_CAT_SCIENCE 11
-#define ENUM_CAT_TOOLS 12
-#define ENUM_CAT_DRIVERS 13
-#define ENUM_CAT_LIBS 14
-#define ENUM_CAT_OTHER 15
-
-#define ENUM_INSTALLED_MIN ENUM_ALL_COMPONENTS
-#define ENUM_INSTALLED_MAX ENUM_UPDATES
-#define ENUM_AVAILABLE_MIN ENUM_ALL_AVAILABLE
-#define ENUM_AVAILABLE_MAX ENUM_CAT_OTHER
-
-#define IS_INSTALLED_ENUM(a) (a >= ENUM_INSTALLED_MIN && a <= ENUM_INSTALLED_MAX)
-#define IS_AVAILABLE_ENUM(a) (a >= ENUM_AVAILABLE_MIN && a <= ENUM_AVAILABLE_MAX)
-
-typedef enum
-{
- None,
- OpenSource,
- Freeware,
- Trial,
- Max = Trial,
- Min = None
-} LICENSE_TYPE, *PLICENSE_TYPE;
-
-/* aboutdlg.cpp */
-VOID ShowAboutDialog(VOID);
-
-/* available.cpp */
-typedef struct
-{
- INT Category;
- LICENSE_TYPE LicenseType;
- ATL::CStringW szName;
- ATL::CStringW szRegName;
- ATL::CStringW szVersion;
- ATL::CStringW szLicense;
- ATL::CStringW szDesc;
- ATL::CStringW szSize;
- ATL::CStringW szUrlSite;
- ATL::CStringW szUrlDownload;
- ATL::CStringW szCDPath;
- ATL::CSimpleArray<LCID> Languages;
-
- /* caching mechanism related entries */
- ATL::CStringW sFileName;
- FILETIME ftCacheStamp;
-
- /* optional integrity checks (SHA-1 digests are 160 bit = 40 characters in hex string form) */
- ATL::CStringW szSHA1;
-
-} APPLICATION_INFO, *PAPPLICATION_INFO;
-
-extern ATL::CAtlList<PAPPLICATION_INFO> InfoList;
-
-typedef struct
-{
- HKEY hRootKey;
- HKEY hSubKey;
- ATL::CStringW szKeyName;
-
-} INSTALLED_INFO, *PINSTALLED_INFO;
-
-typedef struct
-{
- BOOL bSaveWndPos;
- BOOL bUpdateAtStart;
- BOOL bLogEnabled;
- WCHAR szDownloadDir[MAX_PATH];
- BOOL bDelInstaller;
- /* Window Pos */
- BOOL Maximized;
- INT Left;
- INT Top;
- INT Width;
- INT Height;
- /* Proxy settings */
- INT Proxy;
- WCHAR szProxyServer[MAX_PATH];
- WCHAR szNoProxyFor[MAX_PATH];
-
-} SETTINGS_INFO, *PSETTINGS_INFO;
-
-/* available.cpp */
-class CConfigParser
-{
- // Loacale names cache
- static ATL::CStringW m_szLocaleID;
- const static INT m_cchLocaleSize = 5;
- static ATL::CStringW m_szCachedINISectionLocale;
- static ATL::CStringW m_szCachedINISectionLocaleNeutral;
-
- const LPCWSTR STR_VERSION_CURRENT = L"CURRENT";
- const ATL::CStringW szConfigPath;
-
- static ATL::CStringW GetINIFullPath(const ATL::CStringW& FileName);
- static VOID CacheINILocaleLazy();
-
-public:
- static const ATL::CStringW& GetLocale();
- static INT CConfigParser::GetLocaleSize();
-
- CConfigParser(const ATL::CStringW& FileName);
-
- UINT GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString);
- UINT GetInt(const ATL::CStringW& KeyName);
-};
-
-typedef BOOL (CALLBACK *AVAILENUMPROC)(PAPPLICATION_INFO Info, LPCWSTR szFolderPath);
-struct CAvailableApplicationInfo : public APPLICATION_INFO
-{
- ATL::CStringW szInstalledVersion;
- CAvailableApplicationInfo(const ATL::CStringW& sFileNameParam);
-
- // Load all info from the file
- VOID RefreshAppInfo();
- BOOL HasLanguageInfo() const;
- BOOL HasNativeLanguage() const;
- BOOL HasEnglishLanguage() const;
- BOOL IsInstalled() const;
- BOOL HasInstalledVersion() const;
- BOOL HasUpdate() const;
-
- // Set a timestamp
- VOID SetLastWriteTime(FILETIME* ftTime);
-
-private:
- BOOL m_IsInstalled = FALSE;
- BOOL m_HasLanguageInfo = FALSE;
- BOOL m_HasInstalledVersion = FALSE;
- CConfigParser m_Parser;
-
- inline BOOL GetString(LPCWSTR lpKeyName,
- ATL::CStringW& ReturnedString);
-
- // Lazily load general info from the file
- VOID RetrieveGeneralInfo();
- VOID RetrieveInstalledStatus();
- VOID RetrieveInstalledVersion();
- VOID RetrieveLanguages();
- VOID RetrieveLicenseType();
- inline BOOL FindInLanguages(LCID what) const;
-};
-
-class CAvailableApps
-{
- ATL::CAtlList<CAvailableApplicationInfo*> m_InfoList;
- ATL::CStringW m_szPath;
- ATL::CStringW m_szCabPath;
- ATL::CStringW m_szAppsPath;
- ATL::CStringW m_szSearchPath;
-
-public:
- CAvailableApps();
- VOID FreeCachedEntries();
- BOOL DeleteCurrentAppsDB();
- BOOL UpdateAppsDB();
- BOOL EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc);
- const ATL::CStringW& GetFolderPath();
- const ATL::CStringW& GetAppPath();
- const ATL::CStringW& GetCabPath();
- const LPCWSTR GetFolderPathString();
- const LPCWSTR GetAppPathString();
- const LPCWSTR GetCabPathString();
-};
-
-/* installdlg.cpp */
-//BOOL InstallApplication(INT Index);
-
-/* installed.cpp */
-typedef BOOL (CALLBACK *APPENUMPROC)(INT ItemIndex, ATL::CStringW &lpName, PINSTALLED_INFO Info);
-BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc);
-BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString);
-BOOL GetApplicationString(HKEY hKey, LPCWSTR RegName, ATL::CStringW& String);
-
-BOOL ShowInstalledAppInfo(INT Index);
-BOOL UninstallApplication(INT Index, BOOL bModify);
-VOID RemoveAppFromRegistry(INT Index);
-
-BOOL GetInstalledVersion(ATL::CStringW* pszVersion, const ATL::CStringW& szRegName);
-
-/* winmain.cpp */
-extern HWND hMainWnd;
-extern HINSTANCE hInst;
-extern INT SelectedEnumType;
-extern SETTINGS_INFO SettingsInfo;
-VOID SaveSettings(HWND hwnd);
-VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo);
-
-/* loaddlg.cpp */
-class CDowloadingAppsListView;
-
-class CDownloadManager
-{
- static PAPPLICATION_INFO AppInfo;
- static ATL::CSimpleArray<PAPPLICATION_INFO> AppsToInstallList;
- static CDowloadingAppsListView DownloadsListView;
- static INT iCurrentApp;
-public:
- static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
- static LRESULT CALLBACK DownloadProgressProc(HWND hWnd,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam,
- UINT_PTR uIdSubclass,
- DWORD_PTR dwRefData);
-
- static DWORD WINAPI ThreadFunc(LPVOID Context);
- static BOOL DownloadListOfApplications(const ATL::CSimpleArray<PAPPLICATION_INFO>& AppsList);
- static BOOL DownloadApplication(PAPPLICATION_INFO pAppInfo);
- static VOID DownloadApplicationsDB(LPCWSTR lpUrl);
- static VOID LaunchDownloadDialog();
-};
-
-/* misc.cpp */
-INT GetSystemColorDepth(VOID);
-int GetWindowWidth(HWND hwnd);
-int GetWindowHeight(HWND hwnd);
-int GetClientWindowWidth(HWND hwnd);
-int GetClientWindowHeight(HWND hwnd);
-VOID CopyTextToClipboard(LPCWSTR lpszText);
-VOID SetWelcomeText(VOID);
-VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem);
-BOOL StartProcess(ATL::CStringW & Path, BOOL Wait);
-BOOL StartProcess(LPWSTR lpPath, BOOL Wait);
-BOOL GetStorageDirectory(ATL::CStringW &lpDirectory);
-BOOL ExtractFilesFromCab(LPCWSTR lpCabName, LPCWSTR lpOutputPath);
-VOID InitLogs(VOID);
-VOID FreeLogs(VOID);
-BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg);
-
-/* settingsdlg.cpp */
-VOID CreateSettingsDlg(HWND hwnd);
-
-/* gui.cpp */
-HWND CreateMainWindow();
-DWORD_PTR ListViewGetlParam(INT item);
-INT ListViewAddItem(INT ItemIndex, INT IconIndex, LPWSTR lpName, LPARAM lParam);
-VOID SetStatusBarText(LPCWSTR szText);
-VOID NewRichEditText(LPCWSTR szText, DWORD flags);
-VOID InsertRichEditText(LPCWSTR szText, DWORD flags);
-
-VOID SetStatusBarText(const ATL::CStringW& szText);
-INT ListViewAddItem(INT ItemIndex, INT IconIndex, ATL::CStringW & Name, LPARAM lParam);
-VOID NewRichEditText(const ATL::CStringW& szText, DWORD flags);
-VOID InsertRichEditText(const ATL::CStringW& szText, DWORD flags);
-CAvailableApps * GetAvailableApps();
-extern HWND hListView;
-extern ATL::CStringW szSearchPattern;
-
-/* integrity.cpp */
-BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName);
-
-//extern HWND hTreeView;
-//BOOL CreateTreeView(HWND hwnd);
-//HTREEITEM TreeViewAddItem(HTREEITEM hParent, LPWSTR lpText, INT Image, INT SelectedImage, LPARAM lParam);
-
-#endif /* _RAPPS_H */
* PROGRAMMERS: Dmitry Chapyshev (dmitry@reactos.org)
* Alexander Shaposhnikov (chaez.san@gmail.com)
*/
+#include "defines.h"
-#include "rapps.h"
+#include "dialogs.h"
SETTINGS_INFO NewSettingsInfo;
* Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
* Alexander Shaposhnikov (chaez.san@gmail.com)
*/
+#include "defines.h"
#include "rapps.h"
GetAvailableApps()->UpdateAppsDB();
/* Load the menu hotkeys */
- KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCE(HOTKEYS));
+ KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCEW(HOTKEYS));
/* Message Loop */
- while (GetMessage(&Msg, NULL, 0, 0))
+ while (GetMessageW(&Msg, NULL, 0, 0))
{
if (!TranslateAcceleratorW(hMainWnd, KeyBrd, &Msg))
{