Skip to content

Commit b13357b

Browse files
committed
updated for version 7.4.123
Problem: Win32: Getting user name does not use wide function. Solution: Use GetUserNameW() if possible. (Ken Takata)
1 parent def142b commit b13357b

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
@@ -2768,6 +2768,26 @@ mch_get_user_name(
27682768
char szUserName[256 + 1]; /* UNLEN is 256 */
27692769
DWORD cch = sizeof szUserName;
27702770

2771+
#ifdef FEAT_MBYTE
2772+
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
2773+
{
2774+
WCHAR wszUserName[256 + 1]; /* UNLEN is 256 */
2775+
DWORD wcch = sizeof(wszUserName) / sizeof(WCHAR);
2776+
2777+
if (GetUserNameW(wszUserName, &wcch))
2778+
{
2779+
char_u *p = utf16_to_enc(wszUserName, NULL);
2780+
2781+
if (p != NULL)
2782+
{
2783+
vim_strncpy(s, p, len - 1);
2784+
vim_free(p);
2785+
return OK;
2786+
}
2787+
}
2788+
/* Retry with non-wide function (for Windows 98). */
2789+
}
2790+
#endif
27712791
if (GetUserName(szUserName, &cch))
27722792
{
27732793
vim_strncpy(s, szUserName, len - 1);

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+
123,
741743
/**/
742744
122,
743745
/**/

0 commit comments

Comments
 (0)