Commit 3f07f717996979b01c70487e581d1d690de1a269

Authored by perry.werneck@gmail.com
1 parent 73456807

Melhorando a carga de DLLs e plugins no windows

src/plugins/remotectl/calls.c
@@ -139,8 +139,9 @@ @@ -139,8 +139,9 @@
139 AddDllDirectory = (HANDLE (*)(PCWSTR)) GetProcAddress(kernel,"AddDllDirectory"); 139 AddDllDirectory = (HANDLE (*)(PCWSTR)) GetProcAddress(kernel,"AddDllDirectory");
140 RemoveDllDirectory = (BOOL (*)(HANDLE)) GetProcAddress(kernel,"RemoveDllDirectory"); 140 RemoveDllDirectory = (BOOL (*)(HANDLE)) GetProcAddress(kernel,"RemoveDllDirectory");
141 141
142 - // Notify user in case of error loading protocol DLL  
143 - errorMode = SetErrorMode(0); 142 + // Notify user in case of error loading protocol DLL
  143 + // http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621(v=vs.85).aspx
  144 + errorMode = SetErrorMode(1);
144 145
145 memset(datadir,' ',4095); 146 memset(datadir,' ',4095);
146 datadir[4095] = 0; 147 datadir[4095] = 0;
@@ -165,8 +166,12 @@ @@ -165,8 +166,12 @@
165 166
166 trace("%s hModule=%p rc=%d",buffer,hModule,(int) GetLastError()); 167 trace("%s hModule=%p rc=%d",buffer,hModule,(int) GetLastError());
167 168
168 - if(hModule == NULL) 169 + if(hModule == NULL)
  170 + {
  171 + // Enable DLL error popup and try again with full path
  172 + SetErrorMode(0)
169 hModule = LoadLibraryEx(buffer,NULL,LOAD_LIBRARY_SEARCH_DEFAULT_DIRS|LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); 173 hModule = LoadLibraryEx(buffer,NULL,LOAD_LIBRARY_SEARCH_DEFAULT_DIRS|LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
  174 + }
170 175
171 rc = GetLastError(); 176 rc = GetLastError();
172 177
src/pw3270/plugin.c
@@ -45,6 +45,10 @@ @@ -45,6 +45,10 @@
45 const gchar * name; 45 const gchar * name;
46 GError * err = NULL; 46 GError * err = NULL;
47 GList * lst = NULL; 47 GList * lst = NULL;
  48 +#ifdef WIN32
  49 + UINT errorMode;
  50 +#endif // WIN32
  51 +
48 52
49 trace("Loading plugins from %s",path); 53 trace("Loading plugins from %s",path);
50 54
@@ -59,6 +63,11 @@ @@ -59,6 +63,11 @@
59 return; 63 return;
60 } 64 }
61 65
  66 +#ifdef WIN32
  67 + // http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621(v=vs.85).aspx
  68 + errorMode = SetErrorMode(1);
  69 +#endif // WIN32
  70 +
62 name = g_dir_read_name(dir); 71 name = g_dir_read_name(dir);
63 while(name) 72 while(name)
64 { 73 {
@@ -104,6 +113,10 @@ @@ -104,6 +113,10 @@
104 name = g_dir_read_name(dir); 113 name = g_dir_read_name(dir);
105 } 114 }
106 115
  116 +#ifdef WIN32
  117 + SetErrorMode(errorMode);
  118 +#endif // WIN32
  119 +
107 g_dir_close(dir); 120 g_dir_close(dir);
108 121
109 if(lst) 122 if(lst)