Microsoft Windows Registry Guide, Second Edition

My Computer

Use the My Computer category to determine which icons you see in My Computer. Table 5-19 describes the settings you must apply to show the Control Panel and Files Stored On This Computer icons in My Computer.

Table 5-19 Values in the My Computer Category

Setting

Name

Type

Data

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideMyComputerIcons

Control Panel

{21EC2020-3AEA-1069-A2DD-08002B30309D}

REG_DWORD

0x00 | 0x01

HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

Files Stored On This Computer

NoSharedDocuments

REG_DWORD

0x00 | 0x01

Drives

Windows can hide drive letters. You hide them by setting NoDrives in the key HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer, but it's easier using the Tweak UI category Drives. The trick is figuring out the value to put in the REG_BINARY value NoDrives.

Each bit in NoDrives, right to left, corresponds to the drive letters A through Z. To hide drive A, turn on the first bit. To hide drive B, turn on the second bit. Turn on the bit representing each drive that you want to hide. This math is easier if you use Calculator in scientific view. Also, see Chapter 1, “Learning the Basics,” for some tips on doing bitwise math.

NOTE

Hiding drive letters in Windows doesn't prevent users from accessing those drives through other means, including a command prompt window. This setting hides only those drives in Windows Explorer, the common dialog boxes, and Windows applications. Thus, you can't rely on this as a security measure.

Special Folders

Windows users have special folders, such as the My Documents, My Pictures, and Favorites folders, in their user profiles. The default location for these folders is in %UserProfile%, but you can redirect them to any location, including a location on the network. That's the purpose of the Tweak UI category Special Folders.

The key where you find each of these special folders is HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders. You learn about them in detail in Chapter 4, “Hacking the Registry,” and in Appendix C, “Per-User Settings.” In Table 5-20, look up the folder you want to redirect. Then in User Shell Folders, change the value shown in the Folder drop-down list to the folder's new location. I suggest that you use environment variables, particularly when referencing folders in %UserProfile% or %SystemRoot%. The next time you log on to Windows, Windows updates HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\ to reflect your changes. After relocating a shell folder, you must manually move your files and folders from the old location to the new location.

TIP

I always relocate the My Documents, My Pictures, and Favorites folders to a network location. Doing so ensures that I always have access to my documents and Internet shortcuts from any computer on the network. I use Group Policy to automatically redirect the My Documents and My Pictures folders so I don't have to think about it. I use a script to relocate the Favorites folder on each computer that I use, however, because Group Policy doesn't support redirecting Favorites folders. Using a script makes redirecting Favorites easy, but still not automatic.

Table 5-20 Values in the Special Folders Category

Folder

Value

Default Path

CD Burning

CD Burning

%UserProfile%\LocalSettings\Application Data\Microsoft\CD Burning

Desktop

Desktop

%UserProfile%\Desktop

Document templates

Templates

%UserProfile%\Templates

Favorites

Favorites

%UserProfile%\Favorites

My Documents

Personal

%UserProfile%\MyDocuments

Programs

Programs

%UserProfile%\StartMenu\Programs

Send To

SendTo

%UserProfile%\SendTo

Start Menu

Start Menu

%UserProfile%\StartMenu

Startup

Startup

%UserProfile%\StartMenu\Programs\Startup

The value for the Installation Path setting is not in HKCU. It's the REG_SZ value SourcePath in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup. Likewise, the values for the Shared Music, Shared Pictures, and Shared Video folders are in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders. They are the REG_SZ values CommonMusic, CommonPictures, and CommonVideo, respectively.

AutoPlay

All the action in the AutoPlay category is in its subcategories: Drives, Types, and Handlers. In the Drives category, you can prevent specific drives from playing media automatically when you insert them. You use the value NoDriveAutoRun, which is a REG_BINARY value, just like the NoDrives value you learned about earlier. For each drive that you want to stop from playing media automatically, set the bit, right to left, which corresponds to the drive letters A through Z. NoDriveAutoRun is in the key HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer.

The next subcategory is Types, which controls Autoplay for specific types of media. In this category, you can control whether CDs, DVDs, and removable drives automatically play when you insert disks. Table 5-21 describes the values that correlate to the settings you see in this category. Just like you did with the value UserPreferencesMask, you must toggle the bit shown in the Data column. To prevent CD drives from automatically playing, for example, set bit 0x20 in the REG_DWORD value NoDriveTypeAutoRun.

Table 5-21 Values in Autoplay Drive Types

Setting

Name

Type

Data

HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

Enable Autoplay for CD and DVD drives

NoDriveTypeAutoRun

REG_DWORD

Bit 0x20

Enable Autoplay for removable drives

NoDriveTypeAutoRun

REG_DWORD

Bit 0x04

The last subcategory is Handlers. When Windows detects that you've inserted a CD, DVD, or removable disk, it automatically runs the program that it associates with the type of content on that disk. You use the Autoplay Handlers list to control which programs are used with different types of content. This setting is much easier to configure in Tweak UI than manually, but we'll try it, anyway.

The key where you find these associations is HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers. In Table 5-22, look up the type of content you want to customize. Then open the subkey shown in the Subkey column for EventHandlers. In that subkey, add any combination of the following handlers as an empty REG_SZ value, if they don't already exist:

Table 5-22 Values in Autoplay Handlers

Media

Subkey

Media

Subkey

Generic

GenericVolumeArrival

Music files

PlayMusicFilesOnArrival

Blank CD-R

HandleCDBurningOnArrival

Video files

PlayVideoFilesOnArrival

Mixed content

MixedContentOnArrival

Digital images

ShowPicturesOnArrival

CD audio

PlayCDAudioOnArrival

Video camera

VideoCameraArrival

DVD

PlayDVDMovieOnArrival

Drive Letters

The Drive Letters category allows you to configure how Windows Explorer displays drive letters in relation to the volume label. Set the REG_DWORD value ShowDriveLettersFirst in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer to one of the following values:

Категории