scrrun: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-06-20 09:09:09 +02:00
parent 43b7995a0d
commit 107f54eff7
4 changed files with 40 additions and 44 deletions

View File

@ -1,6 +1,8 @@
MODULE = scrrun.dll MODULE = scrrun.dll
IMPORTS = uuid oleaut32 version advapi32 IMPORTS = uuid oleaut32 version advapi32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
dictionary.c \ dictionary.c \
filesystem.c \ filesystem.c \

View File

@ -18,10 +18,8 @@
*/ */
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include <math.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
@ -32,7 +30,6 @@
#include "scrrun_private.h" #include "scrrun_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
@ -125,7 +122,7 @@ static inline int strcmp_key(const dictionary *dict, const VARIANT *key1, const
str1 = get_key_strptr(key1); str1 = get_key_strptr(key1);
str2 = get_key_strptr(key2); str2 = get_key_strptr(key2);
return dict->method == BinaryCompare ? strcmpW(str1, str2) : strcmpiW(str1, str2); return dict->method == BinaryCompare ? wcscmp(str1, str2) : wcsicmp(str1, str2);
} }
static BOOL is_matching_key(const dictionary *dict, const struct keyitem_pair *pair, const VARIANT *key, DWORD hash) static BOOL is_matching_key(const dictionary *dict, const struct keyitem_pair *pair, const VARIANT *key, DWORD hash)
@ -754,7 +751,7 @@ static DWORD get_str_hash(const WCHAR *str, CompareMethod method)
while (*str) { while (*str) {
WCHAR ch; WCHAR ch;
ch = (method == TextCompare || method == DatabaseCompare) ? tolowerW(*str) : *str; ch = (method == TextCompare || method == DatabaseCompare) ? towlower(*str) : *str;
hash += (hash << 4) + ch; hash += (hash << 4) + ch;
str++; str++;

View File

@ -18,7 +18,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include <limits.h> #include <limits.h>
@ -32,7 +31,6 @@
#include "scrrun_private.h" #include "scrrun_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/heap.h" #include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(scrrun); WINE_DEFAULT_DEBUG_CHANNEL(scrrun);
@ -205,8 +203,8 @@ static inline BOOL is_dir_data(const WIN32_FIND_DATAW *data)
static const WCHAR dotW[] = {'.',0}; static const WCHAR dotW[] = {'.',0};
return (data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && return (data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
strcmpW(data->cFileName, dotdotW) && wcscmp(data->cFileName, dotdotW) &&
strcmpW(data->cFileName, dotW); wcscmp(data->cFileName, dotW);
} }
static inline BOOL is_file_data(const WIN32_FIND_DATAW *data) static inline BOOL is_file_data(const WIN32_FIND_DATAW *data)
@ -219,10 +217,10 @@ static BSTR get_full_path(BSTR path, const WIN32_FIND_DATAW *data)
int len = SysStringLen(path); int len = SysStringLen(path);
WCHAR buffW[MAX_PATH]; WCHAR buffW[MAX_PATH];
strcpyW(buffW, path); lstrcpyW(buffW, path);
if (path[len-1] != '\\') if (path[len-1] != '\\')
strcatW(buffW, bsW); lstrcatW(buffW, bsW);
strcatW(buffW, data->cFileName); lstrcatW(buffW, data->cFileName);
return SysAllocString(buffW); return SysAllocString(buffW);
} }
@ -1165,11 +1163,11 @@ static HANDLE start_enumeration(const WCHAR *path, WIN32_FIND_DATAW *data, BOOL
int len; int len;
HANDLE handle; HANDLE handle;
strcpyW(pathW, path); lstrcpyW(pathW, path);
len = strlenW(pathW); len = lstrlenW(pathW);
if (len && pathW[len-1] != '\\') if (len && pathW[len-1] != '\\')
strcatW(pathW, bsW); lstrcatW(pathW, bsW);
strcatW(pathW, allW); lstrcatW(pathW, allW);
handle = FindFirstFileW(pathW, data); handle = FindFirstFileW(pathW, data);
if (handle == INVALID_HANDLE_VALUE) return 0; if (handle == INVALID_HANDLE_VALUE) return 0;
@ -1738,8 +1736,8 @@ static HRESULT WINAPI foldercoll_get_Count(IFolderCollection *iface, LONG *count
*count = 0; *count = 0;
strcpyW(pathW, This->path); lstrcpyW(pathW, This->path);
strcatW(pathW, allW); lstrcatW(pathW, allW);
handle = FindFirstFileW(pathW, &data); handle = FindFirstFileW(pathW, &data);
if (handle == INVALID_HANDLE_VALUE) if (handle == INVALID_HANDLE_VALUE)
return HRESULT_FROM_WIN32(GetLastError()); return HRESULT_FROM_WIN32(GetLastError());
@ -1933,8 +1931,8 @@ static HRESULT WINAPI filecoll_get_Count(IFileCollection *iface, LONG *count)
*count = 0; *count = 0;
strcpyW(pathW, This->path); lstrcpyW(pathW, This->path);
strcatW(pathW, allW); lstrcatW(pathW, allW);
handle = FindFirstFileW(pathW, &data); handle = FindFirstFileW(pathW, &data);
if (handle == INVALID_HANDLE_VALUE) if (handle == INVALID_HANDLE_VALUE)
return HRESULT_FROM_WIN32(GetLastError()); return HRESULT_FROM_WIN32(GetLastError());
@ -2287,7 +2285,7 @@ static HRESULT WINAPI folder_get_Name(IFolder *iface, BSTR *name)
*name = NULL; *name = NULL;
ptr = strrchrW(This->path, '\\'); ptr = wcsrchr(This->path, '\\');
if (ptr) if (ptr)
{ {
*name = SysAllocString(ptr+1); *name = SysAllocString(ptr+1);
@ -2637,7 +2635,7 @@ static HRESULT WINAPI file_get_Name(IFile *iface, BSTR *name)
*name = NULL; *name = NULL;
ptr = strrchrW(This->path, '\\'); ptr = wcsrchr(This->path, '\\');
if (ptr) if (ptr)
{ {
*name = SysAllocString(ptr+1); *name = SysAllocString(ptr+1);
@ -3031,9 +3029,9 @@ static HRESULT WINAPI filesys_BuildPath(IFileSystem3 *iface, BSTR Path,
ret = SysAllocStringLen(NULL, path_len + name_len); ret = SysAllocStringLen(NULL, path_len + name_len);
if (ret) if (ret)
{ {
strcpyW(ret, Path); lstrcpyW(ret, Path);
ret[path_len] = 0; ret[path_len] = 0;
strcatW(ret, Name); lstrcatW(ret, Name);
} }
} }
else if (Path[path_len-1] != '\\' && Name[0] != '\\') else if (Path[path_len-1] != '\\' && Name[0] != '\\')
@ -3041,10 +3039,10 @@ static HRESULT WINAPI filesys_BuildPath(IFileSystem3 *iface, BSTR Path,
ret = SysAllocStringLen(NULL, path_len + name_len + 1); ret = SysAllocStringLen(NULL, path_len + name_len + 1);
if (ret) if (ret)
{ {
strcpyW(ret, Path); lstrcpyW(ret, Path);
if (Path[path_len-1] != ':') if (Path[path_len-1] != ':')
strcatW(ret, bsW); lstrcatW(ret, bsW);
strcatW(ret, Name); lstrcatW(ret, Name);
} }
} }
else else
@ -3052,8 +3050,8 @@ static HRESULT WINAPI filesys_BuildPath(IFileSystem3 *iface, BSTR Path,
ret = SysAllocStringLen(NULL, path_len + name_len); ret = SysAllocStringLen(NULL, path_len + name_len);
if (ret) if (ret)
{ {
strcpyW(ret, Path); lstrcpyW(ret, Path);
strcatW(ret, Name); lstrcatW(ret, Name);
} }
} }
} }
@ -3077,7 +3075,7 @@ static HRESULT WINAPI filesys_GetDriveName(IFileSystem3 *iface, BSTR path, BSTR
*drive = NULL; *drive = NULL;
if (path && strlenW(path) > 1 && path[1] == ':') if (path && lstrlenW(path) > 1 && path[1] == ':')
*drive = SysAllocStringLen(path, 2); *drive = SysAllocStringLen(path, 2);
return S_OK; return S_OK;
@ -3147,7 +3145,7 @@ static HRESULT WINAPI filesys_GetFileName(IFileSystem3 *iface, BSTR Path,
return S_OK; return S_OK;
} }
for(end=strlenW(Path)-1; end>=0; end--) for(end=lstrlenW(Path)-1; end>=0; end--)
if(Path[end]!='/' && Path[end]!='\\') if(Path[end]!='/' && Path[end]!='\\')
break; break;
@ -3182,7 +3180,7 @@ static HRESULT WINAPI filesys_GetBaseName(IFileSystem3 *iface, BSTR Path,
return S_OK; return S_OK;
} }
for(end=strlenW(Path)-1; end>=0; end--) for(end=lstrlenW(Path)-1; end>=0; end--)
if(Path[end]!='/' && Path[end]!='\\') if(Path[end]!='/' && Path[end]!='\\')
break; break;
@ -3252,7 +3250,7 @@ static HRESULT WINAPI filesys_GetAbsolutePathName(IFileSystem3 *iface, BSTR Path
if(!len) if(!len)
return E_FAIL; return E_FAIL;
buf[0] = toupperW(buf[0]); buf[0] = towupper(buf[0]);
if(len>3 && buf[len-1] == '\\') if(len>3 && buf[len-1] == '\\')
buf[--len] = 0; buf[--len] = 0;
@ -3266,7 +3264,7 @@ static HRESULT WINAPI filesys_GetAbsolutePathName(IFileSystem3 *iface, BSTR Path
if(fh == INVALID_HANDLE_VALUE) if(fh == INVALID_HANDLE_VALUE)
break; break;
exp_len = strlenW(fdata.cFileName); exp_len = lstrlenW(fdata.cFileName);
if(exp_len == i-beg) if(exp_len == i-beg)
memcpy(buf+beg, fdata.cFileName, exp_len*sizeof(WCHAR)); memcpy(buf+beg, fdata.cFileName, exp_len*sizeof(WCHAR));
FindClose(fh); FindClose(fh);
@ -3297,7 +3295,7 @@ static HRESULT WINAPI filesys_GetTempName(IFileSystem3 *iface, BSTR *pbstrResult
if(!RtlGenRandom(&random, sizeof(random))) if(!RtlGenRandom(&random, sizeof(random)))
return E_FAIL; return E_FAIL;
sprintfW(*pbstrResult, fmt, random & 0xfffff); swprintf(*pbstrResult, 12, fmt, random & 0xfffff);
return S_OK; return S_OK;
} }
@ -3314,7 +3312,7 @@ static HRESULT WINAPI filesys_DriveExists(IFileSystem3 *iface, BSTR DriveSpec,
len = SysStringLen(DriveSpec); len = SysStringLen(DriveSpec);
if (len >= 1) { if (len >= 1) {
driveletter = toupperW(DriveSpec[0]); driveletter = towupper(DriveSpec[0]);
if (driveletter >= 'A' && driveletter <= 'Z' if (driveletter >= 'A' && driveletter <= 'Z'
&& (len < 2 || DriveSpec[1] == ':') && (len < 2 || DriveSpec[1] == ':')
&& (len < 3 || DriveSpec[2] == '\\')) { && (len < 3 || DriveSpec[2] == '\\')) {
@ -3372,7 +3370,7 @@ static HRESULT WINAPI filesys_GetDrive(IFileSystem3 *iface, BSTR DriveSpec,
if (!len) if (!len)
return E_INVALIDARG; return E_INVALIDARG;
else if (len <= 3) { else if (len <= 3) {
driveletter = toupperW(DriveSpec[0]); driveletter = towupper(DriveSpec[0]);
if (driveletter < 'A' || driveletter > 'Z' if (driveletter < 'A' || driveletter > 'Z'
|| (len >= 2 && DriveSpec[1] != ':') || (len >= 2 && DriveSpec[1] != ':')
|| (len == 3 && DriveSpec[2] != '\\')) || (len == 3 && DriveSpec[2] != '\\'))
@ -3489,7 +3487,7 @@ static inline HRESULT delete_file(const WCHAR *file, DWORD file_len, VARIANT_BOO
if(ffd.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE)) if(ffd.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE))
continue; continue;
name_len = strlenW(ffd.cFileName); name_len = lstrlenW(ffd.cFileName);
if(len+name_len+1 >= MAX_PATH) { if(len+name_len+1 >= MAX_PATH) {
FindClose(f); FindClose(f);
return E_FAIL; return E_FAIL;
@ -3551,7 +3549,7 @@ static HRESULT delete_folder(const WCHAR *folder, DWORD folder_len, VARIANT_BOOL
(ffd.cFileName[1]=='.' && ffd.cFileName[2]==0))) (ffd.cFileName[1]=='.' && ffd.cFileName[2]==0)))
continue; continue;
name_len = strlenW(ffd.cFileName); name_len = lstrlenW(ffd.cFileName);
if(len+name_len+3 >= MAX_PATH) { if(len+name_len+3 >= MAX_PATH) {
FindClose(f); FindClose(f);
return E_FAIL; return E_FAIL;
@ -3667,7 +3665,7 @@ static inline HRESULT copy_file(const WCHAR *source, DWORD source_len,
if(ffd.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE)) if(ffd.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE))
continue; continue;
name_len = strlenW(ffd.cFileName); name_len = lstrlenW(ffd.cFileName);
if(src_len+name_len+1>=MAX_PATH || dst_len+name_len+1>=MAX_PATH) { if(src_len+name_len+1>=MAX_PATH || dst_len+name_len+1>=MAX_PATH) {
FindClose(f); FindClose(f);
return E_FAIL; return E_FAIL;
@ -3769,7 +3767,7 @@ static HRESULT copy_folder(const WCHAR *source, DWORD source_len, const WCHAR *d
(ffd.cFileName[1]=='.' && ffd.cFileName[2]==0))) (ffd.cFileName[1]=='.' && ffd.cFileName[2]==0)))
continue; continue;
name_len = strlenW(ffd.cFileName); name_len = lstrlenW(ffd.cFileName);
if(dst_len+name_len>=MAX_PATH || src_len+name_len+2>=MAX_PATH) { if(dst_len+name_len>=MAX_PATH || src_len+name_len+2>=MAX_PATH) {
FindClose(f); FindClose(f);
return E_FAIL; return E_FAIL;
@ -3895,7 +3893,7 @@ static void get_versionstring(VS_FIXEDFILEINFO *info, WCHAR *ver)
c = (WORD)((version >> 16) & 0xffff); c = (WORD)((version >> 16) & 0xffff);
d = (WORD)( version & 0xffff); d = (WORD)( version & 0xffff);
sprintfW(ver, fmtW, a, b, c, d); swprintf(ver, 30, fmtW, a, b, c, d);
} }
static HRESULT WINAPI filesys_GetFileVersion(IFileSystem3 *iface, BSTR name, BSTR *version) static HRESULT WINAPI filesys_GetFileVersion(IFileSystem3 *iface, BSTR name, BSTR *version)

View File

@ -17,7 +17,6 @@
*/ */
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"