Special Folders 

Content / madShell /...
www.madshi.net

In Windows there are several folders/objects, which have a special meaning. Some of these objects have a real file system path, e.g. the "Program Files" folder or the "Fonts" folder. Others do not belong to any file system, nevertheless they can be browsed in the Windows Explorer, e.g. the "My Computer" object or the "Control Panel".

The most important special folders/objects are listed in the following enumeration type:

type
  TSpecialFolder = (
    // objects, no file system path available
    sfDesktopObj,          // desktop object
    sfMyComputer,          // my computer
    sfNetworkObj,          // My Network Places object
    sfRecycleBin,          // recycle bin
    sfControlPanel,        // control panel
    sfPrintersObj,         // printers
    sfDialupNetwork,       // network and dialup connections
    sfMyDocumentsObj,      // my documents object
    sfIEObj,               // internet explorer object
    sfComputersNearMe,     // computers near me (workgroup)

    // system directories, user independent
    sfWindows,             // windows folder
    sfSystem,              // system(32) folder
    sfSystemX86,           // RISC: x86 system directory
    sfFonts,               // fonts
    sfResources,           // resource directory
    sfLocalizedResources,  // localized resource directory
    sfProgramFiles,        // program files
    sfProgramFilesX86,     // RISC: x86 program files directory
    sfCommonFiles,         // program files \ common
    sfCommonFilesX86,      // RISC: x86 program files \ common folder
    sfTemp,                // windows temp folder
    sfProfiles,            // root directory of all user profiles

    // directories of the current user
    sfMyProfile,           // \ .
    sfDesktopDir,          // \ desktop
    sfStartMenu,           // \ start menu
    sfPrograms,            // \ start menu \ programs
    sfStartup,             // \ start menu \ programs \ startup
    sfAltStartup,          // \ non localized startup
    sfMyDocumentsDir,      // \ my documents
    sfMyMusic,             // \ my music
    sfMyPictures,          // \ my pictures
    sfMyVideo,             // \ my video
    sfTemplates,           // \ templates
    sfFavorites,           // \ favorites
    sfIECache,             // \ ie cache folder
    sfIECookies,           // \ ie cookie folder
    sfIEHistory,           // \ ie history folder
    sfRecent,              // \ recent
    sfSendTo,              // \ sendto
    sfAppData,             // \ application data
    sfLocalSettings,       // \ local settings \ .
    sfLocalAppData,        // \ local settings \ application data
    sfCdBurning,           // \ local settings \ application data \ microsoft \ cd burning
    sfPrintersDir,         // \ printhood
    sfNetworkDir,          // \ nethood
    sfAdminTools,          // \ administrative tools

    // directories of all users
    sfAllUsersProfile,     // all users \ .
    sfAllUsersDesktopDir,  // all users \ desktop
    sfAllUsersStartMenu,   // all users \ start menu
    sfAllUsersPrograms,    // all users \ start menu \ programs
    sfAllUsersStartup,     // all users \ start menu \ programs \ startup
    sfAllUsersAltStartup,  // all users \ non localized startup
    sfAllUsersDocuments,   // all users \ documents
    sfAllUsersMusic,       // all users \ music
    sfAllUsersPictures,    // all users \ pictures
    sfAllUsersVideo,       // all users \ video
    sfAllUsersTemplates,   // all users \ templates
    sfAllUsersFavorites,   // all users \ favorites
    sfAllUsersAppData,     // all users \ application data
    sfAllUsersAdminTools,  // all users \ administrative tools
    sfAllUsersOemLinks     // all users \ links to OEM specific apps
  );

The function "GetSpecialFolder" returns the path of the specified special folder. You should call it only for file system folders:

function GetSpecialFolder (sf: TSpecialFolder; out path: string) : boolean;

// Examples:
GetSpecialFolder(sfProgramFiles)  ->  'C:\Program Files'
GetSpecialFolder(sfSendTo      )  ->  'C:\Profiles\CurrentUser\SendTo'

The following 2 functions return the path of the "Windows" and of the "System" folder:

function WinFolder : string;  // e.g. "C:\Windows"        or "C:\WinNT"
function SysFolder : string;  // e.g. "C:\Windows\System" or "C:\WinNT\System32"