cryptdlg: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-05-29 08:53:11 +02:00
parent bf1bebc3a8
commit 3817304343
2 changed files with 93 additions and 94 deletions

View File

@ -1,6 +1,8 @@
MODULE = cryptdlg.dll MODULE = cryptdlg.dll
IMPORTS = cryptui crypt32 wintrust user32 advapi32 IMPORTS = cryptui crypt32 wintrust user32 advapi32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
main.c main.c

View File

@ -18,8 +18,6 @@
#define NONAMELESSUNION #define NONAMELESSUNION
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
@ -33,7 +31,6 @@
#include "cryptdlg.h" #include "cryptdlg.h"
#include "cryptuiapi.h" #include "cryptuiapi.h"
#include "cryptres.h" #include "cryptres.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(cryptdlg); WINE_DEFAULT_DEBUG_CHANNEL(cryptdlg);
@ -501,9 +498,9 @@ static BOOL CRYPT_FormatHexString(const BYTE *pbEncoded, DWORD cbEncoded,
for (i = 0; i < cbEncoded; i++) for (i = 0; i < cbEncoded; i++)
{ {
if (i < cbEncoded - 1) if (i < cbEncoded - 1)
ptr += sprintfW(ptr, fmt, pbEncoded[i]); ptr += swprintf(ptr, 4, fmt, pbEncoded[i]);
else else
ptr += sprintfW(ptr, endFmt, pbEncoded[i]); ptr += swprintf(ptr, 3, endFmt, pbEncoded[i]);
} }
} }
else else
@ -538,31 +535,31 @@ static BOOL CRYPT_FormatCPS(DWORD dwCertEncodingType,
else else
sep = commaSep; sep = commaSep;
sepLen = strlenW(sep); sepLen = lstrlenW(sep);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
charsNeeded += 3 * strlenW(indent); charsNeeded += 3 * lstrlenW(indent);
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
} }
charsNeeded += cpsValue->Value.cbData / sizeof(WCHAR); charsNeeded += cpsValue->Value.cbData / sizeof(WCHAR);
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, (LPWSTR)cpsValue->Value.pbData); lstrcpyW(str, (LPWSTR)cpsValue->Value.pbData);
str += cpsValue->Value.cbData / sizeof(WCHAR); str += cpsValue->Value.cbData / sizeof(WCHAR);
} }
charsNeeded += sepLen; charsNeeded += sepLen;
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen; str += sepLen;
} }
LocalFree(cpsValue); LocalFree(cpsValue);
@ -619,8 +616,8 @@ static BOOL CRYPT_FormatUserNotice(DWORD dwCertEncodingType,
headingSep = colonSpace; headingSep = colonSpace;
sep = commaSep; sep = commaSep;
} }
sepLen = strlenW(sep); sepLen = lstrlenW(sep);
headingSepLen = strlenW(headingSep); headingSepLen = lstrlenW(headingSep);
if (pNoticeRef) if (pNoticeRef)
{ {
@ -629,15 +626,15 @@ static BOOL CRYPT_FormatUserNotice(DWORD dwCertEncodingType,
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
charsNeeded += 3 * strlenW(indent); charsNeeded += 3 * lstrlenW(indent);
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
} }
charsNeeded += noticeRefLen; charsNeeded += noticeRefLen;
@ -649,22 +646,22 @@ static BOOL CRYPT_FormatUserNotice(DWORD dwCertEncodingType,
charsNeeded += headingSepLen; charsNeeded += headingSepLen;
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, headingSep); lstrcpyW(str, headingSep);
str += headingSepLen; str += headingSepLen;
} }
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
charsNeeded += 4 * strlenW(indent); charsNeeded += 4 * lstrlenW(indent);
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
} }
charsNeeded += organizationLen; charsNeeded += organizationLen;
@ -681,24 +678,24 @@ static BOOL CRYPT_FormatUserNotice(DWORD dwCertEncodingType,
charsNeeded += sepLen; charsNeeded += sepLen;
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen; str += sepLen;
} }
for (k = 0; k < pNoticeRef->cNoticeNumbers; k++) for (k = 0; k < pNoticeRef->cNoticeNumbers; k++)
{ {
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
charsNeeded += 4 * strlenW(indent); charsNeeded += 4 * lstrlenW(indent);
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
} }
charsNeeded += noticeNumLen; charsNeeded += noticeNumLen;
@ -707,17 +704,17 @@ static BOOL CRYPT_FormatUserNotice(DWORD dwCertEncodingType,
memcpy(str, noticeNum, noticeNumLen * sizeof(WCHAR)); memcpy(str, noticeNum, noticeNumLen * sizeof(WCHAR));
str += noticeNumLen; str += noticeNumLen;
} }
sprintfW(noticeNumStr, numFmt, k + 1); swprintf(noticeNumStr, ARRAY_SIZE(noticeNumStr), numFmt, k + 1);
charsNeeded += strlenW(noticeNumStr); charsNeeded += lstrlenW(noticeNumStr);
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, noticeNumStr); lstrcpyW(str, noticeNumStr);
str += strlenW(noticeNumStr); str += lstrlenW(noticeNumStr);
} }
charsNeeded += sepLen; charsNeeded += sepLen;
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen; str += sepLen;
} }
} }
@ -726,15 +723,15 @@ static BOOL CRYPT_FormatUserNotice(DWORD dwCertEncodingType,
{ {
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
charsNeeded += 3 * strlenW(indent); charsNeeded += 3 * lstrlenW(indent);
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
} }
charsNeeded += noticeTextLen; charsNeeded += noticeTextLen;
@ -743,16 +740,16 @@ static BOOL CRYPT_FormatUserNotice(DWORD dwCertEncodingType,
memcpy(str, noticeText, noticeTextLen * sizeof(WCHAR)); memcpy(str, noticeText, noticeTextLen * sizeof(WCHAR));
str += noticeTextLen; str += noticeTextLen;
} }
charsNeeded += strlenW(notice->pszDisplayText); charsNeeded += lstrlenW(notice->pszDisplayText);
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, notice->pszDisplayText); lstrcpyW(str, notice->pszDisplayText);
str += strlenW(notice->pszDisplayText); str += lstrlenW(notice->pszDisplayText);
} }
charsNeeded += sepLen; charsNeeded += sepLen;
if (str && *pcchStr >= charsNeeded) if (str && *pcchStr >= charsNeeded)
{ {
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen; str += sepLen;
} }
} }
@ -826,8 +823,8 @@ BOOL WINAPI FormatVerisignExtension(DWORD dwCertEncodingType,
headingSep = colonSpace; headingSep = colonSpace;
sep = commaSep; sep = commaSep;
} }
sepLen = strlenW(sep); sepLen = lstrlenW(sep);
headingSepLen = strlenW(headingSep); headingSepLen = lstrlenW(headingSep);
for (i = 0; ret && i < policies->cPolicyInfo; i++) for (i = 0; ret && i < policies->cPolicyInfo; i++)
{ {
@ -838,12 +835,12 @@ BOOL WINAPI FormatVerisignExtension(DWORD dwCertEncodingType,
charsNeeded += 1; /* '['*/ charsNeeded += 1; /* '['*/
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
*str++ = '['; *str++ = '[';
sprintfW(policyNum, numFmt, i + 1); swprintf(policyNum, ARRAY_SIZE(policyNum), numFmt, i + 1);
charsNeeded += strlenW(policyNum); charsNeeded += lstrlenW(policyNum);
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, policyNum); lstrcpyW(str, policyNum);
str += strlenW(policyNum); str += lstrlenW(policyNum);
} }
charsNeeded += 1; /* ']'*/ charsNeeded += 1; /* ']'*/
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
@ -857,16 +854,16 @@ BOOL WINAPI FormatVerisignExtension(DWORD dwCertEncodingType,
charsNeeded += headingSepLen; charsNeeded += headingSepLen;
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, headingSep); lstrcpyW(str, headingSep);
str += headingSepLen; str += headingSepLen;
} }
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
charsNeeded += strlenW(indent); charsNeeded += lstrlenW(indent);
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
} }
charsNeeded += policyIdLen; charsNeeded += policyIdLen;
@ -885,7 +882,7 @@ BOOL WINAPI FormatVerisignExtension(DWORD dwCertEncodingType,
charsNeeded += sepLen; charsNeeded += sepLen;
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen; str += sepLen;
} }
for (j = 0; j < policy->cPolicyQualifier; j++) for (j = 0; j < policy->cPolicyQualifier; j++)
@ -896,31 +893,31 @@ BOOL WINAPI FormatVerisignExtension(DWORD dwCertEncodingType,
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
charsNeeded += strlenW(indent); charsNeeded += lstrlenW(indent);
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
} }
charsNeeded += 1; /* '['*/ charsNeeded += 1; /* '['*/
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
*str++ = '['; *str++ = '[';
charsNeeded += strlenW(policyNum); charsNeeded += lstrlenW(policyNum);
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, policyNum); lstrcpyW(str, policyNum);
str += strlenW(policyNum); str += lstrlenW(policyNum);
} }
charsNeeded += 1; /* ','*/ charsNeeded += 1; /* ','*/
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
*str++ = ','; *str++ = ',';
sprintfW(policyQualifierNum, numFmt, j + 1); swprintf(policyQualifierNum, ARRAY_SIZE(policyQualifierNum), numFmt, j + 1);
charsNeeded += strlenW(policyQualifierNum); charsNeeded += lstrlenW(policyQualifierNum);
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, policyQualifierNum); lstrcpyW(str, policyQualifierNum);
str += strlenW(policyQualifierNum); str += lstrlenW(policyQualifierNum);
} }
charsNeeded += 1; /* ']'*/ charsNeeded += 1; /* ']'*/
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
@ -935,18 +932,18 @@ BOOL WINAPI FormatVerisignExtension(DWORD dwCertEncodingType,
charsNeeded += headingSepLen; charsNeeded += headingSepLen;
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, headingSep); lstrcpyW(str, headingSep);
str += headingSepLen; str += headingSepLen;
} }
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
charsNeeded += 2 * strlenW(indent); charsNeeded += 2 * lstrlenW(indent);
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
} }
charsNeeded += policyQualifierIdLen; charsNeeded += policyQualifierIdLen;
@ -989,18 +986,18 @@ BOOL WINAPI FormatVerisignExtension(DWORD dwCertEncodingType,
charsNeeded += sepLen; charsNeeded += sepLen;
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen; str += sepLen;
} }
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
charsNeeded += 2 * strlenW(indent); charsNeeded += 2 * lstrlenW(indent);
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
} }
charsNeeded += qualifierLen; charsNeeded += qualifierLen;
@ -1012,7 +1009,7 @@ BOOL WINAPI FormatVerisignExtension(DWORD dwCertEncodingType,
charsNeeded += headingSepLen; charsNeeded += headingSepLen;
if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR)) if (str && *pcbFormat >= charsNeeded * sizeof(WCHAR))
{ {
strcpyW(str, headingSep); lstrcpyW(str, headingSep);
str += headingSepLen; str += headingSepLen;
} }
/* This if block is deliberately redundant with the same if /* This if block is deliberately redundant with the same if