7030249: Eliminate use of LoadLibrary and other clean-ups
Dmytro Sheyko
dmytro_sheyko at hotmail.com
Tue Mar 29 16:04:47 UTC 2011
Good. Thank you
Date: Tue, 29 Mar 2011 16:49:50 +0100
From: Alan.Bateman at oracle.com
To: dmytro_sheyko at hotmail.com
CC: core-libs-dev at openjdk.java.net
Subject: Re: 7030249: Eliminate use of LoadLibrary and other clean-ups
Message body
Dmytro Sheyko wrote:
:
Why we obtain HMODULE for kernel32 this way:
// get handle to kernel32
if (GetModuleHandleExW((GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT),
(LPCWSTR)&CreateFileW, &h) != 0)
{
...
instead of
handle = GetModuleHandle("kernel32");
GetModuleHandleExW allows you to provide the address of a function in
the library that you need the handle for and so you avoid issues when
multiple libraries with the same name are loaded.
:
Also according to MSDN GetModuleHandleEx requires at minimum "Windows
XP" or "Windows Server 2003". It means that we do not support "Windows
2000", right?
I don't think it's been possible to install or run jdk7 on Windows 2000
for some time.
-Alan
More information about the core-libs-dev
mailing list