Registry System utility

Discussion in 'MFC' started by alok, Sep 27, 2004.

  1. alok

    alok New Member

    Joined:
    Jul 24, 2004
    Messages:
    127
    Likes Received:
    2
    Trophy Points:
    0
    Occupation:
    S/W Engg
    Home Page:
    http://www.thatsalok.com
    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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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\CurrentVersion\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:
    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
     

    Attached Files:

  2. alok

    alok New Member

    Joined:
    Jul 24, 2004
    Messages:
    127
    Likes Received:
    2
    Trophy Points:
    0
    Occupation:
    S/W Engg
    Home Page:
    http://www.thatsalok.com
    Re: My Project: System utility

    --->Adding Rest OF Source CODE
     

    Attached Files:

  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Re: My Project: System utility

    Nice explanation and will get into code when I get some time.

    Thanks
    Shabbir Bhimani
     
  4. alok

    alok New Member

    Joined:
    Jul 24, 2004
    Messages:
    127
    Likes Received:
    2
    Trophy Points:
    0
    Occupation:
    S/W Engg
    Home Page:
    http://www.thatsalok.com
    Re: My Project: System utility

    My Pleasure,
    thanks,i think i am improving on language Fronts :d
     
  5. ranjithsubra

    ranjithsubra New Member

    Joined:
    Mar 9, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Re: My Project: System utility

    Hi,

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

    kchenthilk New Member

    Joined:
    Jul 17, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    Thank u for Using the way for Registery programming


    Thanks&regards
    Chenthil.k
     
  7. Bhullarz

    Bhullarz New Member

    Joined:
    Nov 15, 2006
    Messages:
    253
    Likes Received:
    13
    Trophy Points:
    0
    Occupation:
    System Manager
    Home Page:
    http://www.tutors161.com
    attached EXE file doesn't seem to be working. Has anyone tried this thing?
     
  8. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    What does it says.
     
  9. UFUKK

    UFUKK New Member

    Joined:
    Jan 8, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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\CurrentControlSet\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???
     
  10. parvez.yu

    parvez.yu New Member

    Joined:
    Feb 14, 2008
    Messages:
    100
    Likes Received:
    0
    Trophy Points:
    0
    nice explanation
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice