Basically this whole program depends on the registry. The registry in Windows holds the key to each and every aspects of the Windows Operating System, but only if you find them in registry and use them.
Now , let us see how to manually Disable and Enable the drives using the keys in the Registry.
1.Disable/Enable Drives:
The key for the Number of drives in the registry is available at,
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer
The value ‘NoDrives’ :The value of this data will depend on the no of drives in your system.
Let us take an example. If you system contain A: C: D: drives, and you want to disable C drive the entry in registry would be 2 int(65-‘C’) , and if you want to disable A: and D: the registry value is 2((65-int(‘A’))+(65-int(‘d’))).This is a little complicated. The DLL, I use contains the wrapper for this , so just use them.
2.Disable Control panel:
The Key Holding data to Show or Hide Control Panel is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer
and Value Name is “NoControlPanel” if it value is 0 you can see Control Panel and if 1 you can’t see control panel.
3. Disable Change Password:
This option you are going to see when u press (CTRL+ALT+DEL) in WIN2000 and above and it Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem
and Value Name is “DisableChangePassword” if its value is 0 you can see Change Password Option Enabled and if 1 ChangePassword Option is disabled.
4.Disable Search:
This option you are going to see in Start menu and it Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer and Value Name is “NoFind” if its value is 0 you can see this Option Enabled and if 1 you can’t see that option.
5.Disable RUN:
This option is available in Start menu and it Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer and Value Name is “NoRun” if its value is 0 you can see this Option Enabled and if 1 you will not be able to see this Windows’ Run program option.
6.Disable ShutDown:
This option is available in Start menu and it Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer and Value Name is “NoClose” if its value is 0 you can see this Option Enabled and if 1 you can’t see that option.
7.Disable NetworkAccess:
This option is available on the Desktop and it Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer and Value Name is “NoNetHood” if its value is 0 you can see this Network Neighborhood icon and if 1 it will be invisible.
8.Disable TaskBar Setting:
This option you are going to see at Desktop and it Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer and Value Name is “NoSetTaskBar” if its value is 0 you can see this Option Enabled and if 1 you can’t see that option.
9.Disable RegEdit:
This is Registry Editor tool HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem and Value Name is “DisableRegistryTools” if it value is 0 you can see this Option Enabled and if 1 you can’t see that option.
10.Disable TaskManager:
This option you are going to see usually in windows 2000 and above when you press (CTRL+ALT_DEL), its Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem and Value Name is “DisableTaskMgr” if its value is 0 you can see this Option Enabled and if 1 you can’t see that option.
11.Disable Context Menu:
This option you are going to see is accessible by a Right click on DESKTOP. This is what is known as Context menu and it Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer and Value Name is “NoViewContextMenu” if its value is 0 you can see?this context menu and if 1 you can’t see that option.
12. Disable Desktop icon:
This option applies all the icon present on desktop ,it key is HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer and Value Name is “NoDesktop” if its value is 0 you can see?this icons and if 1 all icons will be invisible.
13.Disable Display Properties:
This option you are going to see is accessible by a Right click on DESKTOP and click on Properties menu item and it Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem. The Value Name is “NoDispCPL” if its value is 0 you can see?this Option Enabled and if 1 you can’t see that option.
14.Disable Background Tab:
This option you are going to see in Display Control Panel and it Key is HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem and Value Name is “NoDispBackgroundPage” if its value is 0 you can see?this Option Enabled and if 1 you can’t see that option.
15.Disable ScreenSaver Tab:
This option you are going to see In Display Control Panel and it Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem and Value Name is “NoDispScrSavPage” if its value is 0 you can see?this Option Enabled and if 1 you can’t see that option.
16.Disable Setting And Plus Tab:
This option you are going to see In Display Control Panel and it Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem and Value Name is “NoDispSettingsPage” if its value is 0 you can see?this Option Enabled and if 1 you can’t see that option.
17.Disable Appearance Tab:
This option you are going to see In Display Contral Panel and it Key is
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesSystem and Value Name is “NoDispAppearancePage” if its value is 0 you can see?this Option Enabled and if 1 you can’t see that option.
I think I have explained all the functionalities of the program. Remember one thing. Some of these options show effect only when the computer is restarted.
Using this Program:
- Just Check on the Restriction you want to apply and click apply, the restriction are applied.
- Remember most of restriction after applying and disapplying need Restarting of your computer ok.
Registry Class – CNMPDrivesClass
The Declaration of the Class is this ->
class AFX_EXT_CLASS CNMPDrivesClass { CString NMPChangeToBinary(DWORD dwVar); public: void SendTypeOFDrives(CUIntArray &Stat); void SendStatusOFDrives(CUIntArray &stat); BOOL GetDrivesVolume(CStringArray &VolumeName,CDWordArray SerialNumber,CStringArray &FileSystem); void NMPReturnNoOfDrives(CUIntArray &NoOfDrives); void NMPDisableLocalDrives(CUIntArray &a); CRegKey m_LocalKey; CNMPDrivesClass(); CNMPDrivesClass(CString SID); CNMPDrivesClass(BOOL bUser); virtual ~CNMPDrivesClass(); private: CRegKey f; };
Now let me explain working of each function
1. void SendTypeOFDrives(CUIntArray &Stat);
This function fills the Types of Drives Present in the computer into an array of type CUIntArray. The values are filled according to Drives like If your computer has (A: C: D: E:),
in the alphabetical order.
Array [0]:A: information
Array [1]:C: information
Array [2]:D: information
Array [3]:E: information
Meaning of Values in the CUIntArray:
- 0 stand for
Floppy Drive - 1 stand for
Hard Disk - 2 stand for
CDRom - 3 stand for
RAMDISK - 4 for
network Drives - 5 for
Unknown or Can’t be retrieve
2.void SendStatusOFDrives(CUIntArray &stat);
This function will tell status of drives either it Enabled or disabled. This argument contains the Drives Int, which are disabled eg int(65) stand for A, int (66) for B and so on.
Now let me explain this with small Example
Assume that the Computer had A:,C:,D:,E: Drives and C: and D: are disabled.
The size of returning Array Stat will be 2 and the values will be filled as follows.
Stat[0]=C
&Stat[1]=D
3. BOOL GetDrivesVolume(CStringArray &VolumeName,CDWordArray SerialNumber,CStringArray &FileSystem);
This function contains the information about Volume Name, Serial Number And File System of drives, and it Sequence is same as above.
Like if your computer has (A: C: D: E:)
Array [0]:A: information
Array [1]:C: information
Array [2]:D: information
Array [3]:E: information
4.void NMPReturnNoOfDrives(CUIntArray &NoOfDrives);
This function returns the number of drives the local system contain, but it will return Integer equivalent of character.
eg If your computer has (A: C: D: E:)
Array [0]:65
ie A (According to ASCII Character SET)
Array [1]:67 ie C
(According to ASCII Character SET)
Array [2]:68
ie D (According to ASCII Character SET)
Array [3]:69:ie E
(According to ASCII Character SET)
5. void NMPDisableLocalDrives(CUIntArray &a);
This function will Disable the local drives in the computer, but remember it erases the previous values before writing to it.
Now if you want to disable A: and C:, just ADD to a.Add(A),a.Add(C) (Because a is Array Class) and call the function.
NMPDisableLocalDrives(a);
And Voila after Restart the A: & C: are not Visible on Explorer.
Download the sample project here.