diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk index 0fe8e109f45..8904c39449e 100644 --- a/make/modules/java.base/lib/CoreLibraries.gmk +++ b/make/modules/java.base/lib/CoreLibraries.gmk @@ -64,7 +64,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/, \ - LDFLAGS_windows := -delayload:shell32.dll, \ LIBS_unix := -ljvm, \ LIBS_linux := $(LIBDL), \ LIBS_aix := $(LIBDL) $(LIBM),\ @@ -72,7 +71,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \ -framework Foundation \ -framework SystemConfiguration, \ LIBS_windows := jvm.lib \ - shell32.lib delayimp.lib \ + shell32.lib ole32.lib \ advapi32.lib version.lib, \ )) diff --git a/src/java.base/windows/native/libjava/java_props_md.c b/src/java.base/windows/native/libjava/java_props_md.c index 2ff4c9e8806..5eefb6a9fc9 100644 --- a/src/java.base/windows/native/libjava/java_props_md.c +++ b/src/java.base/windows/native/libjava/java_props_md.c @@ -40,10 +40,6 @@ #include "locale_str.h" #include "java_props.h" -#ifndef VER_PLATFORM_WIN32_WINDOWS -#define VER_PLATFORM_WIN32_WINDOWS 1 -#endif - #ifndef PROCESSOR_ARCHITECTURE_AMD64 #define PROCESSOR_ARCHITECTURE_AMD64 9 #endif @@ -213,39 +209,13 @@ getHomeFromShell32() */ static WCHAR *u_path = NULL; if (u_path == NULL) { - HRESULT hr; - - /* - * SHELL32 DLL is delay load DLL and we can use the trick with - * __try/__except block. - */ - __try { - /* - * For Windows Vista and later (or patched MS OS) we need to use - * [SHGetKnownFolderPath] call to avoid MAX_PATH length limitation. - * Shell32.dll (version 6.0.6000 or later) - */ - hr = SHGetKnownFolderPath(&FOLDERID_Profile, KF_FLAG_DONT_VERIFY, NULL, &u_path); - } __except(EXCEPTION_EXECUTE_HANDLER) { - /* Exception: no [SHGetKnownFolderPath] entry */ - hr = E_FAIL; - } + WCHAR *tmpPath = NULL; + HRESULT hr = SHGetKnownFolderPath(&FOLDERID_Profile, KF_FLAG_DONT_VERIFY, NULL, &tmpPath); if (FAILED(hr)) { - WCHAR path[MAX_PATH+1]; - - /* fallback solution for WinXP and Windows 2000 */ - hr = SHGetFolderPathW(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, path); - if (FAILED(hr)) { - /* we can't find the shell folder. */ - u_path = NULL; - } else { - /* Just to be sure about the path length until Windows Vista approach. - * [S_FALSE] could not be returned due to [CSIDL_FLAG_DONT_VERIFY] flag and UNICODE version. - */ - path[MAX_PATH] = 0; - u_path = _wcsdup(path); - } + CoTaskMemFree(tmpPath); + } else { + u_path = tmpPath; } } return u_path;