Alexandre Julliard : ntdll:
Initial implementation of RtlQueryInformationActivationContext.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jul 26 06:36:42 CDT 2007
Module: wine
Branch: master
Commit: 3a71513d991fe6b818d92eb3c5435b472b216a0b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3a71513d991fe6b818d92eb3c5435b472b216a0b
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Jul 25 18:17:36 2007 +0200
ntdll: Initial implementation of RtlQueryInformationActivationContext.
Partially based on a patch by Eric Pouech.
---
dlls/kernel32/actctx.c | 14 ++++++---
dlls/ntdll/actctx.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/ntdll.spec | 2 +-
include/winternl.h | 2 +
4 files changed, 86 insertions(+), 6 deletions(-)
diff --git a/dlls/kernel32/actctx.c b/dlls/kernel32/actctx.c
index 84c29cd..2d1e11c 100644
--- a/dlls/kernel32/actctx.c
+++ b/dlls/kernel32/actctx.c
@@ -293,9 +293,13 @@ BOOL WINAPI QueryActCtxW(DWORD dwFlags, HANDLE hActCtx, PVOID pvSubInst,
ULONG ulClass, PVOID pvBuff, SIZE_T cbBuff,
SIZE_T *pcbLen)
{
- FIXME("%08x %p %p %u %p %ld %p\n", dwFlags, hActCtx,
- pvSubInst, ulClass, pvBuff, cbBuff, pcbLen);
- /* this makes Adobe Photoshop 7.0 happy */
- SetLastError( ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
+ NTSTATUS status;
+
+ if ((status = RtlQueryInformationActivationContext( dwFlags, hActCtx, pvSubInst, ulClass,
+ pvBuff, cbBuff, pcbLen )))
+ {
+ SetLastError(RtlNtStatusToDosError(status));
+ return FALSE;
+ }
+ return TRUE;
}
diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c
index f7b0b43..7068424 100644
--- a/dlls/ntdll/actctx.c
+++ b/dlls/ntdll/actctx.c
@@ -1893,6 +1893,37 @@ static NTSTATUS parse_depend_manifests(struct actctx_loader* acl)
return status;
}
+/* find the appropriate activation context for RtlQueryInformationActivationContext */
+static NTSTATUS find_query_actctx( HANDLE *handle, DWORD flags )
+{
+ NTSTATUS status = STATUS_SUCCESS;
+
+ if (flags & QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX)
+ {
+ if (NtCurrentTeb()->ActivationContextStack.ActiveFrame)
+ *handle = NtCurrentTeb()->ActivationContextStack.ActiveFrame->ActivationContext;
+ }
+ else if (flags & (QUERY_ACTCTX_FLAG_ACTCTX_IS_ADDRESS|QUERY_ACTCTX_FLAG_ACTCTX_IS_HMODULE))
+ {
+ ULONG magic;
+ LDR_MODULE *pldr;
+
+ LdrLockLoaderLock( 0, NULL, &magic );
+ if (!LdrFindEntryForAddress( *handle, &pldr ))
+ {
+ if ((flags & QUERY_ACTCTX_FLAG_ACTCTX_IS_HMODULE) && *handle != pldr->BaseAddress)
+ status = STATUS_DLL_NOT_FOUND;
+ else
+ *handle = pldr->ActivationContext;
+ }
+ else status = STATUS_DLL_NOT_FOUND;
+ LdrUnlockLoaderLock( 0, magic );
+ }
+ else if (!*handle) *handle = process_actctx;
+
+ return status;
+}
+
/* initialize the activation context for the current process */
void actctx_init(void)
{
@@ -2149,3 +2180,46 @@ BOOLEAN WINAPI RtlIsActivationContextActive( HANDLE handle )
if (frame->ActivationContext == handle) return TRUE;
return FALSE;
}
+
+
+/***********************************************************************
+ * RtlQueryInformationActivationContext (NTDLL.@)
+ *
+ * Get information about an activation context.
+ * FIXME: function signature/prototype may be wrong
+ */
+NTSTATUS WINAPI RtlQueryInformationActivationContext( ULONG flags, HANDLE handle, PVOID subinst,
+ ULONG class, PVOID buffer,
+ SIZE_T bufsize, SIZE_T *retlen )
+{
+ NTSTATUS status;
+
+ 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;
+
+ switch (class)
+ {
+ case ActivationContextBasicInformation:
+ {
+ ACTIVATION_CONTEXT_BASIC_INFORMATION *info = buffer;
+
+ if (retlen) *retlen = sizeof(*info);
+ if (!info || bufsize < sizeof(*info)) return STATUS_BUFFER_TOO_SMALL;
+
+ info->hActCtx = handle;
+ info->dwFlags = 0; /* FIXME */
+ if (!(flags & QUERY_ACTCTX_FLAG_NO_ADDREF)) RtlAddRefActivationContext( handle );
+ }
+ break;
+
+ case ActivationContextDetailedInformation:
+ case AssemblyDetailedInformationInActivationContext:
+ case FileInformationInAssemblyOfAssemblyInActivationContext:
+ default:
+ FIXME( "class %u not implemented\n", class );
+ return STATUS_NOT_IMPLEMENTED;
+ }
+ return STATUS_SUCCESS;
+}
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 62e89c7..6f05412 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -767,7 +767,7 @@
@ stdcall RtlQueryEnvironmentVariable_U(ptr ptr ptr)
@ stub RtlQueryHeapInformation
@ stdcall RtlQueryInformationAcl(ptr ptr long long)
-@ stub RtlQueryInformationActivationContext
+@ stdcall RtlQueryInformationActivationContext(long long ptr ptr long ptr long ptr)
@ stub RtlQueryInformationActiveActivationContext
@ stub RtlQueryInterfaceMemoryStream
@ stub RtlQueryProcessBackTraceInformation
diff --git a/include/winternl.h b/include/winternl.h
index 372e4d4..8ad8329 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2195,10 +2195,12 @@ BOOLEAN WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRI
NTSTATUS WINAPI RtlQueryAtomInAtomTable(RTL_ATOM_TABLE,RTL_ATOM,ULONG*,ULONG*,WCHAR*,ULONG*);
NTSTATUS WINAPI RtlQueryEnvironmentVariable_U(PWSTR,PUNICODE_STRING,PUNICODE_STRING);
NTSTATUS WINAPI RtlQueryInformationAcl(PACL,LPVOID,DWORD,ACL_INFORMATION_CLASS);
+NTSTATUS WINAPI RtlQueryInformationActivationContext(ULONG,HANDLE,PVOID,ULONG,PVOID,SIZE_T,SIZE_T*);
NTSTATUS WINAPI RtlQueryProcessDebugInformation(ULONG,ULONG,PDEBUG_BUFFER);
NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID);
NTSTATUS WINAPI RtlQueryTimeZoneInformation(RTL_TIME_ZONE_INFORMATION*);
NTSTATUS WINAPI RtlQueueWorkItem(PRTL_WORK_ITEM_ROUTINE,PVOID,ULONG);
+
void WINAPI RtlRaiseException(PEXCEPTION_RECORD);
void WINAPI RtlRaiseStatus(NTSTATUS);
ULONG WINAPI RtlRandom(PULONG);
More information about the wine-cvs
mailing list