Commit 439b852d authored by Detlef Riekenberg's avatar Detlef Riekenberg Committed by Alexandre Julliard

kernel32/tests: DuplicateTokenEx is not present on all platforms.

parent 81e7d69d
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
#define NB_SERVER_LOOPS 8 #define NB_SERVER_LOOPS 8
static HANDLE alarm_event; static HANDLE alarm_event;
static BOOL (WINAPI *pDuplicateTokenEx)(HANDLE,DWORD,LPSECURITY_ATTRIBUTES,
SECURITY_IMPERSONATION_LEVEL,TOKEN_TYPE,PHANDLE);
static void test_CreateNamedPipe(int pipemode) static void test_CreateNamedPipe(int pipemode)
{ {
...@@ -907,7 +910,7 @@ static HANDLE make_impersonation_token(DWORD Access, SECURITY_IMPERSONATION_LEVE ...@@ -907,7 +910,7 @@ static HANDLE make_impersonation_token(DWORD Access, SECURITY_IMPERSONATION_LEVE
ret = OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE, &ProcessToken); ret = OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE, &ProcessToken);
ok(ret, "OpenProcessToken failed with error %d\n", GetLastError()); ok(ret, "OpenProcessToken failed with error %d\n", GetLastError());
ret = DuplicateTokenEx(ProcessToken, Access, NULL, ImpersonationLevel, TokenImpersonation, &Token); ret = pDuplicateTokenEx(ProcessToken, Access, NULL, ImpersonationLevel, TokenImpersonation, &Token);
ok(ret, "DuplicateToken failed with error %d\n", GetLastError()); ok(ret, "DuplicateToken failed with error %d\n", GetLastError());
CloseHandle(ProcessToken); CloseHandle(ProcessToken);
...@@ -1196,6 +1199,11 @@ static void test_impersonation(void) ...@@ -1196,6 +1199,11 @@ static void test_impersonation(void)
HANDLE hProcessToken; HANDLE hProcessToken;
BOOL ret; BOOL ret;
if( !pDuplicateTokenEx ) {
skip("DuplicateTokenEx not found\n");
return;
}
ret = OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hProcessToken); ret = OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hProcessToken);
if (!ret) if (!ret)
{ {
...@@ -1246,6 +1254,11 @@ static void test_impersonation(void) ...@@ -1246,6 +1254,11 @@ static void test_impersonation(void)
START_TEST(pipe) START_TEST(pipe)
{ {
HMODULE hmod;
hmod = GetModuleHandle("advapi32.dll");
pDuplicateTokenEx = (void *) GetProcAddress(hmod, "DuplicateTokenEx");
trace("test 1 of 7:\n"); trace("test 1 of 7:\n");
if (test_DisconnectNamedPipe()) if (test_DisconnectNamedPipe())
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment