Jimmyb
Jimmyb

Reputation: 890

Static linking SHFolder components

I have a Win32 app developed in C++ Builder XE, which has worked great in the WinPE 2.x/3.0 environments for the past couple of years. I have made some significant changes over the past couple of months, but now that it's complete and I try to run it under WinPE I get the error message: The program can't start because SHFOLDER.DLL is missing from your computer.

Since I can't control the WinPE environment, and this dll isn't included in WinPE, my first thought is to try and statically link the necessary components. However, it appears the functionality offered by this dll is only available from the dll.

I haven't been able to find any useful information on this DLL, and unfortunately I don't know which functionality I added that now requires this DLL. I am hoping that someone has experience with this, and can help guide me toward statically linking the required components, or finding a workaround so that this app no longer requires the dll. Thanks!

Upvotes: 0

Views: 779

Answers (1)

kichik
kichik

Reputation: 34714

shfolder.dll is used to get shell folder paths like the Desktop, My Documents, Windows directory, etc. It implements SHGetFolderPath() consistently along all versions of Windows due to differences of implementation between SHGetSpecialFolderPath(), SHGetFolderLocation(), SHGetKnownFolderPath(), etc.

MSDN explains it better:

This function is a superset of SHGetSpecialFolderPath, included with earlier versions of the Shell. On systems that preceded those that include Shell32.dll version 5.0 (Windows Millennium Edition (Windows Me) and Windows 2000), SHGetFolderPath was obtained through SHFolder.dll, distributed with Microsoft Internet Explorer 4.0 and later versions. SHFolder.dll always calls the current platform's version of this function. If that fails, it tries to simulate the appropriate behavior. SHFolder.dll continues to be included for backward compatibility, but the function is now implemented in Shell32.dll.

The DLL itself is redistributable so you can include it for WinPE. You can also just use any one of the other functions, if they work for you and you don't need any of the special cases.

Upvotes: 1

Related Questions