Improved windirs.GetWindowsSpecialDir to use newer API when available
Original Reporter info from Mantis: dezlov
-
Reporter name: Denis Kozlov
Original Reporter info from Mantis: dezlov
- Reporter name: Denis Kozlov
Description:
Improved windirs.GetWindowsSpecialDir to use newer API when available.
SHGetFolderPath - requires Windows 2000 and newer, but has been deprecated.
SHGetKnownFolderPath - requires Windows Vista / Server 2008 and newer.
The attached patch contains the following changes:
- Added FOLDERID_* constants, required for SHGetKnownFolderPath.
- Added mapping of legacy CSIDL_* constants to FOLDERID_* constants.
- Overloaded GetWindowsSpecialDir to work with both CSIDL_* or FOLDERID_* constants.
- Changed GetWindowsSpecialDir to fallback to an alternative API (using appropriate remapping of parameters) when the default API function is not available.
Existing code that uses GetWindowsSpecialDir(CSIDL_*) should not be affected, except for an improved forward compatibility when the deprecated SHGetFolderPath is finally removed from Windows API, in which case a newer API function will be used automatically.
Additional information:
Relevant discussion on the mailing list:
http://lists.freepascal.org/pipermail/fpc-devel/2018-February/038564.html
Mantis conversion info:
- Mantis ID: 33133
- Build: TRUNK
- Fixed in version: 3.1.1
- Fixed in revision: 38328 (#ccbaf748)
- Monitored by: » dezlov (Denis Kozlov)
- Target version: 3.2.0