Author: cwittich Date: Mon Dec 27 09:50:02 2010 New Revision: 50156
URL: http://svn.reactos.org/svn/reactos?rev=50156&view=rev Log: [FUSION] sync to wine 1.3.10
Modified: trunk/reactos/dll/win32/fusion/asmcache.c trunk/reactos/dll/win32/fusion/asmenum.c trunk/reactos/dll/win32/fusion/asmname.c trunk/reactos/dll/win32/fusion/assembly.c trunk/reactos/dll/win32/fusion/fusion.rbuild trunk/reactos/dll/win32/fusion/fusionpriv.h
Modified: trunk/reactos/dll/win32/fusion/asmcache.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/asmcache.c... ============================================================================== --- trunk/reactos/dll/win32/fusion/asmcache.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/asmcache.c [iso-8859-1] Mon Dec 27 09:50:02 2010 @@ -123,15 +123,20 @@ /* IAssemblyCache */
typedef struct { - const IAssemblyCacheVtbl *lpIAssemblyCacheVtbl; + IAssemblyCache IAssemblyCache_iface;
LONG ref; } IAssemblyCacheImpl;
+static inline IAssemblyCacheImpl *impl_from_IAssemblyCache(IAssemblyCache *iface) +{ + return CONTAINING_RECORD(iface, IAssemblyCacheImpl, IAssemblyCache_iface); +} + static HRESULT WINAPI IAssemblyCacheImpl_QueryInterface(IAssemblyCache *iface, REFIID riid, LPVOID *ppobj) { - IAssemblyCacheImpl *This = (IAssemblyCacheImpl *)iface; + IAssemblyCacheImpl *This = impl_from_IAssemblyCache(iface);
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
@@ -151,7 +156,7 @@
static ULONG WINAPI IAssemblyCacheImpl_AddRef(IAssemblyCache *iface) { - IAssemblyCacheImpl *This = (IAssemblyCacheImpl *)iface; + IAssemblyCacheImpl *This = impl_from_IAssemblyCache(iface); ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before = %u)\n", This, refCount - 1); @@ -161,7 +166,7 @@
static ULONG WINAPI IAssemblyCacheImpl_Release(IAssemblyCache *iface) { - IAssemblyCacheImpl *This = (IAssemblyCacheImpl *)iface; + IAssemblyCacheImpl *This = impl_from_IAssemblyCache(iface); ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before = %u)\n", This, refCount + 1); @@ -222,6 +227,8 @@
if (!pAsmInfo) goto done; + + hr = IAssemblyName_GetPath(next, pAsmInfo->pszCurrentAssemblyPathBuf, &pAsmInfo->cchBuf);
pAsmInfo->dwAssemblyFlags = ASSEMBLYINFO_FLAG_INSTALLED;
@@ -362,10 +369,10 @@ if (!cache) return E_OUTOFMEMORY;
- cache->lpIAssemblyCacheVtbl = &AssemblyCacheVtbl; + cache->IAssemblyCache_iface.lpVtbl = &AssemblyCacheVtbl; cache->ref = 1;
- *ppAsmCache = (IAssemblyCache *)cache; + *ppAsmCache = &cache->IAssemblyCache_iface;
return S_OK; } @@ -373,15 +380,20 @@ /* IAssemblyCacheItem */
typedef struct { - const IAssemblyCacheItemVtbl *lpIAssemblyCacheItemVtbl; + IAssemblyCacheItem IAssemblyCacheItem_iface;
LONG ref; } IAssemblyCacheItemImpl;
+static inline IAssemblyCacheItemImpl *impl_from_IAssemblyCacheItem(IAssemblyCacheItem *iface) +{ + return CONTAINING_RECORD(iface, IAssemblyCacheItemImpl, IAssemblyCacheItem_iface); +} + static HRESULT WINAPI IAssemblyCacheItemImpl_QueryInterface(IAssemblyCacheItem *iface, REFIID riid, LPVOID *ppobj) { - IAssemblyCacheItemImpl *This = (IAssemblyCacheItemImpl *)iface; + IAssemblyCacheItemImpl *This = impl_from_IAssemblyCacheItem(iface);
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
@@ -401,7 +413,7 @@
static ULONG WINAPI IAssemblyCacheItemImpl_AddRef(IAssemblyCacheItem *iface) { - IAssemblyCacheItemImpl *This = (IAssemblyCacheItemImpl *)iface; + IAssemblyCacheItemImpl *This = impl_from_IAssemblyCacheItem(iface); ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before = %u)\n", This, refCount - 1); @@ -411,7 +423,7 @@
static ULONG WINAPI IAssemblyCacheItemImpl_Release(IAssemblyCacheItem *iface) { - IAssemblyCacheItemImpl *This = (IAssemblyCacheItemImpl *)iface; + IAssemblyCacheItemImpl *This = impl_from_IAssemblyCacheItem(iface); ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before = %u)\n", This, refCount + 1);
Modified: trunk/reactos/dll/win32/fusion/asmenum.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/asmenum.c?... ============================================================================== --- trunk/reactos/dll/win32/fusion/asmenum.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/asmenum.c [iso-8859-1] Mon Dec 27 09:50:02 2010 @@ -45,17 +45,22 @@
typedef struct { - const IAssemblyEnumVtbl *lpIAssemblyEnumVtbl; + IAssemblyEnum IAssemblyEnum_iface;
struct list assemblies; struct list *iter; LONG ref; } IAssemblyEnumImpl;
+static inline IAssemblyEnumImpl *impl_from_IAssemblyEnum(IAssemblyEnum *iface) +{ + return CONTAINING_RECORD(iface, IAssemblyEnumImpl, IAssemblyEnum_iface); +} + static HRESULT WINAPI IAssemblyEnumImpl_QueryInterface(IAssemblyEnum *iface, REFIID riid, LPVOID *ppobj) { - IAssemblyEnumImpl *This = (IAssemblyEnumImpl *)iface; + IAssemblyEnumImpl *This = impl_from_IAssemblyEnum(iface);
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
@@ -75,7 +80,7 @@
static ULONG WINAPI IAssemblyEnumImpl_AddRef(IAssemblyEnum *iface) { - IAssemblyEnumImpl *This = (IAssemblyEnumImpl *)iface; + IAssemblyEnumImpl *This = impl_from_IAssemblyEnum(iface); ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before = %u)\n", This, refCount - 1); @@ -85,7 +90,7 @@
static ULONG WINAPI IAssemblyEnumImpl_Release(IAssemblyEnum *iface) { - IAssemblyEnumImpl *This = (IAssemblyEnumImpl *)iface; + IAssemblyEnumImpl *This = impl_from_IAssemblyEnum(iface); ULONG refCount = InterlockedDecrement(&This->ref); struct list *item, *cursor;
@@ -113,7 +118,7 @@ IAssemblyName **ppName, DWORD dwFlags) { - IAssemblyEnumImpl *asmenum = (IAssemblyEnumImpl *)iface; + IAssemblyEnumImpl *asmenum = impl_from_IAssemblyEnum(iface); ASMNAME *asmname;
TRACE("(%p, %p, %p, %d)\n", iface, pvReserved, ppName, dwFlags); @@ -135,7 +140,7 @@
static HRESULT WINAPI IAssemblyEnumImpl_Reset(IAssemblyEnum *iface) { - IAssemblyEnumImpl *asmenum = (IAssemblyEnumImpl *)iface; + IAssemblyEnumImpl *asmenum = impl_from_IAssemblyEnum(iface);
TRACE("(%p)\n", iface);
@@ -287,6 +292,7 @@ WIN32_FIND_DATAW ffd; WCHAR buf[MAX_PATH]; WCHAR disp[MAX_PATH]; + WCHAR asmpath[MAX_PATH]; ASMNAME *asmname; HANDLE hfind; LPWSTR ptr; @@ -297,9 +303,9 @@ static const WCHAR dot[] = {'.',0}; static const WCHAR dotdot[] = {'.','.',0}; static const WCHAR search_fmt[] = {'%','s','\','*',0}; - static const WCHAR parent_fmt[] = {'%','s',',',' ',0}; static const WCHAR dblunder[] = {'_','_',0}; - static const WCHAR fmt[] = {'V','e','r','s','i','o','n','=','%','s',',',' ', + static const WCHAR path_fmt[] = {'%','s','\','%','s','\','%','s','.','d','l','l',0}; + static const WCHAR fmt[] = {'%','s',',',' ','V','e','r','s','i','o','n','=','%','s',',',' ', 'C','u','l','t','u','r','e','=','n','e','u','t','r','a','l',',',' ', 'P','u','b','l','i','c','K','e','y','T','o','k','e','n','=','%','s',0}; static const WCHAR ss_fmt[] = {'%','s','\','%','s',0}; @@ -325,17 +331,17 @@ else ptr = ffd.cFileName;
- sprintfW(parent, parent_fmt, ptr); + lstrcpyW(parent, ptr); } else if (depth == 1) { + sprintfW(asmpath, path_fmt, path, ffd.cFileName, parent); + ptr = strstrW(ffd.cFileName, dblunder); *ptr = '\0'; ptr += 2; - sprintfW(buf, fmt, ffd.cFileName, ptr); - - lstrcpyW(disp, parent); - lstrcatW(disp, buf); + + sprintfW(disp, fmt, parent, ffd.cFileName, ptr);
asmname = HeapAlloc(GetProcessHeap(), 0, sizeof(ASMNAME)); if (!asmname) @@ -352,6 +358,14 @@ break; }
+ hr = IAssemblyName_SetPath(asmname->name, asmpath); + if (FAILED(hr)) + { + IAssemblyName_Release(asmname->name); + HeapFree(GetProcessHeap(), 0, asmname); + break; + } + insert_assembly(assemblies, asmname); continue; } @@ -422,7 +436,7 @@ if (!asmenum) return E_OUTOFMEMORY;
- asmenum->lpIAssemblyEnumVtbl = &AssemblyEnumVtbl; + asmenum->IAssemblyEnum_iface.lpVtbl = &AssemblyEnumVtbl; asmenum->ref = 1; list_init(&asmenum->assemblies);
@@ -437,7 +451,7 @@ }
asmenum->iter = list_head(&asmenum->assemblies); - *pEnum = (IAssemblyEnum *)asmenum; + *pEnum = &asmenum->IAssemblyEnum_iface;
return S_OK; }
Modified: trunk/reactos/dll/win32/fusion/asmname.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/asmname.c?... ============================================================================== --- trunk/reactos/dll/win32/fusion/asmname.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/asmname.c [iso-8859-1] Mon Dec 27 09:50:02 2010 @@ -19,6 +19,7 @@ */
#include <stdarg.h> +#include <assert.h>
#define COBJMACROS #define INITGUID @@ -40,6 +41,8 @@ typedef struct { const IAssemblyNameVtbl *lpIAssemblyNameVtbl;
+ LPWSTR path; + LPWSTR displayname; LPWSTR name; LPWSTR culture; @@ -104,6 +107,7 @@
if (!refCount) { + HeapFree(GetProcessHeap(), 0, This->path); HeapFree(GetProcessHeap(), 0, This->displayname); HeapFree(GetProcessHeap(), 0, This->name); HeapFree(GetProcessHeap(), 0, This->culture); @@ -425,6 +429,43 @@ IAssemblyNameImpl_Clone };
+/* Internal methods */ +HRESULT IAssemblyName_SetPath(IAssemblyName *iface, LPCWSTR path) +{ + IAssemblyNameImpl *name = (IAssemblyNameImpl *)iface; + + assert(name->lpIAssemblyNameVtbl == &AssemblyNameVtbl); + + name->path = strdupW(path); + if (!name->path) + return E_OUTOFMEMORY; + + return S_OK; +} + +HRESULT IAssemblyName_GetPath(IAssemblyName *iface, LPWSTR buf, ULONG *len) +{ + ULONG buffer_size = *len; + IAssemblyNameImpl *name = (IAssemblyNameImpl *)iface; + + assert(name->lpIAssemblyNameVtbl == &AssemblyNameVtbl); + + if (!name->path) + return S_OK; + + if (!buf) + buffer_size = 0; + + *len = lstrlenW(name->path) + 1; + + if (*len <= buffer_size) + lstrcpyW(buf, name->path); + else + return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + + return S_OK; +} + static HRESULT parse_version(IAssemblyNameImpl *name, LPWSTR version) { LPWSTR beg, end; @@ -450,7 +491,7 @@ return S_OK; }
-static HRESULT parse_culture(IAssemblyNameImpl *name, LPWSTR culture) +static HRESULT parse_culture(IAssemblyNameImpl *name, LPCWSTR culture) { static const WCHAR empty[] = {0};
@@ -480,7 +521,7 @@ return 0; }
-static HRESULT parse_pubkey(IAssemblyNameImpl *name, LPWSTR pubkey) +static HRESULT parse_pubkey(IAssemblyNameImpl *name, LPCWSTR pubkey) { int i; BYTE val; @@ -522,8 +563,16 @@ if (!str) return E_OUTOFMEMORY;
- ptr = strstrW(str, separator); + ptr = strchrW(str, ','); if (ptr) *ptr = '\0'; + + /* no ',' but ' ' only */ + if( !ptr && strchrW(str, ' ') ) + { + hr = FUSION_E_INVALID_NAME; + goto done; + } + name->name = strdupW(str); if (!name->name) return E_OUTOFMEMORY;
Modified: trunk/reactos/dll/win32/fusion/assembly.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/assembly.c... ============================================================================== --- trunk/reactos/dll/win32/fusion/assembly.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/assembly.c [iso-8859-1] Mon Dec 27 09:50:02 2010 @@ -146,7 +146,7 @@ #define MAX_TABLES_3BIT_ENCODE 8191 #define MAX_TABLES_5BIT_ENCODE 2047
-static inline ULONG get_table_size(ASSEMBLY *assembly, DWORD index) +static inline ULONG get_table_size(const ASSEMBLY *assembly, DWORD index) { DWORD size; INT tables; @@ -731,11 +731,11 @@ return S_OK; }
-static LPWSTR assembly_dup_str(ASSEMBLY *assembly, DWORD index) +static LPWSTR assembly_dup_str(const ASSEMBLY *assembly, DWORD index) { int len; LPWSTR cpy; - LPSTR str = (LPSTR)&assembly->strings[index]; + LPCSTR str = (LPCSTR)&assembly->strings[index];
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
@@ -772,7 +772,7 @@ return S_OK; }
-HRESULT assembly_get_path(ASSEMBLY *assembly, LPWSTR *path) +HRESULT assembly_get_path(const ASSEMBLY *assembly, LPWSTR *path) { LPWSTR cpy = HeapAlloc(GetProcessHeap(), 0, (strlenW(assembly->path) + 1) * sizeof(WCHAR)); *path = cpy;
Modified: trunk/reactos/dll/win32/fusion/fusion.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/fusion.rbu... ============================================================================== --- trunk/reactos/dll/win32/fusion/fusion.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/fusion.rbuild [iso-8859-1] Mon Dec 27 09:50:02 2010 @@ -8,6 +8,7 @@ <library>shlwapi</library> <library>advapi32</library> <library>dbghelp</library> + <library>msvcrt</library> <library>user32</library> <file>asmcache.c</file> <file>asmenum.c</file>
Modified: trunk/reactos/dll/win32/fusion/fusionpriv.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/fusionpriv... ============================================================================== --- trunk/reactos/dll/win32/fusion/fusionpriv.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/fusionpriv.h [iso-8859-1] Mon Dec 27 09:50:02 2010 @@ -431,10 +431,13 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file); HRESULT assembly_release(ASSEMBLY *assembly); HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name); -HRESULT assembly_get_path(ASSEMBLY *assembly, LPWSTR *path); +HRESULT assembly_get_path(const ASSEMBLY *assembly, LPWSTR *path); HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version); BYTE assembly_get_architecture(ASSEMBLY *assembly); HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token); + +extern HRESULT IAssemblyName_SetPath(IAssemblyName *iface, LPCWSTR path); +extern HRESULT IAssemblyName_GetPath(IAssemblyName *iface, LPWSTR buf, ULONG *len);
static inline LPWSTR strdupW(LPCWSTR src) {