afa942e386ff97aa01c74511d5586740618a621e
[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 #include <atlcoll.h>
29 #include <atlstr.h>
30 #include <rappsmsg.h>
31
32 #include "resource.h"
33
34 #ifdef USE_CERT_PINNING
35 #define CERT_ISSUER_INFO "BE\r\nGlobalSign nv-sa\r\nGlobalSign Domain Validation CA - SHA256 - G2"
36 #define CERT_SUBJECT_INFO "Domain Control Validated\r\n*.reactos.org"
37 #endif
38
39 #define APPLICATION_DATABASE_URL L"https://svn.reactos.org/packages/rappmgr.cab"
40
41 #define SPLIT_WIDTH 4
42 #define MAX_STR_LEN 256
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 ATL::CStringW szName;
95 ATL::CStringW szRegName;
96 ATL::CStringW szVersion;
97 ATL::CStringW szLicense;
98 ATL::CStringW szDesc;
99 ATL::CStringW szSize;
100 ATL::CStringW szUrlSite;
101 ATL::CStringW szUrlDownload;
102 ATL::CStringW szCDPath;
103 ATL::CStringW szLanguages;
104
105 /* caching mechanism related entries */
106 ATL::CStringW cFileName;
107 FILETIME ftCacheStamp;
108
109 /* optional integrity checks (SHA-1 digests are 160 bit = 40 characters in hex string form) */
110 ATL::CStringW szSHA1;
111
112 } APPLICATION_INFO, *PAPPLICATION_INFO;
113
114 extern ATL::CAtlList<PAPPLICATION_INFO> InfoList;
115
116 typedef struct
117 {
118 HKEY hRootKey;
119 HKEY hSubKey;
120 ATL::CStringW szKeyName;
121
122 } INSTALLED_INFO, *PINSTALLED_INFO;
123
124 typedef struct
125 {
126 BOOL bSaveWndPos;
127 BOOL bUpdateAtStart;
128 BOOL bLogEnabled;
129 WCHAR szDownloadDir[MAX_PATH];
130 BOOL bDelInstaller;
131 /* Window Pos */
132 BOOL Maximized;
133 INT Left;
134 INT Top;
135 INT Width;
136 INT Height;
137 /* Proxy settings */
138 INT Proxy;
139 WCHAR szProxyServer[MAX_PATH];
140 WCHAR szNoProxyFor[MAX_PATH];
141
142 } SETTINGS_INFO, *PSETTINGS_INFO;
143
144 /* available.cpp */
145 typedef BOOL (CALLBACK *AVAILENUMPROC)(PAPPLICATION_INFO Info);
146 BOOL EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc);
147 BOOL ShowAvailableAppInfo(INT Index);
148 BOOL UpdateAppsDB(VOID);
149 VOID FreeCachedAvailableEntries(VOID);
150
151 /* installdlg.cpp */
152 BOOL InstallApplication(INT Index);
153
154 /* installed.cpp */
155 typedef BOOL (CALLBACK *APPENUMPROC)(INT ItemIndex, ATL::CStringW &lpName, PINSTALLED_INFO Info);
156 BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc);
157 BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString);
158 BOOL GetApplicationString(HKEY hKey, LPCWSTR RegName, ATL::CStringW& String);
159
160 BOOL ShowInstalledAppInfo(INT Index);
161 BOOL UninstallApplication(INT Index, BOOL bModify);
162 BOOL IsInstalledApplication(const ATL::CStringW& RegName, BOOL IsUserKey, REGSAM keyWow);
163 VOID RemoveAppFromRegistry(INT Index);
164
165 BOOL InstalledVersion(ATL::CStringW& szVersionResult, const ATL::CStringW& RegName, BOOL IsUserKey, REGSAM keyWow);
166
167 /* winmain.cpp */
168 extern HWND hMainWnd;
169 extern HINSTANCE hInst;
170 extern INT SelectedEnumType;
171 extern SETTINGS_INFO SettingsInfo;
172 VOID SaveSettings(HWND hwnd);
173 VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo);
174
175 /* loaddlg.cpp */
176 BOOL DownloadApplication(INT Index);
177 VOID DownloadApplicationsDB(LPCWSTR lpUrl);
178
179 /* misc.cpp */
180 INT GetSystemColorDepth(VOID);
181 int GetWindowWidth(HWND hwnd);
182 int GetWindowHeight(HWND hwnd);
183 int GetClientWindowWidth(HWND hwnd);
184 int GetClientWindowHeight(HWND hwnd);
185 VOID CopyTextToClipboard(LPCWSTR lpszText);
186 VOID SetWelcomeText(VOID);
187 VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem);
188 BOOL StartProcess(ATL::CStringW & Path, BOOL Wait);
189 BOOL StartProcess(LPWSTR lpPath, BOOL Wait);
190 BOOL GetStorageDirectory(ATL::CStringW &lpDirectory);
191 BOOL ExtractFilesFromCab(LPCWSTR lpCabName, LPCWSTR lpOutputPath);
192 VOID InitLogs(VOID);
193 VOID FreeLogs(VOID);
194 BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg);
195
196 UINT ParserGetString(const ATL::CStringW& KeyName, const ATL::CStringW& FileName, ATL::CStringW& ReturnedString);
197 UINT ParserGetInt(const ATL::CStringW& KeyName, const ATL::CStringW& FileName);
198
199 /* settingsdlg.cpp */
200 VOID CreateSettingsDlg(HWND hwnd);
201
202 /* gui.cpp */
203 HWND CreateMainWindow();
204 DWORD_PTR ListViewGetlParam(INT item);
205 INT ListViewAddItem(INT ItemIndex, INT IconIndex, LPWSTR lpName, LPARAM lParam);
206 VOID SetStatusBarText(LPCWSTR szText);
207 VOID NewRichEditText(LPCWSTR szText, DWORD flags);
208 VOID InsertRichEditText(LPCWSTR szText, DWORD flags);
209
210 VOID SetStatusBarText(const ATL::CStringW& szText);
211 INT ListViewAddItem(INT ItemIndex, INT IconIndex, ATL::CStringW & Name, LPARAM lParam);
212 VOID NewRichEditText(const ATL::CStringW& szText, DWORD flags);
213 VOID InsertRichEditText(const ATL::CStringW& szText, DWORD flags);
214 extern HWND hListView;
215 extern ATL::CStringW szSearchPattern;
216
217 /* integrity.cpp */
218 BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName);
219
220 //extern HWND hTreeView;
221 //BOOL CreateTreeView(HWND hwnd);
222 //HTREEITEM TreeViewAddItem(HTREEITEM hParent, LPWSTR lpText, INT Image, INT SelectedImage, LPARAM lParam);
223
224 #endif /* _RAPPS_H */