mirror of
https://github.com/reactos/wine.git
synced 2025-01-21 03:15:18 +00:00
advapi32: Fix CheckTokenMembership test on Windows.
This commit is contained in:
parent
d7c9bd13a2
commit
9b3b9a1060
@ -3206,7 +3206,7 @@ static void test_CheckTokenMembership(void)
|
||||
{
|
||||
PTOKEN_GROUPS token_groups;
|
||||
DWORD size;
|
||||
HANDLE token;
|
||||
HANDLE process_token, token;
|
||||
BOOL is_member;
|
||||
BOOL ret;
|
||||
DWORD i;
|
||||
@ -3216,9 +3216,12 @@ static void test_CheckTokenMembership(void)
|
||||
win_skip("CheckTokenMembership is not available\n");
|
||||
return;
|
||||
}
|
||||
ret = OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
|
||||
ret = OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE|TOKEN_QUERY, &process_token);
|
||||
ok(ret, "OpenProcessToken failed with error %d\n", GetLastError());
|
||||
|
||||
ret = DuplicateToken(process_token, SecurityImpersonation, &token);
|
||||
ok(ret, "DuplicateToken failed with error %d\n", GetLastError());
|
||||
|
||||
/* groups */
|
||||
ret = GetTokenInformation(token, TokenGroups, NULL, 0, &size);
|
||||
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
@ -3244,10 +3247,19 @@ static void test_CheckTokenMembership(void)
|
||||
|
||||
ret = pCheckTokenMembership(token, token_groups->Groups[i].Sid, &is_member);
|
||||
ok(ret, "CheckTokenMembership failed with error %d\n", GetLastError());
|
||||
ok(is_member, "CheckTokenMembership should have detected sid as member");
|
||||
ok(is_member, "CheckTokenMembership should have detected sid as member\n");
|
||||
|
||||
ret = pCheckTokenMembership(process_token, token_groups->Groups[i].Sid, &is_member);
|
||||
todo_wine {
|
||||
ok(!ret && GetLastError() == ERROR_NO_IMPERSONATION_TOKEN,
|
||||
"CheckTokenMembership with process token %s with error %d\n",
|
||||
ret ? "succeeded" : "failed", GetLastError());
|
||||
ok(!is_member, "CheckTokenMembership should have cleared is_member\n");
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, token_groups);
|
||||
CloseHandle(token);
|
||||
CloseHandle(process_token);
|
||||
}
|
||||
|
||||
START_TEST(security)
|
||||
|
Loading…
x
Reference in New Issue
Block a user