To: vim-dev@vim.org Subject: Patch 6.1.243 (extra) Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.243 (extra) Problem: Win32: When the OLE version is started and wasn't registered, a message pops up to suggest registering, even when this isn't possible (when the registry is not writable). Solution: Check if registering is possible before asking whether it should be done. (Walter Briscoe) Also avoid restarting Vim after registering. Files: src/if_ole.cpp *** ../vim61.242/src/if_ole.cpp Fri Aug 24 11:54:37 2001 --- src/if_ole.cpp Sun Oct 27 21:00:44 2002 *************** *** 124,141 **** // Load the type library from the registry hr = LoadRegTypeLib(MYLIBID, 1, 0, 0x00, &typelib); - if (FAILED(hr)) { ! delete me; if (MessageBox(0, "Cannot load registered type library.\nDo you want to register Vim now?", ! "Vim Initialisation", MB_YESNO | MB_ICONQUESTION) == IDYES) { ! RegisterMe(FALSE); ! MessageBox(0, "You must restart Vim in order for the registration to take effect.", "Vim Initialisation", 0); *pbDoRestart = TRUE; } - return NULL; } // Get the type info of the vtable interface --- 124,162 ---- // Load the type library from the registry hr = LoadRegTypeLib(MYLIBID, 1, 0, 0x00, &typelib); if (FAILED(hr)) { ! HKEY hKey; ! ! // Check we can write to the registry. ! // RegCreateKeyEx succeeds even if key exists. W.Briscoe W2K 20021011 ! if (RegCreateKeyEx(HKEY_CLASSES_ROOT, MYVIPROGID, 0, NULL, ! REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL)) ! { ! delete me; ! return NULL; // Unable to write to registry. Quietly fail. ! } ! RegCloseKey(hKey); ! if (MessageBox(0, "Cannot load registered type library.\nDo you want to register Vim now?", ! "Vim Initialisation", MB_YESNO | MB_ICONQUESTION) != IDYES) ! { ! delete me; ! return NULL; ! } ! ! RegisterMe(FALSE); ! ! // Load the type library from the registry ! hr = LoadRegTypeLib(MYLIBID, 1, 0, 0x00, &typelib); ! if (FAILED(hr)) { ! MessageBox(0, "You must restart Vim in order for the registration to take effect.", ! "Vim Initialisation", 0); *pbDoRestart = TRUE; + delete me; + return NULL; } } // Get the type info of the vtable interface *************** *** 144,150 **** if (FAILED(hr)) { ! MessageBox(0, "Cannot get interface type information", "Vim Initialisation", 0); delete me; return NULL; } --- 165,172 ---- if (FAILED(hr)) { ! MessageBox(0, "Cannot get interface type information", ! "Vim Initialisation", 0); delete me; return NULL; } *** ../vim61.242/src/version.c Sun Oct 27 20:54:51 2002 --- src/version.c Sun Oct 27 21:00:50 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 243, /**/ -- WOMAN: Dennis, there's some lovely filth down here. Oh -- how d'you do? ARTHUR: How do you do, good lady. I am Arthur, King of the Britons. Who's castle is that? WOMAN: King of the who? The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///