How to hide disk in my computer

zhaozj2021-02-16  92

I have a hidden disk with a super bunny.

Features, choose hidden disks, then determine,

Restart, see the disk hide

Mainly by operating the registry to implement this function

Open registry

Open HKEY_CURRENT_USER / SOFTWARE

/ Microsoft / Windows / CurrentVersion

/ Policies / Explorer branch

Under this branch, the NODRIVES key value can be set.

The key value corresponding to the disk drive is as follows:

A drive: 0x00000001, B drive: 0x00000002,

C drive: 0x00000004, D drive: 0x00000008,

E drive: 0x00000010, F drive: 0x00000020.

That is, the English alphabetical order (A ~ Z) of the disk drive is incremented from the twice of hexadecimal. Points the key values ​​corresponding to the disk drive you want to hide by hexadecimal assignment to "Nodrivers", if you want Hide a, c, d, assign 0x0000000D to "Nodrives"

The code is as follows: WinXP VB SP6

WinXP can be logged out of re-login to see

Add List control, Command control

Option expedition

Private Declare Function RegreateKey Lib "Advapi32.dll" Alias ​​"RegcreateKeya" (Byval HKEY As String, PhkResult As Long) AS Long

Private Declare Function RegdeleTeKey Lib "Advapi32.dll" Alias ​​"RegdeleteKeya" (Byval Lpsubkey As String) AS Long

Private Declare Function RegdeleteValue Lib "Advapi32.dll" Alias ​​"Regdeletevaluea" (Byval HKEY As Long, BYVAL LPVALUENAME AS STRING) AS Long

Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias ​​"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long

Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias ​​"RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long

Private Declare Function Regopenkey Lib "Advapi32.dll" Alias ​​"RegopenKeya" (BYVAL LPSUBKEY As String, PhkResult As long) As long

Private Declare Function RegcloseKey Lib "Advapi32.dll" (Byval HKEY As Long) (Byval HKEY AS Long) AS Longconst HKEY_CLASSES_ROOT = & H800000000

Const hkey_current_user = & h80000001

Const hkey_local_machine = & h80000002

Private submmand3_click ()

DIM I as integer

Dim KeyValue As Long

DIM HCURKEY AS Long

Dim LregResult As Long

DIM Keyid As Long

Dim Subkey As String

Dim Regkey As String

DIM RETVALUE AS Long

For i = 0 to list1.listcount - 1

If List1.Selected (i) THEN

MSGBOX List1.list (i)

KeyValue = KeyValue List1.itemdata (i)

END IF

NEXT

'If you don't choose, remove the NODRIVERS key value, cancel all disks hidden

Regkey = "Software / Microsoft / Windows / CurrentVersion / Policies / Explorer"

Subkey = "noDrives"

IF keyvalue = 0 THEN

LregResult = regopenkey (HKEY_CURRENT_USER, RegKey, Hcurkey)

LregResult = RegdeleteValue (Hcurkey, Subkey)

LregResult = regcloseKey (Hcurkey)

Else

'Hidden according to the selected disk

RetValue = regReateKey (HKEY_CURRENT_USER, RegKey, KeyID)

Subkey = "noDrives"

'KeyValue = A1

RetValue = RegSetValueex (KeyID, Subkey, 0 &, 4, KeyValue, 4)

END IF

End Sub

Private sub fascist4_click ()

Unload me

End Sub

Private sub flow_load ()

List1.additem "A:"

List1.itemdata (0) = 1

List1.additem "B:"

List1.itemdata (1) = 2

List1.additem "C:"

List1.itemdata (2) = 4

List1.additem "D:"

List1.itemdata (3) = 8

List1.additem "E:"

List1.itemdata (4) = 16

List1.additem "f:"

List1.itemdata (5) = 32

List1.additem "g:"

List1.itemdata (6) = 64

List1.additem "h:"

List1.itemdata (7) = 128

List1.additem "i:"

List1.itemdata (8) = 256

List1.additem "J:" List1.itemdata (9) = 512

List1.additem "K:"

List1.itemdata (10) = 1024

List1.additem "l:"

List1.itemdata (11) = 2048

List1.additem "M:"

List1.itemdata (12) = 4096

List1.additem "N:"

List1.itemdata (13) = 8192

List1.additem "o:"

List1.itemdata (14) = 16384

List1.additem "P:"

List1.itemdata (15) = 32768

List1.additem "Q:"

List1.itemdata (16) = 65536

List1.additem "r:"

List1.itemdata (17) = 131072

List1.additem "S:"

List1.itemdata (18) = 262144

List1.additem "T:"

List1.itemdata (19) = 524288

List1.additem "u:"

List1.itemdata (20) = 1048576

List1.additem "V:"

List1.itemdata (21) = 2097152

List1.additem "W:"

List1.itemdata (22) = 4194304

List1.additem "x:"

List1.itemdata (23) = 8388608

List1.additem "Y:"

List1.itemdata (24) = 16777216

List1.additem "z:"

List1.itemdata (25) = 33554432

End Sub

转载请注明原文地址:https://www.9cbs.com/read-15576.html

New Post(0)