• R/O
  • SSH
  • HTTPS

exewrap: Commit


Commit MetaInfo

Revision57 (tree)
Time2018-11-15 19:32:39
Authorhirukawa_ryo

Log Message

* exewrap 1.3.0 UWP(Desktop Bridge)に対応しました。

Change Summary

Incremental Difference

--- exewrap/trunk/exewrap/src/exewrap.c (revision 56)
+++ exewrap/trunk/exewrap/src/exewrap.c (revision 57)
@@ -84,7 +84,7 @@
8484 exe_file = argv[0];
8585 }
8686
87- printf("exewrap 1.2.7 for %s (%d-bit) \r\n"
87+ printf("exewrap 1.3.0 for %s (%d-bit) \r\n"
8888 "Native executable java application wrapper.\r\n"
8989 "Copyright (C) 2005-2018 HIRUKAWA Ryo. All rights reserved.\r\n"
9090 "\r\n"
--- exewrap/trunk/exewrap/src/jvm.c (revision 56)
+++ exewrap/trunk/exewrap/src/jvm.c (revision 57)
@@ -21,7 +21,7 @@
2121 LPTSTR FindJavaHomeFromRegistry(LPCTSTR _subkey, char* output);
2222 void AddPath(LPCTSTR path);
2323 LPTSTR GetModulePath(LPTSTR buffer, DWORD size);
24-LPTSTR GetModuleVersion(LPTSTR buffer);
24+LPTSTR GetModuleVersion(LPTSTR buffer);
2525 BOOL IsDirectory(LPTSTR path);
2626 char* GetSubDirs(char* dir);
2727 char* AddSubDirs(char* buf, char* dir, int* size);
@@ -34,6 +34,8 @@
3434 static char* get_line(FILE* fp);
3535
3636
37+typedef PVOID (WINAPI* Kernel32_AddDllDirectory)(PCWSTR);
38+typedef BOOL (WINAPI* Kernel32_SetDefaultDllDirectories)(DWORD);
3739 typedef jint (WINAPI* JNIGetDefaultJavaVMInitArgs)(JavaVMInitArgs*);
3840 typedef jint (WINAPI* JNICreateJavaVM)(JavaVM**, void**, JavaVMInitArgs*);
3941
@@ -44,14 +46,17 @@
4446 char opt_system_class_loader[512];
4547 char opt_app_path[MAX_PATH + 32];
4648 char opt_app_name[MAX_PATH + 32];
47-char opt_app_version[64];
49+char opt_app_version[64];
4850 char opt_policy_path[MAX_PATH + 32];
4951 BOOL path_initialized = FALSE;
5052 char binpath[MAX_PATH];
5153 char jvmpath[MAX_PATH];
5254 char* classpath = NULL;
53-char* libpath = NULL;
54-HMODULE jvmdll;
55+char* libpath = NULL;
56+HMODULE jvmdll = NULL;
57+HMODULE kernel32 = NULL;
58+Kernel32_AddDllDirectory addDllDirectory = NULL;
59+Kernel32_SetDefaultDllDirectories setDefaultDllDirectories = NULL;
5560
5661 /* このプロセスのアーキテクチャ(32ビット/64ビット)を返します。
5762  * 64ビットOSで32ビットプロセスを実行している場合、この関数は32を返します。
@@ -409,6 +414,16 @@
409414
410415 path_initialized = TRUE;
411416
417+ if(kernel32 == NULL)
418+ {
419+ kernel32 = LoadLibrary("kernel32");
420+ }
421+ if(kernel32 != NULL)
422+ {
423+ addDllDirectory = (Kernel32_AddDllDirectory)GetProcAddress(kernel32, "AddDllDirectory");
424+ setDefaultDllDirectories = (Kernel32_SetDefaultDllDirectories)GetProcAddress(kernel32, "SetDefaultDllDirectories");
425+ }
426+
412427 if (classpath == NULL)
413428 {
414429 classpath = (char*)HeapAlloc(GetProcessHeap(), 0, 64 * 1024);
@@ -741,6 +756,12 @@
741756 AddPath(binpath);
742757 AddPath(jvmpath);
743758
759+ if(setDefaultDllDirectories != NULL)
760+ {
761+ //LOAD_LIBRARY_SEARCH_DEFAULT_DIRS= 0x00001000
762+ BOOL ret = setDefaultDllDirectories(0x00001000);
763+ }
764+
744765 HeapFree(GetProcessHeap(), 0, buffer);
745766 }
746767
@@ -867,6 +888,13 @@
867888 lstrcat(buf, old_path);
868889 SetEnvironmentVariable("PATH", buf);
869890
891+ if(addDllDirectory != NULL)
892+ {
893+ LPCWSTR wPath = A2W(path);
894+ addDllDirectory(wPath);
895+ HeapFree(GetProcessHeap(), 0, wPath);
896+ }
897+
870898 HeapFree(GetProcessHeap(), 0, buf);
871899 HeapFree(GetProcessHeap(), 0, old_path);
872900 }
Show on old repository browser