中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-16 04:56
47,813 topics / 349,903 posts / today 1 new / 48,258 members
DOS批处理 & 脚本技术(批处理室) » [Share] Disabling & Enabling USB Devices Is So Simple (Classifiable by Standards)
Printable Version  7,375 / 35
Floor1 fastslz Posted 2008-01-14 23:10
铂金会员 Posts 2,315 Credits 5,493 From 上海
Previously, everyone used devcon find to obtain the Hardware ID and filtered by for + find to disable or enable devices. However, their names are not fixed and have no pattern, so any code is not relatively universal. I have always been puzzled by the USB device standard. With the spirit of not giving up until the goal is achieved, I started to seek the rules of USB devices in Windows and the USB device standard. I opened the Registry Editor and started from the hardware-related key values to find their similarities and rules. Finally, I located HKLM\SYSTEM\CurrentControlSet\Enum\USB. By comparing one by one, I found that USB\Class_XX&SubClass_XX has a certain pattern. Then I invited Google experts for help. I saw some relevant standards on the Microsoft website with the keyword CompatibleIDs (Microsoft standards are not all standards). Hehe, it seems there is hope! ^_^ Continue with the keyword USB Class, haha OK!!www.usb.org It's standard enough! Well, enough small talk, start sharing my hard work; -)

Classification standards of each device
00 Use class information in the Interface Descriptors
01 Audio
02 Communications and CDC Control
03 HID (Human Interface Device)
05 Physical
06 Image
07 Printer
08 Mass Storage
09 Hub
0A CDC-Data
0B Smart Card
0D Content Security
0E Video
0F Personal Healthcare
DC Diagnostic Device
E0 Wireless Controller
EF Miscellaneous
FE Application Specific
FF Vendor Specific

Not translating the above due to poor English

Method to disable a device: devcon.exe disable USB\Class_XX
Method to enable a device: devcon.exe enable USB\Class_XX
(where XX is the serial number in the green part above)

Example:
devcon.exe disable USB\Class_08
Disable USB flash drives, that is, delete USB flash drives, no matter how many USB flash drives you have, all delete together
devcon.exe disable USB\Class_06
Disable digital cameras, including the removable disks attached to digital cameras
devcon.exe disable USB\Class_03
Disable USB mice & keyboards
devcon.exe disable USB\Class_ff
Disable cameras, see you still show off; -)
Disabling & enabling USB devices is so simple

Related tools DevCon.exe Microsoft command-line utility can replace Device Manager
Related links:
http://www.microsoft.com/whdc/device/input/HID_HWID.mspx
http://www.usb.org/developers/defined_class/
http://www.cn-dos.net/forum/viewthread.php?tid=35139&fpage=1

Finally, I also hope everyone can collect other USB\Class_XX serial numbers (post replies)
Batch code to query the USB\Class_XX serial number of known or previously installed devices is as follows



Back up drivers using pure DevCon script, compatible with Driver Genius (2008-01-17)

[ Last edited by fastslz on 2009-9-13 at 05:19 ]
Floor2 zh159 Posted 2008-01-15 02:05
金牌会员 Posts 1,467 Credits 3,687
devcon.exe disable USB\Class_03
Disable USB mice & keyboards


This works well in some places ^_^
Floor3 voiL Posted 2008-01-16 11:34
中级用户 Posts 189 Credits 384
Still, fastslz is powerful. I've been looking for this material for a long time too, but unfortunately I couldn't find it all..
Floor4 vkill Posted 2008-01-16 11:51
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
The notebook considers some devices as USB flash drives.
Floor5 fastslz Posted 2008-01-16 12:58
铂金会员 Posts 2,315 Credits 5,493 From 上海
Originally posted by vkill at 2008-1-16 11:51:
Some devices on the laptop are considered as USB drives.

It is estimated that some laptops connect the device to the USB expansion port of the motherboard.
Then you can take a look at the SubClass_XX pattern. Here, only the USB mouse cannot test SubClass_XX. If both the USB mouse and keyboard are USB\Class_03, the SubClass_XX serial number may be different. Some friends can take a look. Change "delims=&" in the code on the first floor to "delims=" to see it.
Hey~ The bug of Microsoft reg query is really disgusting.
Floor6 HAT Posted 2008-01-16 13:38
版主 Posts 5,017 Credits 9,023
Learning code, but also learning spirit.
Floor7 zts59 Posted 2008-01-16 14:11
中级用户 Posts 104 Credits 387
Wow, it's great, very comprehensive. Thanks
Floor8 429499381 Posted 2008-01-16 16:17
中级用户 Posts 202 Credits 452
It doesn't work on ASUS motherboard, VIMICRO USB PC Camera (ZC0301PLH). Disabled successfully, but the camera can still be used.
Floor9 regvip2008 Posted 2008-01-16 17:49
初级用户 Posts 87 Credits 187
"devcon" command has such powerful functions?
Hehe, thanks "fastslz" for providing!
Such a good post, can't help but top it!
Floor10 enjoyer Posted 2008-01-16 22:56
中级用户 Posts 140 Credits 351
I want to systematically learn about USB - related things, especially the management of USB devices by the operating system.
Floor11 icm Posted 2008-01-17 14:04
新手上路 Posts 6 Credits 12
Floor12 zts59 Posted 2008-01-24 20:59
中级用户 Posts 104 Credits 387
May I ask the original poster, what is DEVCON modifying to achieve disabling a device?

Why after using DEVCON to disable a device: devcon.exe disable USB\Class_08

After restarting the system, it can be used again. Oh my

How to disable a device without using DEVCON? For example, modifying the registry and so on.
Floor13 fastslz Posted 2008-01-24 22:28
铂金会员 Posts 2,315 Credits 5,493 From 上海
In addition to DEVCON to disable devices, there is also wmic, and the registry is more complicated (and not necessarily successful)
Of course, you can completely disable USB devices from the registry
Keyword "completely disable USB devices" google
Floor14 rot04021 Posted 2008-01-25 01:17
新手上路 Posts 5 Credits 6
Floor15 student007 Posted 2008-01-25 23:39
新手上路 Posts 5 Credits 10
Thanks, share.
Learned
1 2 3  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023