Karsten Hopp fc76dd
To: vim_dev@googlegroups.com
Karsten Hopp fc76dd
Subject: Patch 7.3.707
Karsten Hopp fc76dd
Fcc: outbox
Karsten Hopp fc76dd
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp fc76dd
Mime-Version: 1.0
Karsten Hopp fc76dd
Content-Type: text/plain; charset=UTF-8
Karsten Hopp fc76dd
Content-Transfer-Encoding: 8bit
Karsten Hopp fc76dd
------------
Karsten Hopp fc76dd
Karsten Hopp fc76dd
Patch 7.3.707 (after 7.3.701)
Karsten Hopp fc76dd
Problem:    Problems loading a library for a file name with non-latin
Karsten Hopp fc76dd
            characters.
Karsten Hopp fc76dd
Solution:   Use wide system functions when possible. (Ken Takata)
Karsten Hopp fc76dd
Files:      src/os_win32.c, src/os_win32.h
Karsten Hopp fc76dd
Karsten Hopp fc76dd
Karsten Hopp fc76dd
*** ../vim-7.3.706/src/os_win32.c	2012-10-21 02:37:02.000000000 +0200
Karsten Hopp fc76dd
--- src/os_win32.c	2012-10-21 21:33:58.000000000 +0200
Karsten Hopp fc76dd
***************
Karsten Hopp fc76dd
*** 287,313 ****
Karsten Hopp fc76dd
      HINSTANCE
Karsten Hopp fc76dd
  vimLoadLib(char *name)
Karsten Hopp fc76dd
  {
Karsten Hopp fc76dd
!     HINSTANCE dll = NULL;
Karsten Hopp fc76dd
!     TCHAR old_dir[MAXPATHL];
Karsten Hopp fc76dd
  
Karsten Hopp fc76dd
      /* NOTE: Do not use mch_dirname() and mch_chdir() here, they may call
Karsten Hopp fc76dd
       * vimLoadLib() recursively, which causes a stack overflow. */
Karsten Hopp fc76dd
      if (exe_path == NULL)
Karsten Hopp fc76dd
  	get_exe_name();
Karsten Hopp fc76dd
!     if (exe_path != NULL && GetCurrentDirectory(MAXPATHL, old_dir) != 0)
Karsten Hopp fc76dd
      {
Karsten Hopp fc76dd
! 	/* Change directory to where the executable is, both to make sure we
Karsten Hopp fc76dd
! 	 * find a .dll there and to avoid looking for a .dll in the current
Karsten Hopp fc76dd
! 	 * directory. */
Karsten Hopp fc76dd
! 	SetCurrentDirectory(exe_path);
Karsten Hopp fc76dd
! 	dll = LoadLibrary(name);
Karsten Hopp fc76dd
! 	SetCurrentDirectory(old_dir);
Karsten Hopp fc76dd
!     }
Karsten Hopp fc76dd
!     else
Karsten Hopp fc76dd
!     {
Karsten Hopp fc76dd
! 	/* We are not able to change directory to where the executable is, try
Karsten Hopp fc76dd
! 	 * to load library anyway. */
Karsten Hopp fc76dd
! 	dll = LoadLibrary(name);
Karsten Hopp fc76dd
      }
Karsten Hopp fc76dd
      return dll;
Karsten Hopp fc76dd
  }
Karsten Hopp fc76dd
--- 287,326 ----
Karsten Hopp fc76dd
      HINSTANCE
Karsten Hopp fc76dd
  vimLoadLib(char *name)
