diff --git a/_pre-commit.sh b/_pre-commit.sh index 0fb1eff7..4f526102 100644 --- a/_pre-commit.sh +++ b/_pre-commit.sh @@ -32,7 +32,7 @@ s/^[ \t]*PRODUCTVERSION[ \t]*\(.*\),\(.*\),\(.*\),.*/ PRODUCTVERSION \1,\2,\3,@@ s/^\([ \t]*\)VALUE[ \t]*"FileVersion",[ \t]*"\(.*\)\..*"/\1VALUE "FileVersion", "\2.@@TAGVER@@"/ s/^\([ \t]*\)VALUE[ \t]*"ProductVersion",[ \t]*"\(.*\)\..*"/\1VALUE "ProductVersion", "\2.@@TAGVER@@"/ # TODO: revert ' ' to '"' below when out of beta -s/^\(.*\)"Rufus v\(.*\)\.\(.*\) \(.*\)/\1"Rufus v\2.@@TAGVER@@ \4/ +s/^\(.*\)"Rufus v\(.*\)\.\(.*\)"\(.*\)/\1"Rufus v\2.@@TAGVER@@"\4/ s/^\(.*\)"Version \(.*\) (Build \(.*\))"\(.*\)/\1"Version \2 (Build @@TAGVER@@)"\4/ _EOF diff --git a/configure b/configure index 6da5dd25..720135fa 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.0.2. +# Generated by GNU Autoconf 2.68 for rufus 1.0.3. # # Report bugs to . # @@ -559,8 +559,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='rufus' PACKAGE_TARNAME='rufus' -PACKAGE_VERSION='1.0.2' -PACKAGE_STRING='rufus 1.0.2' +PACKAGE_VERSION='1.0.3' +PACKAGE_STRING='rufus 1.0.3' PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues' PACKAGE_URL='https://github.com/pbatard/rufus' @@ -1200,7 +1200,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.0.2 to adapt to many kinds of systems. +\`configure' configures rufus 1.0.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1266,7 +1266,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of rufus 1.0.2:";; + short | recursive ) echo "Configuration of rufus 1.0.3:";; esac cat <<\_ACEOF @@ -1354,7 +1354,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -rufus configure 1.0.2 +rufus configure 1.0.3 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1409,7 +1409,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.0.2, which was +It was created by rufus $as_me 1.0.3, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2224,7 +2224,7 @@ fi # Define the identity of the package. PACKAGE='rufus' - VERSION='1.0.2' + VERSION='1.0.3' cat >>confdefs.h <<_ACEOF @@ -3362,7 +3362,7 @@ $as_echo "#define _GNU_SOURCE /**/" >>confdefs.h # Clang needs an explicit WIN32_WINNT defined else it produces warnings # in msapi_utf8.h - including winver.h only doesn't work -AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501" +AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501 -D_WIN32_WINNT=0x501" AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined" # Debug logging @@ -3982,7 +3982,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.0.2, which was +This file was extended by rufus $as_me 1.0.3, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4036,7 +4036,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.0.2 +rufus config.status 1.0.3 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index bececa6d..45d70c03 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([rufus], [1.0.2], [https://github.com/pbatard/rufus/issues], [rufus], [https://github.com/pbatard/rufus]) +AC_INIT([rufus], [1.0.3], [https://github.com/pbatard/rufus/issues], [rufus], [https://github.com/pbatard/rufus]) AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies]) AC_CONFIG_SRCDIR([src/rufus.c]) AC_CONFIG_MACRO_DIR([m4]) @@ -33,7 +33,7 @@ AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions]) # Clang needs an explicit WIN32_WINNT defined else it produces warnings # in msapi_utf8.h - including winver.h only doesn't work -AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501" +AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501 -D_WIN32_WINNT=0x501" AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined" # Debug logging diff --git a/src/badblocks.c b/src/badblocks.c index 9d1ef0d9..585443c0 100644 --- a/src/badblocks.c +++ b/src/badblocks.c @@ -274,8 +274,6 @@ static void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter) */ static int v_flag = 1; /* verbose */ static int s_flag = 1; /* show progress of test */ -static int t_flag = 0; /* number of test patterns */ -static unsigned int *t_patts = NULL; /* test patterns */ static int cancel_ops = 0; /* abort current operation */ static int cur_pattern, nr_pattern; static int cur_op; @@ -481,26 +479,17 @@ static unsigned int test_ro (HANDLE hDrive, blk_t last_block, ext2fs_badblocks_list_iterate (bb_iter, &next_bad); } while (next_bad && next_bad < first_block); - if (t_flag) { - blkbuf = allocate_buffer((blocks_at_once + 1) * block_size); - } else { - blkbuf = allocate_buffer(blocks_at_once * block_size); - } + blkbuf = allocate_buffer(blocks_at_once * block_size); if (!blkbuf) { uprintf("could not allocate buffers\n"); cancel_ops = -1; return 0; } - if (t_flag) { - uprintf("Checking for bad blocks in read-only mode\n"); - pattern_fill(blkbuf + blocks_at_once * block_size, - t_patts[0], block_size); - } tryout = blocks_at_once; currently_testing = first_block; num_blocks = last_block - 1; - if (!t_flag && (s_flag || v_flag)) { + if (s_flag || v_flag) { // Printstatus uprintf("Checking for bad blocks (read-only test): \n"); } @@ -526,16 +515,6 @@ static unsigned int test_ro (HANDLE hDrive, blk_t last_block, if (currently_testing + tryout > last_block) tryout = last_block - currently_testing; got = do_read(hDrive, blkbuf, tryout, block_size, currently_testing); - if (t_flag) { - /* test the comparison between all the - blocks successfully read */ - int i; - for (i = 0; i < got; ++i) - if (memcmp (blkbuf+i*block_size, - blkbuf+blocks_at_once*block_size, - block_size)) - bb_count += bb_output(currently_testing + i, CORRUPTION_ERROR); - } if (got == 0 && tryout == 1) bb_count += bb_output(currently_testing++, READ_ERROR); currently_testing += got; @@ -566,8 +545,7 @@ static unsigned int test_ro (HANDLE hDrive, blk_t last_block, static unsigned int test_rw(HANDLE hDrive, blk_t last_block, int block_size, blk_t first_block, unsigned int blocks_at_once) { unsigned char *buffer = NULL, *read_buffer; - const unsigned int patterns[] = EXT2_RW_PATTERNS; - const unsigned int *pattern; + const unsigned int pattern[] = EXT2_RW_PATTERNS; int i, tryout, got, pat_idx; unsigned int bb_count = 0; blk_t recover_block = ~0; @@ -583,16 +561,10 @@ static unsigned int test_rw(HANDLE hDrive, blk_t last_block, int block_size, blk uprintf("Checking for bad blocks in read-write mode\n"); uprintf("From block %lu to %lu\n", (unsigned long) first_block, (unsigned long) last_block - 1); - if (t_flag) { - pattern = t_patts; - nr_pattern = t_flag; - } else { - pattern = patterns; - nr_pattern = ARRAYSIZE(patterns); - } + nr_pattern = ARRAYSIZE(pattern); cur_pattern = 0; - for (pat_idx = 0; pat_idx < nr_pattern; pat_idx++) { + for (pat_idx = 0; pat_idx < ARRAYSIZE(pattern); pat_idx++) { if (cancel_ops) goto out; pattern_fill(buffer, pattern[pat_idx], blocks_at_once * block_size); num_blocks = last_block - 1; @@ -694,8 +666,7 @@ static unsigned int test_nd(HANDLE hDrive, blk_t last_block, unsigned char *blkbuf, *save_ptr, *test_ptr, *read_ptr; unsigned char *test_base, *save_base, *read_base; int tryout, i; - const unsigned int patterns[] = { ~0 }; - const unsigned int *pattern; + const unsigned int pattern[] = { ~0 }; int pat_idx; int got, used2, written; blk_t save_currently_testing; @@ -760,17 +731,9 @@ static unsigned int test_nd(HANDLE hDrive, blk_t last_block, exit(1); } - if (t_flag) { - pattern = t_patts; - nr_pattern = t_flag; - } else { - pattern = patterns; - nr_pattern = ARRAYSIZE(patterns); - } - for (pat_idx = 0; pat_idx < nr_pattern; pat_idx++) { - pattern_fill(test_base, pattern[pat_idx], - blocks_at_once * block_size); - + nr_pattern = ARRAYSIZE(pattern); + for (pat_idx = 0; pat_idx < ARRAYSIZE(pattern); pat_idx++) { + pattern_fill(test_base, pattern[pat_idx], blocks_at_once * block_size); buf_used = 0; bb_count = 0; save_ptr = save_base; @@ -963,7 +926,6 @@ BOOL BadBlocks(HANDLE hPhysicalDrive, ULONGLONG disk_size, int block_size, SetTimer(hMainDialog, TID_BADBLOCKS_UPDATE, 1000, alarm_intr); report->bb_count = test_func(hPhysicalDrive, last_block, block_size, first_block, EXT2_BLOCKS_AT_ONCE); KillTimer(hMainDialog, TID_BADBLOCKS_UPDATE); - free(t_patts); free(bb_list->list); free(bb_list); // TODO: report first problem block for each error or create a report file diff --git a/src/format.c b/src/format.c index 2bed7ba3..f8fac057 100644 --- a/src/format.c +++ b/src/format.c @@ -61,6 +61,7 @@ static BOOLEAN __stdcall FormatExCallback(FILE_SYSTEM_CALLBACK_COMMAND Command, switch(Command) { case FCC_PROGRESS: + // TODO: send this percentage to the status bar percent = (DWORD*)pData; PrintStatus(0, "Formatting: %d%% completed.\n", *percent); // uprintf("%d percent completed.\n", *percent); diff --git a/src/rufus.c b/src/rufus.c index dce2e588..898a6244 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -105,75 +105,39 @@ static BOOL DefineClusterSizes(void) default_fs = FS_UNKNOWN; memset(&SelectedDrive.ClusterSize, 0, sizeof(SelectedDrive.ClusterSize)); if (SelectedDrive.DiskSize < 8*MB) { - // TODO: muck with FAT12 and Small FAT16 like Microsoft does to support small drives? - uprintf("This application does not support volumes smaller than 8 MB\n"); + // TODO: muck with FAT12 and Small FAT16 like Microsoft does + uprintf("This application does not support volumes smaller than 8 MB yet\n"); goto out; } -/* - * The following is MS's allowed cluster sizes for FAT16 and FAT32: - * - * FAT16 - * 31M : 512 - 4096 - * 63M : 1024 - 8192 - * 127M : 2048 - 16k - * 255M : 4096 - 32k - * 511M : 8192 - 64k - * 1023M: 16k - 64k - * 2047M: 32k - 64k - * 4095M: 64k - * 4GB+ : N/A - * - * FAT32 - * 31M : N/A - * 63M : N/A (NB unlike MS, we're allowing 512-512 here - UNTESTED) - * 127M : 512 - 1024 - * 255M : 512 - 2048 - * 511M : 512 - 4096 - * 1023M: 512 - 8192 - * 2047M: 512 - 16k - * 4095M: 1024 - 32k - * 7GB : 2048 - 64k - * 15GB : 4096 - 64k - * 31GB : 8192 - 64k - * 32GB+: possible but N/A from Microsoft (see below) - */ - // FAT 16 if (SelectedDrive.DiskSize < 4*GB) { - SelectedDrive.ClusterSize[FS_FAT16].Allowed = 0x00001E00; + // TODO: Refine the following according to size + SelectedDrive.ClusterSize[FS_FAT16].Allowed = 0x0001FE00; for (i=32; i<=4096; i<<=1) { // 8 MB -> 4 GB if (SelectedDrive.DiskSize < i*MB) { SelectedDrive.ClusterSize[FS_FAT16].Default = 16*(ULONG)i; break; } - SelectedDrive.ClusterSize[FS_FAT16].Allowed <<= 1; } - SelectedDrive.ClusterSize[FS_FAT16].Allowed &= 0x0001FE00; } // FAT 32 - // > 32GB FAT32 is not supported by MS (and likely FormatEx) but is feasible - // See: http://www.ridgecrop.demon.co.uk/index.htm?fat32format.htm - // < 32 MB FAT32 is not allowed by FormatEx - if ((SelectedDrive.DiskSize >= 32*MB) && (SelectedDrive.DiskSize < 32*GB)) { - SelectedDrive.ClusterSize[FS_FAT32].Allowed = 0x000001F8; - for (i=32; i<=(32*1024); i<<=1) { // 32 MB -> 32 GB + if (SelectedDrive.DiskSize < 256*MB) { + // TODO: Refine the following according to size + SelectedDrive.ClusterSize[FS_FAT32].Allowed = 0x0001FE00; + for (i=64; i<=256; i<<=1) { // 8 MB -> 256 MB if (SelectedDrive.DiskSize < i*MB) { SelectedDrive.ClusterSize[FS_FAT32].Default = 8*(ULONG)i; break; } - SelectedDrive.ClusterSize[FS_FAT32].Allowed <<= 1; } - SelectedDrive.ClusterSize[FS_FAT32].Allowed &= 0x0001FE00; - - // Default cluster sizes in the 256MB to 32 GB range do not follow the rule above - if (SelectedDrive.DiskSize >= 256*MB) { - for (i=8; i<=32; i<<=1) { // 256 MB -> 32 GB - if (SelectedDrive.DiskSize < i*GB) { - SelectedDrive.ClusterSize[FS_FAT32].Default = ((ULONG)i/2)*1024; - break; - } + } else if (SelectedDrive.DiskSize < 32*GB) { + SelectedDrive.ClusterSize[FS_FAT32].Allowed = 0x0001FE00; + for (i=8; i<=32; i<<=1) { // 256 MB -> 32 GB + if (SelectedDrive.DiskSize < i*GB) { + SelectedDrive.ClusterSize[FS_FAT32].Default = ((ULONG)i/2)*1024; + break; } } } @@ -228,7 +192,7 @@ out: static BOOL SetClusterSizes(int FSType) { char szClustSize[64]; - int i, k, default_index = 0; + int i, default_index = 0; ULONG j; IGNORE_RETVAL(ComboBox_ResetContent(hClusterSize)); @@ -244,15 +208,14 @@ static BOOL SetClusterSizes(int FSType) return FALSE; } - for(i=0,j=0x200,k=0;j<0x10000000;i++,j<<=1) { + for(i=0,j=0x200;j<0x10000000;i++,j<<=1) { if (j & SelectedDrive.ClusterSize[FSType].Allowed) { safe_sprintf(szClustSize, sizeof(szClustSize), "%s", ClusterSizeLabel[i]); if (j == SelectedDrive.ClusterSize[FSType].Default) { safe_strcat(szClustSize, sizeof(szClustSize), " (Default)"); - default_index = k; + default_index = i; } IGNORE_RETVAL(ComboBox_SetItemData(hClusterSize, ComboBox_AddStringU(hClusterSize, szClustSize), j)); - k++; } } @@ -700,39 +663,40 @@ void UpdateProgress(int op, float percent) /* * Set or restore a Local Group Policy DWORD key indexed by szPath/SzPolicy */ -#pragma push_macro("INTERFACE") -#undef INTERFACE -#define INTERFACE IGroupPolicyObject -#define REGISTRY_EXTENSION_GUID { 0x35378EAC, 0x683F, 0x11D2, {0xA8, 0x9A, 0x00, 0xC0, 0x4F, 0xBB, 0xCF, 0xA2} } -#define GPO_OPEN_LOAD_REGISTRY 1 -#define GPO_SECTION_MACHINE 2 typedef enum _GROUP_POLICY_OBJECT_TYPE { - GPOTypeLocal = 0, GPOTypeRemote, GPOTypeDS -} GROUP_POLICY_OBJECT_TYPE, *PGROUP_POLICY_OBJECT_TYPE; -DECLARE_INTERFACE_(IGroupPolicyObject, IUnknown) { - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE; - STDMETHOD_(ULONG, AddRef) (THIS) PURE; - STDMETHOD_(ULONG, Release) (THIS) PURE; - STDMETHOD(New) (THIS_ LPOLESTR pszDomainName, LPOLESTR pszDisplayName, DWORD dwFlags) PURE; - STDMETHOD(OpenDSGPO) (THIS_ LPOLESTR pszPath, DWORD dwFlags) PURE; - STDMETHOD(OpenLocalMachineGPO) (THIS_ DWORD dwFlags) PURE; - STDMETHOD(OpenRemoteMachineGPO) (THIS_ LPOLESTR pszComputerName, DWORD dwFlags) PURE; - STDMETHOD(Save) (THIS_ BOOL bMachine, BOOL bAdd,GUID *pGuidExtension, GUID *pGuid) PURE; - STDMETHOD(Delete) (THIS) PURE; - STDMETHOD(GetName) (THIS_ LPOLESTR pszName, int cchMaxLength) PURE; - STDMETHOD(GetDisplayName) (THIS_ LPOLESTR pszName, int cchMaxLength) PURE; - STDMETHOD(SetDisplayName) (THIS_ LPOLESTR pszName) PURE; - STDMETHOD(GetPath) (THIS_ LPOLESTR pszPath, int cchMaxPath) PURE; - STDMETHOD(GetDSPath) (THIS_ DWORD dwSection, LPOLESTR pszPath ,int cchMaxPath) PURE; - STDMETHOD(GetFileSysPath) (THIS_ DWORD dwSection, LPOLESTR pszPath, int cchMaxPath) PURE; - STDMETHOD(GetRegistryKey) (THIS_ DWORD dwSection, HKEY *hKey) PURE; - STDMETHOD(GetOptions) (THIS_ DWORD *dwOptions) PURE; - STDMETHOD(SetOptions) (THIS_ DWORD dwOptions, DWORD dwMask) PURE; - STDMETHOD(GetType) (THIS_ GROUP_POLICY_OBJECT_TYPE *gpoType) PURE; - STDMETHOD(GetMachineName) (THIS_ LPOLESTR pszName, int cchMaxLength) PURE; - STDMETHOD(GetPropertySheetPages) (THIS_ HPROPSHEETPAGE **hPages, UINT *uPageCount) PURE; -}; -typedef IGroupPolicyObject *LPGROUPPOLICYOBJECT; + GPOTypeLocal = 0,GPOTypeRemote,GPOTypeDS +} GROUP_POLICY_OBJECT_TYPE,*PGROUP_POLICY_OBJECT_TYPE; + +#define REGISTRY_EXTENSION_GUID { 0x35378EAC,0x683F,0x11D2, {0xA8,0x9A,0x00,0xC0,0x4F,0xBB,0xCF,0xA2} } +#define GPO_OPEN_LOAD_REGISTRY 0x00000001 +#define GPO_SECTION_MACHINE 2 + +#undef INTERFACE +#define INTERFACE IGroupPolicyObject + DECLARE_INTERFACE_(IGroupPolicyObject,IUnknown) { + STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + STDMETHOD(New) (THIS_ LPOLESTR pszDomainName,LPOLESTR pszDisplayName,DWORD dwFlags) PURE; + STDMETHOD(OpenDSGPO) (THIS_ LPOLESTR pszPath,DWORD dwFlags) PURE; + STDMETHOD(OpenLocalMachineGPO) (THIS_ DWORD dwFlags) PURE; + STDMETHOD(OpenRemoteMachineGPO) (THIS_ LPOLESTR pszComputerName,DWORD dwFlags) PURE; + STDMETHOD(Save) (THIS_ BOOL bMachine, BOOL bAdd,GUID *pGuidExtension,GUID *pGuid) PURE; + STDMETHOD(Delete) (THIS) PURE; + STDMETHOD(GetName) (THIS_ LPOLESTR pszName,int cchMaxLength) PURE; + STDMETHOD(GetDisplayName) (THIS_ LPOLESTR pszName,int cchMaxLength) PURE; + STDMETHOD(SetDisplayName) (THIS_ LPOLESTR pszName) PURE; + STDMETHOD(GetPath) (THIS_ LPOLESTR pszPath,int cchMaxPath) PURE; + STDMETHOD(GetDSPath) (THIS_ DWORD dwSection,LPOLESTR pszPath,int cchMaxPath) PURE; + STDMETHOD(GetFileSysPath) (THIS_ DWORD dwSection,LPOLESTR pszPath,int cchMaxPath) PURE; + STDMETHOD(GetRegistryKey) (THIS_ DWORD dwSection,HKEY *hKey) PURE; + STDMETHOD(GetOptions) (THIS_ DWORD *dwOptions) PURE; + STDMETHOD(SetOptions) (THIS_ DWORD dwOptions,DWORD dwMask) PURE; + STDMETHOD(GetType) (THIS_ GROUP_POLICY_OBJECT_TYPE *gpoType) PURE; + STDMETHOD(GetMachineName) (THIS_ LPOLESTR pszName,int cchMaxLength) PURE; + STDMETHOD(GetPropertySheetPages) (THIS_ HPROPSHEETPAGE **hPages,UINT *uPageCount) PURE; + }; + typedef IGroupPolicyObject *LPGROUPPOLICYOBJECT; BOOL SetLGP(BOOL bRestore, const char* szPath, const char* szPolicy, DWORD dwValue) { @@ -742,7 +706,7 @@ BOOL SetLGP(BOOL bRestore, const char* szPath, const char* szPolicy, DWORD dwVal HRESULT hr; IGroupPolicyObject* pLGPO; // These statuc values are used to restore initial state - static BOOL existing_key = FALSE; + static BOOL key_was_present = FALSE; static DWORD original_val; HKEY path_key = NULL, policy_key = NULL; // MSVC is finicky about these ones => redefine them @@ -791,20 +755,20 @@ BOOL SetLGP(BOOL bRestore, const char* szPath, const char* szPolicy, DWORD dwVal goto error; } - if ((disp == REG_OPENED_EXISTING_KEY) && (!bRestore) && (!existing_key)) { + if ((disp == REG_OPENED_EXISTING_KEY) && (!bRestore) && (!key_was_present)) { // backup existing value for restore - existing_key = TRUE; + key_was_present = TRUE; regtype = REG_DWORD; r = RegQueryValueExA(policy_key, szPolicy, NULL, ®type, (LPBYTE)&original_val, &val_size); if (r == ERROR_FILE_NOT_FOUND) { // The Key exists but not its value, which is OK - existing_key = FALSE; + key_was_present = FALSE; } else if (r != ERROR_SUCCESS) { uprintf("SetLGP: Failed to read original %s policy value - error %x\n", szPolicy, r); } } - if ((!bRestore) || (existing_key)) { + if ((!bRestore) || (key_was_present)) { val = (bRestore)?original_val:dwValue; r = RegSetValueExA(policy_key, szPolicy, 0, REG_DWORD, (BYTE*)&val, sizeof(val)); } else { @@ -822,11 +786,7 @@ BOOL SetLGP(BOOL bRestore, const char* szPath, const char* szPolicy, DWORD dwVal uprintf("SetLGP: Unable to apply %s policy - error %x\n", szPolicy, hr); goto error; } else { - if ((bRestore) && (!existing_key)) { - uprintf("SetLGP: Successfully removed %s policy key\n", szPolicy); - } else { - uprintf("SetLGP: Successfully %s %s policy to 0x%08X\n", (bRestore)?"restored":"set", szPolicy, val); - } + uprintf("SetLGP: Successfully %s %s policy\n", (bRestore)?"restored":"disabled", szPolicy); } RegCloseKey(path_key); @@ -839,7 +799,6 @@ error: if (pLGPO != NULL) pLGPO->lpVtbl->Release(pLGPO); return FALSE; } -#pragma pop_macro("INTERFACE") /* * Toggle controls according to operation diff --git a/src/rufus.rc b/src/rufus.rc index a7b40992..3394c45a 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 278 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.0.2.90 (Beta)" +CAPTION "Rufus v1.0.3.91" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,236,50,14 @@ -59,12 +59,12 @@ CAPTION "About Rufus" FONT 8, "Microsoft Sans Serif", 400, 0, 0x0 BEGIN ICON IDI_ICON,IDC_ABOUT_ICON,11,8,20,20 - LTEXT "Rufus - The Reliable USB Formatting Utility *BETA*",IDC_RUFUS_BOLD,46,8,240,10,SS_NOPREFIX | SS_NOTIFY + LTEXT "Rufus - The Reliable USB Formatting Utility",IDC_RUFUS_BOLD,46,8,240,10,SS_NOPREFIX | SS_NOTIFY LTEXT "Copyright (c) 2011 Pete Batard",IDC_STATIC,46,36,139,8 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.0.2 (Build 90)",IDC_STATIC,46,19,78,8 + LTEXT "Version 1.0.3 (Build 91)",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 @@ -163,8 +163,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,2,90 - PRODUCTVERSION 1,0,2,90 + FILEVERSION 1,0,3,91 + PRODUCTVERSION 1,0,3,91 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -181,13 +181,13 @@ BEGIN BEGIN VALUE "CompanyName", "akeo.ie" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.0.2.90" + VALUE "FileVersion", "1.0.3.91" 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.0.2.90" + VALUE "ProductVersion", "1.0.3.91" END END BLOCK "VarFileInfo"