]> git.pld-linux.org Git - packages/vim.git/blame - 7.3.034
7.3.170
[packages/vim.git] / 7.3.034
CommitLineData
d7160e4c
ER
1To: vim-dev@vim.org
2Subject: Patch 7.3.034
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 7.3.034
11Problem: Win32: may be loading .dll from the wrong directory.
12Solution: Go to the Vim executable directory when opening a library.
13Files: src/gui_w32.c, src/if_lua.c, src/if_mzsch.c, src/if_perl.xs,
14 src/if_python.c, src/if_python3.c, src/if_ruby.c, src/mbyte.c,
15 src/os_mswin.c, src/os_win32.c, src/proto/os_win32.pro
16
17
18*** ../vim-7.3.033/src/gui_w32.c 2010-08-15 21:57:25.000000000 +0200
19--- src/gui_w32.c 2010-10-22 21:49:27.000000000 +0200
20***************
21*** 1260,1266 ****
22
23 /* try and load the user32.dll library and get the entry points for
24 * multi-monitor-support. */
25! if ((user32_lib = LoadLibrary("User32.dll")) != NULL)
26 {
27 pMonitorFromWindow = (TMonitorFromWindow)GetProcAddress(user32_lib,
28 "MonitorFromWindow");
29--- 1260,1266 ----
30
31 /* try and load the user32.dll library and get the entry points for
32 * multi-monitor-support. */
33! if ((user32_lib = vimLoadLib("User32.dll")) != NULL)
34 {
35 pMonitorFromWindow = (TMonitorFromWindow)GetProcAddress(user32_lib,
36 "MonitorFromWindow");
37***************
38*** 4188,4194 ****
39 static void
40 dyn_imm_load(void)
41 {
42! hLibImm = LoadLibrary("imm32.dll");
43 if (hLibImm == NULL)
44 return;
45
46--- 4188,4194 ----
47 static void
48 dyn_imm_load(void)
49 {
50! hLibImm = vimLoadLib("imm32.dll");
51 if (hLibImm == NULL)
52 return;
53
54*** ../vim-7.3.033/src/if_lua.c 2010-08-15 21:57:28.000000000 +0200
55--- src/if_lua.c 2010-10-22 21:49:39.000000000 +0200
56***************
57*** 49,55 ****
58 # define symbol_from_dll dlsym
59 # define close_dll dlclose
60 #else
61! # define load_dll LoadLibrary
62 # define symbol_from_dll GetProcAddress
63 # define close_dll FreeLibrary
64 #endif
65--- 49,55 ----
66 # define symbol_from_dll dlsym
67 # define close_dll dlclose
68 #else
69! # define load_dll vimLoadLib
70 # define symbol_from_dll GetProcAddress
71 # define close_dll FreeLibrary
72 #endif
73*** ../vim-7.3.033/src/if_mzsch.c 2010-08-15 21:57:32.000000000 +0200
74--- src/if_mzsch.c 2010-10-22 21:49:53.000000000 +0200
75***************
76*** 556,563 ****
77
78 if (hMzGC && hMzSch)
79 return OK;
80! hMzSch = LoadLibrary(sch_dll);
81! hMzGC = LoadLibrary(gc_dll);
82
83 if (!hMzSch)
84 {
85--- 556,563 ----
86
87 if (hMzGC && hMzSch)
88 return OK;
89! hMzSch = vimLoadLib(sch_dll);
90! hMzGC = vimLoadLib(gc_dll);
91
92 if (!hMzSch)
93 {
94*** ../vim-7.3.033/src/if_perl.xs 2010-08-15 21:57:30.000000000 +0200
95--- src/if_perl.xs 2010-10-22 21:53:06.000000000 +0200
96***************
97*** 106,112 ****
98 #define close_dll dlclose
99 #else
100 #define PERL_PROC FARPROC
101! #define load_dll LoadLibrary
102 #define symbol_from_dll GetProcAddress
103 #define close_dll FreeLibrary
104 #endif
105--- 106,112 ----
106 #define close_dll dlclose
107 #else
108 #define PERL_PROC FARPROC
109! #define load_dll vimLoadLib
110 #define symbol_from_dll GetProcAddress
111 #define close_dll FreeLibrary
112 #endif
113*** ../vim-7.3.033/src/if_python.c 2010-08-15 21:57:28.000000000 +0200
114--- src/if_python.c 2010-10-22 21:49:57.000000000 +0200
115***************
116*** 110,116 ****
117 # define close_dll dlclose
118 # define symbol_from_dll dlsym
119 # else
120! # define load_dll LoadLibrary
121 # define close_dll FreeLibrary
122 # define symbol_from_dll GetProcAddress
123 # endif
124--- 110,116 ----
125 # define close_dll dlclose
126 # define symbol_from_dll dlsym
127 # else
128! # define load_dll vimLoadLib
129 # define close_dll FreeLibrary
130 # define symbol_from_dll GetProcAddress
131 # endif
132*** ../vim-7.3.033/src/if_python3.c 2010-08-15 21:57:28.000000000 +0200
133--- src/if_python3.c 2010-10-22 21:50:01.000000000 +0200
134***************
135*** 88,94 ****
136 # define close_dll dlclose
137 # define symbol_from_dll dlsym
138 # else
139! # define load_dll LoadLibrary
140 # define close_dll FreeLibrary
141 # define symbol_from_dll GetProcAddress
142 # endif
143--- 88,94 ----
144 # define close_dll dlclose
145 # define symbol_from_dll dlsym
146 # else
147! # define load_dll vimLoadLib
148 # define close_dll FreeLibrary
149 # define symbol_from_dll GetProcAddress
150 # endif
151*** ../vim-7.3.033/src/if_ruby.c 2010-09-29 13:02:48.000000000 +0200
152--- src/if_ruby.c 2010-10-22 21:50:04.000000000 +0200
153***************
154*** 55,61 ****
155 # define symbol_from_dll dlsym
156 # define close_dll dlclose
157 #else
158! # define load_dll LoadLibrary
159 # define symbol_from_dll GetProcAddress
160 # define close_dll FreeLibrary
161 #endif
162--- 55,61 ----
163 # define symbol_from_dll dlsym
164 # define close_dll dlclose
165 #else
166! # define load_dll vimLoadLib
167 # define symbol_from_dll GetProcAddress
168 # define close_dll FreeLibrary
169 #endif
170*** ../vim-7.3.033/src/mbyte.c 2010-09-18 13:36:41.000000000 +0200
171--- src/mbyte.c 2010-10-22 21:50:09.000000000 +0200
172***************
173*** 4159,4169 ****
174 {
175 if (hIconvDLL != 0 && hMsvcrtDLL != 0)
176 return TRUE;
177! hIconvDLL = LoadLibrary(DYNAMIC_ICONV_DLL);
178 if (hIconvDLL == 0) /* sometimes it's called libiconv.dll */
179! hIconvDLL = LoadLibrary(DYNAMIC_ICONV_DLL_ALT);
180 if (hIconvDLL != 0)
181! hMsvcrtDLL = LoadLibrary(DYNAMIC_MSVCRT_DLL);
182 if (hIconvDLL == 0 || hMsvcrtDLL == 0)
183 {
184 /* Only give the message when 'verbose' is set, otherwise it might be
185--- 4159,4169 ----
186 {
187 if (hIconvDLL != 0 && hMsvcrtDLL != 0)
188 return TRUE;
189! hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL);
190 if (hIconvDLL == 0) /* sometimes it's called libiconv.dll */
191! hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT);
192 if (hIconvDLL != 0)
193! hMsvcrtDLL = vimLoadLib(DYNAMIC_MSVCRT_DLL);
194 if (hIconvDLL == 0 || hMsvcrtDLL == 0)
195 {
196 /* Only give the message when 'verbose' is set, otherwise it might be
197*** ../vim-7.3.033/src/os_mswin.c 2010-08-15 21:57:29.000000000 +0200
198--- src/os_mswin.c 2010-10-22 22:03:26.000000000 +0200
199***************
200*** 817,823 ****
201--- 817,827 ----
202 BOOL fRunTimeLinkSuccess = FALSE;
203
204 // Get a handle to the DLL module.
205+ # ifdef WIN16
206 hinstLib = LoadLibrary(libname);
207+ # else
208+ hinstLib = vimLoadLib(libname);
209+ # endif
210
211 // If the handle is valid, try to get the function address.
212 if (hinstLib != NULL)
213*** ../vim-7.3.033/src/os_win32.c 2010-10-13 20:37:37.000000000 +0200
214--- src/os_win32.c 2010-10-23 13:16:55.000000000 +0200
215***************
216*** 206,247 ****
217 static int suppress_winsize = 1; /* don't fiddle with console */
218 #endif
219
220 static void
221 get_exe_name(void)
222 {
223! char temp[256];
224! static int did_set_PATH = FALSE;
225
226 if (exe_name == NULL)
227 {
228 /* store the name of the executable, may be used for $VIM */
229! GetModuleFileName(NULL, temp, 255);
230 if (*temp != NUL)
231 exe_name = FullName_save((char_u *)temp, FALSE);
232 }
233
234! if (!did_set_PATH && exe_name != NULL)
235 {
236! char_u *p;
237! char_u *newpath;
238!
239! /* Append our starting directory to $PATH, so that when doing "!xxd"
240! * it's found in our starting directory. Needed because SearchPath()
241! * also looks there. */
242! p = mch_getenv("PATH");
243! newpath = alloc((unsigned)(STRLEN(p) + STRLEN(exe_name) + 2));
244! if (newpath != NULL)
245! {
246! STRCPY(newpath, p);
247! STRCAT(newpath, ";");
248! vim_strncpy(newpath + STRLEN(newpath), exe_name,
249! gettail_sep(exe_name) - exe_name);
250! vim_setenv((char_u *)"PATH", newpath);
251! vim_free(newpath);
252 }
253
254! did_set_PATH = TRUE;
255 }
256 }
257
258 #if defined(DYNAMIC_GETTEXT) || defined(PROTO)
259--- 206,268 ----
260 static int suppress_winsize = 1; /* don't fiddle with console */
261 #endif
262
263+ static char_u *exe_path = NULL;
264+
265 static void
266 get_exe_name(void)
267 {
268! char temp[MAXPATHL];
269! char_u *p;
270
271 if (exe_name == NULL)
272 {
273 /* store the name of the executable, may be used for $VIM */
274! GetModuleFileName(NULL, temp, MAXPATHL - 1);
275 if (*temp != NUL)
276 exe_name = FullName_save((char_u *)temp, FALSE);
277 }
278
279! if (exe_path == NULL && exe_name != NULL)
280 {
281! exe_path = vim_strnsave(exe_name, gettail_sep(exe_name) - exe_name);
282! if (exe_path != NULL)
283! {
284! /* Append our starting directory to $PATH, so that when doing
285! * "!xxd" it's found in our starting directory. Needed because
286! * SearchPath() also looks there. */
287! p = mch_getenv("PATH");
288! if (STRLEN(p) + STRLEN(exe_path) + 2 < MAXPATHL);
289! {
290! STRCPY(temp, p);
291! STRCAT(temp, ";");
292! STRCAT(temp, exe_path);
293! vim_setenv((char_u *)"PATH", temp);
294! }
295 }
296+ }
297+ }
298+
299+ /*
300+ * Load library "name".
301+ */
302+ HINSTANCE
303+ vimLoadLib(char *name)
304+ {
305+ HINSTANCE dll = NULL;
306+ char old_dir[MAXPATHL];
307
308! if (exe_path == NULL)
309! get_exe_name();
310! if (exe_path != NULL && mch_dirname(old_dir, MAXPATHL) == OK)
311! {
312! /* Change directory to where the executable is, both to make sure we
313! * find a .dll there and to avoid looking for a .dll in the current
314! * directory. */
315! mch_chdir(exe_path);
316! dll = LoadLibrary(name);
317! mch_chdir(old_dir);
318 }
319+ return dll;
320 }
321
322 #if defined(DYNAMIC_GETTEXT) || defined(PROTO)
323***************
324*** 254,260 ****
325 static char *null_libintl_bindtextdomain(const char *, const char *);
326 static char *null_libintl_bind_textdomain_codeset(const char *, const char *);
327
328! static HINSTANCE hLibintlDLL = 0;
329 char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext;
330 char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain;
331 char *(*dyn_libintl_bindtextdomain)(const char *, const char *)
332--- 275,281 ----
333 static char *null_libintl_bindtextdomain(const char *, const char *);
334 static char *null_libintl_bind_textdomain_codeset(const char *, const char *);
335
336! static HINSTANCE hLibintlDLL = NULL;
337 char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext;
338 char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain;
339 char *(*dyn_libintl_bindtextdomain)(const char *, const char *)
340***************
341*** 282,307 ****
342 if (hLibintlDLL)
343 return 1;
344 /* Load gettext library (libintl.dll) */
345! hLibintlDLL = LoadLibrary(libname != NULL ? libname : GETTEXT_DLL);
346 if (!hLibintlDLL)
347 {
348! char_u dirname[_MAX_PATH];
349!
350! /* Try using the path from gvim.exe to find the .dll there. */
351! get_exe_name();
352! STRCPY(dirname, exe_name);
353! STRCPY(gettail(dirname), GETTEXT_DLL);
354! hLibintlDLL = LoadLibrary((char *)dirname);
355! if (!hLibintlDLL)
356 {
357! if (p_verbose > 0)
358! {
359! verbose_enter();
360! EMSG2(_(e_loadlib), GETTEXT_DLL);
361! verbose_leave();
362! }
363! return 0;
364 }
365 }
366 for (i = 0; libintl_entry[i].name != NULL
367 && libintl_entry[i].ptr != NULL; ++i)
368--- 303,318 ----
369 if (hLibintlDLL)
370 return 1;
371 /* Load gettext library (libintl.dll) */
372! hLibintlDLL = vimLoadLib(libname != NULL ? libname : GETTEXT_DLL);
373 if (!hLibintlDLL)
374 {
375! if (p_verbose > 0)
376 {
377! verbose_enter();
378! EMSG2(_(e_loadlib), GETTEXT_DLL);
379! verbose_leave();
380 }
381+ return 0;
382 }
383 for (i = 0; libintl_entry[i].name != NULL
384 && libintl_entry[i].ptr != NULL; ++i)
385***************
386*** 430,436 ****
387 * Seems like a lot of overhead to load/unload ADVAPI32.DLL each
388 * time we verify security...
389 */
390! advapi_lib = LoadLibrary("ADVAPI32.DLL");
391 if (advapi_lib != NULL)
392 {
393 pSetNamedSecurityInfo = (PSNSECINFO)GetProcAddress(advapi_lib,
394--- 441,447 ----
395 * Seems like a lot of overhead to load/unload ADVAPI32.DLL each
396 * time we verify security...
397 */
398! advapi_lib = vimLoadLib("ADVAPI32.DLL");
399 if (advapi_lib != NULL)
400 {
401 pSetNamedSecurityInfo = (PSNSECINFO)GetProcAddress(advapi_lib,
402*** ../vim-7.3.033/src/proto/os_win32.pro 2010-08-15 21:57:28.000000000 +0200
403--- src/proto/os_win32.pro 2010-10-22 22:05:35.000000000 +0200
404***************
405*** 1,4 ****
406--- 1,5 ----
407 /* os_win32.c */
408+ HINSTANCE vimLoadLib __ARGS((char *name));
409 int dyn_libintl_init __ARGS((char *libname));
410 void dyn_libintl_end __ARGS((void));
411 void PlatformId __ARGS((void));
412*** ../vim-7.3.033/src/version.c 2010-10-22 22:13:47.000000000 +0200
413--- src/version.c 2010-10-23 13:55:21.000000000 +0200
414***************
415*** 716,717 ****
416--- 716,719 ----
417 { /* Add new patch number below this line */
418+ /**/
419+ 34,
420 /**/
421
422--
423This is the polymorph virus! Follow these instructions carefully:
4241. Send this message to everybody you know.
4252. Format your harddisk.
426Thank you for your cooperation in spreading the most powerful virus ever!
427
428 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
429/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
430\\\ download, build and distribute -- http://www.A-A-P.org ///
431 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
This page took 0.099043 seconds and 4 git commands to generate.