7030249: Eliminate use of LoadLibrary and other clean-ups

Dmytro Sheyko dmytro_sheyko at hotmail.com
Tue Mar 29 15:11:06 UTC 2011




Thanks for cleaning it up.

Couple of questions:

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");
     if (handle != NULL) {
         ...

?

Also according to MSDN GetModuleHandleEx requires at minimum "Windows XP" or "Windows Server 2003". It means that we do not support "Windows 2000", right?

Thanks,
Dmytro

> Date: Mon, 28 Mar 2011 16:58:57 +0100
> From: Alan.Bateman at oracle.com
> To: core-libs-dev at openjdk.java.net; Vincent.Ryan at oracle.com
> Subject: 7030249: Eliminate use of LoadLibrary and other clean-ups
> 
> 
> There are several places in the Windows native code where win32 
> functions are looked up with GetProcAddress after loading the DLL. Many 
> of these places date back to when the JDK was built on Windows NT. Chris 
> removed several of them from the network code in a recent change-set 
> where he was cleaning up some code in that area. While editing 
> java_props_md.c I also changed the code that uses GetUserName to get the 
> value for the user.name property it's not set by an environment 
> variable. This was something Dmytro Sheyko pointed out on this list a 
> few weeks ago [1].  The webrev with the changes is here:
>   http://cr.openjdk.java.net/~alanb/7030249/webrev/
> 
> Vinnie - I updated the MS CAPI provider while I was at it, do you mind 
> reviewing that? I've run the tests in test/sun/security/mscapi to verify.
> 
> -Alan.
> 
> [1] 
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-February/005837.html
> 
 		 	   		  


More information about the core-libs-dev mailing list