sync netapi32_winetest with wine 1.1.13

svn path=/trunk/; revision=38981
This commit is contained in:
Christoph von Wittich 2009-01-20 17:09:46 +00:00
parent e6d7f59aa5
commit f2e519c99a
2 changed files with 14 additions and 15 deletions

View file

@ -70,7 +70,7 @@ static int init_access_tests(void)
BOOL rc; BOOL rc;
user_name[0] = 0; user_name[0] = 0;
dwSize = sizeof(user_name); dwSize = sizeof(user_name)/sizeof(WCHAR);
rc=GetUserNameW(user_name, &dwSize); rc=GetUserNameW(user_name, &dwSize);
if (rc==FALSE && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) if (rc==FALSE && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
{ {
@ -80,7 +80,7 @@ static int init_access_tests(void)
ok(rc, "User Name Retrieved\n"); ok(rc, "User Name Retrieved\n");
computer_name[0] = 0; computer_name[0] = 0;
dwSize = sizeof(computer_name); dwSize = sizeof(computer_name)/sizeof(WCHAR);
ok(GetComputerNameW(computer_name, &dwSize), "Computer Name Retrieved\n"); ok(GetComputerNameW(computer_name, &dwSize), "Computer Name Retrieved\n");
return 1; return 1;
} }
@ -170,9 +170,7 @@ static void run_usergetinfo_tests(void)
trace("Deleting the test user failed. You might have to manually delete it.\n"); trace("Deleting the test user failed. You might have to manually delete it.\n");
} }
/* checks Level 1 of NetQueryDisplayInformation /* Checks Level 1 of NetQueryDisplayInformation */
* FIXME: Needs to be rewritten to not depend on the spelling of the users,
* ideally based on the admin and guest user SIDs/RIDs.*/
static void run_querydisplayinformation1_tests(void) static void run_querydisplayinformation1_tests(void)
{ {
PNET_DISPLAY_USER Buffer, rec; PNET_DISPLAY_USER Buffer, rec;
@ -180,9 +178,6 @@ static void run_querydisplayinformation1_tests(void)
DWORD i = 0; DWORD i = 0;
BOOL hasAdmin = FALSE; BOOL hasAdmin = FALSE;
BOOL hasGuest = FALSE; BOOL hasGuest = FALSE;
static const WCHAR sAdminUserName[] = {'A','d','m','i','n','i','s','t','r','a',
't','o','r',0};
static const WCHAR sGuestUserName[] = {'G','u','e','s','t',0};
do do
{ {
@ -195,14 +190,14 @@ static void run_querydisplayinformation1_tests(void)
rec = Buffer; rec = Buffer;
for(; EntryCount > 0; EntryCount--) for(; EntryCount > 0; EntryCount--)
{ {
if (!lstrcmpW(rec->usri1_name, sAdminUserName)) if (rec->usri1_user_id == DOMAIN_USER_RID_ADMIN)
{ {
ok(!hasAdmin, "One admin user\n"); ok(!hasAdmin, "One admin user\n");
ok(rec->usri1_flags & UF_SCRIPT, "UF_SCRIPT flag is set\n"); ok(rec->usri1_flags & UF_SCRIPT, "UF_SCRIPT flag is set\n");
ok(rec->usri1_flags & UF_NORMAL_ACCOUNT, "UF_NORMAL_ACCOUNT flag is set\n"); ok(rec->usri1_flags & UF_NORMAL_ACCOUNT, "UF_NORMAL_ACCOUNT flag is set\n");
hasAdmin = TRUE; hasAdmin = TRUE;
} }
else if (!lstrcmpW(rec->usri1_name, sGuestUserName)) else if (rec->usri1_user_id == DOMAIN_USER_RID_GUEST)
{ {
ok(!hasGuest, "One guest record\n"); ok(!hasGuest, "One guest record\n");
ok(rec->usri1_flags & UF_SCRIPT, "UF_SCRIPT flag is set\n"); ok(rec->usri1_flags & UF_SCRIPT, "UF_SCRIPT flag is set\n");
@ -217,7 +212,7 @@ static void run_querydisplayinformation1_tests(void)
pNetApiBufferFree(Buffer); pNetApiBufferFree(Buffer);
} while (Result == ERROR_MORE_DATA); } while (Result == ERROR_MORE_DATA);
ok(hasAdmin, "Has Administrator account\n"); ok(hasAdmin, "Doesn't have 'Administrator' account\n");
} }
static void run_usermodalsget_tests(void) static void run_usermodalsget_tests(void)
@ -257,7 +252,9 @@ static void run_userhandling_tests(void)
ok(ret == NERR_Success, "Deleting the user failed : %d\n", ret); ok(ret == NERR_Success, "Deleting the user failed : %d\n", ret);
} }
else else
ok(ret == NERR_BadUsername, "Adding user with too long username returned 0x%08x\n", ret); ok(ret == NERR_BadUsername ||
broken(ret == NERR_PasswordTooShort), /* NT4 */
"Adding user with too long username returned 0x%08x\n", ret);
usri.usri1_name = sTestUserName; usri.usri1_name = sTestUserName;
usri.usri1_password = sTooLongPassword; usri.usri1_password = sTooLongPassword;
@ -293,7 +290,9 @@ static void run_userhandling_tests(void)
return; return;
} }
ok(ret == NERR_Success, "Adding user failed with error 0x%08x\n", ret); ok(ret == NERR_Success ||
broken(ret == NERR_PasswordTooShort), /* NT4 */
"Adding user failed with error 0x%08x\n", ret);
if(ret != NERR_Success) if(ret != NERR_Success)
return; return;

View file

@ -74,13 +74,13 @@ static void run_apibuf_tests(void)
/* NULL-Pointer */ /* NULL-Pointer */
/* NT: ERROR_INVALID_PARAMETER, lasterror is untouched) */ /* NT: ERROR_INVALID_PARAMETER, lasterror is untouched) */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = pNetApiBufferAllocate(0, (LPVOID *)NULL); res = pNetApiBufferAllocate(0, NULL);
ok( (res == ERROR_INVALID_PARAMETER) && (GetLastError() == 0xdeadbeef), ok( (res == ERROR_INVALID_PARAMETER) && (GetLastError() == 0xdeadbeef),
"returned %d with 0x%x (expected ERROR_INVALID_PARAMETER with " "returned %d with 0x%x (expected ERROR_INVALID_PARAMETER with "
"0xdeadbeef)\n", res, GetLastError()); "0xdeadbeef)\n", res, GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = pNetApiBufferAllocate(1024, (LPVOID *)NULL); res = pNetApiBufferAllocate(1024, NULL);
ok( (res == ERROR_INVALID_PARAMETER) && (GetLastError() == 0xdeadbeef), ok( (res == ERROR_INVALID_PARAMETER) && (GetLastError() == 0xdeadbeef),
"returned %d with 0x%x (expected ERROR_INVALID_PARAMETER with " "returned %d with 0x%x (expected ERROR_INVALID_PARAMETER with "
"0xdeadbeef)\n", res, GetLastError()); "0xdeadbeef)\n", res, GetLastError());