d92eafed56a7655feb350d199b0fa1f26f552906
[reactos.git] / reactos / base / applications / rapps / rapps.h
1 #ifndef _RAPPS_H
2 #define _RAPPS_H
3
4 #include <stdarg.h>
5
6 #define WIN32_NO_STATUS
7 #define _INC_WINDOWS
8 #define COM_NO_WINDOWS_H
9 #define COBJMACROS
10
11 #include <windef.h>
12 #include <winbase.h>
13 #include <winreg.h>
14 #include <wingdi.h>
15 #include <winnls.h>
16 #include <winuser.h>
17 #include <wincon.h>
18 #include <richedit.h>
19 #include <shlobj.h>
20 #include <shlwapi.h>
21 #include <stdio.h>
22 #include <strsafe.h>
23 #include <ndk/rtlfuncs.h>
24
25 #include <rappsmsg.h>
26
27 #include "resource.h"
28
29 /* FIXME: this should be downloaded by HTTPS once is supported */
30 #define APPLICATION_DATABASE_URL L"http://svn.reactos.org/packages/rappmgr.cab"
31
32 #define SPLIT_WIDTH 4
33 #define MAX_STR_LEN 256
34
35 #define LISTVIEW_ICON_SIZE 24
36 #define TREEVIEW_ICON_SIZE 24
37
38 /* EnumType flags for EnumInstalledApplications */
39 #define ENUM_ALL_COMPONENTS 30
40 #define ENUM_APPLICATIONS 31
41 #define ENUM_UPDATES 32
42 /* EnumType flags for EnumAvailableApplications */
43 #define ENUM_ALL_AVAILABLE 0
44 #define ENUM_CAT_AUDIO 1
45 #define ENUM_CAT_VIDEO 2
46 #define ENUM_CAT_GRAPHICS 3
47 #define ENUM_CAT_GAMES 4
48 #define ENUM_CAT_INTERNET 5
49 #define ENUM_CAT_OFFICE 6
50 #define ENUM_CAT_DEVEL 7
51 #define ENUM_CAT_EDU 8
52 #define ENUM_CAT_ENGINEER 9
53 #define ENUM_CAT_FINANCE 10
54 #define ENUM_CAT_SCIENCE 11
55 #define ENUM_CAT_TOOLS 12
56 #define ENUM_CAT_DRIVERS 13
57 #define ENUM_CAT_LIBS 14
58 #define ENUM_CAT_OTHER 15
59
60 #define ENUM_INSTALLED_MIN ENUM_ALL_COMPONENTS
61 #define ENUM_INSTALLED_MAX ENUM_UPDATES
62 #define ENUM_AVAILABLE_MIN ENUM_ALL_AVAILABLE
63 #define ENUM_AVAILABLE_MAX ENUM_CAT_OTHER
64
65 #define IS_INSTALLED_ENUM(a) (a >= ENUM_INSTALLED_MIN && a <= ENUM_INSTALLED_MAX)
66 #define IS_AVAILABLE_ENUM(a) (a >= ENUM_AVAILABLE_MIN && a <= ENUM_AVAILABLE_MAX)
67
68 /* aboutdlg.c */
69 VOID ShowAboutDialog(VOID);
70
71 /* available.c */
72 typedef struct
73 {
74 INT Category;
75 WCHAR szName[MAX_PATH];
76 WCHAR szRegName[MAX_PATH];
77 WCHAR szVersion[MAX_PATH];
78 WCHAR szLicense[MAX_PATH];
79 WCHAR szDesc[MAX_PATH];
80 WCHAR szSize[MAX_PATH];
81 WCHAR szUrlSite[MAX_PATH];
82 WCHAR szUrlDownload[MAX_PATH];
83 WCHAR szCDPath[MAX_PATH];
84
85 /* caching mechanism related entries */
86 WCHAR cFileName[MAX_PATH];
87 FILETIME ftCacheStamp;
88 LIST_ENTRY List;
89
90 /* optional integrity checks */
91 BYTE MD5Checksum[16];
92
93 } APPLICATION_INFO, *PAPPLICATION_INFO;
94
95 typedef struct
96 {
97 HKEY hRootKey;
98 HKEY hSubKey;
99 WCHAR szKeyName[MAX_PATH];
100
101 } INSTALLED_INFO, *PINSTALLED_INFO;
102
103 typedef struct
104 {
105 BOOL bSaveWndPos;
106 BOOL bUpdateAtStart;
107 BOOL bLogEnabled;
108 WCHAR szDownloadDir[MAX_PATH];
109 BOOL bDelInstaller;
110 /* Window Pos */
111 BOOL Maximized;
112 INT Left;
113 INT Top;
114 INT Width;
115 INT Height;
116 /* Proxy settings */
117 INT Proxy;
118 WCHAR szProxyServer[MAX_PATH];
119 WCHAR szNoProxyFor[MAX_PATH];
120
121 } SETTINGS_INFO, *PSETTINGS_INFO;
122
123 /* available.c */
124 typedef BOOL (CALLBACK *AVAILENUMPROC)(PAPPLICATION_INFO Info);
125 BOOL EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc);
126 BOOL ShowAvailableAppInfo(INT Index);
127 BOOL UpdateAppsDB(VOID);
128 VOID FreeCachedAvailableEntries(VOID);
129
130 /* installdlg.c */
131 BOOL InstallApplication(INT Index);
132
133 /* installed.c */
134 typedef BOOL (CALLBACK *APPENUMPROC)(INT ItemIndex, LPWSTR lpName, PINSTALLED_INFO Info);
135 BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc);
136 BOOL GetApplicationString(HKEY hKey, LPWSTR lpKeyName, LPWSTR lpString);
137 BOOL ShowInstalledAppInfo(INT Index);
138 BOOL UninstallApplication(INT Index, BOOL bModify);
139 BOOL IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey);
140 VOID RemoveAppFromRegistry(INT Index);
141
142 /* winmain.c */
143 extern HWND hMainWnd;
144 extern HINSTANCE hInst;
145 extern INT SelectedEnumType;
146 extern SETTINGS_INFO SettingsInfo;
147 VOID SaveSettings(HWND hwnd);
148 VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo);
149
150 /* listview.c */
151 extern HWND hListView;
152 extern BOOL bAscending;
153 BOOL CreateListView(HWND hwnd);
154 BOOL ListViewAddColumn(INT Index, LPWSTR lpText, INT Width, INT Format);
155 INT ListViewAddItem(INT ItemIndex, INT IconIndex, LPWSTR lpText, LPARAM lParam);
156 INT CALLBACK ListViewCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
157 PVOID ListViewGetlParam(INT Index);
158
159 /* loaddlg.c */
160 BOOL DownloadApplication(INT Index);
161 VOID DownloadApplicationsDB(LPWSTR lpUrl);
162
163 /* misc.c */
164 INT GetSystemColorDepth(VOID);
165 int GetWindowWidth(HWND hwnd);
166 int GetWindowHeight(HWND hwnd);
167 int GetClientWindowWidth(HWND hwnd);
168 int GetClientWindowHeight(HWND hwnd);
169 VOID CopyTextToClipboard(LPCWSTR lpszText);
170 VOID SetWelcomeText(VOID);
171 VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem);
172 BOOL StartProcess(LPWSTR lpPath, BOOL Wait);
173 BOOL GetStorageDirectory(PWCHAR lpDirectory, DWORD cch);
174 BOOL ExtractFilesFromCab(LPWSTR lpCabName, LPWSTR lpOutputPath);
175 VOID InitLogs(VOID);
176 VOID FreeLogs(VOID);
177 BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPWSTR lpMsg);
178
179 UINT ParserGetString(LPCWSTR lpKeyName, LPWSTR lpReturnedString, UINT nSize, LPCWSTR lpFileName);
180 UINT ParserGetInt(LPCWSTR lpKeyName, LPCWSTR lpFileName);
181
182 /* richedit.c */
183 extern HWND hRichEdit;
184 extern PWSTR pLink;
185 BOOL CreateRichEdit(HWND hwnd);
186 VOID RichEditOnLink(HWND hwnd, ENLINK *Link);
187 VOID InsertRichEditText(LPCWSTR lpszText, DWORD dwEffects);
188 VOID NewRichEditText(LPCWSTR lpszText, DWORD dwEffects);
189
190 /* settingsdlg.c */
191 VOID CreateSettingsDlg(HWND hwnd);
192
193 /* splitter.c */
194 extern HWND hVSplitter;
195 extern HWND hHSplitter;
196 BOOL CreateVSplitBar(HWND hwnd);
197 BOOL CreateHSplitBar(HWND hwnd);
198 int GetHSplitterPos(VOID);
199 VOID SetHSplitterPos(int Pos);
200
201 /* statusbar.c */
202 extern HWND hStatusBar;
203 BOOL CreateStatusBar(HWND hwnd);
204 VOID SetStatusBarText(LPCWSTR lpszText);
205
206 /* toolbar.c */
207 extern HWND hToolBar;
208 extern HWND hSearchBar;
209 BOOL CreateToolBar(HWND hwnd);
210 VOID ToolBarOnGetDispInfo(LPTOOLTIPTEXT lpttt);
211
212 /* treeview.c */
213 extern HWND hTreeView;
214 BOOL CreateTreeView(HWND hwnd);
215 HTREEITEM TreeViewAddItem(HTREEITEM hParent, LPWSTR lpText, INT Image, INT SelectedImage, LPARAM lParam);
216
217 #endif /* _RAPPS_H */