Commit 8306dd55 authored by Alexandre Julliard's avatar Alexandre Julliard

setupapi: Use the specified language for SxS manifest file names.

parent 6a6aab27
...@@ -595,9 +595,9 @@ static BOOL next_xml_attr(xmlbuf_t* xmlbuf, xmlstr_t* name, xmlstr_t* value, ...@@ -595,9 +595,9 @@ static BOOL next_xml_attr(xmlbuf_t* xmlbuf, xmlstr_t* name, xmlstr_t* value,
} }
static void get_manifest_filename( const xmlstr_t *arch, const xmlstr_t *name, const xmlstr_t *key, static void get_manifest_filename( const xmlstr_t *arch, const xmlstr_t *name, const xmlstr_t *key,
const xmlstr_t *version, WCHAR *buffer, DWORD size ) const xmlstr_t *version, const xmlstr_t *lang, WCHAR *buffer, DWORD size )
{ {
static const WCHAR trailerW[] = {'_','n','o','n','e','_','d','e','a','d','b','e','e','f',0}; static const WCHAR trailerW[] = {'_','d','e','a','d','b','e','e','f',0};
DWORD pos; DWORD pos;
pos = MultiByteToWideChar( CP_UTF8, 0, arch->ptr, arch->len, buffer, size ); pos = MultiByteToWideChar( CP_UTF8, 0, arch->ptr, arch->len, buffer, size );
...@@ -607,12 +607,14 @@ static void get_manifest_filename( const xmlstr_t *arch, const xmlstr_t *name, c ...@@ -607,12 +607,14 @@ static void get_manifest_filename( const xmlstr_t *arch, const xmlstr_t *name, c
pos += MultiByteToWideChar( CP_UTF8, 0, key->ptr, key->len, buffer + pos, size - pos ); pos += MultiByteToWideChar( CP_UTF8, 0, key->ptr, key->len, buffer + pos, size - pos );
buffer[pos++] = '_'; buffer[pos++] = '_';
pos += MultiByteToWideChar( CP_UTF8, 0, version->ptr, version->len, buffer + pos, size - pos ); pos += MultiByteToWideChar( CP_UTF8, 0, version->ptr, version->len, buffer + pos, size - pos );
buffer[pos++] = '_';
pos += MultiByteToWideChar( CP_UTF8, 0, lang->ptr, lang->len, buffer + pos, size - pos );
memcpy( buffer + pos, trailerW, sizeof(trailerW) ); memcpy( buffer + pos, trailerW, sizeof(trailerW) );
strlwrW( buffer ); strlwrW( buffer );
} }
static BOOL create_winsxs_dll( const WCHAR *dll_name, const xmlstr_t *arch, const xmlstr_t *name, static BOOL create_winsxs_dll( const WCHAR *dll_name, const xmlstr_t *arch, const xmlstr_t *name,
const xmlstr_t *key, const xmlstr_t *version, const xmlstr_t *key, const xmlstr_t *version, const xmlstr_t *lang,
const void *dll_data, size_t dll_size ) const void *dll_data, size_t dll_size )
{ {
static const WCHAR winsxsW[] = {'w','i','n','s','x','s','\\'}; static const WCHAR winsxsW[] = {'w','i','n','s','x','s','\\'};
...@@ -633,7 +635,7 @@ static BOOL create_winsxs_dll( const WCHAR *dll_name, const xmlstr_t *arch, cons ...@@ -633,7 +635,7 @@ static BOOL create_winsxs_dll( const WCHAR *dll_name, const xmlstr_t *arch, cons
path[pos++] = '\\'; path[pos++] = '\\';
memcpy( path + pos, winsxsW, sizeof(winsxsW) ); memcpy( path + pos, winsxsW, sizeof(winsxsW) );
pos += sizeof(winsxsW) / sizeof(WCHAR); pos += sizeof(winsxsW) / sizeof(WCHAR);
get_manifest_filename( arch, name, key, version, path + pos, path_len - pos ); get_manifest_filename( arch, name, key, version, lang, path + pos, path_len - pos );
pos += strlenW( path + pos ); pos += strlenW( path + pos );
path[pos++] = '\\'; path[pos++] = '\\';
strcpyW( path + pos, filename ); strcpyW( path + pos, filename );
...@@ -651,7 +653,7 @@ static BOOL create_winsxs_dll( const WCHAR *dll_name, const xmlstr_t *arch, cons ...@@ -651,7 +653,7 @@ static BOOL create_winsxs_dll( const WCHAR *dll_name, const xmlstr_t *arch, cons
} }
static BOOL create_manifest( const xmlstr_t *arch, const xmlstr_t *name, const xmlstr_t *key, static BOOL create_manifest( const xmlstr_t *arch, const xmlstr_t *name, const xmlstr_t *key,
const xmlstr_t *version, const void *data, DWORD len ) const xmlstr_t *version, const xmlstr_t *lang, const void *data, DWORD len )
{ {
static const WCHAR winsxsW[] = {'w','i','n','s','x','s','\\','m','a','n','i','f','e','s','t','s','\\'}; static const WCHAR winsxsW[] = {'w','i','n','s','x','s','\\','m','a','n','i','f','e','s','t','s','\\'};
static const WCHAR extensionW[] = {'.','m','a','n','i','f','e','s','t',0}; static const WCHAR extensionW[] = {'.','m','a','n','i','f','e','s','t',0};
...@@ -668,7 +670,7 @@ static BOOL create_manifest( const xmlstr_t *arch, const xmlstr_t *name, const x ...@@ -668,7 +670,7 @@ static BOOL create_manifest( const xmlstr_t *arch, const xmlstr_t *name, const x
path[pos++] = '\\'; path[pos++] = '\\';
memcpy( path + pos, winsxsW, sizeof(winsxsW) ); memcpy( path + pos, winsxsW, sizeof(winsxsW) );
pos += sizeof(winsxsW) / sizeof(WCHAR); pos += sizeof(winsxsW) / sizeof(WCHAR);
get_manifest_filename( arch, name, key, version, path + pos, MAX_PATH - pos ); get_manifest_filename( arch, name, key, version, lang, path + pos, MAX_PATH - pos );
strcatW( path + pos, extensionW ); strcatW( path + pos, extensionW );
handle = CreateFileW( path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL ); handle = CreateFileW( path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
if (handle == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND) if (handle == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND)
...@@ -701,13 +703,13 @@ static void register_manifest( const WCHAR *dll_name, const char *manifest, DWOR ...@@ -701,13 +703,13 @@ static void register_manifest( const WCHAR *dll_name, const char *manifest, DWOR
#endif #endif
xmlbuf_t buffer; xmlbuf_t buffer;
xmlstr_t elem, attr_name, attr_value; xmlstr_t elem, attr_name, attr_value;
xmlstr_t name, version, arch, key; xmlstr_t name, version, arch, key, lang;
BOOL end = FALSE, error; BOOL end = FALSE, error;
buffer.ptr = manifest; buffer.ptr = manifest;
buffer.end = manifest + len; buffer.end = manifest + len;
name.ptr = version.ptr = arch.ptr = key.ptr = NULL; name.ptr = version.ptr = arch.ptr = key.ptr = lang.ptr = NULL;
name.len = version.len = arch.len = key.len = 0; name.len = version.len = arch.len = key.len = lang.len = 0;
while (next_xml_elem( &buffer, &elem )) while (next_xml_elem( &buffer, &elem ))
{ {
...@@ -718,9 +720,15 @@ static void register_manifest( const WCHAR *dll_name, const char *manifest, DWOR ...@@ -718,9 +720,15 @@ static void register_manifest( const WCHAR *dll_name, const char *manifest, DWOR
else if (xmlstr_cmp(&attr_name, "version")) version = attr_value; else if (xmlstr_cmp(&attr_name, "version")) version = attr_value;
else if (xmlstr_cmp(&attr_name, "processorArchitecture")) arch = attr_value; else if (xmlstr_cmp(&attr_name, "processorArchitecture")) arch = attr_value;
else if (xmlstr_cmp(&attr_name, "publicKeyToken")) key = attr_value; else if (xmlstr_cmp(&attr_name, "publicKeyToken")) key = attr_value;
else if (xmlstr_cmp(&attr_name, "language")) lang = attr_value;
} }
if (!error && name.ptr && version.ptr && arch.ptr && key.ptr) if (!error && name.ptr && version.ptr && arch.ptr && key.ptr)
{ {
if (!lang.ptr)
{
lang.ptr = "none";
lang.len = strlen( lang.ptr );
}
if (!arch.len) /* fixup the architecture */ if (!arch.len) /* fixup the architecture */
{ {
char *new_buffer = HeapAlloc( GetProcessHeap(), 0, len + sizeof(current_arch) ); char *new_buffer = HeapAlloc( GetProcessHeap(), 0, len + sizeof(current_arch) );
...@@ -729,14 +737,14 @@ static void register_manifest( const WCHAR *dll_name, const char *manifest, DWOR ...@@ -729,14 +737,14 @@ static void register_manifest( const WCHAR *dll_name, const char *manifest, DWOR
memcpy( new_buffer + strlen(new_buffer), arch.ptr, len - (arch.ptr - manifest) ); memcpy( new_buffer + strlen(new_buffer), arch.ptr, len - (arch.ptr - manifest) );
arch.ptr = current_arch; arch.ptr = current_arch;
arch.len = strlen( current_arch ); arch.len = strlen( current_arch );
if (create_winsxs_dll( dll_name, &arch, &name, &key, &version, dll_data, dll_size )) if (create_winsxs_dll( dll_name, &arch, &name, &key, &version, &lang, dll_data, dll_size ))
create_manifest( &arch, &name, &key, &version, new_buffer, len + arch.len ); create_manifest( &arch, &name, &key, &version, &lang, new_buffer, len + arch.len );
HeapFree( GetProcessHeap(), 0, new_buffer ); HeapFree( GetProcessHeap(), 0, new_buffer );
} }
else else
{ {
if (create_winsxs_dll( dll_name, &arch, &name, &key, &version, dll_data, dll_size )) if (create_winsxs_dll( dll_name, &arch, &name, &key, &version, &lang, dll_data, dll_size ))
create_manifest( &arch, &name, &key, &version, manifest, len ); create_manifest( &arch, &name, &key, &version, &lang, manifest, len );
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment