fusion: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-06-04 09:14:04 +02:00
parent d0416d9bc6
commit 842d404342
7 changed files with 78 additions and 81 deletions

View File

@ -1,6 +1,8 @@
MODULE = fusion.dll
IMPORTS = bcrypt dbghelp shlwapi version user32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
asmcache.c \
asmenum.c \

View File

@ -37,7 +37,6 @@
#include "fusionpriv.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(fusion);
@ -63,11 +62,11 @@ static BOOL create_full_path(LPCWSTR path)
BOOL ret = TRUE;
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;
while (!CreateDirectoryW(new_path, NULL))
@ -84,7 +83,7 @@ static BOOL create_full_path(LPCWSTR path)
break;
}
if(!(slash = strrchrW(new_path, '\\')))
if(!(slash = wcsrchr(new_path, '\\')))
{
ret = FALSE;
break;
@ -116,14 +115,14 @@ static BOOL get_assembly_directory(LPWSTR dir, DWORD size, const char *version,
if (!strcmp(version, "v4.0.30319"))
{
strcpyW(dir + len, dotnet);
lstrcpyW(dir + len, dotnet);
len += ARRAY_SIZE(dotnet) - 1;
strcpyW(dir + len, gac + 1);
lstrcpyW(dir + len, gac + 1);
len += ARRAY_SIZE(gac) - 2;
}
else
{
strcpyW(dir + len, gac);
lstrcpyW(dir + len, gac);
len += ARRAY_SIZE(gac) - 1;
}
switch (architecture)
@ -132,15 +131,15 @@ static BOOL get_assembly_directory(LPWSTR dir, DWORD size, const char *version,
break;
case peMSIL:
strcpyW(dir + len, msil);
lstrcpyW(dir + len, msil);
break;
case peI386:
strcpyW(dir + len, x86);
lstrcpyW(dir + len, x86);
break;
case peAMD64:
strcpyW(dir + len, amd64);
lstrcpyW(dir + len, amd64);
break;
default:
@ -267,11 +266,11 @@ static HRESULT WINAPI IAssemblyCacheImpl_UninstallAssembly(IAssemblyCache *iface
if (DeleteFileW( path ))
{
if ((p = strrchrW( path, '\\' )))
if ((p = wcsrchr( path, '\\' )))
{
*p = 0;
RemoveDirectoryW( path );
if ((p = strrchrW( path, '\\' )))
if ((p = wcsrchr( path, '\\' )))
{
*p = 0;
RemoveDirectoryW( path );
@ -393,13 +392,13 @@ static HRESULT copy_file( const WCHAR *src_dir, DWORD src_len, const WCHAR *dst_
const WCHAR *filename )
{
WCHAR *src_file, *dst_file;
DWORD len = strlenW( filename );
DWORD len = lstrlenW( filename );
HRESULT hr = S_OK;
if (!(src_file = heap_alloc( (src_len + len + 1) * sizeof(WCHAR) )))
return E_OUTOFMEMORY;
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) )))
{
@ -407,7 +406,7 @@ static HRESULT copy_file( const WCHAR *src_dir, DWORD src_len, const WCHAR *dst_
return E_OUTOFMEMORY;
}
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() );
heap_free( src_file );
@ -442,7 +441,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
if (!pszManifestFilePath || !*pszManifestFilePath)
return E_INVALIDARG;
if (!(extension = strrchrW(pszManifestFilePath, '.')))
if (!(extension = wcsrchr(pszManifestFilePath, '.')))
return HRESULT_FROM_WIN32(ERROR_INVALID_NAME);
if (lstrcmpiW(extension, ext_exe) && lstrcmpiW(extension, ext_dll))
@ -483,16 +482,16 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
architecture = assembly_get_architecture(assembly);
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))))
{
hr = E_OUTOFMEMORY;
goto done;
}
if (!strcmp(clr_version, "v4.0.30319"))
dst_len = sprintfW(dst_dir, format_v40, asmdir, name, version, token);
dst_len = swprintf(dst_dir, dst_len, format_v40, asmdir, name, version, token);
else
dst_len = sprintfW(dst_dir, format, asmdir, name, version, token);
dst_len = swprintf(dst_dir, dst_len, format, asmdir, name, version, token);
create_full_path(dst_dir);
@ -500,7 +499,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
if (FAILED(hr))
goto done;
if ((p = strrchrW(asmpath, '\\')))
if ((p = wcsrchr(asmpath, '\\')))
{
filename = p + 1;
src_dir = asmpath;

View File

@ -34,7 +34,6 @@
#include "fusionpriv.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(fusion);
@ -187,9 +186,9 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path,
if (!name)
{
if (prefix && depth == 1)
sprintfW(buf, star_prefix_fmt, path, prefix);
swprintf(buf, MAX_PATH, star_prefix_fmt, path, prefix);
else
sprintfW(buf, star_fmt, path);
swprintf(buf, MAX_PATH, star_fmt, path);
return;
}
if (depth == 0)
@ -198,9 +197,9 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path,
*disp = '\0';
hr = IAssemblyName_GetName(name, &size, disp);
if (SUCCEEDED(hr))
sprintfW(buf, ss_fmt, path, disp);
swprintf(buf, MAX_PATH, ss_fmt, path, disp);
else
sprintfW(buf, ss_fmt, path, star);
swprintf(buf, MAX_PATH, ss_fmt, path, star);
}
else if (depth == 1)
{
@ -219,7 +218,7 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path,
if (!major_size || !minor_size || !build_size || !revision_size) verptr = star;
else
{
sprintfW(version, ver_fmt, major, minor, build, revision);
swprintf(version, ARRAY_SIZE(version), ver_fmt, major, minor, build, revision);
verptr = version;
}
@ -234,9 +233,9 @@ static void build_file_mask(IAssemblyName *name, int depth, const WCHAR *path,
}
if (prefix)
sprintfW(buf, ssss_fmt, path, prefix, verptr, pubkeyptr);
swprintf(buf, MAX_PATH, ssss_fmt, path, prefix, verptr, pubkeyptr);
else
sprintfW(buf, sss_fmt, path, verptr, pubkeyptr);
swprintf(buf, MAX_PATH, sss_fmt, path, verptr, pubkeyptr);
}
}
@ -254,7 +253,7 @@ static int compare_assembly_names(ASMNAME *asmname1, ASMNAME *asmname2)
size = sizeof(name2);
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++)
{
@ -277,7 +276,7 @@ static int compare_assembly_names(ASMNAME *asmname1, ASMNAME *asmname2)
token_to_str(token1, token_str1);
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;
}
@ -331,7 +330,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
if (depth == 0)
{
if (name)
ptr = strrchrW(buf, '\\') + 1;
ptr = wcsrchr(buf, '\\') + 1;
else
ptr = ffd.cFileName;
@ -341,19 +340,19 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
{
const WCHAR *token, *version = ffd.cFileName;
sprintfW(asmpath, path_fmt, path, ffd.cFileName, parent);
ptr = strstrW(ffd.cFileName, dblunder);
swprintf(asmpath, ARRAY_SIZE(asmpath), path_fmt, path, ffd.cFileName, parent);
ptr = wcsstr(ffd.cFileName, dblunder);
*ptr = '\0';
token = ptr + 2;
if (prefix)
{
unsigned int prefix_len = strlenW(prefix);
if (strlenW(ffd.cFileName) >= prefix_len &&
!strncmpiW(ffd.cFileName, prefix, prefix_len))
unsigned int prefix_len = lstrlenW(prefix);
if (lstrlenW(ffd.cFileName) >= prefix_len &&
!wcsnicmp(ffd.cFileName, prefix, prefix_len))
version += prefix_len;
}
sprintfW(disp, name_fmt, parent, version, token);
swprintf(disp, ARRAY_SIZE(disp), name_fmt, parent, version, token);
if (!(asmname = heap_alloc(sizeof(*asmname))))
{
@ -381,7 +380,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
continue;
}
sprintfW(buf, ss_fmt, path, ffd.cFileName);
swprintf(buf, ARRAY_SIZE(buf), ss_fmt, path, ffd.cFileName);
hr = enum_gac_assemblies(assemblies, name, depth + 1, prefix, buf);
if (FAILED(hr))
break;
@ -408,21 +407,21 @@ static HRESULT enumerate_gac(IAssemblyEnumImpl *asmenum, IAssemblyName *pName)
if (FAILED(hr))
return hr;
strcpyW(path, buf);
lstrcpyW(path, buf);
GetNativeSystemInfo(&info);
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);
if (FAILED(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);
if (FAILED(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);
if (FAILED(hr))
return hr;
@ -432,25 +431,25 @@ static HRESULT enumerate_gac(IAssemblyEnumImpl *asmenum, IAssemblyName *pName)
if (FAILED(hr))
return hr;
strcpyW(path, buf);
lstrcpyW(path, buf);
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);
if (FAILED(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);
if (FAILED(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);
if (FAILED(hr))
return hr;
strcpyW(path + size - 1, gac);
lstrcpyW(path + size - 1, gac);
hr = enum_gac_assemblies(&asmenum->assemblies, pName, 0, NULL, path);
if (FAILED(hr))
return hr;

View File

@ -34,7 +34,6 @@
#include "strsafe.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "fusionpriv.h"
WINE_DEFAULT_DEBUG_CHANNEL(fusion);
@ -277,7 +276,7 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName *iface,
if (!name->displayname || !*name->displayname)
return FUSION_E_INVALID_NAME;
size = strlenW(name->displayname) + 1;
size = lstrlenW(name->displayname) + 1;
if (*pccDisplayName < size)
{
@ -285,7 +284,7 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName *iface,
return E_NOT_SUFFICIENT_BUFFER;
}
if (szDisplayName) strcpyW(szDisplayName, name->displayname);
if (szDisplayName) lstrcpyW(szDisplayName, name->displayname);
*pccDisplayName = size;
return S_OK;
@ -417,7 +416,7 @@ static HRESULT WINAPI IAssemblyNameImpl_GetName(IAssemblyName *iface,
TRACE("(%p, %p, %p)\n", iface, lpcwBuffer, pwzName);
if (name->name)
len = strlenW(name->name) + 1;
len = lstrlenW(name->name) + 1;
else
len = 0;
@ -427,7 +426,7 @@ static HRESULT WINAPI IAssemblyNameImpl_GetName(IAssemblyName *iface,
return E_NOT_SUFFICIENT_BUFFER;
}
if (!name->name) lpcwBuffer[0] = 0;
else strcpyW(pwzName, name->name);
else lstrcpyW(pwzName, name->name);
*lpcwBuffer = len;
return S_OK;
@ -465,7 +464,7 @@ static HRESULT WINAPI IAssemblyNameImpl_IsEqual(IAssemblyName *iface,
if (!pName) return S_FALSE;
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 ((flags & ASM_CMPF_MAJOR_VERSION) &&
@ -483,7 +482,7 @@ static HRESULT WINAPI IAssemblyNameImpl_IsEqual(IAssemblyName *iface,
if ((flags & ASM_CMPF_CULTURE) &&
name1->culture && name2->culture &&
strcmpW(name1->culture, name2->culture)) return S_FALSE;
lstrcmpW(name1->culture, name2->culture)) return S_FALSE;
return S_OK;
}
@ -560,10 +559,10 @@ static HRESULT parse_version(IAssemblyNameImpl *name, LPWSTR version)
if (!*beg)
return S_OK;
end = strchrW(beg, '.');
end = wcschr(beg, '.');
if (end) *end = '\0';
name->version[i] = atolW(beg);
name->version[i] = wcstol(beg, NULL, 10);
name->versize++;
if (!end && i < 3)
@ -700,11 +699,11 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
goto done;
}
ptr = strchrW(str, ',');
ptr = wcschr(str, ',');
if (ptr) *ptr = '\0';
/* no ',' but ' ' only */
if( !ptr && strchrW(str, ' ') )
if( !ptr && wcschr(str, ' ') )
{
hr = FUSION_E_INVALID_NAME;
goto done;
@ -723,7 +722,7 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
str = ptr + 1;
while (!done)
{
ptr = strchrW(str, '=');
ptr = wcschr(str, '=');
if (!ptr)
{
hr = FUSION_E_INVALID_NAME;
@ -737,9 +736,9 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
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;
goto done;

View File

@ -35,7 +35,6 @@
#include "fusionpriv.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#define TableFromToken(tk) (TypeFromToken(tk) >> 24)
#define TokenFromTable(idx) (idx << 24)
@ -750,10 +749,10 @@ HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name)
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;
if (cpy)
strcpyW(cpy, assembly->path);
lstrcpyW(cpy, assembly->path);
else
return E_OUTOFMEMORY;
@ -777,10 +776,10 @@ HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version)
if (!asmtbl)
return E_FAIL;
if (!(*version = heap_alloc(sizeof(format) + 4 * strlen("65535") * sizeof(WCHAR))))
if (!(*version = heap_alloc(24 * sizeof(WCHAR))))
return E_OUTOFMEMORY;
sprintfW(*version, format, asmtbl->MajorVersion, asmtbl->MinorVersion,
swprintf(*version, 24, format, asmtbl->MajorVersion, asmtbl->MinorVersion,
asmtbl->BuildNumber, asmtbl->RevisionNumber);
return S_OK;

View File

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

View File

@ -325,7 +325,7 @@ static void test_loadlibraryshim(void)
GetModuleFileNameA(hdll, dllpath, MAX_PATH);
todo_wine ok(StrStrIA(dllpath, "v1.1.4322") != 0, "incorrect fusion.dll path %s\n", dllpath);
ok(StrStrIA(dllpath, "v1.1.4322") != 0, "incorrect fusion.dll path %s\n", dllpath);
ok(StrStrIA(dllpath, "fusion.dll") != 0, "incorrect fusion.dll path %s\n", dllpath);
FreeLibrary(hdll);
@ -339,7 +339,7 @@ static void test_loadlibraryshim(void)
GetModuleFileNameA(hdll, dllpath, MAX_PATH);
todo_wine ok(StrStrIA(dllpath, "v2.0.50727") != 0, "incorrect fusion.dll path %s\n", dllpath);
ok(StrStrIA(dllpath, "v2.0.50727") != 0, "incorrect fusion.dll path %s\n", dllpath);
ok(StrStrIA(dllpath, "fusion.dll") != 0, "incorrect fusion.dll path %s\n", dllpath);
FreeLibrary(hdll);
@ -355,7 +355,7 @@ static void test_loadlibraryshim(void)
GetModuleFileNameA(hdll, dllpath, MAX_PATH);
todo_wine ok(StrStrIA(dllpath, "v4.0.30319") != 0, "incorrect fusion.dll path %s\n", dllpath);
ok(StrStrIA(dllpath, "v4.0.30319") != 0, "incorrect fusion.dll path %s\n", dllpath);
ok(StrStrIA(dllpath, "fusion.dll") != 0, "incorrect fusion.dll path %s\n", dllpath);
FreeLibrary(hdll);
@ -375,7 +375,7 @@ static void test_loadlibraryshim(void)
GetModuleFileNameA(hdll, dllpath, MAX_PATH);
if (latest)
todo_wine ok(StrStrIA(dllpath, latestA) != 0, "incorrect fusion.dll path %s\n", dllpath);
ok(StrStrIA(dllpath, latestA) != 0, "incorrect fusion.dll path %s\n", dllpath);
ok(StrStrIA(dllpath, "fusion.dll") != 0, "incorrect fusion.dll path %s\n", dllpath);
FreeLibrary(hdll);
@ -388,7 +388,7 @@ static void test_loadlibraryshim(void)
GetModuleFileNameA(hdll, dllpath, MAX_PATH);
if (latest)
todo_wine ok(StrStrIA(dllpath, latestA) != 0, "incorrect fusion.dll path %s\n", dllpath);
ok(StrStrIA(dllpath, latestA) != 0, "incorrect fusion.dll path %s\n", dllpath);
ok(StrStrIA(dllpath, "fusion.dll") != 0, "incorrect fusion.dll path %s\n", dllpath);
FreeLibrary(hdll);