Changed calling updater thread.

This commit is contained in:
2023-11-07 17:55:47 +03:00
parent 0403415607
commit b855b0d624
4 changed files with 10 additions and 4 deletions

View File

@@ -26,7 +26,8 @@ void FillVersionStructure(Version& ver, const std::wstring& str);
std::vector<std::wstring> Split(const std::wstring& s, wchar_t delim); std::vector<std::wstring> Split(const std::wstring& s, wchar_t delim);
std::wstring ConvertUtf8ToWide(const std::string& str); std::wstring ConvertUtf8ToWide(const std::string& str);
DWORD WINAPI Updater(LPVOID) //DWORD WINAPI Updater(LPVOID)
UINT WINAPI Updater(LPVOID)
{ {
LOG_TO_FILE(L"Entering the %s() function", TEXT(__FUNCTION__)); LOG_TO_FILE(L"Entering the %s() function", TEXT(__FUNCTION__));
@@ -115,7 +116,8 @@ DWORD WINAPI Updater(LPVOID)
LOG_TO_FILE(L"[UPDT] Exit from the %s() function", TEXT(__FUNCTION__)); LOG_TO_FILE(L"[UPDT] Exit from the %s() function", TEXT(__FUNCTION__));
return 0; //return 0;
_endthreadex(0);
} }
bool GetLatestRelease(const std::wstring& urn) bool GetLatestRelease(const std::wstring& urn)

View File

@@ -2,4 +2,5 @@
// updater.h // updater.h
// //
#pragma once #pragma once
DWORD WINAPI Updater(LPVOID); //DWORD WINAPI Updater(LPVOID);
UINT WINAPI Updater(void*);

View File

@@ -25,6 +25,7 @@ WCHAR szClass[MAX_LOADSTRING]; // Window's class
WCHAR szWinTitle[256]; WCHAR szWinTitle[256];
WCHAR szWinClass[256]; WCHAR szWinClass[256];
HANDLE hHeap = NULL, hUpdater = NULL; HANDLE hHeap = NULL, hUpdater = NULL;
UINT dwUpdaterID = 0;
HHOOK hMouseHook = NULL, hKbdHook = NULL; // Hook's handles HHOOK hMouseHook = NULL, hKbdHook = NULL; // Hook's handles
HICON hIcon = NULL; HICON hIcon = NULL;
HMENU hMenu = NULL, hPopup = NULL; HMENU hMenu = NULL, hPopup = NULL;
@@ -278,7 +279,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
LOG_TO_FILE(L"%s(%d): Checking for updates is enabled, fCheckUpdates = %s", TEXT(__FUNCTION__), __LINE__, fCheckUpdates ? L"True" : L"False"); LOG_TO_FILE(L"%s(%d): Checking for updates is enabled, fCheckUpdates = %s", TEXT(__FUNCTION__), __LINE__, fCheckUpdates ? L"True" : L"False");
hUpdater = CreateThread(NULL, 0, &Updater, nullptr, 0, nullptr); //hUpdater = CreateThread(NULL, 0, &Updater, nullptr, 0, nullptr);
hUpdater = (HANDLE)_beginthreadex(NULL, 0, &Updater, NULL, 0, &dwUpdaterID);
if (NULL == hUpdater) if (NULL == hUpdater)
{ {
DWORD dwLastError = GetLastError(); DWORD dwLastError = GetLastError();

View File

@@ -15,6 +15,7 @@
#include <wininet.h> #include <wininet.h>
#include <shellapi.h> #include <shellapi.h>
#include <CommCtrl.h> #include <CommCtrl.h>
#include <process.h>
// VerionInfo header file // VerionInfo header file
#include "VersionInfo.h" #include "VersionInfo.h"