[RAPPS] Update check, license type
[reactos.git] / reactos / base / applications / rapps / rapps.h
1 #pragma once
2
3 #ifndef _RAPPS_H
4 #define _RAPPS_H
5
6 #include <tchar.h>
7 #include <stdarg.h>
8
9 #define WIN32_NO_STATUS
10 #define _INC_WINDOWS
11 #define COM_NO_WINDOWS_H
12 #define COBJMACROS
13
14 #include <windef.h>
15 #include <winbase.h>
16 #include <winreg.h>
17 #include <wingdi.h>
18 #include <winnls.h>
19 #include <winuser.h>
20 #include <wincon.h>
21 #include <richedit.h>
22 #include <shellapi.h>
23 #include <shlobj.h>
24 #include <shlwapi.h>
25 #include <stdio.h>
26 #include <strsafe.h>
27 #include <ndk/rtlfuncs.h>
28
29 #include <rappsmsg.h>
30
31 #include "resource.h"
32
33 #ifdef USE_CERT_PINNING
34 #define CERT_ISSUER_INFO "BE\r\nGlobalSign nv-sa\r\nGlobalSign Domain Validation CA - SHA256 - G2"
35 #define CERT_SUBJECT_INFO "Domain Control Validated\r\n*.reactos.org"
36 #endif
37
38 #define APPLICATION_DATABASE_URL L"https://svn.reactos.org/packages/rappmgr.cab"
39
40 #define SPLIT_WIDTH 4
41 #define MAX_STR_LEN 256
42 #define MAX_VERSION 10
43 #define LISTVIEW_ICON_SIZE 24
44 #define TREEVIEW_ICON_SIZE 24
45
46 /* EnumType flags for EnumInstalledApplications */
47 #define ENUM_ALL_COMPONENTS 30
48 #define ENUM_APPLICATIONS 31
49 #define ENUM_UPDATES 32
50 /* EnumType flags for EnumAvailableApplications */
51 #define ENUM_ALL_AVAILABLE 0
52 #define ENUM_CAT_AUDIO 1
53 #define ENUM_CAT_VIDEO 2
54 #define ENUM_CAT_GRAPHICS 3
55 #define ENUM_CAT_GAMES 4
56 #define ENUM_CAT_INTERNET 5
57 #define ENUM_CAT_OFFICE 6
58 #define ENUM_CAT_DEVEL 7
59 #define ENUM_CAT_EDU 8
60 #define ENUM_CAT_ENGINEER 9
61 #define ENUM_CAT_FINANCE 10
62 #define ENUM_CAT_SCIENCE 11
63 #define ENUM_CAT_TOOLS 12
64 #define ENUM_CAT_DRIVERS 13
65 #define ENUM_CAT_LIBS 14
66 #define ENUM_CAT_OTHER 15
67
68 #define ENUM_INSTALLED_MIN ENUM_ALL_COMPONENTS
69 #define ENUM_INSTALLED_MAX ENUM_UPDATES
70 #define ENUM_AVAILABLE_MIN ENUM_ALL_AVAILABLE
71 #define ENUM_AVAILABLE_MAX ENUM_CAT_OTHER
72
73 #define IS_INSTALLED_ENUM(a) (a >= ENUM_INSTALLED_MIN && a <= ENUM_INSTALLED_MAX)
74 #define IS_AVAILABLE_ENUM(a) (a >= ENUM_AVAILABLE_MIN && a <= ENUM_AVAILABLE_MAX)
75
76 typedef enum
77 {
78 None,
79 OpenSource,
80 Freeware,
81 Trial,
82 Max = Trial,
83 Min = None
84 } LICENSE_TYPE, *PLICENSE_TYPE;
85
86 /* aboutdlg.cpp */
87 VOID ShowAboutDialog(VOID);
88
89 /* available.cpp */
90 typedef struct
91 {
92 INT Category;
93 LICENSE_TYPE LicenseType;
94 WCHAR szName[MAX_PATH];
95 WCHAR szRegName[MAX_PATH];
96 WCHAR szVersion[MAX_PATH];
97 WCHAR szLicense[MAX_PATH];
98 WCHAR szDesc[MAX_PATH];
99 WCHAR szSize[MAX_PATH];
100 WCHAR szUrlSite[MAX_PATH];
101 WCHAR szUrlDownload[MAX_PATH];
102 WCHAR szCDPath[MAX_PATH];
103 WCHAR szLanguages[MAX_PATH];
104
105 /* caching mechanism related entries */
106 WCHAR cFileName[MAX_PATH];
107 FILETIME ftCacheStamp;
108 LIST_ENTRY List;
109
110 /* optional integrity checks (SHA-1 digests are 160 bit = 40 characters in hex string form) */
111 WCHAR szSHA1[40 + 1];
112
113 } APPLICATION_INFO, *PAPPLICATION_INFO;
114
115 typedef struct
116 {
117 HKEY hRootKey;
118 HKEY hSubKey;
119 WCHAR szKeyName[MAX_PATH];
120
121 } INSTALLED_INFO, *PINSTALLED_INFO;
122
123 typedef struct
124 {
125 BOOL bSaveWndPos;
126 BOOL bUpdateAtStart;
127 BOOL bLogEnabled;
128 WCHAR szDownloadDir[MAX_PATH];
129 BOOL bDelInstaller;
130 /* Window Pos */
131 BOOL Maximized;
132 INT Left;
133 INT Top;
134 INT Width;
135 INT Height;
136 /* Proxy settings */
137 INT Proxy;
138 WCHAR szProxyServer[MAX_PATH];
139 WCHAR szNoProxyFor[MAX_PATH];
140
141 } SETTINGS_INFO, *PSETTINGS_INFO;
142
143 typedef struct
144 {
145 INT arrVersion[MAX_VERSION];
146 UINT VersionSize;
147 WCHAR cVersionSuffix = (WCHAR) NULL;
148 WCHAR szVersion[MAX_PATH];
149 } VERSION_INFO, *PVERSION_INFO;
150
151 /* available.cpp */
152 typedef BOOL (CALLBACK *AVAILENUMPROC)(PAPPLICATION_INFO Info);
153 BOOL EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc);
154 BOOL ShowAvailableAppInfo(INT Index);
155 BOOL UpdateAppsDB(VOID);
156 VOID FreeCachedAvailableEntries(VOID);
157
158
159 /* installdlg.cpp */
160 BOOL InstallApplication(INT Index);
161
162 /* installed.cpp */
163 typedef BOOL (CALLBACK *APPENUMPROC)(INT ItemIndex, LPWSTR lpName, PINSTALLED_INFO Info);
164 BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc);
165 BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR lpString);
166 BOOL ShowInstalledAppInfo(INT Index);
167 BOOL UninstallApplication(INT Index, BOOL bModify);
168 BOOL IsInstalledApplication(LPCWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow);
169 VOID RemoveAppFromRegistry(INT Index);
170
171 BOOL InstalledVersion(LPWSTR szVersionResult, UINT iVersionResultSize, LPCWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow);
172
173 /* winmain.cpp */
174 extern HWND hMainWnd;
175 extern HINSTANCE hInst;
176 extern INT SelectedEnumType;
177 extern SETTINGS_INFO SettingsInfo;
178 VOID SaveSettings(HWND hwnd);
179 VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo);
180
181 /* loaddlg.cpp */
182 BOOL DownloadApplication(INT Index);
183 VOID DownloadApplicationsDB(LPCWSTR lpUrl);
184
185 /* misc.cpp */
186 INT GetSystemColorDepth(VOID);
187 int GetWindowWidth(HWND hwnd);
188 int GetWindowHeight(HWND hwnd);
189 int GetClientWindowWidth(HWND hwnd);
190 int GetClientWindowHeight(HWND hwnd);
191 VOID CopyTextToClipboard(LPCWSTR lpszText);
192 VOID SetWelcomeText(VOID);
193 VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem);
194 BOOL StartProcess(LPWSTR lpPath, BOOL Wait);
195 BOOL GetStorageDirectory(PWCHAR lpDirectory, DWORD cch);
196 BOOL ExtractFilesFromCab(LPWSTR lpCabName, LPWSTR lpOutputPath);
197 VOID InitLogs(VOID);
198 VOID FreeLogs(VOID);
199 BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPWSTR lpMsg);
200
201 UINT ParserGetString(LPCWSTR lpKeyName, LPWSTR lpReturnedString, UINT nSize, LPCWSTR lpFileName);
202 UINT ParserGetInt(LPCWSTR lpKeyName, LPCWSTR lpFileName);
203
204 BOOL ParseVersion(_In_z_ LPCWSTR szVersion, _Outptr_ PVERSION_INFO parrVersion);
205 BOOL CompareVersionsStrings(_In_z_ LPCWSTR sczVersionLeft, _In_z_ LPCWSTR sczVersionRight);
206 BOOL CompareVersions(_In_ PVERSION_INFO LeftVersion, _In_ PVERSION_INFO RightVersion);
207
208 /* settingsdlg.cpp */
209 VOID CreateSettingsDlg(HWND hwnd);
210
211 /* gui.cpp */
212 HWND CreateMainWindow();
213 DWORD_PTR ListViewGetlParam(INT item);
214 INT ListViewAddItem(INT ItemIndex, INT IconIndex, PWSTR lpName, LPARAM lParam);
215 VOID SetStatusBarText(PCWSTR szText);
216 VOID NewRichEditText(PCWSTR szText, DWORD flags);
217 VOID InsertRichEditText(PCWSTR szText, DWORD flags);
218 extern HWND hListView;
219 extern WCHAR szSearchPattern[MAX_STR_LEN];
220
221 /* integrity.cpp */
222 BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName);
223
224 //extern HWND hTreeView;
225 //BOOL CreateTreeView(HWND hwnd);
226 //HTREEITEM TreeViewAddItem(HTREEITEM hParent, LPWSTR lpText, INT Image, INT SelectedImage, LPARAM lParam);
227
228
229 #endif /* _RAPPS_H */