Sunday, May 3, 2009

Make undeletable custom folders in Windows

Have you ever wanted to make a custom folder like My Computer and My documents, that can not be deleted nor can it be renamed other than removing the CLSID and the entries under namespace. You can easily create these type of files and place it in My Computer or Windows Desktop. To do so, go through this :-
Create the following series of keys and values in the Windows registry at 

Quote:HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID 

Create a new key called: HKEY_CLASSES_ROOT\CLSID\{FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345} and set it Default to equal the name of the folder e.g. “My Folder”.

Create a new sub-key under the main key called "InProcServer32" (i.e. [HKEY_CLASSES...ABCD1DE12345}\InProcServer32]) and set (Default) to equal "shell32.dll", also create a new String value called "ThreadingModel" and set it to "Apartment".

Now create a set of sub-keys starting at the main key “Shell\Open My Menu\Command” (i.e.[HKEY_CLASSES...ABCD1DE12345}\Shell\Open My Folder\Command]) and set (Default) to equal the command to execute when clicked, in this case explorer, e.g. “explorer /root,c:\MyFolder”.

Create a set of sub-keys starting at the main key "ShellExPropertySheetHandlers{FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345}" (i.e. [HKEY_CLASSES...ABCD1DE12345}ShellExPropertySheetHa ndlers{FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345}])

Create a new sub-key under the main key called “ShellFolder” (i.e. [HKEY_CLASSES...ABCD1DE12345}\ShellFolder]) and create a new Binary value called “Attributes” and set it to “00 00 00 00″.

To place the folder (which is now a system folder) on the desktop add the following key: 
[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentV ersion 
ExplorerDesktopNameSpace{FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345}] 

To also place it in My Computer create this key: 
[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentV ersion 
ExplorerMyComputerNameSpace{FD4DF9E0-E3DE-11CE-BFCF-ABCD1DE12345}]

Thats it.

No comments:

Post a Comment