Register DLL

Bastiaan Olij bastiaan at basenlily.me
Thu Mar 5 02:22:26 EST 2015


Hey Kelly,

You can find the REFKNOWNFOLDERID definition here:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457%28v=vs.85%29.aspx

Like I said, they are GUIDs, those funny 16 byte guaranteed to be unique
in the world generated numbers that Microsoft also uses to identify COM
objects with.
The problem is, there are more known folder IDs then are available with
the old command, one of them being the download folder. Microsoft got it
in their heads to make that a user configurable setting and off course
we have users that aren't using the default <userprofile>\Downloads folder

Cheers,

Bas

On 5/03/2015 5:12 pm, Kelly Burgess wrote:
> Hi Bas,
>
>> I'm trying to make SHGetKnownFolderPath to work with RegisterDLL and CallDLL.
> That function has problematic parameters.
>
> HRESULT SHGetKnownFolderPath(
>   _In_      REFKNOWNFOLDERID rfid,
>   _In_      DWORD dwFlags,
>   _In_opt_  HANDLE hToken,
>   _Out_     PWSTR *ppszPath
> );
>
> I can't find a typedef for REFKNOWNFOLDERID, and I'm not sure how you'd cook up a proper 'reference' to a folder ID.
>
> The docs for it say "This function replaces SHGetFolderPath. That older function is now simply a wrapper forSHGetKnownFolderPath."
>
> SHGetFolderPath has simpler parameters, and if it's a pass-through like the docs suggest, I'd suggest you could use it instead.
>
> HRESULT SHGetFolderPath(
>   _In_   HWND hwndOwner,
>   _In_   int   nFolder,
>   _In_   HANDLE hToken,
>   _In_   DWORD dwFlags,
>   _Out_  LPTSTR pszPath
> );
>
> ;  get user's appData folder, Documents folder, Internet Cache folder, Desktop folder
> Register DLL ('shfolder.dll','SHGetFolderPathA','JJJJJC') 
> Call DLL ('shfolder.dll','SHGetFolderPathA',0,28,-1,0,appDataFolder) 
> Call DLL ('shfolder.dll','SHGetFolderPathA',0,5,-1,0,documentsFolder) 
> Call DLL ('shfolder.dll','SHGetFolderPathA',0,32,-1,0,internetCacheFolder) 
> Call DLL ('shfolder.dll','SHGetFolderPathA',0,0,-1,0,userDesktopFolder) 
>
> appDataFolder = C:\Users\kelly\AppData\Local
> documentsFolder = C:\Users\kelly\Documents
> internetCacheFolder = C:\Users\kelly\AppData\Local\Microsoft\Windows\Temporary Internet Files
> userDesktopFolder = C:\Users\kelly\Desktop
>
> Here's a list of constants from shlobj.h: (I've only tried a few of them)
>
> CSIDL_DESKTOP                   0x0000        // <desktop>
> CSIDL_INTERNET                  0x0001        // Internet Explorer (icon on desktop)
> CSIDL_PROGRAMS                  0x0002        // Start Menu\Programs
> CSIDL_CONTROLS                  0x0003        // My Computer\Control Panel
> CSIDL_PRINTERS                  0x0004        // My Computer\Printers
> CSIDL_PERSONAL                  0x0005        // My Documents
> CSIDL_FAVORITES                 0x0006        // <user name>\Favorites
> CSIDL_STARTUP                   0x0007        // Start Menu\Programs\Startup
> CSIDL_RECENT                    0x0008        // <user name>\Recent
> CSIDL_SENDTO                    0x0009        // <user name>\SendTo
> CSIDL_BITBUCKET                 0x000a        // <desktop>\Recycle Bin
> CSIDL_STARTMENU                 0x000b        // <user name>\Start Menu
> CSIDL_DESKTOPDIRECTORY          0x0010        // <user name>\Desktop
> CSIDL_DRIVES                    0x0011        // My Computer
> CSIDL_NETWORK                   0x0012        // Network Neighborhood
> CSIDL_NETHOOD                   0x0013        // <user name>\nethood
> CSIDL_FONTS                     0x0014        // windows\fonts
> CSIDL_TEMPLATES                 0x0015
> CSIDL_COMMON_STARTMENU          0x0016        // All Users\Start Menu
> CSIDL_COMMON_PROGRAMS           0X0017        // All Users\Programs
> CSIDL_COMMON_STARTUP            0x0018        // All Users\Startup
> CSIDL_COMMON_DESKTOPDIRECTORY   0x0019        // All Users\Desktop
> CSIDL_APPDATA                   0x001a        // <user name>\Application Data
> CSIDL_PRINTHOOD                 0x001b        // <user name>\PrintHood
> CSIDL_LOCAL_APPDATA             0x001c        // <user name>\Local Settings\Applicaiton Data (non roaming)
> CSIDL_ALTSTARTUP                0x001d        // non localized startup
> CSIDL_COMMON_ALTSTARTUP         0x001e        // non localized common startup
> CSIDL_COMMON_FAVORITES          0x001f
> CSIDL_INTERNET_CACHE            0x0020
> CSIDL_COOKIES                   0x0021
> CSIDL_HISTORY                   0x0022
> CSIDL_COMMON_APPDATA            0x0023        // All Users\Application Data
> CSIDL_WINDOWS                   0x0024        // GetWindowsDirectory()
> CSIDL_SYSTEM                    0x0025        // GetSystemDirectory()
> CSIDL_PROGRAM_FILES             0x0026        // C:\Program Files
> CSIDL_MYPICTURES                0x0027        // C:\Program Files\My Pictures
> CSIDL_PROFILE                   0x0028        // USERPROFILE
> CSIDL_SYSTEMX86                 0x0029        // x86 system directory on RISC
> CSIDL_PROGRAM_FILESX86          0x002a        // x86 C:\Program Files on RISC
> CSIDL_PROGRAM_FILES_COMMON      0x002b        // C:\Program Files\Common
> CSIDL_PROGRAM_FILES_COMMONX86   0x002c        // x86 Program Files\Common on RISC
> CSIDL_COMMON_TEMPLATES          0x002d        // All Users\Templates
> CSIDL_COMMON_DOCUMENTS          0x002e        // All Users\Documents
> CSIDL_COMMON_ADMINTOOLS         0x002f        // All Users\Start Menu\Programs\Administrative Tools
> CSIDL_ADMINTOOLS                0x0030        // <user name>\Start Menu\Programs\Administrative Tools
> CSIDL_CONNECTIONS               0x0031        // Network and Dial-up Connections
>
> CSIDL_FLAG_CREATE               0x8000        // combine with CSIDL_ value to force folder creation in SHGetFolderPath()
> CSIDL_FLAG_DONT_VERIFY          0x4000        // combine with CSIDL_ value to return an unverified folder path
>
> Hope it helps,
>
> Kelly
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
>
>


-- 
Kindest Regards,

Bastiaan Olij
e-mail: bastiaan at basenlily.me
web: http://www.basenlily.me
Skype: Mux213
http://www.linkedin.com/in/bastiaanolij




More information about the omnisdev-en mailing list