From e36fdb67366f159bf2f63798856ab32153941a52 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Mon, 11 Jun 2018 14:02:23 +0100 Subject: [PATCH] [core] add detection and warning about Controller Access Folder --- src/rufus.c | 19 +++++++++++++++++-- src/rufus.rc | 10 +++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/rufus.c b/src/rufus.c index 2ae0587b..7ea7bcd6 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -3639,10 +3639,25 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA PrintInfo(0, MSG_212); MessageBeep(MB_ICONERROR); FlashTaskbar(dialog_handle); - if (BlockingProcess.Index > 0) + if (BlockingProcess.Index > 0) { ListDialog(lmprintf(MSG_042), lmprintf(MSG_055), BlockingProcess.String, BlockingProcess.Index); - else + } else { + if (nWindowsVersion >= WINDOWS_10) { + // Try to detect if 'Controlled Folder Access' is enabled on Windows 10 or later. See also: + // http://www.winhelponline.com/blog/use-controlled-folder-access-windows-10-windows-defender + switch (SCODE_CODE(FormatStatus)) { + case ERROR_PARTITION_FAILURE: + case ERROR_WRITE_FAULT: + if ((RunCommand("powershell.exe -NonInteractive -NoProfile -Command If (Get-Command -Commandtype Function Get-MpPreference -ErrorAction SilentlyContinue) { exit 1 } Else { exit 0 }", app_dir, TRUE) == 1) && + (RunCommand("powershell.exe -NonInteractive -NoProfile -Command exit (Get-MpPreference).EnableControlledFolderAccess", app_dir, TRUE) == 1)) { + uprintf("\r\nWARNING: 'Controlled Folder Access' appears to be enabled on this system!"); + uprintf("You may need to disable this feature, or add an exception, for Rufus to be able to work...\n"); + } + break; + } + } Notification(MSG_ERROR, NULL, lmprintf(MSG_042), lmprintf(MSG_043, StrError(FormatStatus, FALSE))); + } } FormatStatus = 0; format_op_in_progress = FALSE; diff --git a/src/rufus.rc b/src/rufus.rc index 7a7f6ae5..144c1dd1 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.1.1314" +CAPTION "Rufus 3.1.1315" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -389,8 +389,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,1,1314,0 - PRODUCTVERSION 3,1,1314,0 + FILEVERSION 3,1,1315,0 + PRODUCTVERSION 3,1,1315,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -407,13 +407,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.1.1314" + VALUE "FileVersion", "3.1.1315" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.1.1314" + VALUE "ProductVersion", "3.1.1315" END END BLOCK "VarFileInfo"