[RAPPS]
[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
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
77 /* aboutdlg.c */
78 VOID ShowAboutDialog(VOID);
79
80 /* available.c */
81 typedef struct
82 {
83 INT Category;
84 WCHAR szName[MAX_PATH];
85 WCHAR szRegName[MAX_PATH];
86 WCHAR szVersion[MAX_PATH];
87 WCHAR szLicense[MAX_PATH];
88 WCHAR szDesc[MAX_PATH];
89 WCHAR szSize[MAX_PATH];
90 WCHAR szUrlSite[MAX_PATH];
91 WCHAR szUrlDownload[MAX_PATH];
92 WCHAR szCDPath[MAX_PATH];
93
94 /* caching mechanism related entries */
95 WCHAR cFileName[MAX_PATH];
96 FILETIME ftCacheStamp;
97 LIST_ENTRY List;
98
99 /* optional integrity checks (SHA-1 digests are 160 bit = 40 characters in hex string form) */
100 WCHAR szSHA1[40 + 1];
101
102 } APPLICATION_INFO, *PAPPLICATION_INFO;
103
104 typedef struct
105 {
106 HKEY hRootKey;
107 HKEY hSubKey;
108 WCHAR szKeyName[MAX_PATH];
109
110 } INSTALLED_INFO, *PINSTALLED_INFO;
111
112 typedef struct
113 {
114 BOOL bSaveWndPos;
115 BOOL bUpdateAtStart;
116 BOOL bLogEnabled;
117 WCHAR szDownloadDir[MAX_PATH];
118 BOOL bDelInstaller;
119 /* Window Pos */
120 BOOL Maximized;
121 INT Left;
122 INT Top;
123 INT Width;
124 INT Height;
125 /* Proxy settings */
126 INT Proxy;
127 WCHAR szProxyServer[MAX_PATH];
128 WCHAR szNoProxyFor[MAX_PATH];
129
130 } SETTINGS_INFO, *PSETTINGS_INFO;
131
132 /* available.c */
133 typedef BOOL (CALLBACK *AVAILENUMPROC)(PAPPLICATION_INFO Info);
134 BOOL EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc);
135 BOOL ShowAvailableAppInfo(INT Index);
136 BOOL UpdateAppsDB(VOID);
137 VOID FreeCachedAvailableEntries(VOID);
138
139 /* installdlg.c */
140 BOOL InstallApplication(INT Index);
141
142 /* installed.c */
143 typedef BOOL (CALLBACK *APPENUMPROC)(INT ItemIndex, LPWSTR lpName, PINSTALLED_INFO Info);
144 BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc);
145 BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR lpString);
146 BOOL ShowInstalledAppInfo(INT Index);
147 BOOL UninstallApplication(INT Index, BOOL bModify);
148 BOOL IsInstalledApplication(LPCWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow);
149 VOID RemoveAppFromRegistry(INT Index);
150
151 BOOL InstalledVersion(LPWSTR szVersionResult, UINT iVersionResultSize, LPCWSTR lpRegName, BOOL IsUserKey, REGSAM keyWow);
152
153 /* winmain.c */
154 extern HWND hMainWnd;
155 extern HINSTANCE hInst;
156 extern INT SelectedEnumType;
157 extern SETTINGS_INFO SettingsInfo;
158 VOID SaveSettings(HWND hwnd);
159 VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo);
160
161 /* loaddlg.c */
162 BOOL DownloadApplication(INT Index);
163 VOID DownloadApplicationsDB(LPCWSTR lpUrl);
164
165 /* misc.c */
166 INT GetSystemColorDepth(VOID);
167 int GetWindowWidth(HWND hwnd);
168 int GetWindowHeight(HWND hwnd);
169 int GetClientWindowWidth(HWND hwnd);
170 int GetClientWindowHeight(HWND hwnd);
171 VOID CopyTextToClipboard(LPCWSTR lpszText);
172 VOID SetWelcomeText(VOID);
173 VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem);
174 BOOL StartProcess(LPWSTR lpPath, BOOL Wait);
175 BOOL GetStorageDirectory(PWCHAR lpDirectory, DWORD cch);
176 BOOL ExtractFilesFromCab(LPWSTR lpCabName, LPWSTR lpOutputPath);
177 VOID InitLogs(VOID);
178 VOID FreeLogs(VOID);
179 BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPWSTR lpMsg);
180
181 UINT ParserGetString(LPCWSTR lpKeyName, LPWSTR lpReturnedString, UINT nSize, LPCWSTR lpFileName);
182 UINT ParserGetInt(LPCWSTR lpKeyName, LPCWSTR lpFileName);
183
184 BOOL FindRegistryKeyByName(_In_ HKEY hKeyBase, _In_ REGSAM keyWow, _In_ LPCWSTR lpcKey, _Out_opt_ PHKEY hKeyResult);
185
186 /* settingsdlg.c */
187 VOID CreateSettingsDlg(HWND hwnd);
188
189 /* gui.cpp */
190 HWND CreateMainWindow();
191 DWORD_PTR ListViewGetlParam(INT item);
192 INT ListViewAddItem(INT ItemIndex, INT IconIndex, PWSTR lpName, LPARAM lParam);
193 VOID SetStatusBarText(PCWSTR szText);
194 VOID NewRichEditText(PCWSTR szText, DWORD flags);
195 VOID InsertRichEditText(PCWSTR szText, DWORD flags);
196 extern HWND hListView;
197 extern WCHAR szSearchPattern[MAX_STR_LEN];
198
199 /* integrity.cpp */
200 BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName);
201
202 //extern HWND hTreeView;
203 //BOOL CreateTreeView(HWND hwnd);
204 //HTREEITEM TreeViewAddItem(HTREEITEM hParent, LPWSTR lpText, INT Image, INT SelectedImage, LPARAM lParam);
205
206
207 #endif /* _RAPPS_H */