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

This commit is contained in:
Amine Khaldi 2019-10-26 22:53:42 +01:00
parent 98ef8700d2
commit 2fdfd36ca5
2 changed files with 95 additions and 95 deletions

View file

@ -18,9 +18,10 @@
#define NONAMELESSUNION #define NONAMELESSUNION
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#ifdef __REACTOS__
#include <wchar.h>
#endif
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
@ -33,7 +34,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 +501,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, fmt, pbEncoded[i]);
else else
ptr += sprintfW(ptr, endFmt, pbEncoded[i]); ptr += swprintf(ptr, endFmt, pbEncoded[i]);
} }
} }
else else
@ -538,31 +538,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 +619,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 +629,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 +649,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 +681,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 +707,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, 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 +726,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 +743,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 +826,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 +838,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, 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 +857,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 +885,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 +896,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, 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 +935,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 +989,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 +1012,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

View file

@ -60,7 +60,7 @@ dll/win32/comdlg32 # Synced to WineStaging-4.18
dll/win32/compstui # Synced to WineStaging-4.18 dll/win32/compstui # Synced to WineStaging-4.18
dll/win32/credui # Synced to WineStaging-4.18 dll/win32/credui # Synced to WineStaging-4.18
dll/win32/crypt32 # Synced to WineStaging-4.0 dll/win32/crypt32 # Synced to WineStaging-4.0
dll/win32/cryptdlg # Synced to WineStaging-3.3 dll/win32/cryptdlg # Synced to WineStaging-4.18
dll/win32/cryptdll # Synced to WineStaging-3.3 dll/win32/cryptdll # Synced to WineStaging-3.3
dll/win32/cryptnet # Synced to WineStaging-3.3 dll/win32/cryptnet # Synced to WineStaging-3.3
dll/win32/cryptui # Synced to WineStaging-4.0 dll/win32/cryptui # Synced to WineStaging-4.0