To disable the USB interface, you can create a new key "nodrives" at the HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ Explorer location in the registry. The type is REG_DWORD, hide a drive letter, and create a new key "noviewondrive". The type is REG_DWORD. By setting its value, access to a drive is prohibited.
These should be well understood. USB flash drives can also be disabled. But the problem lies in "setting its value". How can I set it?
There are "details" on the Internet about how to set it up, but it is too obscure. I guess you can copy it and I don't know what it means. I just posted a tutorial on the Internet, the person reading the tutorial is notAlgorithmErrors are completely incomprehensible. I was deeply affected by this problem. At last, I could not go to msdn to view the English documents to understand what was going on.
After talking so much nonsense, let's get started.
Parameter rules: In the Registry, the key type REG_DWORD indicates the 32-bit unsigned number. If it is represented in binary, it indicates abcdefghjiklmnopqrstuvwxyz, if you want to disable a drive, write the corresponding bit as 1. If it is not disabled, write 0. The relationship is as follows:
All Drives are disabled.
If only disk A, disk C, and disk D are retained and all others are disabled, write them as follows:
We can see that we actually constructed a binary representation in alphabetical order, converted the binary representation into a hexadecimal representation, and saved it to the "nodrives" key and "noviewondrive" key, in this way, the disabled drive cannot be displayed or accessed.