WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Hiding-Disabling Apps to Prevent User Intervention

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Hide and Unhide Disk Drives from User's Perusal

Keywords:   hide unhide disk drives

In some cases, you might want to hide a disk drive from users. To do this, you need to change some settings in the registry.

The registry key for Win 95/98 is:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
NoDrive=00 00 00 00, which shows all drives.

In the example below, you need to build an INI file, with binary values of each drive letter. You could build a table to work off of, with each alphabetic character representing a bit, and cluster them into 4 bytes (8 bits per byte), with the last cluster containing only Y and Z.

Column 1 is A - H
Column 2 is I - P
Column 3 is Q - X
Column 4 is Y - Z
(These are binary values with each drive letter twice the value of the previous, ie A=01, B=02, C=04, ...H=80)
;The following hides all drives but A and G
;it reads from an INI file to determine the values
;in this case, the INI file holds the integer value of the visible drives

ExpKey = 'Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'

;Determine values (total bytes) of the drives, in 4 bytes (D1-D4) consisting of 8 bits each
intDrvAH = IniReadPvt("Student", "D1", 65, LCini) ;1+64 (drive A and drive G shown drives)
intDrvIP = IniReadPvt("Student", "D2", 0, LCini)
intDrvQX = IniReadPvt("Student", "D3", 0, LCini)
intDrvYZ = IniReadPvt("Student", "D4", 0, LCini)

;Flipping the bit here
intDrvAH = 255-intDrvAH
intDrvIP = 255-intDrvIP
intDrvQX = 255-intDrvQX
intDrvYZ = 03-intDrvYZ

if intDrvYZ < 3 then intDrvYZ = 3
D1 = xBaseConvert(intDrvAH, 10, 16)

if intDrvAH < 16 then D1 = StrCat("0",D1)
D2 = xBaseConvert(intDrvIP, 10, 16)

if intDrvIP < 16 then D2 = StrCat("0",D2)
D3 = xBaseConvert(intDrvQX, 10, 16)

if intDrvQX < 16 then D3 = StrCat("0",D3)
D4 = xBaseConvert(intDrvYZ, 10, 16)

;The following hides the drive 
D4 = StrCat("0", D4)
RegKey = RegOpenKey(@RegCurrent,ExpKey)
RegSetBin(RegKey, "[NoDrives]", "%D1% %D2% %D3% %D4%")
RegCloseKey(RegKey)

;The following unhides all drives
RegKey = RegCreateKey(@RegCurrent,ExpKey)
RegSetBin(RegKey, "[NoDrives]", "00 00 00 00")
RegCloseKey(RegKey)

Article ID:   W14492
Filename:   Hiding and Unhiding Disk Drives.txt
File Created: 2000:03:01:14:41:22
Last Updated: 2000:03:01:14:41:22