@@ -51,13 +51,14 @@ HRESULT CALLBACK FinalTaskDialogCallbackProc(
51
51
break ;
52
52
case TDN_BUTTON_CLICKED :
53
53
{
54
- if ((INT )wParam == IDRETRY )
54
+ INT buttonId = (INT )wParam ;
55
+
56
+ if (buttonId == IDRETRY )
55
57
{
56
58
ShowCheckingForUpdatesDialog (context );
57
59
return S_FALSE ;
58
60
}
59
-
60
- if ((INT )wParam == IDYES )
61
+ else if (buttonId == IDYES )
61
62
{
62
63
SHELLEXECUTEINFO info = { sizeof (SHELLEXECUTEINFO ) };
63
64
@@ -109,62 +110,81 @@ VOID ShowUpdateInstallDialog(
109
110
config .dwFlags = TDF_USE_HICON_MAIN | TDF_ALLOW_DIALOG_CANCELLATION | TDF_CAN_BE_MINIMIZED ;
110
111
config .dwCommonButtons = TDCBF_CLOSE_BUTTON ;
111
112
config .hMainIcon = Context -> IconLargeHandle ;
113
+ config .cxWidth = 200 ;
114
+ config .pfCallback = FinalTaskDialogCallbackProc ;
115
+ config .lpCallbackData = (LONG_PTR )Context ;
116
+ config .pButtons = TaskDialogButtonArray ;
117
+ config .cButtons = ARRAYSIZE (TaskDialogButtonArray );
112
118
113
119
config .pszWindowTitle = L"Process Hacker - Updater" ;
114
120
config .pszMainInstruction = L"Ready to install update" ;
115
121
config .pszContent = L"The update has been successfully downloaded and verified.\r\n\r\nClick Install to continue." ;
116
122
117
- config .pButtons = TaskDialogButtonArray ;
118
- config .cButtons = ARRAYSIZE (TaskDialogButtonArray );
119
-
120
- config .cxWidth = 200 ;
121
- config .pfCallback = FinalTaskDialogCallbackProc ;
122
- config .lpCallbackData = (LONG_PTR )Context ;
123
-
124
123
SendMessage (Context -> DialogHandle , TDM_NAVIGATE_PAGE , 0 , (LPARAM )& config );
125
124
}
126
125
127
126
VOID ShowLatestVersionDialog (
128
127
_In_ PPH_UPDATER_CONTEXT Context
129
128
)
130
129
{
131
- PPH_UPDATER_CONTEXT context ;
132
130
TASKDIALOGCONFIG config ;
133
131
134
- context = (PPH_UPDATER_CONTEXT )Context ;
135
-
136
132
memset (& config , 0 , sizeof (TASKDIALOGCONFIG ));
137
133
config .cbSize = sizeof (TASKDIALOGCONFIG );
138
134
config .dwFlags = TDF_USE_HICON_MAIN | TDF_ALLOW_DIALOG_CANCELLATION | TDF_CAN_BE_MINIMIZED | TDF_ENABLE_HYPERLINKS ;
139
135
config .dwCommonButtons = TDCBF_CLOSE_BUTTON ;
140
- config .hMainIcon = context -> IconLargeHandle ;
136
+ config .hMainIcon = Context -> IconLargeHandle ;
137
+ config .cxWidth = 200 ;
138
+ config .pfCallback = FinalTaskDialogCallbackProc ;
139
+ config .lpCallbackData = (LONG_PTR )Context ;
141
140
142
141
config .pszWindowTitle = L"Process Hacker - Updater" ;
143
142
144
143
if (PhGetIntegerSetting (SETTING_NAME_NIGHTLY_BUILD ))
145
144
{
146
- config .pszMainInstruction = L"You're running the latest nightly build." ;
145
+ LARGE_INTEGER time ;
146
+ SYSTEMTIME systemTime = { 0 };
147
+ SYSTEMTIME localTime = { 0 };
148
+ PIMAGE_DOS_HEADER imageDosHeader ;
149
+ PIMAGE_NT_HEADERS imageNtHeader ;
150
+
151
+ // HACK
152
+ imageDosHeader = (PIMAGE_DOS_HEADER )PluginInstance -> DllBase ;
153
+ imageNtHeader = (PIMAGE_NT_HEADERS )PTR_ADD_OFFSET (PluginInstance -> DllBase , (ULONG )imageDosHeader -> e_lfanew );
154
+
155
+ RtlSecondsSince1970ToTime (imageNtHeader -> FileHeader .TimeDateStamp , & time );
156
+ PhLargeIntegerToLocalSystemTime (& systemTime , & time );
157
+ SystemTimeToTzSpecificLocalTime (NULL , & systemTime , & localTime );
158
+
159
+ config .pszMainInstruction = L"You're running the latest nightly build" ;
147
160
config .pszContent = PhaFormatString (
148
- L"Alpha build: v%lu.%lu.%lu" ,
149
- context -> CurrentMajorVersion ,
150
- context -> CurrentMinorVersion ,
151
- context -> CurrentRevisionVersion
161
+ L"Version: v%lu.%lu.%lu\r\nCompiled: %s" ,
162
+ Context -> CurrentMajorVersion ,
163
+ Context -> CurrentMinorVersion ,
164
+ Context -> CurrentRevisionVersion ,
165
+ PhaFormatDateTime (& localTime )-> Buffer
152
166
)-> Buffer ;
167
+
168
+ if (PhIsNullOrEmptyString (Context -> BuildMessage ))
169
+ config .pszExpandedInformation = L"<A HREF=\"executablestring\">View Changelog</A>" ;
170
+ else
171
+ config .pszExpandedInformation = PhGetStringOrEmpty (Context -> BuildMessage );
153
172
}
154
173
else
155
174
{
156
- config .pszMainInstruction = L"You're running the latest version. " ;
175
+ config .pszMainInstruction = L"You're running the latest version" ;
157
176
config .pszContent = PhaFormatString (
158
- L"Stable release build: v%lu.%lu.%lu\r\n\r\n<A HREF=\"executablestring\">View Changelog</A> " ,
159
- context -> CurrentMajorVersion ,
160
- context -> CurrentMinorVersion ,
161
- context -> CurrentRevisionVersion
177
+ L"Stable release build: v%lu.%lu.%lu\r\n\r\n" ,
178
+ Context -> CurrentMajorVersion ,
179
+ Context -> CurrentMinorVersion ,
180
+ Context -> CurrentRevisionVersion
162
181
)-> Buffer ;
163
- }
164
182
165
- config .cxWidth = 200 ;
166
- config .pfCallback = FinalTaskDialogCallbackProc ;
167
- config .lpCallbackData = (LONG_PTR )Context ;
183
+ if (PhIsNullOrEmptyString (Context -> BuildMessage ))
184
+ config .pszExpandedInformation = L"<A HREF=\"executablestring\">View Changelog</A>" ;
185
+ else
186
+ config .pszExpandedInformation = PhGetStringOrEmpty (Context -> BuildMessage );
187
+ }
168
188
169
189
SendMessage (Context -> DialogHandle , TDM_NAVIGATE_PAGE , 0 , (LPARAM )& config );
170
190
}
@@ -173,16 +193,13 @@ VOID ShowNewerVersionDialog(
173
193
_In_ PPH_UPDATER_CONTEXT Context
174
194
)
175
195
{
176
- PPH_UPDATER_CONTEXT context ;
177
196
TASKDIALOGCONFIG config ;
178
197
179
- context = (PPH_UPDATER_CONTEXT )Context ;
180
-
181
198
memset (& config , 0 , sizeof (TASKDIALOGCONFIG ));
182
199
config .cbSize = sizeof (TASKDIALOGCONFIG );
183
200
config .dwFlags = TDF_USE_HICON_MAIN | TDF_ALLOW_DIALOG_CANCELLATION | TDF_CAN_BE_MINIMIZED ;
184
201
config .dwCommonButtons = TDCBF_CLOSE_BUTTON ;
185
- config .hMainIcon = context -> IconLargeHandle ;
202
+ config .hMainIcon = Context -> IconLargeHandle ;
186
203
187
204
config .pszWindowTitle = L"Process Hacker - Updater" ;
188
205
@@ -191,19 +208,19 @@ VOID ShowNewerVersionDialog(
191
208
config .pszMainInstruction = L"You're running the latest nightly build" ;
192
209
config .pszContent = PhaFormatString (
193
210
L"Pre-release build: v%lu.%lu.%lu\r\n" ,
194
- context -> CurrentMajorVersion ,
195
- context -> CurrentMinorVersion ,
196
- context -> CurrentRevisionVersion
211
+ Context -> CurrentMajorVersion ,
212
+ Context -> CurrentMinorVersion ,
213
+ Context -> CurrentRevisionVersion
197
214
)-> Buffer ;
198
215
}
199
216
else
200
217
{
201
218
config .pszMainInstruction = L"You're running a pre-release version!" ;
202
219
config .pszContent = PhaFormatString (
203
220
L"Pre-release build: v%lu.%lu.%lu\r\n" ,
204
- context -> CurrentMajorVersion ,
205
- context -> CurrentMinorVersion ,
206
- context -> CurrentRevisionVersion
221
+ Context -> CurrentMajorVersion ,
222
+ Context -> CurrentMinorVersion ,
223
+ Context -> CurrentRevisionVersion
207
224
)-> Buffer ;
208
225
}
209
226
0 commit comments