From 8edb487ac9b4457de4f63ff089ddf33e00750948 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Thu, 12 Oct 2023 19:46:10 +0100 Subject: [PATCH] [misc] update ChangeLog for 4.3 BETA * Also minor code cleanups and improvements. --- ChangeLog.txt | 10 ++++++++++ src/process.c | 6 +++++- src/process.h | 1 + src/rufus.h | 2 +- src/rufus.rc | 10 +++++----- src/stdfn.c | 30 +++++++++++++++--------------- src/stdio.c | 4 +--- 7 files changed, 38 insertions(+), 25 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 0cb2abaf..08db102c 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,13 @@ +o Version 4.3 (2023.10.??) + Add support for Rock Ridge symlink preservation when NTFS is used + Add an exception to enforce NTFS for Linux Mint's LMDE + Add an expert feature to restrict a Windows installation to S Mode + Fix persistence support for Debian 12 when booted in BIOS mode + Fix a regression that prevented the opening of .vhd images + Update UEFI:NTFS to report a more explicit error on bootmgr security issues + Improve the search for conflicting processes by running it in a background thread + Improve support for Slax Linux + o Version 4.2 (2023.07.26) Add detection and warning for UEFI revoked bootloaders (including ones revoked through SkuSiPolicy.p7b) Add ZIP64 support, to extract .zip images that are larger than 4 GB diff --git a/src/process.c b/src/process.c index fe9575dd..c9fc9d06 100644 --- a/src/process.c +++ b/src/process.c @@ -975,6 +975,10 @@ retry: * be convenient for our usage (since we might be looking for processes preventing * us to open said target in exclusive mode). * + * At least on Windows 11, this no longer seems to work as querying a logical or + * physical volume seems to return almost ALL the processes that are running, + * including the ones that are not actually accessing the handle. + * * \param HandleName The name of the handle to look for. * * \return TRUE if processes were found, FALSE otherwise. @@ -992,7 +996,7 @@ BOOL SearchProcessAlt(char* HandleName) goto out; // Note that the access rights being used with CreateFile() might matter... - searchHandle = CreateFileA(HandleName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, + searchHandle = CreateFileA(HandleName, FILE_READ_ATTRIBUTES | SYNCHRONIZE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); status = PhQueryProcessesUsingVolumeOrFile(searchHandle, &info); diff --git a/src/process.h b/src/process.h index fcaa61cb..3c367ca5 100644 --- a/src/process.h +++ b/src/process.h @@ -45,6 +45,7 @@ #define STATUS_OBJECT_NAME_NOT_FOUND ((NTSTATUS)0xC0000034L) #define STATUS_OBJECT_PATH_INVALID ((NTSTATUS)0xC0000039L) #define STATUS_SHARING_VIOLATION ((NTSTATUS)0xC0000043L) +#define STATUS_PROCEDURE_NOT_FOUND ((NTSTATUS)0xC000007AL) #define STATUS_INSUFFICIENT_RESOURCES ((NTSTATUS)0xC000009AL) #define STATUS_NOT_SUPPORTED ((NTSTATUS)0xC00000BBL) diff --git a/src/rufus.h b/src/rufus.h index 6d2822df..b1db118e 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -827,7 +827,7 @@ out: if (pf##proc == NULL) {uprintf("Unable to locate %s() in '%s.dll': %s", \ #proc, #name, WindowsErrorString()); goto out;} } while(0) #define PF_INIT_OR_SET_STATUS(proc, name) do {PF_INIT(proc, name); \ - if ((pf##proc == NULL) && (NT_SUCCESS(status))) status = STATUS_NOT_IMPLEMENTED; } while(0) + if ((pf##proc == NULL) && (NT_SUCCESS(status))) status = STATUS_PROCEDURE_NOT_FOUND; } while(0) #if defined(_MSC_VER) #define TRY_AND_HANDLE(exception, TRY_CODE, EXCEPTION_CODE) __try TRY_CODE \ __except (GetExceptionCode() == exception ? EXCEPTION_EXECUTE_HANDLER : \ diff --git a/src/rufus.rc b/src/rufus.rc index f8baf63d..2d91ece5 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 4.3.2088" +CAPTION "Rufus 4.3.2089" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -392,8 +392,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,3,2088,0 - PRODUCTVERSION 4,3,2088,0 + FILEVERSION 4,3,2089,0 + PRODUCTVERSION 4,3,2089,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -411,13 +411,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "4.3.2088" + VALUE "FileVersion", "4.3.2089" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-4.3.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "4.3.2088" + VALUE "ProductVersion", "4.3.2089" END END BLOCK "VarFileInfo" diff --git a/src/stdfn.c b/src/stdfn.c index ea9953bf..d4076364 100644 --- a/src/stdfn.c +++ b/src/stdfn.c @@ -534,7 +534,7 @@ void StrArrayCreate(StrArray* arr, uint32_t initial_size) arr->Max = initial_size; arr->Index = 0; arr->String = (char**)calloc(arr->Max, sizeof(char*)); if (arr->String == NULL) - uprintf("Could not allocate string array\n"); + uprintf("Could not allocate string array"); } int32_t StrArrayAdd(StrArray* arr, const char* str, BOOL duplicate) @@ -548,13 +548,13 @@ int32_t StrArrayAdd(StrArray* arr, const char* str, BOOL duplicate) arr->String = (char**)realloc(arr->String, arr->Max*sizeof(char*)); if (arr->String == NULL) { free(old_table); - uprintf("Could not reallocate string array\n"); + uprintf("Could not reallocate string array"); return -1; } } arr->String[arr->Index] = (duplicate)?safe_strdup(str):(char*)str; if (arr->String[arr->Index] == NULL) { - uprintf("Could not store string in array\n"); + uprintf("Could not store string in array"); return -1; } return arr->Index++; @@ -577,7 +577,7 @@ void StrArrayClear(StrArray* arr) uint32_t i; if ((arr == NULL) || (arr->String == NULL)) return; - for (i=0; iIndex; i++) { + for (i = 0; i < arr->Index; i++) { safe_free(arr->String[i]); } arr->Index = 0; @@ -601,13 +601,13 @@ static PSID GetSID(void) { char* psid_string = NULL; if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { - uprintf("OpenProcessToken failed: %s\n", WindowsErrorString()); + uprintf("OpenProcessToken failed: %s", WindowsErrorString()); return NULL; } if (!GetTokenInformation(token, TokenUser, tu, 0, &len)) { if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { - uprintf("GetTokenInformation (pre) failed: %s\n", WindowsErrorString()); + uprintf("GetTokenInformation (pre) failed: %s", WindowsErrorString()); return NULL; } tu = (TOKEN_USER*)calloc(1, len); @@ -623,11 +623,11 @@ static PSID GetSID(void) { * The workaround? Convert to string then back to PSID */ if (!ConvertSidToStringSidA(tu->User.Sid, &psid_string)) { - uprintf("Unable to convert SID to string: %s\n", WindowsErrorString()); + uprintf("Unable to convert SID to string: %s", WindowsErrorString()); ret = NULL; } else { if (!ConvertStringSidToSidA(psid_string, &ret)) { - uprintf("Unable to convert string back to SID: %s\n", WindowsErrorString()); + uprintf("Unable to convert string back to SID: %s", WindowsErrorString()); ret = NULL; } // MUST use LocalFree() @@ -635,7 +635,7 @@ static PSID GetSID(void) { } } else { ret = NULL; - uprintf("GetTokenInformation (real) failed: %s\n", WindowsErrorString()); + uprintf("GetTokenInformation (real) failed: %s", WindowsErrorString()); } free(tu); return ret; @@ -662,7 +662,7 @@ BOOL FileIO(enum file_io_type io_type, char* path, char** buffer, DWORD* size) s_attr.lpSecurityDescriptor = &s_desc; sa = &s_attr; } else { - uprintf("Could not set security descriptor: %s\n", WindowsErrorString()); + uprintf("Could not set security descriptor: %s", WindowsErrorString()); } switch (io_type) { @@ -696,7 +696,7 @@ BOOL FileIO(enum file_io_type io_type, char* path, char** buffer, DWORD* size) *size = GetFileSize(handle, NULL); *buffer = (char*)malloc(*size); if (*buffer == NULL) { - uprintf("Could not allocate buffer for reading file\n"); + uprintf("Could not allocate buffer for reading file"); goto out; } r = ReadFile(handle, *buffer, *size, size, NULL); @@ -742,12 +742,12 @@ unsigned char* GetResource(HMODULE module, char* name, char* type, const char* d res = FindResourceA(module, name, type); if (res == NULL) { - uprintf("Could not locate resource '%s': %s\n", desc, WindowsErrorString()); + uprintf("Could not locate resource '%s': %s", desc, WindowsErrorString()); goto out; } res_handle = LoadResource(module, res); if (res_handle == NULL) { - uprintf("Could not load resource '%s': %s\n", desc, WindowsErrorString()); + uprintf("Could not load resource '%s': %s", desc, WindowsErrorString()); goto out; } res_len = SizeofResource(module, res); @@ -757,12 +757,12 @@ unsigned char* GetResource(HMODULE module, char* name, char* type, const char* d *len = res_len; p = (unsigned char*)calloc(*len, 1); if (p == NULL) { - uprintf("Could not allocate resource '%s'\n", desc); + uprintf("Could not allocate resource '%s'", desc); goto out; } memcpy(p, LockResource(res_handle), min(res_len, *len)); if (res_len > *len) - uprintf("WARNING: Resource '%s' was truncated by %d bytes!\n", desc, res_len - *len); + uprintf("WARNING: Resource '%s' was truncated by %d bytes!", desc, res_len - *len); } else { p = (unsigned char*)LockResource(res_handle); } diff --git a/src/stdio.c b/src/stdio.c index 8f0b6470..493345cf 100644 --- a/src/stdio.c +++ b/src/stdio.c @@ -83,7 +83,6 @@ void uprintf(const char *format, ...) *p++ = '\n'; *p = '\0'; - // Yay, Windows 10 *FINALLY* added actual Unicode support for OutputDebugStringW()! wbuf = utf8_to_wchar(buf); // Send output to Windows debug facility OutputDebugStringW(wbuf); @@ -92,7 +91,6 @@ void uprintf(const char *format, ...) Edit_SetSel(hLog, MAX_LOG_SIZE, MAX_LOG_SIZE); Edit_ReplaceSel(hLog, wbuf); // Make sure the message scrolls into view - // (Or see code commented in LogProc:WM_SHOWWINDOW for a less forceful scroll) Edit_Scroll(hLog, Edit_GetLineCount(hLog), 0); } free(wbuf); @@ -608,7 +606,7 @@ DWORD WaitForSingleObjectWithMessages(HANDLE hHandle, DWORD dwMilliseconds) } #define STATUS_SUCCESS ((NTSTATUS)0x00000000L) -#define STATUS_NOT_IMPLEMENTED ((NTSTATUS)0xC0000002L) +#define STATUS_PROCEDURE_NOT_FOUND ((NTSTATUS)0xC000007AL) #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007FB7 #define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock) #define RtlGetProcessHeap() (NtCurrentPeb()->Reserved4[1]) // NtCurrentPeb()->ProcessHeap, mangled due to deficiencies in winternl.h