Commit 65e67773 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

ntdll: Update behavior of ActivationContextBasicInformation.

parent 0c82af8a
......@@ -851,6 +851,42 @@ static void test_find_string_fail(void)
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%u\n", GetLastError());
}
static void test_basic_info(HANDLE handle)
{
ACTIVATION_CONTEXT_BASIC_INFORMATION basic;
SIZE_T size;
BOOL b;
b = pQueryActCtxW(0, handle, NULL,
ActivationContextBasicInformation, &basic,
sizeof(basic), &size);
ok (b,"ActivationContextBasicInformation failed\n");
ok (size == sizeof(ACTIVATION_CONTEXT_BASIC_INFORMATION),"size mismatch\n");
ok (basic.dwFlags == 0, "unexpected flags %x\n",basic.dwFlags);
ok (basic.hActCtx == handle, "unexpected handle\n");
b = pQueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX, handle, NULL,
ActivationContextBasicInformation, &basic,
sizeof(basic), &size);
if (handle)
{
ok (!b,"ActivationContextBasicInformation succeeded\n");
ok (size == 0,"size mismatch\n");
ok (GetLastError() == ERROR_INVALID_PARAMETER, "Wrong last error\n");
ok (basic.dwFlags == 0, "unexpected flags %x\n",basic.dwFlags);
ok (basic.hActCtx == handle, "unexpected handle\n");
}
else
{
ok (b,"ActivationContextBasicInformation failed\n");
ok (size == sizeof(ACTIVATION_CONTEXT_BASIC_INFORMATION),"size mismatch\n");
ok (basic.dwFlags == 0, "unexpected flags %x\n",basic.dwFlags);
ok (basic.hActCtx == handle, "unexpected handle\n");
}
}
static void test_actctx(void)
{
ULONG_PTR cookie;
......@@ -865,6 +901,7 @@ static void test_actctx(void)
ok(handle == NULL, "handle = %p, expected NULL\n", handle);
ok(b, "GetCurrentActCtx failed: %u\n", GetLastError());
if(b) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info0);
pReleaseActCtx(handle);
}
......@@ -879,6 +916,7 @@ static void test_actctx(void)
handle = test_create("test1.manifest", manifest1);
DeleteFileA("test1.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1);
test_info_in_assembly(handle, 1, &manifest1_info);
......@@ -904,6 +942,7 @@ static void test_actctx(void)
DeleteFileA("test2.manifest");
DeleteFileA("testdep.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info2);
test_info_in_assembly(handle, 1, &manifest2_info);
test_info_in_assembly(handle, 2, &depmanifest1_info);
......@@ -921,6 +960,7 @@ static void test_actctx(void)
DeleteFileA("test3.manifest");
DeleteFileA("testdep.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info2);
test_info_in_assembly(handle, 1, &manifest2_info);
test_info_in_assembly(handle, 2, &depmanifest2_info);
......@@ -948,6 +988,7 @@ static void test_actctx(void)
DeleteFileA("test2-3.manifest");
DeleteFileA("testdep.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info2);
test_info_in_assembly(handle, 1, &manifest2_info);
test_info_in_assembly(handle, 2, &depmanifest3_info);
......@@ -976,6 +1017,7 @@ static void test_actctx(void)
handle = test_create("test3.manifest", manifest3);
DeleteFileA("test3.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1);
test_info_in_assembly(handle, 1, &manifest3_info);
test_file_info(handle, 0, 0, testlib_dll);
......@@ -1002,6 +1044,7 @@ static void test_actctx(void)
DeleteFileA("test4.manifest");
DeleteFileA("testdep.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info2);
test_info_in_assembly(handle, 1, &manifest4_info);
test_info_in_assembly(handle, 2, &manifest_comctrl_info);
......@@ -1020,6 +1063,7 @@ static void test_actctx(void)
handle = test_create("..\\test1.manifest", manifest1);
DeleteFileA("..\\test1.manifest");
if(handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1);
test_info_in_assembly(handle, 1, &manifest1_info);
pReleaseActCtx(handle);
......@@ -1039,6 +1083,7 @@ static void test_actctx(void)
handle = test_create("test1.manifest", manifest1);
DeleteFileA("test1.manifest");
if (handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1);
test_info_in_assembly(handle, 1, &manifest1_info);
pReleaseActCtx(handle);
......@@ -1053,6 +1098,7 @@ static void test_actctx(void)
handle = test_create("test1.manifest", manifest1);
DeleteFileA("test1.manifest");
if (handle != INVALID_HANDLE_VALUE) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1);
test_info_in_assembly(handle, 1, &manifest1_info);
pReleaseActCtx(handle);
......@@ -1071,6 +1117,7 @@ static void test_app_manifest(void)
ok(handle == NULL, "handle != NULL\n");
ok(b, "GetCurrentActCtx failed: %u\n", GetLastError());
if(b) {
test_basic_info(handle);
test_detailed_info(handle, &detailed_info1_child);
test_info_in_assembly(handle, 1, &manifest1_child_info);
pReleaseActCtx(handle);
......
......@@ -2028,12 +2028,14 @@ static NTSTATUS parse_depend_manifests(struct actctx_loader* acl)
}
/* find the appropriate activation context for RtlQueryInformationActivationContext */
static NTSTATUS find_query_actctx( HANDLE *handle, DWORD flags )
static NTSTATUS find_query_actctx( HANDLE *handle, DWORD flags, ULONG class )
{
NTSTATUS status = STATUS_SUCCESS;
if (flags & QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX)
{
if (*handle) return STATUS_INVALID_PARAMETER;
if (NtCurrentTeb()->ActivationContextStack.ActiveFrame)
*handle = NtCurrentTeb()->ActivationContextStack.ActiveFrame->ActivationContext;
}
......@@ -2042,6 +2044,8 @@ static NTSTATUS find_query_actctx( HANDLE *handle, DWORD flags )
ULONG magic;
LDR_MODULE *pldr;
if (!*handle) return STATUS_INVALID_PARAMETER;
LdrLockLoaderLock( 0, NULL, &magic );
if (!LdrFindEntryForAddress( *handle, &pldr ))
{
......@@ -2053,7 +2057,8 @@ static NTSTATUS find_query_actctx( HANDLE *handle, DWORD flags )
else status = STATUS_DLL_NOT_FOUND;
LdrUnlockLoaderLock( 0, magic );
}
else if (!*handle) *handle = process_actctx;
else if (!*handle && (class != ActivationContextBasicInformation))
*handle = process_actctx;
return status;
}
......@@ -2430,7 +2435,8 @@ NTSTATUS WINAPI RtlQueryInformationActivationContext( ULONG flags, HANDLE handle
TRACE("%08x %p %p %u %p %ld %p\n", flags, handle,
subinst, class, buffer, bufsize, retlen);
if ((status = find_query_actctx( &handle, flags ))) return status;
if (retlen) *retlen = 0;
if ((status = find_query_actctx( &handle, flags, class ))) return status;
switch (class)
{
......
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