1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[core] report SuperSpeed+ devices

* Also clean up cfgmgr32 dependencies and set rufus-next to 3.7
This commit is contained in:
Pete Batard 2019-07-31 22:45:11 +01:00
parent 17d4d6c6fe
commit c8fda3e4e8
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
7 changed files with 50 additions and 66 deletions

20
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for rufus 3.6.
# Generated by GNU Autoconf 2.69 for rufus 3.7.
#
# Report bugs to <https://github.com/pbatard/rufus/issues>.
#
@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='rufus'
PACKAGE_TARNAME='rufus'
PACKAGE_VERSION='3.6'
PACKAGE_STRING='rufus 3.6'
PACKAGE_VERSION='3.7'
PACKAGE_STRING='rufus 3.7'
PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues'
PACKAGE_URL='https://rufus.ie'
@ -1228,7 +1228,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 3.6 to adapt to many kinds of systems.
\`configure' configures rufus 3.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1294,7 +1294,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of rufus 3.6:";;
short | recursive ) echo "Configuration of rufus 3.7:";;
esac
cat <<\_ACEOF
@ -1385,7 +1385,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
rufus configure 3.6
rufus configure 3.7
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -1440,7 +1440,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 3.6, which was
It was created by rufus $as_me 3.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2303,7 +2303,7 @@ fi
# Define the identity of the package.
PACKAGE='rufus'
VERSION='3.6'
VERSION='3.7'
cat >>confdefs.h <<_ACEOF
@ -4483,7 +4483,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 3.6, which was
This file was extended by rufus $as_me 3.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -4537,7 +4537,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 3.6
rufus config.status 3.7
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View file

@ -1,4 +1,4 @@
AC_INIT([rufus], [3.6], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AC_INIT([rufus], [3.7], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies])
AC_CONFIG_SRCDIR([src/rufus.c])
AC_CONFIG_MACRO_DIR([m4])

View file

@ -8,7 +8,7 @@
for an interesting struggle, when you also happen to have a comma in one of the fields... -->
<Identity
Name="Rufus"
Version="3.6.1551.0"
Version="3.7.1551.0"
ProcessorArchitecture="@ARCH@"
Publisher='CN=Akeo Consulting, O=Akeo Consulting, STREET=24 Grey Rock, L=Milford, S=Co. Donegal, PostalCode=F92 D667, C=IE' />
<Properties>

View file

@ -1,6 +1,6 @@
@echo off
setlocal EnableExtensions DisableDelayedExpansion
set VERSION=3.6
set VERSION=3.7
del /q *.appx >NUL 2>&1
del /q *.appxbundle >NUL 2>&1

View file

@ -114,10 +114,14 @@ static BOOL GetUSBProperties(char* parent_path, char* device_id, usb_device_prop
conn_info_v2.SupportedUsbProtocols.Usb300 = 1;
if (!DeviceIoControl(handle, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX_V2, &conn_info_v2, size, &conn_info_v2, size, &size, NULL)) {
uprintf("Could not get node connection information (V2) for device '%s': %s", device_id, WindowsErrorString());
} else if (conn_info_v2.Flags.DeviceIsOperatingAtSuperSpeedPlusOrHigher) {
props->speed = USB_SPEED_SUPER_PLUS;
} else if (conn_info_v2.Flags.DeviceIsOperatingAtSuperSpeedOrHigher) {
props->speed = USB_SPEED_SUPER_OR_LATER;
props->speed = USB_SPEED_SUPER;
} else if (conn_info_v2.Flags.DeviceIsSuperSpeedPlusCapableOrHigher) {
props->lower_speed = 2;
} else if (conn_info_v2.Flags.DeviceIsSuperSpeedCapableOrHigher) {
props->is_LowerSpeed = TRUE;
props->lower_speed = 1;
}
}
@ -193,7 +197,7 @@ int CycleDevice(int index)
return ERROR_INVALID_PARAMETER;
// Need DIGCF_ALLCLASSES else disabled devices won't be listed.
dev_info = SetupDiGetClassDevsA(&_GUID_DEVINTERFACE_DISK, NULL, NULL, DIGCF_PRESENT | DIGCF_ALLCLASSES);
dev_info = SetupDiGetClassDevsA(&GUID_DEVINTERFACE_DISK, NULL, NULL, DIGCF_PRESENT | DIGCF_ALLCLASSES);
if (dev_info == INVALID_HANDLE_VALUE) {
uprintf("Could not get classes for device cycling: %s", WindowsErrorString());
return ERROR_PATH_NOT_FOUND;
@ -327,7 +331,7 @@ BOOL GetOpticalMedia(IMG_SAVE* img_save)
HANDLE hDrive = INVALID_HANDLE_VALUE;
LARGE_INTEGER li;
dev_info = SetupDiGetClassDevsA(&_GUID_DEVINTERFACE_CDROM, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
dev_info = SetupDiGetClassDevsA(&GUID_DEVINTERFACE_CDROM, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if (dev_info == INVALID_HANDLE_VALUE) {
uprintf("SetupDiGetClassDevs (Interface) failed: %s", WindowsErrorString());
return FALSE;
@ -348,7 +352,7 @@ BOOL GetOpticalMedia(IMG_SAVE* img_save)
safe_free(devint_detail_data);
safe_free(buffer);
if (!SetupDiEnumDeviceInterfaces(dev_info, &dev_info_data, &_GUID_DEVINTERFACE_CDROM, j, &devint_data)) {
if (!SetupDiEnumDeviceInterfaces(dev_info, &dev_info_data, &GUID_DEVINTERFACE_CDROM, j, &devint_data)) {
if (GetLastError() != ERROR_NO_MORE_ITEMS) {
uprintf("SetupDiEnumDeviceInterfaces failed: %s", WindowsErrorString());
}
@ -452,7 +456,7 @@ BOOL GetDevices(DWORD devnum)
const char* scsi_card_name[] = {
"_SD_", "_SDHC_", "_MMC_", "_MS_", "_MSPro_", "_xDPicture_", "_O2Media_"
};
const char* usb_speed_name[USB_SPEED_MAX] = { "USB", "USB 1.0", "USB 1.1", "USB 2.0", "USB 3.0" };
const char* usb_speed_name[USB_SPEED_MAX] = { "USB", "USB 1.0", "USB 1.1", "USB 2.0", "USB 3.0", "USB 3.1" };
const char* windows_sandbox_vhd_label = "PortableBaseLayer";
// Hash table and String Array used to match a Device ID with the parent hub's Device Interface Path
htab_table htab_devid = HTAB_EMPTY;
@ -490,9 +494,9 @@ BOOL GetDevices(DWORD devnum)
if (device_id == NULL)
goto out;
// Build a hash table associating a CM Device ID of an USB device with the SetupDI Device Interface Path
// Build a hash table associating a CM Device ID of a USB device with the SetupDI Device Interface Path
// of its parent hub - this is needed to retrieve the device speed
dev_info = SetupDiGetClassDevsA(&_GUID_DEVINTERFACE_USB_HUB, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
dev_info = SetupDiGetClassDevsA(&GUID_DEVINTERFACE_USB_HUB, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if (dev_info != INVALID_HANDLE_VALUE) {
if (htab_create(DEVID_HTAB_SIZE, &htab_devid)) {
dev_info_data.cbSize = sizeof(dev_info_data);
@ -501,7 +505,7 @@ BOOL GetDevices(DWORD devnum)
devint_detail_data = NULL;
devint_data.cbSize = sizeof(devint_data);
// Only care about the first interface (MemberIndex 0)
if ( (SetupDiEnumDeviceInterfaces(dev_info, &dev_info_data, &_GUID_DEVINTERFACE_USB_HUB, 0, &devint_data))
if ( (SetupDiEnumDeviceInterfaces(dev_info, &dev_info_data, &GUID_DEVINTERFACE_USB_HUB, 0, &devint_data))
&& (!SetupDiGetDeviceInterfaceDetailA(dev_info, &devint_data, NULL, 0, &size, NULL))
&& (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
&& ((devint_detail_data = (PSP_DEVICE_INTERFACE_DETAIL_DATA_A)calloc(1, size)) != NULL) ) {
@ -593,7 +597,7 @@ BOOL GetDevices(DWORD devnum)
}
// Now use SetupDi to enumerate all our disk storage devices
dev_info = SetupDiGetClassDevsA(&_GUID_DEVINTERFACE_DISK, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
dev_info = SetupDiGetClassDevsA(&GUID_DEVINTERFACE_DISK, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if (dev_info == INVALID_HANDLE_VALUE) {
uprintf("SetupDiGetClassDevs (Interface) failed: %s", WindowsErrorString());
goto out;
@ -783,8 +787,8 @@ BOOL GetDevices(DWORD devnum)
props.speed = 0;
uprintf("Found %s%s%s device '%s' (%s) %s", props.is_UASP?"UAS (":"",
usb_speed_name[props.speed], props.is_UASP?")":"", buffer, str, method_str);
if (props.is_LowerSpeed)
uprintf("NOTE: This device is an USB 3.0 device operating at lower speed...");
if (props.lower_speed)
uprintf("NOTE: This device is a USB 3.%c device operating at lower speed...", '0' + props.lower_speed - 1);
}
devint_data.cbSize = sizeof(devint_data);
hDrive = INVALID_HANDLE_VALUE;
@ -793,7 +797,7 @@ BOOL GetDevices(DWORD devnum)
safe_closehandle(hDrive);
safe_free(devint_detail_data);
if (!SetupDiEnumDeviceInterfaces(dev_info, &dev_info_data, &_GUID_DEVINTERFACE_DISK, j, &devint_data)) {
if (!SetupDiEnumDeviceInterfaces(dev_info, &dev_info_data, &GUID_DEVINTERFACE_DISK, j, &devint_data)) {
if(GetLastError() != ERROR_NO_MORE_ITEMS) {
uprintf("SetupDiEnumDeviceInterfaces failed: %s", WindowsErrorString());
} else {

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Device listing
* Copyright © 2014-2016 Pete Batard <pete@akeo.ie>
* Device detection and enumeration
* Copyright © 2014-2019 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,19 +18,22 @@
*/
#include <windows.h>
#include <cfgmgr32.h>
#define USB_SPEED_UNKNOWN 0
#define USB_SPEED_LOW 1
#define USB_SPEED_FULL 2
#define USB_SPEED_HIGH 3
#define USB_SPEED_SUPER_OR_LATER 4
#define USB_SPEED_MAX 5
#define USB_SPEED_SUPER 4
#define USB_SPEED_SUPER_PLUS 5
#define USB_SPEED_MAX 6
/* List of the properties we are interested in */
typedef struct usb_device_props {
uint32_t vid;
uint32_t pid;
uint32_t speed;
uint32_t lower_speed;
uint32_t port;
BOOLEAN is_USB;
BOOLEAN is_SCSI;
@ -38,7 +41,6 @@ typedef struct usb_device_props {
BOOLEAN is_UASP;
BOOLEAN is_VHD;
BOOLEAN is_Removable;
BOOLEAN is_LowerSpeed;
} usb_device_props;
/*
@ -50,34 +52,14 @@ typedef DWORD RETURN_TYPE;
typedef RETURN_TYPE CONFIGRET;
typedef CHAR *DEVINSTID_A;
#define CR_SUCCESS 0x00000000
#define CR_NO_SUCH_DEVNODE 0x0000000D
#define CM_GETIDLIST_FILTER_SERVICE 0x00000002
#define CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL 0x00000001
#define CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL 0x00000002
#define CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL 0x00000003
// /!\ The following flag is only available on Windows 7 or later!
#ifndef CM_GETIDLIST_FILTER_PRESENT
#define CM_GETIDLIST_FILTER_PRESENT 0x00000100
#define CM_DRP_ADDRESS 0x0000001D
#endif
#ifndef METHOD_BUFFERED
#define METHOD_BUFFERED 0
#endif
#ifndef FILE_ANY_ACCESS
#define FILE_ANY_ACCESS 0x00000000
#endif
#ifndef FILE_DEVICE_UNKNOWN
#define FILE_DEVICE_UNKNOWN 0x00000022
#endif
#ifndef FILE_DEVICE_USB
#define FILE_DEVICE_USB FILE_DEVICE_UNKNOWN
#endif
#ifndef CTL_CODE
#define CTL_CODE(DeviceType, Function, Method, Access)( \
((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
#endif
typedef enum USB_CONNECTION_STATUS {
NoDeviceConnected,
DeviceConnected,
@ -96,7 +78,7 @@ typedef enum USB_HUB_NODE {
} USB_HUB_NODE;
/* Cfgmgr32.dll interface */
DECLSPEC_IMPORT CONFIGRET WINAPI CM_Get_Device_IDA(DEVINST dnDevInst, PCSTR Buffer, ULONG BufferLen, ULONG ulFlags);
DECLSPEC_IMPORT CONFIGRET WINAPI CM_Get_Device_IDA(DEVINST dnDevInst, CHAR* Buffer, ULONG BufferLen, ULONG ulFlags);
DECLSPEC_IMPORT CONFIGRET WINAPI CM_Get_Device_ID_List_SizeA(PULONG pulLen, PCSTR pszFilter, ULONG ulFlags);
DECLSPEC_IMPORT CONFIGRET WINAPI CM_Get_Device_ID_ListA(PCSTR pszFilter, PCHAR Buffer, ULONG BufferLen, ULONG ulFlags);
DECLSPEC_IMPORT CONFIGRET WINAPI CM_Locate_DevNodeA(PDEVINST pdnDevInst, DEVINSTID_A pDeviceID, ULONG ulFlags);
@ -165,7 +147,9 @@ typedef union _USB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS {
struct {
ULONG DeviceIsOperatingAtSuperSpeedOrHigher:1;
ULONG DeviceIsSuperSpeedCapableOrHigher:1;
ULONG ReservedMBZ:30;
ULONG DeviceIsOperatingAtSuperSpeedPlusOrHigher : 1;
ULONG DeviceIsSuperSpeedPlusCapableOrHigher : 1;
ULONG ReservedMBZ:28;
};
} USB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS, *PUSB_NODE_CONNECTION_INFORMATION_EX_V2_FLAGS;
@ -183,11 +167,7 @@ typedef struct {
#pragma pack(pop)
const GUID _GUID_DEVINTERFACE_DISK =
{ 0x53f56307L, 0xb6bf, 0x11d0, {0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} };
const GUID _GUID_DEVINTERFACE_CDROM =
{ 0x53f56308L, 0xb6bf, 0x11d0, {0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b} };
const GUID _GUID_DEVINTERFACE_USB_HUB =
const GUID GUID_DEVINTERFACE_USB_HUB =
{ 0xf18a0e88L, 0xc30c, 0x11d0, {0x88, 0x15, 0x00, 0xa0, 0xc9, 0x06, 0xbe, 0xd8} };
#define DEVID_HTAB_SIZE 257

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.6.1552"
CAPTION "Rufus 3.7.1553"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -394,8 +394,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,6,1552,0
PRODUCTVERSION 3,6,1552,0
FILEVERSION 3,7,1553,0
PRODUCTVERSION 3,7,1553,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -413,13 +413,13 @@ BEGIN
VALUE "Comments", "https://akeo.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.6.1552"
VALUE "FileVersion", "3.7.1553"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus-3.6.exe"
VALUE "OriginalFilename", "rufus-3.7.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.6.1552"
VALUE "ProductVersion", "3.7.1553"
END
END
BLOCK "VarFileInfo"