diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-06-19 18:58:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-06-19 18:58:07 +0200 |
commit | 828c3d70833a0689cc07581f2a67d06430675da5 (patch) | |
tree | 612b23768f415285a94cce0044b594866a2ea5bb | |
parent | 8516071124dbb7ad7caa43cc98ae3c57ae093c9e (diff) |
patch 8.1.0084: user name completion does not work on MS-Windowsv8.1.0084
Problem: User name completion does not work on MS-Windows.
Solution: Use NetUserEnum() to get user names. (Yasuhiro Matsumoto)
-rw-r--r-- | src/Make_cyg_ming.mak | 2 | ||||
-rw-r--r-- | src/Make_ivc.mak | 2 | ||||
-rw-r--r-- | src/Make_mvc.mak | 5 | ||||
-rw-r--r-- | src/misc1.c | 26 | ||||
-rw-r--r-- | src/version.c | 2 |
5 files changed, 33 insertions, 4 deletions
diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index d51b6ea898..cdec101fbb 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -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 = \ diff --git a/src/Make_ivc.mak b/src/Make_ivc.mak index d90477c761..c8c1c2f97a 100644 --- a/src/Make_ivc.mak +++ b/src/Make_ivc.mak @@ -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 diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 5ca5380877..8cb443c7c5 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -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 diff --git a/src/misc1.c b/src/misc1.c index 76f50258ad..d797a0bc65 100644 --- a/src/misc1.c +++ b/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 } diff --git a/src/version.c b/src/version.c index 20cd3803cd..9d4d4493b5 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 84, +/**/ 83, /**/ 82, |