mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
updated for version 7.4.123
Problem: Win32: Getting user name does not use wide function. Solution: Use GetUserNameW() if possible. (Ken Takata)
This commit is contained in:
@@ -2768,6 +2768,26 @@ mch_get_user_name(
|
|||||||
char szUserName[256 + 1]; /* UNLEN is 256 */
|
char szUserName[256 + 1]; /* UNLEN is 256 */
|
||||||
DWORD cch = sizeof szUserName;
|
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))
|
if (GetUserName(szUserName, &cch))
|
||||||
{
|
{
|
||||||
vim_strncpy(s, szUserName, len - 1);
|
vim_strncpy(s, szUserName, len - 1);
|
||||||
|
@@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
123,
|
||||||
/**/
|
/**/
|
||||||
122,
|
122,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user