summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-12-11 18:18:06 +0100
committerBram Moolenaar <Bram@vim.org>2013-12-11 18:18:06 +0100
commitc8020ee825b9d9196b1329c0e097424576fc9b3a (patch)
tree7457739d4f16f661e07a188f85687990cb78b196
parent910cffbb5ea2df88688301168eb04926c9e68990 (diff)
downloadvim-git-7.4.123.tar.gz
updated for version 7.4.123v7.4.123
Problem: Win32: Getting user name does not use wide function. Solution: Use GetUserNameW() if possible. (Ken Takata)
-rw-r--r--src/os_win32.c20
-rw-r--r--src/version.c2
2 files changed, 22 insertions, 0 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index 2d5544b44..06cc315e5 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -2768,6 +2768,26 @@ mch_get_user_name(
char szUserName[256 + 1]; /* UNLEN is 256 */
DWORD cch = sizeof szUserName;
+#ifdef FEAT_MBYTE
+ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
+ {
+ WCHAR wszUserName[256 + 1]; /* UNLEN is 256 */
+ DWORD wcch = sizeof(wszUserName) / sizeof(WCHAR);
+
+ if (GetUserNameW(wszUserName, &wcch))
+ {
+ char_u *p = utf16_to_enc(wszUserName, NULL);
+
+ if (p != NULL)
+ {
+ vim_strncpy(s, p, len - 1);
+ vim_free(p);
+ return OK;
+ }
+ }
+ /* Retry with non-wide function (for Windows 98). */
+ }
+#endif
if (GetUserName(szUserName, &cch))
{
vim_strncpy(s, szUserName, len - 1);
diff --git a/src/version.c b/src/version.c
index 4bfd68ff9..8a44a1c54 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 123,
+/**/
122,
/**/
121,