Nikolay Sivov : kernel32/tests: Link to activation context API directly.

Alexandre Julliard julliard at winehq.org
Fri Feb 21 15:27:05 CST 2020


Module: wine
Branch: master
Commit: f1ff96cf5a94d7d6212c4d9885f3f801218023a1
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f1ff96cf5a94d7d6212c4d9885f3f801218023a1

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Feb 21 13:24:33 2020 +0300

kernel32/tests: Link to activation context API directly.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/path.c   | 35 +++++++----------------------------
 dlls/kernel32/tests/thread.c | 41 ++++++++++++-----------------------------
 2 files changed, 19 insertions(+), 57 deletions(-)

diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c
index 3d717f7b1f..7342a865af 100644
--- a/dlls/kernel32/tests/path.c
+++ b/dlls/kernel32/tests/path.c
@@ -80,12 +80,6 @@ static NTSTATUS (WINAPI *pRtlGetSearchPath)(LPWSTR*);
 static void     (WINAPI *pRtlReleasePath)(LPWSTR);
 static NTSTATUS (WINAPI *pLdrGetDllPath)(LPCWSTR,ULONG,LPWSTR*,LPWSTR*);
 
-static BOOL   (WINAPI *pActivateActCtx)(HANDLE,ULONG_PTR*);
-static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW);
-static BOOL   (WINAPI *pDeactivateActCtx)(DWORD,ULONG_PTR);
-static BOOL   (WINAPI *pGetCurrentActCtx)(HANDLE *);
-static void   (WINAPI *pReleaseActCtx)(HANDLE);
-
 static BOOL (WINAPI *pCheckNameLegalDOS8Dot3W)(const WCHAR *, char *, DWORD, BOOL *, BOOL *);
 static BOOL (WINAPI *pCheckNameLegalDOS8Dot3A)(const char *, char *, DWORD, BOOL *, BOOL *);
 
@@ -1758,7 +1752,7 @@ static HANDLE test_create(const char *file)
     actctx.cbSize = sizeof(ACTCTXW);
     actctx.lpSource = manifest_path;
 
-    handle = pCreateActCtxW(&actctx);
+    handle = CreateActCtxW(&actctx);
     ok(handle != INVALID_HANDLE_VALUE, "failed to create context, error %u\n", GetLastError());
 
     ok(actctx.cbSize == sizeof(actctx), "cbSize=%d\n", actctx.cbSize);
@@ -1825,9 +1819,6 @@ static void test_SearchPathA(void)
 
     DeleteFileA(path2A);
 
-    if (!pActivateActCtx)
-        return;
-
     GetWindowsDirectoryA(pathA, ARRAY_SIZE(pathA));
 
     create_manifest_file("testdep1.manifest", manifest_dep);
@@ -1844,7 +1835,7 @@ static void test_SearchPathA(void)
     ret = SearchPathA(NULL, kernel32A, NULL, ARRAY_SIZE(path2A), path2A, NULL);
     ok(ret && ret == strlen(path2A), "got %d\n", ret);
 
-    ret = pActivateActCtx(handle, &cookie);
+    ret = ActivateActCtx(handle, &cookie);
     ok(ret, "failed to activate context, %u\n", GetLastError());
 
     /* works when activated */
@@ -1873,9 +1864,9 @@ static void test_SearchPathA(void)
     ok(ret && ret == strlen(buffA), "got %d\n", ret);
     ok(strcmp(buffA, path2A), "got wrong path %s, %s\n", buffA, path2A);
 
-    ret = pDeactivateActCtx(0, cookie);
+    ret = DeactivateActCtx(0, cookie);
     ok(ret, "failed to deactivate context, %u\n", GetLastError());
-    pReleaseActCtx(handle);
+    ReleaseActCtx(handle);
 
     /* test the search path priority of the working directory */
     GetTempPathA(sizeof(tmpdirA), tmpdirA);
@@ -1957,9 +1948,6 @@ if (0)
 
     DeleteFileW(path2W);
 
