Signed-off-by: Nikolay Sivov nsivov@codeweavers.com ---
Reported as https://bugs.winehq.org/show_bug.cgi?id=44563
dlls/kernel32/tests/actctx.c | 4 +-- dlls/ntdll/actctx.c | 70 ++++++++++++++++++++++++++------------------ 2 files changed, 44 insertions(+), 30 deletions(-)
diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index cef11a5e63..263fe3997c 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -426,9 +426,9 @@ static const char compat_manifest_vista_7_8_10_81[] = " <assemblyIdentity version="1.0.0.0" name="Wine.Test" type="win32"></assemblyIdentity>" " <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">" " <application>" -" <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />" /* Windows Vista */ +" <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" ></supportedOS>" /* Windows Vista */ " <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />" /* Windows 7 */ -" <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />" /* Windows 8 */ +" <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" ></supportedOS>" /* Windows 8 */ " <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />" /* Windows 10 */ " <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />" /* Windows 8.1 */ " </application>" diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index 4a3370048f..27d6ad864c 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -2245,11 +2245,50 @@ static BOOL parse_file_elem(xmlbuf_t* xmlbuf, struct assembly* assembly, struct return ret; }
+static BOOL parse_supportedos_elem(xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl) +{ + xmlstr_t attr_name, attr_value; + BOOL end = FALSE, error; + + while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end)) + { + if (xmlstr_cmp(&attr_name, IdW)) + { + COMPATIBILITY_CONTEXT_ELEMENT *compat; + UNICODE_STRING str; + GUID compat_id; + + str.Buffer = (PWSTR)attr_value.ptr; + str.Length = str.MaximumLength = (USHORT)attr_value.len * sizeof(WCHAR); + if (RtlGUIDFromString(&str, &compat_id) == STATUS_SUCCESS) + { + if (!(compat = add_compat_context(assembly))) return FALSE; + compat->Type = ACTCX_COMPATIBILITY_ELEMENT_TYPE_OS; + compat->Id = compat_id; + } + else + { + WARN("Invalid guid %s\n", debugstr_xmlstr(&attr_value)); + } + } + else + { + WARN("unknown attr %s=%s\n", debugstr_xmlstr(&attr_name), + debugstr_xmlstr(&attr_value)); + } + } + + if (error) return FALSE; + if (end) return TRUE; + + return parse_expect_end_elem(xmlbuf, supportedOSW, asmv1W); +} + static BOOL parse_compatibility_application_elem(xmlbuf_t* xmlbuf, struct assembly* assembly, struct actctx_loader* acl) { - xmlstr_t attr_name, attr_value, elem; - BOOL end = FALSE, ret = TRUE, error; + BOOL ret = TRUE; + xmlstr_t elem;
while (ret && (ret = next_xml_elem(xmlbuf, &elem))) { @@ -2260,32 +2299,7 @@ static BOOL parse_compatibility_application_elem(xmlbuf_t* xmlbuf, struct assemb } else if (xmlstr_cmp(&elem, supportedOSW)) { - while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end)) - { - if (xmlstr_cmp(&attr_name, IdW)) - { - UNICODE_STRING str; - COMPATIBILITY_CONTEXT_ELEMENT* compat; - GUID compat_id; - str.Buffer = (PWSTR)attr_value.ptr; - str.Length = str.MaximumLength = (USHORT)attr_value.len * sizeof(WCHAR); - if (RtlGUIDFromString(&str, &compat_id) == STATUS_SUCCESS) - { - if (!(compat = add_compat_context(assembly))) return FALSE; - compat->Type = ACTCX_COMPATIBILITY_ELEMENT_TYPE_OS; - compat->Id = compat_id; - } - else - { - WARN("Invalid guid %s\n", debugstr_xmlstr(&attr_value)); - } - } - else - { - WARN("unknown attr %s=%s\n", debugstr_xmlstr(&attr_name), - debugstr_xmlstr(&attr_value)); - } - } + ret = parse_supportedos_elem(xmlbuf, assembly, acl); } else {