Aric Stewart : netapi32: Improve stub for NetLocalGroupGetMembers a bit to return current user.

Alexandre Julliard julliard at winehq.org
Wed Dec 12 09:29:22 CST 2007


Module: wine
Branch: master
Commit: f3e59a3d701d7ec3831645e92dee0659b614551f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f3e59a3d701d7ec3831645e92dee0659b614551f

Author: Aric Stewart <aric at codeweavers.com>
Date:   Wed Dec 12 19:21:49 2007 +0900

netapi32: Improve stub for NetLocalGroupGetMembers a bit to return current user.

---

 dlls/netapi32/local_group.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/dlls/netapi32/local_group.c b/dlls/netapi32/local_group.c
index a9f838f..e125de5 100644
--- a/dlls/netapi32/local_group.c
+++ b/dlls/netapi32/local_group.c
@@ -166,6 +166,39 @@ NET_API_STATUS WINAPI NetLocalGroupGetMembers(
     FIXME("(%s %s %d %p %d, %p %p %p) stub!\n", debugstr_w(servername),
           debugstr_w(localgroupname), level, bufptr, prefmaxlen, entriesread,
           totalentries, resumehandle);
+
+    if (level == 3)
+    {
+        WCHAR userName[MAX_COMPUTERNAME_LENGTH + 1];
+        DWORD userNameLen;
+        DWORD len,needlen;
+        PLOCALGROUP_MEMBERS_INFO_3 ptr;
+
+        /* still a stub,  current user is belonging to all groups */
+
+        *totalentries = 1;
+        *entriesread = 0;
+
+        userNameLen = MAX_COMPUTERNAME_LENGTH + 1;
+        GetUserNameW(userName,&userNameLen);
+        needlen = sizeof(LOCALGROUP_MEMBERS_INFO_3) +
+             (userNameLen+2) * sizeof(WCHAR);
+        if (prefmaxlen != MAX_PREFERRED_LENGTH)
+            len = min(prefmaxlen,needlen);
+        else
+            len = needlen;
+
+        NetApiBufferAllocate(len, (LPVOID *) bufptr);
+        if (len < needlen)
+            return ERROR_MORE_DATA;
+
+        ptr = (PLOCALGROUP_MEMBERS_INFO_3)*bufptr;
+        ptr->lgrmi3_domainandname = (LPWSTR)(*bufptr+sizeof(LOCALGROUP_MEMBERS_INFO_3));
+        lstrcpyW(ptr->lgrmi3_domainandname,userName);
+
+        *entriesread = 1;
+    }
+
     return NERR_Success;
 }
 




More information about the wine-cvs mailing list