Want to ensure that this works across all platforms, all I got to test with is w2k platforms:
Simple test code, the function it calls just returns the %ID and the commentary from the left side of the definitions from the wind32api file:
And on my machine here, this returns:
Notation: Yes, on this machine, my Documents & Settings has been hashed to point to another hard drive, this was done when installing windows, before creating any user accounts, by editing the value at:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
ProfilesDirectory = VALUE
Then copying ALL USERS and DEFAULT USER to the drive.
There might of been more involved stuff in whacking the registry, don't remember, it's been years since I've needed to install w2k on a machine.
Shouldn't bother going off on a tangent about that, now everyone will start discussing different means to do that, ...
Code:
FUNCTION GetSpecialFolderPath(hWindow AS DWORD, nFolder AS LONG) AS STRING LOCAL pidl AS LONG LOCAL SpecialPath AS ASCIIZ * %MAX_PATH ON ERROR GOTO NotExported SHGetSpecialFolderPath hWindow, SpecialPath, nFolder, 0 IF INSTR(SpecialPath, $NUL) > 1 THEN GetSpecialFolderPath = SpecialPath #DEBUG PRINT "SHGetSpecialFolderPath Success" EXIT FUNCTION END IF NotExported: IF SHGetSpecialFolderLocation(hWindow, nFolder, pidl) = %NOERROR THEN IF pidl THEN #DEBUG PRINT "SHGetSpecialFolderLocation Success" IF SHGetPathFromIDList(BYVAL pidl, SpecialPath) THEN GetSpecialFolderPath = SpecialPath #DEBUG PRINT "SHGetPathFromIDList Success" END IF CoTaskMemFree pidl EXIT FUNCTION END IF END IF #DEBUG PRINT "GetSpecialFolderPath Failure" END FUNCTION
Code:
LOCAL sFolder AS STRING, sIndex AS LONG FOR sIndex = %CSIDL_DESKTOP TO %CSIDL_RESOURCES sFolder = GetSpecialFolderPath(CB.HNDL, sIndex) #DEBUG PRINT HEX$(sIndex, 2) &" / "& GetFolderAlias(sIndex) #DEBUG PRINT " = "& sFolder #DEBUG PRINT "" NEXT sIndex
Code:
SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 00 / %CSIDL_DESKTOP ' <desktop> = F:\mug\Desktop SHGetSpecialFolderLocation Success 01 / %CSIDL_INTERNET ' Internet Explorer (icon on desktop) = SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 02 / %CSIDL_PROGRAMS ' Start Menu\Programs = F:\mug\Start Menu\Programs SHGetSpecialFolderLocation Success 03 / %CSIDL_CONTROLS ' My Computer\Control Panel = SHGetSpecialFolderLocation Success 04 / %CSIDL_PRINTERS ' My Computer\Printers = SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 05 / %CSIDL_PERSONAL ' My Documents = F:\mug\My Documents SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 06 / %CSIDL_FAVORITES ' <user name>\Favorites = F:\mug\Favorites SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 07 / %CSIDL_STARTUP ' Start Menu\Programs\Startup = F:\mug\Start Menu\Programs\Startup SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 08 / %CSIDL_RECENT ' <user name>\Recent = F:\mug\Recent SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 09 / %CSIDL_SENDTO ' <user name>\SendTo = F:\mug\SendTo SHGetSpecialFolderLocation Success 0A / %CSIDL_BITBUCKET ' <desktop>\Recycle Bin = SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 0B / %CSIDL_STARTMENU ' <user name>\Start Menu = F:\mug\Start Menu GetSpecialFolderPath Failure 0C / %CSIDL_MYDOCUMENTS logical 'My Documents' desktop icon = GetSpecialFolderPath Failure 0D / %CSIDL_MYMUSIC 'My Music' folder = GetSpecialFolderPath Failure 0E / %CSIDL_MYVIDEO 'My Videos' folder = GetSpecialFolderPath Failure 0F / = SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 10 / %CSIDL_DESKTOPDIRECTORY ' <user name>\Desktop = F:\mug\Desktop SHGetSpecialFolderLocation Success 11 / %CSIDL_DRIVES ' My Computer = SHGetSpecialFolderLocation Success 12 / %CSIDL_NETWORK ' Network Neighborhood = SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 13 / %CSIDL_NETHOOD ' <user name>\nethood = F:\mug\NetHood SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 14 / %CSIDL_FONTS ' windows\fonts = C:\winnt\Fonts SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 15 / %CSIDL_TEMPLATES = F:\mug\Templates SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 16 / %CSIDL_COMMON_STARTMENU ' All Users\Start Menu = F:\All Users\Start Menu SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 17 / %CSIDL_COMMON_PROGRAMS ' All Users\Programs = F:\All Users\Start Menu\Programs SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 18 / %CSIDL_COMMON_STARTUP ' All Users\Startup = F:\All Users\Start Menu\Programs\Startup SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 19 / %CSIDL_COMMON_DESKTOPDIRECTORY ' All Users\Desktop = F:\All Users\Desktop SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 1A / %CSIDL_APPDATA ' <user name>\Application Data = F:\mug\Application Data SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 1B / %CSIDL_PRINTHOOD ' <user name>\PrintHood = F:\mug\PrintHood SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 1C / %CSIDL_LOCAL_APPDATA ' <user name>\Local Settings\Application Data (non roaming) = F:\mug\Local Settings\Application Data GetSpecialFolderPath Failure 1D / %CSIDL_ALTSTARTUP ' non localized startup = GetSpecialFolderPath Failure 1E / %CSIDL_COMMON_ALTSTARTUP ' non localized common startup = SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 1F / %CSIDL_COMMON_FAVORITES = F:\All Users\Favorites SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 20 / %CSIDL_INTERNET_CACHE = F:\mug\Local Settings\Temporary Internet Files SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 21 / %CSIDL_COOKIES = F:\mug\Cookies SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 22 / %CSIDL_HISTORY = F:\mug\Local Settings\History SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 23 / %CSIDL_COMMON_APPDATA ' All Users\Application Data = F:\All Users\Application Data SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 24 / %CSIDL_WINDOWS ' GetWindowsDirectory() = C:\winnt SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 25 / %CSIDL_SYSTEM ' GetSystemDirectory() = C:\winnt\system32 SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 26 / %CSIDL_PROGRAM_FILES ' C:\Program Files = C:\Program Files SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 27 / %CSIDL_MYPICTURES ' C:\Program Files\My Pictures = F:\mug\My Documents\My Pictures SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 28 / %CSIDL_PROFILE ' USERPROFILE = F:\mug SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 29 / %CSIDL_SYSTEMX86 ' x86 system directory on RISC = C:\winnt\system32 GetSpecialFolderPath Failure 2A / %CSIDL_PROGRAM_FILESX86 ' x86 C:\Program Files on RISC = SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 2B / %CSIDL_PROGRAM_FILES_COMMON ' C:\Program Files\Common = C:\Program Files\Common Files GetSpecialFolderPath Failure 2C / %CSIDL_PROGRAM_FILES_COMMONX86 ' x86 Program Files\Common on RISC = SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 2D / %CSIDL_COMMON_TEMPLATES ' All Users\Templates = F:\All Users\Templates SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 2E / %CSIDL_COMMON_DOCUMENTS ' All Users\Documents = F:\All Users\Documents SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 2F / %CSIDL_COMMON_ADMINTOOLS ' All Users\Start Menu\Programs\Administrative Tools = F:\All Users\Start Menu\Programs\Accessories\Administrative Tools SHGetSpecialFolderLocation Success SHGetPathFromIDList Success 30 / %CSIDL_ADMINTOOLS ' <user name>\Start Menu\Programs\Administrative Tools = F:\All Users\Start Menu\Programs\Accessories\Administrative Tools SHGetSpecialFolderLocation Success 31 / %CSIDL_CONNECTIONS ' Network and Dial-up Connections = GetSpecialFolderPath Failure 32 / = GetSpecialFolderPath Failure 33 / = GetSpecialFolderPath Failure 34 / = GetSpecialFolderPath Failure 35 / %CSIDL_COMMON_MUSIC ' All Users\My Music = GetSpecialFolderPath Failure 36 / %CSIDL_COMMON_PICTURES ' All Users\My Pictures = GetSpecialFolderPath Failure 37 / %CSIDL_COMMON_VIDEO ' All Users\My Video = GetSpecialFolderPath Failure 38 / %CSIDL_RESOURCES ' Resource Direcotry =
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
ProfilesDirectory = VALUE
Then copying ALL USERS and DEFAULT USER to the drive.
There might of been more involved stuff in whacking the registry, don't remember, it's been years since I've needed to install w2k on a machine.
Shouldn't bother going off on a tangent about that, now everyone will start discussing different means to do that, ...
Comment