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

This commit is contained in:
Aric Stewart 2007-12-12 19:21:49 +09:00 committed by Alexandre Julliard
parent 1e3d65dbb8
commit f3e59a3d70
1 changed files with 33 additions and 0 deletions

View File

@ -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;
}