Author: akhaldi
Date: Mon Mar 9 18:08:15 2015
New Revision: 66623
URL:
http://svn.reactos.org/svn/reactos?rev=66623&view=rev
Log:
[RTL] Partly sync actctx.c with Wine Staging 1.7.37. CORE-9246
Modified:
trunk/reactos/lib/rtl/actctx.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/lib/rtl/actctx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/actctx.c?rev=66623…
==============================================================================
--- trunk/reactos/lib/rtl/actctx.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/actctx.c [iso-8859-1] Mon Mar 9 18:08:15 2015
@@ -12,7 +12,7 @@
* Samuel Serapión
*/
-/* Based on Wine 1.7.17 */
+/* Based on Wine Staging 1.7.37 */
#include <rtl.h>
@@ -78,6 +78,7 @@
WCHAR *type;
struct assembly_version version;
BOOL optional;
+ BOOL delayed;
};
struct strsection_header
@@ -582,13 +583,13 @@
static const WCHAR dependentAssemblyW[] =
{'d','e','p','e','n','d','e','n','t','A','s','s','e','m','b','l','y',0};
static const WCHAR descriptionW[] =
{'d','e','s','c','r','i','p','t','i','o','n',0};
static const WCHAR fileW[] = {'f','i','l','e',0};
+static const WCHAR hashW[] = {'h','a','s','h',0};
static const WCHAR noInheritW[] =
{'n','o','I','n','h','e','r','i','t',0};
static const WCHAR noInheritableW[] =
{'n','o','I','n','h','e','r','i','t','a','b','l','e',0};
static const WCHAR typelibW[] =
{'t','y','p','e','l','i','b',0};
static const WCHAR windowClassW[] =
{'w','i','n','d','o','w','C','l','a','s','s',0};
static const WCHAR clsidW[] =
{'c','l','s','i','d',0};
-static const WCHAR hashW[] = {'h','a','s','h',0};
static const WCHAR hashalgW[] =
{'h','a','s','h','a','l','g',0};
static const WCHAR helpdirW[] =
{'h','e','l','p','d','i','r',0};
static const WCHAR iidW[] = {'i','i','d',0};
@@ -684,6 +685,7 @@
static const WCHAR g_xmlW[] = {'?','x','m','l',0};
static const WCHAR manifestv1W[] =
{'u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','a','s','m','.','v','1',0};
+static const WCHAR manifestv2W[] =
{'u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','a','s','m','.','v','2',0};
static const WCHAR manifestv3W[] =
{'u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','a','s','m','.','v','3',0};
static const WCHAR dotManifestW[] =
{'.','m','a','n','i','f','e','s','t',0};
@@ -879,6 +881,7 @@
RtlFreeHeap(RtlGetProcessHeap(), 0, entity->u.ifaceps.base);
RtlFreeHeap(RtlGetProcessHeap(), 0, entity->u.ifaceps.ps32);
RtlFreeHeap(RtlGetProcessHeap(), 0, entity->u.ifaceps.name);
+ RtlFreeHeap(RtlGetProcessHeap(), 0, entity->u.ifaceps.tlib);
break;
case ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION:
RtlFreeHeap(RtlGetProcessHeap(), 0, entity->u.typelib.tlbid);
@@ -1060,6 +1063,7 @@
append_string( ret, versionW2, version );
return ret;
}
+
static ACTIVATION_CONTEXT *check_actctx( HANDLE h )
{
ACTIVATION_CONTEXT *ret = NULL, *actctx = h;
@@ -1114,6 +1118,14 @@
RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->config.info );
RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->appdir.info );
RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->assemblies );
+ RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->dllredirect_section );
+ RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->wndclass_section );
+ RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->tlib_section );
+ RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->comserver_section );
+ RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->ifaceps_section );
+ RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->clrsurrogate_section );
+ RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->progid_section );
+
pActual = CONTAINING_RECORD(actctx, ACTIVATION_CONTEXT_WRAPPED,
ActivationContext);
pActual->MagicMarker = 0;
RtlFreeHeap(RtlGetProcessHeap(), 0, pActual);
@@ -1891,16 +1903,26 @@
static BOOL parse_description_elem(xmlbuf_t* xmlbuf)
{
- xmlstr_t elem, content;
- UNICODE_STRING elemU;
- BOOL end = FALSE, ret = TRUE;
-
- if (!parse_expect_no_attr(xmlbuf, &end) || end ||
- !parse_text_content(xmlbuf, &content))
+ xmlstr_t elem, content, attr_name, attr_value;
+ BOOL end = FALSE, ret = TRUE, error = FALSE;
+
+ UNICODE_STRING elem1U, elem2U;
+
+ while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end))
+ {
+ elem1U = xmlstr2unicode(&attr_name);
+ elem2U = xmlstr2unicode(&attr_value);
+ DPRINT1("unknown attr %s=%s\n", &elem1U, &elem2U);
+ }
+
+ if (error) return FALSE;
+ if (end) return TRUE;
+
+ if (!parse_text_content(xmlbuf, &content))
return FALSE;
- elemU = xmlstr2unicode(&content);
- DPRINT("Got description %wZ\n", &elemU);
+ elem1U = xmlstr2unicode(&content);
+ DPRINT("Got description %wZ\n", &elem1U);
while (ret && (ret = next_xml_elem(xmlbuf, &elem)))
{
@@ -1911,8 +1933,8 @@
}
else
{
- elemU = xmlstr2unicode(&elem);
- DPRINT1("unknown elem %wZ\n", &elemU);
+ elem1U = xmlstr2unicode(&elem);
+ DPRINT1("unknown elem %wZ\n", &elem1U);
ret = parse_unknown_elem(xmlbuf, &elem);
}
}
@@ -2092,13 +2114,31 @@
static BOOL parse_dependent_assembly_elem(xmlbuf_t* xmlbuf, struct actctx_loader* acl,
BOOL optional)
{
struct assembly_identity ai;
- xmlstr_t elem;
- BOOL end = FALSE, ret = TRUE;
-
- if (!parse_expect_no_attr(xmlbuf, &end) || end) return end;
+ xmlstr_t elem, attr_name, attr_value;
+ BOOL end = FALSE, error = FALSE, ret = TRUE, delayed = FALSE;
+
+ UNICODE_STRING elem1U, elem2U;
+
+ while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end))
+ {
+ static const WCHAR allowDelayedBindingW[] =
{'a','l','l','o','w','D','e','l','a','y','e','d','B','i','n','d','i','n','g',0};
+ static const WCHAR trueW[] =
{'t','r','u','e',0};
+
+ if (xmlstr_cmp(&attr_name, allowDelayedBindingW))
+ delayed = xmlstr_cmp(&attr_value, trueW);
+ else
+ {
+ elem1U = xmlstr2unicode(&attr_name);
+ elem2U = xmlstr2unicode(&attr_value);
+ DPRINT1("unknown attr %s=%s\n", &elem1U, &elem2U);
+ }
+ }
+
+ if (error || end) return end;
memset(&ai, 0, sizeof(ai));
ai.optional = optional;
+ ai.delayed = delayed;
if (!parse_expect_elem(xmlbuf, assemblyIdentityW, asmv1W) ||
!parse_assembly_identity_elem(xmlbuf, acl->actctx, &ai))
@@ -2297,7 +2337,9 @@
}
else if (xmlstr_cmp(&attr_name, xmlnsW))
{
- if (!xmlstr_cmp(&attr_value, manifestv1W) &&
!xmlstr_cmp(&attr_value, manifestv3W))
+ if (!xmlstr_cmp(&attr_value, manifestv1W) &&
+ !xmlstr_cmp(&attr_value, manifestv2W) &&
+ !xmlstr_cmp(&attr_value, manifestv3W))
{
DPRINT1("wrong namespace %wZ\n", &attr_valueU);
return FALSE;
@@ -2537,7 +2579,7 @@
static NTSTATUS get_module_filename( HMODULE module, UNICODE_STRING *str, USHORT
extra_len )
{
NTSTATUS status;
- ULONG magic;
+ ULONG_PTR magic;
LDR_DATA_TABLE_ENTRY *pldr;
LdrLockLoaderLock(0, NULL, &magic);
@@ -2763,8 +2805,8 @@
{
static const WCHAR lookup_fmtW[] =
{'%','s','_','%','s','_','%','s','_','%','u','.','%','u','.','*','.','*','_',
- '*', /* FIXME */
-
'.','m','a','n','i','f','e','s','t',0};
+
'%','s','_','*','.','m','a','n','i','f','e','s','t',0};
+ static const WCHAR wine_trailerW[] =
{'d','e','a','d','b','e','e','f','.','m','a','n','i','f','e','s','t'};
WCHAR *lookup, *ret = NULL;
UNICODE_STRING lookup_us;
@@ -2788,6 +2830,7 @@
FileBothDirectoryInformation, FALSE, &lookup_us, TRUE );
if (io.Status == STATUS_SUCCESS)
{
+ ULONG min_build = ai->version.build, min_revision = ai->version.revision;
FILE_BOTH_DIR_INFORMATION *dir_info;
WCHAR *tmp;
ULONG build, revision;
@@ -2811,20 +2854,32 @@
tmp = (WCHAR *)dir_info->FileName + (strchrW(lookup, '*') -
lookup);
build = atoiW(tmp);
- if (build < ai->version.build) continue;
+ if (build < min_build) continue;
tmp = strchrW(tmp, '.') + 1;
revision = atoiW(tmp);
- if (build == ai->version.build && revision <
ai->version.revision)
- continue;
- ai->version.build = (USHORT)build;
- ai->version.revision = (USHORT)revision;
-
- if ((ret = RtlAllocateHeap( RtlGetProcessHeap(), 0,
dir_info->FileNameLength * sizeof(WCHAR) )))
+ if (build == min_build && revision < min_revision) continue;
+ tmp = strchrW(tmp, '_') + 1;
+ tmp = strchrW(tmp, '_') + 1;
+ if (dir_info->FileNameLength - (tmp - dir_info->FileName) *
sizeof(WCHAR) == sizeof(wine_trailerW) &&
+ !memicmpW( tmp, wine_trailerW, sizeof(wine_trailerW) / sizeof(WCHAR) ))
+ {
+ /* prefer a non-Wine manifest if we already have one */
+ /* we'll still load the builtin dll if specified through DllOverrides
*/
+ if (ret) continue;
+ }
+ else
+ {
+ min_build = build;
+ min_revision = revision;
+ }
+ ai->version.build = build;
+ ai->version.revision = revision;
+ RtlFreeHeap( RtlGetProcessHeap(), 0, ret );
+ if ((ret = RtlAllocateHeap( RtlGetProcessHeap(), 0,
dir_info->FileNameLength + sizeof(WCHAR) )))
{
memcpy( ret, dir_info->FileName, dir_info->FileNameLength );
ret[dir_info->FileNameLength/sizeof(WCHAR)] = 0;
}
- break;
}
}
else DPRINT1("no matching file for %S\n", lookup);
@@ -2920,7 +2975,7 @@
HANDLE file;
DWORD len;
- DPRINT( "looking for name=%S version=%u.%u.%u.%u arch=%S\n",
+ DPRINT1( "looking for name=%S version=%u.%u.%u.%u arch=%S\n",
ai->name, ai->version.major, ai->version.minor, ai->version.build,
ai->version.revision, ai->arch );
if ((status = lookup_winsxs(acl, ai)) != STATUS_NO_SUCH_FILE) return status;
@@ -3006,7 +3061,7 @@
{
if (lookup_assembly(acl, &acl->dependencies[i]) != STATUS_SUCCESS)
{
- if (!acl->dependencies[i].optional)
+ if (!acl->dependencies[i].optional &&
!acl->dependencies[i].delayed)
{
const struct assembly_version *ver =
&acl->dependencies[i].version;
DPRINT1( "Could not find dependent assembly %S
(%u.%u.%u.%u)\n",
@@ -3035,7 +3090,7 @@
}
else if (flags & (RTL_QUERY_ACTIVATION_CONTEXT_FLAG_IS_ADDRESS |
RTL_QUERY_ACTIVATION_CONTEXT_FLAG_IS_HMODULE))
{
- ULONG magic;
+ ULONG_PTR magic;
LDR_DATA_TABLE_ENTRY *pldr;
if (!*handle) return STATUS_INVALID_PARAMETER;
@@ -4584,6 +4639,11 @@
/* FUNCTIONS ***************************************************************/
+/***********************************************************************
+ * RtlCreateActivationContext (NTDLL.@)
+ *
+ * Create an activation context.
+ */
NTSTATUS
NTAPI
RtlCreateActivationContext(IN ULONG Flags,
@@ -4633,7 +4693,7 @@
if (pActCtx->dwFlags & ACTCTX_FLAG_HMODULE_VALID) module =
pActCtx->hModule;
else module = NtCurrentTeb()->ProcessEnvironmentBlock->ImageBaseAddress;
- status = get_module_filename(module, &dir, 0);
+ status = get_module_filename( module, &dir, 0 );
if (!NT_SUCCESS(status)) goto error;
if ((p = strrchrW( dir.Buffer, '\\' ))) p[1] = 0;
actctx->appdir.info = dir.Buffer;
@@ -4782,24 +4842,43 @@
}
}
#else
-VOID
-NTAPI
-RtlAddRefActivationContext( HANDLE handle )
+
+/***********************************************************************
+ * RtlAddRefActivationContext (NTDLL.@)
+ */
+VOID NTAPI RtlAddRefActivationContext( HANDLE handle )
{
ACTIVATION_CONTEXT *actctx;
- if ((actctx = check_actctx(handle))) actctx_addref(actctx);
-}
-
-VOID
-NTAPI
-RtlReleaseActivationContext( HANDLE handle )
+ if ((actctx = check_actctx( handle ))) actctx_addref( actctx );
+}
+
+
+/******************************************************************
+ * RtlReleaseActivationContext (NTDLL.@)
+ */
+VOID NTAPI RtlReleaseActivationContext( HANDLE handle )
{
ACTIVATION_CONTEXT *actctx;
- if ((actctx = check_actctx(handle))) actctx_release(actctx);
-}
+ if ((actctx = check_actctx( handle ))) actctx_release( actctx );
+}
+
#endif
+
+/******************************************************************
+ * RtlZombifyActivationContext (NTDLL.@)
+ *
+ */
+NTSTATUS NTAPI RtlZombifyActivationContext(PVOID Context)
+{
+ UNIMPLEMENTED;
+
+ if (Context == ACTCTX_FAKE_HANDLE)
+ return STATUS_SUCCESS;
+
+ return STATUS_NOT_IMPLEMENTED;
+}
NTSTATUS
NTAPI RtlActivateActivationContextEx( ULONG flags, PTEB tebAddress, HANDLE handle,
PULONG_PTR cookie )
@@ -4821,16 +4900,18 @@
return STATUS_SUCCESS;
}
-
-NTSTATUS
-NTAPI RtlActivateActivationContext( ULONG flags, HANDLE handle, PULONG_PTR cookie )
+/******************************************************************
+ * RtlActivateActivationContext (NTDLL.@)
+ */
+NTSTATUS NTAPI RtlActivateActivationContext( ULONG flags, HANDLE handle, PULONG_PTR
cookie )
{
return RtlActivateActivationContextEx(flags, NtCurrentTeb(), handle, cookie);
}
-NTSTATUS
-NTAPI
-RtlDeactivateActivationContext( ULONG flags, ULONG_PTR cookie )
+/***********************************************************************
+ * RtlDeactivateActivationContext (NTDLL.@)
+ */
+NTSTATUS NTAPI RtlDeactivateActivationContext( ULONG flags, ULONG_PTR cookie )
{
RTL_ACTIVATION_CONTEXT_STACK_FRAME *frame, *top;
@@ -4892,16 +4973,20 @@
RtlFreeHeap(RtlGetProcessHeap(), 0, Stack);
}
-VOID
-NTAPI RtlFreeThreadActivationContextStack(VOID)
+/******************************************************************
+ * RtlFreeThreadActivationContextStack (NTDLL.@)
+ */
+VOID NTAPI RtlFreeThreadActivationContextStack(VOID)
{
RtlFreeActivationContextStack(NtCurrentTeb()->ActivationContextStackPointer);
NtCurrentTeb()->ActivationContextStackPointer = NULL;
}
-NTSTATUS
-NTAPI RtlGetActiveActivationContext( HANDLE *handle )
+/******************************************************************
+ * RtlGetActiveActivationContext (NTDLL.@)
+ */
+NTSTATUS NTAPI RtlGetActiveActivationContext( HANDLE *handle )
{
if (NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame)
{
@@ -4915,8 +5000,10 @@
}
-BOOLEAN
-NTAPI RtlIsActivationContextActive( HANDLE handle )
+/******************************************************************
+ * RtlIsActivationContextActive (NTDLL.@)
+ */
+BOOLEAN NTAPI RtlIsActivationContextActive( HANDLE handle )
{
RTL_ACTIVATION_CONTEXT_STACK_FRAME *frame;
@@ -4925,11 +5012,16 @@
return FALSE;
}
-NTSTATUS
-NTAPI
-RtlQueryInformationActivationContext( ULONG flags, HANDLE handle, PVOID subinst,
- ULONG class, PVOID buffer,
- SIZE_T bufsize, SIZE_T *retlen )
+
+/***********************************************************************
+ * RtlQueryInformationActivationContext (NTDLL.@)
+ *
+ * Get information about an activation context.
+ * FIXME: function signature/prototype may be wrong
+ */
+NTSTATUS NTAPI RtlQueryInformationActivationContext( ULONG flags, HANDLE handle, PVOID
subinst,
+ ULONG class, PVOID buffer,
+ SIZE_T bufsize, SIZE_T *retlen )
{
ACTIVATION_CONTEXT *actctx;
NTSTATUS status;
@@ -5172,10 +5264,14 @@
return STATUS_SUCCESS;
}
-NTSTATUS
-NTAPI
-RtlFindActivationContextSectionString( ULONG flags, const GUID *guid, ULONG
section_kind,
- const UNICODE_STRING *section_name, PVOID ptr )
+/***********************************************************************
+ * RtlFindActivationContextSectionString (NTDLL.@)
+ *
+ * Find information about a string in an activation context.
+ * FIXME: function signature/prototype may be wrong
+ */
+NTSTATUS NTAPI RtlFindActivationContextSectionString( ULONG flags, const GUID *guid,
ULONG section_kind,
+ const UNICODE_STRING *section_name,
PVOID ptr )
{
PACTCTX_SECTION_KEYED_DATA data = ptr;
NTSTATUS status;
@@ -5204,13 +5300,19 @@
return status;
}
+/***********************************************************************
+ * RtlFindActivationContextSectionGuid (NTDLL.@)
+ *
+ * Find information about a GUID in an activation context.
+ * FIXME: function signature/prototype may be wrong
+ */
NTSTATUS WINAPI RtlFindActivationContextSectionGuid( ULONG flags, const GUID *extguid,
ULONG section_kind,
const GUID *guid, void *ptr )
{
- ACTCTX_SECTION_KEYED_DATA *data = ptr;
- NTSTATUS status = STATUS_SXS_KEY_NOT_FOUND;
-
- if (extguid)
+ ACTCTX_SECTION_KEYED_DATA *data = ptr;
+ NTSTATUS status = STATUS_SXS_KEY_NOT_FOUND;
+
+ if (extguid)
{
DPRINT1("expected extguid == NULL\n");
return STATUS_INVALID_PARAMETER;
@@ -5224,7 +5326,7 @@
if (!data || data->cbSize < FIELD_OFFSET(ACTCTX_SECTION_KEYED_DATA,
ulAssemblyRosterIndex) || !guid)
return STATUS_INVALID_PARAMETER;
-
+
if (NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame)
{
ACTIVATION_CONTEXT *actctx =
check_actctx(NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame->ActivationContext);
@@ -5346,17 +5448,3 @@
return frame;
}
-
-
-NTSTATUS
-NTAPI
-RtlZombifyActivationContext(PVOID Context)
-{
- UNIMPLEMENTED;
-
- if (Context == ACTCTX_FAKE_HANDLE)
- return STATUS_SUCCESS;
-
- return STATUS_NOT_IMPLEMENTED;
-}
-
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Mon Mar 9 18:08:15 2015
@@ -260,6 +260,8 @@
reactos/lib/3rdparty/strmbase # Synced to Wine-1.7.27
+reactos/lib/rtl/actctx.c # Partly synced with WineStaging-1.7.37
+
advapi32 -
reactos/dll/win32/advapi32/wine/cred.c # Synced to Wine-1.7.27
reactos/dll/win32/advapi32/wine/crypt.c # Synced to Wine-1.7.27