-    if (!pActivateActCtx)
-        return;
-
     GetWindowsDirectoryW(pathW, ARRAY_SIZE(pathW));
 
     create_manifest_file("testdep1.manifest", manifest_dep);
@@ -1983,7 +1971,7 @@ if (0)
 
     GetWindowsDirectoryW(pathW, ARRAY_SIZE(pathW));
 
-    ret = pActivateActCtx(handle, &cookie);
+    ret = ActivateActCtx(handle, &cookie);
     ok(ret, "failed to activate context, %u\n", GetLastError());
 
     /* works when activated */
@@ -2016,9 +2004,9 @@ if (0)
     ret = SearchPathW(NULL, ole32W, NULL, ARRAY_SIZE(buffW), buffW, NULL);
     ok(ret && ret == lstrlenW(buffW), "got %d\n", ret);
 
-    ret = pDeactivateActCtx(0, cookie);
+    ret = DeactivateActCtx(0, cookie);
     ok(ret, "failed to deactivate context, %u\n", GetLastError());
-    pReleaseActCtx(handle);
+    ReleaseActCtx(handle);
 }
 
 static void test_GetFullPathNameA(void)
@@ -2157,11 +2145,6 @@ static void init_pointers(void)
     MAKEFUNC(RemoveDllDirectory);
     MAKEFUNC(SetDllDirectoryW);
     MAKEFUNC(SetDefaultDllDirectories);
-    MAKEFUNC(ActivateActCtx);
-    MAKEFUNC(CreateActCtxW);
-    MAKEFUNC(DeactivateActCtx);
-    MAKEFUNC(GetCurrentActCtx);
-    MAKEFUNC(ReleaseActCtx);
     MAKEFUNC(CheckNameLegalDOS8Dot3W);
     MAKEFUNC(CheckNameLegalDOS8Dot3A);
     mod = GetModuleHandleA("ntdll.dll");
@@ -2695,10 +2678,6 @@ START_TEST(path)
 
     init_pointers();
 
-    /* Report only once */
-    if (!pActivateActCtx)
-        win_skip("Activation contexts not supported, some tests will be skipped\n");
-
     test_relative_path();
     test_InitPathA(curdir, &curDrive, &otherDrive);
     test_CurrentDirectoryA(origdir,curdir);
diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
index 8c27024cf2..3b9a407e73 100644
--- a/dlls/kernel32/tests/thread.c
+++ b/dlls/kernel32/tests/thread.c
@@ -90,11 +90,6 @@ static BOOL (WINAPI *pIsWow64Process)(HANDLE,PBOOL);
 static BOOL (WINAPI *pSetThreadErrorMode)(DWORD,PDWORD);
 static DWORD (WINAPI *pGetThreadErrorMode)(void);
 static DWORD (WINAPI *pRtlGetThreadErrorMode)(void);
-static BOOL   (WINAPI *pActivateActCtx)(HANDLE,ULONG_PTR*);
-static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW);
-static BOOL   (WINAPI *pDeactivateActCtx)(DWORD,ULONG_PTR);
-static BOOL   (WINAPI *pGetCurrentActCtx)(HANDLE *);
-static void   (WINAPI *pReleaseActCtx)(HANDLE);
 static PTP_POOL (WINAPI *pCreateThreadpool)(PVOID);
 static void (WINAPI *pCloseThreadpool)(PTP_POOL);
 static PTP_WORK (WINAPI *pCreateThreadpoolWork)(PTP_WORK_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON);
@@ -312,7 +307,7 @@ static DWORD WINAPI thread_actctx_func(void *p)
     BOOL ret;
 
     cur = (void*)0xdeadbeef;
-    ret = pGetCurrentActCtx(&cur);
+    ret = GetCurrentActCtx(&cur);
     ok(ret, "thread GetCurrentActCtx failed, %u\n", GetLastError());
     ok(cur == param->handle, "got %p, expected %p\n", cur, param->handle);
     param->thread_context = cur;
@@ -1852,7 +1847,7 @@ static HANDLE test_create(const char *file)
     actctx.cbSize = sizeof(ACTCTXW);
     actctx.lpSource = path;
 
