Recent

Author Topic: shlobj.pp SHGetSetFolderCustomSettings definition problems  (Read 748 times)

440bx

  • Hero Member
  • *****
  • Posts: 6119
shlobj.pp SHGetSetFolderCustomSettings definition problems
« on: August 02, 2025, 02:51:54 am »
Hello,

Sometime around Windows Vista, MS got rid of the functions SHGetSetFolderCustomSettingsA and SHGetSetFolderCustomSettingsW. 

This means those entry points no longer exist and any attempt to use those functions in any version of Windows starting with Vista and later will cause the program to fail loading (since the loader will not be able to find the entry points anywhere.)

Related to that, there were  SHFOLDERCUSTOMSETTINGSA and SHFOLDERCUSTOMSETTINGSW structures.  They are both gone.  there is only a SHFOLDERCUSTOMSETTINGS structure, documented at:
https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/ns-shlobj_core-shfoldercustomsettings

which is used by SHGetSetFolderCustomSettings (note the absence of "A" and/or "W")

Basically, as of Windows Vista and later there is only a SHGetSetFolderCustomSettings function which takes a SHFOLDERCUSTOMSETTINGS.

Anything else no longer exists, is no longer declared in the C headers and no longer documented online.

The current non A/W definition in shlobj.pp will fail because it is not using the correct structure definition (it should use the current SHFOLDERCUSTOMSETTINGS definition which uses wide chars, not chars.

HTH.

Factoid, in some versions of Windows, the ordinal of the old "A" version is forwarded to the dll SHUNIMPL which will cause the process to fail (the dll's entry point always returns false, telling the loader the load failed thus causing the process not to load.)  The "W" is probably redirected too but, a cursory look was not enough to make the determination.


FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018