diff src/GvimExt/gvimext.cpp @ 12626:aca41efd888c v8.0.1191

patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer commit https://github.com/vim/vim/commit/6199d43f4b59a9bb1c87d408c5b33fa19a23ebcd Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 14 19:05:44 2017 +0200 patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer Problem: MS-Windows: missing 32 and 64 bit files in installer. Solution: Include both 32 and 64 bit GvimExt and related dll files. Remove old Windows code from the installer. (Ken Takata, closes #2144)
author Christian Brabandt <cb@256bit.org>
date Sat, 14 Oct 2017 19:15:04 +0200
parents 1e48ffa2d697
children 013b70517b1a
line wrap: on
line diff
--- a/src/GvimExt/gvimext.cpp
+++ b/src/GvimExt/gvimext.cpp
@@ -38,7 +38,7 @@ STGMEDIUM medium;
 HRESULT hres = 0;
 UINT cbFiles = 0;
 
-/* The buffers size used to be MAX_PATH (256 bytes), but that's not always
+/* The buffers size used to be MAX_PATH (260 bytes), but that's not always
  * enough */
 #define BUFSIZE 1100
 
@@ -203,7 +203,7 @@ dyn_libintl_init(char *dir)
     if (hLibintlDLL)
 	return 1;
 
-    // Load gettext library from the Vim runtime directory.
+    // Load gettext library from $VIMRUNTIME\GvimExt{64,32} directory.
     // Add the directory to $PATH temporarily.
     len = GetEnvironmentVariableW(L"PATH", NULL, 0);
     len2 = MAX_PATH + 1 + len;
@@ -212,7 +212,11 @@ dyn_libintl_init(char *dir)
     if (buf != NULL && buf2 != NULL)
     {
 	GetEnvironmentVariableW(L"PATH", buf, len);
-	_snwprintf(buf2, len2, L"%S;%s", dir, buf);
+#ifdef _WIN64
+	_snwprintf(buf2, len2, L"%S\\GvimExt64;%s", dir, buf);
+#else
+	_snwprintf(buf2, len2, L"%S\\GvimExt32;%s", dir, buf);
+#endif
 	SetEnvironmentVariableW(L"PATH", buf2);
 	hLibintlDLL = LoadLibrary(GETTEXT_DLL);
 #ifdef GETTEXT_DLL_ALT
@@ -883,37 +887,7 @@ BOOL CShellExt::LoadMenuIcon()
 	return TRUE;
 }
 
-#ifdef WIN32
-// This symbol is not defined in older versions of the SDK or Visual C++.
-
-#ifndef VER_PLATFORM_WIN32_WINDOWS
-# define VER_PLATFORM_WIN32_WINDOWS 1
-#endif
-
-static DWORD g_PlatformId;
-
-//
-// Set g_PlatformId to VER_PLATFORM_WIN32_NT (NT) or
-// VER_PLATFORM_WIN32_WINDOWS (Win95).
-//
-    static void
-PlatformId(void)
-{
-    static int done = FALSE;
-
-    if (!done)
-    {
-	OSVERSIONINFO ovi;
-
-	ovi.dwOSVersionInfoSize = sizeof(ovi);
-	GetVersionEx(&ovi);
-
-	g_PlatformId = ovi.dwPlatformId;
-	done = TRUE;
-    }
-}
-
-# ifndef __BORLANDC__
+#ifndef __BORLANDC__
     static char *
 searchpath(char *name)
 {
@@ -922,28 +896,17 @@ searchpath(char *name)
 
     // There appears to be a bug in FindExecutableA() on Windows NT.
     // Use FindExecutableW() instead...
-    PlatformId();
-    if (g_PlatformId == VER_PLATFORM_WIN32_NT)
+    MultiByteToWideChar(CP_ACP, 0, (LPCSTR)name, -1,
+	    (LPWSTR)widename, BUFSIZE);
+    if (FindExecutableW((LPCWSTR)widename, (LPCWSTR)"",
+		(LPWSTR)location) > (HINSTANCE)32)
     {
-	MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)name, -1,
-		(LPWSTR)widename, BUFSIZE);
-	if (FindExecutableW((LPCWSTR)widename, (LPCWSTR)"",
-		    (LPWSTR)location) > (HINSTANCE)32)
-	{
-	    WideCharToMultiByte(CP_ACP, 0, (LPWSTR)location, -1,
-		    (LPSTR)widename, 2 * BUFSIZE, NULL, NULL);
-	    return widename;
-	}
-    }
-    else
-    {
-	if (FindExecutableA((LPCTSTR)name, (LPCTSTR)"",
-		    (LPTSTR)location) > (HINSTANCE)32)
-	    return location;
+	WideCharToMultiByte(CP_ACP, 0, (LPWSTR)location, -1,
+		(LPSTR)widename, 2 * BUFSIZE, NULL, NULL);
+	return widename;
     }
     return (char *)"";
 }
-# endif
 #endif
 
 STDMETHODIMP CShellExt::InvokeGvim(HWND hParent,