netapi32/tests: Add small conformance test for NetLocalGroupGetInfo and LocalGroupGetMembers.

This commit is contained in:
Louis Lenders 2011-06-05 09:58:33 +02:00 committed by Alexandre Julliard
parent 4680f63939
commit de2c401527
1 changed files with 30 additions and 0 deletions

View File

@ -63,6 +63,8 @@ static NET_API_STATUS (WINAPI *pNetUserGetInfo)(LPCWSTR,LPCWSTR,DWORD,LPBYTE*)=N
static NET_API_STATUS (WINAPI *pNetUserModalsGet)(LPCWSTR,DWORD,LPBYTE*)=NULL;
static NET_API_STATUS (WINAPI *pNetUserAdd)(LPCWSTR,DWORD,LPBYTE,LPDWORD)=NULL;
static NET_API_STATUS (WINAPI *pNetUserDel)(LPCWSTR,LPCWSTR)=NULL;
static NET_API_STATUS (WINAPI *pNetLocalGroupGetInfo)(LPCWSTR,LPCWSTR,DWORD,LPBYTE*)=NULL;
static NET_API_STATUS (WINAPI *pNetLocalGroupGetMembers)(LPCWSTR,LPCWSTR,DWORD,LPBYTE*,DWORD,LPDWORD,LPDWORD,PDWORD_PTR)=NULL;
static int init_access_tests(void)
{
@ -320,6 +322,31 @@ static void run_userhandling_tests(void)
ok(ret == NERR_UserNotFound, "Deleting a nonexistent user returned 0x%08x\n",ret);
}
static void run_localgroupgetinfo_tests(void)
{
NET_API_STATUS status;
static const WCHAR admins[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r','s',0};
PLOCALGROUP_INFO_1 lgi = NULL;
PLOCALGROUP_MEMBERS_INFO_3 buffer = NULL;
DWORD entries_read = 0, total_entries =0;
int i;
status = pNetLocalGroupGetInfo(NULL, admins, 1, (LPBYTE *)&lgi);
ok(status == NERR_Success, "NetLocalGroupGetInfo unexpectedly returned %d\n", status);
trace("Local groupname:%s\n", wine_dbgstr_w( lgi->lgrpi1_name));
trace("Comment: %s\n", wine_dbgstr_w( lgi->lgrpi1_comment));
pNetApiBufferFree(lgi);
status = pNetLocalGroupGetMembers(NULL, admins, 3, (LPBYTE *)&buffer, MAX_PREFERRED_LENGTH, &entries_read, &total_entries, NULL);
ok(status == NERR_Success, "NetLocalGroupGetMembers unexpectedly returned %d\n", status);
ok(entries_read > 0 && total_entries > 0, "Amount of entries is unexpectedly 0\n");
for(i=0;i<entries_read;i++)
trace("domain and name: %s\n", wine_dbgstr_w(buffer[i].lgrmi3_domainandname));
}
START_TEST(access)
{
HMODULE hnetapi32=LoadLibraryA("netapi32.dll");
@ -331,6 +358,8 @@ START_TEST(access)
pNetUserModalsGet=(void*)GetProcAddress(hnetapi32,"NetUserModalsGet");
pNetUserAdd=(void*)GetProcAddress(hnetapi32, "NetUserAdd");
pNetUserDel=(void*)GetProcAddress(hnetapi32, "NetUserDel");
pNetLocalGroupGetInfo=(void*)GetProcAddress(hnetapi32, "NetLocalGroupGetInfo");
pNetLocalGroupGetMembers=(void*)GetProcAddress(hnetapi32, "NetLocalGroupGetMembers");
/* These functions were introduced with NT. It's safe to assume that
* if one is not available, none are.
@ -346,6 +375,7 @@ START_TEST(access)
run_usergetinfo_tests();
run_querydisplayinformation1_tests();
run_usermodalsget_tests();
run_localgroupgetinfo_tests();
}
FreeLibrary(hnetapi32);