static const WCHAR iidW[] = {'i','i','d',0};
static const WCHAR languageW[] = {'l','a','n','g','u','a','g','e',0};
static const WCHAR manifestVersionW[] = {'m','a','n','i','f','e','s','t','V','e','r','s','i','o','n',0};
-static const WCHAR nameW[] = {'n','a','m','e',0};
+static const WCHAR g_nameW[] = {'n','a','m','e',0};
static const WCHAR newVersionW[] = {'n','e','w','V','e','r','s','i','o','n',0};
static const WCHAR oldVersionW[] = {'o','l','d','V','e','r','s','i','o','n',0};
static const WCHAR optionalW[] = {'o','p','t','i','o','n','a','l',0};
static const WCHAR versionW[] = {'v','e','r','s','i','o','n',0};
static const WCHAR xmlnsW[] = {'x','m','l','n','s',0};
-static const WCHAR xmlW[] = {'?','x','m','l',0};
+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 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};
{',','p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=',0};
static const WCHAR public_keyW[] =
{',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=',0};
- static const WCHAR typeW[] =
- {',','t','y','p','e','=',0};
- static const WCHAR versionW[] =
- {',','v','e','r','s','i','o','n','=',0};
WCHAR version[64], *ret;
SIZE_T size = 0;
sprintfW( version, version_formatW,
ai->version.major, ai->version.minor, ai->version.build, ai->version.revision );
- if (ai->name) size += strlenW(ai->name) * sizeof(WCHAR);
+ if (ai->name) size += strlenW(ai->name);
if (ai->arch) size += strlenW(archW) + strlenW(ai->arch) + 2;
if (ai->public_key) size += strlenW(public_keyW) + strlenW(ai->public_key) + 2;
- if (ai->type) size += strlenW(typeW) + strlenW(ai->type) + 2;
- size += strlenW(versionW) + strlenW(version) + 2;
+ if (ai->type) size += 1 + strlenW(typeW) + 1 + strlenW(ai->type) + 2;
+ size += 1+ strlenW(versionW) + 1 + strlenW(version) + 2;
if (!(ret = RtlAllocateHeap( RtlGetProcessHeap(), 0, (size + 1) * sizeof(WCHAR) )))
return NULL;
while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end))
{
- if (xmlstr_cmp(&attr_name, nameW))
+ if (xmlstr_cmp(&attr_name, g_nameW))
{
if (!(ai->name = xmlstrdupW(&attr_value))) return FALSE;
}
{
if (!(entity->u.proxy.iid = xmlstrdupW(&attr_value))) return FALSE;
}
- if (xmlstr_cmp(&attr_name, nameW))
+ if (xmlstr_cmp(&attr_name, g_nameW))
{
if (!(entity->u.proxy.name = xmlstrdupW(&attr_value))) return FALSE;
}
{
if (!(entity->u.proxy.iid = xmlstrdupW(&attr_value))) return FALSE;
}
- if (xmlstr_cmp(&attr_name, nameW))
+ if (xmlstr_cmp(&attr_name, g_nameW))
{
if (!(entity->u.proxy.name = xmlstrdupW(&attr_value))) return FALSE;
}
while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end))
{
- if (xmlstr_cmp(&attr_name, nameW))
+ if (xmlstr_cmp(&attr_name, g_nameW))
{
if (!(entity->u.clrclass.name = xmlstrdupW(&attr_value))) return FALSE;
}
while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end))
{
- if (xmlstr_cmp(&attr_name, nameW))
+ if (xmlstr_cmp(&attr_name, g_nameW))
{
if (!(entity->u.clrsurrogate.name = xmlstrdupW(&attr_value))) return FALSE;
}
attr_nameU = xmlstr2unicode(&attr_name);
attr_valueU = xmlstr2unicode(&attr_value);
- if (xmlstr_cmp(&attr_name, nameW))
+ if (xmlstr_cmp(&attr_name, g_nameW))
{
if (!(dll->name = xmlstrdupW(&attr_value))) return FALSE;
DPRINT("name=%wZ\n", &attr_valueU);
if (!next_xml_elem(xmlbuf, &elem)) return STATUS_SXS_CANT_GEN_ACTCTX;
- if (xmlstr_cmp(&elem, xmlW) &&
+ if (xmlstr_cmp(&elem, g_xmlW) &&
(!parse_xml_header(xmlbuf) || !next_xml_elem(xmlbuf, &elem)))
return STATUS_SXS_CANT_GEN_ACTCTX;
}
else
{
- /* let's assume utf-8 for now */
- size_t len;
- WCHAR *new_buff;
+ /* TODO: this doesn't handle arbitrary encodings */
+ ANSI_STRING xmlA;
+ UNICODE_STRING xmlW;
+
+ ASSERT(size < MAXUSHORT);
+ xmlA.Buffer = (PCHAR)buffer;
+ xmlA.Length = xmlA.MaximumLength = (USHORT)size;
_SEH2_TRY
{
- len = mbstowcs(NULL, buffer, size);
+ status = RtlAnsiStringToUnicodeString(&xmlW, &xmlA, TRUE);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
}
_SEH2_END;
- DPRINT("len = %x\n", len);
-
- if (len == -1)
+ if (!NT_SUCCESS(status))
{
- DPRINT1( "utf-8 conversion failed\n" );
+ DPRINT1("RtlAnsiStringToUnicodeString failed with %lx\n", status);
return STATUS_SXS_CANT_GEN_ACTCTX;
}
- if (!(new_buff = RtlAllocateHeap( RtlGetProcessHeap(), HEAP_ZERO_MEMORY, len)))
- return STATUS_NO_MEMORY;
+ ASSERT(xmlW.Buffer != NULL);
- mbstowcs( new_buff, buffer, size);
- xmlbuf.ptr = new_buff;
-
- xmlbuf.end = xmlbuf.ptr + len / sizeof(WCHAR);
+ xmlbuf.ptr = xmlW.Buffer;
+ xmlbuf.end = xmlbuf.ptr + xmlW.Length / sizeof(WCHAR);
status = parse_manifest_buffer( acl, assembly, ai, &xmlbuf );
- RtlFreeHeap( RtlGetProcessHeap(), 0, new_buff );
+ RtlFreeUnicodeString(&xmlW);
}
return status;
}
*Context = ContextStack;
- /* FIXME: Documentation on MSDN reads that activation contexts are only created
- for modules that have a valid manifest file or resource */
- actctx_init();
-
return STATUS_SUCCESS;
}