Permalink
Browse files

[misc] remove no longer needed XP workarounds

  • Loading branch information...
pbatard committed Nov 13, 2017
1 parent c5f4e5a commit 903ac993f2c762b2f4abc074c6fb9028117a9103
Showing with 294 additions and 932 deletions.
  1. +1 −4 _sign.cmd
  2. +1 −3 configure
  3. +1 −3 configure.ac
  4. BIN res/down.ico
  5. BIN res/up.ico
  6. +1 −1 src/Makefile.am
  7. +1 −1 src/Makefile.in
  8. +2 −2 src/badblocks.c
  9. +2 −2 src/checksum.c
  10. +3 −5 src/dev.c
  11. +9 −9 src/drive.c
  12. +12 −21 src/format.c
  13. +1 −0 src/iso.c
  14. +3 −3 src/localization.c
  15. +1 −452 src/missing.h
  16. +0 −2 src/resource.h
  17. +77 −112 src/rufus.c
  18. +2 −6 src/rufus.h
  19. +5 −9 src/rufus.rc
  20. +1 −7 src/stdfn.c
  21. +5 −4 src/stdio.c
  22. +164 −284 src/stdlg.c
  23. +2 −2 src/vhd.c
View
@@ -1,6 +1,3 @@
@echo off
"C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool" sign /v /sha1 655f6413a8f721e3286ace95025c9e0ea132a984 /fd SHA1 /tr http://timestamp.comodoca.com/rfc3161 /td SHA1 %1
if ERRORLEVEL 1 goto out
"C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool" sign /as /v /sha1 5759b23dc8f45e9120a7317f306e5b6890b612f0 /fd SHA256 /tr http://timestamp.comodoca.com/rfc3161 /td SHA256 %1
:out
"C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool" sign /v /sha1 5759b23dc8f45e9120a7317f306e5b6890b612f0 /fd SHA256 /tr http://timestamp.comodoca.com/rfc3161 /td SHA256 %1
exit
View
@@ -3813,9 +3813,7 @@ esac
$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 -D_WIN32_WINNT=0x501"
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800"
# "-Wl,--nxcompat" to enable DEP (Data Execution Prevention)
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat"
View
@@ -17,9 +17,7 @@ AC_CHECK_TOOL(WINDRES, windres, windres)
AC_C_INLINE
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 -D_WIN32_WINNT=0x501"
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x601 -D_WIN32_WINNT=0x601 -D_WIN32_IE=0x800"
# "-Wl,--nxcompat" to enable DEP (Data Execution Prevention)
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat"
View
Binary file not shown.
View
Binary file not shown.
View
@@ -15,4 +15,4 @@ rufus_SOURCES = badblocks.c checksum.c dev.c dos.c dos_locale.c drive.c format.c
rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller -I./syslinux/win -I./libcdio $(AM_CFLAGS)
rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows
rufus_LDADD = rufus_rc.o bled/libbled.a ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a syslinux/win/libwin.a \
libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lwininet -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -luuid -lpsapi
libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lwininet -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -lcomctl32 -luuid -lpsapi
View
@@ -276,7 +276,7 @@ rufus_SOURCES = badblocks.c checksum.c dev.c dos.c dos_locale.c drive.c format.c
rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller -I./syslinux/win -I./libcdio $(AM_CFLAGS)
rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows
rufus_LDADD = rufus_rc.o bled/libbled.a ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a syslinux/win/libwin.a \
libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lwininet -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -luuid -lpsapi
libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a -lsetupapi -lole32 -lgdi32 -lwininet -lshlwapi -lcrypt32 -lwintrust -lcomdlg32 -lcomctl32 -luuid -lpsapi
all: all-recursive
View
@@ -350,7 +350,7 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern,
unsigned char bpattern[sizeof(pattern)], *ptr;
if (pattern == (unsigned int) ~0) {
srand((unsigned int)_GetTickCount64());
srand((unsigned int)GetTickCount64());
for (ptr = buffer; ptr < buffer + n; ptr++) {
// coverity[dont_call]
(*ptr) = rand() % (1 << (8 * sizeof(char)));
@@ -452,7 +452,7 @@ static unsigned int test_rw(HANDLE hDrive, blk_t last_block, size_t block_size,
cur_pattern = 0;
for (pat_idx = 0; pat_idx < nb_passes; pat_idx++) {
srand((unsigned int)_GetTickCount64());
srand((unsigned int)GetTickCount64());
if (cancel_ops) goto out;
// coverity[dont_call]
id_offset = rand() * (block_size-sizeof(blk_t)) / RAND_MAX;
View
@@ -929,8 +929,8 @@ DWORD WINAPI SumThread(void* param)
read_size[0] = 1; // Don't trigger the first loop break
for (rb = 0; ;rb += read_size[_bufnum]) {
// Update the progress and check for cancel
if (_GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = _GetTickCount64();
if (GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = GetTickCount64();
format_percent = (100.0f*rb) / (1.0f*img_report.image_size);
PrintInfo(0, MSG_271, format_percent);
SendMessage(hProgress, PBM_SETPOS, (WPARAM)((format_percent / 100.0f)*MAX_PROGRESS), 0);
View
@@ -136,15 +136,15 @@ BOOL ResetDevice(int index)
USB_CYCLE_PORT_PARAMS cycle_port;
// Wait at least 10 secs between resets
if (_GetTickCount64() < LastReset + 10000ULL) {
if (GetTickCount64() < LastReset + 10000ULL) {
uprintf("You must wait at least 10 seconds before trying to reset a device");
return FALSE;
}
if (DriveHub.String[index] == NULL)
return FALSE;
LastReset = _GetTickCount64();
LastReset = GetTickCount64();
handle = CreateFileA(DriveHub.String[index], GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
if (handle == INVALID_HANDLE_VALUE) {
@@ -432,9 +432,7 @@ BOOL GetDevices(DWORD devnum)
// Build a single list of Device IDs from all the storage enumerators we know of
full_list_size = 0;
ulFlags = CM_GETIDLIST_FILTER_SERVICE;
if (nWindowsVersion >= WINDOWS_7)
ulFlags |= CM_GETIDLIST_FILTER_PRESENT;
ulFlags = CM_GETIDLIST_FILTER_SERVICE | CM_GETIDLIST_FILTER_PRESENT;
for (s=0; s<ARRAYSIZE(usbstor_name); s++) {
// Get a list of device IDs for all USB storage devices
// This will be used to find if a device is UASP
View
@@ -121,7 +121,8 @@ static HANDLE GetHandle(char* Path, BOOL bLockDrive, BOOL bWriteAccess, BOOL bWr
{
int i;
BYTE access_mask = 0;
DWORD size, EndTime;
DWORD size;
uint64_t EndTime;
HANDLE hDrive = INVALID_HANDLE_VALUE;
char DevPath[MAX_PATH];
@@ -172,14 +173,14 @@ static HANDLE GetHandle(char* Path, BOOL bLockDrive, BOOL bWriteAccess, BOOL bWr
}
uprintf("Requesting lock...");
EndTime = GetTickCount() + DRIVE_ACCESS_TIMEOUT;
EndTime = GetTickCount64() + DRIVE_ACCESS_TIMEOUT;
do {
if (DeviceIoControl(hDrive, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &size, NULL))
goto out;
if (IS_ERROR(FormatStatus)) // User cancel
break;
Sleep(DRIVE_ACCESS_TIMEOUT / DRIVE_ACCESS_RETRIES);
} while (GetTickCount() < EndTime);
} while (GetTickCount64() < EndTime);
// If we reached this section, either we didn't manage to get a lock or the user cancelled
uprintf("Could not lock access to %s: %s", Path, WindowsErrorString());
// See if we can report the processes are accessing the drive
@@ -315,12 +316,12 @@ char* GetLogicalName(DWORD DriveIndex, BOOL bKeepTrailingBackslash, BOOL bSilent
/* Wait for a logical drive to reappear - Used when a drive has just been repartitioned */
BOOL WaitForLogical(DWORD DriveIndex)
{
DWORD EndTime;
uint64_t EndTime;
char* LogicalPath = NULL;
// GetLogicalName() calls may be slow, so use the system time to
// make sure we don't spend more than DRIVE_ACCESS_TIMEOUT in wait.
EndTime = GetTickCount() + DRIVE_ACCESS_TIMEOUT;
EndTime = GetTickCount64() + DRIVE_ACCESS_TIMEOUT;
do {
LogicalPath = GetLogicalName(DriveIndex, FALSE, TRUE);
if (LogicalPath != NULL) {
@@ -330,7 +331,7 @@ BOOL WaitForLogical(DWORD DriveIndex)
if (IS_ERROR(FormatStatus)) // User cancel
return FALSE;
Sleep(DRIVE_ACCESS_TIMEOUT/DRIVE_ACCESS_RETRIES);
} while (GetTickCount() < EndTime);
} while (GetTickCount64() < EndTime);
uprintf("Timeout while waiting for logical drive");
return FALSE;
}
@@ -826,8 +827,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
(CompareGUID(&DriveLayout->PartitionEntry[i].Gpt.PartitionType, &PARTITION_MSFT_RESERVED_GUID)) ||
(CompareGUID(&DriveLayout->PartitionEntry[i].Gpt.PartitionType, &PARTITION_SYSTEM_GUID)) )
--SelectedDrive.nPartitions;
if ( (memcmp(&PARTITION_BASIC_DATA_GUID, &DriveLayout->PartitionEntry[i].Gpt.PartitionType, sizeof(GUID)) == 0) &&
(nWindowsVersion >= WINDOWS_VISTA) )
if (memcmp(&PARTITION_BASIC_DATA_GUID, &DriveLayout->PartitionEntry[i].Gpt.PartitionType, sizeof(GUID)) == 0)
ret = TRUE;
}
break;
@@ -1242,7 +1242,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m
// This helps us reselect the partition scheme option that was used when creating the
// drive in Rufus. As far as I can tell, Windows doesn't care much if this signature
// isn't unique for USB drives.
CreateDisk.Mbr.Signature = mbr_uefi_marker?MBR_UEFI_MARKER:(DWORD)_GetTickCount64();
CreateDisk.Mbr.Signature = mbr_uefi_marker?MBR_UEFI_MARKER:(DWORD)GetTickCount64();
DriveLayoutEx.PartitionStyle = PARTITION_STYLE_MBR;
DriveLayoutEx.PartitionCount = 4; // Must be multiple of 4 for MBR
View
@@ -607,8 +607,8 @@ static BOOL FormatFAT32(DWORD DriveIndex)
format_percent = 0.0f;
for (i=0; i<(SystemAreaSize+BurstSize-1); i+=BurstSize) {
if (_GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = _GetTickCount64();
if (GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = GetTickCount64();
format_percent = (100.0f*i)/(1.0f*(SystemAreaSize+BurstSize));
PrintInfo(0, MSG_217, format_percent);
UpdateProgress(OP_FORMAT, format_percent);
@@ -1516,8 +1516,8 @@ static BOOL SetupWinToGo(const char* drive_name, BOOL use_ms_efi)
static void update_progress(const uint64_t processed_bytes)
{
if (_GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = _GetTickCount64();
if (GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = GetTickCount64();
format_percent = (100.0f*processed_bytes)/(1.0f*img_report.image_size);
PrintInfo(0, MSG_261, format_percent);
UpdateProgress(OP_FORMAT, format_percent);
@@ -1574,8 +1574,8 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage)
// will be as fast, if not faster, than whatever async scheme you can come up with.
rSize = BufSize;
for (wb = 0, wSize = 0; wb < (uint64_t)SelectedDrive.DiskSize; wb += wSize) {
if (_GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = _GetTickCount64();
if (GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = GetTickCount64();
format_percent = (100.0f*wb) / (1.0f*target_size);
PrintInfo(0, hSourceImage?MSG_261:MSG_286, format_percent);
UpdateProgress(OP_FORMAT, format_percent);
@@ -1661,11 +1661,6 @@ DWORD WINAPI FormatThread(void* param)
char kolibri_dst[] = "?:\\MTLD_F32";
char grub4dos_dst[] = "?:\\grldr";
PF_TYPE_DECL(WINAPI, LANGID, GetThreadUILanguage, (void));
PF_TYPE_DECL(WINAPI, LANGID, SetThreadUILanguage, (LANGID));
PF_INIT(GetThreadUILanguage, Kernel32);
PF_INIT(SetThreadUILanguage, Kernel32);
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
@@ -1751,10 +1746,6 @@ DWORD WINAPI FormatThread(void* param)
UpdateProgress(OP_ANALYZE_MBR, -1.0f);
}
// Yet another half-workaround needed for XP...
if (nWindowsVersion <= WINDOWS_XP)
InitializeDisk(hPhysicalDrive);
if (zero_drive) {
WriteDrive(hPhysicalDrive, NULL);
goto out;
@@ -1764,7 +1755,7 @@ DWORD WINAPI FormatThread(void* param)
// Note, Microsoft's way of cleaning partitions (IOCTL_DISK_CREATE_DISK, which is what we apply
// in InitializeDisk) is *NOT ENOUGH* to reset a disk and can render it inoperable for partitioning
// or formatting under Windows. See https://github.com/pbatard/rufus/issues/759 for details.
if ((nWindowsVersion > WINDOWS_XP) && ((!IsChecked(IDC_BOOT)) || (bt != BT_IMG))) {
if ((!IsChecked(IDC_BOOT)) || (bt != BT_IMG)) {
if ((!ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.SectorSize, use_large_fat32)) ||
(!InitializeDisk(hPhysicalDrive))) {
uprintf("Could not reset partitions\n");
@@ -2068,9 +2059,9 @@ DWORD WINAPI FormatThread(void* param)
// NTFS fixup (WinPE/AIK images don't seem to boot without an extra checkdisk)
if ((bt == BT_ISO) && (fs == FS_NTFS)) {
// Try to ensure that all messages from Checkdisk will be in English
if ((pfGetThreadUILanguage != NULL) && (PRIMARYLANGID(pfGetThreadUILanguage()) != LANG_ENGLISH)) {
pfSetThreadUILanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
if (PRIMARYLANGID(pfGetThreadUILanguage()) != LANG_ENGLISH)
if (PRIMARYLANGID(GetThreadUILanguage()) != LANG_ENGLISH) {
SetThreadUILanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
if (PRIMARYLANGID(GetThreadUILanguage()) != LANG_ENGLISH)
uprintf("Note: CheckDisk messages may be localized");
}
CheckDisk(drive_name[0]);
@@ -2169,8 +2160,8 @@ DWORD WINAPI SaveImageThread(void* param)
}
if (rSize == 0)
break;
if (_GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = _GetTickCount64();
if (GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = GetTickCount64();
format_percent = (100.0f*wb)/(1.0f*img_save->DeviceSize);
PrintInfo(0, MSG_261, format_percent);
UpdateProgress(OP_FORMAT, format_percent);
View
@@ -32,6 +32,7 @@
#include <errno.h>
#include <direct.h>
#include <ctype.h>
#include <virtdisk.h>
#include <cdio/cdio.h>
#include <cdio/logging.h>
View
@@ -447,7 +447,7 @@ static void CALLBACK OutputMessageTimeout(HWND hWnd, UINT uMsg, UINT_PTR idEvent
KillTimer(hMainDialog, idEvent);
bOutputTimerArmed[i] = FALSE;
PrintMessage[i](output_msg[i]);
last_msg_time[i] = _GetTickCount64();
last_msg_time[i] = GetTickCount64();
}
static void OutputMessage(BOOL info, char* msg)
@@ -460,15 +460,15 @@ static void OutputMessage(BOOL info, char* msg)
output_msg[i] = msg;
} else {
// Find if we need to arm a timer
delta = _GetTickCount64() - last_msg_time[i];
delta = GetTickCount64() - last_msg_time[i];
if (delta < (2 * MAX_REFRESH)) {
// Not enough time has elapsed since our last output => arm a timer
output_msg[i] = msg;
SetTimer(hMainDialog, TID_OUTPUT_INFO + i, (UINT)((2 * MAX_REFRESH) - delta), OutputMessageTimeout);
bOutputTimerArmed[i] = TRUE;
} else {
PrintMessage[i](msg);
last_msg_time[i] = _GetTickCount64();
last_msg_time[i] = GetTickCount64();
}
}
}
Oops, something went wrong.

0 comments on commit 903ac99

Please sign in to comment.