23245fdc91467d5ae3b3662a1284bac71525850d
[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 <atlsimpcoll.h>
30 #include <atlstr.h>
31 #include <rappsmsg.h>
32
33 #include "resource.h"
34
35 #ifdef USE_CERT_PINNING
36 #define CERT_ISSUER_INFO "BE\r\nGlobalSign nv-sa\r\nGlobalSign Domain Validation CA - SHA256 - G2"
37 #define CERT_SUBJECT_INFO "Domain Control Validated\r\n*.reactos.org"
38 #endif
39
40 #define APPLICATION_DATABASE_URL L"https://svn.reactos.org/packages/rappmgr.cab"
41
42 #define SPLIT_WIDTH 4
43 #define MAX_STR_LEN 256
44 #define LISTVIEW_ICON_SIZE 24
45 #define TREEVIEW_ICON_SIZE 24
46
47 /* EnumType flags for EnumInstalledApplications */
48 #define ENUM_ALL_COMPONENTS 30
49 #define ENUM_APPLICATIONS 31
50 #define ENUM_UPDATES 32
51 /* EnumType flags for EnumAvailableApplications */
52 #define ENUM_ALL_AVAILABLE 0
53 #define ENUM_CAT_AUDIO 1
54 #define ENUM_CAT_VIDEO 2
55 #define ENUM_CAT_GRAPHICS 3
56 #define ENUM_CAT_GAMES 4
57 #define ENUM_CAT_INTERNET 5
58 #define ENUM_CAT_OFFICE 6
59 #define ENUM_CAT_DEVEL 7
60 #define ENUM_CAT_EDU 8
61 #define ENUM_CAT_ENGINEER 9
62 #define ENUM_CAT_FINANCE 10
63 #define ENUM_CAT_SCIENCE 11
64 #define ENUM_CAT_TOOLS 12
65 #define ENUM_CAT_DRIVERS 13
66 #define ENUM_CAT_LIBS 14
67 #define ENUM_CAT_OTHER 15
68
69 #define ENUM_INSTALLED_MIN ENUM_ALL_COMPONENTS
70 #define ENUM_INSTALLED_MAX ENUM_UPDATES
71 #define ENUM_AVAILABLE_MIN ENUM_ALL_AVAILABLE
72 #define ENUM_AVAILABLE_MAX ENUM_CAT_OTHER
73
74 #define IS_INSTALLED_ENUM(a) (a >= ENUM_INSTALLED_MIN && a <= ENUM_INSTALLED_MAX)
75 #define IS_AVAILABLE_ENUM(a) (a >= ENUM_AVAILABLE_MIN && a <= ENUM_AVAILABLE_MAX)
76
77 typedef enum
78 {
79 None,
80 OpenSource,
81 Freeware,
82 Trial,
83 Max = Trial,
84 Min = None
85 } LICENSE_TYPE, *PLICENSE_TYPE;
86
87 /* aboutdlg.cpp */
88 VOID ShowAboutDialog(VOID);
89
90 /* available.cpp */
91 typedef struct
92 {
93 INT Category;
94 LICENSE_TYPE LicenseType;
95 ATL::CStringW szName;
96 ATL::CStringW szRegName;
97 ATL::CStringW szVersion;
98 ATL::CStringW szLicense;
99 ATL::CStringW szDesc;
100 ATL::CStringW szSize;
101 ATL::CStringW szUrlSite;
102 ATL::CStringW szUrlDownload;
103 ATL::CStringW szCDPath;
104 ATL::CSimpleArray<ATL::CStringW> Languages;
105
106 /* caching mechanism related entries */
107 ATL::CStringW cFileName;
108 FILETIME ftCacheStamp;
109
110 /* optional integrity checks (SHA-1 digests are 160 bit = 40 characters in hex string form) */
111 ATL::CStringW szSHA1;
112
113 } APPLICATION_INFO, *PAPPLICATION_INFO;
114
115 extern ATL::CAtlList<PAPPLICATION_INFO> InfoList;
116
117 typedef struct
118 {
119 HKEY hRootKey;
120 HKEY hSubKey;
121 ATL::CStringW szKeyName;
122
123 } INSTALLED_INFO, *PINSTALLED_INFO;
124
125 typedef struct
126 {
127 BOOL bSaveWndPos;
128 BOOL bUpdateAtStart;
129 BOOL bLogEnabled;
130 WCHAR szDownloadDir[MAX_PATH];
131 BOOL bDelInstaller;
132 /* Window Pos */
133 BOOL Maximized;
134 INT Left;
135 INT Top;
136 INT Width;
137 INT Height;
138 /* Proxy settings */
139 INT Proxy;
140 WCHAR szProxyServer[MAX_PATH];
141 WCHAR szNoProxyFor[MAX_PATH];
142
143 } SETTINGS_INFO, *PSETTINGS_INFO;
144
145 /* available.cpp */
146 typedef BOOL (CALLBACK *AVAILENUMPROC)(PAPPLICATION_INFO Info);
147 BOOL EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc);
148 BOOL ShowAvailableAppInfo(INT Index);
149 BOOL UpdateAppsDB(VOID);
150 VOID FreeCachedAvailableEntries(VOID);
151
152 /* installdlg.cpp */
153 BOOL InstallApplication(INT Index);
154
155 /* installed.cpp */
156 typedef BOOL (CALLBACK *APPENUMPROC)(INT ItemIndex, ATL::CStringW &lpName, PINSTALLED_INFO Info);
157 BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc);
158 BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString);
159 BOOL GetApplicationString(HKEY hKey, LPCWSTR RegName, ATL::CStringW& String);
160
161 BOOL ShowInstalledAppInfo(INT Index);
162 BOOL UninstallApplication(INT Index, BOOL bModify);
163 VOID RemoveAppFromRegistry(INT Index);
164
165 BOOL GetInstalledVersion_WowUser(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 */