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 139 AddDllDirectory = (HANDLE (*)(PCWSTR)) GetProcAddress(kernel,"AddDllDirectory");
140 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 146 memset(datadir,' ',4095);
146 147 datadir[4095] = 0;
... ... @@ -165,8 +166,12 @@
165 166  
166 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 173 hModule = LoadLibraryEx(buffer,NULL,LOAD_LIBRARY_SEARCH_DEFAULT_DIRS|LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
  174 + }
170 175  
171 176 rc = GetLastError();
172 177  
... ...
src/pw3270/plugin.c
... ... @@ -45,6 +45,10 @@
45 45 const gchar * name;
46 46 GError * err = NULL;
47 47 GList * lst = NULL;
  48 +#ifdef WIN32
  49 + UINT errorMode;
  50 +#endif // WIN32
  51 +
48 52  
49 53 trace("Loading plugins from %s",path);
50 54  
... ... @@ -59,6 +63,11 @@
59 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 71 name = g_dir_read_name(dir);
63 72 while(name)
64 73 {
... ... @@ -104,6 +113,10 @@
104 113 name = g_dir_read_name(dir);
105 114 }
106 115  
  116 +#ifdef WIN32
  117 + SetErrorMode(errorMode);
  118 +#endif // WIN32
  119 +
107 120 g_dir_close(dir);
108 121  
109 122 if(lst)
... ...