summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-05-01 17:46:03 +0200
committerBram Moolenaar <Bram@vim.org>2021-05-01 17:46:03 +0200
commit3d0e7a956afb6f913466e96bd462eff0c92ad4c6 (patch)
treed0860b358f7827044ff9bc2b4a99949cc3fdd03d
parentb6c2e9a010ebd7db586081957e634903d4972fa1 (diff)
downloadvim-git-3d0e7a956afb6f913466e96bd462eff0c92ad4c6.tar.gz
patch 8.2.2821: MS-Windows: unnessarily loading libraries when registering OLEv8.2.2821
Problem: MS-Windows: unnessarily loading libraries when registering OLE. Solution: Skip loading libraries when invoked with "-register".
-rw-r--r--src/globals.h1
-rw-r--r--src/main.c14
-rw-r--r--src/os_win32.c4
-rw-r--r--src/version.c2
4 files changed, 21 insertions, 0 deletions
diff --git a/src/globals.h b/src/globals.h
index 5e6b6461d..b6541a4f4 100644
--- 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
diff --git a/src/main.c b/src/main.c
index 30014d4be..686fb1432 100644
--- 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
diff --git a/src/os_win32.c b/src/os_win32.c
index d40d0332c..3bfeee66e 100644
--- 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)
diff --git a/src/version.c b/src/version.c
index ed632f7ba..8140e20fa 100644
--- 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,