以下是引用szgyyq在2007-12-30 22:42:48的发言: 如何禁止使用D或E盘呢? Option Explicit Public Const HKEY_CLASSES_ROOT = &H80000000 Public Const HKEY_CURRENT_USER = &H80000001 Public Const HKEY_LOCAL_MACHINE = &H80000002 Public Const HKEY_USERS = &H80000003 Public Const HKEY_PERFORMANCE_DATA = &H80000004 Public Const HKEY_CURRENT_CONFIG = &H80000005 Public Const HKEY_DYN_DATA = &H80000006 Public Const REG_NONE = 0 Public Const REG_SZ = 1 Public Const REG_EXPAND_SZ = 2 Public Const REG_BINARY = 3 Public Const REG_DWORD = 4 Public Const REG_DWORD_BIG_ENDIAN = 5 Public Const REG_MULTI_SZ = 7 Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long 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 '---------------------隐藏D和E=D+E:(8+10=18)A=01,B=02,C=04,D=08,E=10,F=20,G=40,...十六进制翻倍 Sub GaiBian() Dim hKey As Long Dim bArr(0 To 4) As Byte RegCreateKey HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", hKey bArr(0) = &H18: bArr(1) = &H0: bArr(2) = &H0: bArr(3) = &H0 RegSetValueEx hKey, "NoDrives", 0, REG_BINARY, bArr(0), 4 RegSetValueEx hKey, "NoViewOnDrive", 0, REG_BINARY, bArr(0), 4 End Sub '--------------- 恢复在红字行改为下式 bArr(0) = &H0: bArr(1) = &H0: bArr(2) = &H0: bArr(3) = &H0 我已在自已的局域网中成功使用,改变键值可隐藏1-26的任意盘符, 用EXCEL试过成功,有空时另贴奉献,感谢楼主提出了这个好想法,此法妙用多多!!!
键值00000000(不隐藏任何盘)01000000(隐藏A盘)02000000(B)04000000(C)08000000(D)10000000(E) 20000000(F)40000000(G)80000000(H)00010000(I)00020000(J)00040000(K)00080000(L)00100000(M)00200000(N)00400000(O)00800000(P)00000100(Q)00000200?00000400(S)00000800(T)00001000(U)00002000(V)00004000(W)00008000(X)00000001(Y)00000002(Z)FFFFFFFF(隐藏所有驱动器)21000000(隐藏A、F盘).。具体使用方法:首先应该把这些值看成四区00 00 00 00,第一区控制盘符A-H,第二区控制盘符I-P,第三区控制盘符Q-X,第四区控制Y和Z盘符。一直下去都是以陪数关系的,比如A盘为01,B盘则为02,再下去就是C盘02x2=04了,不过到D盘08后,因为是16进制计算的,所以E盘08x2为16,进一位就要写成E盘10了,然后再下去F盘10x2=20……以此类推。
[此贴子已经被作者于2008-1-1 3:32:10编辑过] |