ntdll: Implement RtlQueryActivationContextApplicationSettings.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2018-03-23 09:13:31 +01:00
parent fc14442970
commit 14b9a5af0b
3 changed files with 55 additions and 0 deletions

View File

@ -4891,6 +4891,24 @@ static NTSTATUS find_guid(ACTIVATION_CONTEXT* actctx, ULONG section_kind,
return STATUS_SUCCESS;
}
static const WCHAR *find_app_settings( ACTIVATION_CONTEXT *actctx, const WCHAR *settings )
{
unsigned int i, j;
for (i = 0; i < actctx->num_assemblies; i++)
{
struct assembly *assembly = &actctx->assemblies[i];
for (j = 0; j < assembly->entities.num; j++)
{
struct entity *entity = &assembly->entities.base[j];
if (entity->kind == ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS &&
!strcmpW( entity->u.settings.name, settings ))
return entity->u.settings.value;
}
}
return NULL;
}
/* initialize the activation context for the current process */
void actctx_init(void)
{
@ -5524,3 +5542,38 @@ NTSTATUS WINAPI RtlFindActivationContextSectionGuid( ULONG flags, const GUID *ex
return status;
}
/***********************************************************************
* RtlQueryActivationContextApplicationSettings (NTDLL.@)
*/
NTSTATUS WINAPI RtlQueryActivationContextApplicationSettings( DWORD flags, HANDLE handle, const WCHAR *ns,
const WCHAR *settings, WCHAR *buffer,
SIZE_T size, SIZE_T *written )
{
static const WCHAR namespaceW[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0',0};
ACTIVATION_CONTEXT *actctx = check_actctx( handle );
const WCHAR *res;
if (flags)
{
WARN( "unknown flags %08x\n", flags );
return STATUS_INVALID_PARAMETER;
}
if (ns && strncmpW( ns, namespaceW, strlenW(namespaceW) ))
{
WARN( "unknown namespace %s\n", debugstr_w(ns) );
return STATUS_INVALID_PARAMETER;
}
if (!handle) handle = process_actctx;
if (!(actctx = check_actctx( handle ))) return STATUS_INVALID_PARAMETER;
if (!(res = find_app_settings( actctx, settings ))) return STATUS_SXS_KEY_NOT_FOUND;
if (written) *written = strlenW(res) + 1;
if (size < strlenW(res)) return STATUS_BUFFER_TOO_SMALL;
strcpyW( buffer, res );
return STATUS_SUCCESS;
}

View File

@ -803,6 +803,7 @@
@ stub RtlPropertySetNameToGuid
@ stub RtlProtectHeap
@ stdcall RtlPushFrame(ptr)
@ stdcall RtlQueryActivationContextApplicationSettings(long ptr wstr wstr ptr long ptr)
@ stdcall RtlQueryAtomInAtomTable(ptr long ptr ptr ptr ptr)
@ stdcall RtlQueryDepthSList(ptr)
@ stdcall RtlQueryDynamicTimeZoneInformation(ptr)

View File

@ -2694,6 +2694,7 @@ NTSYSAPI void WINAPI RtlPopFrame(TEB_ACTIVE_FRAME*);
NTSYSAPI BOOLEAN WINAPI RtlPrefixString(const STRING*,const STRING*,BOOLEAN);
NTSYSAPI BOOLEAN WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
NTSYSAPI void WINAPI RtlPushFrame(TEB_ACTIVE_FRAME*);
NTSYSAPI NTSTATUS WINAPI RtlQueryActivationContextApplicationSettings(DWORD,HANDLE,const WCHAR*,const WCHAR*,WCHAR*,SIZE_T,SIZE_T*);
NTSYSAPI NTSTATUS WINAPI RtlQueryAtomInAtomTable(RTL_ATOM_TABLE,RTL_ATOM,ULONG*,ULONG*,WCHAR*,ULONG*);
NTSYSAPI NTSTATUS WINAPI RtlQueryDynamicTimeZoneInformation(RTL_DYNAMIC_TIME_ZONE_INFORMATION*);
NTSYSAPI NTSTATUS WINAPI RtlQueryEnvironmentVariable_U(PWSTR,PUNICODE_STRING,PUNICODE_STRING);