To: vim_dev@googlegroups.com Subject: Patch 8.1.0084 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0084 Problem: User name completion does not work on MS-Windows. Solution: Use NetUserEnum() to get user names. (Yasuhiro Matsumoto) Files: src/Make_ivc.mak, src/Make_cyg_ming.mak, src/Make_mvc.mak, src/misc1.c *** ../vim-8.1.0083/src/Make_ivc.mak 2016-07-19 13:51:41.000000000 +0200 --- src/Make_ivc.mak 2018-06-19 18:37:43.572545354 +0200 *************** *** 88,94 **** 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 # 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 --- 88,94 ---- 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 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 *** ../vim-8.1.0083/src/Make_cyg_ming.mak 2018-04-21 19:06:58.000000000 +0200 --- src/Make_cyg_ming.mak 2018-06-19 18:38:21.464387436 +0200 *************** *** 662,668 **** CFLAGS += -s endif ! LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o CUIOBJ = $(OUTDIR)/iscygpty.o OBJ = \ --- 662,668 ---- CFLAGS += -s endif ! 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 = \ *** ../vim-8.1.0083/src/Make_mvc.mak 2018-03-26 20:41:04.000000000 +0200 --- src/Make_mvc.mak 2018-06-19 18:40:11.891907875 +0200 *************** *** 489,498 **** # need advapi32.lib for GetUserName() # need shell32.lib for ExtractIcon() # 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) !if "$(DELAYLOAD)" == "yes" CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib !endif --- 489,499 ---- # 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 netapi32.lib uuid.lib /machine:$(CPU) !if "$(DELAYLOAD)" == "yes" CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib !endif *************** *** 801,807 **** $(OUTDIR)\os_w32exe.obj GUI_LIB = \ gdi32.lib version.lib $(IME_LIB) \ ! winspool.lib comctl32.lib advapi32.lib shell32.lib \ /machine:$(CPU) !else SUBSYSTEM = console --- 802,808 ---- $(OUTDIR)\os_w32exe.obj GUI_LIB = \ gdi32.lib version.lib $(IME_LIB) \ ! winspool.lib comctl32.lib advapi32.lib shell32.lib netapi32.lib \ /machine:$(CPU) !else SUBSYSTEM = console *** ../vim-8.1.0083/src/misc1.c 2018-05-14 22:56:16.000000000 +0200 --- src/misc1.c 2018-06-19 18:41:51.783452927 +0200 *************** *** 14,19 **** --- 14,23 ---- #include "vim.h" #include "version.h" + #if defined(FEAT_CMDL_COMPL) && defined(WIN3264) + # include + #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,4608 **** --- 4607,4634 ---- } 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 } *** ../vim-8.1.0083/src/version.c 2018-06-19 18:27:38.271694008 +0200 --- src/version.c 2018-06-19 18:56:50.358883504 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 84, /**/ -- From "know your smileys": :----} You lie like Pinocchio /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///