vcomp/tests: Link to activation context API directly.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-02-21 13:24:23 +03:00 committed by Alexandre Julliard
parent bf39f2bf0f
commit eb4c4b3504

View file

@ -27,11 +27,6 @@ static HANDLE vcomp_actctx_hctx;
static ULONG_PTR vcomp_actctx_cookie; static ULONG_PTR vcomp_actctx_cookie;
static HMODULE vcomp_handle; static HMODULE vcomp_handle;
static HANDLE (WINAPI *pCreateActCtxA)(ACTCTXA*);
static BOOL (WINAPI *pActivateActCtx)(HANDLE, ULONG_PTR*);
static BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR);
static VOID (WINAPI *pReleaseActCtx)(HANDLE);
typedef CRITICAL_SECTION *omp_lock_t; typedef CRITICAL_SECTION *omp_lock_t;
typedef CRITICAL_SECTION *omp_nest_lock_t; typedef CRITICAL_SECTION *omp_nest_lock_t;
@ -191,18 +186,10 @@ static const char vcomp_manifest[] =
static void create_vcomp_manifest(void) static void create_vcomp_manifest(void)
{ {
char temp_path[MAX_PATH]; char temp_path[MAX_PATH];
HMODULE kernel32;
DWORD written; DWORD written;
ACTCTXA ctx; ACTCTXA ctx;
HANDLE file; HANDLE file;
kernel32 = GetModuleHandleA("kernel32.dll");
pCreateActCtxA = (void *)GetProcAddress(kernel32, "CreateActCtxA");
pActivateActCtx = (void *)GetProcAddress(kernel32, "ActivateActCtx");
pDeactivateActCtx = (void *)GetProcAddress(kernel32, "DeactivateActCtx");
pReleaseActCtx = (void *)GetProcAddress(kernel32, "ReleaseActCtx");
if (!pCreateActCtxA) return;
if (!GetTempPathA(sizeof(temp_path), temp_path) || if (!GetTempPathA(sizeof(temp_path), temp_path) ||
!GetTempFileNameA(temp_path, "vcomp", 0, vcomp_manifest_file)) !GetTempFileNameA(temp_path, "vcomp", 0, vcomp_manifest_file))
{ {
@ -231,7 +218,7 @@ static void create_vcomp_manifest(void)
memset(&ctx, 0, sizeof(ctx)); memset(&ctx, 0, sizeof(ctx));
ctx.cbSize = sizeof(ctx); ctx.cbSize = sizeof(ctx);
ctx.lpSource = vcomp_manifest_file; ctx.lpSource = vcomp_manifest_file;
vcomp_actctx_hctx = pCreateActCtxA(&ctx); vcomp_actctx_hctx = CreateActCtxA(&ctx);
if (!vcomp_actctx_hctx) if (!vcomp_actctx_hctx)
{ {
ok(0, "failed to create activation context\n"); ok(0, "failed to create activation context\n");
@ -239,10 +226,10 @@ static void create_vcomp_manifest(void)
return; return;
} }
if (!pActivateActCtx(vcomp_actctx_hctx, &vcomp_actctx_cookie)) if (!ActivateActCtx(vcomp_actctx_hctx, &vcomp_actctx_cookie))
{ {
win_skip("failed to activate context\n"); win_skip("failed to activate context\n");
pReleaseActCtx(vcomp_actctx_hctx); ReleaseActCtx(vcomp_actctx_hctx);
DeleteFileA(vcomp_manifest_file); DeleteFileA(vcomp_manifest_file);
vcomp_actctx_hctx = NULL; vcomp_actctx_hctx = NULL;
} }
@ -255,8 +242,8 @@ static void release_vcomp(void)
if (vcomp_actctx_hctx) if (vcomp_actctx_hctx)
{ {
pDeactivateActCtx(0, vcomp_actctx_cookie); DeactivateActCtx(0, vcomp_actctx_cookie);
pReleaseActCtx(vcomp_actctx_hctx); ReleaseActCtx(vcomp_actctx_hctx);
DeleteFileA(vcomp_manifest_file); DeleteFileA(vcomp_manifest_file);
} }
} }