Skip to content

Commit b6004e2

Browse files
committed
updated for version 7.4.124
Problem: Win32: Getting host name does not use wide function. Solution: Use GetComputerNameW() if possible. (Ken Takata)
1 parent 2b3e49e commit b6004e2

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/os_win32.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2808,6 +2808,26 @@ mch_get_host_name(
28082808
{
28092809
DWORD cch = len;
28102810

2811+
#ifdef FEAT_MBYTE
2812+
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
2813+
{
2814+
WCHAR wszHostName[256 + 1];
2815+
DWORD wcch = sizeof(wszHostName) / sizeof(WCHAR);
2816+
2817+
if (GetComputerNameW(wszHostName, &wcch))
2818+
{
2819+
char_u *p = utf16_to_enc(wszHostName, NULL);
2820+
2821+
if (p != NULL)
2822+
{
2823+
vim_strncpy(s, p, len - 1);
2824+
vim_free(p);
2825+
return;
2826+
}
2827+
}
2828+
/* Retry with non-wide function (for Windows 98). */
2829+
}
2830+
#endif
28112831
if (!GetComputerName(s, &cch))
28122832
vim_strncpy(s, "PC (Win32 Vim)", len - 1);
28132833
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
124,
741743
/**/
742744
123,
743745
/**/

0 commit comments

Comments
 (0)