-    handle = pCreateActCtxW(&actctx);
+    handle = CreateActCtxW(&actctx);
     ok(handle != INVALID_HANDLE_VALUE, "failed to create context, error %u\n", GetLastError());
 
     ok(actctx.cbSize == sizeof(actctx), "cbSize=%d\n", actctx.cbSize);
@@ -1876,12 +1871,6 @@ static void test_thread_actctx(void)
     DWORD tid, ret;
     BOOL b;
 
-    if (!pActivateActCtx)
-    {
-        win_skip("skipping activation context tests\n");
-        return;
-    }
-
     create_manifest_file("testdep1.manifest", manifest_dep);
     create_manifest_file("main.manifest", manifest_main);
 
@@ -1890,7 +1879,7 @@ static void test_thread_actctx(void)
     DeleteFileA("main.manifest");
 
     handle = (void*)0xdeadbeef;
-    b = pGetCurrentActCtx(&handle);
+    b = GetCurrentActCtx(&handle);
     ok(b, "GetCurrentActCtx failed: %u\n", GetLastError());
     ok(handle == 0, "active context %p\n", handle);
 
@@ -1905,17 +1894,17 @@ static void test_thread_actctx(void)
     ok(param.thread_context == NULL, "got wrong thread context %p\n", param.thread_context);
     CloseHandle(thread);
 
-    b = pActivateActCtx(context, &cookie);
+    b = ActivateActCtx(context, &cookie);
     ok(b, "activation failed: %u\n", GetLastError());
 
     handle = 0;
-    b = pGetCurrentActCtx(&handle);
+    b = GetCurrentActCtx(&handle);
     ok(b, "GetCurrentActCtx failed: %u\n", GetLastError());
     ok(handle != 0, "no active context\n");
-    pReleaseActCtx(handle);
+    ReleaseActCtx(handle);
 
     param.handle = NULL;
-    b = pGetCurrentActCtx(&param.handle);
+    b = GetCurrentActCtx(&param.handle);
     ok(b && param.handle != NULL, "failed to get context, %u\n", GetLastError());
 
     param.thread_context = (void*)0xdeadbeef;
@@ -1925,7 +1914,7 @@ static void test_thread_actctx(void)
     ret = WaitForSingleObject(thread, 1000);
     ok(ret == WAIT_OBJECT_0, "wait timeout\n");
     ok(param.thread_context == context, "got wrong thread context %p, %p\n", param.thread_context, context);
-    pReleaseActCtx(param.thread_context);
+    ReleaseActCtx(param.thread_context);
     CloseHandle(thread);
 
     /* similar test for CreateRemoteThread() */
@@ -1936,17 +1925,16 @@ static void test_thread_actctx(void)
     ret = WaitForSingleObject(thread, 1000);
     ok(ret == WAIT_OBJECT_0, "wait timeout\n");
     ok(param.thread_context == context, "got wrong thread context %p, %p\n", param.thread_context, context);
-    pReleaseActCtx(param.thread_context);
+    ReleaseActCtx(param.thread_context);
     CloseHandle(thread);
 
-    pReleaseActCtx(param.handle);
+    ReleaseActCtx(param.handle);
 
-    b = pDeactivateActCtx(0, cookie);
+    b = DeactivateActCtx(0, cookie);
     ok(b, "DeactivateActCtx failed: %u\n", GetLastError());
-    pReleaseActCtx(context);
+    ReleaseActCtx(context);
 }
 
-
 static void WINAPI threadpool_workcallback(PTP_CALLBACK_INSTANCE instance, void *context, PTP_WORK work) {
     int *foo = (int*)context;
 
@@ -2267,11 +2255,6 @@ static void init_funcs(void)
     X(IsWow64Process);
     X(SetThreadErrorMode);
     X(GetThreadErrorMode);
-    X(ActivateActCtx);
-    X(CreateActCtxW);
-    X(DeactivateActCtx);
-    X(GetCurrentActCtx);
-    X(ReleaseActCtx);
 
     X(CreateThreadpool);
     X(CloseThreadpool);




More information about the wine-cvs mailing list