Karsten Hopp 762525
To: vim_dev@googlegroups.com
Karsten Hopp 762525
Subject: Patch 7.4.123
Karsten Hopp 762525
Fcc: outbox
Karsten Hopp 762525
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 762525
Mime-Version: 1.0
Karsten Hopp 762525
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 762525
Content-Transfer-Encoding: 8bit
Karsten Hopp 762525
------------
Karsten Hopp 762525
Karsten Hopp 762525
Patch 7.4.123
Karsten Hopp 762525
Problem:    Win32: Getting user name does not use wide function.
Karsten Hopp 762525
Solution:   Use GetUserNameW() if possible. (Ken Takata)
Karsten Hopp 762525
Files:	    src/os_win32.c
Karsten Hopp 762525
Karsten Hopp 762525
Karsten Hopp 762525
*** ../vim-7.4.122/src/os_win32.c	2013-12-11 17:58:29.000000000 +0100
Karsten Hopp 762525
--- src/os_win32.c	2013-12-11 18:14:29.000000000 +0100
Karsten Hopp 762525
***************
Karsten Hopp 762525
*** 2768,2773 ****
Karsten Hopp 762525
--- 2768,2793 ----
Karsten Hopp 762525
      char szUserName[256 + 1];	/* UNLEN is 256 */
Karsten Hopp 762525
      DWORD cch = sizeof szUserName;
Karsten Hopp 762525
  
Karsten Hopp 762525
+ #ifdef FEAT_MBYTE
Karsten Hopp 762525
+     if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
Karsten Hopp 762525
+     {
Karsten Hopp 762525
+ 	WCHAR wszUserName[256 + 1];	/* UNLEN is 256 */
Karsten Hopp 762525
+ 	DWORD wcch = sizeof(wszUserName) / sizeof(WCHAR);
Karsten Hopp 762525
+ 
Karsten Hopp 762525
+ 	if (GetUserNameW(wszUserName, &wcch))
Karsten Hopp 762525
+ 	{
Karsten Hopp 762525
+ 	    char_u  *p = utf16_to_enc(wszUserName, NULL);
Karsten Hopp 762525
+ 
Karsten Hopp 762525
+ 	    if (p != NULL)
Karsten Hopp 762525
+ 	    {
Karsten Hopp 762525
+ 		vim_strncpy(s, p, len - 1);
Karsten Hopp 762525
+ 		vim_free(p);
Karsten Hopp 762525
+ 		return OK;
Karsten Hopp 762525
+ 	    }
Karsten Hopp 762525
+ 	}
Karsten Hopp 762525
+ 	/* Retry with non-wide function (for Windows 98). */
Karsten Hopp 762525
+     }
Karsten Hopp 762525
+ #endif
Karsten Hopp 762525
      if (GetUserName(szUserName, &cch))
Karsten Hopp 762525
      {
Karsten Hopp 762525
  	vim_strncpy(s, szUserName, len - 1);
Karsten Hopp 762525
*** ../vim-7.4.122/src/version.c	2013-12-11 17:58:29.000000000 +0100
Karsten Hopp 762525
--- src/version.c	2013-12-11 18:15:48.000000000 +0100
Karsten Hopp 762525
***************
Karsten Hopp 762525
*** 740,741 ****
Karsten Hopp 762525
--- 740,743 ----
Karsten Hopp 762525
  {   /* Add new patch number below this line */
Karsten Hopp 762525
+ /**/
Karsten Hopp 762525
+     123,
Karsten Hopp 762525
  /**/
Karsten Hopp 762525
Karsten Hopp 762525
-- 
Karsten Hopp 762525
Everybody lies, but it doesn't matter since nobody listens.
Karsten Hopp 762525
                                -- Lieberman's Law
Karsten Hopp 762525
Karsten Hopp 762525
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 762525
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 762525
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 762525
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///