Loading ...
Sorry, an error occurred while loading the content.

Patch 6.2.524 (extra)

Expand Messages
  • Bram Moolenaar
    Patch 6.2.524 (extra, after 6.2.520) Problem: Win32: (un)installing gvimext.dll may fail if it was used. The desktop and start menu links are created for
    Message 1 of 1 , May 4 7:21 AM
    • 0 Attachment
      Patch 6.2.524 (extra, after 6.2.520)
      Problem: Win32: (un)installing gvimext.dll may fail if it was used.
      The desktop and start menu links are created for the current user
      instead of all users.
      Using the home directory as working directory for the links is a
      bad idea for multi-user systems.
      Cannot use Vim from the "Open With..." menu.
      Solution: Force a reboot if necessary. (Alejandro Lopez-Valencia) Also use
      macros for the directory of the source and runtime files. Use
      "CSIDL_COMMON_*" instead of "CSIDL_*" when possible.
      Do not specify a working directory in the links.
      Add Vim to the "Open With..." menu. (Giuseppe Bilotta)
      Files: nsis/gvim.nsi, src/dosinst.c, src/dosinst.h, src/uninstal.c


      *** ../vim-6.2.523/nsis/gvim.nsi Sun May 2 16:57:24 2004
      --- nsis/gvim.nsi Tue May 4 15:49:21 2004
      ***************
      *** 3,11 ****
      # Last change: 2004 May 02

      # WARNING: if you make changes to this script, look out for $0 to be valid,
      ! # because this line is very dangerous: RMDir /r $0

      ! # comment next line if you don't have UPX.
      # Get it at http://upx.sourceforge.net
      !define HAVE_UPX

      --- 3,20 ----
      # Last change: 2004 May 02

      # WARNING: if you make changes to this script, look out for $0 to be valid,
      ! # because uninstall deletes most files in $0.

      ! # Location of gvim_ole.exe, vimd32.exe, GvimExt/*, etc.
      ! !define VIMSRC "..\src"
      !
      ! # Location of runtime files
      ! !define VIMRT ".."
      !
      ! # Location of extra tools: diff.exe
      ! !define VIMTOOLS ..\..
      !
      ! # Comment the next line if you don't have UPX.
      # Get it at http://upx.sourceforge.net
      !define HAVE_UPX

      ***************
      *** 15,20 ****
      --- 24,33 ----
      !define VER_MINOR 2
      !define VER_MAJOR 6

      + # ----------- No configurable settings below this line -----------
      +
      + !include UpgradeDLL.nsh # for VisVim.dll
      +
      Name "Vim ${VER_MAJOR}.${VER_MINOR}"
      OutFile gvim${VER_MAJOR}${VER_MINOR}.exe
      CRCCheck force
      ***************
      *** 31,44 ****
      UninstallIcon icons\vim_uninst_16c.ico
      BGGradient 004000 008200 FFFFFF
      LicenseText "You should read the following before installing:"
      ! LicenseData ..\doc\uganda.nsis.txt

      !ifdef HAVE_UPX
      !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
      !endif

      # This adds '\vim' to the user choice automagically.
      ! InstallDir $PROGRAMFILES\Vim

      # Types of installs we can perform:
      InstType Typical
      --- 44,57 ----
      UninstallIcon icons\vim_uninst_16c.ico
      BGGradient 004000 008200 FFFFFF
      LicenseText "You should read the following before installing:"
      ! LicenseData ${VIMRT}\doc\uganda.nsis.txt

      !ifdef HAVE_UPX
      !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
      !endif

      # This adds '\vim' to the user choice automagically.
      ! InstallDir "$PROGRAMFILES\Vim"

      # Types of installs we can perform:
      InstType Typical
      ***************
      *** 59,65 ****

      # run the install program to check for already installed versions
      SetOutPath $TEMP
      ! File /oname=install.exe ..\src\installw32.exe
      ExecWait "$TEMP\install.exe -uninstall-check"
      Delete $TEMP\install.exe

      --- 72,78 ----

      # run the install program to check for already installed versions
      SetOutPath $TEMP
      ! File /oname=install.exe ${VIMSRC}\installw32.exe
      ExecWait "$TEMP\install.exe -uninstall-check"
      Delete $TEMP\install.exe

      ***************
      *** 153,200 ****
      StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"

      SetOutPath $0
      ! File /oname=gvim.exe ..\src\gvim_ole.exe
      ! File /oname=install.exe ..\src\installw32.exe
      ! File /oname=uninstal.exe ..\src\uninstalw32.exe
      ! File ..\src\vimrun.exe
      ! File /oname=xxd.exe ..\src\xxdw32.exe
      ! File ..\..\diff.exe
      ! File ..\vimtutor.bat
      ! File ..\README.txt
      File ..\uninstal.txt
      ! File ..\*.vim
      ! File ..\rgb.txt

      SetOutPath $0\colors
      ! File ..\colors\*.*

      SetOutPath $0\compiler
      ! File ..\compiler\*.*

      SetOutPath $0\doc
      ! File ..\doc\*.txt
      ! File ..\doc\tags

      SetOutPath $0\ftplugin
      ! File ..\ftplugin\*.*

      SetOutPath $0\indent
      ! File ..\indent\*.*

      SetOutPath $0\macros
      ! File ..\macros\*.*

      SetOutPath $0\plugin
      ! File ..\plugin\*.*

      SetOutPath $0\syntax
      ! File ..\syntax\*.*

      SetOutPath $0\tools
      ! File ..\tools\*.*

      SetOutPath $0\tutor
      ! File ..\tutor\*.*
      SectionEnd

      ##########################################################
      --- 166,213 ----
      StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"

      SetOutPath $0
      ! File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe
      ! File /oname=install.exe ${VIMSRC}\installw32.exe
      ! File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe
      ! File ${VIMSRC}\vimrun.exe
      ! File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
      ! File ${VIMTOOLS}\diff.exe
      ! File ${VIMRT}\vimtutor.bat
      ! File ${VIMRT}\README.txt
      File ..\uninstal.txt
      ! File ${VIMRT}\*.vim
      ! File ${VIMRT}\rgb.txt

      SetOutPath $0\colors
      ! File ${VIMRT}\colors\*.*

      SetOutPath $0\compiler
      ! File ${VIMRT}\compiler\*.*

      SetOutPath $0\doc
      ! File ${VIMRT}\doc\*.txt
      ! File ${VIMRT}\doc\tags

      SetOutPath $0\ftplugin
      ! File ${VIMRT}\ftplugin\*.*

      SetOutPath $0\indent
      ! File ${VIMRT}\indent\*.*

      SetOutPath $0\macros
      ! File ${VIMRT}\macros\*.*

      SetOutPath $0\plugin
      ! File ${VIMRT}\plugin\*.*

      SetOutPath $0\syntax
      ! File ${VIMRT}\syntax\*.*

      SetOutPath $0\tools
      ! File ${VIMRT}\tools\*.*

      SetOutPath $0\tutor
      ! File ${VIMRT}\tutor\*.*
      SectionEnd

      ##########################################################
      ***************
      *** 206,221 ****
      "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
      IfErrors 0 lbl_winnt
      # Windows 95/98/ME
      ! File /oname=vim.exe ..\src\vimd32.exe
      Goto lbl_done
      lbl_winnt:
      # Windows NT/2000/XT
      ! File /oname=vim.exe ..\src\vimw32.exe
      lbl_done:
      StrCpy $2 "$2 vim view vimdiff"
      SectionEnd

      ##########################################################
      Section "Create icons on the Desktop"
      SectionIn 1 3

      --- 219,241 ----
      "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
      IfErrors 0 lbl_winnt
      # Windows 95/98/ME
      ! File /oname=vim.exe ${VIMSRC}\vimd32.exe
      Goto lbl_done
      lbl_winnt:
      # Windows NT/2000/XT
      ! File /oname=vim.exe ${VIMSRC}\vimw32.exe
      lbl_done:
      StrCpy $2 "$2 vim view vimdiff"
      SectionEnd

      ##########################################################
      + Section "Create .bat files for command line use"
      + SectionIn 3
      +
      + StrCpy $1 "$1 -create-batfiles $2"
      + SectionEnd
      +
      + ##########################################################
      Section "Create icons on the Desktop"
      SectionIn 1 3

      ***************
      *** 233,241 ****
      Section "Add an Edit-with-Vim context menu entry"
      SectionIn 1 3

      SetOutPath $0
      ! File ..\src\GvimExt\gvimext.dll
      ! StrCpy $1 "$1 -install-popup"
      SectionEnd

      ##########################################################
      --- 253,284 ----
      Section "Add an Edit-with-Vim context menu entry"
      SectionIn 1 3

      + # Be aware of this sequence of events:
      + # - user uninstalls Vim, gvimext.dll can't be removed (it's in use) and
      + # is scheduled to be removed at next reboot.
      + # - user installs Vim in same directory, gvimext.dll still exists.
      + # If we now skip installing gvimext.dll, it will disappear at the next
      + # reboot. Thus when copying gvimext.dll fails always schedule it to be
      + # installed at the next reboot. Can't use UpgradeDLL!
      + # We don't ask the user to reboot, the old dll will keep on working.
      SetOutPath $0
      ! ClearErrors
      ! SetOverwrite try
      ! File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll
      ! IfErrors 0 GvimExtDone
      !
      ! # Can't copy gvimext.dll, create it under another name and rename it on
      ! # next reboot.
      ! GetTempFileName $3 $0
      ! File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll
      ! Rename /REBOOTOK $3 $0\gvimext.dll
      !
      ! GvimExtDone:
      ! SetOverwrite lastused
      !
      ! # We don't have a separate entry for the "Open With..." menu, assume
      ! # the user wants either both or none.
      ! StrCpy $1 "$1 -install-popup -install-openwith"
      SectionEnd

      ##########################################################
      ***************
      *** 246,258 ****
      SectionEnd

      ##########################################################
      - Section "Create .bat files for command line use"
      - SectionIn 3
      -
      - StrCpy $1 "$1 -create-batfiles $2"
      - SectionEnd
      -
      - ##########################################################
      Section "Create plugin directories in HOME or VIM"
      SectionIn 1 3

      --- 289,294 ----
      ***************
      *** 271,279 ****
      SectionIn 3

      SetOutPath $0
      ! File ..\src\VisVim\VisVim.dll
      ! File ..\src\VisVim\README_VisVim.txt
      ! ExecWait "regsvr32.exe /s $0\VisVim.dll"
      SectionEnd

      ##########################################################
      --- 307,314 ----
      SectionIn 3

      SetOutPath $0
      ! !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0"
      ! File ${VIMSRC}\VisVim\README_VisVim.txt
      SectionEnd

      ##########################################################
      ***************
      *** 282,293 ****
      SectionIn 1 3

      SetOutPath $0\lang
      ! File /r ..\lang\*.*
      SetOutPath $0\keymap
      ! File ..\keymap\README.txt
      ! File ..\keymap\*.vim
      SetOutPath $0
      ! File ..\libintl.dll
      SectionEnd
      !endif

      --- 317,328 ----
      SectionIn 1 3

      SetOutPath $0\lang
      ! File /r ${VIMRT}\lang\*.*
      SetOutPath $0\keymap
      ! File ${VIMRT}\keymap\README.txt
      ! File ${VIMRT}\keymap\*.vim
      SetOutPath $0
      ! File ${VIMRT}\libintl.dll
      SectionEnd
      !endif

      ***************
      *** 308,314 ****
      # created. Thus the "vim61" directory is included in it.
      StrCpy $0 "$INSTDIR"

      ! # If VisVim was installed, unregister the DLL
      IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim
      Has_VisVim:
      ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
      --- 343,349 ----
      # created. Thus the "vim61" directory is included in it.
      StrCpy $0 "$INSTDIR"

      ! # If VisVim was installed, unregister the DLL.
      IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim
      Has_VisVim:
      ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
      ***************
      *** 326,340 ****
      "Would you like to delete $0?$\n \
      $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes

      ! Delete /REBOOTOK $0\gvimext.dll
      ClearErrors
      ! RMDir /r $0

      IfErrors ErrorMess NoErrorMess
      ErrorMess:
      MessageBox MB_OK|MB_ICONEXCLAMATION \
      "Some files in $0 have not been deleted!$\nYou must do it manually."
      NoErrorMess:

      NoRemoveExes:
      # get the parent dir of the installation
      --- 361,397 ----
      "Would you like to delete $0?$\n \
      $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes

      ! Delete /REBOOTOK $0\*.dll
      ClearErrors
      ! # Remove everything but *.dll files. Avoids that
      ! # a lot remains when gvimext.dll cannot be deleted.
      ! RMDir /r $0\colors
      ! RMDir /r $0\compiler
      ! RMDir /r $0\doc
      ! RMDir /r $0\ftplugin
      ! RMDir /r $0\indent
      ! RMDir /r $0\macros
      ! RMDir /r $0\plugin
      ! RMDir /r $0\syntax
      ! RMDir /r $0\tools
      ! RMDir /r $0\tutor
      ! RMDir /r $0\VisVim
      ! RMDir /r $0\lang
      ! RMDir /r $0\keymap
      ! Delete $0\*.exe
      ! Delete $0\*.bat
      ! Delete $0\*.vim
      ! Delete $0\*.txt

      IfErrors ErrorMess NoErrorMess
      ErrorMess:
      MessageBox MB_OK|MB_ICONEXCLAMATION \
      "Some files in $0 have not been deleted!$\nYou must do it manually."
      NoErrorMess:
      +
      + # No error message if the "vim62" directory can't be removed, the
      + # gvimext.dll may still be there.
      + RMDir $0

      NoRemoveExes:
      # get the parent dir of the installation
      *** ../vim-6.2.523/src/dosinst.c Sun Apr 25 16:29:55 2004
      --- src/dosinst.c Mon May 3 22:24:47 2004
      ***************
      *** 32,38 ****
      --- 32,40 ----
      directory to write .bat files in */
      char *default_vim_dir = NULL; /* when not NULL, use this as the default
      install dir for NSIS */
      + #if 0
      char homedir[BUFSIZE]; /* home directory or "" */
      + #endif

      /*
      * Structure used for each choice the user can make.
      ***************
      *** 113,118 ****
      --- 115,123 ----
      /* non-zero when selected to install the popup menu entry. */
      static int install_popup = 0;

      + /* non-zero when selected to install the "Open with" entry. */
      + static int install_openwith = 0;
      +
      /* non-zero when need to add an uninstall entry in the registry */
      static int need_uninstall_entry = 0;

      ***************
      *** 679,684 ****
      --- 684,690 ----
      else
      *oldvimrc = NUL;

      + #if 0 /* currently not used */
      /*
      * Get default home directory.
      * Prefer $HOME if it's set. For Win NT use $HOMEDRIVE and $HOMEPATH.
      ***************
      *** 709,714 ****
      --- 715,721 ----
      *homedir = NUL;
      }
      }
      + #endif
      }

      /*
      ***************
      *** 1311,1316 ****
      --- 1318,1324 ----
      /*
      * Add some entries to the registry:
      * - to add "Edit with Vim" to the context * menu
      + * - to add Vim to the "Open with..." list
      * - to uninstall Vim
      */
      /*ARGSUSED*/
      ***************
      *** 1367,1372 ****
      --- 1375,1396 ----
      fprintf(fd, "\n");
      }

      + if (install_openwith)
      + {
      + char bufg[BUFSIZE];
      + struct stat st;
      +
      + printf("Creating \"Open with ...\" list entry\n");
      +
      + fprintf(fd, "[HKEY_CLASSES_ROOT\\Applications\\gvim.exe]\n\n");
      + fprintf(fd, "[HKEY_CLASSES_ROOT\\Applications\\gvim.exe\\shell]\n\n");
      + fprintf(fd, "[HKEY_CLASSES_ROOT\\Applications\\gvim.exe\\shell\\edit]\n\n");
      + fprintf(fd, "[HKEY_CLASSES_ROOT\\Applications\\gvim.exe\\shell\\edit\\command]\n");
      + fprintf(fd, "@=\"%sgvim.exe \\\"%%1\\\"\"\n\n", buf);
      + fprintf(fd, "[HKEY_CLASSES_ROOT\\.htm\\OpenWithList\\gvim.exe]\n\n");
      + fprintf(fd, "[HKEY_CLASSES_ROOT\\*\\OpenWithList\\gvim.exe]\n\n");
      + }
      +
      printf("Creating an uninstall entry\n");

      /* The registry entries for uninstalling the menu */
      ***************
      *** 1435,1440 ****
      --- 1459,1502 ----
      add_dummy_choice();
      }

      + static void
      + change_openwith_choice(int idx)
      + {
      + if (install_openwith == 0)
      + {
      + choices[idx].text = "Add Vim to the \"Open With...\" list in the popup menu for the right\n mouse button so that you can edit any file with Vim";
      + install_openwith = 1;
      + }
      + else
      + {
      + choices[idx].text = "Do NOT add Vim to the \"Open With...\" list in the popup menu for the\n right mouse button to edit any file with Vim";
      + install_openwith = 0;
      + }
      + }
      +
      + /*
      + * Only add the choice for the open-with menu entry when gvim.exe was found
      + * and and regedit.exe exist.
      + */
      + static void
      + init_openwith_choice(void)
      + {
      + if (has_gvim
      + #ifndef WIN3264
      + && searchpath("regedit.exe") != NULL
      + #endif
      + )
      + {
      + choices[choice_count].changefunc = change_openwith_choice;
      + choices[choice_count].installfunc = NULL;
      + choices[choice_count].active = 1;
      + change_openwith_choice(choice_count); /* set the text */
      + ++choice_count;
      + }
      + else
      + add_dummy_choice();
      + }
      +
      #ifdef WIN3264
      /* create_shortcut
      *
      ***************
      *** 1577,1582 ****
      --- 1639,1650 ----
      }

      /*
      + * We used to use "homedir" as the working directory, but that is a bad choice
      + * on multi-user systems. Not specifying a directory appears to work best.
      + */
      + #define WORKDIR ""
      +
      + /*
      * Create shortcut(s) in the Start Menu\Programs\Vim folder.
      */
      static void
      ***************
      *** 1587,1614 ****
      if (has_vim)
      {
      if (build_shortcut("Vim", "vim.exe", "",
      ! VIM_STARTMENU, homedir) == FAIL)
      return;
      if (build_shortcut("Vim Read-only", "vim.exe", "-R",
      ! VIM_STARTMENU, homedir) == FAIL)
      return;
      if (build_shortcut("Vim Diff", "vim.exe", "-d",
      ! VIM_STARTMENU, homedir) == FAIL)
      return;
      }
      if (has_gvim)
      {
      if (build_shortcut("gVim", "gvim.exe", "",
      ! VIM_STARTMENU, homedir) == FAIL)
      return;
      if (build_shortcut("gVim Easy", "gvim.exe", "-y",
      ! VIM_STARTMENU, homedir) == FAIL)
      return;
      if (build_shortcut("gVim Read-only", "gvim.exe", "-R",
      ! VIM_STARTMENU, homedir) == FAIL)
      return;
      if (build_shortcut("gVim Diff", "gvim.exe", "-d",
      ! VIM_STARTMENU, homedir) == FAIL)
      return;
      }
      if (build_shortcut("Uninstall",
      --- 1655,1682 ----
      if (has_vim)
      {
      if (build_shortcut("Vim", "vim.exe", "",
      ! VIM_STARTMENU, WORKDIR) == FAIL)
      return;
      if (build_shortcut("Vim Read-only", "vim.exe", "-R",
      ! VIM_STARTMENU, WORKDIR) == FAIL)
      return;
      if (build_shortcut("Vim Diff", "vim.exe", "-d",
      ! VIM_STARTMENU, WORKDIR) == FAIL)
      return;
      }
      if (has_gvim)
      {
      if (build_shortcut("gVim", "gvim.exe", "",
      ! VIM_STARTMENU, WORKDIR) == FAIL)
      return;
      if (build_shortcut("gVim Easy", "gvim.exe", "-y",
      ! VIM_STARTMENU, WORKDIR) == FAIL)
      return;
      if (build_shortcut("gVim Read-only", "gvim.exe", "-R",
      ! VIM_STARTMENU, WORKDIR) == FAIL)
      return;
      if (build_shortcut("gVim Diff", "gvim.exe", "-d",
      ! VIM_STARTMENU, WORKDIR) == FAIL)
      return;
      }
      if (build_shortcut("Uninstall",
      ***************
      *** 1621,1627 ****
      VIM_STARTMENU, installdir) == FAIL)
      return;
      if (build_shortcut("Help", has_gvim ? "gvim.exe" : "vim.exe", "-c h",
      ! VIM_STARTMENU, homedir) == FAIL)
      return;
      {
      char shell_folder_path[BUFSIZE];
      --- 1689,1695 ----
      VIM_STARTMENU, installdir) == FAIL)
      return;
      if (build_shortcut("Help", has_gvim ? "gvim.exe" : "vim.exe", "-c h",
      ! VIM_STARTMENU, WORKDIR) == FAIL)
      return;
      {
      char shell_folder_path[BUFSIZE];
      ***************
      *** 1674,1680 ****
      if (choices[idx].arg)
      {
      (void)build_shortcut(icon_names[0], "gvim.exe",
      ! "", "desktop", homedir);
      need_uninstall_entry = 1;
      }
      }
      --- 1742,1748 ----
      if (choices[idx].arg)
      {
      (void)build_shortcut(icon_names[0], "gvim.exe",
      ! "", "desktop", WORKDIR);
      need_uninstall_entry = 1;
      }
      }
      ***************
      *** 1685,1691 ****
      if (choices[idx].arg)
      {
      (void)build_shortcut(icon_names[1], "gvim.exe",
      ! "-y", "desktop", homedir);
      need_uninstall_entry = 1;
      }
      }
      --- 1753,1759 ----
      if (choices[idx].arg)
      {
      (void)build_shortcut(icon_names[1], "gvim.exe",
      ! "-y", "desktop", WORKDIR);
      need_uninstall_entry = 1;
      }
      }
      ***************
      *** 1696,1702 ****
      if (choices[idx].arg)
      {
      (void)build_shortcut(icon_names[2], "gvim.exe",
      ! "-R", "desktop", homedir);
      need_uninstall_entry = 1;
      }
      }
      --- 1764,1770 ----
      if (choices[idx].arg)
      {
      (void)build_shortcut(icon_names[2], "gvim.exe",
      ! "-R", "desktop", WORKDIR);
      need_uninstall_entry = 1;
      }
      }
      ***************
      *** 1974,1979 ****
      --- 2042,2050 ----
      /* Whether to add Vim to the popup menu */
      init_popup_choice();

      + /* Whether to add Vim to the "Open With..." menu */
      + init_openwith_choice();
      +
      /* Whether to add Vim to the Start Menu. */
      init_startmenu_choice();

      ***************
      *** 1995,2000 ****
      --- 2066,2073 ----
      printf(" Create a default _vimrc file if one does not already exist.\n");
      printf("-install-popup\n");
      printf(" Install the Edit-with-Vim context menu entry\n");
      + printf("-install-openwith\n");
      + printf(" Add Vim to the \"Open With...\" context menu list\n");
      #ifdef WIN3264
      printf("-add-start-menu");
      printf(" Add Vim to the start menu\n");
      ***************
      *** 2054,2059 ****
      --- 2127,2136 ----
      {
      init_popup_choice();
      }
      + else if (strcmp(argv[i], "-install-openwith") == 0)
      + {
      + init_openwith_choice();
      + }
      else if (strcmp(argv[i], "-add-start-menu") == 0)
      {
      init_startmenu_choice();
      ***************
      *** 2178,2184 ****
      "select each file type.\n"
      "An alternative is the option offered here: Install an \"Edit with Vim\"\n"
      "entry in the popup menu for the right mouse button. This means you can\n"
      ! "edit any file with Vim\n"
      ,
      "Add Vim to the Start menu\n"
      "-------------------------\n"
      --- 2255,2268 ----
      "select each file type.\n"
      "An alternative is the option offered here: Install an \"Edit with Vim\"\n"
      "entry in the popup menu for the right mouse button. This means you can\n"
      ! "edit any file with Vim.\n"
      ! ,
      ! "\"Open With...\" context menu entry\n"
      ! "--------------------------------\n"
      ! "(this choice is only available when gvim.exe is present)\n"
      ! "This option adds Vim to the \"Open With...\" entry in the popup menu for\n"
      ! "the right mouse button. This also makes it possible to edit HTML files\n"
      ! "directly from Internet Explorer.\n"
      ,
      "Add Vim to the Start menu\n"
      "-------------------------\n"
      ***************
      *** 2237,2243 ****
      (choices[i].installfunc)(i);

      /* Add some entries to the registry, if needed. */
      ! if (install_popup || (need_uninstall_entry && interactive) || !interactive)
      install_registry();

      #ifdef WIN3264
      --- 2321,2330 ----
      (choices[i].installfunc)(i);

      /* Add some entries to the registry, if needed. */
      ! if (install_popup
      ! || install_openwith
      ! || (need_uninstall_entry && interactive)
      ! || !interactive)
      install_registry();

      #ifdef WIN3264
      *** ../vim-6.2.523/src/dosinst.h Tue May 27 22:00:56 2003
      --- src/dosinst.h Mon May 3 22:56:17 2004
      ***************
      *** 213,228 ****
      /*
      * The following code was successfully built with make_mvc.mak.
      * The resulting executable worked on Windows 95, Millennium Edition, and
      ! * 2000 Professional.
      */
      ! LPITEMIDLIST pidl = 0; /* Pointer to an Item ID list allocated below */
      ! LPMALLOC pMalloc; /* Pointer to an IMalloc interface */
      ! int csidl;

      if (strcmp(shell_folder_name, "desktop") == 0)
      ! csidl = CSIDL_DESKTOP;
      else if (strncmp(shell_folder_name, "Programs", 8) == 0)
      ! csidl = CSIDL_PROGRAMS;
      else
      {
      printf("\nERROR (internal) unrecognised shell_folder_name: \"%s\"\n\n",
      --- 213,241 ----
      /*
      * The following code was successfully built with make_mvc.mak.
      * The resulting executable worked on Windows 95, Millennium Edition, and
      ! * 2000 Professional. But it was changed after testing...
      */
      ! LPITEMIDLIST pidl = 0; /* Pointer to an Item ID list allocated below */
      ! LPMALLOC pMalloc; /* Pointer to an IMalloc interface */
      ! int csidl;
      ! int alt_csidl = -1;
      ! static int desktop_csidl = -1;
      ! static int programs_csidl = -1;
      ! int *pcsidl;
      ! int r;

      if (strcmp(shell_folder_name, "desktop") == 0)
      ! {
      ! pcsidl = &desktop_csidl;
      ! csidl = CSIDL_COMMON_DESKTOPDIRECTORY;
      ! alt_csidl = CSIDL_DESKTOP;
      ! }
      else if (strncmp(shell_folder_name, "Programs", 8) == 0)
      ! {
      ! pcsidl = &programs_csidl;
      ! csidl = CSIDL_COMMON_PROGRAMS;
      ! alt_csidl = CSIDL_PROGRAMS;
      ! }
      else
      {
      printf("\nERROR (internal) unrecognised shell_folder_name: \"%s\"\n\n",
      ***************
      *** 230,235 ****
      --- 243,256 ----
      return FAIL;
      }

      + /* Did this stuff before, use the same ID again. */
      + if (*pcsidl >= 0)
      + {
      + csidl = *pcsidl;
      + alt_csidl = -1;
      + }
      +
      + retry:
      /* Initialize pointer to IMalloc interface */
      if (NOERROR != SHGetMalloc(&pMalloc))
      {
      ***************
      *** 241,265 ****
      /* Get an ITEMIDLIST corresponding to the folder code */
      if (NOERROR != SHGetSpecialFolderLocation(0, csidl, &pidl))
      {
      ! printf("\nERROR getting ITEMIDLIST for shell_folder_name: \"%s\"\n\n",
      shell_folder_name);
      ! return FAIL;
      }

      /* Translate that ITEMIDLIST to a string */
      ! if (!SHGetPathFromIDList(pidl, shell_folder_path))
      {
      printf("\nERROR translating ITEMIDLIST for shell_folder_name: \"%s\"\n\n",
      shell_folder_name);
      - pMalloc->lpVtbl->Free(pMalloc, pidl);
      - pMalloc->lpVtbl->Release(pMalloc);
      return FAIL;
      }

      ! /* Free the data associated with pidl */
      ! pMalloc->lpVtbl->Free(pMalloc, pidl);
      ! /* Release the IMalloc interface */
      ! pMalloc->lpVtbl->Release(pMalloc);

      if (strncmp(shell_folder_name, "Programs\\", 9) == 0)
      strcat(shell_folder_path, shell_folder_name + 8);
      --- 262,328 ----
      /* Get an ITEMIDLIST corresponding to the folder code */
      if (NOERROR != SHGetSpecialFolderLocation(0, csidl, &pidl))
      {
      ! if (alt_csidl < 0 || NOERROR != SHGetSpecialFolderLocation(0,
      ! alt_csidl, &pidl))
      ! {
      ! printf("\nERROR getting ITEMIDLIST for shell_folder_name: \"%s\"\n\n",
      shell_folder_name);
      ! return FAIL;
      ! }
      ! csidl = alt_csidl;
      ! alt_csidl = -1;
      }

      /* Translate that ITEMIDLIST to a string */
      ! r = SHGetPathFromIDList(pidl, shell_folder_path);
      !
      ! /* Free the data associated with pidl */
      ! pMalloc->lpVtbl->Free(pMalloc, pidl);
      ! /* Release the IMalloc interface */
      ! pMalloc->lpVtbl->Release(pMalloc);
      !
      ! if (!r)
      {
      + if (alt_csidl >= 0)
      + {
      + /* We probably get here for Windows 95: the "all users"
      + * desktop/start menu entry doesn't exist. */
      + csidl = alt_csidl;
      + alt_csidl = -1;
      + goto retry;
      + }
      printf("\nERROR translating ITEMIDLIST for shell_folder_name: \"%s\"\n\n",
      shell_folder_name);
      return FAIL;
      }

      ! /* If there is an alternative: verify we can write in this directory.
      ! * This should cause a retry when the "all users" directory exists but we
      ! * are a normal user and can't write there. */
      ! if (alt_csidl >= 0)
      ! {
      ! char tbuf[BUFSIZE];
      ! FILE *fd;
      !
      ! strcpy(tbuf, shell_folder_path);
      ! strcat(tbuf, "\\vim write test");
      ! fd = fopen(tbuf, "w");
      ! if (fd == NULL)
      ! {
      ! csidl = alt_csidl;
      ! alt_csidl = -1;
      ! goto retry;
      ! }
      ! fclose(fd);
      ! unlink(tbuf);
      ! }
      !
      ! /*
      ! * Keep the found csidl for next time, so that we don't have to do the
      ! * write test every time.
      ! */
      ! if (*pcsidl < 0)
      ! *pcsidl = csidl;

      if (strncmp(shell_folder_name, "Programs\\", 9) == 0)
      strcat(shell_folder_path, shell_folder_name + 8);
      *** ../vim-6.2.523/src/uninstal.c Tue May 13 20:39:50 2003
      --- src/uninstal.c Mon May 3 22:28:05 2004
      ***************
      *** 11,16 ****
      --- 11,17 ----
      * uninstal.c: Minimalistic uninstall program for Vim on MS-Windows
      * Removes:
      * - the "Edit with Vim" popup menu entry
      + * - the Vim "Open With..." popup menu entry
      * - any Vim Batch files in the path
      * - icons for Vim on the Desktop
      * - the Vim entry in the Start Menu
      ***************
      *** 57,62 ****
      --- 58,88 ----
      return (r == ERROR_SUCCESS);
      }

      + /*
      + * Check if the "Open With..." menu entry exists and what gvim it refers to.
      + * Returns non-zero when it's found.
      + */
      + static int
      + openwith_gvim_path(char *buf)
      + {
      + HKEY key_handle;
      + DWORD value_type;
      + DWORD bufsize = BUFSIZE;
      + int r;
      +
      + /* Open the key where the path to gvim.exe is stored. */
      + if (RegOpenKeyEx(HKEY_CLASSES_ROOT,
      + "Applications\\gvim.exe\\shell\\edit\\command", 0, KEY_READ,
      + &key_handle) != ERROR_SUCCESS)
      + return 0;
      +
      + /* get the DisplayName out of it to show the user */
      + r = RegQueryValueEx(key_handle, "", 0, &value_type, (LPBYTE)buf, &bufsize);
      + RegCloseKey(key_handle);
      +
      + return (r == ERROR_SUCCESS);
      + }
      +
      static void
      remove_popup(void)
      {
      ***************
      *** 83,93 ****
      ++fail;

      if (fail == 6)
      ! printf("No Vim registry entries could be removed\n");
      else if (fail)
      ! printf("Some Vim registry entries could not be removed\n");
      else
      ! printf("The Vim registry entries have been removed\n");
      }
      #endif

      --- 109,146 ----
      ++fail;

      if (fail == 6)
      ! printf("No Vim popup registry entries could be removed\n");
      ! else if (fail)
      ! printf("Some Vim popup registry entries could not be removed\n");
      ! else
      ! printf("The Vim popup registry entries have been removed\n");
      ! }
      !
      ! static void
      ! remove_openwith(void)
      ! {
      ! int fail = 0;
      ! HKEY kh;
      !
      ! if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit\\command") != ERROR_SUCCESS)
      ! ++fail;
      ! if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit") != ERROR_SUCCESS)
      ! ++fail;
      ! if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell") != ERROR_SUCCESS)
      ! ++fail;
      ! if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe") != ERROR_SUCCESS)
      ! ++fail;
      ! if (RegDeleteKey(HKEY_CLASSES_ROOT, ".htm\\OpenWithList\\gvim.exe") != ERROR_SUCCESS)
      ! ++fail;
      ! if (RegDeleteKey(HKEY_CLASSES_ROOT, "*\\OpenWithList\\gvim.exe") != ERROR_SUCCESS)
      ! ++fail;
      !
      ! if (fail == 6)
      ! printf("No Vim open-with registry entries could be removed\n");
      else if (fail)
      ! printf("Some Vim open-with registry entries could not be removed\n");
      else
      ! printf("The Vim open-with registry entries have been removed\n");
      }
      #endif

      ***************
      *** 302,308 ****
      --- 355,374 ----
      printf(" which uses \"%s\"\n", popup_path);
      printf("\nRemove it (y/n)? ");
      if (confirm())
      + {
      remove_popup();
      + /* Assume the "Open With" entry can be removed as well, don't
      + * bother the user with asking him again. */
      + remove_openwith();
      + }
      + }
      + else if (openwith_gvim_path(popup_path))
      + {
      + printf(" - the Vim \"Open With...\" entry in the popup menu\n");
      + printf(" which uses \"%s\"\n", popup_path);
      + printf("\nRemove it (y/n)? ");
      + if (confirm())
      + remove_openwith();
      }

      if (get_shell_folder_path(path, "desktop"))
      *** ../vim-6.2.523/src/version.c Mon May 3 21:30:07 2004
      --- src/version.c Tue May 4 15:42:08 2004
      ***************
      *** 639,640 ****
      --- 642,645 ----
      { /* Add new patch number below this line */
      + /**/
      + 524,
      /**/

      --
      hundred-and-one symptoms of being an internet addict:
      99. The hum of a cooling fan and the click of keys is comforting to you.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.