Alexander Nicolaysen Sørnes : netapi32: Improve NetUserGetLocalGroups stub.
Alexandre Julliard
julliard at winehq.org
Tue Sep 23 09:28:56 CDT 2008
Module: wine
Branch: master
Commit: 39894c2423b34e27c27bd6ac098ca1ce676994f0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=39894c2423b34e27c27bd6ac098ca1ce676994f0
Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date: Fri Sep 12 00:05:47 2008 +0200
netapi32: Improve NetUserGetLocalGroups stub.
Report the user as member of the admins group.
---
dlls/netapi32/access.c | 37 +++++++++++++++++++++++++++++++++----
1 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/dlls/netapi32/access.c b/dlls/netapi32/access.c
index 5da07a6..4244827 100644
--- a/dlls/netapi32/access.c
+++ b/dlls/netapi32/access.c
@@ -417,6 +417,10 @@ NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level,
LPDWORD entriesread, LPDWORD totalentries)
{
NET_API_STATUS status;
+ const WCHAR admins[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r','s',0};
+ LPWSTR currentuser;
+ LOCALGROUP_USERS_INFO_0* info;
+ DWORD size;
FIXME("(%s, %s, %d, %08x, %p %d, %p, %p) stub!\n",
debugstr_w(servername), debugstr_w(username), level, flags, bufptr,
@@ -426,12 +430,37 @@ NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level,
if (status != NERR_Success)
return status;
- if (!NETAPI_FindUser(username))
+ size = UNLEN + 1;
+ NetApiBufferAllocate(size, (LPVOID*)¤tuser);
+ GetUserNameW(currentuser, &size);
+
+ if (lstrcmpiW(username, currentuser) && NETAPI_FindUser(username))
+ {
+ NetApiBufferFree(currentuser);
return NERR_UserNotFound;
+ }
+
+ NetApiBufferFree(currentuser);
+ *totalentries = 1;
+ size = sizeof(*info) + sizeof(admins);
+
+ if(prefmaxlen < size)
+ status = ERROR_MORE_DATA;
+ else
+ status = NetApiBufferAllocate(size, (LPVOID*)&info);
+
+ if(status != NERR_Success)
+ {
+ *bufptr = NULL;
+ *entriesread = 0;
+ return status;
+ }
+
+ info->lgrui0_name = (LPWSTR)((LPBYTE)info + sizeof(*info));
+ lstrcpyW(info->lgrui0_name, admins);
- if (bufptr) *bufptr = NULL;
- if (entriesread) *entriesread = 0;
- if (totalentries) *totalentries = 0;
+ *bufptr = (LPBYTE)info;
+ *entriesread = 1;
return NERR_Success;
}
More information about the wine-cvs
mailing list