Commit 556af124d41251d46f9179552d5edc1b2bb7b6b7
1 parent
7564dbba
Exists in
master
and in
5 other branches
Atualizando java
Showing
5 changed files
with
64 additions
and
30 deletions
Show diff stats
po/pt_BR.po
| ... | ... | @@ -5,7 +5,7 @@ msgid "" |
| 5 | 5 | msgstr "" |
| 6 | 6 | "Project-Id-Version: pw3270 5.0\n" |
| 7 | 7 | "Report-Msgid-Bugs-To: \n" |
| 8 | -"POT-Creation-Date: 2015-07-07 08:13-0300\n" | |
| 8 | +"POT-Creation-Date: 2015-07-07 09:37-0300\n" | |
| 9 | 9 | "PO-Revision-Date: 2014-02-17 08:05-0300\n" |
| 10 | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
| 11 | 11 | "Language-Team: Portugues <>\n" | ... | ... |
src/java/Makefile.in
src/java/call.cc
| ... | ... | @@ -31,6 +31,7 @@ |
| 31 | 31 | #include "private.h" |
| 32 | 32 | #include <pw3270/v3270.h> |
| 33 | 33 | #include <lib3270/trace.h> |
| 34 | + #include <lib3270/log.h> | |
| 34 | 35 | |
| 35 | 36 | |
| 36 | 37 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
| ... | ... | @@ -40,6 +41,8 @@ namespace PW3270_NAMESPACE { |
| 40 | 41 | |
| 41 | 42 | void java::call(GtkWidget *widget, const char *classname) { |
| 42 | 43 | |
| 44 | + debug("%s(%s)",__FUNCTION__,classname); | |
| 45 | + | |
| 43 | 46 | if(!trylock()) { |
| 44 | 47 | |
| 45 | 48 | failed(widget, _( "Can't access java virtual machine" ), "%s", strerror(EBUSY)); | ... | ... |
src/java/plugin.cc
src/java/startstop.cc
| ... | ... | @@ -212,60 +212,92 @@ extern "C" { |
| 212 | 212 | |
| 213 | 213 | kernel = LoadLibrary("kernel32.dll"); |
| 214 | 214 | |
| 215 | - AddDllDirectory = (HANDLE WINAPI (*)(PCWSTR)) GetProcAddress(kernel,"AddDllDirectory"); | |
| 216 | - if(AddDllDirectory) { | |
| 215 | + if(kernel) { | |
| 217 | 216 | |
| 218 | - // Acrescenta mais caminhos para achar a dll | |
| 219 | - for(size_t f = 0; f < G_N_ELEMENTS(dlldir); f++) { | |
| 217 | + AddDllDirectory = (HANDLE WINAPI (*)(PCWSTR)) GetProcAddress(kernel,"AddDllDirectory"); | |
| 218 | + if(AddDllDirectory) { | |
| 220 | 219 | |
| 221 | - const char *env = getenv(dlldir[f].env); | |
| 220 | + // Acrescenta mais caminhos para achar a dll | |
| 221 | + for(size_t f = 0; f < G_N_ELEMENTS(dlldir); f++) { | |
| 222 | 222 | |
| 223 | - debug("%s=\"%s\"",dlldir[f].env,env); | |
| 223 | + const char *env = getenv(dlldir[f].env); | |
| 224 | 224 | |
| 225 | - if(env) { | |
| 225 | + debug("%s=\"%s\"",dlldir[f].env,env); | |
| 226 | 226 | |
| 227 | - gchar *p = g_build_filename(env,dlldir[f].path,NULL); | |
| 227 | + if(env) { | |
| 228 | 228 | |
| 229 | - debug("Adicionando diretório \"%s\"",p); | |
| 229 | + gchar *p = g_build_filename(env,dlldir[f].path,NULL); | |
| 230 | 230 | |
| 231 | - wchar_t *path = (wchar_t *) malloc(4096*sizeof(wchar_t)); | |
| 232 | - mbstowcs(path, p, 4095); | |
| 233 | - dlldir[f].cookie = AddDllDirectory(path); | |
| 234 | - free(path); | |
| 231 | + lib3270_trace_event(v3270_get_session(widget),"Adding \"%s\" to DLL search path",p); | |
| 235 | 232 | |
| 236 | - g_free(p); | |
| 233 | + wchar_t *path = (wchar_t *) malloc(4096*sizeof(wchar_t)); | |
| 234 | + mbstowcs(path, p, 4095); | |
| 235 | + dlldir[f].cookie = AddDllDirectory(path); | |
| 236 | + free(path); | |
| 237 | 237 | |
| 238 | + g_free(p); | |
| 239 | + | |
| 240 | + } | |
| 238 | 241 | } |
| 242 | + | |
| 243 | + } else { | |
| 244 | + | |
| 245 | + lib3270_trace_event(v3270_get_session(widget),"Can't find %s: %s","AddDllDirectory",session::win32_strerror(GetLastError()).c_str()); | |
| 246 | + | |
| 239 | 247 | } |
| 240 | 248 | |
| 249 | + } else { | |
| 250 | + | |
| 251 | + lib3270_trace_event(v3270_get_session(widget),"Can't load %s: %s\n","kernel32.dll",session::win32_strerror(GetLastError()).c_str()); | |
| 252 | + | |
| 241 | 253 | } |
| 242 | - #ifdef DEBUG | |
| 243 | - else { | |
| 244 | - debug("Can't get %s: %s","AddDllDirectory",session::win32_strerror(GetLastError()).c_str()) | |
| 245 | - } | |
| 246 | - #endif // DEBUG | |
| 247 | 254 | |
| 248 | 255 | hModule = LoadLibrary("jvm.dll"); |
| 256 | + if(!hModule) { | |
| 257 | + lib3270_trace_event(v3270_get_session(widget),"Can't load %s\n","jvm.dll",session::win32_strerror(GetLastError()).c_str()); | |
| 258 | + | |
| 259 | + for(size_t f = 0; !hModule && f < G_N_ELEMENTS(dlldir); f++) { | |
| 260 | + | |
| 261 | + const char *env = getenv(dlldir[f].env); | |
| 262 | + | |
| 263 | + debug("%s=\"%s\"",dlldir[f].env,env); | |
| 264 | + | |
| 265 | + if(env) { | |
| 266 | + | |
| 267 | + gchar *p = g_build_filename(env,dlldir[f].path,"jvm.dll",NULL); | |
| 268 | + hModule = LoadLibrary(p); | |
| 269 | + if(!hModule) { | |
| 270 | + lib3270_trace_event(v3270_get_session(widget),"Can't load %s: %s\n",p,session::win32_strerror(GetLastError()).c_str()); | |
| 271 | + } | |
| 272 | + g_free(p); | |
| 273 | + | |
| 274 | + } | |
| 275 | + } | |
| 276 | + } | |
| 249 | 277 | |
| 250 | - if(hModule) { | |
| 278 | + if(!hModule) { | |
| 251 | 279 | failed(widget, _( "Can't load java virtual machine" ), "%s", session::win32_strerror(GetLastError()).c_str()); |
| 252 | 280 | } |
| 253 | 281 | |
| 254 | - RemoveDllDirectory = (BOOL WINAPI (*)(HANDLE)) GetProcAddress(kernel,"RemoveDllDirectory"); | |
| 255 | - if(RemoveDllDirectory) { | |
| 282 | + if(kernel) { | |
| 256 | 283 | |
| 257 | - for(size_t f = 0; f < G_N_ELEMENTS(dlldir); f++) { | |
| 284 | + RemoveDllDirectory = (BOOL WINAPI (*)(HANDLE)) GetProcAddress(kernel,"RemoveDllDirectory"); | |
| 285 | + if(RemoveDllDirectory) { | |
| 258 | 286 | |
| 259 | - if(dlldir[f].cookie) { | |
| 287 | + for(size_t f = 0; f < G_N_ELEMENTS(dlldir); f++) { | |
| 260 | 288 | |
| 261 | - RemoveDllDirectory(dlldir[f].cookie); | |
| 289 | + if(dlldir[f].cookie) { | |
| 262 | 290 | |
| 291 | + RemoveDllDirectory(dlldir[f].cookie); | |
| 292 | + | |
| 293 | + } | |
| 263 | 294 | } |
| 295 | + | |
| 264 | 296 | } |
| 265 | 297 | |
| 266 | - } | |
| 298 | + FreeLibrary(kernel); | |
| 267 | 299 | |
| 268 | - FreeLibrary(kernel); | |
| 300 | + } | |
| 269 | 301 | |
| 270 | 302 | if(!hModule) { |
| 271 | 303 | return false; | ... | ... |