comparison src/GvimExt/gvimext.cpp @ 3008:37a54a85413e v7.3.276

updated for version 7.3.276 Problem: GvimExt sets $LANG in the wrong way. Solution: Save the environment and use it for gvim. (Yasuhiro Matsumoto)
author Bram Moolenaar <bram@vim.org>
date Wed, 10 Aug 2011 16:31:23 +0200
parents bdc3335bd72e
children 04736b4030ec
comparison
equal deleted inserted replaced
3007:166af06c6ac4 3008:37a54a85413e
140 static char *null_libintl_textdomain(const char *); 140 static char *null_libintl_textdomain(const char *);
141 static char *null_libintl_bindtextdomain(const char *, const char *); 141 static char *null_libintl_bindtextdomain(const char *, const char *);
142 static int dyn_libintl_init(char *dir); 142 static int dyn_libintl_init(char *dir);
143 static void dyn_libintl_end(void); 143 static void dyn_libintl_end(void);
144 144
145 static wchar_t *oldenv = NULL;
145 static HINSTANCE hLibintlDLL = 0; 146 static HINSTANCE hLibintlDLL = 0;
146 static char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext; 147 static char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext;
147 static char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain; 148 static char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain;
148 static char *(*dyn_libintl_bindtextdomain)(const char *, const char *) 149 static char *(*dyn_libintl_bindtextdomain)(const char *, const char *)
149 = null_libintl_bindtextdomain; 150 = null_libintl_bindtextdomain;
337 338
338 static void 339 static void
339 inc_cRefThisDLL() 340 inc_cRefThisDLL()
340 { 341 {
341 #ifdef FEAT_GETTEXT 342 #ifdef FEAT_GETTEXT
342 if (g_cRefThisDll == 0) 343 if (g_cRefThisDll == 0) {
343 dyn_gettext_load(); 344 dyn_gettext_load();
345 oldenv = GetEnvironmentStringsW();
346 }
344 #endif 347 #endif
345 InterlockedIncrement((LPLONG)&g_cRefThisDll); 348 InterlockedIncrement((LPLONG)&g_cRefThisDll);
346 } 349 }
347 350
348 static void 351 static void
349 dec_cRefThisDLL() 352 dec_cRefThisDLL()
350 { 353 {
351 #ifdef FEAT_GETTEXT 354 #ifdef FEAT_GETTEXT
352 if (InterlockedDecrement((LPLONG)&g_cRefThisDll) == 0) 355 if (InterlockedDecrement((LPLONG)&g_cRefThisDll) == 0) {
353 dyn_gettext_free(); 356 dyn_gettext_free();
357 if (oldenv != NULL) {
358 FreeEnvironmentStringsW(oldenv);
359 oldenv = NULL;
360 }
361 }
354 #else 362 #else
355 InterlockedDecrement((LPLONG)&g_cRefThisDll); 363 InterlockedDecrement((LPLONG)&g_cRefThisDll);
356 #endif 364 #endif
357 } 365 }
358 366
903 if (!CreateProcessW(NULL, // No module name (use command line). 911 if (!CreateProcessW(NULL, // No module name (use command line).
904 cmdStrW, // Command line. 912 cmdStrW, // Command line.
905 NULL, // Process handle not inheritable. 913 NULL, // Process handle not inheritable.
906 NULL, // Thread handle not inheritable. 914 NULL, // Thread handle not inheritable.
907 FALSE, // Set handle inheritance to FALSE. 915 FALSE, // Set handle inheritance to FALSE.
908 0, // No creation flags. 916 oldenv == NULL ? 0 : CREATE_UNICODE_ENVIRONMENT,
909 NULL, // Use parent's environment block. 917 oldenv, // Use unmodified environment block.
910 NULL, // Use parent's starting directory. 918 NULL, // Use parent's starting directory.
911 &si, // Pointer to STARTUPINFO structure. 919 &si, // Pointer to STARTUPINFO structure.
912 &pi) // Pointer to PROCESS_INFORMATION structure. 920 &pi) // Pointer to PROCESS_INFORMATION structure.
913 ) 921 )
914 { 922 {
985 if (!CreateProcessW(NULL, // No module name (use command line). 993 if (!CreateProcessW(NULL, // No module name (use command line).
986 cmdStrW, // Command line. 994 cmdStrW, // Command line.
987 NULL, // Process handle not inheritable. 995 NULL, // Process handle not inheritable.
988 NULL, // Thread handle not inheritable. 996 NULL, // Thread handle not inheritable.
989 FALSE, // Set handle inheritance to FALSE. 997 FALSE, // Set handle inheritance to FALSE.
990 0, // No creation flags. 998 oldenv == NULL ? 0 : CREATE_UNICODE_ENVIRONMENT,
991 NULL, // Use parent's environment block. 999 oldenv, // Use unmodified environment block.
992 NULL, // Use parent's starting directory. 1000 NULL, // Use parent's starting directory.
993 &si, // Pointer to STARTUPINFO structure. 1001 &si, // Pointer to STARTUPINFO structure.
994 &pi) // Pointer to PROCESS_INFORMATION structure. 1002 &pi) // Pointer to PROCESS_INFORMATION structure.
995 ) 1003 )
996 { 1004 {