https://git.reactos.org/?p=reactos.git;a=commitdiff;h=975d9d4d4c5644dd66f6d…
commit 975d9d4d4c5644dd66f6df337049607494f38a2f
Author: Amine Khaldi <amine.khaldi(a)reactos.org>
AuthorDate: Fri Jan 19 00:10:53 2018 +0100
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Fri Jan 19 00:10:53 2018 +0100
[FUSION] Sync with Wine 3.0. CORE-14225
---
dll/win32/fusion/asmname.c | 89 +++++++++++++++++++++++++++++++++++++++-------
dll/win32/fusion/fusion.c | 2 +-
media/doc/README.WINE | 2 +-
3 files changed, 79 insertions(+), 14 deletions(-)
diff --git a/dll/win32/fusion/asmname.c b/dll/win32/fusion/asmname.c
index 3fc54d28b1..79a99f5bc0 100644
--- a/dll/win32/fusion/asmname.c
+++ b/dll/win32/fusion/asmname.c
@@ -22,6 +22,7 @@
#include <assert.h>
#include <winuser.h>
+#include <strsafe.h>
typedef struct {
IAssemblyName IAssemblyName_iface;
@@ -39,6 +40,8 @@ typedef struct {
BYTE pubkey[8];
BOOL haspubkey;
+ PEKIND pekind;
+
LONG ref;
} IAssemblyNameImpl;
@@ -123,11 +126,11 @@ static HRESULT WINAPI IAssemblyNameImpl_GetProperty(IAssemblyName
*iface,
LPDWORD pcbProperty)
{
IAssemblyNameImpl *name = impl_from_IAssemblyName(iface);
+ DWORD size;
TRACE("(%p, %d, %p, %p)\n", iface, PropertyId, pvProperty, pcbProperty);
- *((LPWSTR)pvProperty) = '\0';
-
+ size = *pcbProperty;
switch (PropertyId)
{
case ASM_NAME_NULL_PUBLIC_KEY:
@@ -143,45 +146,65 @@ static HRESULT WINAPI IAssemblyNameImpl_GetProperty(IAssemblyName
*iface,
*pcbProperty = 0;
if (name->name)
{
- lstrcpyW(pvProperty, name->name);
*pcbProperty = (lstrlenW(name->name) + 1) * 2;
+ if (size < *pcbProperty)
+ return STRSAFE_E_INSUFFICIENT_BUFFER;
+ lstrcpyW(pvProperty, name->name);
}
break;
case ASM_NAME_MAJOR_VERSION:
*pcbProperty = 0;
- *((WORD *)pvProperty) = name->version[0];
if (name->versize >= 1)
+ {
*pcbProperty = sizeof(WORD);
+ if (size < *pcbProperty)
+ return STRSAFE_E_INSUFFICIENT_BUFFER;
+ *((WORD *)pvProperty) = name->version[0];
+ }
break;
case ASM_NAME_MINOR_VERSION:
*pcbProperty = 0;
- *((WORD *)pvProperty) = name->version[1];
if (name->versize >= 2)
+ {
*pcbProperty = sizeof(WORD);
+ if (size < *pcbProperty)
+ return STRSAFE_E_INSUFFICIENT_BUFFER;
+ *((WORD *)pvProperty) = name->version[1];
+ }
break;
case ASM_NAME_BUILD_NUMBER:
*pcbProperty = 0;
- *((WORD *)pvProperty) = name->version[2];
if (name->versize >= 3)
+ {
*pcbProperty = sizeof(WORD);
+ if (size < *pcbProperty)
+ return STRSAFE_E_INSUFFICIENT_BUFFER;
+ *((WORD *)pvProperty) = name->version[2];
+ }
break;
case ASM_NAME_REVISION_NUMBER:
*pcbProperty = 0;
- *((WORD *)pvProperty) = name->version[3];
if (name->versize >= 4)
+ {
*pcbProperty = sizeof(WORD);
+ if (size < *pcbProperty)
+ return STRSAFE_E_INSUFFICIENT_BUFFER;
+ *((WORD *)pvProperty) = name->version[3];
+ }
break;
case ASM_NAME_CULTURE:
*pcbProperty = 0;
if (name->culture)
{
- lstrcpyW(pvProperty, name->culture);
*pcbProperty = (lstrlenW(name->culture) + 1) * 2;
+ if (size < *pcbProperty)
+ return STRSAFE_E_INSUFFICIENT_BUFFER;
+ lstrcpyW(pvProperty, name->culture);
}
break;
@@ -189,8 +212,21 @@ static HRESULT WINAPI IAssemblyNameImpl_GetProperty(IAssemblyName
*iface,
*pcbProperty = 0;
if (name->haspubkey)
{
- memcpy(pvProperty, name->pubkey, sizeof(DWORD) * 2);
*pcbProperty = sizeof(DWORD) * 2;
+ if (size < *pcbProperty)
+ return STRSAFE_E_INSUFFICIENT_BUFFER;
+ memcpy(pvProperty, name->pubkey, sizeof(DWORD) * 2);
+ }
+ break;
+
+ case ASM_NAME_ARCHITECTURE:
+ *pcbProperty = 0;
+ if (name->pekind != peNone)
+ {
+ *pcbProperty = sizeof(PEKIND);
+ if (size < *pcbProperty)
+ return STRSAFE_E_INSUFFICIENT_BUFFER;
+ *((PEKIND *)pvProperty) = name->pekind;
}
break;
@@ -281,7 +317,10 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName
*iface,
size += lstrlenW(separator) + lstrlenW(procarch) + lstrlenW(equals) +
lstrlenW(name->procarch);
if (size > *pccDisplayName)
- return S_FALSE;
+ {
+ *pccDisplayName = size;
+ return E_NOT_SUFFICIENT_BUFFER;
+ }
/* Construct the string */
lstrcpyW(szDisplayName, name->name);
@@ -307,8 +346,8 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName
*iface,
if ((dwDisplayFlags & ASM_DISPLAYF_PUBLIC_KEY_TOKEN) &&
(name->haspubkey))
{
WCHAR pkt[CHARS_PER_PUBKEY + 1];
- static const WCHAR spec[] =
{'%','0','x','%','0','x','%','0','x',
-
'%','0','x','%','0','x','%','0','x','%','0','x','%','0','x',0};
+ static const WCHAR spec[] =
{'%','0','2','x','%','0','2','x','%','0','2','x',
+
'%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x',0};
lstrcatW(szDisplayName, separator);
@@ -578,6 +617,30 @@ static HRESULT parse_pubkey(IAssemblyNameImpl *name, LPCWSTR pubkey)
return S_OK;
}
+static HRESULT parse_procarch(IAssemblyNameImpl *name, LPCWSTR procarch)
+{
+ static const WCHAR msilW[] = {'m','s','i','l',0};
+ static const WCHAR x86W[] = {'x','8','6',0};
+ static const WCHAR ia64W[] = {'i','a','6','4',0};
+ static const WCHAR amd64W[] =
{'a','m','d','6','4',0};
+
+ if (!lstrcmpiW(procarch, msilW))
+ name->pekind = peMSIL;
+ else if (!lstrcmpiW(procarch, x86W))
+ name->pekind = peI386;
+ else if (!lstrcmpiW(procarch, ia64W))
+ name->pekind = peIA64;
+ else if (!lstrcmpiW(procarch, amd64W))
+ name->pekind = peAMD64;
+ else
+ {
+ ERR("unrecognized architecture: %s\n", wine_dbgstr_w(procarch));
+ return FUSION_E_INVALID_NAME;
+ }
+
+ return S_OK;
+}
+
static WCHAR *parse_value( const WCHAR *str, unsigned int len )
{
WCHAR *ret;
@@ -688,6 +751,8 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR
szAssemblyNam
{
name->procarch = value;
value = NULL;
+
+ hr = parse_procarch( name, name->procarch );
}
HeapFree( GetProcessHeap(), 0, value );
diff --git a/dll/win32/fusion/fusion.c b/dll/win32/fusion/fusion.c
index 729356208e..a51f40660d 100644
--- a/dll/win32/fusion/fusion.c
+++ b/dll/win32/fusion/fusion.c
@@ -26,7 +26,7 @@
HRESULT WINAPI InitializeFusion(void)
{
FIXME("\n");
- return E_NOTIMPL;
+ return S_OK;
}
/******************************************************************
diff --git a/media/doc/README.WINE b/media/doc/README.WINE
index 5e4932e3ad..8b15f8045b 100644
--- a/media/doc/README.WINE
+++ b/media/doc/README.WINE
@@ -67,7 +67,7 @@ reactos/dll/win32/dbghelp # Synced to Wine-3.0
reactos/dll/win32/dciman32 # Synced to WineStaging-2.9
reactos/dll/win32/faultrep # Synced to WineStaging-2.9
reactos/dll/win32/fontsub # Synced to WineStaging-2.9
-reactos/dll/win32/fusion # Synced to WineStaging-2.16
+reactos/dll/win32/fusion # Synced to Wine-3.0
reactos/dll/win32/gdiplus # Synced to WineStaging-2.16
reactos/dll/win32/hhctrl.ocx # Synced to WineStaging-2.9
reactos/dll/win32/hlink # Synced to WineStaging-2.9