home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.2.524 < prev    next >
Encoding:
Internet Message Format  |  2004-05-03  |  30.1 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.2.524 (extra)
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.2.524 (extra, after 6.2.520)
  11. Problem:    Win32: (un)installing gvimext.dll may fail if it was used.
  12.         The desktop and start menu links are created for the current user
  13.         instead of all users.
  14.         Using the home directory as working directory for the links is a
  15.         bad idea for multi-user systems.
  16.         Cannot use Vim from the "Open With..." menu.
  17. Solution:   Force a reboot if necessary. (Alejandro Lopez-Valencia)  Also use
  18.         macros for the directory of the source and runtime files.  Use
  19.         "CSIDL_COMMON_*" instead of "CSIDL_*" when possible.
  20.         Do not specify a working directory in the links.
  21.         Add Vim to the "Open With..." menu. (Giuseppe Bilotta)
  22. Files:        nsis/gvim.nsi, src/dosinst.c, src/dosinst.h, src/uninstal.c
  23.  
  24.  
  25. *** ../vim-6.2.523/nsis/gvim.nsi    Sun May  2 16:57:24 2004
  26. --- nsis/gvim.nsi    Tue May  4 15:49:21 2004
  27. ***************
  28. *** 3,11 ****
  29.   # Last change:    2004 May 02
  30.   
  31.   # WARNING: if you make changes to this script, look out for $0 to be valid,
  32. ! # because this line is very dangerous:        RMDir /r $0
  33.   
  34. ! # comment next line if you don't have UPX.
  35.   # Get it at http://upx.sourceforge.net
  36.   !define HAVE_UPX
  37.   
  38. --- 3,20 ----
  39.   # Last change:    2004 May 02
  40.   
  41.   # WARNING: if you make changes to this script, look out for $0 to be valid,
  42. ! # because uninstall deletes most files in $0.
  43.   
  44. ! # Location of gvim_ole.exe, vimd32.exe, GvimExt/*, etc.
  45. ! !define VIMSRC "..\src"
  46. ! # Location of runtime files
  47. ! !define VIMRT ".."
  48. ! # Location of extra tools: diff.exe
  49. ! !define VIMTOOLS ..\..
  50. ! # Comment the next line if you don't have UPX.
  51.   # Get it at http://upx.sourceforge.net
  52.   !define HAVE_UPX
  53.   
  54. ***************
  55. *** 15,20 ****
  56. --- 24,33 ----
  57.   !define VER_MINOR 2
  58.   !define VER_MAJOR 6
  59.   
  60. + # ----------- No configurable settings below this line -----------
  61. + !include UpgradeDLL.nsh        # for VisVim.dll
  62.   Name "Vim ${VER_MAJOR}.${VER_MINOR}"
  63.   OutFile gvim${VER_MAJOR}${VER_MINOR}.exe
  64.   CRCCheck force
  65. ***************
  66. *** 31,44 ****
  67.   UninstallIcon icons\vim_uninst_16c.ico
  68.   BGGradient 004000 008200 FFFFFF
  69.   LicenseText "You should read the following before installing:"
  70. ! LicenseData ..\doc\uganda.nsis.txt
  71.   
  72.   !ifdef HAVE_UPX
  73.     !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
  74.   !endif
  75.   
  76.   # This adds '\vim' to the user choice automagically.
  77. ! InstallDir $PROGRAMFILES\Vim
  78.   
  79.   # Types of installs we can perform:
  80.   InstType Typical
  81. --- 44,57 ----
  82.   UninstallIcon icons\vim_uninst_16c.ico
  83.   BGGradient 004000 008200 FFFFFF
  84.   LicenseText "You should read the following before installing:"
  85. ! LicenseData ${VIMRT}\doc\uganda.nsis.txt
  86.   
  87.   !ifdef HAVE_UPX
  88.     !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
  89.   !endif
  90.   
  91.   # This adds '\vim' to the user choice automagically.
  92. ! InstallDir "$PROGRAMFILES\Vim"
  93.   
  94.   # Types of installs we can perform:
  95.   InstType Typical
  96. ***************
  97. *** 59,65 ****
  98.   
  99.     # run the install program to check for already installed versions
  100.     SetOutPath $TEMP
  101. !   File /oname=install.exe ..\src\installw32.exe
  102.     ExecWait "$TEMP\install.exe -uninstall-check"
  103.     Delete $TEMP\install.exe
  104.   
  105. --- 72,78 ----
  106.   
  107.     # run the install program to check for already installed versions
  108.     SetOutPath $TEMP
  109. !   File /oname=install.exe ${VIMSRC}\installw32.exe
  110.     ExecWait "$TEMP\install.exe -uninstall-check"
  111.     Delete $TEMP\install.exe
  112.   
  113. ***************
  114. *** 153,200 ****
  115.       StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
  116.   
  117.       SetOutPath $0
  118. !     File /oname=gvim.exe ..\src\gvim_ole.exe
  119. !     File /oname=install.exe ..\src\installw32.exe
  120. !     File /oname=uninstal.exe ..\src\uninstalw32.exe
  121. !     File ..\src\vimrun.exe
  122. !     File /oname=xxd.exe ..\src\xxdw32.exe
  123. !     File ..\..\diff.exe
  124. !     File ..\vimtutor.bat
  125. !     File ..\README.txt
  126.       File ..\uninstal.txt
  127. !     File ..\*.vim
  128. !     File ..\rgb.txt
  129.   
  130.       SetOutPath $0\colors
  131. !     File ..\colors\*.*
  132.   
  133.       SetOutPath $0\compiler
  134. !     File ..\compiler\*.*
  135.   
  136.       SetOutPath $0\doc
  137. !     File ..\doc\*.txt
  138. !     File ..\doc\tags
  139.   
  140.       SetOutPath $0\ftplugin
  141. !     File ..\ftplugin\*.*
  142.   
  143.       SetOutPath $0\indent
  144. !     File ..\indent\*.*
  145.   
  146.       SetOutPath $0\macros
  147. !     File ..\macros\*.*
  148.   
  149.       SetOutPath $0\plugin
  150. !     File ..\plugin\*.*
  151.   
  152.       SetOutPath $0\syntax
  153. !     File ..\syntax\*.*
  154.   
  155.       SetOutPath $0\tools
  156. !     File ..\tools\*.*
  157.   
  158.       SetOutPath $0\tutor
  159. !     File ..\tutor\*.*
  160.   SectionEnd
  161.   
  162.   ##########################################################
  163. --- 166,213 ----
  164.       StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
  165.   
  166.       SetOutPath $0
  167. !     File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe
  168. !     File /oname=install.exe ${VIMSRC}\installw32.exe
  169. !     File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe
  170. !     File ${VIMSRC}\vimrun.exe
  171. !     File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
  172. !     File ${VIMTOOLS}\diff.exe
  173. !     File ${VIMRT}\vimtutor.bat
  174. !     File ${VIMRT}\README.txt
  175.       File ..\uninstal.txt
  176. !     File ${VIMRT}\*.vim
  177. !     File ${VIMRT}\rgb.txt
  178.   
  179.       SetOutPath $0\colors
  180. !     File ${VIMRT}\colors\*.*
  181.   
  182.       SetOutPath $0\compiler
  183. !     File ${VIMRT}\compiler\*.*
  184.   
  185.       SetOutPath $0\doc
  186. !     File ${VIMRT}\doc\*.txt
  187. !     File ${VIMRT}\doc\tags
  188.   
  189.       SetOutPath $0\ftplugin
  190. !     File ${VIMRT}\ftplugin\*.*
  191.   
  192.       SetOutPath $0\indent
  193. !     File ${VIMRT}\indent\*.*
  194.   
  195.       SetOutPath $0\macros
  196. !     File ${VIMRT}\macros\*.*
  197.   
  198.       SetOutPath $0\plugin
  199. !     File ${VIMRT}\plugin\*.*
  200.   
  201.       SetOutPath $0\syntax
  202. !     File ${VIMRT}\syntax\*.*
  203.   
  204.       SetOutPath $0\tools
  205. !     File ${VIMRT}\tools\*.*
  206.   
  207.       SetOutPath $0\tutor
  208. !     File ${VIMRT}\tutor\*.*
  209.   SectionEnd
  210.   
  211.   ##########################################################
  212. ***************
  213. *** 206,221 ****
  214.          "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  215.       IfErrors 0 lbl_winnt
  216.           # Windows 95/98/ME
  217. !         File /oname=vim.exe ..\src\vimd32.exe
  218.           Goto lbl_done
  219.       lbl_winnt:
  220.           # Windows NT/2000/XT
  221. !         File /oname=vim.exe ..\src\vimw32.exe
  222.       lbl_done:
  223.       StrCpy $2 "$2 vim view vimdiff"
  224.   SectionEnd
  225.   
  226.   ##########################################################
  227.   Section "Create icons on the Desktop"
  228.       SectionIn 1 3
  229.   
  230. --- 219,241 ----
  231.          "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  232.       IfErrors 0 lbl_winnt
  233.           # Windows 95/98/ME
  234. !         File /oname=vim.exe ${VIMSRC}\vimd32.exe
  235.           Goto lbl_done
  236.       lbl_winnt:
  237.           # Windows NT/2000/XT
  238. !         File /oname=vim.exe ${VIMSRC}\vimw32.exe
  239.       lbl_done:
  240.       StrCpy $2 "$2 vim view vimdiff"
  241.   SectionEnd
  242.   
  243.   ##########################################################
  244. + Section "Create .bat files for command line use"
  245. +     SectionIn 3
  246. +     StrCpy $1 "$1 -create-batfiles $2"
  247. + SectionEnd
  248. + ##########################################################
  249.   Section "Create icons on the Desktop"
  250.       SectionIn 1 3
  251.   
  252. ***************
  253. *** 233,241 ****
  254.   Section "Add an Edit-with-Vim context menu entry"
  255.       SectionIn 1 3
  256.   
  257.       SetOutPath $0
  258. !     File ..\src\GvimExt\gvimext.dll
  259. !     StrCpy $1 "$1 -install-popup"
  260.   SectionEnd
  261.   
  262.   ##########################################################
  263. --- 253,284 ----
  264.   Section "Add an Edit-with-Vim context menu entry"
  265.       SectionIn 1 3
  266.   
  267. +     # Be aware of this sequence of events:
  268. +     # - user uninstalls Vim, gvimext.dll can't be removed (it's in use) and
  269. +     #   is scheduled to be removed at next reboot.
  270. +     # - user installs Vim in same directory, gvimext.dll still exists.
  271. +     # If we now skip installing gvimext.dll, it will disappear at the next
  272. +     # reboot.  Thus when copying gvimext.dll fails always schedule it to be
  273. +     # installed at the next reboot.  Can't use UpgradeDLL!
  274. +     # We don't ask the user to reboot, the old dll will keep on working.
  275.       SetOutPath $0
  276. !     ClearErrors
  277. !     SetOverwrite try
  278. !     File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll
  279. !     IfErrors 0 GvimExtDone
  280. !     # Can't copy gvimext.dll, create it under another name and rename it on
  281. !     # next reboot.
  282. !     GetTempFileName $3 $0
  283. !     File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll
  284. !     Rename /REBOOTOK $3 $0\gvimext.dll
  285. !     GvimExtDone:
  286. !     SetOverwrite lastused
  287. !     # We don't have a separate entry for the "Open With..." menu, assume
  288. !     # the user wants either both or none.
  289. !     StrCpy $1 "$1 -install-popup -install-openwith"
  290.   SectionEnd
  291.   
  292.   ##########################################################
  293. ***************
  294. *** 246,258 ****
  295.   SectionEnd
  296.   
  297.   ##########################################################
  298. - Section "Create .bat files for command line use"
  299. -     SectionIn 3
  300. -     StrCpy $1 "$1 -create-batfiles $2"
  301. - SectionEnd
  302. - ##########################################################
  303.   Section "Create plugin directories in HOME or VIM"
  304.       SectionIn 1 3
  305.   
  306. --- 289,294 ----
  307. ***************
  308. *** 271,279 ****
  309.       SectionIn 3
  310.   
  311.       SetOutPath $0
  312. !     File ..\src\VisVim\VisVim.dll
  313. !     File ..\src\VisVim\README_VisVim.txt
  314. !     ExecWait "regsvr32.exe /s $0\VisVim.dll"
  315.   SectionEnd
  316.   
  317.   ##########################################################
  318. --- 307,314 ----
  319.       SectionIn 3
  320.   
  321.       SetOutPath $0
  322. !     !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0"
  323. !     File ${VIMSRC}\VisVim\README_VisVim.txt
  324.   SectionEnd
  325.   
  326.   ##########################################################
  327. ***************
  328. *** 282,293 ****
  329.           SectionIn 1 3
  330.   
  331.           SetOutPath $0\lang
  332. !         File /r ..\lang\*.*
  333.           SetOutPath $0\keymap
  334. !         File ..\keymap\README.txt
  335. !         File ..\keymap\*.vim
  336.           SetOutPath $0
  337. !         File ..\libintl.dll
  338.       SectionEnd
  339.   !endif
  340.   
  341. --- 317,328 ----
  342.           SectionIn 1 3
  343.   
  344.           SetOutPath $0\lang
  345. !         File /r ${VIMRT}\lang\*.*
  346.           SetOutPath $0\keymap
  347. !         File ${VIMRT}\keymap\README.txt
  348. !         File ${VIMRT}\keymap\*.vim
  349.           SetOutPath $0
  350. !         File ${VIMRT}\libintl.dll
  351.       SectionEnd
  352.   !endif
  353.   
  354. ***************
  355. *** 308,314 ****
  356.       # created.  Thus the "vim61" directory is included in it.
  357.       StrCpy $0 "$INSTDIR"
  358.   
  359. !     # If VisVim was installed, unregister the DLL
  360.       IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim
  361.       Has_VisVim:
  362.          ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
  363. --- 343,349 ----
  364.       # created.  Thus the "vim61" directory is included in it.
  365.       StrCpy $0 "$INSTDIR"
  366.   
  367. !     # If VisVim was installed, unregister the DLL.
  368.       IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim
  369.       Has_VisVim:
  370.          ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
  371. ***************
  372. *** 326,340 ****
  373.         "Would you like to delete $0?$\n \
  374.          $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes
  375.   
  376. !     Delete /REBOOTOK $0\gvimext.dll
  377.       ClearErrors
  378. !     RMDir /r $0
  379.   
  380.       IfErrors ErrorMess NoErrorMess
  381.         ErrorMess:
  382.           MessageBox MB_OK|MB_ICONEXCLAMATION \
  383.             "Some files in $0 have not been deleted!$\nYou must do it manually."
  384.         NoErrorMess:
  385.   
  386.       NoRemoveExes:
  387.       # get the parent dir of the installation
  388. --- 361,397 ----
  389.         "Would you like to delete $0?$\n \
  390.          $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes
  391.   
  392. !     Delete /REBOOTOK $0\*.dll
  393.       ClearErrors
  394. !     # Remove everything but *.dll files.  Avoids that
  395. !     # a lot remains when gvimext.dll cannot be deleted.
  396. !     RMDir /r $0\colors
  397. !     RMDir /r $0\compiler
  398. !     RMDir /r $0\doc
  399. !     RMDir /r $0\ftplugin
  400. !     RMDir /r $0\indent
  401. !     RMDir /r $0\macros
  402. !     RMDir /r $0\plugin
  403. !     RMDir /r $0\syntax
  404. !     RMDir /r $0\tools
  405. !     RMDir /r $0\tutor
  406. !     RMDir /r $0\VisVim
  407. !     RMDir /r $0\lang
  408. !     RMDir /r $0\keymap
  409. !     Delete $0\*.exe
  410. !     Delete $0\*.bat
  411. !     Delete $0\*.vim
  412. !     Delete $0\*.txt
  413.   
  414.       IfErrors ErrorMess NoErrorMess
  415.         ErrorMess:
  416.           MessageBox MB_OK|MB_ICONEXCLAMATION \
  417.             "Some files in $0 have not been deleted!$\nYou must do it manually."
  418.         NoErrorMess:
  419. +     # No error message if the "vim62" directory can't be removed, the
  420. +     # gvimext.dll may still be there.
  421. +     RMDir $0
  422.   
  423.       NoRemoveExes:
  424.       # get the parent dir of the installation
  425. *** ../vim-6.2.523/src/dosinst.c    Sun Apr 25 16:29:55 2004
  426. --- src/dosinst.c    Mon May  3 22:24:47 2004
  427. ***************
  428. *** 32,38 ****
  429. --- 32,40 ----
  430.                        directory to write .bat files in */
  431.   char    *default_vim_dir = NULL;  /* when not NULL, use this as the default
  432.                        install dir for NSIS */
  433. + #if 0
  434.   char    homedir[BUFSIZE];    /* home directory or "" */
  435. + #endif
  436.   
  437.   /*
  438.    * Structure used for each choice the user can make.
  439. ***************
  440. *** 113,118 ****
  441. --- 115,123 ----
  442.   /* non-zero when selected to install the popup menu entry. */
  443.   static int    install_popup = 0;
  444.   
  445. + /* non-zero when selected to install the "Open with" entry. */
  446. + static int    install_openwith = 0;
  447.   /* non-zero when need to add an uninstall entry in the registry */
  448.   static int    need_uninstall_entry = 0;
  449.   
  450. ***************
  451. *** 679,684 ****
  452. --- 684,690 ----
  453.       else
  454.       *oldvimrc = NUL;
  455.   
  456. + #if 0 /* currently not used */
  457.       /*
  458.        * Get default home directory.
  459.        * Prefer $HOME if it's set.  For Win NT use $HOMEDRIVE and $HOMEPATH.
  460. ***************
  461. *** 709,714 ****
  462. --- 715,721 ----
  463.           *homedir = NUL;
  464.       }
  465.       }
  466. + #endif
  467.   }
  468.   
  469.   /*
  470. ***************
  471. *** 1311,1316 ****
  472. --- 1318,1324 ----
  473.   /*
  474.    * Add some entries to the registry:
  475.    * - to add "Edit with Vim" to the context * menu
  476. +  * - to add Vim to the "Open with..." list
  477.    * - to uninstall Vim
  478.    */
  479.   /*ARGSUSED*/
  480. ***************
  481. *** 1367,1372 ****
  482. --- 1375,1396 ----
  483.           fprintf(fd, "\n");
  484.       }
  485.   
  486. +     if (install_openwith)
  487. +     {
  488. +         char    bufg[BUFSIZE];
  489. +         struct stat st;
  490. +         printf("Creating \"Open with ...\" list entry\n");
  491. +         fprintf(fd, "[HKEY_CLASSES_ROOT\\Applications\\gvim.exe]\n\n");
  492. +         fprintf(fd, "[HKEY_CLASSES_ROOT\\Applications\\gvim.exe\\shell]\n\n");
  493. +         fprintf(fd, "[HKEY_CLASSES_ROOT\\Applications\\gvim.exe\\shell\\edit]\n\n");
  494. +         fprintf(fd, "[HKEY_CLASSES_ROOT\\Applications\\gvim.exe\\shell\\edit\\command]\n");
  495. +         fprintf(fd, "@=\"%sgvim.exe \\\"%%1\\\"\"\n\n", buf);
  496. +         fprintf(fd, "[HKEY_CLASSES_ROOT\\.htm\\OpenWithList\\gvim.exe]\n\n");
  497. +         fprintf(fd, "[HKEY_CLASSES_ROOT\\*\\OpenWithList\\gvim.exe]\n\n");
  498. +     }
  499.       printf("Creating an uninstall entry\n");
  500.   
  501.       /* The registry entries for uninstalling the menu */
  502. ***************
  503. *** 1435,1440 ****
  504. --- 1459,1502 ----
  505.       add_dummy_choice();
  506.   }
  507.   
  508. +     static void
  509. + change_openwith_choice(int idx)
  510. + {
  511. +     if (install_openwith == 0)
  512. +     {
  513. +     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";
  514. +     install_openwith = 1;
  515. +     }
  516. +     else
  517. +     {
  518. +     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";
  519. +     install_openwith = 0;
  520. +     }
  521. + }
  522. + /*
  523. +  * Only add the choice for the open-with menu entry when gvim.exe was found
  524. +  * and and regedit.exe exist.
  525. +  */
  526. +     static void
  527. + init_openwith_choice(void)
  528. + {
  529. +     if (has_gvim
  530. + #ifndef WIN3264
  531. +         && searchpath("regedit.exe") != NULL
  532. + #endif
  533. +        )
  534. +     {
  535. +     choices[choice_count].changefunc = change_openwith_choice;
  536. +     choices[choice_count].installfunc = NULL;
  537. +     choices[choice_count].active = 1;
  538. +     change_openwith_choice(choice_count);  /* set the text */
  539. +     ++choice_count;
  540. +     }
  541. +     else
  542. +     add_dummy_choice();
  543. + }
  544.   #ifdef WIN3264
  545.   /* create_shortcut
  546.    *
  547. ***************
  548. *** 1577,1582 ****
  549. --- 1639,1650 ----
  550.   }
  551.   
  552.   /*
  553. +  * We used to use "homedir" as the working directory, but that is a bad choice
  554. +  * on multi-user systems.  Not specifying a directory appears to work best.
  555. +  */
  556. + #define WORKDIR ""
  557. + /*
  558.    * Create shortcut(s) in the Start Menu\Programs\Vim folder.
  559.    */
  560.       static void
  561. ***************
  562. *** 1587,1614 ****
  563.       if (has_vim)
  564.       {
  565.       if (build_shortcut("Vim", "vim.exe", "",
  566. !                           VIM_STARTMENU, homedir) == FAIL)
  567.           return;
  568.       if (build_shortcut("Vim Read-only", "vim.exe", "-R",
  569. !                           VIM_STARTMENU, homedir) == FAIL)
  570.           return;
  571.       if (build_shortcut("Vim Diff", "vim.exe", "-d",
  572. !                           VIM_STARTMENU, homedir) == FAIL)
  573.           return;
  574.       }
  575.       if (has_gvim)
  576.       {
  577.       if (build_shortcut("gVim", "gvim.exe", "",
  578. !                           VIM_STARTMENU, homedir) == FAIL)
  579.           return;
  580.       if (build_shortcut("gVim Easy", "gvim.exe", "-y",
  581. !                           VIM_STARTMENU, homedir) == FAIL)
  582.           return;
  583.       if (build_shortcut("gVim Read-only", "gvim.exe", "-R",
  584. !                           VIM_STARTMENU, homedir) == FAIL)
  585.           return;
  586.       if (build_shortcut("gVim Diff", "gvim.exe", "-d",
  587. !                           VIM_STARTMENU, homedir) == FAIL)
  588.           return;
  589.       }
  590.       if (build_shortcut("Uninstall",
  591. --- 1655,1682 ----
  592.       if (has_vim)
  593.       {
  594.       if (build_shortcut("Vim", "vim.exe", "",
  595. !                           VIM_STARTMENU, WORKDIR) == FAIL)
  596.           return;
  597.       if (build_shortcut("Vim Read-only", "vim.exe", "-R",
  598. !                           VIM_STARTMENU, WORKDIR) == FAIL)
  599.           return;
  600.       if (build_shortcut("Vim Diff", "vim.exe", "-d",
  601. !                           VIM_STARTMENU, WORKDIR) == FAIL)
  602.           return;
  603.       }
  604.       if (has_gvim)
  605.       {
  606.       if (build_shortcut("gVim", "gvim.exe", "",
  607. !                           VIM_STARTMENU, WORKDIR) == FAIL)
  608.           return;
  609.       if (build_shortcut("gVim Easy", "gvim.exe", "-y",
  610. !                           VIM_STARTMENU, WORKDIR) == FAIL)
  611.           return;
  612.       if (build_shortcut("gVim Read-only", "gvim.exe", "-R",
  613. !                           VIM_STARTMENU, WORKDIR) == FAIL)
  614.           return;
  615.       if (build_shortcut("gVim Diff", "gvim.exe", "-d",
  616. !                           VIM_STARTMENU, WORKDIR) == FAIL)
  617.           return;
  618.       }
  619.       if (build_shortcut("Uninstall",
  620. ***************
  621. *** 1621,1627 ****
  622.                          VIM_STARTMENU, installdir) == FAIL)
  623.       return;
  624.       if (build_shortcut("Help", has_gvim ? "gvim.exe" : "vim.exe", "-c h",
  625. !                           VIM_STARTMENU, homedir) == FAIL)
  626.       return;
  627.       {
  628.       char    shell_folder_path[BUFSIZE];
  629. --- 1689,1695 ----
  630.                          VIM_STARTMENU, installdir) == FAIL)
  631.       return;
  632.       if (build_shortcut("Help", has_gvim ? "gvim.exe" : "vim.exe", "-c h",
  633. !                           VIM_STARTMENU, WORKDIR) == FAIL)
  634.       return;
  635.       {
  636.       char    shell_folder_path[BUFSIZE];
  637. ***************
  638. *** 1674,1680 ****
  639.       if (choices[idx].arg)
  640.       {
  641.       (void)build_shortcut(icon_names[0], "gvim.exe",
  642. !                               "", "desktop", homedir);
  643.       need_uninstall_entry = 1;
  644.       }
  645.   }
  646. --- 1742,1748 ----
  647.       if (choices[idx].arg)
  648.       {
  649.       (void)build_shortcut(icon_names[0], "gvim.exe",
  650. !                               "", "desktop", WORKDIR);
  651.       need_uninstall_entry = 1;
  652.       }
  653.   }
  654. ***************
  655. *** 1685,1691 ****
  656.       if (choices[idx].arg)
  657.       {
  658.       (void)build_shortcut(icon_names[1], "gvim.exe",
  659. !                             "-y", "desktop", homedir);
  660.       need_uninstall_entry = 1;
  661.       }
  662.   }
  663. --- 1753,1759 ----
  664.       if (choices[idx].arg)
  665.       {
  666.       (void)build_shortcut(icon_names[1], "gvim.exe",
  667. !                             "-y", "desktop", WORKDIR);
  668.       need_uninstall_entry = 1;
  669.       }
  670.   }
  671. ***************
  672. *** 1696,1702 ****
  673.       if (choices[idx].arg)
  674.       {
  675.       (void)build_shortcut(icon_names[2], "gvim.exe",
  676. !                             "-R", "desktop", homedir);
  677.       need_uninstall_entry = 1;
  678.       }
  679.   }
  680. --- 1764,1770 ----
  681.       if (choices[idx].arg)
  682.       {
  683.       (void)build_shortcut(icon_names[2], "gvim.exe",
  684. !                             "-R", "desktop", WORKDIR);
  685.       need_uninstall_entry = 1;
  686.       }
  687.   }
  688. ***************
  689. *** 1974,1979 ****
  690. --- 2042,2050 ----
  691.       /* Whether to add Vim to the popup menu */
  692.       init_popup_choice();
  693.   
  694. +     /* Whether to add Vim to the "Open With..." menu */
  695. +     init_openwith_choice();
  696.       /* Whether to add Vim to the Start Menu. */
  697.       init_startmenu_choice();
  698.   
  699. ***************
  700. *** 1995,2000 ****
  701. --- 2066,2073 ----
  702.       printf("    Create a default _vimrc file if one does not already exist.\n");
  703.       printf("-install-popup\n");
  704.       printf("    Install the Edit-with-Vim context menu entry\n");
  705. +     printf("-install-openwith\n");
  706. +     printf("    Add Vim to the \"Open With...\" context menu list\n");
  707.   #ifdef WIN3264
  708.       printf("-add-start-menu");
  709.       printf("    Add Vim to the start menu\n");
  710. ***************
  711. *** 2054,2059 ****
  712. --- 2127,2136 ----
  713.       {
  714.           init_popup_choice();
  715.       }
  716. +     else if (strcmp(argv[i], "-install-openwith") == 0)
  717. +     {
  718. +         init_openwith_choice();
  719. +     }
  720.       else if (strcmp(argv[i], "-add-start-menu") == 0)
  721.       {
  722.           init_startmenu_choice();
  723. ***************
  724. *** 2178,2184 ****
  725.   "select each file type.\n"
  726.   "An alternative is the option offered here: Install an \"Edit with Vim\"\n"
  727.   "entry in the popup menu for the right mouse button.  This means you can\n"
  728. ! "edit any file with Vim\n"
  729.   ,
  730.   "Add Vim to the Start menu\n"
  731.   "-------------------------\n"
  732. --- 2255,2268 ----
  733.   "select each file type.\n"
  734.   "An alternative is the option offered here: Install an \"Edit with Vim\"\n"
  735.   "entry in the popup menu for the right mouse button.  This means you can\n"
  736. ! "edit any file with Vim.\n"
  737. ! ,
  738. ! "\"Open With...\" context menu entry\n"
  739. ! "--------------------------------\n"
  740. ! "(this choice is only available when gvim.exe is present)\n"
  741. ! "This option adds Vim to the \"Open With...\" entry in the popup menu for\n"
  742. ! "the right mouse button.  This also makes it possible to edit HTML files\n"
  743. ! "directly from Internet Explorer.\n"
  744.   ,
  745.   "Add Vim to the Start menu\n"
  746.   "-------------------------\n"
  747. ***************
  748. *** 2237,2243 ****
  749.           (choices[i].installfunc)(i);
  750.   
  751.       /* Add some entries to the registry, if needed. */
  752. !     if (install_popup || (need_uninstall_entry && interactive) || !interactive)
  753.       install_registry();
  754.   
  755.   #ifdef WIN3264
  756. --- 2321,2330 ----
  757.           (choices[i].installfunc)(i);
  758.   
  759.       /* Add some entries to the registry, if needed. */
  760. !     if (install_popup
  761. !         || install_openwith
  762. !         || (need_uninstall_entry && interactive)
  763. !         || !interactive)
  764.       install_registry();
  765.   
  766.   #ifdef WIN3264
  767. *** ../vim-6.2.523/src/dosinst.h    Tue May 27 22:00:56 2003
  768. --- src/dosinst.h    Mon May  3 22:56:17 2004
  769. ***************
  770. *** 213,228 ****
  771.       /*
  772.        * The following code was successfully built with make_mvc.mak.
  773.        * The resulting executable worked on Windows 95, Millennium Edition, and
  774. !      * 2000 Professional.
  775.        */
  776. !     LPITEMIDLIST pidl = 0; /* Pointer to an Item ID list allocated below */
  777. !     LPMALLOC pMalloc; /* Pointer to an IMalloc interface */
  778. !     int csidl;
  779.   
  780.       if (strcmp(shell_folder_name, "desktop") == 0)
  781. !     csidl = CSIDL_DESKTOP;
  782.       else if (strncmp(shell_folder_name, "Programs", 8) == 0)
  783. !     csidl = CSIDL_PROGRAMS;
  784.       else
  785.       {
  786.       printf("\nERROR (internal) unrecognised shell_folder_name: \"%s\"\n\n",
  787. --- 213,241 ----
  788.       /*
  789.        * The following code was successfully built with make_mvc.mak.
  790.        * The resulting executable worked on Windows 95, Millennium Edition, and
  791. !      * 2000 Professional.  But it was changed after testing...
  792.        */
  793. !     LPITEMIDLIST    pidl = 0; /* Pointer to an Item ID list allocated below */
  794. !     LPMALLOC        pMalloc;  /* Pointer to an IMalloc interface */
  795. !     int            csidl;
  796. !     int            alt_csidl = -1;
  797. !     static int        desktop_csidl = -1;
  798. !     static int        programs_csidl = -1;
  799. !     int            *pcsidl;
  800. !     int            r;
  801.   
  802.       if (strcmp(shell_folder_name, "desktop") == 0)
  803. !     {
  804. !     pcsidl = &desktop_csidl;
  805. !     csidl = CSIDL_COMMON_DESKTOPDIRECTORY;
  806. !     alt_csidl = CSIDL_DESKTOP;
  807. !     }
  808.       else if (strncmp(shell_folder_name, "Programs", 8) == 0)
  809. !     {
  810. !     pcsidl = &programs_csidl;
  811. !     csidl = CSIDL_COMMON_PROGRAMS;
  812. !     alt_csidl = CSIDL_PROGRAMS;
  813. !     }
  814.       else
  815.       {
  816.       printf("\nERROR (internal) unrecognised shell_folder_name: \"%s\"\n\n",
  817. ***************
  818. *** 230,235 ****
  819. --- 243,256 ----
  820.       return FAIL;
  821.       }
  822.   
  823. +     /* Did this stuff before, use the same ID again. */
  824. +     if (*pcsidl >= 0)
  825. +     {
  826. +     csidl = *pcsidl;
  827. +     alt_csidl = -1;
  828. +     }
  829. + retry:
  830.       /* Initialize pointer to IMalloc interface */
  831.       if (NOERROR != SHGetMalloc(&pMalloc))
  832.       {
  833. ***************
  834. *** 241,265 ****
  835.       /* Get an ITEMIDLIST corresponding to the folder code */
  836.       if (NOERROR != SHGetSpecialFolderLocation(0, csidl, &pidl))
  837.       {
  838. !     printf("\nERROR getting ITEMIDLIST for shell_folder_name: \"%s\"\n\n",
  839.                                  shell_folder_name);
  840. !     return FAIL;
  841.       }
  842.   
  843.       /* Translate that ITEMIDLIST to a string */
  844. !     if (!SHGetPathFromIDList(pidl, shell_folder_path))
  845.       {
  846.       printf("\nERROR translating ITEMIDLIST for shell_folder_name: \"%s\"\n\n",
  847.                                  shell_folder_name);
  848. -     pMalloc->lpVtbl->Free(pMalloc, pidl);
  849. -     pMalloc->lpVtbl->Release(pMalloc);
  850.       return FAIL;
  851.       }
  852.   
  853. !     /* Free the data associated with pidl */
  854. !     pMalloc->lpVtbl->Free(pMalloc, pidl);
  855. !     /* Release the IMalloc interface */
  856. !     pMalloc->lpVtbl->Release(pMalloc);
  857.   
  858.       if (strncmp(shell_folder_name, "Programs\\", 9) == 0)
  859.       strcat(shell_folder_path, shell_folder_name + 8);
  860. --- 262,328 ----
  861.       /* Get an ITEMIDLIST corresponding to the folder code */
  862.       if (NOERROR != SHGetSpecialFolderLocation(0, csidl, &pidl))
  863.       {
  864. !     if (alt_csidl < 0 || NOERROR != SHGetSpecialFolderLocation(0,
  865. !                                 alt_csidl, &pidl))
  866. !     {
  867. !         printf("\nERROR getting ITEMIDLIST for shell_folder_name: \"%s\"\n\n",
  868.                                  shell_folder_name);
  869. !         return FAIL;
  870. !     }
  871. !     csidl = alt_csidl;
  872. !     alt_csidl = -1;
  873.       }
  874.   
  875.       /* Translate that ITEMIDLIST to a string */
  876. !     r = SHGetPathFromIDList(pidl, shell_folder_path);
  877. !     /* Free the data associated with pidl */
  878. !     pMalloc->lpVtbl->Free(pMalloc, pidl);
  879. !     /* Release the IMalloc interface */
  880. !     pMalloc->lpVtbl->Release(pMalloc);
  881. !     if (!r)
  882.       {
  883. +     if (alt_csidl >= 0)
  884. +     {
  885. +         /* We probably get here for Windows 95: the "all users"
  886. +          * desktop/start menu entry doesn't exist. */
  887. +         csidl = alt_csidl;
  888. +         alt_csidl = -1;
  889. +         goto retry;
  890. +     }
  891.       printf("\nERROR translating ITEMIDLIST for shell_folder_name: \"%s\"\n\n",
  892.                                  shell_folder_name);
  893.       return FAIL;
  894.       }
  895.   
  896. !     /* If there is an alternative: verify we can write in this directory.
  897. !      * This should cause a retry when the "all users" directory exists but we
  898. !      * are a normal user and can't write there. */
  899. !     if (alt_csidl >= 0)
  900. !     {
  901. !     char tbuf[BUFSIZE];
  902. !     FILE *fd;
  903. !     strcpy(tbuf, shell_folder_path);
  904. !     strcat(tbuf, "\\vim write test");
  905. !     fd = fopen(tbuf, "w");
  906. !     if (fd == NULL)
  907. !     {
  908. !         csidl = alt_csidl;
  909. !         alt_csidl = -1;
  910. !         goto retry;
  911. !     }
  912. !     fclose(fd);
  913. !     unlink(tbuf);
  914. !     }
  915. !     /*
  916. !      * Keep the found csidl for next time, so that we don't have to do the
  917. !      * write test every time.
  918. !      */
  919. !     if (*pcsidl < 0)
  920. !     *pcsidl = csidl;
  921.   
  922.       if (strncmp(shell_folder_name, "Programs\\", 9) == 0)
  923.       strcat(shell_folder_path, shell_folder_name + 8);
  924. *** ../vim-6.2.523/src/uninstal.c    Tue May 13 20:39:50 2003
  925. --- src/uninstal.c    Mon May  3 22:28:05 2004
  926. ***************
  927. *** 11,16 ****
  928. --- 11,17 ----
  929.    * uninstal.c:    Minimalistic uninstall program for Vim on MS-Windows
  930.    *        Removes:
  931.    *        - the "Edit with Vim" popup menu entry
  932. +  *        - the Vim "Open With..." popup menu entry
  933.    *        - any Vim Batch files in the path
  934.    *        - icons for Vim on the Desktop
  935.    *        - the Vim entry in the Start Menu
  936. ***************
  937. *** 57,62 ****
  938. --- 58,88 ----
  939.       return (r == ERROR_SUCCESS);
  940.   }
  941.   
  942. + /*
  943. +  * Check if the "Open With..." menu entry exists and what gvim it refers to.
  944. +  * Returns non-zero when it's found.
  945. +  */
  946. +     static int
  947. + openwith_gvim_path(char *buf)
  948. + {
  949. +     HKEY    key_handle;
  950. +     DWORD    value_type;
  951. +     DWORD    bufsize = BUFSIZE;
  952. +     int        r;
  953. +     /* Open the key where the path to gvim.exe is stored. */
  954. +     if (RegOpenKeyEx(HKEY_CLASSES_ROOT,
  955. +         "Applications\\gvim.exe\\shell\\edit\\command", 0, KEY_READ,
  956. +                         &key_handle) != ERROR_SUCCESS)
  957. +     return 0;
  958. +     /* get the DisplayName out of it to show the user */
  959. +     r = RegQueryValueEx(key_handle, "", 0, &value_type, (LPBYTE)buf, &bufsize);
  960. +     RegCloseKey(key_handle);
  961. +     return (r == ERROR_SUCCESS);
  962. + }
  963.       static void
  964.   remove_popup(void)
  965.   {
  966. ***************
  967. *** 83,93 ****
  968.       ++fail;
  969.   
  970.       if (fail == 6)
  971. !     printf("No Vim registry entries could be removed\n");
  972.       else if (fail)
  973. !     printf("Some Vim registry entries could not be removed\n");
  974.       else
  975. !     printf("The Vim registry entries have been removed\n");
  976.   }
  977.   #endif
  978.   
  979. --- 109,146 ----
  980.       ++fail;
  981.   
  982.       if (fail == 6)
  983. !     printf("No Vim popup registry entries could be removed\n");
  984. !     else if (fail)
  985. !     printf("Some Vim popup registry entries could not be removed\n");
  986. !     else
  987. !     printf("The Vim popup registry entries have been removed\n");
  988. ! }
  989. !     static void
  990. ! remove_openwith(void)
  991. ! {
  992. !     int        fail = 0;
  993. !     HKEY    kh;
  994. !     if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit\\command") != ERROR_SUCCESS)
  995. !     ++fail;
  996. !     if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit") != ERROR_SUCCESS)
  997. !     ++fail;
  998. !     if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell") != ERROR_SUCCESS)
  999. !     ++fail;
  1000. !     if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe") != ERROR_SUCCESS)
  1001. !     ++fail;
  1002. !     if (RegDeleteKey(HKEY_CLASSES_ROOT, ".htm\\OpenWithList\\gvim.exe") != ERROR_SUCCESS)
  1003. !     ++fail;
  1004. !     if (RegDeleteKey(HKEY_CLASSES_ROOT, "*\\OpenWithList\\gvim.exe") != ERROR_SUCCESS)
  1005. !     ++fail;
  1006. !     if (fail == 6)
  1007. !     printf("No Vim open-with registry entries could be removed\n");
  1008.       else if (fail)
  1009. !     printf("Some Vim open-with registry entries could not be removed\n");
  1010.       else
  1011. !     printf("The Vim open-with registry entries have been removed\n");
  1012.   }
  1013.   #endif
  1014.   
  1015. ***************
  1016. *** 302,308 ****
  1017. --- 355,374 ----
  1018.       printf("   which uses \"%s\"\n", popup_path);
  1019.       printf("\nRemove it (y/n)? ");
  1020.       if (confirm())
  1021. +     {
  1022.           remove_popup();
  1023. +         /* Assume the "Open With" entry can be removed as well, don't
  1024. +          * bother the user with asking him again. */
  1025. +         remove_openwith();
  1026. +     }
  1027. +     }
  1028. +     else if (openwith_gvim_path(popup_path))
  1029. +     {
  1030. +     printf(" - the Vim \"Open With...\" entry in the popup menu\n");
  1031. +     printf("   which uses \"%s\"\n", popup_path);
  1032. +     printf("\nRemove it (y/n)? ");
  1033. +     if (confirm())
  1034. +         remove_openwith();
  1035.       }
  1036.   
  1037.       if (get_shell_folder_path(path, "desktop"))
  1038. *** ../vim-6.2.523/src/version.c    Mon May  3 21:30:07 2004
  1039. --- src/version.c    Tue May  4 15:42:08 2004
  1040. ***************
  1041. *** 639,640 ****
  1042. --- 642,645 ----
  1043.   {   /* Add new patch number below this line */
  1044. + /**/
  1045. +     524,
  1046.   /**/
  1047.  
  1048. -- 
  1049. hundred-and-one symptoms of being an internet addict:
  1050. 99. The hum of a cooling fan and the click of keys is comforting to you.
  1051.  
  1052.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  1053. ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  1054. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  1055.  \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
  1056.