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