wintrust: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-06-27 09:08:07 +02:00
parent 57d5db5d64
commit 8a281038af
4 changed files with 27 additions and 31 deletions

View File

@ -3,6 +3,8 @@ IMPORTLIB = wintrust
IMPORTS = crypt32 user32 advapi32 IMPORTS = crypt32 user32 advapi32
DELAYIMPORTS = cryptui imagehlp DELAYIMPORTS = cryptui imagehlp
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
asn.c \ asn.c \
crypt.c \ crypt.c \

View File

@ -18,9 +18,6 @@
* *
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>

View File

@ -33,7 +33,6 @@
#include "winternl.h" #include "winternl.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(wintrust); WINE_DEFAULT_DEBUG_CHANNEL(wintrust);
@ -75,7 +74,7 @@ static HCATINFO create_catinfo(const WCHAR *filename)
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
strcpyW(ci->file, filename); lstrcpyW(ci->file, filename);
ci->magic = CATINFO_MAGIC; ci->magic = CATINFO_MAGIC;
return ci; return ci;
} }
@ -125,13 +124,13 @@ BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin,
} }
GetSystemDirectoryW(catroot_dir, MAX_PATH); GetSystemDirectoryW(catroot_dir, MAX_PATH);
strcatW(catroot_dir, catroot); lstrcatW(catroot_dir, catroot);
/* create the directory if it doesn't exist */ /* create the directory if it doesn't exist */
CreateDirectoryW(catroot_dir, NULL); CreateDirectoryW(catroot_dir, NULL);
if (!sys) sys = &defsys; if (!sys) sys = &defsys;
sprintfW(ca->path, fmt, catroot_dir, sys->Data1, sys->Data2, swprintf(ca->path, ARRAY_SIZE(ca->path), fmt, catroot_dir, sys->Data1, sys->Data2,
sys->Data3, sys->Data4[0], sys->Data4[1], sys->Data4[2], sys->Data3, sys->Data4[0], sys->Data4[1], sys->Data4[2],
sys->Data4[3], sys->Data4[4], sys->Data4[5], sys->Data4[6], sys->Data4[3], sys->Data4[4], sys->Data4[5], sys->Data4[6],
sys->Data4[7]); sys->Data4[7]);
@ -184,15 +183,15 @@ HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile,
return NULL; return NULL;
} }
len = strlenW(ca->path) + strlenW(selectBaseName) + 2; len = lstrlenW(ca->path) + lstrlenW(selectBaseName) + 2;
if (!(target = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) if (!(target = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return NULL; return NULL;
} }
strcpyW(target, ca->path); lstrcpyW(target, ca->path);
strcatW(target, slashW); lstrcatW(target, slashW);
strcatW(target, selectBaseName); lstrcatW(target, selectBaseName);
if (!CopyFileW(catalogFile, target, FALSE)) if (!CopyFileW(catalogFile, target, FALSE))
{ {
@ -208,7 +207,7 @@ HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile,
return NULL; return NULL;
} }
ci->magic = CATINFO_MAGIC; ci->magic = CATINFO_MAGIC;
strcpyW(ci->file, target); lstrcpyW(ci->file, target);
HeapFree(GetProcessHeap(), 0, target); HeapFree(GetProcessHeap(), 0, target);
return ci; return ci;
@ -308,15 +307,15 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin, BYTE* pbHa
{ {
WCHAR *path; WCHAR *path;
size = strlenW(ca->path) * sizeof(WCHAR) + sizeof(globW); size = lstrlenW(ca->path) * sizeof(WCHAR) + sizeof(globW);
if (!(path = HeapAlloc(GetProcessHeap(), 0, size))) if (!(path = HeapAlloc(GetProcessHeap(), 0, size)))
{ {
CryptReleaseContext(prov, 0); CryptReleaseContext(prov, 0);
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return NULL; return NULL;
} }
strcpyW(path, ca->path); lstrcpyW(path, ca->path);
strcatW(path, globW); lstrcatW(path, globW);
FindClose(ca->find); FindClose(ca->find);
ca->find = FindFirstFileW(path, &data); ca->find = FindFirstFileW(path, &data);
@ -342,15 +341,15 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin, BYTE* pbHa
struct catinfo *ci; struct catinfo *ci;
HANDLE hcat; HANDLE hcat;
size = (strlenW(ca->path) + strlenW(data.cFileName) + 2) * sizeof(WCHAR); size = (lstrlenW(ca->path) + lstrlenW(data.cFileName) + 2) * sizeof(WCHAR);
if (!(filename = HeapAlloc(GetProcessHeap(), 0, size))) if (!(filename = HeapAlloc(GetProcessHeap(), 0, size)))
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return NULL; return NULL;
} }
strcpyW(filename, ca->path); lstrcpyW(filename, ca->path);
strcatW(filename, slashW); lstrcatW(filename, slashW);
strcatW(filename, data.cFileName); lstrcatW(filename, data.cFileName);
hcat = CryptCATOpen(filename, CRYPTCAT_OPEN_EXISTING, prov, 0, 0); hcat = CryptCATOpen(filename, CRYPTCAT_OPEN_EXISTING, prov, 0, 0);
if (hcat == INVALID_HANDLE_VALUE) if (hcat == INVALID_HANDLE_VALUE)
@ -487,22 +486,22 @@ BOOL WINAPI CryptCATAdminRemoveCatalog(HCATADMIN hCatAdmin, LPCWSTR pwszCatalogF
/* Only delete when there is a filename and no path */ /* Only delete when there is a filename and no path */
if (pwszCatalogFile && pwszCatalogFile[0] != 0 && if (pwszCatalogFile && pwszCatalogFile[0] != 0 &&
!strchrW(pwszCatalogFile, '\\') && !strchrW(pwszCatalogFile, '/') && !wcschr(pwszCatalogFile, '\\') && !wcschr(pwszCatalogFile, '/') &&
!strchrW(pwszCatalogFile, ':')) !wcschr(pwszCatalogFile, ':'))
{ {
static const WCHAR slashW[] = {'\\',0}; static const WCHAR slashW[] = {'\\',0};
WCHAR *target; WCHAR *target;
DWORD len; DWORD len;
len = strlenW(ca->path) + strlenW(pwszCatalogFile) + 2; len = lstrlenW(ca->path) + lstrlenW(pwszCatalogFile) + 2;
if (!(target = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) if (!(target = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return FALSE; return FALSE;
} }
strcpyW(target, ca->path); lstrcpyW(target, ca->path);
strcatW(target, slashW); lstrcatW(target, slashW);
strcatW(target, pwszCatalogFile); lstrcatW(target, pwszCatalogFile);
DeleteFileW(target); DeleteFileW(target);
@ -528,9 +527,9 @@ BOOL WINAPI CryptCATAdminResolveCatalogPath(HCATADMIN hcatadmin, WCHAR *catalog_
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
strcpyW(info->wszCatalogFile, ca->path); lstrcpyW(info->wszCatalogFile, ca->path);
strcatW(info->wszCatalogFile, slashW); lstrcatW(info->wszCatalogFile, slashW);
strcatW(info->wszCatalogFile, catalog_file); lstrcatW(info->wszCatalogFile, catalog_file);
return TRUE; return TRUE;
} }
@ -845,7 +844,7 @@ BOOL WINAPI CryptCATCatalogInfoFromContext(HCATINFO hcatinfo, CATALOG_INFO *info
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
strcpyW(info->wszCatalogFile, ci->file); lstrcpyW(info->wszCatalogFile, ci->file);
return TRUE; return TRUE;
} }

View File

@ -17,8 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#define NONAMELESSUNION #define NONAMELESSUNION