[misc] various small improvements

* Less scary message from bad blocks
* Better error report for read/write_sectors
* Fix a WDK warning
This commit is contained in:
Pete Batard 2012-11-03 17:22:28 +00:00
parent 261834e31f
commit 8dc5429d9f
5 changed files with 11 additions and 9 deletions

View file

@ -457,7 +457,7 @@ static unsigned int test_rw(HANDLE hDrive, blk_t last_block, size_t block_size,
srand((unsigned int)GetTickCount()); srand((unsigned int)GetTickCount());
id_offset = rand()* (block_size-sizeof(blk_t)) / RAND_MAX; id_offset = rand()* (block_size-sizeof(blk_t)) / RAND_MAX;
pattern_fill(buffer, pattern[pat_idx], blocks_at_once * block_size); pattern_fill(buffer, pattern[pat_idx], blocks_at_once * block_size);
uprintf("%sBlock ID at offset: %d\n", bb_prefix, id_offset); uprintf("%sUsing offset %d for fake device check\n", bb_prefix, id_offset);
num_blocks = last_block - 1; num_blocks = last_block - 1;
currently_testing = first_block; currently_testing = first_block;
if (s_flag | v_flag) if (s_flag | v_flag)

View file

@ -64,7 +64,7 @@ HANDLE GetDriveHandle(DWORD DriveIndex, char* DriveLetter, BOOL bWriteAccess, BO
} }
DriveIndex -= DRIVE_INDEX_MIN; DriveIndex -= DRIVE_INDEX_MIN;
// If no drive letter is requested, open a phyical drive // If no drive letter is requested, open a physical drive
if (DriveLetter == NULL) { if (DriveLetter == NULL) {
safe_sprintf(physical_drive, sizeof(physical_drive), "\\\\.\\PHYSICALDRIVE%d", DriveIndex); safe_sprintf(physical_drive, sizeof(physical_drive), "\\\\.\\PHYSICALDRIVE%d", DriveIndex);
hDrive = CreateFileA(physical_drive, GENERIC_READ|(bWriteAccess?GENERIC_WRITE:0), hDrive = CreateFileA(physical_drive, GENERIC_READ|(bWriteAccess?GENERIC_WRITE:0),

View file

@ -48,6 +48,7 @@ int64_t write_sectors(HANDLE hDrive, uint64_t SectorSize,
if((!WriteFile(hDrive, pBuf, Size, &Size, NULL)) || (Size != nSectors*SectorSize)) if((!WriteFile(hDrive, pBuf, Size, &Size, NULL)) || (Size != nSectors*SectorSize))
{ {
uprintf("write_sectors: Write error - %s\n", WindowsErrorString()); uprintf("write_sectors: Write error - %s\n", WindowsErrorString());
uprintf(" Wrote: %d, Expected: %d\n", Size, nSectors*SectorSize);
uprintf(" StartSector:%0X, nSectors:%0X, SectorSize:%0X\n", StartSector, nSectors, SectorSize); uprintf(" StartSector:%0X, nSectors:%0X, SectorSize:%0X\n", StartSector, nSectors, SectorSize);
return Size; return Size;
} }
@ -80,6 +81,7 @@ int64_t read_sectors(HANDLE hDrive, uint64_t SectorSize,
if((!ReadFile(hDrive, pBuf, Size, &Size, NULL)) || (Size != nSectors*SectorSize)) if((!ReadFile(hDrive, pBuf, Size, &Size, NULL)) || (Size != nSectors*SectorSize))
{ {
uprintf("read_sectors: Read error - %s\n", WindowsErrorString()); uprintf("read_sectors: Read error - %s\n", WindowsErrorString());
uprintf(" Read: %d, Expected: %d\n", Size, nSectors*SectorSize);
uprintf(" StartSector:%0X, nSectors:%0X, SectorSize:%0X\n", StartSector, nSectors, SectorSize); uprintf(" StartSector:%0X, nSectors:%0X, SectorSize:%0X\n", StartSector, nSectors, SectorSize);
} }

View file

@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 316 IDD_DIALOG DIALOGEX 12, 12, 206, 316
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.2.0.184" CAPTION "Rufus v1.2.0.185"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,278,50,14 DEFPUSHBUTTON "Start",IDC_START,94,278,50,14
@ -77,7 +77,7 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP
CONTROL "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL, CONTROL "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL,
"SysLink",WS_TABSTOP,46,47,114,9 "SysLink",WS_TABSTOP,46,47,114,9
LTEXT "Version 1.2.0 (Build 184)",IDC_STATIC,46,19,78,8 LTEXT "Version 1.2.0 (Build 185)",IDC_STATIC,46,19,78,8
PUSHBUTTON "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP 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 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 LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8
@ -237,8 +237,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,0,184 FILEVERSION 1,2,0,185
PRODUCTVERSION 1,2,0,184 PRODUCTVERSION 1,2,0,185
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -255,13 +255,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "akeo.ie" VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.2.0.184" VALUE "FileVersion", "1.2.0.185"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.2.0.184" VALUE "ProductVersion", "1.2.0.185"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -944,7 +944,7 @@ BOOL IsShown(HWND hDlg)
LONG GetEntryWidth(HWND hDropDown, const char *entry) LONG GetEntryWidth(HWND hDropDown, const char *entry)
{ {
HDC hDC; HDC hDC;
HFONT hFont, hDefFont; HFONT hFont, hDefFont = NULL;
SIZE size; SIZE size;
WCHAR* wentry = NULL; WCHAR* wentry = NULL;
int len; int len;