diff --git a/res/appstore/Package.appxmanifest b/res/appstore/Package.appxmanifest index 356166d0..e1dd3684 100644 --- a/res/appstore/Package.appxmanifest +++ b/res/appstore/Package.appxmanifest @@ -10,7 +10,7 @@ + Version="3.13.1739.0" /> Rufus @@ -36,7 +36,13 @@ BackgroundColor="transparent" Square150x150Logo="Images\Square150x150Logo.png" Square44x44Logo="Images\Square44x44Logo.png"> - + + + + + + + diff --git a/src/format.c b/src/format.c index d9344957..4d0238d0 100644 --- a/src/format.c +++ b/src/format.c @@ -2181,6 +2181,7 @@ DWORD WINAPI FormatThread(void* param) } out: + // TODO: Use a thread or only issue this on DD write VdsRescan(VDS_RESCAN_REFRESH, 0, TRUE); safe_free(volume_name); safe_free(buffer); diff --git a/src/net.c b/src/net.c index 375f9536..099be9e6 100644 --- a/src/net.c +++ b/src/net.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -265,27 +266,32 @@ static HINTERNET GetInternetSession(BOOL bRetry) { int i; char agent[64]; - BOOL r, decodingSupport = TRUE; - DWORD dwFlags, dwTimeout = NET_SESSION_TIMEOUT, dwProtocolSupport = HTTP_PROTOCOL_FLAG_HTTP2; + BOOL decodingSupport = TRUE; + DWORD dwTimeout = NET_SESSION_TIMEOUT, dwProtocolSupport = HTTP_PROTOCOL_FLAG_HTTP2; HINTERNET hSession = NULL; + HRESULT hr = S_FALSE; + INetworkListManager* pNetworkListManager; + NLM_CONNECTIVITY Connectivity = NLM_CONNECTIVITY_DISCONNECTED; - PF_TYPE_DECL(WINAPI, BOOL, InternetGetConnectedState, (LPDWORD, DWORD)); PF_TYPE_DECL(WINAPI, HINTERNET, InternetOpenA, (LPCSTR, DWORD, LPCSTR, LPCSTR, DWORD)); PF_TYPE_DECL(WINAPI, BOOL, InternetSetOptionA, (HINTERNET, DWORD, LPVOID, DWORD)); - PF_INIT_OR_OUT(InternetGetConnectedState, WinInet); PF_INIT_OR_OUT(InternetOpenA, WinInet); PF_INIT_OR_OUT(InternetSetOptionA, WinInet); - for (i = 0; i <= WRITE_RETRIES; i++) { - r = pfInternetGetConnectedState(&dwFlags, 0); - if (r || !bRetry) - break; - Sleep(1000); + // Create a NetworkListManager Instance to check the network connection + IGNORE_RETVAL(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)); + hr = CoCreateInstance(&CLSID_NetworkListManager, NULL, CLSCTX_ALL, + &IID_INetworkListManager, (LPVOID*)&pNetworkListManager); + if (hr == S_OK) { + for (i = 0; i <= WRITE_RETRIES; i++) { + hr = INetworkListManager_GetConnectivity(pNetworkListManager, &Connectivity); + if (hr == S_OK || !bRetry) + break; + Sleep(1000); + } } - if (!r) { - // http://msdn.microsoft.com/en-us/library/windows/desktop/aa384702.aspx is wrong... - SetLastError(ERROR_INTERNET_NOT_INITIALIZED); - uprintf("Network is unavailable: %s", WinInetErrorString()); + if (Connectivity == NLM_CONNECTIVITY_DISCONNECTED) { + SetLastError(ERROR_INTERNET_DISCONNECTED); goto out; } static_sprintf(agent, APPLICATION_NAME "/%d.%d.%d (Windows NT %d.%d%s)", diff --git a/src/rufus.c b/src/rufus.c index 93e150b9..7d860638 100755 --- a/src/rufus.c +++ b/src/rufus.c @@ -3290,7 +3290,9 @@ skip_args_processing: // Look for a .ini file in the current app directory static_sprintf(ini_path, "%s\\rufus.ini", app_dir); fd = fopenU(ini_path, ini_flags); // Will create the file if portable mode is requested - vc |= (safe_strcmp(GetSignatureName(NULL, NULL), cert_name[0]) == 0); + // Using the string directly in safe_strcmp() would call GetSignatureName() twice + tmp = GetSignatureName(NULL, NULL); + vc |= (safe_strcmp(tmp, cert_name[0]) == 0); if (fd != NULL) { ini_file = ini_path; fclose(fd); diff --git a/src/rufus.rc b/src/rufus.rc index 71c745d5..e30681f6 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 3.14.1738" +CAPTION "Rufus 3.14.1739" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -395,8 +395,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,14,1738,0 - PRODUCTVERSION 3,14,1738,0 + FILEVERSION 3,14,1739,0 + PRODUCTVERSION 3,14,1739,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -414,13 +414,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.14.1738" + VALUE "FileVersion", "3.14.1739" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-3.14.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.14.1738" + VALUE "ProductVersion", "3.14.1739" END END BLOCK "VarFileInfo" diff --git a/src/stdio.c b/src/stdio.c index 134c9ef2..530adcbb 100644 --- a/src/stdio.c +++ b/src/stdio.c @@ -43,7 +43,6 @@ HWND hStatus; size_t ubuffer_pos = 0; char ubuffer[UBUFFER_SIZE]; // Buffer for ubpushf() messages we don't log right away -static HANDLE print_mutex = NULL; void _uprintf(const char *format, ...) { @@ -53,11 +52,6 @@ void _uprintf(const char *format, ...) va_list args; int n; - if (print_mutex == NULL) - print_mutex = CreateMutex(NULL, FALSE, NULL); - if (WaitForSingleObject(print_mutex, INFINITE) != WAIT_OBJECT_0) - return; - va_start(args, format); n = safe_vsnprintf(p, sizeof(buf)-3, format, args); // buf-3 is room for CR/LF/NUL va_end(args); @@ -84,8 +78,6 @@ void _uprintf(const char *format, ...) Edit_Scroll(hLog, Edit_GetLineCount(hLog), 0); } free(wbuf); - - ReleaseMutex(print_mutex); } void _uprintfs(const char* str)