ntdll: Initial implementation of RtlQueryInformationActivationContext.

Partially based on a patch by Eric Pouech.
This commit is contained in:
Alexandre Julliard 2007-07-25 18:17:36 +02:00
parent 5b844fe844
commit 3a71513d99
4 changed files with 86 additions and 6 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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);