mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[core] add enumeration debugging
* Alt-. to toggle * Also add configure option for test releases
This commit is contained in:
		
							parent
							
								
									d2576a9f5e
								
							
						
					
					
						commit
						f04167c51c
					
				
					 9 changed files with 92 additions and 13 deletions
				
			
		
							
								
								
									
										16
									
								
								configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								configure
									
										
									
									
										vendored
									
									
								
							|  | @ -678,6 +678,7 @@ enable_silent_rules | ||||||
| enable_debug | enable_debug | ||||||
| enable_alpha | enable_alpha | ||||||
| enable_beta | enable_beta | ||||||
|  | enable_test | ||||||
| ' | ' | ||||||
|       ac_precious_vars='build_alias |       ac_precious_vars='build_alias | ||||||
| host_alias | host_alias | ||||||
|  | @ -1306,6 +1307,7 @@ Optional Features: | ||||||
|   --enable-debug          keep debug symbols for gdb (default=yes) |   --enable-debug          keep debug symbols for gdb (default=yes) | ||||||
|   --enable-alpha          build an ALPHA release (default=no) |   --enable-alpha          build an ALPHA release (default=no) | ||||||
|   --enable-beta           build a BETA release (default=no) |   --enable-beta           build a BETA release (default=no) | ||||||
|  |   --enable-test=#         build a TEST release (default=no) | ||||||
| 
 | 
 | ||||||
| Some influential environment variables: | Some influential environment variables: | ||||||
|   CC          C compiler command |   CC          C compiler command | ||||||
|  | @ -3831,7 +3833,7 @@ else | ||||||
|   LDFLAGS="-s" |   LDFLAGS="-s" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # Alpha/Beta | # Alpha/Beta/Test | ||||||
| # Check whether --enable-alpha was given. | # Check whether --enable-alpha was given. | ||||||
| if test "${enable_alpha+set}" = set; then : | if test "${enable_alpha+set}" = set; then : | ||||||
|   enableval=$enable_alpha; alpha_enabled=$enableval |   enableval=$enable_alpha; alpha_enabled=$enableval | ||||||
|  | @ -3854,6 +3856,18 @@ if test "x$beta_enabled" != "xno" ; then | ||||||
|   CFLAGS+=" -DBETA" |   CFLAGS+=" -DBETA" | ||||||
|   SUFFIX=_BETA |   SUFFIX=_BETA | ||||||
| fi | fi | ||||||
|  | # Check whether --enable-test was given. | ||||||
|  | if test "${enable_test+set}" = set; then : | ||||||
|  |   enableval=$enable_test; test_enabled=$enableval | ||||||
|  | else | ||||||
|  |   test_enabled='no' | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | if test "x$test_enabled" != "xno" ; then | ||||||
|  |   if test "x$test_enabled" == "xyes" ; then $enableval="" ; fi | ||||||
|  |   CFLAGS+=" -DTEST=$enableval" | ||||||
|  |   SUFFIX=_TEST$enableval | ||||||
|  | fi | ||||||
| 
 | 
 | ||||||
| { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabling Large File Support (ISO support)" >&5 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabling Large File Support (ISO support)" >&5 | ||||||
| $as_echo "enabling Large File Support (ISO support)" >&6; } | $as_echo "enabling Large File Support (ISO support)" >&6; } | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ else | ||||||
|   LDFLAGS="-s" |   LDFLAGS="-s" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # Alpha/Beta | # Alpha/Beta/Test | ||||||
| AC_ARG_ENABLE([alpha],[AS_HELP_STRING([--enable-alpha], [build an ALPHA release (default=no)])], [alpha_enabled=$enableval], [alpha_enabled='no']) | AC_ARG_ENABLE([alpha],[AS_HELP_STRING([--enable-alpha], [build an ALPHA release (default=no)])], [alpha_enabled=$enableval], [alpha_enabled='no']) | ||||||
| if test "x$alpha_enabled" != "xno" ; then | if test "x$alpha_enabled" != "xno" ; then | ||||||
|   CFLAGS+=" -DALPHA" |   CFLAGS+=" -DALPHA" | ||||||
|  | @ -46,6 +46,12 @@ if test "x$beta_enabled" != "xno" ; then | ||||||
|   CFLAGS+=" -DBETA" |   CFLAGS+=" -DBETA" | ||||||
|   SUFFIX=_BETA |   SUFFIX=_BETA | ||||||
| fi | fi | ||||||
|  | AC_ARG_ENABLE([test],[AS_HELP_STRING([--enable-test=#], [build a TEST release (default=no)])], [test_enabled=$enableval], [test_enabled='no']) | ||||||
|  | if test "x$test_enabled" != "xno" ; then | ||||||
|  |   if test "x$test_enabled" == "xyes" ; then $enableval="" ; fi | ||||||
|  |   CFLAGS+=" -DTEST=$enableval" | ||||||
|  |   SUFFIX=_TEST$enableval | ||||||
|  | fi | ||||||
| 
 | 
 | ||||||
| AC_MSG_RESULT([enabling Large File Support (ISO support)]) | AC_MSG_RESULT([enabling Large File Support (ISO support)]) | ||||||
| AM_CFLAGS="$AM_CFLAGS -D_FILE_OFFSET_BITS=64 -D_OFF_T_ -D_off_t=off64_t -Doff_t=off64_t -Doff32_t=long" | AM_CFLAGS="$AM_CFLAGS -D_FILE_OFFSET_BITS=64 -D_OFF_T_ -D_off_t=off64_t -Doff_t=off64_t -Doff32_t=long" | ||||||
|  |  | ||||||
|  | @ -516,6 +516,7 @@ t MSG_266 "Dual UEFI/BIOS mode" | ||||||
| t MSG_267 "Applying Windows image: %0.1f%% completed" | t MSG_267 "Applying Windows image: %0.1f%% completed" | ||||||
| t MSG_268 "Applying Windows image..." | t MSG_268 "Applying Windows image..." | ||||||
| t MSG_269 "Preserve timestamps" | t MSG_269 "Preserve timestamps" | ||||||
|  | t MSG_270 "USB debug" | ||||||
| 
 | 
 | ||||||
| ################################################################################ | ################################################################################ | ||||||
| ############################# TRANSLATOR END COPY ############################## | ############################# TRANSLATOR END COPY ############################## | ||||||
|  |  | ||||||
|  | @ -367,6 +367,16 @@ const loc_control_id control_id[] = { | ||||||
| 	LOC_CTRL(MSG_267), | 	LOC_CTRL(MSG_267), | ||||||
| 	LOC_CTRL(MSG_268), | 	LOC_CTRL(MSG_268), | ||||||
| 	LOC_CTRL(MSG_269), | 	LOC_CTRL(MSG_269), | ||||||
|  | 	LOC_CTRL(MSG_270), | ||||||
|  | 	LOC_CTRL(MSG_271), | ||||||
|  | 	LOC_CTRL(MSG_272), | ||||||
|  | 	LOC_CTRL(MSG_273), | ||||||
|  | 	LOC_CTRL(MSG_274), | ||||||
|  | 	LOC_CTRL(MSG_275), | ||||||
|  | 	LOC_CTRL(MSG_276), | ||||||
|  | 	LOC_CTRL(MSG_277), | ||||||
|  | 	LOC_CTRL(MSG_278), | ||||||
|  | 	LOC_CTRL(MSG_279), | ||||||
| 	LOC_CTRL(MSG_MAX), | 	LOC_CTRL(MSG_MAX), | ||||||
| 	LOC_CTRL(IDOK), | 	LOC_CTRL(IDOK), | ||||||
| 	LOC_CTRL(IDCANCEL), | 	LOC_CTRL(IDCANCEL), | ||||||
|  |  | ||||||
|  | @ -405,7 +405,17 @@ | ||||||
| #define MSG_267                         3267 | #define MSG_267                         3267 | ||||||
| #define MSG_268                         3268 | #define MSG_268                         3268 | ||||||
| #define MSG_269                         3269 | #define MSG_269                         3269 | ||||||
| #define MSG_MAX                         3270 | #define MSG_270                         3270 | ||||||
|  | #define MSG_271                         3271 | ||||||
|  | #define MSG_272                         3272 | ||||||
|  | #define MSG_273                         3273 | ||||||
|  | #define MSG_274                         3274 | ||||||
|  | #define MSG_275                         3275 | ||||||
|  | #define MSG_276                         3276 | ||||||
|  | #define MSG_277                         3277 | ||||||
|  | #define MSG_278                         3278 | ||||||
|  | #define MSG_279                         3279 | ||||||
|  | #define MSG_MAX                         3280 | ||||||
| 
 | 
 | ||||||
| // Next default values for new objects
 | // Next default values for new objects
 | ||||||
| // 
 | // 
 | ||||||
|  |  | ||||||
							
								
								
									
										16
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -103,7 +103,7 @@ static BOOL log_displayed = FALSE; | ||||||
| static BOOL iso_provided = FALSE; | static BOOL iso_provided = FALSE; | ||||||
| static BOOL user_notified = FALSE; | static BOOL user_notified = FALSE; | ||||||
| static BOOL relaunch = FALSE; | static BOOL relaunch = FALSE; | ||||||
| extern BOOL force_large_fat32, enable_iso, enable_joliet, enable_rockridge, enable_ntfs_compression, preserve_timestamps; | extern BOOL force_large_fat32, enable_iso, enable_joliet, enable_rockridge, enable_ntfs_compression, preserve_timestamps, usb_debug; | ||||||
| extern uint8_t* grub2_buf; | extern uint8_t* grub2_buf; | ||||||
| extern long grub2_len; | extern long grub2_len; | ||||||
| extern const char* old_c32_name[NB_OLD_C32]; | extern const char* old_c32_name[NB_OLD_C32]; | ||||||
|  | @ -1541,6 +1541,9 @@ static __inline const char* IsAlphaOrBeta(void) | ||||||
| 	return " (Alpha) "; | 	return " (Alpha) "; | ||||||
| #elif defined(BETA) | #elif defined(BETA) | ||||||
| 	return " (Beta) "; | 	return " (Beta) "; | ||||||
|  | #elif defined(TEST) | ||||||
|  | #	define TEST_STR(x) " (Test" STRINGIFY(x) ")" | ||||||
|  | 	return TEST_STR(TEST); | ||||||
| #else | #else | ||||||
| 	return " "; | 	return " "; | ||||||
| #endif | #endif | ||||||
|  | @ -2039,6 +2042,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		// Add a VERY ANNOYING popup for Alpha releases, so that people don't start redistributing them
 | 		// Add a VERY ANNOYING popup for Alpha releases, so that people don't start redistributing them
 | ||||||
| 		Notification(MSG_INFO, NULL, "ALPHA VERSION", "This is an Alpha version of " APPLICATION_NAME | 		Notification(MSG_INFO, NULL, "ALPHA VERSION", "This is an Alpha version of " APPLICATION_NAME | ||||||
| 			" - It is meant to be used for testing ONLY and should NOT be distributed as a release."); | 			" - It is meant to be used for testing ONLY and should NOT be distributed as a release."); | ||||||
|  | #elif defined(TEST) | ||||||
|  | 		// Same thing for Test releases
 | ||||||
|  | 		Notification(MSG_INFO, NULL, "TEST VERSION", "This is a Test version of " APPLICATION_NAME | ||||||
|  | 			" - It is meant to be used for testing ONLY and should NOT be distributed as a release."); | ||||||
| #endif | #endif | ||||||
| 		return (INT_PTR)FALSE; | 		return (INT_PTR)FALSE; | ||||||
| 
 | 
 | ||||||
|  | @ -2821,6 +2828,13 @@ relaunch: | ||||||
| 			// Might also need ES_NOHIDESEL property if you want to select when not active
 | 			// Might also need ES_NOHIDESEL property if you want to select when not active
 | ||||||
| 			SendMessage(hLog, EM_SETSEL, 0, -1); | 			SendMessage(hLog, EM_SETSEL, 0, -1); | ||||||
| 		} | 		} | ||||||
|  | 		// Alt-. => Enable USB enumeration debug
 | ||||||
|  | 		if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == VK_OEM_PERIOD)) { | ||||||
|  | 			usb_debug = !usb_debug; | ||||||
|  | 			PrintStatus2000(lmprintf(MSG_270), usb_debug); | ||||||
|  | 			GetUSBDevices(0); | ||||||
|  | 			continue; | ||||||
|  | 		} | ||||||
| 		// Alt-B => Toggle fake drive detection during bad blocks check
 | 		// Alt-B => Toggle fake drive detection during bad blocks check
 | ||||||
| 		// By default, Rufus will check for fake USB flash drives that mistakenly present
 | 		// By default, Rufus will check for fake USB flash drives that mistakenly present
 | ||||||
| 		// more capacity than they already have by looping over the flash. This check which
 | 		// more capacity than they already have by looping over the flash. This check which
 | ||||||
|  |  | ||||||
|  | @ -77,6 +77,9 @@ | ||||||
| #ifndef ARRAYSIZE | #ifndef ARRAYSIZE | ||||||
| #define ARRAYSIZE(A)                (sizeof(A)/sizeof((A)[0])) | #define ARRAYSIZE(A)                (sizeof(A)/sizeof((A)[0])) | ||||||
| #endif | #endif | ||||||
|  | #ifndef STRINGIFY | ||||||
|  | #define STRINGIFY(x)                #x | ||||||
|  | #endif | ||||||
| #define IsChecked(CheckBox_ID)      (IsDlgButtonChecked(hMainDialog, CheckBox_ID) == BST_CHECKED) | #define IsChecked(CheckBox_ID)      (IsDlgButtonChecked(hMainDialog, CheckBox_ID) == BST_CHECKED) | ||||||
| #define MB_IS_RTL                   (right_to_left_mode?MB_RTLREADING:0) | #define MB_IS_RTL                   (right_to_left_mode?MB_RTLREADING:0) | ||||||
| #define IDD_OFFSET                  ((right_to_left_mode?100:0) + ((nWindowsVersion <= WINDOWS_XP)?50:0)) | #define IDD_OFFSET                  ((right_to_left_mode?100:0) + ((nWindowsVersion <= WINDOWS_XP)?50:0)) | ||||||
|  |  | ||||||
							
								
								
									
										16
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| 
 | 
 | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 242, 376 | IDD_DIALOG DIALOGEX 12, 12, 242, 376 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| CAPTION "Rufus 2.3.682" | CAPTION "Rufus 2.3.683" | ||||||
| FONT 8, "Segoe UI", 400, 0, 0x1 | FONT 8, "Segoe UI", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 |     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 | ||||||
|  | @ -157,7 +157,7 @@ END | ||||||
| 
 | 
 | ||||||
| IDD_DIALOG_XP DIALOGEX 12, 12, 242, 376 | IDD_DIALOG_XP DIALOGEX 12, 12, 242, 376 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| CAPTION "Rufus 2.3.682" | CAPTION "Rufus 2.3.683" | ||||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 |     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 | ||||||
|  | @ -283,7 +283,7 @@ END | ||||||
| IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 376 | IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 376 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL | EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL | ||||||
| CAPTION "Rufus 2.3.682" | CAPTION "Rufus 2.3.683" | ||||||
| FONT 8, "Segoe UI", 400, 0, 0x1 | FONT 8, "Segoe UI", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 |     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 | ||||||
|  | @ -415,7 +415,7 @@ END | ||||||
| IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 376 | IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 376 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL | EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL | ||||||
| CAPTION "Rufus 2.3.682" | CAPTION "Rufus 2.3.683" | ||||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 |     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 | ||||||
|  | @ -671,8 +671,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 2,3,682,0 |  FILEVERSION 2,3,683,0 | ||||||
|  PRODUCTVERSION 2,3,682,0 |  PRODUCTVERSION 2,3,683,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -689,13 +689,13 @@ BEGIN | ||||||
|         BEGIN |         BEGIN | ||||||
|             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" |             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "2.3.682" |             VALUE "FileVersion", "2.3.683" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2015 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", "2.3.682" |             VALUE "ProductVersion", "2.3.683" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
							
								
								
									
										23
									
								
								src/usb.c
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								src/usb.c
									
										
									
									
									
								
							|  | @ -42,6 +42,7 @@ | ||||||
| 
 | 
 | ||||||
| extern StrArray DriveID, DriveLabel; | extern StrArray DriveID, DriveLabel; | ||||||
| extern BOOL enable_HDDs, use_fake_units, enable_vmdk; | extern BOOL enable_HDDs, use_fake_units, enable_vmdk; | ||||||
|  | BOOL usb_debug = FALSE; | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Get the VID, PID and current device speed |  * Get the VID, PID and current device speed | ||||||
|  | @ -169,7 +170,8 @@ BOOL GetUSBDevices(DWORD devnum) | ||||||
| 		if (htab_create(DEVID_HTAB_SIZE, &htab_devid)) { | 		if (htab_create(DEVID_HTAB_SIZE, &htab_devid)) { | ||||||
| 			dev_info_data.cbSize = sizeof(dev_info_data); | 			dev_info_data.cbSize = sizeof(dev_info_data); | ||||||
| 			for (i=0; SetupDiEnumDeviceInfo(dev_info, i, &dev_info_data); i++) { | 			for (i=0; SetupDiEnumDeviceInfo(dev_info, i, &dev_info_data); i++) { | ||||||
| 
 | 				if (usb_debug) | ||||||
|  | 					uprintf("Processing Hub %d:", i + 1); | ||||||
| 				devint_detail_data = NULL; | 				devint_detail_data = NULL; | ||||||
| 				devint_data.cbSize = sizeof(devint_data); | 				devint_data.cbSize = sizeof(devint_data); | ||||||
| 				// Only care about the first interface (MemberIndex 0)
 | 				// Only care about the first interface (MemberIndex 0)
 | ||||||
|  | @ -188,12 +190,16 @@ BOOL GetUSBDevices(DWORD devnum) | ||||||
| 								if ((k = htab_hash(device_id, &htab_devid)) != 0) { | 								if ((k = htab_hash(device_id, &htab_devid)) != 0) { | ||||||
| 									htab_devid.table[k].data = (void*)(uintptr_t)s; | 									htab_devid.table[k].data = (void*)(uintptr_t)s; | ||||||
| 								} | 								} | ||||||
|  | 								if (usb_debug) | ||||||
|  | 									uprintf("  Found ID[%03d]: %s", k, device_id); | ||||||
| 								while (CM_Get_Sibling(&device_inst, device_inst, 0) == CR_SUCCESS) { | 								while (CM_Get_Sibling(&device_inst, device_inst, 0) == CR_SUCCESS) { | ||||||
| 									device_id[0] = 0; | 									device_id[0] = 0; | ||||||
| 									if (CM_Get_Device_IDA(device_inst, device_id, MAX_PATH, 0) == CR_SUCCESS) { | 									if (CM_Get_Device_IDA(device_inst, device_id, MAX_PATH, 0) == CR_SUCCESS) { | ||||||
| 										if ((k = htab_hash(device_id, &htab_devid)) != 0) { | 										if ((k = htab_hash(device_id, &htab_devid)) != 0) { | ||||||
| 											htab_devid.table[k].data = (void*)(uintptr_t)s; | 											htab_devid.table[k].data = (void*)(uintptr_t)s; | ||||||
| 										} | 										} | ||||||
|  | 										if (usb_debug) | ||||||
|  | 											uprintf("  Found ID[%03d]: %s", k, device_id); | ||||||
| 									} | 									} | ||||||
| 								} | 								} | ||||||
| 							} | 							} | ||||||
|  | @ -233,6 +239,11 @@ BOOL GetUSBDevices(DWORD devnum) | ||||||
| 			if (list_size[s] > 1) { | 			if (list_size[s] > 1) { | ||||||
| 				if (CM_Get_Device_ID_ListA(storage_name[s], &devid_list[i], list_size[s], ulFlags) != CR_SUCCESS) | 				if (CM_Get_Device_ID_ListA(storage_name[s], &devid_list[i], list_size[s], ulFlags) != CR_SUCCESS) | ||||||
| 					continue; | 					continue; | ||||||
|  | 				if (usb_debug) { | ||||||
|  | 					uprintf("Processing IDs belonging to %s:", storage_name[s]); | ||||||
|  | 					for (device_id = &devid_list[i]; *device_id != 0; device_id += strlen(device_id) + 1) | ||||||
|  | 						uprintf("  %s", device_id); | ||||||
|  | 				} | ||||||
| 				// The list_size is sometimes larger than required thus we need to find the real end
 | 				// The list_size is sometimes larger than required thus we need to find the real end
 | ||||||
| 				for (i += list_size[s]; i > 2; i--) { | 				for (i += list_size[s]; i > 2; i--) { | ||||||
| 					if ((devid_list[i-2] != '\0') && (devid_list[i-1] == '\0') && (devid_list[i] == '\0')) | 					if ((devid_list[i-2] != '\0') && (devid_list[i-1] == '\0') && (devid_list[i] == '\0')) | ||||||
|  | @ -268,6 +279,8 @@ BOOL GetUSBDevices(DWORD devnum) | ||||||
| 		memset(buffer, 0, sizeof(buffer)); | 		memset(buffer, 0, sizeof(buffer)); | ||||||
| 		props.is_VHD = SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_HARDWAREID, | 		props.is_VHD = SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_HARDWAREID, | ||||||
| 			&datatype, (LPBYTE)buffer, sizeof(buffer), &size) && IsVHD(buffer); | 			&datatype, (LPBYTE)buffer, sizeof(buffer), &size) && IsVHD(buffer); | ||||||
|  | 		if (usb_debug) | ||||||
|  | 			uprintf("Processing Device: '%s'", buffer); | ||||||
| 
 | 
 | ||||||
| 		memset(buffer, 0, sizeof(buffer)); | 		memset(buffer, 0, sizeof(buffer)); | ||||||
| 		if (!SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_FRIENDLYNAME, | 		if (!SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_FRIENDLYNAME, | ||||||
|  | @ -287,6 +300,8 @@ BOOL GetUSBDevices(DWORD devnum) | ||||||
| 					props.is_UASP = ((((uintptr_t)device_id)+2) >= ((uintptr_t)devid_list)+list_start[1]); | 					props.is_UASP = ((((uintptr_t)device_id)+2) >= ((uintptr_t)devid_list)+list_start[1]); | ||||||
| 					// Now get the properties of the device, and its Device ID, which we need to populate the properties
 | 					// Now get the properties of the device, and its Device ID, which we need to populate the properties
 | ||||||
| 					j = htab_hash(device_id, &htab_devid); | 					j = htab_hash(device_id, &htab_devid); | ||||||
|  | 					if (usb_debug) | ||||||
|  | 						uprintf("  Matched with ID[%03d]: %s", j, device_id); | ||||||
| 					// If the hash didn't match a populated string in dev_if_path[] (htab_devid.table[j].data > 0),
 | 					// If the hash didn't match a populated string in dev_if_path[] (htab_devid.table[j].data > 0),
 | ||||||
| 					// we might have an extra vendor driver in between (e.g. "ASUS USB 3.0 Boost Storage Driver"
 | 					// we might have an extra vendor driver in between (e.g. "ASUS USB 3.0 Boost Storage Driver"
 | ||||||
| 					// for UASP devices in ASUS "Turbo Mode" or "Apple Mobile Device USB Driver" for iPods)
 | 					// for UASP devices in ASUS "Turbo Mode" or "Apple Mobile Device USB Driver" for iPods)
 | ||||||
|  | @ -297,9 +312,13 @@ BOOL GetUSBDevices(DWORD devnum) | ||||||
| 						device_id = str; | 						device_id = str; | ||||||
| 						method_str = "[GP]"; | 						method_str = "[GP]"; | ||||||
| 						j = htab_hash(device_id, &htab_devid); | 						j = htab_hash(device_id, &htab_devid); | ||||||
|  | 						if (usb_debug) | ||||||
|  | 							uprintf("  Matched with (GP) ID[%03d]: %s", j, device_id); | ||||||
| 					} | 					} | ||||||
| 					if ((uint32_t)htab_devid.table[j].data > 0) | 					if ((uint32_t)htab_devid.table[j].data > 0) | ||||||
| 						GetUSBProperties(dev_if_path.String[(uint32_t)htab_devid.table[j].data], device_id, &props); | 						GetUSBProperties(dev_if_path.String[(uint32_t)htab_devid.table[j].data], device_id, &props); | ||||||
|  | 					if (usb_debug) | ||||||
|  | 						uprintf("  Props VID:PID = %04X:%04X", props.vid, props.pid); | ||||||
| 
 | 
 | ||||||
| 					// If previous calls still didn't succeed, try reading the VID:PID from the device_id
 | 					// If previous calls still didn't succeed, try reading the VID:PID from the device_id
 | ||||||
| 					if ((props.vid == 0) && (props.pid == 0)) { | 					if ((props.vid == 0) && (props.pid == 0)) { | ||||||
|  | @ -328,6 +347,8 @@ BOOL GetUSBDevices(DWORD devnum) | ||||||
| 				if (is_SCSI) { | 				if (is_SCSI) { | ||||||
| 					// If we have an SCSI drive and couldn't get a VID:PID, we are most likely
 | 					// If we have an SCSI drive and couldn't get a VID:PID, we are most likely
 | ||||||
| 					// dealing with a system drive => eliminate it!
 | 					// dealing with a system drive => eliminate it!
 | ||||||
|  | 					if (usb_debug) | ||||||
|  | 						uprintf("  Non USB => Eliminated"); | ||||||
| 					continue; | 					continue; | ||||||
| 				} | 				} | ||||||
| 				safe_strcpy(str, sizeof(str), "????:????");	// Couldn't figure VID:PID
 | 				safe_strcpy(str, sizeof(str), "????:????");	// Couldn't figure VID:PID
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue