

'====================================================================
' Registry tutorial - How to make your computer more secure by hiding
' drives of your choice.
' 
' This program will show / hide drives from another user, whilst your
' user account will NOT be effected.
'====================================================================

'====================================================================================
' Should you have any problems restoring (seeing) a drive and this 
' program will not work for you, then you can always use regedit.exe
'
' You will need to click on "HKEY_USERS", then "File", "Load Hive" and select
' the correct NTUSER.DAT file i.e. C:|Users\Andy\NTUSER.DAT
'
' and go to...
'
' HKEY_USERS\\UserName\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer
'
' Set the NoDrives entry to zero, or just delete it - then restart your computer.
'==================================================================================== 

'=====================================================================
' USE:
'
' Select a user, then a drive to hide it, then click Apply.
'
' Repeat the process to show the drive again.
'
'=====================================================================

'=================================================
' Compile as single file and run as Administrator!
'=================================================

$ifdef WIN32
$define WIN32_LEAN_AND_MEAN
$endif
 
$define __winreg_inc__ 'Always use this with Registry.inc if you have windowssdk.inc included.
$include "windowssdk.inc"
$include "Registry.inc"
$include "Psapi.inc"
$include "TlHelp32.inc"

declare "kernel32",GetDriveTypeFL alias GetDriveTypeA(dir:string),int
declare "kernel32",GetLogicalDrivesFL alias GetLogicalDrives(),int

'====================================================================
' This first section of code is used to make sure we have full access 
' to the registry.
'====================================================================

DWORD aProcesses[1024], cbNeeded, cProcesses, procId, bProcess[512] 
handle hProcess, hTokenSelf, hProcSelf

hProcSelf = OpenProcess( PROCESS_ALL_ACCESS,FALSE,GetCurrentProcessId() )
OpenProcessToken(hProcSelf,TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY ,&hTokenSelf)

SetPrivilege(hTokenSelf,"SeDebugPrivilege",true)

'========================
' Now some constants etc.
'========================

const Check1  = 1  : const Check2  = 2  : const Check3  = 3  : const Check4  = 4
const Check5  = 5  : const Check6  = 6  : const Check7  = 7  : const Check8  = 8
const Check9  = 9  : const Check10 = 10 : const Check11 = 11 : const Check12 = 12
const Check13 = 13 : const Check14 = 14 : const Check15 = 15 : const Check16 = 16
const Check17 = 17 : const Check18 = 18 : const Check19 = 19 : const Check20 = 20
const Check21 = 21 : const Check22 = 22 : const Check23 = 23 : const Check24 = 24
const Check25 = 25 : const Check26 = 26

const BUTTON_1 = 51 : const BUTTON_2 = 52 : const BUTTON_3 = 53
const BUTTON_4 = 54 : const BUTTON_5 = 55

const STATIC_1 = 60

WINDOW win,win2

string ALabel,BLabel,CLabel,DLabel,ELabel,FLabel,GLabel,HLabel,ILabel,JLabel,KLabel,LLabel
string MLabel,NLabel,OLabel,PLabel,QLabel,RLabel,SLabel,TLabel,ULabel,VLabel,WLabel
string XLabel,YLabel,ZLabel
string Drive,dir

string SubKeyHive[100]
string UsersHive[100]
string UsersName[100]
string UsersPath[100]
string RegPath = ""
string DriveNotes = ""
string DriveNames = ""
string DriveUnUsed = ""
string dl = ""
string DriveLetter = ""
string name 
string filesystemname 

DriveLetter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

int ActUsers
int SelectNewUser = 0
int i,l,result,Selected
int x = 0
int DriveCount = 0
int DriveA,DriveB,DriveC,DriveD,DriveE,DriveF,DriveG,DriveH,DriveI,DriveJ,DriveK,DriveL,DriveM
int DriveN,DriveO,DriveP,DriveQ,DriveR,DriveS,DriveT,DriveU,DriveV,DriveW,DriveX,DriveY,DriveZ
int flags,serialnumber,maxcomponentlength ' Integers of the call

flags=0:serialnumber=0:maxcomponentlength=0 ' Make sure there all set to zero

'==========================================================================
' First we will test to see if this program is being run as Admin...
'
' To do this test, try writing a value to:
' "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Test"
'
' If you have admin rights, it will do so, if not it will fail.
'
'==========================================================================

result = RegSetDWValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Test",1,"Test")
sleep(250)

'=================================================================
' Now try to read this test entry value back from the registry....
'=================================================================

resultin = ""
resultin = RegGetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Test","Test")

if resultin = ""
   ' Program has not been run as Admin. 
   _MessageBox(0, "Please run this program as an Administrator.")
   end
else
   ' Program has been run as admin, so let's delete this test entry, so we can test again next time.
   result = RegDeleteKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Test")
endif

'===========================================================
' Now we will get a list of user accounts on this machine.
'===========================================================

EnumUserAccounts()

'================================================================
' Now we will open a window so you can choose which user you want
' to change the registry setting for.
'================================================================

label SelectAUser
SelectUser()

'===============================================================================
' Here we get the value of the registry entry 'NoDrives'.
' Since this entry does not normally ship with Windows, it's unlikely to be on
' your machine, and so the first time you run this program the value will be 
' zero.
'
' However, once you start hiding drives it will have some value stored in it.
'===============================================================================

DriveCount = val(RegGetValue(RegPath, "NoDrives"))

'*******************************************************
' NOTICE - HKEY_CURRENT_USER\\Software....
'
' is now replaced by:
'
' "HKEY_USERS\\" + UsersName[Selected] + "\\Software...
'
' Example - HKEY_USERS\\Andy\Software...
'*******************************************************

'============================================================================
' Here I will store a 1 or 0 for each drive that is hidden (1) or showing (0)
' I found this much easier than trying to calculate it.
'============================================================================
NoteDrives()

'Get the drive label name if available and store it.
GetDriveNames() 

'Get the stored label names.
LabelDrives() 

'Main window to show / hide drives from the selected user.
NowSelectDrives()

if SelectNewUser = 1
   SelectNewUser = 0
   goto SelectAUser
else
   end
endif

SUB win_handler(), INT
	SELECT @MESSAGE
		CASE @IDCREATE
			CENTERWINDOW win

		CASE @IDCONTROL
			SELECT @CONTROLID

				CASE BUTTON_1 'Apply

                 '====================================================================
                 ' When the Apply button is clicked, we will check to see which drives
                 ' have been selected.
                 '
                 ' If the drive is visable, then we will add it's corresponding drive
                 ' number to the NoDrives registry entry.
                 ' i.e. If drive A is selected, we will add 1 to the NoDrives count
                 ' we would add 2 for drive B, 4 for drive C and so on...
                 '
                 ' If the drive selected is hidden, then we will subtract it's number
                 ' from NoDrives.
                 '====================================================================  

						IF @NOTIFYCODE = 0
							if getstate(win,Check1) = 1 'A
                        if DriveA = 0  
									result = RegSetDWValue(DriveNotes, 1, "A")
									DriveCount += 1
                           setcontroltext(win,Check1,"Show Drive (A) "+ALabel)
                           DriveA = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "A")
									DriveCount = DriveCount - 1
                           setcontroltext(win,Check1,"Hide Drive (A) "+ALabel)
                           DriveA = 0
                        endif 
                        setstate(win,Check1,0)
							endif  

							if getstate(win,Check2) = 1 'B
                        if DriveB = 0  
									result = RegSetDWValue(DriveNotes, 1, "B")
									DriveCount += 2
                           setcontroltext(win,Check2,"Show Drive (B) " +BLabel)
                           DriveB = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "B")
									DriveCount = DriveCount - 2
                           setcontroltext(win,Check2,"Hide Drive (B) " +BLabel)
                           DriveB = 0
                        endif 
                        setstate(win,Check2,0)
							endif

							if getstate(win,Check3) = 1 'C
                        if DriveC = 0  
									result = RegSetDWValue(DriveNotes, 1, "C")
									DriveCount += 4
                           setcontroltext(win,Check3,"Show Drive (C) " +CLabel)
                           DriveC = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "C")
									DriveCount = DriveCount - 4
                           setcontroltext(win,Check3,"Hide Drive (C) " +CLabel)
                           DriveC = 0
                        endif 
                        setstate(win,Check3,0)
							endif

							if getstate(win,Check4) = 1 'D
                        if DriveD = 0  
									result = RegSetDWValue(DriveNotes, 1, "D")
									DriveCount += 8
                           setcontroltext(win,Check4,"Show Drive (D) " +DLabel)
                           DriveD = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "D")
									DriveCount = DriveCount - 8
                           setcontroltext(win,Check4,"Hide Drive (D) " +DLabel)
                           DriveD = 0
                        endif 
                        setstate(win,Check4,0)
							endif

							if getstate(win,Check5) = 1 'E
                        if DriveE = 0  
									result = RegSetDWValue(DriveNotes, 1, "E")
									DriveCount += 16
                           setcontroltext(win,Check5,"Show Drive (E) " +ELabel)
                           DriveE = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "E")
									DriveCount = DriveCount - 16
                           setcontroltext(win,Check5,"Hide Drive (E) " +ELabel)
                           DriveE = 0
                        endif 
                        setstate(win,Check5,0)
							endif

							if getstate(win,Check6) = 1 'F
                        if DriveF = 0  
									result = RegSetDWValue(DriveNotes, 1, "F")
									DriveCount += 32
                           setcontroltext(win,Check6,"Show Drive (F) " +FLabel)
                           DriveF = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "F")
									DriveCount = DriveCount - 32
                           setcontroltext(win,Check6,"Hide Drive (F) " +FLabel)
                           DriveF = 0
                        endif 
                        setstate(win,Check6,0)
							endif

							if getstate(win,Check7) = 1 'G
                        if DriveG = 0  
									result = RegSetDWValue(DriveNotes, 1, "G")
									DriveCount += 64
                           setcontroltext(win,Check7,"Show Drive (G) " +GLabel)
                           DriveG = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "G")
									DriveCount = DriveCount - 64
                           setcontroltext(win,Check7,"Hide Drive (G) " +GLabel)
                           DriveG = 0
                        endif 
                        setstate(win,Check7,0)
							endif

							if getstate(win,Check8) = 1 'H
                        if DriveH = 0  
									result = RegSetDWValue(DriveNotes, 1, "H")
									DriveCount += 128
                           setcontroltext(win,Check8,"Show Drive (H) " +HLabel)
                           DriveH = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "H")
									DriveCount = DriveCount - 128
                           setcontroltext(win,Check8,"Hide Drive (H) " +HLabel)
                           DriveH = 0
                        endif 
                        setstate(win,Check8,0)
							endif

							if getstate(win,Check9) = 1 'I
                        if DriveI = 0  
									result = RegSetDWValue(DriveNotes, 1, "I")
									DriveCount += 256
                           setcontroltext(win,Check9,"Show Drive (I) " +ILabel)
                           DriveI = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "I")
									DriveCount = DriveCount - 256
                           setcontroltext(win,Check9,"Hide Drive (I) " +ILabel)
                           DriveI = 0
                        endif 
                        setstate(win,Check9,0)
							endif

							if getstate(win,Check10) = 1 'J
                        if DriveJ = 0  
									result = RegSetDWValue(DriveNotes, 1, "J")
									DriveCount += 512
                           setcontroltext(win,Check10,"Show Drive (J) " +JLabel)
                           DriveJ = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "J")
									DriveCount = DriveCount - 512
                           setcontroltext(win,Check10,"Hide Drive (J) " +JLabel)
                           DriveJ = 0
                        endif 
                        setstate(win,Check10,0)
							endif

							if getstate(win,Check11) = 1 'K
                        if DriveK = 0  
									result = RegSetDWValue(DriveNotes, 1, "K")
									DriveCount += 1024
                           setcontroltext(win,Check11,"Show Drive (K) " +KLabel)
                           DriveK = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "K")
									DriveCount = DriveCount - 1024
                           setcontroltext(win,Check11,"Hide Drive (K) " +KLabel)
                           DriveK = 0
                        endif 
                        setstate(win,Check11,0)
							endif

							if getstate(win,Check12) = 1 'L
                        if DriveL = 0  
									result = RegSetDWValue(DriveNotes, 1, "L")
									DriveCount += 2048
                           setcontroltext(win,Check12,"Show Drive (L) " +LLabel)
                           DriveL = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "L")
									DriveCount = DriveCount - 2048
                           setcontroltext(win,Check12,"Hide Drive (L) " +LLabel)
                           DriveL = 0
                        endif 
                        setstate(win,Check12,0)
							endif

							if getstate(win,Check13) = 1 'M
                        if DriveM = 0  
									result = RegSetDWValue(DriveNotes, 1, "M")
									DriveCount += 4096
                           setcontroltext(win,Check13,"Show Drive (M) " +MLabel)
                           DriveM = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "M")
									DriveCount = DriveCount - 4096
                           setcontroltext(win,Check13,"Hide Drive (M) " +MLabel)
                           DriveM = 0
                        endif 
                        setstate(win,Check13,0)
							endif

							if getstate(win,Check14) = 1 'N
                        if DriveN = 0  
									result = RegSetDWValue(DriveNotes, 1, "N")
									DriveCount += 8192
                           setcontroltext(win,Check14,"Show Drive (N) " +NLabel)
                           DriveN = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "N")
									DriveCount = DriveCount - 8192
                           setcontroltext(win,Check14,"Hide Drive (N) " +NLabel)
                           DriveN = 0
                        endif 
                        setstate(win,Check14,0)
							endif

							if getstate(win,Check15) = 1 'O
                        if DriveO = 0  
									result = RegSetDWValue(DriveNotes, 1, "O")
									DriveCount += 16384
                           setcontroltext(win,Check15,"Show Drive (O) " +OLabel)
                           DriveO = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "O")
									DriveCount = DriveCount - 16384
                           setcontroltext(win,Check15,"Hide Drive (O) " +OLabel)
                           DriveO = 0
                        endif 
                        setstate(win,Check15,0)
							endif

							if getstate(win,Check16) = 1 'P
                        if DriveP = 0  
									result = RegSetDWValue(DriveNotes, 1, "P")
									DriveCount += 32768
                           setcontroltext(win,Check16,"Show Drive (P) " +PLabel)
                           DriveP = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "P")
									DriveCount = DriveCount - 32768
                           setcontroltext(win,Check16,"Hide Drive (P) " +PLabel)
                           DriveP = 0
                        endif 
                        setstate(win,Check16,0)
							endif

							if getstate(win,Check17) = 1 'Q
                        if DriveQ = 0  
									result = RegSetDWValue(DriveNotes, 1, "Q")
									DriveCount += 65536
                           setcontroltext(win,Check17,"Show Drive (Q) " +QLabel)
                           DriveQ = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "Q")
									DriveCount = DriveCount - 65536
                           setcontroltext(win,Check17,"Hide Drive (Q) " +QLabel)
                           DriveQ = 0
                        endif 
                        setstate(win,Check17,0)
							endif

							if getstate(win,Check18) = 1 'R
                        if DriveR = 0  
									result = RegSetDWValue(DriveNotes, 1, "R")
									DriveCount += 131072
                           setcontroltext(win,Check18,"Show Drive (R) " +RLabel)
                           DriveR = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "R")
									DriveCount = DriveCount - 131072
                           setcontroltext(win,Check18,"Hide Drive (R) " +RLabel)
                           DriveR = 0
                        endif 
                        setstate(win,Check18,0)
							endif

							if getstate(win,Check19) = 1 'S
                        if DriveS = 0  
									result = RegSetDWValue(DriveNotes, 1, "S")
									DriveCount += 262144
                           setcontroltext(win,Check19,"Show Drive (S) " +SLabel)
                           DriveS = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "S")
									DriveCount = DriveCount - 262144
                           setcontroltext(win,Check19,"Hide Drive (S) " +SLabel)
                           DriveS = 0
                        endif 
                        setstate(win,Check19,0)
							endif

							if getstate(win,Check20) = 1 'T
                        if DriveT = 0  
									result = RegSetDWValue(DriveNotes, 1, "T")
									DriveCount += 524288
                           setcontroltext(win,Check20,"Show Drive (T) " +TLabel)
                           DriveT = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "T")
									DriveCount = DriveCount - 524288
                           setcontroltext(win,Check20,"Hide Drive (T) " +TLabel)
                           DriveT = 0
                        endif 
                        setstate(win,Check20,0)
							endif

							if getstate(win,Check21) = 1 'U
                        if DriveU = 0  
									result = RegSetDWValue(DriveNotes, 1, "U")
									DriveCount += 1048576
                           setcontroltext(win,Check21,"Show Drive (U) " +ULabel)
                           DriveU = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "U")
									DriveCount = DriveCount - 1048576
                           setcontroltext(win,Check21,"Hide Drive (U) " +ULabel)
                           DriveU = 0
                        endif 
                        setstate(win,Check21,0)
							endif

							if getstate(win,Check22) = 1 'V
                        if DriveV = 0  
									result = RegSetDWValue(DriveNotes, 1, "V")
									DriveCount +=  2097152
                           setcontroltext(win,Check22,"Show Drive (V) " +VLabel)
                           DriveV = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "V")
									DriveCount = DriveCount -  2097152
                           setcontroltext(win,Check22,"Hide Drive (V) " +VLabel)
                           DriveV = 0
                        endif 
                        setstate(win,Check22,0)
							endif

							if getstate(win,Check23) = 1 'W
                        if DriveW = 0  
									result = RegSetDWValue(DriveNotes, 1, "W")
									DriveCount += 4194304
                           setcontroltext(win,Check23,"Show Drive (W) " +WLabel)
                           DriveW = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "W")
									DriveCount = DriveCount - 4194304
                           setcontroltext(win,Check23,"Hide Drive (W) " +WLabel)
                           DriveW = 0
                        endif 
                        setstate(win,Check23,0)
							endif

							if getstate(win,Check24) = 1 'X
                        if DriveX = 0  
									result = RegSetDWValue(DriveNotes, 1, "X")
									DriveCount +=  8388608
                           setcontroltext(win,Check24,"Show Drive (X) " +XLabel)
                           DriveX = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "X")
									DriveCount = DriveCount -  8388608
                           setcontroltext(win,Check24,"Hide Drive (X) " +XLabel)
                           DriveX = 0
                        endif 
                        setstate(win,Check24,0)
							endif

							if getstate(win,Check25) = 1 'Y
                        if DriveY = 0  
									result = RegSetDWValue(DriveNotes, 1, "Y")
									DriveCount += 16777216
                           setcontroltext(win,Check25,"Show Drive (Y) " +YLabel)
                           DriveY = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "Y")
									DriveCount = DriveCount - 16777216
                           setcontroltext(win,Check25,"Hide Drive (Y) " +YLabel)
                           DriveY = 0
                        endif 
                        setstate(win,Check25,0)
							endif

							if getstate(win,Check26) = 1 'Z
                        if DriveZ = 0  
									result = RegSetDWValue(DriveNotes, 1, "Z")
									DriveCount += 33554432
                           setcontroltext(win,Check26,"Show Drive (Z) " +ZLabel)
                           DriveZ = 1
                        else
									result = RegSetDWValue(DriveNotes, 0, "Z")
									DriveCount = DriveCount - 33554432
                           setcontroltext(win,Check26,"Hide Drive (Z) " +ZLabel)
                           DriveZ = 0
                        endif 
                        setstate(win,Check26,0)
							endif

                     '=====================================
                     ' Now we will store the NoDrive count.
                     '=====================================

                     result = RegSetDWValue(RegPath, DriveCount, "NoDrives")

                     '==========================================================
                     ' Since this is a user account that is NOT LOGGED ON, we 
                     ' do not need to re-start explorer.exe any more.
                     ' The changes will be applied when they next log on.
                     '==========================================================



                     if instr(RegPath,"HKEY_CURRENT_USER")

								retval = findPIDByName("explorer.exe")

								if retval <>0
									killProcess(retval) 'Here KillProcess stops an exe OR use GOSUB DOSOMETHINGELSE etc....
								ELSE
									'print "Process Not Found."
								ENDIF

                     endif

					CASE BUTTON_2 'Show all drives
							IF @NOTIFYCODE = 0

                        DriveCount = 0

                        DriveA = 0 
                        DriveB = 0 
                        DriveC = 0 
                        DriveD = 0 
                        DriveE = 0 
                        DriveF = 0 
                        DriveG = 0 
                        DriveH = 0 
                        DriveI = 0 
                        DriveJ = 0 
                        DriveK = 0
                        DriveL = 0 
                        DriveM = 0 
                        DriveN = 0 
                        DriveO = 0 
                        DriveP = 0 
                        DriveQ = 0 
                        DriveR = 0 
                        DriveS = 0 
                        DriveT = 0 
                        DriveU = 0 
                        DriveV = 0 
                        DriveW = 0 
                        DriveX = 0 
                        DriveY = 0 
                        DriveZ = 0  

								result = RegSetDWValue(RegPath, 0, "NoDrives")

								result = RegSetDWValue(DriveNotes, 0, "A")
								result = RegSetDWValue(DriveNotes, 0, "B")
								result = RegSetDWValue(DriveNotes, 0, "C")
								result = RegSetDWValue(DriveNotes, 0, "D")
								result = RegSetDWValue(DriveNotes, 0, "E")
								result = RegSetDWValue(DriveNotes, 0, "F")
								result = RegSetDWValue(DriveNotes, 0, "G")
								result = RegSetDWValue(DriveNotes, 0, "H")
								result = RegSetDWValue(DriveNotes, 0, "I")
								result = RegSetDWValue(DriveNotes, 0, "J")
								result = RegSetDWValue(DriveNotes, 0, "K")
								result = RegSetDWValue(DriveNotes, 0, "L")
								result = RegSetDWValue(DriveNotes, 0, "M")
								result = RegSetDWValue(DriveNotes, 0, "N")
								result = RegSetDWValue(DriveNotes, 0, "O")
								result = RegSetDWValue(DriveNotes, 0, "P")
								result = RegSetDWValue(DriveNotes, 0, "Q")
								result = RegSetDWValue(DriveNotes, 0, "R")
								result = RegSetDWValue(DriveNotes, 0, "S")
								result = RegSetDWValue(DriveNotes, 0, "T")
								result = RegSetDWValue(DriveNotes, 0, "U")
								result = RegSetDWValue(DriveNotes, 0, "V")
								result = RegSetDWValue(DriveNotes, 0, "W")
								result = RegSetDWValue(DriveNotes, 0, "X")
								result = RegSetDWValue(DriveNotes, 0, "Y")
								result = RegSetDWValue(DriveNotes, 0, "Z")
                       
                        setcontroltext(win,Check1, "Hide Drive (A) " +ALAbel)
                        setcontroltext(win,Check2, "Hide Drive (B) " +BLAbel)
                        setcontroltext(win,Check3, "Hide Drive (C) " +CLAbel)
                        setcontroltext(win,Check4, "Hide Drive (D) " +DLAbel)
                        setcontroltext(win,Check5, "Hide Drive (E) " +ELAbel)
                        setcontroltext(win,Check6, "Hide Drive (F) " +FLAbel)
                        setcontroltext(win,Check7, "Hide Drive (G) " +GLAbel)
                        setcontroltext(win,Check8, "Hide Drive (H) " +HLAbel)
                        setcontroltext(win,Check9, "Hide Drive (I) " +ILAbel)
                        setcontroltext(win,Check10,"Hide Drive (J) " +JLAbel)
                        setcontroltext(win,Check11,"Hide Drive (K) " +KLAbel)
                        setcontroltext(win,Check12,"Hide Drive (L) " +LLAbel)
                        setcontroltext(win,Check13,"Hide Drive (M) " +MLAbel)
                        setcontroltext(win,Check14,"Hide Drive (N) " +NLAbel)
                        setcontroltext(win,Check15,"Hide Drive (O) " +OLAbel)
                        setcontroltext(win,Check16,"Hide Drive (P) " +PLAbel)
                        setcontroltext(win,Check17,"Hide Drive (Q) " +QLAbel)
                        setcontroltext(win,Check18,"Hide Drive (R) " +RLAbel)
                        setcontroltext(win,Check19,"Hide Drive (S) " +SLAbel)
                        setcontroltext(win,Check20,"Hide Drive (T) " +TLAbel)
                        setcontroltext(win,Check21,"Hide Drive (U) " +ULAbel)
                        setcontroltext(win,Check22,"Hide Drive (V) " +VLAbel)
                        setcontroltext(win,Check23,"Hide Drive (W) " +WLAbel)
                        setcontroltext(win,Check24,"Hide Drive (X) " +XLAbel)
                        setcontroltext(win,Check25,"Hide Drive (Y) " +YLAbel)
                        setcontroltext(win,Check26,"Hide Drive (Z) " +ZLAbel)

                        for x = 1 to 26
                            setstate(win,x,0)
                        next x

                        if instr(RegPath,"HKEY_CURRENT_USER")

									retval = findPIDByName("explorer.exe")

									if retval <>0
										killProcess(retval) 'Here KillProcess stops an exe OR use GOSUB DOSOMETHINGELSE etc....
									ENDIF

                        endif 

							 endif

						ENDIF

               case BUTTON_4 'UnUsed Drives
                    if @NOTIFYCODE = 0

								for i = 1 to 26
								  
									 dl = mid$(DriveLetter,i,1)

									 resultin = ""
									 resultin = ltrim$(RegGetValue(DriveUnUsed,dl))
								  
									 if resultin <> ""
										 setstate(win,i,1)
									 endif

								next i

                        setfocus win

                     endif

					CASE BUTTON_5 'New User
							IF @NOTIFYCODE = 0
                        SelectNewUser = 1
                        UnloadUser()
                        closewindow win
                        return
                     endif

					CASE BUTTON_3 'Quit
							IF @NOTIFYCODE = 0
                        UnloadUser()
                        closewindow win
                        end
                     endif
			ENDSELECT

		CASE @IDCLOSEWINDOW
           UnloadUser()
			  CLOSEWINDOW win
           end
	ENDSELECT
	RETURN 0
ENDSUB

SUB Win2Hnd(), INT
	SELECT @MESSAGE
		CASE @IDCREATE
			CENTERWINDOW win2
			/* Initialize any controls here */
		CASE @IDCONTROL
			SELECT @CONTROLID

				CASE BUTTON_1 'Next
						IF @NOTIFYCODE = 0
							Selected  = getselected(win2,100) + 1

                     ' HKEY_CURRENT_USER\\Volatile Environment, USERNAME - tells us the current user account name

                     if UsersName[Selected] <> ltrim$(RegGetValue("HKEY_CURRENT_USER\\Volatile Environment","USERNAME"))
								if LoadUser()
                           RegPath = "HKEY_USERS\\" + UsersName[Selected] + "\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"
                           DriveNotes = "HKEY_USERS\\" + UsersName[Selected] + "\\Software\\Andys Hidden Drives"
                           DriveNames = "HKEY_USERS\\" + UsersName[Selected] + "\\Software\\Andys Hidden Drives\\Labels"  
                           DriveUnUsed = "HKEY_USERS\\" + UsersName[Selected] + "\\Software\\Andys Hidden Drives\\UnUsed"  
                       else
                           closewindow win2
                           end
                        endif 
								closewindow win2
                     else 
                        RegPath = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"  
                        DriveNotes = "HKEY_CURRENT_USER\\Software\\Andys Hidden Drives" 
                        DriveNames = "HKEY_CURRENT_USER\\Software\\Andys Hidden Drives\\Labels"
                        DriveUnUsed = "HKEY_CURRENT_USER\\Software\\Andys Hidden Drives\\UnUsed"
                        closewindow win2
                    endif
                  endif 

                  CASE BUTTON_2 'Quit
							  IF @NOTIFYCODE = 0
							     closewindow win2
								  end
						 	  endif

			ENDSELECT

		CASE @IDCLOSEWINDOW
			  CLOSEWINDOW win2
           end 
	ENDSELECT
	RETURN 0
ENDSUB

sub GetDriveNames()

result = RegDeleteKey(DriveUnUsed)

Drive = GetAllDrivesStr()

l = len(Drive)
for i = 1 to l
	dir = mid$(Drive,i,1)
   int DriveType = 0
   DriveType = GetDriveTypeFL(dir + ":\\")
	'print dir , " ",Drivetype 
   string strdrive = ""
   strdrive = dir + ":\\"
   name = ""

	if((strdrive <> "A:\\") & (strdrive <> "B:\\"))
		GetVolumeInformationA(strdrive,name,255,serialnumber,maxcomponentlength,flags,filesystemname,255)
	endif

   if DriveType = 2 and strdrive = "A:\\" or strdrive = "B:\\" 
      result = RegSetValue(DriveNames,"Floppy Drive",dir)
      goto nexti
   endif

   if DriveType = 5 then 
      result = RegSetValue(DriveNames,"CD / DVD Drive",dir)
      goto nexti
   endif

	if((strdrive <> "A:\\") & (strdrive <> "B:\\"))
		if len(name) = 0 and DriveType = 3
         result = RegSetValue(DriveNames,"Fixed Drive",dir)
		else
         result = RegSetValue(DriveNames,name,dir)
		endif
   endif

label nexti
next i

for i = 1 to 26
  
    dl = mid$(DriveLetter,i,1)

    resultin = ""
    resultin = ltrim$(RegGetValue(DriveNames,dl))
  
    if resultin <> ""
       'print resultin
    else
       result = RegSetDWValue(DriveUnUsed,1,dl)
    endif

next i

return
endsub

' GetAllDrivesStr
sub GetAllDrivesStr(),string
def n, t, s:int
def d:string
	d = ""
	n = GetLogicalDrivesFL()
	for t=0 to 25
		s = 2 ^ t
		if (n & s)
			d += chr$(65 + t)
		endif
	next t
return d
EndSub

sub EnumUserAccounts()
examkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList"

'Count the number of sub keys
ret = RegCountSubKeys(examkey)

'Enumerate sub keys
FOR y = 0 to (ret-1)
	retval = RegEnumKey(examkey,y)
   SubKeyHive[y] = retval
NEXT y

For x = 0 to ret-1

   examkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + SubKeyHive[x]  
	values = RegCountEntries(examkey)

	'Enumerate the entry names
	FOR y = 0 to (values-1)
		retval = RegEnumEntryName(examkey,y)

		if retval = "ProfileImagePath" and instr(examkey,"S-1-5-21")
			resultin = RegGetValue(examkey,retval)

         int z

         z = instr(examkey,"S-1-5-21")      

         ActUsers ++
         UsersHive[ActUsers] = mid$(examkey,z,len(examkey))
         UsersName[ActUsers] = mid$(resultin,10,len(resultin))
         UsersPath[ActUsers] = resultin + "\\ntuser.dat"
		endif
	NEXT y

next x

return
endsub

sub LoadUser(),int

HANDLE hToken
TOKEN_PRIVILEGES tp[2] ' make space for two LUID_AND_ATTRIBUTES

if (0=OpenProcessToken(GetCurrentProcess(),TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &hToken))
	_MessageBox(0, "OpenProcessToken failed")
else
	if (0=(LookupPrivilegeValue(NULL, SE_RESTORE_NAME, &tp.Privileges[0].Luid) _
	and LookupPrivilegeValue(NULL, SE_BACKUP_NAME, &tp.Privileges[1].Luid)))
		_MessageBox(0, "LookupPrivilegeValue failed")
	else
		tp.PrivilegeCount = 2
		tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED
		tp.Privileges[1].Attributes = SE_PRIVILEGE_ENABLED
		if (0=AdjustTokenPrivileges(hToken,FALSE,&tp,0,NULL,NULL))
			_MessageBox(0, "AdjustTokenPrivileges failed")
		endif
	endif
	CloseHandle(hToken)
endif

LONG errorcode 
errorcode = RegLoadKey(0x80000003, UsersName[Selected] , UsersPath[Selected])
if (errorcode)
	_MessageBox(0, "Sorry, could not load " + UsersName[Selected] + "'s settings, try restarting your computer and try again.")
   return 0
endif

return 1
endsub

sub UnloadUser()
HANDLE hToken
TOKEN_PRIVILEGES tp[2] ' make space for two LUID_AND_ATTRIBUTES

if (0=OpenProcessToken(GetCurrentProcess(),TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &hToken))
	_MessageBox(0, "OpenProcessToken failed")
else
	if (0=(LookupPrivilegeValue(NULL, SE_RESTORE_NAME, &tp.Privileges[0].Luid) _
	and LookupPrivilegeValue(NULL, SE_BACKUP_NAME, &tp.Privileges[1].Luid)))
		_MessageBox(0, "LookupPrivilegeValue failed")
	else
		tp.PrivilegeCount = 2
		tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED
		tp.Privileges[1].Attributes = SE_PRIVILEGE_ENABLED
		if (0=AdjustTokenPrivileges(hToken,FALSE,&tp,0,NULL,NULL))
			_MessageBox(0, "AdjustTokenPrivileges failed")
		endif
	endif
	CloseHandle(hToken)
endif

RegUnLoadKey(0x80000003, UsersName[Selected])
return
endsub


'======================================================
' This code is used for finding and stopping a program.
'======================================================

sub findPIDByName(string fileNameToFindPID),int
'// required by fined PIDByName
const TH32CS_SNAPHEAPLIST	=0x00000001
const TH32CS_SNAPPROCESS	=0x00000002
const TH32CS_SNAPTHREAD		=0x00000004
const TH32CS_SNAPMODULE		=0x00000008
const TH32CS_SNAPMODULE32	=0x00000010
const TH32CS_SNAPALL		=(TH32CS_SNAPHEAPLIST | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD | TH32CS_SNAPMODULE)
const TH32CS_INHERIT		=0x80000000
const PROCESS_ALL_ACCESS	=0x1F0FFF


type PROCESSENTRY32
	uint dwSize
	uint cntUsage
	uint th32ProcessID
	uint th32DefaultHeapID
	uint th32ModuleID
	uint cntThreads
	uint th32ParentProcessID
	uint pcPriClassBase
	uint dwFlags
	istring szExeFile[259]
endtype

def pe:PROCESSENTRY32
string item,PID
DEF retval, x:int 
x = 0


hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0)
pe.dwSize=len(pe)
retval=Process32First(hSnapshot,pe)

do

if LCASE$(pe.szExeFile) = LCASE$(fileNameToFindPID)
	CloseHandle(hSnapshot)
	return pe.th32ProcessID
ENDIF
item = pe.szExeFile
PID = STR$(pe.th32ProcessID)

print "["+pid+"] "+item

x++

	dwPriorityClass = 0
 
   hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,pe.th32ProcessID)

    if hProcess = NULL
      print error("Open Process Fail findpidbyname ")
    else
    
      dwPriorityClass = GetPriorityClass(hProcess)

      if dwPriorityClass <>0
			'print dwPriorityClass 
		ELSE
			'print error("dwPriorityClass")
		endif
	CloseHandle(hProcess)

/*' Print process Info
    print "process ID        = ",pe.th32ProcessID
    print "thread count      = ",pe.cntThreads
    print "parent process ID = ",pe.th32ParentProcessID
    print "Priority Base     = ",pe.pcPriClassBase
	print "Priority Class    = ",dwPriorityClass
 */ 
endif

	pe.dwSize=len(PROCESSENTRY32)
	retval=Process32Next(hSnapshot,pe)

until retval = false

CloseHandle(hSnapshot)
return 0
ENDSUB

sub findProcessIdByName(int processID),INT

int ret 
string szProcessName

szProcessName = SPACE$(255)

hProcess = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE,processID )

	if hProcess <>0
		
		ret = EnumProcessModules( hProcess, bProcess[0], len(bProcess), &cbNeeded)
 
			if ret <>0
				ret = GetModuleBaseName(hProcess, bProcess[0], szProcessName,len(szProcessName))
'				ret = GetModuleFileNameEx(hProcess, bProcess[0], szProcessName,len(szProcessName))

	
					if ret <>0
						print szProcessName
					ELSE
						print error("GetModule")
					ENDIF

			ELSE
				error("EnumProcessModules")
			ENDIF
		CloseHandle( hProcess )
	ELSE
		print error( "Openprocess Failed"+str$(processID))
	ENDIF
 return 0
ENDSUB

sub killProcess(int PID)

HANDLE hProc

hProc = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_TERMINATE, FALSE, PID)

          if hProc <>0

               if TerminateProcess(hProc, 0) <>0
                    'MessageBox (NULL, "CLOSED", "CLOSED", @MB_ICONSTOP) 
               else 
                    MessageBox (NULL, error("SUB KillProcess "), "NOT CLOSED PID"+str$(procId), @MB_ICONSTOP) 
                  CloseHandle(hProc)
			   endif
          else 
               MessageBox (NULL, error("SUB KillProcess "),"I CANT CLOSE "+str$(procId),@MB_ICONSTOP) 
		  ENDIF
ENDSUB


sub SetPrivilege(HANDLE hToken, string lpszPrivilege,INT bEnablePrivilege) 

	def tp:TOKEN_PRIVILEGES
	def luid:LUID

	if LookupPrivilegeValue(NULL,lpszPrivilege,&luid ) = 0
		error("LookupPrivilegeValue error: ")
		return FALSE
	ENDIF

	tp.PrivilegeCount = 1
	tp.Privileges[0].Luid = luid
	
    if bEnablePrivilege = true
		tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED
	else
		tp.Privileges[0].Attributes = 0
	ENDIF

	'// Enable the privilege or disable all privileges.

	if AdjustTokenPrivileges(hToken,FALSE, &tp, LEN(TOKEN_PRIVILEGES), 0, 0) =0
			error("AdjustTokenPrivileges error:") 
		  return FALSE 
	ENDIF 

	if GetLastError() = ERROR_NOT_ALL_ASSIGNED

		  print "The token does not have the specified privilege."
		  return FALSE
	ENDIF

	return TRUE

ENDSUB

SUB error(string errorCall),string  

   INT CodeErrorId, nBufferSize, flag 
   STRING sBuffer,retError  

   nBufferSize = 1024 
   sBuffer = String$(nBufferSize, Chr$(0)) 
   flag=FORMAT_MESSAGE_FROM_SYSTEM 

   CodeErrorId=GetLastError() 

   FormatMessage(flag, NULL,CodeErrorId,LANG_NEUTRAL, sBuffer, nBufferSize ,NULL ) 
	retError = errorCall+" / "+sBuffer+" / ErrorID = "+str$(CodeErrorID)

return retError
endsub

sub SelectUser()
OPENWINDOW win2,100,100,390,470,@CAPTION|@MINBOX|@MAXBOX,0," User accounts on this machine.",&Win2Hnd	
CONTROL win2,@LISTBOX,"",10,20,360,295,@CTLISTNOTIFY|@HSCROLL,100	
CONTROL win2,@STATIC,"Select a user and change their drive settings...",0,350,390,25,0|@CTEDITCENTER,STATIC_1
CONTROL win2,@BUTTON,"Next >",10,400,100,25,0,BUTTON_1
CONTROL win2,@BUTTON,"Quit",270,400,100,25,0,BUTTON_2

for x = 0 to ActUsers-1
    addstring(win2,100,UsersName[x+1])
next x 

SETFONT win2,"Arial",12,500,0,100
SETFONT win2,"Arial",12,500,0,BUTTON_1
SETFONT win2,"Arial",12,500,0,BUTTON_2
SETFONT win2,"Arial",12,500,0,STATIC_1

SETCONTROLCOLOR win2,STATIC_1,RGB(0,0,0),rgb(255,255,255)

setselected(win2,100,0)
setfocus win2
waituntil win2 = 0
return
endsub

sub NoteDrives()
	DriveA = val(RegGetValue(DriveNotes, "A"))
	DriveB = val(RegGetValue(DriveNotes, "B"))
	DriveC = val(RegGetValue(DriveNotes, "C"))
	DriveD = val(RegGetValue(DriveNotes, "D"))
	DriveE = val(RegGetValue(DriveNotes, "E"))
	DriveF = val(RegGetValue(DriveNotes, "F"))
	DriveG = val(RegGetValue(DriveNotes, "G"))
	DriveH = val(RegGetValue(DriveNotes, "H"))
	DriveI = val(RegGetValue(DriveNotes, "I"))
	DriveJ = val(RegGetValue(DriveNotes, "J"))
	DriveK = val(RegGetValue(DriveNotes, "K"))
	DriveL = val(RegGetValue(DriveNotes, "L"))
	DriveM = val(RegGetValue(DriveNotes, "M"))
	DriveN = val(RegGetValue(DriveNotes, "N"))
	DriveO = val(RegGetValue(DriveNotes, "O"))
	DriveP = val(RegGetValue(DriveNotes, "P"))
	DriveQ = val(RegGetValue(DriveNotes, "Q"))
	DriveR = val(RegGetValue(DriveNotes, "R"))
	DriveS = val(RegGetValue(DriveNotes, "S"))
	DriveT = val(RegGetValue(DriveNotes, "T"))
	DriveU = val(RegGetValue(DriveNotes, "U"))
	DriveV = val(RegGetValue(DriveNotes, "V"))
	DriveW = val(RegGetValue(DriveNotes, "W"))
	DriveX = val(RegGetValue(DriveNotes, "X"))
	DriveY = val(RegGetValue(DriveNotes, "Y"))
	DriveZ = val(RegGetValue(DriveNotes, "Z"))
return
endsub

sub LabelDrives()
	ALabel = RegGetValue(DriveNames,"A")
	BLabel = RegGetValue(DriveNames,"B")
	CLabel = RegGetValue(DriveNames,"C")
	DLabel = RegGetValue(DriveNames,"D")
	ELabel = RegGetValue(DriveNames,"E")
	FLabel = RegGetValue(DriveNames,"F")
	GLabel = RegGetValue(DriveNames,"G")
	HLabel = RegGetValue(DriveNames,"H")
	ILabel = RegGetValue(DriveNames,"I")
	JLabel = RegGetValue(DriveNames,"J")
	KLabel = RegGetValue(DriveNames,"K")
	LLabel = RegGetValue(DriveNames,"L")
	MLabel = RegGetValue(DriveNames,"M")
	NLabel = RegGetValue(DriveNames,"N")
	OLabel = RegGetValue(DriveNames,"O")
	PLabel = RegGetValue(DriveNames,"P")
	QLabel = RegGetValue(DriveNames,"Q")
	RLabel = RegGetValue(DriveNames,"R")
	SLabel = RegGetValue(DriveNames,"S")
	TLabel = RegGetValue(DriveNames,"T")
	ULabel = RegGetValue(DriveNames,"U")
	VLabel = RegGetValue(DriveNames,"V")
	WLabel = RegGetValue(DriveNames,"W")
	XLabel = RegGetValue(DriveNames,"X")
	YLabel = RegGetValue(DriveNames,"Y")
	ZLabel = RegGetValue(DriveNames,"Z")
return
endsub

sub DisplayDriveState()
	if DriveA = 1
		setcontroltext(win,Check3,"Show Drive (A) "+ALabel)
	endif

	if DriveB = 1
		setcontroltext(win,Check3,"Show Drive (B) "+BLabel)
	endif

	if DriveC = 1
		setcontroltext(win,Check3,"Show Drive (C) "+CLabel)
	endif

	if DriveD = 1
		setcontroltext(win,Check4,"Show Drive (D) "+DLabel)
	endif

	if DriveE = 1
		setcontroltext(win,Check5,"Show Drive (E) "+ELabel)
	endif

	if DriveF = 1
		setcontroltext(win,Check6,"Show Drive (F) "+FLabel)
	endif

	if DriveG = 1
		setcontroltext(win,Check7,"Show Drive (G) "+GLabel)
	endif

	if DriveH = 1
		setcontroltext(win,Check8,"Show Drive (H) "+HLabel)
	endif

	if DriveI = 1
		setcontroltext(win,Check9,"Show Drive (I) "+ILabel)
	endif

	if DriveJ = 1
		setcontroltext(win,Check10,"Show Drive (J) "+JLabel)
	endif

	if DriveK = 1
		setcontroltext(win,Check11,"Show Drive (K) "+KLabel)
	endif

	if DriveL = 1
		setcontroltext(win,Check12,"Show Drive (L) "+LLabel)
	endif

	if DriveM = 1
		setcontroltext(win,Check13,"Show Drive (M) "+MLabel)
	endif

	if DriveN = 1
		setcontroltext(win,Check14,"Show Drive (N) "+NLabel)
	endif

	if DriveO = 1
		setcontroltext(win,Check15,"Show Drive (O) "+OLabel)
	endif

	if DriveP = 1
		setcontroltext(win,Check16,"Show Drive (P) "+PLabel)
	endif

	if DriveQ = 1
		setcontroltext(win,Check17,"Show Drive (Q) "+QLabel)
	endif

	if DriveR = 1
		setcontroltext(win,Check18,"Show Drive (R) "+RLabel)
	endif

	if DriveS = 1
		setcontroltext(win,Check19,"Show Drive (S) "+SLabel)
	endif

	if DriveT = 1
		setcontroltext(win,Check20,"Show Drive (T) "+TLabel)
	endif

	if DriveU = 1
		setcontroltext(win,Check21,"Show Drive (U) "+ULabel)
	endif

	if DriveV = 1
		setcontroltext(win,Check22,"Show Drive (V) "+VLabel)
	endif

	if DriveW = 1
		setcontroltext(win,Check23,"Show Drive (W) "+WLabel)
	endif

	if DriveX = 1
		setcontroltext(win,Check24,"Show Drive (X) "+XLabel)
	endif

	if DriveY = 1
		setcontroltext(win,Check25,"Show Drive (Y) "+YLabel)
	endif

	if DriveZ = 1
		setcontroltext(win,Check26,"Show Drive (Z) "+ZLabel)
endif

return
endsub

sub NowSelectDrives()
'===============================
' Open a window and let's begin.
'===============================

OpenWindow win,0,0,900,590,@SIZE|@MINBOX|@MAXBOX|@CAPTION|@SYSMENU,0,"Show / Hide Drives for " + UsersName[Selected],&win_handler
'Left hand side of screen
CONTROL win,@CHECKBOX,"Hide Drive (A) "+ALabel,29,76,345,25,0, Check1
CONTROL win,@CHECKBOX,"Hide Drive (B) "+BLabel,29,108,345,25,0,Check2
CONTROL win,@CHECKBOX,"Hide Drive (C) "+Clabel,29,140,345,25,0,Check3
CONTROL win,@CHECKBOX,"Hide Drive (D) "+DLabel,29,172,345,25,0,Check4
CONTROL win,@CHECKBOX,"Hide Drive (E) "+ELabel,29,205,345,25,0,Check5
CONTROL win,@CHECKBOX,"Hide Drive (F) "+FLabel,29,236,345,25,0,Check6
CONTROL win,@CHECKBOX,"Hide Drive (G) "+GLabel,29,268,345,25,0,Check7
CONTROL win,@CHECKBOX,"Hide Drive (H) "+HLabel,29,298,345,25,0,Check8
CONTROL win,@CHECKBOX,"Hide Drive (I) "+ILabel,29,329,345,25,0,Check9
CONTROL win,@CHECKBOX,"Hide Drive (J) "+JLabel,29,358,345,25,0,Check10
CONTROL win,@CHECKBOX,"Hide Drive (K) "+KLabel,29,388,345,25,0,Check11
CONTROL win,@CHECKBOX,"Hide Drive (L) "+LLAbel,28,417,345,25,0,Check12
CONTROL win,@CHECKBOX,"Hide Drive (M) "+MLabel,29,446,345,25,0,Check13

'Right hand side of the screen
CONTROL win,@CHECKBOX,"Hide Drive (N) "+NLabel,450,76,345,25,0, Check14
CONTROL win,@CHECKBOX,"Hide Drive (O) "+OLabel,450,108,345,25,0,Check15
CONTROL win,@CHECKBOX,"Hide Drive (P) "+PLabel,450,140,344,25,0,Check16
CONTROL win,@CHECKBOX,"Hide Drive (Q) "+QLabel,450,172,346,25,0,Check17
CONTROL win,@CHECKBOX,"Hide Drive (R) "+RLabel,450,205,347,25,0,Check18
CONTROL win,@CHECKBOX,"Hide Drive (S) "+SLabel,450,236,347,25,0,Check19
CONTROL win,@CHECKBOX,"Hide Drive (T) "+TLabel,450,268,348,25,0,Check20
CONTROL win,@CHECKBOX,"Hide Drive (U) "+ULabel,450,298,347,25,0,Check21
CONTROL win,@CHECKBOX,"Hide Drive (V) "+VLabel,450,329,347,25,0,Check22
CONTROL win,@CHECKBOX,"Hide Drive (W) "+WLabel,450,358,346,25,0,Check23
CONTROL win,@CHECKBOX,"Hide Drive (X) "+XLabel,450,388,347,25,0,Check24
CONTROL win,@CHECKBOX,"Hide Drive (Y) "+YLabel,450,417,348,25,0,Check25
CONTROL win,@CHECKBOX,"Hide Drive (Z) "+ZLabel,450,446,348,25,0,Check26

CONTROL win,@BUTTON,"Select Different User",28,30,260,25,0,BUTTON_5
CONTROL win,@BUTTON,"Apply",28,500,100,25,0,BUTTON_1
CONTROL win,@BUTTON,"Select All Unused Drives",200,500,260,25,0,BUTTON_4
CONTROL win,@BUTTON,"Show All Drives",500,500,260,25,0,BUTTON_2
CONTROL win,@BUTTON,"Quit",790,500,80,25,0,BUTTON_3

DisplayDriveState()

for x = 1 to 26
    SETFONT win,"Arial",12,500,0,x
    SETCONTROLCOLOR win,x,RGB(0,0,0),rgb(255,255,255)
next x

SETFONT win,"Arial",12,500,0,BUTTON_1
SETFONT win,"Arial",12,500,0,BUTTON_2
SETFONT win,"Arial",12,500,0,BUTTON_3
SETFONT win,"Arial",12,500,0,BUTTON_4
SETFONT win,"Arial",12,500,0,BUTTON_5

WAITUNTIL ISWINDOWCLOSED(win)
return
endsub

