JDK-8316421 : libjava should load shell32.dll eagerly
  • Type: Enhancement
  • Component: core-libs
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2023-09-18
  • Updated: 2023-09-25
  • Resolved: 2023-09-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 22
22 masterFixed
Related Reports
Relates :  
Relates :  
Description
Java.dll is delay-loading shell32.dll. Delay-loading should only be used on libraries that might never be used, to avoid loading them when they are not needed.

Java.dll is using the following 2 imports from shell32.dll:
- SHGetKnownFolderPath
- SHGetFolderPathW

These functions are used by getHomeFromShell32, which is always used to populate user.home property early during startup.

A bit of archeology:
- Delay-loading was introduced in JDK-7030249. When it was implemented, user.home was populated with values taken from the Windows registry, and getHomeFromShell32 was only called if the registry-based method failed.
- Since JDK-6519127, we are always using getHomeFromShell32 to retrieve user.home. We are still delay-loading shell32, and using try/except to handle missing imports on older shell32 versions (Win2000/XP/2003)

The imports are guaranteed to be available on anything more recent than Vista, and we no longer support any of the older Windows versions.
Comments
Changeset: 8cbe42b9 Author: Daniel JeliƄski <djelinski@openjdk.org> Date: 2023-09-21 12:39:03 +0000 URL: https://git.openjdk.org/jdk/commit/8cbe42b94aaf2ff090ae8399da0418e9e2fc3873
21-09-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15789 Date: 2023-09-18 14:44:13 +0000
18-09-2023