shlobj.pp SHGetSetFolderCustomSettingsA and W problem lazarus / 67-Windows ---------------------------------------------------------------------- 440bx · 2025-09-13 20:26 Hello, the file shlobj.pp has the following definitions: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   function SHGetSetFolderCustomSettingsA(pfcs:LPSHFOLDERCUSTOMSETTINGSA; pszPath:lpcstr; dwReadWrite:DWord):HRESULT;StdCall;external External_library name 'SHGetSetFolderCustomSettingsA';  function SHGetSetFolderCustomSettingsW(pfcs:LPSHFOLDERCUSTOMSETTINGSW; pszPath:lpcwstr; dwReadWrite:DWord):HRESULT;StdCall;external External_library name 'SHGetSetFolderCustomSettingsW';  {$ifdef unicode}  function SHGetSetFolderCustomSettings (pfcs:LPSHFOLDERCUSTOMSETTINGSW; pszPath:lpcwstr; dwReadWrite:DWord):HRESULT;StdCall;external External_library name 'SHGetSetFolderCustomSettingsW';  {$else}  function SHGetSetFolderCustomSettings (pfcs:LPSHFOLDERCUSTOMSETTINGSA; pszPath:lpcstr; dwReadWrite:DWord):HRESULT;StdCall;external External_library name 'SHGetSetFolderCustomSettingsA';  {$endif} Those definitions are correct for Windows XP. I do _not_ know if they are correct for Windows Vista. They are _incorrect_ for all versions of Windows starting with Win 7 because neither the "A" nor the "W" entry point exist.  Beginning in Win 7, there is a single entry point named SHGetSetFolderCustomSettings (note there is no A nor W) and, that entry point uses widechar. The problem with the current definition occurs when unicode is not defined.  In that case, the resulting definition takes a pchar instead of a pwidechar. The same problem exists with the LPSHFOLDERCUSTOMSETTINGS structure, beginning with Win 7, there is no A and W versions only a plain LPSHFOLDERCUSTOMSETTINGS which uses wide characters.  The non-unicode definition will have an incorrect (and non-existent) parameter type. HTH.