Karsten Hopp fc76dd
  {
Karsten Hopp fc76dd
!     HINSTANCE	dll = NULL;
Karsten Hopp fc76dd
!     char	old_dir[MAXPATHL];
Karsten Hopp fc76dd
  
Karsten Hopp fc76dd
      /* NOTE: Do not use mch_dirname() and mch_chdir() here, they may call
Karsten Hopp fc76dd
       * vimLoadLib() recursively, which causes a stack overflow. */
Karsten Hopp fc76dd
      if (exe_path == NULL)
Karsten Hopp fc76dd
  	get_exe_name();
Karsten Hopp fc76dd
!     if (exe_path != NULL)
Karsten Hopp fc76dd
      {
Karsten Hopp fc76dd
! #ifdef FEAT_MBYTE
Karsten Hopp fc76dd
! 	WCHAR old_dirw[MAXPATHL];
Karsten Hopp fc76dd
! 
Karsten Hopp fc76dd
! 	if (GetCurrentDirectoryW(MAXPATHL, old_dirw) != 0)
Karsten Hopp fc76dd
! 	{
Karsten Hopp fc76dd
! 	    /* Change directory to where the executable is, both to make
Karsten Hopp fc76dd
! 	     * sure we find a .dll there and to avoid looking for a .dll
Karsten Hopp fc76dd
! 	     * in the current directory. */
Karsten Hopp fc76dd
! 	    SetCurrentDirectory(exe_path);
Karsten Hopp fc76dd
! 	    dll = LoadLibrary(name);
Karsten Hopp fc76dd
! 	    SetCurrentDirectoryW(old_dirw);
Karsten Hopp fc76dd
! 	    return dll;
Karsten Hopp fc76dd
! 	}
Karsten Hopp fc76dd
! 	/* Retry with non-wide function (for Windows 98). */
Karsten Hopp fc76dd
! 	if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
Karsten Hopp fc76dd
! #endif
Karsten Hopp fc76dd
! 	    if (GetCurrentDirectory(MAXPATHL, old_dir) != 0)
Karsten Hopp fc76dd
! 	    {
Karsten Hopp fc76dd
! 		/* Change directory to where the executable is, both to make
Karsten Hopp fc76dd
! 		 * sure we find a .dll there and to avoid looking for a .dll
Karsten Hopp fc76dd
! 		 * in the current directory. */
Karsten Hopp fc76dd
! 		SetCurrentDirectory(exe_path);
Karsten Hopp fc76dd
! 		dll = LoadLibrary(name);
Karsten Hopp fc76dd
! 		SetCurrentDirectory(old_dir);
Karsten Hopp fc76dd
! 	    }
Karsten Hopp fc76dd
      }
Karsten Hopp fc76dd
      return dll;
Karsten Hopp fc76dd
  }
Karsten Hopp fc76dd
*** ../vim-7.3.706/src/os_win32.h	2011-08-10 17:07:56.000000000 +0200
Karsten Hopp fc76dd
--- src/os_win32.h	2012-10-21 21:33:30.000000000 +0200
Karsten Hopp fc76dd
***************
Karsten Hopp fc76dd
*** 108,114 ****
Karsten Hopp fc76dd
   */
Karsten Hopp fc76dd
  #define CMDBUFFSIZE 1024	/* size of the command processing buffer */
Karsten Hopp fc76dd
  
Karsten Hopp fc76dd
! /* _MAX_PATH is only 256 (stdlib.h), but we want more for the 'path' option,
Karsten Hopp fc76dd
   * thus use a larger number. */
Karsten Hopp fc76dd
  #define MAXPATHL	1024
Karsten Hopp fc76dd
  
Karsten Hopp fc76dd
--- 108,114 ----
Karsten Hopp fc76dd
   */
Karsten Hopp fc76dd
  #define CMDBUFFSIZE 1024	/* size of the command processing buffer */
Karsten Hopp fc76dd
  
Karsten Hopp fc76dd
! /* _MAX_PATH is only 260 (stdlib.h), but we want more for the 'path' option,
Karsten Hopp fc76dd
   * thus use a larger number. */
Karsten Hopp fc76dd
  #define MAXPATHL	1024
Karsten Hopp fc76dd
  
Karsten Hopp fc76dd
*** ../vim-7.3.706/src/version.c	2012-10-21 21:25:17.000000000 +0200
Karsten Hopp fc76dd
--- src/version.c	2012-10-21 21:37:52.000000000 +0200
Karsten Hopp fc76dd
***************
Karsten Hopp fc76dd
*** 727,728 ****
Karsten Hopp fc76dd
--- 727,730 ----
Karsten Hopp fc76dd
  {   /* Add new patch number below this line */
Karsten Hopp fc76dd
+ /**/
Karsten Hopp fc76dd
+     707,
Karsten Hopp fc76dd
  /**/
Karsten Hopp fc76dd
Karsten Hopp fc76dd
-- 
Karsten Hopp fc76dd
Our job was to build a computer information system for the branch banks.  We
Karsten Hopp fc76dd
were the perfect people for the job: Dean had seen a computer once, and I had
Karsten Hopp fc76dd
heard Dean talk about it.
Karsten Hopp fc76dd
				(Scott Adams - The Dilbert principle)
Karsten Hopp fc76dd
Karsten Hopp fc76dd
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp fc76dd
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp fc76dd
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp fc76dd
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///