changeset 24563:30ad18017e1c v8.2.2821

patch 8.2.2821: MS-Windows: unnessarily loading libraries when registering OLE Commit: https://github.com/vim/vim/commit/3d0e7a956afb6f913466e96bd462eff0c92ad4c6 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 1 17:46:03 2021 +0200 patch 8.2.2821: MS-Windows: unnessarily loading libraries when registering OLE Problem: MS-Windows: unnessarily loading libraries when registering OLE. Solution: Skip loading libraries when invoked with "-register".
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 May 2021 18:00:06 +0200
parents 557e50935ce4
children 0099ec55d9c8
files src/globals.h src/main.c src/os_win32.c src/version.c
diffstat 4 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/globals.h
+++ b/src/globals.h
@@ -1311,6 +1311,7 @@ EXTERN int  wild_menu_showing INIT(= 0);
 #ifdef MSWIN
 EXTERN char_u	toupper_tab[256];	// table for toupper()
 EXTERN char_u	tolower_tab[256];	// table for tolower()
+EXTERN int	found_register_arg INIT(= FALSE);
 #endif
 
 #ifdef FEAT_LINEBREAK
--- a/src/main.c
+++ b/src/main.c
@@ -161,6 +161,20 @@ main
 	    break;
 	}
 #endif
+#ifdef MSWIN
+    // Need to find "-register" before loading any libraries.
+    for (i = 1; i < argc; ++i)
+	if (STRICMP(argv[i] + 1, "register") == 0
+				   && (argv[i][0] == '-' || argv[i][0] == '/'))
+	{
+	    found_register_arg = TRUE;
+	    break;
+	}
+#endif
+
+    /*
+     * Various initialisations shared with tests.
+     */
     common_init(&params);
 
 #ifdef VIMDLL
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -529,6 +529,10 @@ vimLoadLib(char *name)
 {
     HINSTANCE	dll = NULL;
 
+    // No need to load any library when registering OLE.
+    if (found_register_arg)
+	return dll;
+
     // NOTE: Do not use mch_dirname() and mch_chdir() here, they may call
     // vimLoadLib() recursively, which causes a stack overflow.
     if (exe_path == NULL)
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2821,
+/**/
     2820,
 /**/
     2819,