mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.0084: user name completion does not work on MS-Windows
Problem: User name completion does not work on MS-Windows. Solution: Use NetUserEnum() to get user names. (Yasuhiro Matsumoto)
This commit is contained in:
parent
8516071124
commit
828c3d7083
@ -662,7 +662,7 @@ endif
|
||||
CFLAGS += -s
|
||||
endif
|
||||
|
||||
LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion
|
||||
LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion
|
||||
GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
|
||||
CUIOBJ = $(OUTDIR)/iscygpty.o
|
||||
OBJ = \
|
||||
|
@ -88,7 +88,7 @@ LINK32=link.exe
|
||||
CPP_PROJ= /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c
|
||||
|
||||
LINK32_FLAGS= oldnames.lib kernel32.lib user32.lib gdi32.lib version.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib uuid.lib /nologo /machine:I386 /nodefaultlib
|
||||
LINK32_FLAGS= oldnames.lib kernel32.lib user32.lib gdi32.lib version.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib netapi32.lib uuid.lib /nologo /machine:I386 /nodefaultlib
|
||||
# ADD LINK32 oldnames.lib kernel32.lib user32.lib gdi32.lib version.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib uuid.lib /nologo /machine:I386 /nodefaultlib
|
||||
# SUBTRACT LINK32 /incremental:yes
|
||||
|
||||
|
@ -489,10 +489,11 @@ NETBEANS_LIB = WSock32.lib
|
||||
|
||||
# need advapi32.lib for GetUserName()
|
||||
# need shell32.lib for ExtractIcon()
|
||||
# need netapi32.lib for NetUserEnum()
|
||||
# gdi32.lib and comdlg32.lib for printing support
|
||||
# ole32.lib and uuid.lib are needed for FEAT_SHORTCUT
|
||||
CON_LIB = oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib \
|
||||
comdlg32.lib ole32.lib uuid.lib /machine:$(CPU)
|
||||
comdlg32.lib ole32.lib netapi32.lib uuid.lib /machine:$(CPU)
|
||||
!if "$(DELAYLOAD)" == "yes"
|
||||
CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib
|
||||
!endif
|
||||
@ -801,7 +802,7 @@ GUI_OBJ = \
|
||||
$(OUTDIR)\os_w32exe.obj
|
||||
GUI_LIB = \
|
||||
gdi32.lib version.lib $(IME_LIB) \
|
||||
winspool.lib comctl32.lib advapi32.lib shell32.lib \
|
||||
winspool.lib comctl32.lib advapi32.lib shell32.lib netapi32.lib \
|
||||
/machine:$(CPU)
|
||||
!else
|
||||
SUBSYSTEM = console
|
||||
|
26
src/misc1.c
26
src/misc1.c
@ -14,6 +14,10 @@
|
||||
#include "vim.h"
|
||||
#include "version.h"
|
||||
|
||||
#if defined(FEAT_CMDL_COMPL) && defined(WIN3264)
|
||||
# include <lm.h>
|
||||
#endif
|
||||
|
||||
static char_u *vim_version_dir(char_u *vimdir);
|
||||
static char_u *remove_tail(char_u *p, char_u *pend, char_u *name);
|
||||
#if defined(FEAT_CMDL_COMPL)
|
||||
@ -4603,6 +4607,28 @@ init_users(void)
|
||||
}
|
||||
endpwent();
|
||||
}
|
||||
# elif defined(WIN3264)
|
||||
{
|
||||
char_u* user;
|
||||
DWORD nusers = 0, ntotal = 0, i;
|
||||
PUSER_INFO_0 uinfo;
|
||||
|
||||
if (NetUserEnum(NULL, 0, 0, (LPBYTE *) &uinfo, MAX_PREFERRED_LENGTH,
|
||||
&nusers, &ntotal, NULL) == NERR_Success)
|
||||
{
|
||||
for (i = 0; i < nusers; i++)
|
||||
{
|
||||
if (ga_grow(&ga_users, 1) == FAIL)
|
||||
break;
|
||||
user = utf16_to_enc(uinfo[i].usri0_name, NULL);
|
||||
if (user == NULL)
|
||||
break;
|
||||
((char_u **)(ga_users.ga_data))[ga_users.ga_len++] = user;
|
||||
}
|
||||
|
||||
NetApiBufferFree(uinfo);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
@ -761,6 +761,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
84,
|
||||
/**/
|
||||
83,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user