mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
Updater: Fixed warning; Minor fixes;
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5317 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -68,14 +68,14 @@ EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "Process Hacker Updater"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Close",IDOK,203,68,50,14
|
||||
CONTROL "Update to the latest version?",IDC_MESSAGE,"Static",SS_SIMPLE | SS_NOPREFIX | SS_WORDELLIPSIS | WS_GROUP,55,5,192,18,WS_EX_TRANSPARENT
|
||||
CONTROL "",IDC_RELDATE,"Static",SS_SIMPLE | SS_NOPREFIX | SS_WORDELLIPSIS | WS_GROUP,55,22,192,9,WS_EX_TRANSPARENT
|
||||
PUSHBUTTON "Start",IDC_DOWNLOAD,149,68,50,14
|
||||
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | NOT WS_VISIBLE,7,53,245,11
|
||||
CONTROL "",IDC_UPDATEICON,"Static",SS_BITMAP | SS_CENTERIMAGE,8,5,40,45,WS_EX_TRANSPARENT
|
||||
CONTROL "",IDC_STATUS,"Static",SS_SIMPLE | SS_NOPREFIX | SS_WORDELLIPSIS | WS_GROUP,7,71,135,8,WS_EX_TRANSPARENT
|
||||
CONTROL "<a>View Latest Changelog</a>",IDC_INFOSYSLINK,"SysLink",NOT WS_VISIBLE | WS_TABSTOP,55,35,89,10
|
||||
DEFPUSHBUTTON "Close",IDOK,203,70,50,14
|
||||
CONTROL "Check for new releases?",IDC_MESSAGE,"Static",SS_SIMPLE | SS_NOPREFIX | SS_WORDELLIPSIS | WS_GROUP,55,7,197,18,WS_EX_TRANSPARENT
|
||||
CONTROL "",IDC_RELDATE,"Static",SS_SIMPLE | SS_NOPREFIX | SS_WORDELLIPSIS | WS_GROUP,56,24,192,9,WS_EX_TRANSPARENT
|
||||
PUSHBUTTON "Start",IDC_DOWNLOAD,149,70,50,14
|
||||
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | NOT WS_VISIBLE,7,54,245,11
|
||||
CONTROL "",IDC_UPDATEICON,"Static",SS_BITMAP | SS_CENTERIMAGE,7,7,40,45,WS_EX_TRANSPARENT
|
||||
CONTROL "",IDC_STATUS,"Static",SS_SIMPLE | SS_NOPREFIX | SS_WORDELLIPSIS | WS_GROUP,7,72,135,8,WS_EX_TRANSPARENT
|
||||
CONTROL "<a>View Changelog</a>",IDC_INFOSYSLINK,"SysLink",NOT WS_VISIBLE | WS_TABSTOP,56,37,89,9
|
||||
END
|
||||
|
||||
IDD_OPTIONS DIALOGEX 0, 0, 215, 54
|
||||
@@ -103,7 +103,7 @@ BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 252
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 82
|
||||
BOTTOMMARGIN, 84
|
||||
END
|
||||
|
||||
IDD_OPTIONS, DIALOG
|
||||
|
||||
@@ -186,15 +186,14 @@ BOOL ConnectionAvailable(
|
||||
{
|
||||
BOOLEAN isSuccess = FALSE;
|
||||
DWORD wininetState = 0;
|
||||
HMODULE wininetHandle = NULL;
|
||||
_InternetGetConnectedState InternetGetConnectedState_I = NULL;
|
||||
static HMODULE wininetHandle = NULL;
|
||||
|
||||
NOT_SUPPORTED_OS:
|
||||
|
||||
__try
|
||||
{
|
||||
wininetHandle = LoadLibrary(L"wininet.dll");
|
||||
if (!wininetHandle)
|
||||
if (!(wininetHandle = LoadLibrary(L"wininet.dll")))
|
||||
__leave;
|
||||
|
||||
InternetGetConnectedState_I = (_InternetGetConnectedState)GetProcAddress(wininetHandle, "InternetGetConnectedState");
|
||||
|
||||
@@ -22,10 +22,8 @@
|
||||
|
||||
#include "updater.h"
|
||||
|
||||
#include <Wincodec.h>
|
||||
#pragma comment(lib, "windowscodecs.lib")
|
||||
// Force update checks to succeed with debug builds
|
||||
#define DEBUG_UPDATE
|
||||
//#define DEBUG_UPDATE
|
||||
|
||||
#define PH_UPDATEISERRORED (WM_APP + 101)
|
||||
#define PH_UPDATEAVAILABLE (WM_APP + 102)
|
||||
@@ -42,7 +40,7 @@ static HICON IconHandle = NULL;
|
||||
static HFONT FontHandle = NULL;
|
||||
static PH_EVENT InitializedEvent = PH_EVENT_INIT;
|
||||
|
||||
HBITMAP LoadImageFromResources(
|
||||
static HBITMAP LoadImageFromResources(
|
||||
__in LPCTSTR lpName,
|
||||
__in LPCTSTR lpType
|
||||
)
|
||||
@@ -138,7 +136,6 @@ HBITMAP LoadImageFromResources(
|
||||
return bitmapHandle;
|
||||
}
|
||||
|
||||
|
||||
static mxml_type_t QueryXmlDataCallback(
|
||||
__in mxml_node_t *node
|
||||
)
|
||||
@@ -713,11 +710,8 @@ static NTSTATUS UpdateDownloadThread(
|
||||
ZeroMemory(buffer, PAGE_SIZE);
|
||||
|
||||
// Download the data.
|
||||
while (TRUE)
|
||||
{
|
||||
if (!WinHttpReadData(requestHandle, buffer, PAGE_SIZE, &bytesDownloaded))
|
||||
break;
|
||||
|
||||
while (WinHttpReadData(requestHandle, buffer, PAGE_SIZE, &bytesDownloaded))
|
||||
{
|
||||
// If we get zero bytes, the file was uploaded or there was an error
|
||||
if (bytesDownloaded == 0)
|
||||
break;
|
||||
@@ -898,22 +892,28 @@ static INT_PTR CALLBACK UpdaterWndProc(
|
||||
LR_SHARED
|
||||
);
|
||||
|
||||
// Set the window icons
|
||||
if (IconHandle)
|
||||
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IconHandle);
|
||||
|
||||
// Set the text font
|
||||
if (FontHandle)
|
||||
SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), WM_SETFONT, (WPARAM)FontHandle, FALSE);
|
||||
|
||||
// Set the window icons
|
||||
if (IconHandle)
|
||||
SendMessage(hwndDlg, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)IconHandle);
|
||||
|
||||
context->SourceforgeBitmap = LoadImageFromResources(MAKEINTRESOURCE(IDB_SF_PNG), L"PNG");
|
||||
|
||||
SendMessage(
|
||||
GetDlgItem(hwndDlg, IDC_UPDATEICON),
|
||||
STM_SETIMAGE,
|
||||
IMAGE_BITMAP,
|
||||
(LPARAM)context->SourceforgeBitmap
|
||||
context->SourceforgeBitmap = LoadImageFromResources(
|
||||
MAKEINTRESOURCE(IDB_SF_PNG),
|
||||
L"PNG"
|
||||
);
|
||||
|
||||
if (context->SourceforgeBitmap)
|
||||
{
|
||||
SendMessage(
|
||||
GetDlgItem(hwndDlg, IDC_UPDATEICON),
|
||||
STM_SETIMAGE,
|
||||
IMAGE_BITMAP,
|
||||
(LPARAM)context->SourceforgeBitmap
|
||||
);
|
||||
}
|
||||
|
||||
// Center the update window on PH if it's visible else we center on the desktop.
|
||||
PhCenterWindow(hwndDlg, (IsWindowVisible(parentWindow) && !IsIconic(parentWindow)) ? parentWindow : NULL);
|
||||
@@ -999,16 +999,16 @@ static INT_PTR CALLBACK UpdaterWndProc(
|
||||
|
||||
// Disable the download button
|
||||
Button_Enable(GetDlgItem(hwndDlg, IDC_DOWNLOAD), FALSE);
|
||||
|
||||
// Reset the progress bar (might be a download retry)
|
||||
SendDlgItemMessage(hwndDlg, IDC_PROGRESS, PBM_SETPOS, 0, 0);
|
||||
|
||||
if (WindowsVersion > WINDOWS_XP)
|
||||
SendDlgItemMessage(hwndDlg, IDC_PROGRESS, PBM_SETSTATE, PBST_NORMAL, 0);
|
||||
|
||||
// Start our Downloader thread
|
||||
if (downloadThreadHandle = PhCreateThread(0, (PUSER_THREAD_START_ROUTINE)UpdateDownloadThread, context))
|
||||
{
|
||||
NtClose(downloadThreadHandle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1116,7 +1116,8 @@ static INT_PTR CALLBACK UpdaterWndProc(
|
||||
// Set the UI text
|
||||
SetDlgItemText(hwndDlg, IDC_MESSAGE, L"You're running the latest version.");
|
||||
SetDlgItemText(hwndDlg, IDC_RELDATE, versionText->Buffer);
|
||||
|
||||
Control_Visible(GetDlgItem(hwndDlg, IDC_INFOSYSLINK), TRUE);
|
||||
|
||||
// Disable the download button
|
||||
Button_Enable(GetDlgItem(hwndDlg, IDC_DOWNLOAD), FALSE);
|
||||
|
||||
@@ -1140,7 +1141,8 @@ static INT_PTR CALLBACK UpdaterWndProc(
|
||||
|
||||
// Disable the download button
|
||||
Button_Enable(GetDlgItem(hwndDlg, IDC_DOWNLOAD), FALSE);
|
||||
|
||||
Control_Visible(GetDlgItem(hwndDlg, IDC_INFOSYSLINK), TRUE);
|
||||
|
||||
// free text
|
||||
PhDereferenceObject(versionText);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define __UPDATER_H__
|
||||
|
||||
#pragma comment(lib, "Winhttp.lib")
|
||||
#pragma comment(lib, "WindowsCodecs.lib")
|
||||
|
||||
#include <phdk.h>
|
||||
#include <phappresource.h>
|
||||
@@ -11,6 +12,7 @@
|
||||
#include <windowsx.h>
|
||||
#include <netlistmgr.h>
|
||||
#include <winhttp.h>
|
||||
#include <Wincodec.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user