# HG changeset patch # User Bram Moolenaar # Date 1274729662 -7200 # Node ID 120502692d829ccd3302e3d401fc300a7c37b48d # Parent ef150ab31dda336d43b7aa56f92c16d3f23d190f Improve the MS-Windows installer. diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -113,6 +113,7 @@ DOSBIN_S = dosbin_s # - "make amirt", "make amibin". # # PC: +# - Run make on Unix to update the ".mo" files. # - "make dossrc" and "make dosrt". Unpack the archives on a PC. # 16 bit DOS version: (OBSOLETE, 16 bit version doesn't build) # - Set environment for compiling with Borland C++ 3.1. @@ -130,9 +131,11 @@ DOSBIN_S = dosbin_s # - Rename the executables to "vimd32.exe", "xxdd32.exe", "installd32.exe" and # "uninstald32.exe". # Win32 console version: -# - Set environment for Visual C++ 2008 Express Edition: "msvc2008.bat". Or, -# when using the Visual C++ Toolkit 2003: "msvcsetup.bat" (adjust the paths -# when necessary). For Windows 98 the 2003 version is required. +# - Set environment for Visual C++ 2010: +# "E:\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat". Or, for Visual +# C++ 2008 Express Edition: "msvc2008.bat". Or, when using the Visual C++ +# Toolkit 2003: "msvcsetup.bat" (adjust the paths when necessary). For +# Windows 98/ME the 2003 version is required. # - "nmake -f Make_mvc.mak" # - "rm testdir/*.out", "nmake -f Make_mvc.mak test" and check the output. # - Rename the executables to "vimw32.exe", "xxdw32.exe". @@ -165,15 +168,18 @@ DOSBIN_S = dosbin_s # - Copy all the "*.exe" files to where this Makefile is. # - Copy all the "*.pdb" files to where this Makefile is. # - "make dosbin". -# - Run make on Unix to update the ".mo" files. # NSIS self installing exe: +# - To get NSIS see http://nsis.sourceforge.net # - Make sure gvim_ole.exe, vimd32.exe, vimw32.exe, installw32.exe, # uninstalw32.exe and xxdw32.exe have been build as mentioned above. -# - put gvimext.dll in src/GvimExt and VisVim.dll in src/VisVim (get them -# from a binary archive or build them) +# - copy these files (get them from a binary archive or build them): +# gvimext.dll in src/GvimExt +# gvimext64.dll in src/GvimExt +# VisVim.dll in src/VisVim # Note: VisVim needs to be build with MSVC 5, newer versions don't work. +# gvimext64.dll can be obtained from http://code.google.com/p/vim-win3264/ # - make sure there is a diff.exe two levels up -# - go to ../nsis and do "makensis gvim.nsi". +# - go to ../nsis and do "makensis gvim.nsi" (takes a few minutes). # - Copy gvim##.exe to the dist directory. # # OS/2: (OBSOLETE, OS/2 version is no longer distributed) @@ -355,11 +361,35 @@ amisrc: dist prepare no_title.vim: Makefile echo "set notitle noicon nocp nomodeline viminfo=" >no_title.vim +# MS-DOS sources +dossrc: dist no_title.vim dist/$(COMMENT_SRC) runtime/doc/uganda.nsis.txt + -rm -rf dist/vim$(VERSION)src.zip + -rm -rf dist/vim + mkdir dist/vim + mkdir dist/vim/$(VIMRTDIR) + tar cf - \ + $(SRC_ALL) \ + $(SRC_DOS) \ + $(SRC_AMI_DOS) \ + $(SRC_DOS_UNIX) \ + runtime/doc/uganda.nsis.txt \ + | (cd dist/vim/$(VIMRTDIR); tar xf -) + mv dist/vim/$(VIMRTDIR)/runtime/* dist/vim/$(VIMRTDIR) + rmdir dist/vim/$(VIMRTDIR)/runtime + find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \; + tar cf - \ + $(SRC_DOS_BIN) \ + | (cd dist/vim/$(VIMRTDIR); tar xf -) + cd dist && zip -9 -rD -z vim$(VERSION)src.zip vim <$(COMMENT_SRC) + +runtime/doc/uganda.nsis.txt: runtime/doc/uganda.txt + cd runtime/doc && $(MAKE) uganda.nsis.txt + dosrt: dist dist/$(COMMENT_RT) dosrt_unix2dos -rm -rf dist/vim$(VERSION)rt.zip cd dist && zip -9 -rD -z vim$(VERSION)rt.zip vim <$(COMMENT_RT) -# Split in two parts to avoid a "argument list too long" error. +# Split in two parts to avoid an "argument list too long" error. dosrt_unix2dos: dist prepare no_title.vim -rm -rf dist/vim mkdir dist/vim @@ -516,30 +546,6 @@ dosbin_s: dist no_title.vim dist/$(COMME cp uninstalw32.exe dist/vim/$(VIMRTDIR)/uninstal.exe cd dist && zip -9 -rD -z gvim$(VERSION)_s.zip vim <$(COMMENT_W32S) -# MS-DOS sources -dossrc: dist no_title.vim dist/$(COMMENT_SRC) runtime/doc/uganda.nsis.txt - -rm -rf dist/vim$(VERSION)src.zip - -rm -rf dist/vim - mkdir dist/vim - mkdir dist/vim/$(VIMRTDIR) - tar cf - \ - $(SRC_ALL) \ - $(SRC_DOS) \ - $(SRC_AMI_DOS) \ - $(SRC_DOS_UNIX) \ - runtime/doc/uganda.nsis.txt \ - | (cd dist/vim/$(VIMRTDIR); tar xf -) - mv dist/vim/$(VIMRTDIR)/runtime/* dist/vim/$(VIMRTDIR) - rmdir dist/vim/$(VIMRTDIR)/runtime - find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \; - tar cf - \ - $(SRC_DOS_BIN) \ - | (cd dist/vim/$(VIMRTDIR); tar xf -) - cd dist && zip -9 -rD -z vim$(VERSION)src.zip vim <$(COMMENT_SRC) - -runtime/doc/uganda.nsis.txt: runtime/doc/uganda.txt - cd runtime/doc && $(MAKE) uganda.nsis.txt - os2bin: dist no_title.vim dist/$(COMMENT_OS2) -rm -rf dist/vim$(VERSION)os2.zip -rm -rf dist/vim diff --git a/nsis/gvim.nsi b/nsis/gvim.nsi --- a/nsis/gvim.nsi +++ b/nsis/gvim.nsi @@ -27,12 +27,15 @@ # ----------- No configurable settings below this line ----------- !include UpgradeDLL.nsh # for VisVim.dll +!include LogicLib.nsh +!include x64.nsh Name "Vim ${VER_MAJOR}.${VER_MINOR}" OutFile gvim${VER_MAJOR}${VER_MINOR}.exe CRCCheck force SetCompressor lzma SetDatablockOptimize on +RequestExecutionLevel highest ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer." DirText "Choose a directory to install Vim (must end in 'vim')" @@ -290,13 +293,21 @@ Section "Add an Edit-with-Vim context me SetOutPath $0 ClearErrors SetOverwrite try - File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll + ${If} ${RunningX64} + File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext64.dll + ${Else} + File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll + ${EndIf} 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 + ${If} ${RunningX64} + File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll + ${Else} + File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll + ${EndIf} Rename /REBOOTOK $3 $0\gvimext.dll GvimExtDone: diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt --- a/runtime/doc/os_win32.txt +++ b/runtime/doc/os_win32.txt @@ -37,7 +37,7 @@ The Win32 version was written by George The original Windows NT port was done by Roger Knobbe . The GUI version was made by George V. Reilly and Robert Webb. -For compiling see "src/INSTALL.pc". *win32-compiling* +For compiling see "src/INSTALLpc.txt". *win32-compiling* ============================================================================== 1. Known problems *windows95* *win32-problems* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1084,12 +1084,12 @@ restored. (Luc St-Louis) Vim 7.3: -- Use NSIS 2.45, it includes Windows 7 support. - Include "RequestExecutionLevel highest" - Ron's version: http://dev.ronware.org/p/vim/finfo?name=gvim.nsi -- Supply a 64 bit version of gvimext.dll for 64 bit windows. - http://code.google.com/p/vim-win3264/ - Gvim can be 32 bit. +- Win32 DOS and Win32 console version: test69 fails. +- using NSIS 2.46: install on Windows 7 works, but no "Edit with Vim" menu. + Ron's version: http://dev.ronware.org/p/vim/finfo?name=gvim.nsi +- When running uninstall program from NSIS via install.exe, still need to + ask confirmation in console window, uninstaller doesn't wait. Is there an + NSIS option to wait? Patches to include: - Persistent undo bugs / fixes: - Add undofile(name): get undo file name for buffer "name". diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt --- a/src/INSTALLpc.txt +++ b/src/INSTALLpc.txt @@ -162,6 +162,17 @@ Visual C++ 2008 Express Edition *m ------------------------------- Visual C++ 2008 Express Edition can be downloaded for free from: + http://www.microsoft.com/express/downloads/ +This includes the IDE and the debugger. + +To set the environment execute the msvc2008.bat script. You can then build +Vim with Make_mvc.mak. + + +Visual C++ 2010 Express Edition *msvc-2010-express* +------------------------------- + +Visual C++ 2010 Express Edition can be downloaded for free from: http://www.microsoft.com/express/vc/Default.aspx This includes the IDE and the debugger. diff --git a/src/blowfish.c b/src/blowfish.c --- a/src/blowfish.c +++ b/src/blowfish.c @@ -25,7 +25,7 @@ typedef union { char_u uc[8]; } block8; -#ifdef WIN3264 +#if defined(WIN3264) || defined(DOS32) /* MS-Windows is always little endian */ #else # ifdef HAVE_CONFIG_H @@ -406,7 +406,7 @@ bf_key_init(password) int keylen; key = sha256_key(password); - keylen = STRLEN(key); + keylen = (int)STRLEN(key); for (i = 0; i < 256; ++i) { sbx[0][i] = sbi[0][i]; diff --git a/src/dosinst.c b/src/dosinst.c --- a/src/dosinst.c +++ b/src/dosinst.c @@ -451,7 +451,7 @@ get_vim_env(void) * Return non-zero when found one. */ static int -uninstall_check(void) +uninstall_check(int skip_question) { HKEY key_handle; HKEY uninstall_key_handle; @@ -502,7 +502,10 @@ uninstall_check(void) printf("(The batch files used in a console and the \"Edit with Vim\" entry in\n"); printf("the popup menu will use the new version)\n"); - printf("\nDo you want to uninstall \"%s\" now?\n(y)es/(n)o) ", temp_string_buffer); + if (skip_question) + printf("\nRunning uninstall program for \"%s\"\n", temp_string_buffer); + else + printf("\nDo you want to uninstall \"%s\" now?\n(y)es/(n)o) ", temp_string_buffer); fflush(stdout); /* get the UninstallString */ @@ -523,8 +526,13 @@ uninstall_check(void) if (input != 'n') printf("%c is an invalid reply. Please enter either 'y' or 'n'\n", input); - rewind(stdin); - scanf("%c", &input); + if (skip_question) + input = 'y'; + else + { + rewind(stdin); + scanf("%c", &input); + } switch (input) { case 'y': @@ -535,12 +543,14 @@ uninstall_check(void) &orig_num_keys, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +#if 0 /* let the uninstall program delete the key */ /* Delete the uninstall key. It has no subkeys, so * this is easy. Do this before uninstalling, that * may try to delete the key as well. */ RegDeleteKey(key_handle, subkey_name_buff); +#endif - /* Find existing .bat files before deleting them. */ + /* Find existing .bat files before deleting them. */ find_bat_exe(TRUE); /* Execute the uninstall program. Put it in double @@ -2376,16 +2386,23 @@ main(int argc, char **argv) if (argc > 1 && strcmp(argv[1], "-uninstall-check") == 0) { /* Only check for already installed Vims. Used by NSIS installer. */ - i = uninstall_check(); + i = uninstall_check(1); /* Find the value of $VIM, because NSIS isn't able to do this by * itself. */ get_vim_env(); /* When nothing found exit quietly. If something found wait for - * return pressed. */ + * hitting Enter. + * We would like to exit without hitting Enter, but the uninstaller + * detaches itself, thus we get here before it's finished. */ if (i) - myexit(0); + { + printf("\n"); + printf("When the uninstall program is finished, press Enter to continue\n"); + rewind(stdin); + (void)getchar(); + } exit(0); } #endif @@ -2399,7 +2416,7 @@ main(int argc, char **argv) #ifdef WIN3264 /* Check for already installed Vims. */ if (interactive) - uninstall_check(); + uninstall_check(0); #endif /* Find out information about the system. */ @@ -2449,6 +2466,7 @@ main(int argc, char **argv) } } printf("\n"); + myexit(0); } else { @@ -2457,9 +2475,11 @@ main(int argc, char **argv) */ command_line_setup_choices(argc, argv); install(); + + /* Avoid that the user has to hit Enter, just wait a little bit to + * allow reading the messages. */ + Sleep(2000); } - myexit(0); - /*NOTREACHED*/ return 0; } diff --git a/src/dosinst.h b/src/dosinst.h --- a/src/dosinst.h +++ b/src/dosinst.h @@ -418,12 +418,12 @@ run_command(char *cmd) /* There is a cmd.exe, so this might be Windows NT. If it is, * we need to call cmd.exe explicitly. If it is a later OS, * calling cmd.exe won't hurt if it is present. - * Also, "wait" on NT expects a window title argument. + * Also, "start" on NT expects a window title argument. */ /* Replace the slashes with backslashes. */ while ((p = strchr(cmd_path, '/')) != NULL) *p = '\\'; - sprintf(cmd_buf, "%s /c start \"vimcmd\" /w %s", cmd_path, cmd); + sprintf(cmd_buf, "%s /c start \"vimcmd\" /wait %s", cmd_path, cmd); free(cmd_path); } else diff --git a/src/fileio.c b/src/fileio.c --- a/src/fileio.c +++ b/src/fileio.c @@ -2848,7 +2848,7 @@ get_crypt_method(ptr, len) return i; } - i = STRLEN(crypt_magic_head); + i = (int)STRLEN(crypt_magic_head); if (len >= i && memcmp(ptr, crypt_magic_head, i) == 0) EMSG(_("E821: File is encrypted with unknown method")); @@ -4409,7 +4409,7 @@ restore_backup: ptr = ml_get_buf(buf, lnum, FALSE) - 1; #ifdef FEAT_PERSISTENT_UNDO if (write_undo_file) - sha256_update(&sha_ctx, ptr + 1, STRLEN(ptr + 1) + 1); + sha256_update(&sha_ctx, ptr + 1, (UINT32_T)(STRLEN(ptr + 1) + 1)); #endif while ((c = *++ptr) != NUL) { @@ -5675,7 +5675,10 @@ need_conversion(fenc) int fenc_flags; if (*fenc == NUL || STRCMP(p_enc, fenc) == 0) + { same_encoding = TRUE; + fenc_flags = 0; + } else { /* Ignore difference between "ansi" and "latin1", "ucs-4" and diff --git a/src/gui_w32.c b/src/gui_w32.c --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -183,7 +183,7 @@ # define ID_BEVAL_TOOLTIP 200 # define BEVAL_TEXT_LEN MAXPATHL -#if _MSC_VER < 1300 +#if _MSC_VER < 1300 || !defined(UINT_PTR) /* Work around old versions of basetsd.h which wrongly declares * UINT_PTR as unsigned long. */ # define UINT_PTR UINT @@ -4765,9 +4765,7 @@ gui_mch_create_beval_area(target, mesg, /*ARGSUSED*/ static void -Handle_WM_Notify(hwnd, pnmh) - HWND hwnd; - LPNMHDR pnmh; +Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh) { if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */ return; diff --git a/src/menu.c b/src/menu.c --- a/src/menu.c +++ b/src/menu.c @@ -462,7 +462,7 @@ add_menu_path(menu_path, menuarg, pri_ta * name (without mnemonic and accelerator text). */ next_name = menu_name_skip(name); #ifdef FEAT_MULTI_LANG - map_to = menutrans_lookup(name,STRLEN(name)); + map_to = menutrans_lookup(name, (int)STRLEN(name)); if (map_to != NULL) { en_name = name; diff --git a/src/os_mswin.c b/src/os_mswin.c --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -787,7 +787,7 @@ check_str_len(char_u *str) /* get length from str to end of page */ long_u pageLength = si.dwPageSize - (dwStr - strPage); - for (p = str; !IsBadReadPtr(p, pageLength); + for (p = str; !IsBadReadPtr(p, (UINT)pageLength); p += pageLength, pageLength = si.dwPageSize) for (i = 0; i < pageLength; ++i, ++length) if (p[i] == NUL) @@ -1779,7 +1779,7 @@ swap_me(COLORREF colorref) } /* Attempt to make this work for old and new compilers */ -#if _MSC_VER < 1300 +#if !defined(_MSC_VER) || (_MSC_VER < 1300) || !defined(INT_PTR) # define PDP_RETVAL BOOL #else # define PDP_RETVAL INT_PTR diff --git a/src/sha256.c b/src/sha256.c --- a/src/sha256.c +++ b/src/sha256.c @@ -307,7 +307,7 @@ sha256_key(buf) if (buf == NULL || *buf == NUL) return (char_u *)""; - return sha256_bytes(buf, STRLEN(buf)); + return sha256_bytes(buf, (int)STRLEN(buf)); } /* @@ -354,7 +354,7 @@ sha256_self_test() if (i < 2) { hexit = sha256_bytes((char_u *)sha_self_test_msg[i], - STRLEN(sha_self_test_msg[i])); + (int)STRLEN(sha_self_test_msg[i])); STRCPY(output, hexit); } else diff --git a/src/undo.c b/src/undo.c --- a/src/undo.c +++ b/src/undo.c @@ -82,6 +82,10 @@ #define UH_MAGIC 0x18dade /* value for uh_magic when in use */ #define UE_MAGIC 0xabc123 /* value for ue_magic when in use */ +#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64) +# include "vimio.h" /* for vim_read(), must be before vim.h */ +#endif + #include "vim.h" /* See below: use malloc()/free() for memory management. */ @@ -685,7 +689,7 @@ u_compute_hash(hash) for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; ++lnum) { p = ml_get(lnum); - sha256_update(&ctx, p, STRLEN(p) + 1); + sha256_update(&ctx, p, (UINT32_T)(STRLEN(p) + 1)); } sha256_finish(&ctx, hash); } @@ -764,7 +768,7 @@ u_get_undo_file_name(buf_ffname, reading { /* Use same directory as the ffname, * "dir/name" -> "dir/.name.un~" */ - undo_file_name = vim_strnsave(ffname, STRLEN(ffname) + 5); + undo_file_name = vim_strnsave(ffname, (int)(STRLEN(ffname) + 5)); if (undo_file_name == NULL) break; p = gettail(undo_file_name); @@ -823,7 +827,7 @@ u_read_undo(name, hash) linenr_T line_count; int uep_len; int line_len; - int num_head; + int num_head = 0; long old_header_seq, new_header_seq, cur_header_seq; long seq_last, seq_cur; short old_idx = -1, new_idx = -1, cur_idx = -1; @@ -929,10 +933,10 @@ u_read_undo(name, hash) /* We're not actually trying to store pointers here. We're just storing * IDs so we can swizzle them into pointers later - hence the type * cast. */ - uhp->uh_next = (u_header_T *)(long)get4c(fp); - uhp->uh_prev = (u_header_T *)(long)get4c(fp); - uhp->uh_alt_next = (u_header_T *)(long)get4c(fp); - uhp->uh_alt_prev = (u_header_T *)(long)get4c(fp); + uhp->uh_next = (u_header_T *)get4c(fp); + uhp->uh_prev = (u_header_T *)get4c(fp); + uhp->uh_alt_next = (u_header_T *)get4c(fp); + uhp->uh_alt_prev = (u_header_T *)get4c(fp); uhp->uh_seq = get4c(fp); if (uhp->uh_seq <= 0) { @@ -1139,6 +1143,8 @@ serialize_uep(uep, fp) if (uep->ue_size > 0) entry_lens = (int *)alloc(uep->ue_size * sizeof(int)); + else + entry_lens = NULL; /* Define uep_len to be the size of the entire uep minus the size of its * component strings, in bytes. The sizes of the component strings @@ -1335,7 +1341,7 @@ u_write_undo(name, forceit, buf, hash) put_bytes(fp, (long_u)buf->b_ml.ml_line_count, 4); /* Begin undo data for U */ - str_len = buf->b_u_line_ptr != NULL ? STRLEN(buf->b_u_line_ptr) : 0; + str_len = buf->b_u_line_ptr != NULL ? (int)STRLEN(buf->b_u_line_ptr) : 0; put_bytes(fp, (long_u)str_len, 4); if (str_len > 0 && fwrite(buf->b_u_line_ptr, (size_t)str_len, (size_t)1, fp) != 1) diff --git a/src/uninstal.c b/src/uninstal.c --- a/src/uninstal.c +++ b/src/uninstal.c @@ -354,8 +354,9 @@ main(int argc, char *argv[]) { printf(" - the \"Edit with Vim\" entry in the popup menu\n"); printf(" which uses \"%s\"\n", popup_path); - printf("\nRemove it (y/n)? "); - if (confirm()) + if (interactive) + printf("\nRemove it (y/n)? "); + if (!interactive || confirm()) { remove_popup(); /* Assume the "Open With" entry can be removed as well, don't @@ -430,9 +431,14 @@ main(int argc, char *argv[]) printf("(They are still where you unpacked them.)\n"); } - rewind(stdin); - printf("\nPress Enter to exit..."); - (void)getchar(); + if (interactive) + { + rewind(stdin); + printf("\nPress Enter to exit..."); + (void)getchar(); + } + else + Sleep(3000); return 0; } diff --git a/src/vim.h b/src/vim.h --- a/src/vim.h +++ b/src/vim.h @@ -1943,6 +1943,11 @@ typedef int VimClipboard; /* This is req #pragma option -p. #endif +#ifdef _MSC_VER +/* Avoid useless warning "conversion from X to Y of greater size". */ + #pragma warning(disable : 4312) +#endif + #if defined(MEM_PROFILE) # define vim_realloc(ptr, size) mem_realloc((ptr), (size)) #else