[FUSION] Sync with Wine Staging 4.18. CORE-16441

This commit is contained in:
Amine Khaldi 2019-10-26 22:56:11 +01:00
parent 683b9f8f98
commit 88179a5d0f
11 changed files with 102 additions and 106 deletions

View file

@ -21,7 +21,7 @@ add_library(fusion MODULE
set_module_type(fusion win32dll) set_module_type(fusion win32dll)
target_link_libraries(fusion fusion_common uuid wine) target_link_libraries(fusion fusion_common uuid wine)
add_importlibs(fusion advapi32 dbghelp shlwapi user32 msvcrt kernel32 ntdll) add_importlibs(fusion bcrypt advapi32 dbghelp shlwapi user32 msvcrt kernel32 ntdll)
add_pch(fusion_common precomp.h COMMON_SOURCE) add_pch(fusion_common precomp.h COMMON_SOURCE)
add_cd_file(TARGET fusion DESTINATION reactos/Microsoft.NET/Framework/v1.0.3705 FOR all) add_cd_file(TARGET fusion DESTINATION reactos/Microsoft.NET/Framework/v1.0.3705 FOR all)
add_cd_file(TARGET fusion DESTINATION reactos/system32 FOR all) add_cd_file(TARGET fusion DESTINATION reactos/system32 FOR all)

View file

@ -22,6 +22,9 @@
#include <stdio.h> #include <stdio.h>
#define COBJMACROS #define COBJMACROS
#ifdef __REACTOS__
#define WIN32_NO_STATUS
#endif
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
@ -37,7 +40,6 @@
#include "fusionpriv.h" #include "fusionpriv.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(fusion); WINE_DEFAULT_DEBUG_CHANNEL(fusion);
@ -63,11 +65,11 @@ static BOOL create_full_path(LPCWSTR path)
BOOL ret = TRUE; BOOL ret = TRUE;
int len; int len;
if (!(new_path = heap_alloc((strlenW(path) + 1) * sizeof(WCHAR)))) return FALSE; if (!(new_path = heap_alloc((lstrlenW(path) + 1) * sizeof(WCHAR)))) return FALSE;
strcpyW(new_path, path); lstrcpyW(new_path, path);
while ((len = strlenW(new_path)) && new_path[len - 1] == '\\') while ((len = lstrlenW(new_path)) && new_path[len - 1] == '\\')
new_path[len - 1] = 0; new_path[len - 1] = 0;
while (!CreateDirectoryW(new_path, NULL)) while (!CreateDirectoryW(new_path, NULL))
@ -84,7 +86,7 @@ static BOOL create_full_path(LPCWSTR path)
break; break;
} }
if(!(slash = strrchrW(new_path, '\\'))) if(!(slash = wcsrchr(new_path, '\\')))
{ {
ret = FALSE; ret = FALSE;
break; break;
@ -116,14 +118,14 @@ static BOOL get_assembly_directory(LPWSTR dir, DWORD size, const char *version,
if (!strcmp(version, "v4.0.30319")) if (!strcmp(version, "v4.0.30319"))
{ {
strcpyW(dir + len, dotnet); lstrcpyW(dir + len, dotnet);
len += ARRAY_SIZE(dotnet) - 1; len += ARRAY_SIZE(dotnet) - 1;
strcpyW(dir + len, gac + 1); lstrcpyW(dir + len, gac + 1);
len += ARRAY_SIZE(gac) - 2; len += ARRAY_SIZE(gac) - 2;
} }
else else
{ {
strcpyW(dir + len, gac); lstrcpyW(dir + len, gac);
len += ARRAY_SIZE(gac) - 1; len += ARRAY_SIZE(gac) - 1;
} }
switch (architecture) switch (architecture)
@ -132,15 +134,15 @@ static BOOL get_assembly_directory(LPWSTR dir, DWORD size, const char *version,
break; break;
case peMSIL: case peMSIL:
strcpyW(dir + len, msil); lstrcpyW(dir + len, msil);
break; break;
case peI386: case peI386:
strcpyW(dir + len, x86); lstrcpyW(dir + len, x86);
break; break;
case peAMD64: case peAMD64:
strcpyW(dir + len, amd64); lstrcpyW(dir + len, amd64);
break; break;
default: default:
@ -267,11 +269,11 @@ static HRESULT WINAPI IAssemblyCacheImpl_UninstallAssembly(IAssemblyCache *iface
if (DeleteFileW( path )) if (DeleteFileW( path ))
{ {
if ((p = strrchrW( path, '\\' ))) if ((p = wcsrchr( path, '\\' )))
{ {
*p = 0; *p = 0;
RemoveDirectoryW( path ); RemoveDirectoryW( path );
if ((p = strrchrW( path, '\\' ))) if ((p = wcsrchr( path, '\\' )))
{ {
*p = 0; *p = 0;
RemoveDirectoryW( path ); RemoveDirectoryW( path );
@ -393,13 +395,13 @@ static HRESULT copy_file( const WCHAR *src_dir, DWORD src_len, const WCHAR *dst_
const WCHAR *filename ) const WCHAR *filename )
{ {
WCHAR *src_file, *dst_file; WCHAR *src_file, *dst_file;
DWORD len = strlenW( filename ); DWORD len = lstrlenW( filename );
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!(src_file = heap_alloc( (src_len + len + 1) * sizeof(WCHAR) ))) if (!(src_file = heap_alloc( (src_len + len + 1) * sizeof(WCHAR) )))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy( src_file, src_dir, src_len * sizeof(WCHAR) ); memcpy( src_file, src_dir, src_len * sizeof(WCHAR) );
strcpyW( src_file + src_len, filename ); lstrcpyW( src_file + src_len, filename );
if (!(dst_file = heap_alloc( (dst_len + len + 1) * sizeof(WCHAR) ))) if (!(dst_file = heap_alloc( (dst_len + len + 1) * sizeof(WCHAR) )))
{ {
@ -407,7 +409,7 @@ static HRESULT copy_file( const WCHAR *src_dir, DWORD src_len, const WCHAR *dst_
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
memcpy( dst_file, dst_dir, dst_len * sizeof(WCHAR) ); memcpy( dst_file, dst_dir, dst_len * sizeof(WCHAR) );
strcpyW( dst_file + dst_len, filename ); lstrcpyW( dst_file + dst_len, filename );
if (!CopyFileW( src_file, dst_file, FALSE )) hr = HRESULT_FROM_WIN32( GetLastError() ); if (!CopyFileW( src_file, dst_file, FALSE )) hr = HRESULT_FROM_WIN32( GetLastError() );
heap_free( src_file ); heap_free( src_file );
@ -442,7 +444,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
if (!pszManifestFilePath || !*pszManifestFilePath) if (!pszManifestFilePath || !*pszManifestFilePath)
return E_INVALIDARG; return E_INVALIDARG;
if (!(extension = strrchrW(pszManifestFilePath, '.'))) if (!(extension = wcsrchr(pszManifestFilePath, '.')))
return HRESULT_FROM_WIN32(ERROR_INVALID_NAME); return HRESULT_FROM_WIN32(ERROR_INVALID_NAME);
if (lstrcmpiW(extension, ext_exe) && lstrcmpiW(extension, ext_dll)) if (lstrcmpiW(extension, ext_exe) && lstrcmpiW(extension, ext_dll))
@ -483,16 +485,16 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
architecture = assembly_get_architecture(assembly); architecture = assembly_get_architecture(assembly);
get_assembly_directory(asmdir, MAX_PATH, clr_version, architecture); get_assembly_directory(asmdir, MAX_PATH, clr_version, architecture);
dst_len += strlenW(asmdir) + strlenW(name) + strlenW(version) + strlenW(token); dst_len += lstrlenW(asmdir) + lstrlenW(name) + lstrlenW(version) + lstrlenW(token);
if (!(dst_dir = heap_alloc(dst_len * sizeof(WCHAR)))) if (!(dst_dir = heap_alloc(dst_len * sizeof(WCHAR))))
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
goto done; goto done;
} }
if (!strcmp(clr_version, "v4.0.30319")) if (!strcmp(clr_version, "v4.0.30319"))
dst_len = sprintfW(dst_dir, format_v40, asmdir, name, version, token); dst_len = swprintf(dst_dir, format_v40, asmdir, name, version, token);
else else
dst_len = sprintfW(dst_dir, format, asmdir, name, version, token); dst_len = swprintf(dst_dir, format, asmdir, name, version, token);
create_full_path(dst_dir); create_full_path(dst_dir);
@ -500,7 +502,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
if (FAILED(hr)) if (FAILED(hr))
goto done; goto done;
if ((p = strrchrW(asmpath, '\\'))) if ((p = wcsrchr(asmpath, '\\')))
{ {
filename = p + 1; filename = p + 1;
src_dir = asmpath; src_dir = asmpath;

View file

@ -20,6 +20,11 @@
#include <stdarg.h> #include <stdarg.h>
#ifdef __REACTOS__
#include <wchar.h>
#define WIN32_NO_STATUS
#endif
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION #define NONAMELESSUNION
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
@ -34,7 +39,6 @@
#include "fusionpriv.h" #include "fusionpriv.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/list.h" #include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(fusion); WINE_DEFAULT_DEBUG_CHANNEL(fusion);
@ -187,9 +191,9 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path,
if (!name) if (!name)
{ {
if (prefix && depth == 1) if (prefix && depth == 1)
sprintfW(buf, star_prefix_fmt, path, prefix); swprintf(buf, star_prefix_fmt, path, prefix);
else else
sprintfW(buf, star_fmt, path); swprintf(buf, star_fmt, path);
return; return;
} }
if (depth == 0) if (depth == 0)
@ -198,9 +202,9 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path,
*disp = '\0'; *disp = '\0';
hr = IAssemblyName_GetName(name, &size, disp); hr = IAssemblyName_GetName(name, &size, disp);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
sprintfW(buf, ss_fmt, path, disp); swprintf(buf, ss_fmt, path, disp);
else else
sprintfW(buf, ss_fmt, path, star); swprintf(buf, ss_fmt, path, star);
} }
else if (depth == 1) else if (depth == 1)
{ {
@ -219,7 +223,7 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path,
if (!major_size || !minor_size || !build_size || !revision_size) verptr = star; if (!major_size || !minor_size || !build_size || !revision_size) verptr = star;
else else
{ {
sprintfW(version, ver_fmt, major, minor, build, revision); swprintf(version, ver_fmt, major, minor, build, revision);
verptr = version; verptr = version;
} }
@ -234,9 +238,9 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path,
} }
if (prefix) if (prefix)
sprintfW(buf, ssss_fmt, path, prefix, verptr, pubkeyptr); swprintf(buf, ssss_fmt, path, prefix, verptr, pubkeyptr);
else else
sprintfW(buf, sss_fmt, path, verptr, pubkeyptr); swprintf(buf, sss_fmt, path, verptr, pubkeyptr);
} }
} }
@ -254,7 +258,7 @@ static int compare_assembly_names(ASMNAME *asmname1, ASMNAME *asmname2)
size = sizeof(name2); size = sizeof(name2);
IAssemblyName_GetProperty(asmname2->name, ASM_NAME_NAME, name2, &size); IAssemblyName_GetProperty(asmname2->name, ASM_NAME_NAME, name2, &size);
if ((ret = strcmpiW(name1, name2))) return ret; if ((ret = wcsicmp(name1, name2))) return ret;
for (i = ASM_NAME_MAJOR_VERSION; i < ASM_NAME_CULTURE; i++) for (i = ASM_NAME_MAJOR_VERSION; i < ASM_NAME_CULTURE; i++)
{ {
@ -277,7 +281,7 @@ static int compare_assembly_names(ASMNAME *asmname1, ASMNAME *asmname2)
token_to_str(token1, token_str1); token_to_str(token1, token_str1);
token_to_str(token2, token_str2); token_to_str(token2, token_str2);
if ((ret = strcmpiW(token_str1, token_str2))) return ret; if ((ret = wcsicmp(token_str1, token_str2))) return ret;
return 0; return 0;
} }
@ -331,7 +335,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
if (depth == 0) if (depth == 0)
{ {
if (name) if (name)
ptr = strrchrW(buf, '\\') + 1; ptr = wcsrchr(buf, '\\') + 1;
else else
ptr = ffd.cFileName; ptr = ffd.cFileName;
@ -341,19 +345,19 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
{ {
const WCHAR *token, *version = ffd.cFileName; const WCHAR *token, *version = ffd.cFileName;
sprintfW(asmpath, path_fmt, path, ffd.cFileName, parent); swprintf(asmpath, path_fmt, path, ffd.cFileName, parent);
ptr = strstrW(ffd.cFileName, dblunder); ptr = wcsstr(ffd.cFileName, dblunder);
*ptr = '\0'; *ptr = '\0';
token = ptr + 2; token = ptr + 2;
if (prefix) if (prefix)
{ {
unsigned int prefix_len = strlenW(prefix); unsigned int prefix_len = lstrlenW(prefix);
if (strlenW(ffd.cFileName) >= prefix_len && if (lstrlenW(ffd.cFileName) >= prefix_len &&
!memicmpW(ffd.cFileName, prefix, prefix_len)) !_wcsnicmp(ffd.cFileName, prefix, prefix_len))
version += prefix_len; version += prefix_len;
} }
sprintfW(disp, name_fmt, parent, version, token); swprintf(disp, name_fmt, parent, version, token);
if (!(asmname = heap_alloc(sizeof(*asmname)))) if (!(asmname = heap_alloc(sizeof(*asmname))))
{ {
@ -381,7 +385,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
continue; continue;
} }
sprintfW(buf, ss_fmt, path, ffd.cFileName); swprintf(buf, ss_fmt, path, ffd.cFileName);
hr = enum_gac_assemblies(assemblies, name, depth + 1, prefix, buf); hr = enum_gac_assemblies(assemblies, name, depth + 1, prefix, buf);
if (FAILED(hr)) if (FAILED(hr))
break; break;
@ -408,21 +412,21 @@ static HRESULT enumerate_gac(IAssemblyEnumImpl *asmenum, IAssemblyName *pName)
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
strcpyW(path, buf); lstrcpyW(path, buf);
GetNativeSystemInfo(&info); GetNativeSystemInfo(&info);
if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
{ {
strcpyW(path + size - 1, gac_64); lstrcpyW(path + size - 1, gac_64);
hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path); hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
} }
strcpyW(path + size - 1, gac_32); lstrcpyW(path + size - 1, gac_32);
hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path); hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
strcpyW(path + size - 1, gac_msil); lstrcpyW(path + size - 1, gac_msil);
hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path); hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, v40, path);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
@ -432,25 +436,25 @@ static HRESULT enumerate_gac(IAssemblyEnumImpl *asmenum, IAssemblyName *pName)
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
strcpyW(path, buf); lstrcpyW(path, buf);
if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
{ {
strcpyW(path + size - 1, gac_64); lstrcpyW(path + size - 1, gac_64);
hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path); hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
} }
strcpyW(path + size - 1, gac_32); lstrcpyW(path + size - 1, gac_32);
hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path); hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
strcpyW(path + size - 1, gac_msil); lstrcpyW(path + size - 1, gac_msil);
hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path); hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
strcpyW(path + size - 1, gac); lstrcpyW(path + size - 1, gac);
hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path); hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;

View file

@ -23,6 +23,9 @@
#define COBJMACROS #define COBJMACROS
#define INITGUID #define INITGUID
#ifdef __REACTOS__
#define WIN32_NO_STATUS
#endif
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
@ -34,7 +37,6 @@
#include "strsafe.h" #include "strsafe.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "fusionpriv.h" #include "fusionpriv.h"
WINE_DEFAULT_DEBUG_CHANNEL(fusion); WINE_DEFAULT_DEBUG_CHANNEL(fusion);
@ -277,7 +279,7 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName *iface,
if (!name->displayname || !*name->displayname) if (!name->displayname || !*name->displayname)
return FUSION_E_INVALID_NAME; return FUSION_E_INVALID_NAME;
size = strlenW(name->displayname) + 1; size = lstrlenW(name->displayname) + 1;
if (*pccDisplayName < size) if (*pccDisplayName < size)
{ {
@ -285,7 +287,7 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName *iface,
return E_NOT_SUFFICIENT_BUFFER; return E_NOT_SUFFICIENT_BUFFER;
} }
if (szDisplayName) strcpyW(szDisplayName, name->displayname); if (szDisplayName) lstrcpyW(szDisplayName, name->displayname);
*pccDisplayName = size; *pccDisplayName = size;
return S_OK; return S_OK;
@ -417,7 +419,7 @@ static HRESULT WINAPI IAssemblyNameImpl_GetName(IAssemblyName *iface,
TRACE("(%p, %p, %p)\n", iface, lpcwBuffer, pwzName); TRACE("(%p, %p, %p)\n", iface, lpcwBuffer, pwzName);
if (name->name) if (name->name)
len = strlenW(name->name) + 1; len = lstrlenW(name->name) + 1;
else else
len = 0; len = 0;
@ -427,7 +429,7 @@ static HRESULT WINAPI IAssemblyNameImpl_GetName(IAssemblyName *iface,
return E_NOT_SUFFICIENT_BUFFER; return E_NOT_SUFFICIENT_BUFFER;
} }
if (!name->name) lpcwBuffer[0] = 0; if (!name->name) lpcwBuffer[0] = 0;
else strcpyW(pwzName, name->name); else lstrcpyW(pwzName, name->name);
*lpcwBuffer = len; *lpcwBuffer = len;
return S_OK; return S_OK;
@ -465,7 +467,7 @@ static HRESULT WINAPI IAssemblyNameImpl_IsEqual(IAssemblyName *iface,
if (!pName) return S_FALSE; if (!pName) return S_FALSE;
if (flags & ~ASM_CMPF_IL_ALL) FIXME("unsupported flags\n"); if (flags & ~ASM_CMPF_IL_ALL) FIXME("unsupported flags\n");
if ((flags & ASM_CMPF_NAME) && strcmpW(name1->name, name2->name)) return S_FALSE; if ((flags & ASM_CMPF_NAME) && lstrcmpW(name1->name, name2->name)) return S_FALSE;
if (name1->versize && name2->versize) if (name1->versize && name2->versize)
{ {
if ((flags & ASM_CMPF_MAJOR_VERSION) && if ((flags & ASM_CMPF_MAJOR_VERSION) &&
@ -483,7 +485,7 @@ static HRESULT WINAPI IAssemblyNameImpl_IsEqual(IAssemblyName *iface,
if ((flags & ASM_CMPF_CULTURE) && if ((flags & ASM_CMPF_CULTURE) &&
name1->culture && name2->culture && name1->culture && name2->culture &&
strcmpW(name1->culture, name2->culture)) return S_FALSE; lstrcmpW(name1->culture, name2->culture)) return S_FALSE;
return S_OK; return S_OK;
} }
@ -560,10 +562,10 @@ static HRESULT parse_version(IAssemblyNameImpl *name, LPWSTR version)
if (!*beg) if (!*beg)
return S_OK; return S_OK;
end = strchrW(beg, '.'); end = wcschr(beg, '.');
if (end) *end = '\0'; if (end) *end = '\0';
name->version[i] = atolW(beg); name->version[i] = wcstol(beg, NULL, 10);
name->versize++; name->versize++;
if (!end && i < 3) if (!end && i < 3)
@ -700,11 +702,11 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
goto done; goto done;
} }
ptr = strchrW(str, ','); ptr = wcschr(str, ',');
if (ptr) *ptr = '\0'; if (ptr) *ptr = '\0';
/* no ',' but ' ' only */ /* no ',' but ' ' only */
if( !ptr && strchrW(str, ' ') ) if( !ptr && wcschr(str, ' ') )
{ {
hr = FUSION_E_INVALID_NAME; hr = FUSION_E_INVALID_NAME;
goto done; goto done;
@ -723,7 +725,7 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
str = ptr + 1; str = ptr + 1;
while (!done) while (!done)
{ {
ptr = strchrW(str, '='); ptr = wcschr(str, '=');
if (!ptr) if (!ptr)
{ {
hr = FUSION_E_INVALID_NAME; hr = FUSION_E_INVALID_NAME;
@ -737,9 +739,9 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
goto done; goto done;
} }
if (!(ptr2 = strchrW(ptr, ','))) if (!(ptr2 = wcschr(ptr, ',')))
{ {
if (!(ptr2 = strchrW(ptr, '\0'))) if (!(ptr2 = wcschr(ptr, '\0')))
{ {
hr = FUSION_E_INVALID_NAME; hr = FUSION_E_INVALID_NAME;
goto done; goto done;

View file

@ -21,11 +21,13 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winuser.h" #include "winuser.h"
#include "winver.h" #include "winver.h"
#include "wincrypt.h" #include "bcrypt.h"
#include "dbghelp.h" #include "dbghelp.h"
#include "ole2.h" #include "ole2.h"
#include "fusion.h" #include "fusion.h"
@ -33,7 +35,6 @@
#include "fusionpriv.h" #include "fusionpriv.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#define TableFromToken(tk) (TypeFromToken(tk) >> 24) #define TableFromToken(tk) (TypeFromToken(tk) >> 24)
#define TokenFromTable(idx) (idx << 24) #define TokenFromTable(idx) (idx << 24)
@ -748,10 +749,10 @@ HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name)
HRESULT assembly_get_path(const ASSEMBLY *assembly, LPWSTR *path) HRESULT assembly_get_path(const ASSEMBLY *assembly, LPWSTR *path)
{ {
WCHAR *cpy = heap_alloc((strlenW(assembly->path) + 1) * sizeof(WCHAR)); WCHAR *cpy = heap_alloc((lstrlenW(assembly->path) + 1) * sizeof(WCHAR));
*path = cpy; *path = cpy;
if (cpy) if (cpy)
strcpyW(cpy, assembly->path); lstrcpyW(cpy, assembly->path);
else else
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -775,10 +776,10 @@ HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version)
if (!asmtbl) if (!asmtbl)
return E_FAIL; return E_FAIL;
if (!(*version = heap_alloc(sizeof(format) + 4 * strlen("65535") * sizeof(WCHAR)))) if (!(*version = heap_alloc(24 * sizeof(WCHAR))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
sprintfW(*version, format, asmtbl->MajorVersion, asmtbl->MinorVersion, swprintf(*version, format, asmtbl->MajorVersion, asmtbl->MinorVersion,
asmtbl->BuildNumber, asmtbl->RevisionNumber); asmtbl->BuildNumber, asmtbl->RevisionNumber);
return S_OK; return S_OK;
@ -807,9 +808,8 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token)
{ {
ULONG i, size; ULONG i, size;
LONG offset; LONG offset;
BYTE *hashdata, *pubkey, *ptr; BYTE hashdata[20], *pubkey, *ptr;
HCRYPTPROV crypt; BCRYPT_ALG_HANDLE alg;
HCRYPTHASH hash;
BYTE tokbytes[BYTES_PER_TOKEN]; BYTE tokbytes[BYTES_PER_TOKEN];
HRESULT hr = E_FAIL; HRESULT hr = E_FAIL;
LPWSTR tok; LPWSTR tok;
@ -833,29 +833,16 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token)
pubkey = assembly_get_blob(assembly, idx, &size); pubkey = assembly_get_blob(assembly, idx, &size);
if (!CryptAcquireContextA(&crypt, NULL, NULL, PROV_RSA_FULL, if (BCryptOpenAlgorithmProvider(&alg, BCRYPT_SHA1_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0) != STATUS_SUCCESS)
CRYPT_VERIFYCONTEXT))
return E_FAIL; return E_FAIL;
if (!CryptCreateHash(crypt, CALG_SHA1, 0, 0, &hash)) if (BCryptHash(alg, NULL, 0, pubkey, size, hashdata, sizeof(hashdata)) != STATUS_SUCCESS)
return E_FAIL;
if (!CryptHashData(hash, pubkey, size, 0))
return E_FAIL;
size = 0;
if (!CryptGetHashParam(hash, HP_HASHVAL, NULL, &size, 0))
return E_FAIL;
if (!(hashdata = heap_alloc(size)))
{ {
hr = E_OUTOFMEMORY; hr = E_FAIL;
goto done; goto done;
} }
if (!CryptGetHashParam(hash, HP_HASHVAL, hashdata, &size, 0)) size = sizeof(hashdata);
goto done;
for (i = size - 1; i >= size - 8; i--) for (i = size - 1; i >= size - 8; i--)
tokbytes[size - i - 1] = hashdata[i]; tokbytes[size - i - 1] = hashdata[i];
@ -871,10 +858,7 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token)
hr = S_OK; hr = S_OK;
done: done:
heap_free(hashdata); BCryptCloseAlgorithmProvider(alg, 0);
CryptDestroyHash(hash);
CryptReleaseContext(crypt, 0);
return hr; return hr;
} }

View file

@ -19,6 +19,9 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#ifdef __REACTOS__
#include <wchar.h>
#endif
#define COBJMACROS #define COBJMACROS
@ -28,7 +31,6 @@
#include "ole2.h" #include "ole2.h"
#include "fusion.h" #include "fusion.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(fusion); WINE_DEFAULT_DEBUG_CHANNEL(fusion);
@ -128,7 +130,7 @@ HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
return E_INVALIDARG; return E_INVALIDARG;
len = GetWindowsDirectoryW(windir, MAX_PATH); len = GetWindowsDirectoryW(windir, MAX_PATH);
strcpyW(path, windir); lstrcpyW(path, windir);
switch (dwCacheFlags) switch (dwCacheFlags)
{ {
@ -138,14 +140,14 @@ HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
len = sprintfW(path, zapfmt, windir, assembly + 1, nativeimg, version); len = swprintf(path, zapfmt, windir, assembly + 1, nativeimg, version);
break; break;
} }
case ASM_CACHE_GAC: case ASM_CACHE_GAC:
{ {
strcpyW(path + len, assembly); lstrcpyW(path + len, assembly);
len += ARRAY_SIZE(assembly) - 1; len += ARRAY_SIZE(assembly) - 1;
strcpyW(path + len, gac); lstrcpyW(path + len, gac);
len += ARRAY_SIZE(gac) - 1; len += ARRAY_SIZE(gac) - 1;
break; break;
} }
@ -155,13 +157,13 @@ HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
return E_FAIL; return E_FAIL;
} }
case ASM_CACHE_ROOT: case ASM_CACHE_ROOT:
strcpyW(path + len, assembly); lstrcpyW(path + len, assembly);
len += ARRAY_SIZE(assembly) - 1; len += ARRAY_SIZE(assembly) - 1;
break; break;
case ASM_CACHE_ROOT_EX: case ASM_CACHE_ROOT_EX:
strcpyW(path + len, dotnet); lstrcpyW(path + len, dotnet);
len += ARRAY_SIZE(dotnet) - 1; len += ARRAY_SIZE(dotnet) - 1;
strcpyW(path + len, assembly); lstrcpyW(path + len, assembly);
len += ARRAY_SIZE(assembly) - 1; len += ARRAY_SIZE(assembly) - 1;
break; break;
default: default:
@ -172,7 +174,7 @@ HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
if (*pcchPath <= len || !pwzCachePath) if (*pcchPath <= len || !pwzCachePath)
hr = E_NOT_SUFFICIENT_BUFFER; hr = E_NOT_SUFFICIENT_BUFFER;
else if (pwzCachePath) else if (pwzCachePath)
strcpyW(pwzCachePath, path); lstrcpyW(pwzCachePath, path);
*pcchPath = len; *pcchPath = len;
return hr; return hr;

View file

@ -9,5 +9,5 @@ add_library(fusion_1_1 MODULE
set_module_type(fusion_1_1 win32dll) set_module_type(fusion_1_1 win32dll)
target_link_libraries(fusion_1_1 fusion_common uuid wine) target_link_libraries(fusion_1_1 fusion_common uuid wine)
set_target_properties(fusion_1_1 PROPERTIES OUTPUT_NAME "fusion" PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") set_target_properties(fusion_1_1 PROPERTIES OUTPUT_NAME "fusion" PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_importlibs(fusion_1_1 advapi32 dbghelp shlwapi user32 msvcrt kernel32 ntdll) add_importlibs(fusion_1_1 bcrypt advapi32 dbghelp shlwapi user32 msvcrt kernel32 ntdll)
add_cd_file(TARGET fusion_1_1 DESTINATION reactos/Microsoft.NET/Framework/v1.1.4322 FOR all) add_cd_file(TARGET fusion_1_1 DESTINATION reactos/Microsoft.NET/Framework/v1.1.4322 FOR all)

View file

@ -9,5 +9,5 @@ add_library(fusion_2_0 MODULE
set_module_type(fusion_2_0 win32dll) set_module_type(fusion_2_0 win32dll)
target_link_libraries(fusion_2_0 fusion_common uuid wine) target_link_libraries(fusion_2_0 fusion_common uuid wine)
set_target_properties(fusion_2_0 PROPERTIES OUTPUT_NAME "fusion" PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") set_target_properties(fusion_2_0 PROPERTIES OUTPUT_NAME "fusion" PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_importlibs(fusion_2_0 advapi32 dbghelp shlwapi user32 msvcrt kernel32 ntdll) add_importlibs(fusion_2_0 bcrypt advapi32 dbghelp shlwapi user32 msvcrt kernel32 ntdll)
add_cd_file(TARGET fusion_2_0 DESTINATION reactos/Microsoft.NET/Framework/v2.0.50727 FOR all) add_cd_file(TARGET fusion_2_0 DESTINATION reactos/Microsoft.NET/Framework/v2.0.50727 FOR all)

View file

@ -23,6 +23,9 @@
#include <stdarg.h> #include <stdarg.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winuser.h" #include "winuser.h"

View file

@ -2,7 +2,6 @@
#ifndef _WINE_FUSION_PRECOMP_H_ #ifndef _WINE_FUSION_PRECOMP_H_
#define _WINE_FUSION_PRECOMP_H_ #define _WINE_FUSION_PRECOMP_H_
#define WIN32_NO_STATUS
#define _INC_WINDOWS #define _INC_WINDOWS
#define COM_NO_WINDOWS_H #define COM_NO_WINDOWS_H

View file

@ -68,7 +68,7 @@ dll/win32/dbghelp # Synced to WineStaging-3.9
dll/win32/dciman32 # Synced to WineStaging-3.3 dll/win32/dciman32 # Synced to WineStaging-3.3
dll/win32/faultrep # Synced to WineStaging-4.18 dll/win32/faultrep # Synced to WineStaging-4.18
dll/win32/fontsub # Synced to WineStaging-2.9 dll/win32/fontsub # Synced to WineStaging-2.9
dll/win32/fusion # Synced to WineStaging-3.17 dll/win32/fusion # Synced to WineStaging-4.18
dll/win32/gdiplus # Synced to WineStaging-4.0 dll/win32/gdiplus # Synced to WineStaging-4.0
dll/win32/hhctrl.ocx # Synced to WineStaging-4.0 dll/win32/hhctrl.ocx # Synced to WineStaging-4.0
dll/win32/hlink # Synced to WineStaging-4.0 dll/win32/hlink # Synced to WineStaging-4.0