diff options
author | Bram Moolenaar <bram@vim.org> | 2013-12-11 18:21:45 +0100 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2013-12-11 18:21:45 +0100 |
commit | 41a3107cde1db8c2365923645fe3f41055d515ea (patch) | |
tree | 9821770752826e16dac174d890f43dad3494d7fe | |
parent | 0869d434dd679cb41800e37cd58cfd68b06478ff (diff) | |
download | vim-41a3107cde1db8c2365923645fe3f41055d515ea.tar.gz |
Problem: Win32: Getting host name does not use wide function.
Solution: Use GetComputerNameW() if possible. (Ken Takata)
-rw-r--r-- | src/os_win32.c | 20 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/os_win32.c b/src/os_win32.c index 06cc315e..17df345f 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -2808,6 +2808,26 @@ mch_get_host_name( { DWORD cch = len; +#ifdef FEAT_MBYTE + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + WCHAR wszHostName[256 + 1]; + DWORD wcch = sizeof(wszHostName) / sizeof(WCHAR); + + if (GetComputerNameW(wszHostName, &wcch)) + { + char_u *p = utf16_to_enc(wszHostName, NULL); + + if (p != NULL) + { + vim_strncpy(s, p, len - 1); + vim_free(p); + return; + } + } + /* Retry with non-wide function (for Windows 98). */ + } +#endif if (!GetComputerName(s, &cch)) vim_strncpy(s, "PC (Win32 Vim)", len - 1); } diff --git a/src/version.c b/src/version.c index 8a44a1c5..f4696d78 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 */ /**/ + 124, +/**/ 123, /**/ 122, |