Improve the MS-Windows installer.
diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt
index 5854c8a..a698b35 100644
--- a/src/INSTALLpc.txt
+++ b/src/INSTALLpc.txt
@@ -162,6 +162,17 @@
 -------------------------------
 
 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
index 02d9008..e449da3 100644
--- a/src/blowfish.c
+++ b/src/blowfish.c
@@ -25,7 +25,7 @@
     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 @@
     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
index 35fa27e..4c09f96 100644
--- a/src/dosinst.c
+++ b/src/dosinst.c
@@ -451,7 +451,7 @@
  * 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 @@
 	    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 @@
 		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 @@
 					     &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 @@
     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 @@
 #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 @@
 	    }
 	}
 	printf("\n");
+	myexit(0);
     }
     else
     {
@@ -2457,9 +2475,11 @@
 	 */
 	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
index 779b3fc..6053129 100644
--- a/src/dosinst.h
+++ b/src/dosinst.h
@@ -418,12 +418,12 @@
 	/* 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
index 779a0d6..f8375c6 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2848,7 +2848,7 @@
 	    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 @@
 	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 @@
     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
index af84f72..9739815 100644
--- 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 @@
 
 /*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
index 0fb286c..f01a34e 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -462,7 +462,7 @@
 	 * 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
index 2e692a7..562dca1 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -787,7 +787,7 @@
 	/* 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 @@
 }
 
 /* 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
index 6ea3f81..0f95856 100644
--- a/src/sha256.c
+++ b/src/sha256.c
@@ -307,7 +307,7 @@
     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 @@
 	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
index 44a7c95..225c632 100644
--- 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 @@
     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 @@
 	{
 	    /* 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 @@
     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 @@
         /* 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 @@
 
     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 @@
     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
index 23c246b..04481ee 100644
--- a/src/uninstal.c
+++ b/src/uninstal.c
@@ -354,8 +354,9 @@
     {
 	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 @@
 	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
index 86d677b..8ae6856 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -1943,6 +1943,11 @@
  #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