Process Hacker
updater.h
Go to the documentation of this file.
1 /*
2  * Process Hacker Plugins -
3  * Update Checker Plugin
4  *
5  * Copyright (C) 2011-2015 dmex
6  *
7  * This file is part of Process Hacker.
8  *
9  * Process Hacker is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * Process Hacker is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef __UPDATER_H__
24 #define __UPDATER_H__
25 
26 #pragma comment(lib, "Winhttp.lib")
27 
28 #define CINTERFACE
29 #define COBJMACROS
30 #define INITGUID
31 #include <phdk.h>
32 #include <phappresource.h>
33 #include <mxml.h>
34 #include <windowsx.h>
35 #include <netlistmgr.h>
36 #include <winhttp.h>
37 #include <Wincodec.h>
38 
39 #include "resource.h"
40 
41 // Force update checks to succeed with debug builds
42 //#define DEBUG_UPDATE
43 #define UPDATE_MENUITEM 1001
44 #define PH_UPDATEISERRORED (WM_APP + 101)
45 #define PH_UPDATEAVAILABLE (WM_APP + 102)
46 #define PH_UPDATEISCURRENT (WM_APP + 103)
47 #define PH_UPDATENEWER (WM_APP + 104)
48 #define PH_UPDATESUCCESS (WM_APP + 105)
49 #define PH_UPDATEFAILURE (WM_APP + 106)
50 #define WM_SHOWDIALOG (WM_APP + 150)
51 
52 #define PLUGIN_NAME L"ProcessHacker.UpdateChecker"
53 #define SETTING_NAME_AUTO_CHECK (PLUGIN_NAME L".PromptStart")
54 
55 #define MAKEDLLVERULL(major, minor, build, revision) \
56  (((ULONGLONG)(major) << 48) | \
57  ((ULONGLONG)(minor) << 32) | \
58  ((ULONGLONG)(build) << 16) | \
59  ((ULONGLONG)(revision) << 0))
60 
61 #define Control_Visible(hWnd, visible) \
62  ShowWindow(hWnd, visible ? SW_SHOW : SW_HIDE);
63 
65 
66 typedef enum _PH_UPDATER_STATE
67 {
73 
74 typedef struct _PH_UPDATER_CONTEXT
75 {
76  BOOLEAN HaveData;
78  HBITMAP IconBitmap;
79  HICON IconHandle;
80  HFONT FontHandle;
84 
85  ULONG MinorVersion;
86  ULONG MajorVersion;
101 
103  _In_opt_ PPH_UPDATER_CONTEXT Context
104  );
105 
107  VOID
108  );
109 
111  _In_ mxml_node_t *xmlNode
112  );
113 
115  VOID
116  );
117 
118 INT_PTR CALLBACK UpdaterWndProc(
119  _In_ HWND hwndDlg,
120  _In_ UINT uMsg,
121  _In_ WPARAM wParam,
122  _In_ LPARAM lParam
123  );
124 
125 INT_PTR CALLBACK OptionsDlgProc(
126  _In_ HWND hwndDlg,
127  _In_ UINT uMsg,
128  _In_ WPARAM wParam,
129  _In_ LPARAM lParam
130  );
131 
132 #endif