mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2025-02-17 11:08:41 +01:00
Fixed automatic updates; improved setup
This commit is contained in:
parent
140866e3de
commit
bcc1bca3d0
@ -71,11 +71,11 @@ BOOL IsUpdateAvailableHelper(char* url, char* szCheckAgainst, DWORD dwUpdateTime
|
||||
INTERNET_OPEN_TYPE_PRECONFIG,
|
||||
NULL,
|
||||
NULL,
|
||||
INTERNET_FLAG_ASYNC
|
||||
0 //INTERNET_FLAG_ASYNC
|
||||
))
|
||||
{
|
||||
InternetSetOptionA(hInternet, INTERNET_OPTION_CONNECT_TIMEOUT, &dwUpdateTimeout, sizeof(DWORD));
|
||||
if (InternetSetStatusCallbackA(hInternet, IsUpdateAvailableHelperCallback) != INTERNET_INVALID_STATUS_CALLBACK)
|
||||
//InternetSetOptionA(hInternet, INTERNET_OPTION_CONNECT_TIMEOUT, &dwUpdateTimeout, sizeof(DWORD));
|
||||
//if (InternetSetStatusCallbackA(hInternet, IsUpdateAvailableHelperCallback) != INTERNET_INVALID_STATUS_CALLBACK)
|
||||
{
|
||||
HINTERNET hConnect = InternetOpenUrlA(
|
||||
hInternet,
|
||||
@ -87,16 +87,17 @@ BOOL IsUpdateAvailableHelper(char* url, char* szCheckAgainst, DWORD dwUpdateTime
|
||||
INTERNET_FLAG_RESYNCHRONIZE |
|
||||
INTERNET_FLAG_NO_COOKIES |
|
||||
INTERNET_FLAG_NO_UI |
|
||||
INTERNET_FLAG_NO_CACHE_WRITE,
|
||||
INTERNET_FLAG_NO_CACHE_WRITE |
|
||||
INTERNET_FLAG_DONT_CACHE,
|
||||
¶ms
|
||||
);
|
||||
if (!hConnect && GetLastError() == ERROR_IO_PENDING)
|
||||
/*if (!hConnect && GetLastError() == ERROR_IO_PENDING)
|
||||
{
|
||||
if (WaitForSingleObject(params.hEvent, dwUpdateTimeout) == WAIT_OBJECT_0)
|
||||
{
|
||||
hConnect = params.hInternet;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (hConnect)
|
||||
{
|
||||
if (szCheckAgainst)
|
||||
@ -122,6 +123,9 @@ BOOL IsUpdateAvailableHelper(char* url, char* szCheckAgainst, DWORD dwUpdateTime
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef UPDATES_VERBOSE_OUTPUT
|
||||
printf("[Updates] Failed. Read %d bytes.\n");
|
||||
#endif
|
||||
if (lpFail) *lpFail = TRUE;
|
||||
}
|
||||
}
|
||||
@ -129,7 +133,7 @@ BOOL IsUpdateAvailableHelper(char* url, char* szCheckAgainst, DWORD dwUpdateTime
|
||||
{
|
||||
WCHAR wszPath[MAX_PATH];
|
||||
ZeroMemory(wszPath, MAX_PATH * sizeof(WCHAR));
|
||||
SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath);
|
||||
SHGetFolderPathW(NULL, SPECIAL_FOLDER_LEGACY, NULL, SHGFP_TYPE_CURRENT, wszPath);
|
||||
wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH));
|
||||
BOOL bRet = CreateDirectoryW(wszPath, NULL);
|
||||
if (bRet || (!bRet && GetLastError() == ERROR_ALREADY_EXISTS))
|
||||
|
@ -498,11 +498,18 @@ int WINAPI wWinMain(
|
||||
//ZZRestartExplorer(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
if (!bOk && !(argc >= 1 && !_wcsicmp(wargv[0], L"/update_silent")))
|
||||
if (!bOk) // && !(argc >= 1 && !_wcsicmp(wargv[0], L"/update_silent"))
|
||||
{
|
||||
MessageBoxW(
|
||||
NULL,
|
||||
L"An error has occured when attempting to service the product. Please reboot the computer and try again.",
|
||||
L"An error has occured while servicing this product.\n"
|
||||
L"Most likely, this is caused by one or more of the backup files still being in use (from"
|
||||
L"a previous update). Unlocking the files will most likely fix this issue.\n\n"
|
||||
L"Troubleshooting steps:\n"
|
||||
L"* Close and reopen the \"Properties\" dialog, if you have it currently open.\n"
|
||||
L"* Kill and restart all \"explorer.exe\" processes.\n"
|
||||
L"* If you have registered this as shell extension, restarting the computer will probably fix this.\n"
|
||||
L"* After everything else, reboot the computer and try again.",
|
||||
_T(PRODUCT_NAME),
|
||||
MB_ICONERROR | MB_OK | MB_DEFBUTTON1
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user