diff --git a/configure b/configure index 54fc8efa..ae723919 100644 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for rufus 1.1.4. +# Generated by GNU Autoconf 2.68 for rufus 1.1.5. # # Report bugs to . # @@ -559,8 +559,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='rufus' PACKAGE_TARNAME='rufus' -PACKAGE_VERSION='1.1.4' -PACKAGE_STRING='rufus 1.1.4' +PACKAGE_VERSION='1.1.5' +PACKAGE_STRING='rufus 1.1.5' PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues' PACKAGE_URL='http://rufus.akeo.ie' @@ -1204,7 +1204,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures rufus 1.1.4 to adapt to many kinds of systems. +\`configure' configures rufus 1.1.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1270,7 +1270,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of rufus 1.1.4:";; + short | recursive ) echo "Configuration of rufus 1.1.5:";; esac cat <<\_ACEOF @@ -1363,7 +1363,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -rufus configure 1.1.4 +rufus configure 1.1.5 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1418,7 +1418,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by rufus $as_me 1.1.4, which was +It was created by rufus $as_me 1.1.5, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2233,7 +2233,7 @@ fi # Define the identity of the package. PACKAGE='rufus' - VERSION='1.1.4' + VERSION='1.1.5' cat >>confdefs.h <<_ACEOF @@ -4091,7 +4091,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by rufus $as_me 1.1.4, which was +This file was extended by rufus $as_me 1.1.5, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4145,7 +4145,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -rufus config.status 1.1.4 +rufus config.status 1.1.5 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index c2160aec..51b32b6e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([rufus], [1.1.4], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie]) +AC_INIT([rufus], [1.1.5], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie]) AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies]) AC_CONFIG_SRCDIR([src/rufus.c]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/src/drive.c b/src/drive.c index b5843b48..5c176d48 100644 --- a/src/drive.c +++ b/src/drive.c @@ -150,8 +150,9 @@ out: */ BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label) { - HANDLE hDrive; - char AutorunPath[] = "#:\\autorun.inf", *AutorunLabel; + HANDLE hDrive, hPhysical; + DWORD size; + char AutorunPath[] = "#:\\autorun.inf", *AutorunLabel = NULL; wchar_t wDrivePath[] = L"#:\\"; wchar_t wVolumeLabel[MAX_PATH+1]; static char VolumeLabel[MAX_PATH+1]; @@ -166,9 +167,17 @@ BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label) wDrivePath[0] = *letter; // Try to read an extended label from autorun first. Fallback to regular label if not found. - AutorunLabel = get_token_data(AutorunPath, "label"); + // In the case of card readers with no card, users can get an annoying popup asking them + // to insert media. Use IOCTL_STORAGE_CHECK_VERIFY to prevent this + hPhysical = GetDriveHandle(DriveIndex, NULL, FALSE, FALSE); + if (DeviceIoControl(hPhysical, IOCTL_STORAGE_CHECK_VERIFY, NULL, 0, NULL, 0, &size, NULL)) + AutorunLabel = get_token_data(AutorunPath, "label"); + else if (GetLastError() == ERROR_NOT_READY) + uprintf("Ignoring autorun.inf label for drive %c: %s\n", *letter, + (HRESULT_CODE(GetLastError()) == ERROR_NOT_READY)?"No media":WindowsErrorString()); + safe_closehandle(hPhysical); if (AutorunLabel != NULL) { - uprintf("Using autorun.inf label for device %c:\n", *letter); + uprintf("Using autorun.inf label for drive %c: '%s'\n", *letter, AutorunLabel); strncpy(VolumeLabel, AutorunLabel, sizeof(VolumeLabel)); safe_free(AutorunLabel); *label = VolumeLabel; diff --git a/src/format.c b/src/format.c index de89fa83..756e7c15 100644 --- a/src/format.c +++ b/src/format.c @@ -136,6 +136,62 @@ static BOOLEAN __stdcall FormatExCallback(FILE_SYSTEM_CALLBACK_COMMAND Command, return (!IS_ERROR(FormatStatus)); } +/* + * Chkdsk callback. Return FALSE to halt operations + */ +static BOOLEAN __stdcall ChkdskCallback(FILE_SYSTEM_CALLBACK_COMMAND Command, DWORD Action, PVOID pData) +{ + DWORD* percent; + if (IS_ERROR(FormatStatus)) + return FALSE; + + switch(Command) { + case FCC_PROGRESS: + case FCC_CHECKDISK_PROGRESS: + percent = (DWORD*)pData; + PrintStatus(0, FALSE, "NTFS Fixup: %d%% completed.", *percent); + break; + case FCC_DONE: + if(*(BOOLEAN*)pData == FALSE) { + uprintf("Error while checking disk.\n"); + FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_GEN_FAILURE; + } + break; + case FCC_UNKNOWN1A: + case FCC_DONE_WITH_STRUCTURE: + // Silence these specific calls + break; + case FCC_INCOMPATIBLE_FILE_SYSTEM: + uprintf("Incompatible File System\n"); + FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_INCOMPATIBLE_FS); + break; + case FCC_ACCESS_DENIED: + uprintf("Access denied\n"); + FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_ACCESS_DENIED; + break; + case FCC_MEDIA_WRITE_PROTECTED: + uprintf("Media is write protected\n"); + FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_PROTECT; + break; + case FCC_VOLUME_IN_USE: + uprintf("Volume is in use\n"); + FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_DEVICE_IN_USE; + break; + case FCC_OUTPUT: + uprintf("%s\n", ((PTEXTOUTPUT)pData)->Output); + break; + case FCC_NO_MEDIA_IN_DRIVE: + uprintf("No media in drive\n"); + FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_NO_MEDIA_IN_DRIVE; + break; + default: + uprintf("ChkdskExCallback: received unhandled command %X\n", Command); + // Assume the command isn't an error + break; + } + return (!IS_ERROR(FormatStatus)); +} + /* * Converts an UTF-16 label to a valid FAT/NTFS one */ @@ -237,6 +293,41 @@ out: return r; } +/* + * Call on fmifs.dll's Chkdsk() to fixup the filesystem + */ +static BOOL CheckDisk(char DriveLetter) +{ + BOOL r = FALSE; + PF_DECL(Chkdsk); + WCHAR wDriveRoot[] = L"?:\\"; + WCHAR wFSType[32]; + size_t i; + + wDriveRoot[0] = (WCHAR)DriveLetter; + PrintStatus(0, TRUE, "NTFS Fixup (Checkdisk)..."); + + PF_INIT_OR_OUT(Chkdsk, fmifs); + + GetWindowTextW(hFileSystem, wFSType, ARRAYSIZE(wFSType)); + // We may have a " (Default)" trail + for (i=0; i Delete the NoDriveTypeAutorun key on exit (useful if the app crashed) if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'D')) { PrintStatus(0, FALSE, "NoDriveTypeAutorun will be deleted on exit."); existing_key = FALSE; continue; } -#endif TranslateMessage(&msg); DispatchMessage(&msg); } @@ -1560,9 +1558,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine out: DestroyAllTooltips(); safe_free(iso_path); -#ifdef DISABLE_AUTORUN SetLGP(TRUE, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", "NoDriveTypeAutorun", 0); -#endif CloseHandle(mutex); uprintf("*** RUFUS EXIT ***\n"); diff --git a/src/rufus.h b/src/rufus.h index ef4b4ab4..391f1075 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -23,7 +23,6 @@ /* Program options */ #define RUFUS_DEBUG // print debug info to Debug facility -#define DISABLE_AUTORUN // disable new USB drive notification from explorer when application is running /* Features not ready for prime time and that may *DESTROY* your data - USE AT YOUR OWN RISKS! */ //#define RUFUS_TEST diff --git a/src/rufus.rc b/src/rufus.rc index 126eb7e7..65d7a2c5 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 289 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.1.4.150" +CAPTION "Rufus v1.1.5.151" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,248,50,14 @@ -73,7 +73,7 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP CONTROL "http://rufus.akeo.ie",IDC_ABOUT_RUFUS_URL, "SysLink",WS_TABSTOP,46,47,114,9 - LTEXT "Version 1.1.4 (Build 150)",IDC_STATIC,46,19,78,8 + LTEXT "Version 1.1.5 (Build 151)",IDC_STATIC,46,19,78,8 PUSHBUTTON "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP EDITTEXT IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 @@ -223,8 +223,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,1,4,150 - PRODUCTVERSION 1,1,4,150 + FILEVERSION 1,1,5,151 + PRODUCTVERSION 1,1,5,151 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -241,13 +241,13 @@ BEGIN BEGIN VALUE "CompanyName", "akeo.ie" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.1.4.150" + VALUE "FileVersion", "1.1.5.151" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.1.4.150" + VALUE "ProductVersion", "1.1.5.151" END END BLOCK "VarFileInfo"