From: Hans Leidekker hans@codeweavers.com
--- dlls/sxs/cache.c | 72 +++++++++++++++++++----------------------------- dlls/sxs/name.c | 29 ++++++++----------- 2 files changed, 40 insertions(+), 61 deletions(-)
diff --git a/dlls/sxs/cache.c b/dlls/sxs/cache.c index a924a359700..f9ecc454550 100644 --- a/dlls/sxs/cache.c +++ b/dlls/sxs/cache.c @@ -35,12 +35,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(sxs);
-static const WCHAR cache_mutex_nameW[] = - {'_','_','W','I','N','E','_','S','X','S','_','C','A','C','H','E','_','M','U','T','E','X','_','_',0}; - -static const WCHAR win32W[] = {'w','i','n','3','2',0}; -static const WCHAR win32_policyW[] = {'w','i','n','3','2','-','p','o','l','i','c','y',0}; -static const WCHAR backslashW[] = {'\',0}; +static const WCHAR cache_mutex_nameW[] = L"__WINE_SXS_CACHE_MUTEX__";
struct cache { @@ -96,7 +91,7 @@ static ULONG WINAPI cache_Release( IAssemblyCache *iface )
static unsigned int build_sxs_path( WCHAR *path ) { - static const WCHAR winsxsW[] = {'\','w','i','n','s','x','s','\',0}; + static const WCHAR winsxsW[] = L"\winsxs\"; unsigned int len = GetWindowsDirectoryW( path, MAX_PATH );
memcpy( path + len, winsxsW, sizeof(winsxsW) ); @@ -106,8 +101,7 @@ static unsigned int build_sxs_path( WCHAR *path ) static WCHAR *build_assembly_name( const WCHAR *arch, const WCHAR *name, const WCHAR *token, const WCHAR *version, unsigned int *len ) { - static const WCHAR fmtW[] = - {'%','s','_','%','s','_','%','s','_','%','s','_','n','o','n','e','_','d','e','a','d','b','e','e','f',0}; + static const WCHAR fmtW[] = L"%s_%s_%s_%s_none_deadbeef"; unsigned int buflen = ARRAY_SIZE(fmtW); WCHAR *ret;
@@ -143,8 +137,7 @@ static WCHAR *build_dll_path( const WCHAR *arch, const WCHAR *name, const WCHAR static WCHAR *build_policy_name( const WCHAR *arch, const WCHAR *name, const WCHAR *token, unsigned int *len ) { - static const WCHAR fmtW[] = - {'%','s','_','%','s','_','%','s','_','n','o','n','e','_','d','e','a','d','b','e','e','f',0}; + static const WCHAR fmtW[] = L"%s_%s_%s_none_deadbeef"; unsigned int buflen = ARRAY_SIZE(fmtW); WCHAR *ret;
@@ -159,8 +152,7 @@ static WCHAR *build_policy_name( const WCHAR *arch, const WCHAR *name, const WCH static WCHAR *build_policy_path( const WCHAR *arch, const WCHAR *name, const WCHAR *token, const WCHAR *version ) { - static const WCHAR fmtW[] = - {'%','s','p','o','l','i','c','i','e','s','\','%','s','\','%','s','.','p','o','l','i','c','y',0}; + static const WCHAR fmtW[] = L"%spolicies\%s\%s.policy"; WCHAR *path = NULL, *ret, sxsdir[MAX_PATH]; unsigned int len;
@@ -229,8 +221,8 @@ static HRESULT WINAPI cache_QueryAssemblyInfo( } cache_lock( cache );
- if (!wcscmp( type, win32W )) path = build_dll_path( arch, name, token, version ); - else if (!wcscmp( type, win32_policyW )) path = build_policy_path( arch, name, token, version ); + if (!wcscmp( type, L"win32" )) path = build_dll_path( arch, name, token, version ); + else if (!wcscmp( type, L"win32-policy" )) path = build_policy_path( arch, name, token, version ); else { hr = HRESULT_FROM_WIN32( ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE ); @@ -346,8 +338,6 @@ static void free_assembly( struct assembly *assembly )
static HRESULT parse_files( IXMLDOMDocument *doc, struct assembly *assembly ) { - static const WCHAR fileW[] = {'f','i','l','e',0}; - static const WCHAR nameW[] = {'n','a','m','e',0}; IXMLDOMNamedNodeMap *attrs; IXMLDOMNodeList *list; IXMLDOMNode *node; @@ -356,7 +346,7 @@ static HRESULT parse_files( IXMLDOMDocument *doc, struct assembly *assembly ) HRESULT hr; LONG len;
- str = SysAllocString( fileW ); + str = SysAllocString( L"file" ); hr = IXMLDOMDocument_getElementsByTagName( doc, str, &list ); SysFreeString( str ); if (hr != S_OK) return hr; @@ -393,7 +383,7 @@ static HRESULT parse_files( IXMLDOMDocument *doc, struct assembly *assembly ) goto done; }
- f->name = get_attribute_value( attrs, nameW ); + f->name = get_attribute_value( attrs, L"name" ); IXMLDOMNamedNodeMap_Release( attrs ); if (!f->name) { @@ -417,12 +407,6 @@ done:
static HRESULT parse_assembly( IXMLDOMDocument *doc, struct assembly **assembly ) { - static const WCHAR identityW[] = {'a','s','s','e','m','b','l','y','I','d','e','n','t','i','t','y',0}; - static const WCHAR typeW[] = {'t','y','p','e',0}; - static const WCHAR nameW[] = {'n','a','m','e',0}; - static const WCHAR versionW[] = {'v','e','r','s','i','o','n',0}; - static const WCHAR architectureW[] = {'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 tokenW[] = {'p','u','b','l','i','c','K','e','y','T','o','k','e','n',0}; IXMLDOMNodeList *list = NULL; IXMLDOMNode *node = NULL; IXMLDOMNamedNodeMap *attrs = NULL; @@ -431,7 +415,7 @@ static HRESULT parse_assembly( IXMLDOMDocument *doc, struct assembly **assembly HRESULT hr; LONG len;
- str = SysAllocString( identityW ); + str = SysAllocString( L"assemblyIdentity" ); hr = IXMLDOMDocument_getElementsByTagName( doc, str, &list ); SysFreeString( str ); if (hr != S_OK) goto done; @@ -460,20 +444,20 @@ static HRESULT parse_assembly( IXMLDOMDocument *doc, struct assembly **assembly hr = IXMLDOMNode_get_attributes( node, &attrs ); if (hr != S_OK) goto done;
- a->type = get_attribute_value( attrs, typeW ); - a->name = get_attribute_value( attrs, nameW ); - a->version = get_attribute_value( attrs, versionW ); - a->arch = get_attribute_value( attrs, architectureW ); - a->token = get_attribute_value( attrs, tokenW ); + a->type = get_attribute_value( attrs, L"type" ); + a->name = get_attribute_value( attrs, L"name" ); + a->version = get_attribute_value( attrs, L"version" ); + a->arch = get_attribute_value( attrs, L"processorArchitecture" ); + a->token = get_attribute_value( attrs, L"publicKeyToken" );
- if (!a->type || (wcscmp( a->type, win32W ) && wcscmp( a->type, win32_policyW )) || + if (!a->type || (wcscmp( a->type, L"win32" ) && wcscmp( a->type, L"win32-policy" )) || !a->name || !a->version || !a->arch || !a->token) { WARN("invalid win32 assembly\n"); hr = ERROR_SXS_MANIFEST_FORMAT_ERROR; goto done; } - if (!wcscmp( a->type, win32W )) hr = parse_files( doc, a ); + if (!wcscmp( a->type, L"win32" )) hr = parse_files( doc, a );
done: if (attrs) IXMLDOMNamedNodeMap_Release( attrs ); @@ -487,8 +471,8 @@ done: static WCHAR *build_policy_filename( const WCHAR *arch, const WCHAR *name, const WCHAR *token, const WCHAR *version ) { - static const WCHAR policiesW[] = {'p','o','l','i','c','i','e','s','\',0}; - static const WCHAR suffixW[] = {'.','p','o','l','i','c','y',0}; + static const WCHAR policiesW[] = L"policies\"; + static const WCHAR suffixW[] = L".policy"; WCHAR sxsdir[MAX_PATH], *ret, *fullname; unsigned int len;
@@ -507,7 +491,7 @@ static WCHAR *build_policy_filename( const WCHAR *arch, const WCHAR *name, const CreateDirectoryW( ret, NULL ); lstrcatW( ret, name ); CreateDirectoryW( ret, NULL ); - lstrcatW( ret, backslashW ); + lstrcatW( ret, L"\" ); lstrcatW( ret, version ); lstrcatW( ret, suffixW );
@@ -558,8 +542,8 @@ static WCHAR *build_source_filename( const WCHAR *manifest, struct file *file ) static WCHAR *build_manifest_filename( const WCHAR *arch, const WCHAR *name, const WCHAR *token, const WCHAR *version ) { - static const WCHAR manifestsW[] = {'m','a','n','i','f','e','s','t','s','\',0}; - static const WCHAR suffixW[] = {'.','m','a','n','i','f','e','s','t',0}; + static const WCHAR manifestsW[] = L"manifests\"; + static const WCHAR suffixW[] = L".manifest"; WCHAR sxsdir[MAX_PATH], *ret, *fullname; unsigned int len;
@@ -642,7 +626,7 @@ static HRESULT install_assembly( const WCHAR *manifest, struct assembly *assembl lstrcatW( dst, name ); CreateDirectoryW( dst, NULL );
- lstrcatW( dst, backslashW ); + lstrcatW( dst, L"\" ); lstrcatW( dst, file->name ); for (p = dst; *p; p++) *p = towlower( *p );
@@ -688,7 +672,7 @@ static HRESULT WINAPI cache_InstallAssembly(
/* FIXME: verify name attributes */
- if (!wcscmp( assembly->type, win32_policyW )) + if (!wcscmp( assembly->type, L"win32-policy" )) hr = install_policy( path, assembly ); else hr = install_assembly( path, assembly ); @@ -721,7 +705,7 @@ static HRESULT uninstall_assembly( struct assembly *assembly ) len = len_sxsdir + len_name + 1 + lstrlenW( file->name ); if (!(filename = malloc( (len + 1) * sizeof(WCHAR) ))) goto done; lstrcpyW( filename, dirname ); - lstrcatW( filename, backslashW ); + lstrcatW( filename, L"\" ); lstrcatW( filename, file->name );
if (!DeleteFileW( filename )) WARN( "failed to delete file %lu\n", GetLastError() ); @@ -775,8 +759,8 @@ static HRESULT WINAPI cache_UninstallAssembly( hr = E_INVALIDARG; goto done; } - if (!wcscmp( type, win32W )) path = build_manifest_filename( arch, name, token, version ); - else if (!wcscmp( type, win32_policyW )) path = build_policy_filename( arch, name, token, version ); + if (!wcscmp( type, L"win32" )) path = build_manifest_filename( arch, name, token, version ); + else if (!wcscmp( type, L"win32-policy" )) path = build_policy_filename( arch, name, token, version ); else { hr = E_INVALIDARG; @@ -796,7 +780,7 @@ static HRESULT WINAPI cache_UninstallAssembly( *p = 0; RemoveDirectoryW( path ); } - if (!wcscmp( assembly->type, win32W )) hr = uninstall_assembly( assembly ); + if (!wcscmp( assembly->type, L"win32" )) hr = uninstall_assembly( assembly );
done: if (name_obj) IAssemblyName_Release( name_obj ); diff --git a/dlls/sxs/name.c b/dlls/sxs/name.c index 4772c7317c5..e9ae3ade33e 100644 --- a/dlls/sxs/name.c +++ b/dlls/sxs/name.c @@ -43,11 +43,6 @@ struct name WCHAR *version; };
-static const WCHAR archW[] = {'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 tokenW[] = {'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}; - static inline struct name *impl_from_IAssemblyName( IAssemblyName *iface ) { return CONTAINING_RECORD( iface, struct name, IAssemblyName_iface ); @@ -140,10 +135,10 @@ static HRESULT WINAPI name_GetDisplayName( if (!buflen || flags) return E_INVALIDARG;
len = lstrlenW( name->name ) + 1; - if (name->arch) len += lstrlenW( archW ) + lstrlenW( name->arch ) + 4; - if (name->token) len += lstrlenW( tokenW ) + lstrlenW( name->token ) + 4; - if (name->type) len += lstrlenW( typeW ) + lstrlenW( name->type ) + 4; - if (name->version) len += lstrlenW( versionW ) + lstrlenW( name->version ) + 4; + if (name->arch) len += lstrlenW( L"processorArchitecture" ) + lstrlenW( name->arch ) + 4; + if (name->token) len += lstrlenW( L"publicKeyToken" ) + lstrlenW( name->token ) + 4; + if (name->type) len += lstrlenW( L"type" ) + lstrlenW( name->type ) + 4; + if (name->version) len += lstrlenW( L"version" ) + lstrlenW( name->version ) + 4; if (len > *buflen) { *buflen = len; @@ -151,10 +146,10 @@ static HRESULT WINAPI name_GetDisplayName( } lstrcpyW( buffer, name->name ); len = lstrlenW( buffer ); - if (name->arch) len += swprintf( buffer + len, *buflen - len, fmtW, archW, name->arch ); - if (name->token) len += swprintf( buffer + len, *buflen - len, fmtW, tokenW, name->token ); - if (name->type) len += swprintf( buffer + len, *buflen - len, fmtW, typeW, name->type ); - if (name->version) len += swprintf( buffer + len, *buflen - len, fmtW, versionW, name->version ); + if (name->arch) len += swprintf( buffer + len, *buflen - len, fmtW, L"processorArchitecture", name->arch ); + if (name->token) len += swprintf( buffer + len, *buflen - len, fmtW, L"publicKeyToken", name->token ); + if (name->type) len += swprintf( buffer + len, *buflen - len, fmtW, L"type", name->type ); + if (name->version) len += swprintf( buffer + len, *buflen - len, fmtW, L"version", name->version ); return S_OK; }
@@ -325,25 +320,25 @@ static HRESULT parse_displayname( struct name *name, const WCHAR *displayname ) while (*q && *q != '=') q++; if (!*q) return E_INVALIDARG; len = q - p; - if (len == ARRAY_SIZE(archW) - 1 && !memcmp( p, archW, len * sizeof(WCHAR) )) + if (len == ARRAY_SIZE(L"processorArchitecture") - 1 && !memcmp( p, L"processorArchitecture", len * sizeof(WCHAR) )) { p = ++q; if (!(name->arch = parse_value( p, &len ))) return E_INVALIDARG; q += len; } - else if (len == ARRAY_SIZE(tokenW) - 1 && !memcmp( p, tokenW, len * sizeof(WCHAR) )) + else if (len == ARRAY_SIZE(L"publicKeyToken") - 1 && !memcmp( p, L"publicKeyToken", len * sizeof(WCHAR) )) { p = ++q; if (!(name->token = parse_value( p, &len ))) return E_INVALIDARG; q += len; } - else if (len == ARRAY_SIZE(typeW) - 1 && !memcmp( p, typeW, len * sizeof(WCHAR) )) + else if (len == ARRAY_SIZE(L"type") - 1 && !memcmp( p, L"type", len * sizeof(WCHAR) )) { p = ++q; if (!(name->type = parse_value( p, &len ))) return E_INVALIDARG; q += len; } - else if (len == ARRAY_SIZE(versionW) - 1 && !memcmp( p, versionW, len * sizeof(WCHAR) )) + else if (len == ARRAY_SIZE(L"version") - 1 && !memcmp( p, L"version", len * sizeof(WCHAR) )) { p = ++q; if (!(name->version = parse_value( p, &len ))) return E_INVALIDARG;
From: Hans Leidekker hans@codeweavers.com
--- dlls/sxs/tests/cache.c | 87 +++++++++++------------------------------- dlls/sxs/tests/name.c | 55 +++++++++----------------- 2 files changed, 39 insertions(+), 103 deletions(-)
diff --git a/dlls/sxs/tests/cache.c b/dlls/sxs/tests/cache.c index 1254d70b1f0..dc84aebc867 100644 --- a/dlls/sxs/tests/cache.c +++ b/dlls/sxs/tests/cache.c @@ -27,60 +27,8 @@
static void test_QueryAssemblyInfo( void ) { - static const WCHAR emptyW[] = {0}; - static const WCHAR wine1W[] = {'w','i','n','e',0}; - static const WCHAR wine2W[] = - {'w','i','n','e',',', - 'v','e','r','s','i','o','n','=','"','1','.','2','.','3','.','4','"',0}; - static const WCHAR wine3W[] = - {'w','i','n','e',',', - 'v','e','r','s','i','o','n','=','"','1','.','2','.','3','.','4','"',',', - 't','y','p','e','=','"','w','i','n','3','2','"',0}; - static const WCHAR wine4W[] = - {'w','i','n','e',',', - 'v','e','r','s','i','o','n','=','"','1','.','2','.','3','.','4','"',',', - 't','y','p','e','=','"','w','i','n','3','2','"',',', - 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=', - '"','x','8','6','"',0}; - static const WCHAR wine5W[] = - {'w','i','n','e',',', - 'v','e','r','s','i','o','n','=','"','1','.','2','.','3','.','4','"',',', - 't','y','p','e','=','"','w','i','n','3','2','"',',', - 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=', - '"','x','8','6','"',',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=', - '"','1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f','"',0}; - static const WCHAR comctl1W[] = - {'m','i','c','r','o','s','o','f','t','.','w','i','n','d','o','w','s','.', - 'c','o','m','m','o','n','-','c','o','n','t','r','o','l','s',',', - 'v','e','r','s','i','o','n','=','"','6','.','0','.','2','6','0','0','.','2','9','8','2','"',',', - 't','y','p','e','=','"','w','i','n','3','2','"',',', - 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=', - '"','x','8','6','"',',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=', - '"','6','5','9','5','b','6','4','1','4','4','c','c','f','1','d','f','"',0}; - static const WCHAR comctl2W[] = - {'m','i','c','r','o','s','o','f','t','.','w','i','n','d','o','w','s','.', - 'c','o','m','m','o','n','-','c','o','n','t','r','o','l','s',',', - 'v','e','r','s','i','o','n','=','"','6','.','0','.','3','7','9','0','.','4','7','7','0','"',',', - 't','y','p','e','=','"','w','i','n','3','2','"',',', - 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=', - '"','x','8','6','"',',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=', - '"','6','5','9','5','b','6','4','1','4','4','c','c','f','1','d','f','"',0}; - static const WCHAR comctl3W[] = - {'m','i','c','r','o','s','o','f','t','.','w','i','n','d','o','w','s','.', - 'c','o','m','m','o','n','-','c','o','n','t','r','o','l','s',',', - 'v','e','r','s','i','o','n','=','"','6','.','0','.','8','2','5','0','.','0','"',',', - 't','y','p','e','=','"','w','i','n','3','2','"',',', - 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=', - '"','x','8','6','"',',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=', - '"','6','5','9','5','b','6','4','1','4','4','c','c','f','1','d','f','"',0}; - static const WCHAR comctl4W[] = - {'m','i','c','r','o','s','o','f','t','.','w','i','n','d','o','w','s','.', - 'c','o','m','m','o','n','-','c','o','n','t','r','o','l','s',',', - 'v','e','r','s','i','o','n','=','"','6','.','0','.','7','6','0','1','.','1','7','5','1','4','"',',', - 't','y','p','e','=','"','w','i','n','3','2','"',',', - 'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=', - '"','x','8','6','"',',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=', - '"','6','5','9','5','b','6','4','1','4','4','c','c','f','1','d','f','"',0}; + static const WCHAR wineW[] = + L"wine,version="1.2.3.4",type="win32",processorArchitecture="x86",publicKeyToken="1234567890abcdef""; HRESULT hr; ASSEMBLY_INFO info; IAssemblyCache *cache = NULL; @@ -95,25 +43,26 @@ static void test_QueryAssemblyInfo( void ) hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, NULL, NULL ); ok( hr == E_INVALIDARG, "got %08lx\n", hr );
- hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, emptyW, NULL ); + hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"", NULL ); ok( hr == E_INVALIDARG, "got %08lx\n", hr );
- hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, wine1W, NULL ); + hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine", NULL ); ok( hr == HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE ) || broken(hr == E_INVALIDARG) /* winxp */, "got %08lx\n", hr );
- hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, wine2W, NULL ); + hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine,version="1.2.3.4"", NULL ); ok( hr == HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE ) || broken(hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND )) /* winxp */, "got %08lx\n", hr );
- hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, wine3W, NULL ); + hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine,version="1.2.3.4",type="win32"", NULL ); ok( hr == HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE ) || broken(hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND )) /* winxp */, "got %08lx\n", hr );
- hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, wine4W, NULL ); + hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine,version="1.2.3.4",type="win32",processorArchitecture="x86"", + NULL ); todo_wine ok( hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND ), "got %08lx\n", hr );
- hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, wine5W, NULL ); + hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, wineW, NULL ); todo_wine ok( hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND ), "got %08lx\n", hr );
GetWindowsDirectoryA( comctl_path1, MAX_PATH ); @@ -124,10 +73,18 @@ static void test_QueryAssemblyInfo( void ) lstrcatA( comctl_path3, "\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.8250.0_none_c119e7cca62b92bd" ); GetWindowsDirectoryA( comctl_path4, MAX_PATH ); lstrcatA( comctl_path4, "\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2" ); - if (GetFileAttributesA( comctl_path1 ) != INVALID_FILE_ATTRIBUTES) comctlW = comctl1W; - else if (GetFileAttributesA( comctl_path2 ) != INVALID_FILE_ATTRIBUTES) comctlW = comctl2W; - else if (GetFileAttributesA( comctl_path3 ) != INVALID_FILE_ATTRIBUTES) comctlW = comctl3W; - else if (GetFileAttributesA( comctl_path4 ) != INVALID_FILE_ATTRIBUTES) comctlW = comctl4W; + if (GetFileAttributesA( comctl_path1 ) != INVALID_FILE_ATTRIBUTES) + comctlW = L"microsoft.windows.common-controls,version="6.0.2600.2982",type="win32",processorArchitecture="x86"," + "publicKeyToken="6595b64144ccf1df""; + else if (GetFileAttributesA( comctl_path2 ) != INVALID_FILE_ATTRIBUTES) + comctlW = L"microsoft.windows.common-controls,version="6.0.3790.4770",type="win32",processorArchitecture="x86"," + "publicKeyToken="6595b64144ccf1df""; + else if (GetFileAttributesA( comctl_path3 ) != INVALID_FILE_ATTRIBUTES) + comctlW = L"microsoft.windows.common-controls,version="6.0.8250.0",type="win32",processorArchitecture="x86"," + "publicKeyToken="6595b64144ccf1df""; + else if (GetFileAttributesA( comctl_path4 ) != INVALID_FILE_ATTRIBUTES) + comctlW = L"microsoft.windows.common-controls,version="6.0.7601.17514",type="win32",processorArchitecture="x86"," + "publicKeyToken="6595b64144ccf1df""; else { skip( "no assembly to test with\n" ); @@ -140,7 +97,7 @@ static void test_QueryAssemblyInfo( void )
memset( &info, 0, sizeof(info) ); info.cbAssemblyInfo = sizeof(info); - hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, wine5W, &info ); + hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, wineW, &info ); todo_wine ok( hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND ), "got %08lx\n", hr );
memset( &info, 0, sizeof(info) ); diff --git a/dlls/sxs/tests/name.c b/dlls/sxs/tests/name.c index 0f825f55428..53f41a3d4c6 100644 --- a/dlls/sxs/tests/name.c +++ b/dlls/sxs/tests/name.c @@ -26,34 +26,13 @@
#include "wine/test.h"
-static const WCHAR wine1W[] = - {'w','i','n','e',0}; -static const WCHAR wine2W[] = - {'w','i','n','e',',','v','e','r','s','i','o','n','=','"','1','.','2','.','3','.','4','"',0}; -static const WCHAR wine3W[] = - {'w','i','n','e',',','v','e','r','s','i','o','n','=','1','.','2','.','3','.','4',0}; -static const WCHAR wine4W[] = - {'w','i','n','e',',',' ','v','e','r','s','i','o','n','=','"','1','.','2','.','3','.','4','"',0}; -static const WCHAR wine5W[] = - {'w','i','n','e',',','v','e','r','s','i','o','n',' ','=','"','1','.','2','.','3','.','4','"',0}; -static const WCHAR wine6W[] = - {'w','i','n','e',',','v','e','r','s','i','o','n','=',' ','"','1','.','2','.','3','.','4','"',0}; -static const WCHAR wine7W[] = - {'w','i','n','e',' ',',','v','e','r','s','i','o','n','=','"','1','.','2','.','3','.','4','"',0}; -static const WCHAR wine8W[] = - {'w','i','n','e',',','v','e','r','s','i','o','n',0}; -static const WCHAR wine9W[] = - {'w','i','n','e',',','t','y','p','e','=','"','"',0}; -static const WCHAR wine10W[] = - {'w','i','n','e',',','t','y','p','e','=','"','w','i','n','3','2',0}; - static void test_CreateAssemblyNameObject( void ) { static const WCHAR emptyW[] = {0}; IAssemblyName *name; HRESULT hr;
- hr = CreateAssemblyNameObject( NULL, wine1W, CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( NULL, L"wine", CANOF_PARSE_DISPLAY_NAME, NULL ); ok(hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr);
name = (IAssemblyName *)0xdeadbeef; @@ -77,12 +56,12 @@ static void test_CreateAssemblyNameObject( void ) ok( !name, "expected NULL got %p\n", name );
name = NULL; - hr = CreateAssemblyNameObject( &name, wine1W, CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine", CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == S_OK, "expected S_OK got %08lx\n", hr ); ok( name != NULL, "expected non-NULL name\n" ); IAssemblyName_Release( name );
- hr = CreateAssemblyNameObject( NULL, wine1W, CANOF_SET_DEFAULT_VALUES, NULL ); + hr = CreateAssemblyNameObject( NULL, L"wine", CANOF_SET_DEFAULT_VALUES, NULL ); ok( hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr );
name = (IAssemblyName *)0xdeadbeef; @@ -106,11 +85,11 @@ static void test_CreateAssemblyNameObject( void ) ok( !name, "expected NULL got %p\n", name );
name = (IAssemblyName *)0xdeadbeef; - hr = CreateAssemblyNameObject( &name, wine1W, CANOF_SET_DEFAULT_VALUES, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine", CANOF_SET_DEFAULT_VALUES, NULL ); ok( hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr ); ok( !name, "expected NULL got %p\n", name );
- hr = CreateAssemblyNameObject( NULL, wine1W, 0, NULL ); + hr = CreateAssemblyNameObject( NULL, L"wine", 0, NULL ); ok( hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr );
name = (IAssemblyName *)0xdeadbeef; @@ -134,10 +113,10 @@ static void test_CreateAssemblyNameObject( void ) ok( !name, "expected NULL got %p\n", name );
name = (IAssemblyName *)0xdeadbeef; - hr = CreateAssemblyNameObject( &name, wine1W, 0, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine", 0, NULL ); ok( hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr );
- hr = CreateAssemblyNameObject( NULL, wine1W, CANOF_SET_DEFAULT_VALUES|CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( NULL, L"wine", CANOF_SET_DEFAULT_VALUES|CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr );
name = (IAssemblyName *)0xdeadbeef; @@ -161,57 +140,57 @@ static void test_CreateAssemblyNameObject( void ) ok( !name, "expected NULL got %p\n", name );
name = (IAssemblyName *)0xdeadbeef; - hr = CreateAssemblyNameObject( &name, wine1W, CANOF_SET_DEFAULT_VALUES|CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine", CANOF_SET_DEFAULT_VALUES|CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr ); ok( !name, "expected NULL got %p\n", name );
name = NULL; - hr = CreateAssemblyNameObject( &name, wine2W, CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine,version="1.2.3.4"", CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == S_OK, "expected S_OK got %08lx\n", hr ); ok( name != NULL, "expected non-NULL name\n" ); IAssemblyName_Release( name );
name = (IAssemblyName *)0xdeadbeef; - hr = CreateAssemblyNameObject( &name, wine3W, CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine,version=1.2.3.4", CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr ); ok( !name, "expected NULL got %p\n", name );
name = (IAssemblyName *)0xdeadbeef; - hr = CreateAssemblyNameObject( &name, wine4W, CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine, version="1.2.3.4"", CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == HRESULT_FROM_WIN32( ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME ), "expected ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME got %08lx\n", hr ); ok( !name, "expected NULL got %p\n", name );
name = (IAssemblyName *)0xdeadbeef; - hr = CreateAssemblyNameObject( &name, wine5W, CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine,version ="1.2.3.4"", CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == HRESULT_FROM_WIN32( ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME ), "expected ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME got %08lx\n", hr ); ok( !name, "expected NULL got %p\n", name );
name = (IAssemblyName *)0xdeadbeef; - hr = CreateAssemblyNameObject( &name, wine6W, CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine,version= "1.2.3.4"", CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr ); ok( !name, "expected NULL got %p\n", name );
name = NULL; - hr = CreateAssemblyNameObject( &name, wine7W, CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine ,version="1.2.3.4"", CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == S_OK, "expected S_OK got %08lx\n", hr ); ok( name != NULL, "expected non-NULL name\n" ); IAssemblyName_Release( name );
name = (IAssemblyName *)0xdeadbeef; - hr = CreateAssemblyNameObject( &name, wine8W, CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine,version", CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr ); ok( !name, "expected NULL got %p\n", name );
name = NULL; - hr = CreateAssemblyNameObject( &name, wine9W, CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine,type=""", CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == S_OK, "expected S_OK got %08lx\n", hr ); ok( name != NULL, "expected non-NULL name\n" ); IAssemblyName_Release( name );
name = (IAssemblyName *)0xdeadbeef; - hr = CreateAssemblyNameObject( &name, wine10W, CANOF_PARSE_DISPLAY_NAME, NULL ); + hr = CreateAssemblyNameObject( &name, L"wine,type="win32", CANOF_PARSE_DISPLAY_NAME, NULL ); ok( hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr ); ok( !name, "expected NULL got %p\n", name ); }
From: Hans Leidekker hans@codeweavers.com
--- dlls/sxs/tests/cache.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/dlls/sxs/tests/cache.c b/dlls/sxs/tests/cache.c index dc84aebc867..6c3869e7b58 100644 --- a/dlls/sxs/tests/cache.c +++ b/dlls/sxs/tests/cache.c @@ -47,16 +47,13 @@ static void test_QueryAssemblyInfo( void ) ok( hr == E_INVALIDARG, "got %08lx\n", hr );
hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine", NULL ); - ok( hr == HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE ) || - broken(hr == E_INVALIDARG) /* winxp */, "got %08lx\n", hr ); + ok( hr == HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE ), "got %08lx\n", hr );
hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine,version="1.2.3.4"", NULL ); - ok( hr == HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE ) || - broken(hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND )) /* winxp */, "got %08lx\n", hr ); + ok( hr == HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE ), "got %08lx\n", hr );
hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine,version="1.2.3.4",type="win32"", NULL ); - ok( hr == HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE ) || - broken(hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND )) /* winxp */, "got %08lx\n", hr ); + ok( hr == HRESULT_FROM_WIN32( ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE ), "got %08lx\n", hr );
hr = IAssemblyCache_QueryAssemblyInfo( cache, 0, L"wine,version="1.2.3.4",type="win32",processorArchitecture="x86"", NULL );
From: Hans Leidekker hans@codeweavers.com
--- dlls/sxs/tests/cache.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/dlls/sxs/tests/cache.c b/dlls/sxs/tests/cache.c index 6c3869e7b58..c3b9df86518 100644 --- a/dlls/sxs/tests/cache.c +++ b/dlls/sxs/tests/cache.c @@ -33,7 +33,7 @@ static void test_QueryAssemblyInfo( void ) ASSEMBLY_INFO info; IAssemblyCache *cache = NULL; WCHAR path[MAX_PATH]; - char comctl_path1[MAX_PATH], comctl_path2[MAX_PATH], comctl_path3[MAX_PATH], comctl_path4[MAX_PATH]; + char comctl_path1[MAX_PATH], comctl_path2[MAX_PATH]; const WCHAR *comctlW;
hr = CreateAssemblyCache( &cache, 0 ); @@ -65,22 +65,12 @@ static void test_QueryAssemblyInfo( void ) GetWindowsDirectoryA( comctl_path1, MAX_PATH ); lstrcatA( comctl_path1, "\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef" ); GetWindowsDirectoryA( comctl_path2, MAX_PATH ); - lstrcatA( comctl_path2, "\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.3790.4770_x-ww_05fdf087" ); - GetWindowsDirectoryA( comctl_path3, MAX_PATH ); - lstrcatA( comctl_path3, "\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.8250.0_none_c119e7cca62b92bd" ); - GetWindowsDirectoryA( comctl_path4, MAX_PATH ); - lstrcatA( comctl_path4, "\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2" ); + lstrcatA( comctl_path2, "\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.3636_none_a863d714867441db" ); if (GetFileAttributesA( comctl_path1 ) != INVALID_FILE_ATTRIBUTES) comctlW = L"microsoft.windows.common-controls,version="6.0.2600.2982",type="win32",processorArchitecture="x86"," "publicKeyToken="6595b64144ccf1df""; else if (GetFileAttributesA( comctl_path2 ) != INVALID_FILE_ATTRIBUTES) - comctlW = L"microsoft.windows.common-controls,version="6.0.3790.4770",type="win32",processorArchitecture="x86"," - "publicKeyToken="6595b64144ccf1df""; - else if (GetFileAttributesA( comctl_path3 ) != INVALID_FILE_ATTRIBUTES) - comctlW = L"microsoft.windows.common-controls,version="6.0.8250.0",type="win32",processorArchitecture="x86"," - "publicKeyToken="6595b64144ccf1df""; - else if (GetFileAttributesA( comctl_path4 ) != INVALID_FILE_ATTRIBUTES) - comctlW = L"microsoft.windows.common-controls,version="6.0.7601.17514",type="win32",processorArchitecture="x86"," + comctlW = L"microsoft.windows.common-controls,version="6.0.19041.3636",type="win32",processorArchitecture="x86"," "publicKeyToken="6595b64144ccf1df""; else {
From: Hans Leidekker hans@codeweavers.com
--- dlls/sxs/cache.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/dlls/sxs/cache.c b/dlls/sxs/cache.c index f9ecc454550..7dd5b067573 100644 --- a/dlls/sxs/cache.c +++ b/dlls/sxs/cache.c @@ -598,6 +598,13 @@ static HRESULT install_assembly( const WCHAR *manifest, struct assembly *assembl dst = build_manifest_filename( assembly->arch, assembly->name, assembly->token, assembly->version ); if (!dst) return E_OUTOFMEMORY;
+ if (GetFileAttributesW( dst ) != INVALID_FILE_ATTRIBUTES) + { + free( dst ); + TRACE("manifest exists, skipping install\n"); + return S_OK; + } + ret = CopyFileW( manifest, dst, FALSE ); free( dst ); if (!ret)