[libbluray-devel] win32: improve jvm.dll loading
hpi1
git at videolan.org
Thu Mar 2 14:23:20 CET 2017
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Mar 2 15:12:58 2017 +0200| [9a216db6bbd8d7919b2889be546bffcac322fb7c] | committer: hpi1
win32: improve jvm.dll loading
First try loading jvm.dll without dll search path.
If failed, retry with JAVA_HOME in search path.
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=9a216db6bbd8d7919b2889be546bffcac322fb7c
---
ChangeLog | 1 +
src/libbluray/bdj/bdj.c | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 0ffc579..7008cc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
- Add playback time position to BD_EVENT_SEEK.
- Add BD_VK_ROOT_MENU handling.
- Add support for heavily fragmented 3D .m2ts files.
+- Improve Win32 dll loading security.
- Improve playback resume position accuracy.
- Improve error resilience and stability.
- Fix using libmmbd with unmounted discs.
diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index 2a8f6bf..7c78ba5 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -80,15 +80,24 @@ static void *_load_dll(const wchar_t *lib_path, const wchar_t *dll_search_path)
pRemoveDllDirectory = (__typeof__(pRemoveDllDirectory)) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "RemoveDllDirectory");
if (pAddDllDirectory && pRemoveDllDirectory) {
+
+ result = LoadLibraryExW(lib_path, NULL,
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
+
+ if (!result) {
PVOID cookie = pAddDllDirectory(dll_search_path);
result = LoadLibraryExW(lib_path, NULL,
LOAD_LIBRARY_SEARCH_SYSTEM32 |
LOAD_LIBRARY_SEARCH_USER_DIRS);
pRemoveDllDirectory(cookie);
+ }
} else {
+ result = LoadLibraryW(lib_path);
+ if (!result) {
SetDllDirectoryW(dll_search_path);
result = LoadLibraryW(lib_path);
SetDllDirectoryW(L"");
+ }
}
return result;
More information about the libbluray-devel
mailing list