mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[core] added badblock checks (ALPHA)
* also fixed some issues with read_sectors/write_sectors and dropped bufsize parameters
This commit is contained in:
parent
d81525d3f4
commit
e419cf9015
18 changed files with 1219 additions and 80 deletions
|
@ -32,7 +32,7 @@ NORMAL_UNINSTALL = :
|
|||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
subdir = .
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/configure $(am__configure_deps)
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
|
|
3
TODO
3
TODO
|
@ -6,6 +6,7 @@ o set keyboard according to locale in DOS
|
|||
o allow selection of one of the existing compatible volume (keep existing MBR) / full repartitioning (overwrite MBR)
|
||||
o FreeDOS integration
|
||||
o Enable compression for NTFS
|
||||
o Bootable NTFS/exFAT
|
||||
o Bootable NTFS/exFAT?
|
||||
http://sourceforge.net/projects/grub4dos/
|
||||
o GPT support?
|
||||
o disable indexing support on NTFS?
|
||||
|
|
2
configure
vendored
2
configure
vendored
|
@ -3360,7 +3360,7 @@ $as_echo "#define _GNU_SOURCE /**/" >>confdefs.h
|
|||
# AC_MSG_ERROR([unsupported development environment])
|
||||
#esac
|
||||
|
||||
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501"
|
||||
AM_CFLAGS="${AM_CFLAGS} -D__MSVCRT_VERSION__=0x700 -DWINVER=0x501 -D_WIN32_IE=0x501"
|
||||
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined"
|
||||
|
||||
# Debug logging
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
AC_INIT([rufus], [1.0.1], [https://github.com/pbatard/rufus/issues], [rufus], [https://github.com/pbatard/rufus])
|
||||
AC_INIT([rufus], [1.0.2], [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])
|
||||
|
@ -31,7 +31,7 @@ AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions])
|
|||
# AC_MSG_ERROR([unsupported development environment])
|
||||
#esac
|
||||
|
||||
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501"
|
||||
AM_CFLAGS="${AM_CFLAGS} -D__MSVCRT_VERSION__=0x700 -DWINVER=0x501 -D_WIN32_IE=0x501"
|
||||
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined"
|
||||
|
||||
# Debug logging
|
||||
|
|
|
@ -146,6 +146,7 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\badblocks.c" />
|
||||
<ClCompile Include="..\br.c" />
|
||||
<ClCompile Include="..\drive.c" />
|
||||
<ClCompile Include="..\fat12.c" />
|
||||
|
@ -159,6 +160,7 @@
|
|||
<ClCompile Include="..\stdlg.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\badblocks.h" />
|
||||
<ClInclude Include="..\format.h" />
|
||||
<ClInclude Include="..\inc\br.h" />
|
||||
<ClInclude Include="..\inc\br_fat12_0x0.h" />
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
<ClCompile Include="..\drive.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\badblocks.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\rufus.h">
|
||||
|
@ -155,6 +158,9 @@
|
|||
<ClInclude Include="..\format.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\badblocks.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\rufus.ico">
|
||||
|
|
|
@ -23,15 +23,16 @@ TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \
|
|||
# http://jpassing.com/2008/02/01/how-to-use-manifests-with-buildexe/
|
||||
SXS_APPLICATION_MANIFEST=common_controls_and_elevation.manifest
|
||||
|
||||
SOURCES=rufus.c \
|
||||
format.c \
|
||||
stdio.c \
|
||||
stdlg.c \
|
||||
msdos.c \
|
||||
drive.c \
|
||||
file.c \
|
||||
br.c \
|
||||
fat12.c \
|
||||
fat16.c \
|
||||
fat32.c \
|
||||
SOURCES=rufus.c \
|
||||
format.c \
|
||||
stdio.c \
|
||||
stdlg.c \
|
||||
msdos.c \
|
||||
badblocks.c \
|
||||
drive.c \
|
||||
file.c \
|
||||
br.c \
|
||||
fat12.c \
|
||||
fat16.c \
|
||||
fat32.c \
|
||||
rufus.rc
|
||||
|
|
|
@ -9,7 +9,7 @@ pkg_v_rc_0 = @echo " RC $@";
|
|||
%_rc.o: %.rc
|
||||
$(pkg_v_rc)$(WINDRES) -i $< -o $@
|
||||
|
||||
rufus_SOURCES = fat12.c fat16.c fat32.c br.c file.c drive.c msdos.c format.c stdio.c stdlg.c rufus.c
|
||||
rufus_SOURCES = fat12.c fat16.c fat32.c br.c file.c drive.c msdos.c badblocks.c format.c stdio.c stdlg.c rufus.c
|
||||
rufus_CFLAGS = -I./inc $(ARCH_CFLAGS) $(AM_CFLAGS)
|
||||
rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows
|
||||
rufus_LDADD = rufus_rc.o -lsetupapi -lole32 -lgdi32
|
||||
|
|
|
@ -48,8 +48,9 @@ PROGRAMS = $(noinst_PROGRAMS)
|
|||
am_rufus_OBJECTS = rufus-fat12.$(OBJEXT) rufus-fat16.$(OBJEXT) \
|
||||
rufus-fat32.$(OBJEXT) rufus-br.$(OBJEXT) rufus-file.$(OBJEXT) \
|
||||
rufus-drive.$(OBJEXT) rufus-msdos.$(OBJEXT) \
|
||||
rufus-format.$(OBJEXT) rufus-stdio.$(OBJEXT) \
|
||||
rufus-stdlg.$(OBJEXT) rufus-rufus.$(OBJEXT)
|
||||
rufus-badblocks.$(OBJEXT) rufus-format.$(OBJEXT) \
|
||||
rufus-stdio.$(OBJEXT) rufus-stdlg.$(OBJEXT) \
|
||||
rufus-rufus.$(OBJEXT)
|
||||
rufus_OBJECTS = $(am_rufus_OBJECTS)
|
||||
rufus_DEPENDENCIES = rufus_rc.o
|
||||
rufus_LINK = $(CCLD) $(rufus_CFLAGS) $(CFLAGS) $(rufus_LDFLAGS) \
|
||||
|
@ -167,7 +168,7 @@ top_srcdir = @top_srcdir@
|
|||
pkg_v_rc = $(pkg_v_rc_$(V))
|
||||
pkg_v_rc_ = $(pkg_v_rc_$(AM_DEFAULT_VERBOSITY))
|
||||
pkg_v_rc_0 = @echo " RC $@";
|
||||
rufus_SOURCES = fat12.c fat16.c fat32.c br.c file.c drive.c msdos.c format.c stdio.c stdlg.c rufus.c
|
||||
rufus_SOURCES = fat12.c fat16.c fat32.c br.c file.c drive.c msdos.c badblocks.c format.c stdio.c stdlg.c rufus.c
|
||||
rufus_CFLAGS = -I./inc $(ARCH_CFLAGS) $(AM_CFLAGS)
|
||||
rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows
|
||||
rufus_LDADD = rufus_rc.o -lsetupapi -lole32 -lgdi32
|
||||
|
@ -282,6 +283,14 @@ rufus-msdos.obj: msdos.c
|
|||
$(AM_V_CC) @AM_BACKSLASH@
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-msdos.obj `if test -f 'msdos.c'; then $(CYGPATH_W) 'msdos.c'; else $(CYGPATH_W) '$(srcdir)/msdos.c'; fi`
|
||||
|
||||
rufus-badblocks.o: badblocks.c
|
||||
$(AM_V_CC) @AM_BACKSLASH@
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-badblocks.o `test -f 'badblocks.c' || echo '$(srcdir)/'`badblocks.c
|
||||
|
||||
rufus-badblocks.obj: badblocks.c
|
||||
$(AM_V_CC) @AM_BACKSLASH@
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-badblocks.obj `if test -f 'badblocks.c'; then $(CYGPATH_W) 'badblocks.c'; else $(CYGPATH_W) '$(srcdir)/badblocks.c'; fi`
|
||||
|
||||
rufus-format.o: format.c
|
||||
$(AM_V_CC) @AM_BACKSLASH@
|
||||
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-format.o `test -f 'format.c' || echo '$(srcdir)/'`format.c
|
||||
|
|
1051
src/badblocks.c
Normal file
1051
src/badblocks.c
Normal file
File diff suppressed because it is too large
Load diff
60
src/badblocks.h
Normal file
60
src/badblocks.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* badblocks.c - Bad blocks checker
|
||||
*
|
||||
* Copyright (C) 1992, 1993, 1994 Remy Card <card@masi.ibp.fr>
|
||||
* Laboratoire MASI, Institut Blaise Pascal
|
||||
* Universite Pierre et Marie Curie (Paris VI)
|
||||
*
|
||||
* Copyright 1995, 1996, 1997, 1998, 1999 by Theodore Ts'o
|
||||
* Copyright 1999 by David Beattie
|
||||
* Copyright 2011 by Pete Batard
|
||||
*
|
||||
* This file is based on the minix file system programs fsck and mkfs
|
||||
* written and copyrighted by Linus Torvalds <Linus.Torvalds@cs.helsinki.fi>
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Public
|
||||
* License.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef __u32
|
||||
#define __u32 UINT32
|
||||
#endif
|
||||
typedef UINT32 blk_t;
|
||||
typedef struct ext2_struct_u32_list *ext2_badblocks_list;
|
||||
typedef struct ext2_struct_u32_iterate *ext2_badblocks_iterate;
|
||||
typedef struct ext2_struct_u32_list *ext2_u32_list;
|
||||
typedef struct ext2_struct_u32_iterate *ext2_u32_iterate;
|
||||
typedef long errcode_t;
|
||||
|
||||
#define EXT2_ET_NO_MEMORY (2133571398L)
|
||||
#define EXT2_ET_MAGIC_BADBLOCKS_LIST (2133571330L)
|
||||
#define EXT2_ET_MAGIC_BADBLOCKS_ITERATE (2133571331L)
|
||||
|
||||
#define EXT2_CHECK_MAGIC(struct, code) \
|
||||
if ((struct)->magic != (code)) return (code)
|
||||
|
||||
/*
|
||||
* Badblocks list
|
||||
*/
|
||||
struct ext2_struct_u32_list {
|
||||
int magic;
|
||||
int num;
|
||||
int size;
|
||||
__u32 *list;
|
||||
int badblocks_flags;
|
||||
};
|
||||
|
||||
struct ext2_struct_u32_iterate {
|
||||
int magic;
|
||||
ext2_u32_list bb;
|
||||
int ptr;
|
||||
};
|
||||
|
||||
/*
|
||||
* Shared prototypes
|
||||
*/
|
||||
BOOL BadBlocks(HANDLE hPhysicalDrive, ULONGLONG disk_size, int block_size);
|
49
src/file.c
49
src/file.c
|
@ -22,64 +22,53 @@
|
|||
#include "rufus.h"
|
||||
#include "file.h"
|
||||
|
||||
/* Returns the number of bytes written or -1 on error */
|
||||
int write_sectors(HANDLE hDrive, size_t SectorSize,
|
||||
size_t StartSector, size_t nSectors,
|
||||
const void *pBuf, size_t BufSize)
|
||||
const void *pBuf)
|
||||
{
|
||||
LARGE_INTEGER ptr;
|
||||
DWORD Size;
|
||||
|
||||
if(SectorSize * nSectors > BufSize)
|
||||
{
|
||||
uprintf("write_sectors: Buffer is too small\n");
|
||||
return 0;
|
||||
}
|
||||
DWORD Size = 0;
|
||||
|
||||
ptr.QuadPart = StartSector*SectorSize;
|
||||
if(!SetFilePointerEx(hDrive, ptr, NULL, FILE_BEGIN))
|
||||
{
|
||||
uprintf("write_sectors: Could not access sector %d - %s\n", StartSector, WindowsErrorString());
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((!WriteFile(hDrive, pBuf, (DWORD)BufSize, &Size, NULL)) || (Size != BufSize))
|
||||
if((!WriteFile(hDrive, pBuf, (DWORD)nSectors*SectorSize, &Size, NULL)) || (Size != nSectors*SectorSize))
|
||||
{
|
||||
uprintf("write_sectors: Write error - %s\n", WindowsErrorString());
|
||||
uprintf(" StartSector:%0X, nSectors:%0X, SectorSize:%0X\n", StartSector, nSectors, SectorSize);
|
||||
return 0;
|
||||
return Size;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return Size;
|
||||
}
|
||||
|
||||
/* Returns the number of bytes read or -1 on error */
|
||||
int read_sectors(HANDLE hDrive, size_t SectorSize,
|
||||
size_t StartSector, size_t nSectors,
|
||||
void *pBuf, size_t BufSize)
|
||||
void *pBuf)
|
||||
{
|
||||
LARGE_INTEGER ptr;
|
||||
DWORD Size;
|
||||
|
||||
if(SectorSize * nSectors > BufSize)
|
||||
{
|
||||
uprintf("read_sectors: Buffer is too small\n");
|
||||
return 0;
|
||||
}
|
||||
DWORD Size = 0;
|
||||
|
||||
ptr.QuadPart = StartSector*SectorSize;
|
||||
if(!SetFilePointerEx(hDrive, ptr, NULL, FILE_BEGIN))
|
||||
{
|
||||
uprintf("read_sectors: Could not access sector %d - %s\n", StartSector, WindowsErrorString());
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((!ReadFile(hDrive, pBuf, (DWORD)BufSize, &Size, NULL)) || (Size != BufSize))
|
||||
if((!ReadFile(hDrive, pBuf, (DWORD)nSectors*SectorSize, &Size, NULL)) || (Size != nSectors*SectorSize))
|
||||
{
|
||||
uprintf("read_sectors: Read error - %s\n", WindowsErrorString());
|
||||
uprintf(" StartSector:%0X, nSectors:%0X, SectorSize:%0X\n", StartSector, nSectors, SectorSize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return Size;
|
||||
}
|
||||
|
||||
/* Use a bastardized fp that contains a Windows handle and the sector size */
|
||||
|
@ -101,8 +90,8 @@ int contains_data(FILE *fp, size_t Position,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(!read_sectors(hDrive, SectorSize, StartSector,
|
||||
NumSectors, aucBuf, sizeof(aucBuf)))
|
||||
if(read_sectors(hDrive, SectorSize, StartSector,
|
||||
NumSectors, aucBuf) <= 0)
|
||||
return 0;
|
||||
|
||||
if(memcmp(pData, &aucBuf[Position - StartSector*SectorSize], Len))
|
||||
|
@ -130,15 +119,15 @@ int write_data(FILE *fp, size_t Position,
|
|||
}
|
||||
|
||||
/* Data to write may not be aligned on a sector boundary => read into a sector buffer first */
|
||||
if(!read_sectors(hDrive, SectorSize, StartSector,
|
||||
NumSectors, aucBuf, sizeof(aucBuf)))
|
||||
if(read_sectors(hDrive, SectorSize, StartSector,
|
||||
NumSectors, aucBuf) <= 0)
|
||||
return 0;
|
||||
|
||||
if(!memcpy(&aucBuf[Position - StartSector*SectorSize], pData, Len))
|
||||
return 0;
|
||||
|
||||
if(!write_sectors(hDrive, SectorSize, StartSector,
|
||||
NumSectors, aucBuf, sizeof(aucBuf)))
|
||||
if(write_sectors(hDrive, SectorSize, StartSector,
|
||||
NumSectors, aucBuf) <= 0)
|
||||
return 0;
|
||||
return 1;
|
||||
} /* write_data */
|
||||
|
|
27
src/format.c
27
src/format.c
|
@ -37,6 +37,7 @@
|
|||
#include "fat32.h"
|
||||
#include "file.h"
|
||||
#include "format.h"
|
||||
#include "badblocks.h"
|
||||
|
||||
/*
|
||||
* Globals
|
||||
|
@ -234,7 +235,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (!read_sectors(hPhysicalDrive, SelectedDrive.Geometry.BytesPerSector, 0, nSecs, buf, SecSize)) {
|
||||
if (!read_sectors(hPhysicalDrive, SelectedDrive.Geometry.BytesPerSector, 0, nSecs, buf)) {
|
||||
uprintf("Could not read MBR\n");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_READ_FAULT;
|
||||
goto out;
|
||||
|
@ -262,7 +263,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
|||
buf[0x1be] = 0x80; // Set first partition bootable
|
||||
}
|
||||
|
||||
if (!write_sectors(hPhysicalDrive, SelectedDrive.Geometry.BytesPerSector, 0, nSecs, buf, SecSize*nSecs)) {
|
||||
if (!write_sectors(hPhysicalDrive, SecSize, 0, nSecs, buf)) {
|
||||
uprintf("Could not write MBR\n");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT;
|
||||
goto out;
|
||||
|
@ -318,7 +319,25 @@ void __cdecl FormatThread(void* param)
|
|||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_OPEN_FAILED;
|
||||
goto out;
|
||||
}
|
||||
// At this stage with have both a handle and a lock to the physical drive
|
||||
// At this stage with have both a handle and a lock to the physical drive...
|
||||
|
||||
if (IsChecked(IDC_BADBLOCKS)) {
|
||||
// ... but we can't write sectors that are part of a volume, even if we have
|
||||
// access to physical, unless we have a lock (which doesn't have to be write)
|
||||
hLogicalVolume = GetDriveHandle(num, drive_name, FALSE, TRUE);
|
||||
if (hLogicalVolume == INVALID_HANDLE_VALUE) {
|
||||
uprintf("Could not lock volume for badblock checks\n");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_OPEN_FAILED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (BadBlocks(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.Geometry.BytesPerSector)) {
|
||||
// TODO: report block failure number, etc
|
||||
uprintf("Bad blocks check failed.\n");
|
||||
goto out;
|
||||
}
|
||||
safe_unlockclose(hLogicalVolume);
|
||||
}
|
||||
|
||||
if (!CreatePartition(hPhysicalDrive)) {
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_PARTITION_FAILURE;
|
||||
|
@ -359,7 +378,7 @@ void __cdecl FormatThread(void* param)
|
|||
}
|
||||
|
||||
if (IsChecked(IDC_DOS)) {
|
||||
// We must have a lock to modify the FS boot record...
|
||||
// We must have a lock to modify the volume boot record...
|
||||
hLogicalVolume = GetDriveHandle(num, drive_name, TRUE, TRUE);
|
||||
if (hLogicalVolume == INVALID_HANDLE_VALUE) {
|
||||
uprintf("Could not re-mount volume for partition boot record access\n");
|
||||
|
|
|
@ -14,14 +14,14 @@ int contains_data(FILE *fp, size_t ulPosition,
|
|||
int write_data(FILE *fp, size_t ulPosition,
|
||||
const void *pData, size_t uiLen);
|
||||
|
||||
/* Checks if a file contains a data pattern of length uiLen at position
|
||||
ulPositoin. The file pointer will change when calling this function! */
|
||||
/* Writes nSectors of size SectorSize starting at sector StartSector */
|
||||
int write_sectors(void *hDrive, size_t SectorSize,
|
||||
size_t StartSector, size_t nSectors,
|
||||
const void *pBuf, size_t BufSize);
|
||||
const void *pBuf);
|
||||
|
||||
/* Reads nSectors of size SectorSize starting at sector StartSector */
|
||||
int read_sectors(void *hDrive, size_t SectorSize,
|
||||
size_t StartSector, size_t nSectors,
|
||||
void *pBuf, size_t BufSize);
|
||||
void *pBuf);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -288,6 +288,7 @@ BOOL ExtractMSDOS(const char* path)
|
|||
{
|
||||
char dllname[MAX_PATH] = "C:\\Windows\\System32";
|
||||
int i, j;
|
||||
BOOL r = TRUE;
|
||||
HMODULE hDLL;
|
||||
HRSRC hDiskImage;
|
||||
|
||||
|
@ -321,17 +322,17 @@ BOOL ExtractMSDOS(const char* path)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
for (i=0; i<FAT_FN_DIR_ENTRY_LAST; i++) {
|
||||
for (i=0; r && i<FAT_FN_DIR_ENTRY_LAST; i++) {
|
||||
if (DiskImage[FAT12_ROOTDIR_OFFSET + i*FAT_BYTES_PER_DIRENT] == FAT_DIRENT_DELETED)
|
||||
continue;
|
||||
for (j=0; j<ARRAYSIZE(extractlist); j++) {
|
||||
for (j=0; r && j<ARRAYSIZE(extractlist); j++) {
|
||||
if (memcmp(extractlist[j], &DiskImage[FAT12_ROOTDIR_OFFSET + i*FAT_BYTES_PER_DIRENT], 8+3) == 0) {
|
||||
ExtractFAT(i, path);
|
||||
r = ExtractFAT(i, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreeLibrary(hDLL);
|
||||
|
||||
return TRUE;
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
#define IDC_LABEL 1008
|
||||
#define IDC_QUICKFORMAT 1009
|
||||
#define IDC_DOS 1010
|
||||
#define IDC_PROGRESS 1011
|
||||
#define IDC_BADBLOCKS 1011
|
||||
#define IDC_PROGRESS 1012
|
||||
#define IDC_ABOUT_LICENSE 1030
|
||||
#define IDC_ABOUT_ICON 1031
|
||||
#define IDC_RUFUS_BOLD 1032
|
||||
|
|
|
@ -34,10 +34,6 @@
|
|||
#include <process.h>
|
||||
#include <dbt.h>
|
||||
|
||||
// http://git.kernel.org/?p=fs/ext2/e2fsprogs.git;a=blob;f=misc/badblocks.c
|
||||
// http://thestarman.pcministry.com/asm/mbr/MSWIN41.htm
|
||||
// http://sourceforge.net/projects/grub4dos/ (bootable NTFS?)
|
||||
|
||||
#include "msapi_utf8.h"
|
||||
#include "resource.h"
|
||||
#include "rufus.h"
|
||||
|
@ -571,6 +567,7 @@ static void EnableControls(BOOL bEnable)
|
|||
} else {
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_DOS), FALSE);
|
||||
}
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_BADBLOCKS), bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_ABOUT), bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_START), bEnable);
|
||||
SetDlgItemTextA(hMainDialog, IDCANCEL, bEnable?"Close":"Cancel");
|
||||
|
|
28
src/rufus.rc
28
src/rufus.rc
|
@ -27,14 +27,14 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
|
|||
// Dialog
|
||||
//
|
||||
|
||||
IDD_DIALOG DIALOGEX 12, 12, 206, 263
|
||||
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.1.76"
|
||||
CAPTION "Rufus v1.0.2.77"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,94,223,50,14
|
||||
PUSHBUTTON "Close",IDCANCEL,148,223,50,14
|
||||
DEFPUSHBUTTON "Start",IDC_START,94,236,50,14
|
||||
PUSHBUTTON "Close",IDCANCEL,148,236,50,14
|
||||
COMBOBOX IDC_DEVICE,8,17,190,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "&Device",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,9,6,22,8
|
||||
COMBOBOX IDC_FILESYSTEM,8,75,190,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
|
@ -43,13 +43,15 @@ BEGIN
|
|||
LTEXT "Ca&pacity",IDC_STATIC,9,35,29,8
|
||||
COMBOBOX IDC_CLUSTERSIZE,8,104,190,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "&Cluster size",IDC_STATIC,9,93,105,10
|
||||
PUSHBUTTON "About...",IDC_ABOUT,8,223,50,14
|
||||
GROUPBOX "Format Options",IDC_STATIC,7,149,189,40
|
||||
PUSHBUTTON "About...",IDC_ABOUT,8,236,50,14
|
||||
GROUPBOX "Format Options",IDC_STATIC,7,149,189,52
|
||||
EDITTEXT IDC_LABEL,7,131,190,13,ES_AUTOHSCROLL
|
||||
CONTROL "&Quick Format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,58,10
|
||||
CONTROL "Create an &MS-DOS startup disk",IDC_DOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,115,10
|
||||
LTEXT "New volume &label",IDC_STATIC,9,121,105,10
|
||||
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,197,189,9
|
||||
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,210,189,9
|
||||
CONTROL "Check device for bad blocks (*ALPHA*)",IDC_BADBLOCKS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,185,171,10
|
||||
END
|
||||
|
||||
IDD_ABOUTBOX DIALOGEX 0, 0, 287, 195
|
||||
|
@ -63,7 +65,7 @@ BEGIN
|
|||
DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP
|
||||
CONTROL "<a href=""https://github.com/pbatard/rufus/wiki/Rufus"">https://github.com/pbatard/rufus</a>",IDC_ABOUT_RUFUS_URL,
|
||||
"SysLink",WS_TABSTOP,46,47,114,9
|
||||
LTEXT "Version 1.0.1 (Build 76)",IDC_STATIC,46,19,78,8
|
||||
LTEXT "Version 1.0.2 (Build 77)",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
|
||||
|
@ -138,7 +140,7 @@ GUIDELINES DESIGNINFO
|
|||
BEGIN
|
||||
IDD_DIALOG, DIALOG
|
||||
BEGIN
|
||||
BOTTOMMARGIN, 249
|
||||
BOTTOMMARGIN, 264
|
||||
END
|
||||
|
||||
IDD_ABOUTBOX, DIALOG
|
||||
|
@ -162,8 +164,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,1,76
|
||||
PRODUCTVERSION 1,0,1,76
|
||||
FILEVERSION 1,0,2,77
|
||||
PRODUCTVERSION 1,0,2,77
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -180,13 +182,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "akeo.ie"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "1.0.1.76"
|
||||
VALUE "FileVersion", "1.0.2.77"
|
||||
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.1.76"
|
||||
VALUE "ProductVersion", "1.0.2.77"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in a new issue