Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/articles/mfc-tutorials/)
-   -   Registry System utility (http://www.go4expert.com/articles/registry-system-utility-t180/)

alok 27Sep2004 12:07

Registry System utility
 
1 Attachment(s)
Here,It my another Project, System Utility ver 1.0. let me explain it's functionality
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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\Explorer

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\Explorer

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 its Key is

HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\System

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\Explorer

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\Explorer

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\Explorer

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\Explorer

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\Explorer

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\System

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\System

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\Explorer

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\Explorer

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\System.

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\System

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\System

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\System

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_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\System

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 ->
Code: CPP

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.
Note-> The Attach Ment Includes The Application EXE

alok 27Sep2004 12:10

Re: My Project: System utility
 
2 Attachment(s)
--->Adding Rest OF Source CODE

shabbir 27Sep2004 12:17

Re: My Project: System utility
 
Nice explanation and will get into code when I get some time.

Thanks
Shabbir Bhimani

alok 27Sep2004 12:47

Re: My Project: System utility
 
My Pleasure,
thanks,i think i am improving on language Fronts :d

ranjithsubra 17Apr2007 00:08

Re: My Project: System utility
 
Quote:

Originally Posted by alok
My Pleasure,
thanks,i think i am improving on language Fronts :d

Hi,

Can u tell me How to Disable the Windows Help On Windows 2000 using Registery.
REGARDS
Ranjith Kumar.S

kchenthilk 21Jul2007 23:58

Re: Registry System utility
 
Hi,

Thank u for Using the way for Registery programming


Thanks&regards
Chenthil.k

Bhullarz 25Sep2007 22:28

Re: Registry System utility
 
attached EXE file doesn't seem to be working. Has anyone tried this thing?

shabbir 26Sep2007 09:05

Re: Registry System utility
 
Quote:

Originally Posted by Bhullarz
attached EXE file doesn't seem to be working. Has anyone tried this thing?

What does it says.

UFUKK 8Jan2008 18:40

Re: Registry System utility
 
hi mr shabbir..

I should learn immediately, how to assign a value as a member from RegisteryKeyValue class

the codes are below:

RegistryValueKind REG_BINARY = RegistryValueKind.Binary;

const double deger = 000000000000000000000000000000000000000000000000;

key = Registry.LocalMachine.CreateSubKey(@"System\Curren tControlSet\Control\KeyBoard Layout");
key.SetValue("XXX", deger, REG_BINARY);

COMPİLER THROWS AN ARGUMENTEXCEPTİON AS "deger and REG_BINARY types do not be converted properly"

HOW CAN I GET OVER THE PROBLEM???

parvez.yu 6Mar2008 14:46

Re: Registry System utility
 
nice explanation


All times are GMT +5.5. The time now is 04:29.