RFR: 8348828: Windows dll loading now resolves symlinks
Brian Burkhalter
bpb at openjdk.org
Wed May 7 21:21:57 UTC 2025
On Wed, 7 May 2025 19:21:38 GMT, Benjamin Peterson <duke at openjdk.org> wrote:
> > New-Item -Path .\jdk-24\bin\jimage.dll -ItemType SymbolicLink -Value .\rando
What if instead this were the following
> New-Item -Path .\jdk-24\bin\jimage.dll -ItemType SymbolicLink -Value .\rando.dll
where `.dll` is appended to the target?
> At this point, the path to load will be `$PWD\rando` due to symlink resolution.
Which is in fact correct, no?
> Entering the VM, `NativeLibraries.load` will eventually pass `$PWD\rando` to `LoadLibrary`. Since `.\rando` lacks a `.dll` extension on its face, `LoadLibrary` will add it, observe that `$PWD\rando.dll` doesn't exist and fail.
Indeed from the `LoadLibrary` documentation
If the string specifies a module name without a path and the file name extension is
omitted, the function appends the default library extension ".DLL" to the module name.
To prevent the function from appending ".DLL" to the module name, include a trailing
point character (.) in the module name string.
so a trailing `.` character on `rando` might equally resolve the problem?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24694#issuecomment-2860411482
More information about the core-libs-dev
mailing list