From: Zhiyi Zhang zzhang@codeweavers.com
Test that the flags for normal activation context stack frames are 0x28. --- dlls/kernel32/tests/actctx.c | 98 ++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)
diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index ca24ed10549..b35e2f3f418 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -31,6 +31,8 @@
static BOOL (WINAPI *pQueryActCtxSettingsW)(DWORD,HANDLE,LPCWSTR,LPCWSTR,LPWSTR,SIZE_T,SIZE_T*);
+static NTSTATUS (NTAPI *pRtlActivateActivationContext)(ULONG,HANDLE,ULONG_PTR *); +static NTSTATUS (NTAPI *pRtlActivateActivationContextEx)(ULONG,TEB *,HANDLE,ULONG_PTR *); static NTSTATUS(NTAPI *pRtlFindActivationContextSectionString)(DWORD,const GUID *,ULONG,PUNICODE_STRING,PACTCTX_SECTION_KEYED_DATA); static BOOLEAN (NTAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING, PCSZ); static VOID (NTAPI *pRtlFreeUnicodeString)(PUNICODE_STRING); @@ -2197,7 +2199,9 @@ static void test_allowDelayedBinding(void)
static void test_actctx(void) { + RTL_ACTIVATION_CONTEXT_STACK_FRAME *frame; ULONG_PTR cookie; + NTSTATUS status; HANDLE handle; BOOL b;
@@ -2213,6 +2217,98 @@ static void test_actctx(void) ReleaseActCtx(handle); }
+ /* Test flags for normal frames */ + if (!create_manifest_file("test1.manifest", manifest1, -1, NULL, NULL)) + { + skip("Could not create manifest file\n"); + return; + } + handle = test_create("test1.manifest"); + ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError()); + DeleteFileA("test1.manifest"); + if (handle != INVALID_HANDLE_VALUE) + { + b = ActivateActCtx(handle, &cookie); + ok(b, "ActivateActCtx failed: %lu\n", GetLastError()); + + frame = NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame; + ok(!frame->Previous, "Got unexpected Previous.\n"); + ok(frame->ActivationContext == handle, "Got unexpected ActivationContext.\n"); + todo_wine + ok(frame->Flags == 0x28, "Got unexpected Flags %#lx.\n", frame->Flags); + + b = DeactivateActCtx(0, cookie); + ok(b, "DeactivateActCtx failed: %lu\n", GetLastError()); + + status = pRtlActivateActivationContext(0x20, handle, &cookie); + todo_wine + ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status); + if (status == STATUS_SUCCESS) + { + b = DeactivateActCtx(0, cookie); + ok(b, "DeactivateActCtx failed: %lu\n", GetLastError()); + } + + status = pRtlActivateActivationContext(0x28, handle, &cookie); + todo_wine + ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status); + if (status == STATUS_SUCCESS) + { + b = DeactivateActCtx(0, cookie); + ok(b, "DeactivateActCtx failed: %lu\n", GetLastError()); + } + + status = pRtlActivateActivationContext(0, handle, &cookie); + ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status); + + frame = NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame; + ok(!frame->Previous, "Got unexpected Previous.\n"); + ok(frame->ActivationContext == handle, "Got unexpected ActivationContext.\n"); + todo_wine + ok(frame->Flags == 0x28, "Got unexpected Flags %#lx.\n", frame->Flags); + + b = DeactivateActCtx(0, cookie); + ok(b, "DeactivateActCtx failed: %lu\n", GetLastError()); + b = GetCurrentActCtx(&handle); + ok(handle == NULL, "handle = %p, expected NULL\n", handle); + ok(b, "GetCurrentActCtx failed: %lu\n", GetLastError()); + + status = pRtlActivateActivationContextEx(0x20, NtCurrentTeb(), handle, &cookie); + todo_wine + ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status); + if (status == STATUS_SUCCESS) + { + b = DeactivateActCtx(0, cookie); + ok(b, "DeactivateActCtx failed: %lu\n", GetLastError()); + } + + status = pRtlActivateActivationContextEx(0x28, NtCurrentTeb(), handle, &cookie); + todo_wine + ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status); + if (status == STATUS_SUCCESS) + { + b = DeactivateActCtx(0, cookie); + ok(b, "DeactivateActCtx failed: %lu\n", GetLastError()); + } + + status = pRtlActivateActivationContextEx(0, NtCurrentTeb(), handle, &cookie); + ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status); + + frame = NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame; + ok(!frame->Previous, "Got unexpected Previous.\n"); + ok(frame->ActivationContext == handle, "Got unexpected ActivationContext.\n"); + todo_wine + ok(frame->Flags == 0x28, "Got unexpected Flags %#lx.\n", frame->Flags); + + b = DeactivateActCtx(0, cookie); + ok(b, "DeactivateActCtx failed: %lu\n", GetLastError()); + b = GetCurrentActCtx(&handle); + ok(handle == NULL, "handle = %p, expected NULL\n", handle); + ok(b, "GetCurrentActCtx failed: %lu\n", GetLastError()); + + ReleaseActCtx(handle); + } + /* test for whitespace handling in Eq ::= S? '=' S? */ create_manifest_file("test1_1.manifest", manifest1_1, -1, NULL, NULL); handle = test_create("test1_1.manifest"); @@ -3096,6 +3192,8 @@ static BOOL init_funcs(void) pQueryActCtxSettingsW = (void *)GetProcAddress( hLibrary, "QueryActCtxSettingsW" );
hLibrary = GetModuleHandleA("ntdll.dll"); + X(RtlActivateActivationContext); + X(RtlActivateActivationContextEx); X(RtlFindActivationContextSectionString); X(RtlCreateUnicodeStringFromAsciiz); X(RtlFreeUnicodeString);