Commit 03bf2369 authored by Alexandre Julliard's avatar Alexandre Julliard

crypt32: Build with msvcrt.

parent bd59aa6d
...@@ -6,6 +6,8 @@ DELAYIMPORTS = cryptnet ...@@ -6,6 +6,8 @@ DELAYIMPORTS = cryptnet
EXTRALIBS = $(SECURITY_LIBS) EXTRALIBS = $(SECURITY_LIBS)
EXTRAINCL = $(GNUTLS_CFLAGS) EXTRAINCL = $(GNUTLS_CFLAGS)
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
base64.c \ base64.c \
cert.c \ cert.c \
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "winerror.h" #include "winerror.h"
#include "wincrypt.h" #include "wincrypt.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt); WINE_DEFAULT_DEBUG_CHANNEL(crypt);
...@@ -331,7 +330,7 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep, ...@@ -331,7 +330,7 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep,
TRACE("bytes is %d, pad bytes is %d\n", bytes, pad_bytes); TRACE("bytes is %d, pad bytes is %d\n", bytes, pad_bytes);
needed = bytes + pad_bytes; needed = bytes + pad_bytes;
needed += (needed / 64 + (needed % 64 ? 1 : 0)) * strlenW(sep); needed += (needed / 64 + (needed % 64 ? 1 : 0)) * lstrlenW(sep);
needed++; needed++;
if (needed > *out_len) if (needed > *out_len)
...@@ -351,8 +350,8 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep, ...@@ -351,8 +350,8 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep,
{ {
if (i && i % 64 == 0) if (i && i % 64 == 0)
{ {
strcpyW(ptr, sep); lstrcpyW(ptr, sep);
ptr += strlenW(sep); ptr += lstrlenW(sep);
} }
/* first char is the first 6 bits of the first byte*/ /* first char is the first 6 bits of the first byte*/
*ptr++ = b64[ ( d[0] >> 2) & 0x3f ]; *ptr++ = b64[ ( d[0] >> 2) & 0x3f ];
...@@ -395,7 +394,7 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep, ...@@ -395,7 +394,7 @@ static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep,
*ptr++ = '='; *ptr++ = '=';
break; break;
} }
strcpyW(ptr, sep); lstrcpyW(ptr, sep);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -436,9 +435,9 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary, ...@@ -436,9 +435,9 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary,
charsNeeded = 0; charsNeeded = 0;
encodeBase64W(pbBinary, cbBinary, sep, NULL, &charsNeeded); encodeBase64W(pbBinary, cbBinary, sep, NULL, &charsNeeded);
if (header) if (header)
charsNeeded += strlenW(header) + strlenW(sep); charsNeeded += lstrlenW(header) + lstrlenW(sep);
if (trailer) if (trailer)
charsNeeded += strlenW(trailer) + strlenW(sep); charsNeeded += lstrlenW(trailer) + lstrlenW(sep);
if (pszString) if (pszString)
{ {
...@@ -449,18 +448,18 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary, ...@@ -449,18 +448,18 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary,
if (header) if (header)
{ {
strcpyW(ptr, header); lstrcpyW(ptr, header);
ptr += strlenW(ptr); ptr += lstrlenW(ptr);
strcpyW(ptr, sep); lstrcpyW(ptr, sep);
ptr += strlenW(sep); ptr += lstrlenW(sep);
} }
encodeBase64W(pbBinary, cbBinary, sep, ptr, &size); encodeBase64W(pbBinary, cbBinary, sep, ptr, &size);
ptr += size - 1; ptr += size - 1;
if (trailer) if (trailer)
{ {
strcpyW(ptr, trailer); lstrcpyW(ptr, trailer);
ptr += strlenW(ptr); ptr += lstrlenW(ptr);
strcpyW(ptr, sep); lstrcpyW(ptr, sep);
} }
*pcchString = charsNeeded - 1; *pcchString = charsNeeded - 1;
} }
...@@ -912,27 +911,27 @@ static LONG Base64WithHeaderAndTrailerToBinaryW(LPCWSTR pszString, ...@@ -912,27 +911,27 @@ static LONG Base64WithHeaderAndTrailerToBinaryW(LPCWSTR pszString,
LPCWSTR trailerBegins; LPCWSTR trailerBegins;
size_t dataLength; size_t dataLength;
if ((strlenW(header) + strlenW(trailer)) > cchString) if ((lstrlenW(header) + lstrlenW(trailer)) > cchString)
{ {
return ERROR_INVALID_DATA; return ERROR_INVALID_DATA;
} }
if (!(headerBegins = strstrW(pszString, header))) if (!(headerBegins = wcsstr(pszString, header)))
{ {
TRACE("Can't find %s in %s.\n", debugstr_w(header), debugstr_wn(pszString, cchString)); TRACE("Can't find %s in %s.\n", debugstr_w(header), debugstr_wn(pszString, cchString));
return ERROR_INVALID_DATA; return ERROR_INVALID_DATA;
} }
dataBegins = headerBegins + strlenW(header); dataBegins = headerBegins + lstrlenW(header);
if (!(dataBegins = strstrW(dataBegins, CERT_DELIMITER_W))) if (!(dataBegins = wcsstr(dataBegins, CERT_DELIMITER_W)))
{ {
return ERROR_INVALID_DATA; return ERROR_INVALID_DATA;
} }
dataBegins += strlenW(CERT_DELIMITER_W); dataBegins += lstrlenW(CERT_DELIMITER_W);
if (*dataBegins == '\r') dataBegins++; if (*dataBegins == '\r') dataBegins++;
if (*dataBegins == '\n') dataBegins++; if (*dataBegins == '\n') dataBegins++;
if (!(trailerBegins = strstrW(dataBegins, trailer))) if (!(trailerBegins = wcsstr(dataBegins, trailer)))
{ {
return ERROR_INVALID_DATA; return ERROR_INVALID_DATA;
} }
...@@ -1091,7 +1090,7 @@ BOOL WINAPI CryptStringToBinaryW(LPCWSTR pszString, ...@@ -1091,7 +1090,7 @@ BOOL WINAPI CryptStringToBinaryW(LPCWSTR pszString,
return FALSE; return FALSE;
} }
if (!cchString) if (!cchString)
cchString = strlenW(pszString); cchString = lstrlenW(pszString);
ret = decoder(pszString, cchString, pbBinary, pcbBinary, pdwSkip, pdwFlags); ret = decoder(pszString, cchString, pbBinary, pcbBinary, pdwSkip, pdwFlags);
if (ret) if (ret)
SetLastError(ret); SetLastError(ret);
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "winnls.h" #include "winnls.h"
#include "rpc.h" #include "rpc.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "crypt32_private.h" #include "crypt32_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt); WINE_DEFAULT_DEBUG_CHANNEL(crypt);
...@@ -1125,10 +1124,10 @@ static BOOL container_matches_cert(PCCERT_CONTEXT pCert, LPCSTR container, ...@@ -1125,10 +1124,10 @@ static BOOL container_matches_cert(PCCERT_CONTEXT pCert, LPCSTR container,
if (matches) if (matches)
{ {
keyProvInfo->pwszContainerName = keyProvInfo->pwszContainerName =
CryptMemAlloc((strlenW(containerW) + 1) * sizeof(WCHAR)); CryptMemAlloc((lstrlenW(containerW) + 1) * sizeof(WCHAR));
if (keyProvInfo->pwszContainerName) if (keyProvInfo->pwszContainerName)
{ {
strcpyW(keyProvInfo->pwszContainerName, containerW); lstrcpyW(keyProvInfo->pwszContainerName, containerW);
keyProvInfo->dwKeySpec = AT_SIGNATURE; keyProvInfo->dwKeySpec = AT_SIGNATURE;
} }
else else
...@@ -1805,13 +1804,10 @@ static BOOL compare_cert_by_name_str(PCCERT_CONTEXT pCertContext, ...@@ -1805,13 +1804,10 @@ static BOOL compare_cert_by_name_str(PCCERT_CONTEXT pCertContext,
if (str) if (str)
{ {
LPWSTR ptr;
CertNameToStrW(pCertContext->dwCertEncodingType, name, CertNameToStrW(pCertContext->dwCertEncodingType, name,
CERT_SIMPLE_NAME_STR, str, len); CERT_SIMPLE_NAME_STR, str, len);
for (ptr = str; *ptr; ptr++) wcslwr(str);
*ptr = tolowerW(*ptr); if (wcsstr(str, pvPara))
if (strstrW(str, pvPara))
ret = TRUE; ret = TRUE;
CryptMemFree(str); CryptMemFree(str);
} }
...@@ -1833,11 +1829,8 @@ static PCCERT_CONTEXT find_cert_by_name_str_a(HCERTSTORE store, DWORD dwType, ...@@ -1833,11 +1829,8 @@ static PCCERT_CONTEXT find_cert_by_name_str_a(HCERTSTORE store, DWORD dwType,
if (str) if (str)
{ {
LPWSTR ptr;
MultiByteToWideChar(CP_ACP, 0, pvPara, -1, str, len); MultiByteToWideChar(CP_ACP, 0, pvPara, -1, str, len);
for (ptr = str; *ptr; ptr++) wcslwr(str);
*ptr = tolowerW(*ptr);
found = cert_compare_certs_in_store(store, prev, found = cert_compare_certs_in_store(store, prev,
compare_cert_by_name_str, dwType, dwFlags, str); compare_cert_by_name_str, dwType, dwFlags, str);
CryptMemFree(str); CryptMemFree(str);
...@@ -1857,17 +1850,13 @@ static PCCERT_CONTEXT find_cert_by_name_str_w(HCERTSTORE store, DWORD dwType, ...@@ -1857,17 +1850,13 @@ static PCCERT_CONTEXT find_cert_by_name_str_w(HCERTSTORE store, DWORD dwType,
if (pvPara) if (pvPara)
{ {
DWORD len = strlenW(pvPara); DWORD len = lstrlenW(pvPara);
LPWSTR str = CryptMemAlloc((len + 1) * sizeof(WCHAR)); LPWSTR str = CryptMemAlloc((len + 1) * sizeof(WCHAR));
if (str) if (str)
{ {
LPCWSTR src; wcscpy( str, pvPara );
LPWSTR dst; wcslwr( str );
for (src = pvPara, dst = str; *src; src++, dst++)
*dst = tolowerW(*src);
*dst = 0;
found = cert_compare_certs_in_store(store, prev, found = cert_compare_certs_in_store(store, prev,
compare_cert_by_name_str, dwType, dwFlags, str); compare_cert_by_name_str, dwType, dwFlags, str);
CryptMemFree(str); CryptMemFree(str);
...@@ -2216,10 +2205,10 @@ static BOOL find_matching_rdn_attr(DWORD dwFlags, const CERT_NAME_INFO *name, ...@@ -2216,10 +2205,10 @@ static BOOL find_matching_rdn_attr(DWORD dwFlags, const CERT_NAME_INFO *name,
name->rgRDN[i].rgRDNAttr[j].Value.cbData) name->rgRDN[i].rgRDNAttr[j].Value.cbData)
match = FALSE; match = FALSE;
else if (dwFlags & CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG) else if (dwFlags & CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG)
match = !strncmpiW(nameStr, attrStr, match = !wcsnicmp(nameStr, attrStr,
attr->Value.cbData / sizeof(WCHAR)); attr->Value.cbData / sizeof(WCHAR));
else else
match = !strncmpW(nameStr, attrStr, match = !wcsncmp(nameStr, attrStr,
attr->Value.cbData / sizeof(WCHAR)); attr->Value.cbData / sizeof(WCHAR));
TRACE("%s : %s => %d\n", TRACE("%s : %s => %d\n",
debugstr_wn(nameStr, attr->Value.cbData / sizeof(WCHAR)), debugstr_wn(nameStr, attr->Value.cbData / sizeof(WCHAR)),
......
...@@ -16,16 +16,18 @@ ...@@ -16,16 +16,18 @@
* 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 <stdarg.h> #include <stdarg.h>
#include <wchar.h>
#define NONAMELESSUNION #define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winnls.h"
#define CERT_CHAIN_PARA_HAS_EXTRA_FIELDS #define CERT_CHAIN_PARA_HAS_EXTRA_FIELDS
#define CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS #define CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS
#include "wincrypt.h" #include "wincrypt.h"
#include "wininet.h" #include "wininet.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "crypt32_private.h" #include "crypt32_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt); WINE_DEFAULT_DEBUG_CHANNEL(crypt);
...@@ -704,18 +706,18 @@ static BOOL url_matches(LPCWSTR constraint, LPCWSTR name, ...@@ -704,18 +706,18 @@ static BOOL url_matches(LPCWSTR constraint, LPCWSTR name,
* The format for URIs is in RFC 2396. * The format for URIs is in RFC 2396.
* *
* First, remove any scheme that's present. */ * First, remove any scheme that's present. */
colon = strchrW(name, ':'); colon = wcschr(name, ':');
if (colon && *(colon + 1) == '/' && *(colon + 2) == '/') if (colon && *(colon + 1) == '/' && *(colon + 2) == '/')
name = colon + 3; name = colon + 3;
/* Next, find the end of the authority component. (The authority is /* Next, find the end of the authority component. (The authority is
* generally just the hostname, but it may contain a username or a port. * generally just the hostname, but it may contain a username or a port.
* Those are removed next.) * Those are removed next.)
*/ */
authority_end = strchrW(name, '/'); authority_end = wcschr(name, '/');
if (!authority_end) if (!authority_end)
authority_end = strchrW(name, '?'); authority_end = wcschr(name, '?');
if (!authority_end) if (!authority_end)
authority_end = name + strlenW(name); authority_end = name + lstrlenW(name);
/* Remove any port number from the authority. The userinfo portion /* Remove any port number from the authority. The userinfo portion
* of an authority may contain a colon, so stop if a userinfo portion * of an authority may contain a colon, so stop if a userinfo portion
* is found (indicated by '@'). * is found (indicated by '@').
...@@ -726,7 +728,7 @@ static BOOL url_matches(LPCWSTR constraint, LPCWSTR name, ...@@ -726,7 +728,7 @@ static BOOL url_matches(LPCWSTR constraint, LPCWSTR name,
if (*colon == ':') if (*colon == ':')
authority_end = colon; authority_end = colon;
/* Remove any username from the authority */ /* Remove any username from the authority */
if ((at = strchrW(name, '@'))) if ((at = wcschr(name, '@')))
name = at; name = at;
/* Ignore any path or query portion of the URL. */ /* Ignore any path or query portion of the URL. */
if (*authority_end) if (*authority_end)
...@@ -760,11 +762,11 @@ static BOOL rfc822_name_matches(LPCWSTR constraint, LPCWSTR name, ...@@ -760,11 +762,11 @@ static BOOL rfc822_name_matches(LPCWSTR constraint, LPCWSTR name,
*trustErrorStatus |= CERT_TRUST_INVALID_NAME_CONSTRAINTS; *trustErrorStatus |= CERT_TRUST_INVALID_NAME_CONSTRAINTS;
else if (!name) else if (!name)
; /* no match */ ; /* no match */
else if (strchrW(constraint, '@')) else if (wcschr(constraint, '@'))
match = !lstrcmpiW(constraint, name); match = !lstrcmpiW(constraint, name);
else else
{ {
if ((at = strchrW(name, '@'))) if ((at = wcschr(name, '@')))
match = domain_name_matches(constraint, at + 1); match = domain_name_matches(constraint, at + 1);
else else
match = !lstrcmpiW(constraint, name); match = !lstrcmpiW(constraint, name);
...@@ -3195,15 +3197,15 @@ static BOOL match_dns_to_subject_alt_name(const CERT_EXTENSION *ext, ...@@ -3195,15 +3197,15 @@ static BOOL match_dns_to_subject_alt_name(const CERT_EXTENSION *ext,
* label, then requires an exact match of the remaining * label, then requires an exact match of the remaining
* string. * string.
*/ */
server_name_dot = strchrW(server_name, '.'); server_name_dot = wcschr(server_name, '.');
if (server_name_dot) if (server_name_dot)
{ {
if (!strcmpiW(server_name_dot, if (!wcsicmp(server_name_dot,
subjectName->rgAltEntry[i].u.pwszDNSName + 1)) subjectName->rgAltEntry[i].u.pwszDNSName + 1))
matches = TRUE; matches = TRUE;
} }
} }
else if (!strcmpiW(server_name, else if (!wcsicmp(server_name,
subjectName->rgAltEntry[i].u.pwszDNSName)) subjectName->rgAltEntry[i].u.pwszDNSName))
matches = TRUE; matches = TRUE;
} }
...@@ -3226,13 +3228,13 @@ static BOOL find_matching_domain_component(const CERT_NAME_INFO *name, ...@@ -3226,13 +3228,13 @@ static BOOL find_matching_domain_component(const CERT_NAME_INFO *name,
const CERT_RDN_ATTR *attr; const CERT_RDN_ATTR *attr;
attr = &name->rgRDN[i].rgRDNAttr[j]; attr = &name->rgRDN[i].rgRDNAttr[j];
/* Compare with strncmpiW rather than strcmpiW in order to avoid /* Compare with wcsnicmp rather than wcsicmp in order to avoid
* a match with a string with an embedded NULL. The component * a match with a string with an embedded NULL. The component
* must match one domain component attribute's entire string * must match one domain component attribute's entire string
* value with a case-insensitive match. * value with a case-insensitive match.
*/ */
if ((len == attr->Value.cbData / sizeof(WCHAR)) && if ((len == attr->Value.cbData / sizeof(WCHAR)) &&
!strncmpiW(component, (LPCWSTR)attr->Value.pbData, len)) !wcsnicmp(component, (LPCWSTR)attr->Value.pbData, len))
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
...@@ -3283,7 +3285,7 @@ static BOOL match_domain_component(LPCWSTR allowed_component, DWORD allowed_len, ...@@ -3283,7 +3285,7 @@ static BOOL match_domain_component(LPCWSTR allowed_component, DWORD allowed_len,
} }
} }
if (matches) if (matches)
matches = tolowerW(*allowed_ptr) == tolowerW(*server_ptr); matches = towlower(*allowed_ptr) == towlower(*server_ptr);
} }
if (matches && server_ptr - server_component < server_len) if (matches && server_ptr - server_component < server_len)
{ {
...@@ -3301,7 +3303,7 @@ static BOOL match_common_name(LPCWSTR server_name, const CERT_RDN_ATTR *nameAttr ...@@ -3301,7 +3303,7 @@ static BOOL match_common_name(LPCWSTR server_name, const CERT_RDN_ATTR *nameAttr
LPCWSTR allowed_component = allowed; LPCWSTR allowed_component = allowed;
DWORD allowed_len = nameAttr->Value.cbData / sizeof(WCHAR); DWORD allowed_len = nameAttr->Value.cbData / sizeof(WCHAR);
LPCWSTR server_component = server_name; LPCWSTR server_component = server_name;
DWORD server_len = strlenW(server_name); DWORD server_len = lstrlenW(server_name);
BOOL matches = TRUE, allow_wildcards = TRUE; BOOL matches = TRUE, allow_wildcards = TRUE;
TRACE_(chain)("CN = %s\n", debugstr_wn(allowed_component, allowed_len)); TRACE_(chain)("CN = %s\n", debugstr_wn(allowed_component, allowed_len));
...@@ -3332,9 +3334,9 @@ static BOOL match_common_name(LPCWSTR server_name, const CERT_RDN_ATTR *nameAttr ...@@ -3332,9 +3334,9 @@ static BOOL match_common_name(LPCWSTR server_name, const CERT_RDN_ATTR *nameAttr
do { do {
LPCWSTR allowed_dot, server_dot; LPCWSTR allowed_dot, server_dot;
allowed_dot = memchrW(allowed_component, '.', allowed_dot = wmemchr(allowed_component, '.',
allowed_len - (allowed_component - allowed)); allowed_len - (allowed_component - allowed));
server_dot = memchrW(server_component, '.', server_dot = wmemchr(server_component, '.',
server_len - (server_component - server_name)); server_len - (server_component - server_name));
/* The number of components must match */ /* The number of components must match */
if ((!allowed_dot && server_dot) || (allowed_dot && !server_dot)) if ((!allowed_dot && server_dot) || (allowed_dot && !server_dot))
...@@ -3395,11 +3397,11 @@ static BOOL match_dns_to_subject_dn(PCCERT_CONTEXT cert, LPCWSTR server_name) ...@@ -3395,11 +3397,11 @@ static BOOL match_dns_to_subject_dn(PCCERT_CONTEXT cert, LPCWSTR server_name)
LPCWSTR ptr = server_name; LPCWSTR ptr = server_name;
do { do {
LPCWSTR dot = strchrW(ptr, '.'), end; LPCWSTR dot = wcschr(ptr, '.'), end;
/* 254 is the maximum DNS label length, see RFC 1035 */ /* 254 is the maximum DNS label length, see RFC 1035 */
size_t len; size_t len;
end = dot ? dot : ptr + strlenW(ptr); end = dot ? dot : ptr + lstrlenW(ptr);
len = end - ptr; len = end - ptr;
if (len >= 255) if (len >= 255)
{ {
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "winbase.h" #include "winbase.h"
#include "wincrypt.h" #include "wincrypt.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "crypt32_private.h" #include "crypt32_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt); WINE_DEFAULT_DEBUG_CHANNEL(crypt);
...@@ -614,7 +613,7 @@ static BOOL compare_dist_point_name(const CRL_DIST_POINT_NAME *name1, ...@@ -614,7 +613,7 @@ static BOOL compare_dist_point_name(const CRL_DIST_POINT_NAME *name1,
switch (entry1->dwAltNameChoice) switch (entry1->dwAltNameChoice)
{ {
case CERT_ALT_NAME_URL: case CERT_ALT_NAME_URL:
match = !strcmpiW(entry1->u.pwszURL, match = !wcsicmp(entry1->u.pwszURL,
entry2->u.pwszURL); entry2->u.pwszURL);
break; break;
case CERT_ALT_NAME_DIRECTORY_NAME: case CERT_ALT_NAME_DIRECTORY_NAME:
......
...@@ -30,9 +30,6 @@ ...@@ -30,9 +30,6 @@
* MSDN, especially "Constants for CryptEncodeObject and CryptDecodeObject" * MSDN, especially "Constants for CryptEncodeObject and CryptDecodeObject"
*/ */
#include "config.h"
#include "wine/port.h"
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
......
...@@ -30,9 +30,6 @@ ...@@ -30,9 +30,6 @@
* MSDN, especially "Constants for CryptEncodeObject and CryptDecodeObject" * MSDN, especially "Constants for CryptEncodeObject and CryptDecodeObject"
*/ */
#include "config.h"
#include "wine/port.h"
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
...@@ -46,7 +43,6 @@ ...@@ -46,7 +43,6 @@
#include "snmp.h" #include "snmp.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/unicode.h"
#include "crypt32_private.h" #include "crypt32_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(cryptasn); WINE_DEFAULT_DEBUG_CHANNEL(cryptasn);
...@@ -1015,7 +1011,7 @@ static BOOL CRYPT_AsnEncodeUTF8String(const CERT_NAME_VALUE *value, ...@@ -1015,7 +1011,7 @@ static BOOL CRYPT_AsnEncodeUTF8String(const CERT_NAME_VALUE *value,
if (value->Value.cbData) if (value->Value.cbData)
strLen = value->Value.cbData / sizeof(WCHAR); strLen = value->Value.cbData / sizeof(WCHAR);
else if (str) else if (str)
strLen = strlenW(str); strLen = lstrlenW(str);
else else
strLen = 0; strLen = 0;
encodedLen = WideCharToMultiByte(CP_UTF8, 0, str, strLen, NULL, 0, NULL, encodedLen = WideCharToMultiByte(CP_UTF8, 0, str, strLen, NULL, 0, NULL,
...@@ -1186,7 +1182,7 @@ static BOOL CRYPT_AsnEncodeRdnAttr(DWORD dwCertEncodingType, ...@@ -1186,7 +1182,7 @@ static BOOL CRYPT_AsnEncodeRdnAttr(DWORD dwCertEncodingType,
return ret; return ret;
} }
static int BLOBComp(const void *l, const void *r) static int __cdecl BLOBComp(const void *l, const void *r)
{ {
const CRYPT_DER_BLOB *a = l, *b = r; const CRYPT_DER_BLOB *a = l, *b = r;
int ret; int ret;
...@@ -1999,7 +1995,7 @@ static BOOL CRYPT_AsnEncodeUnicodeStringCoerce(const CERT_NAME_VALUE *value, ...@@ -1999,7 +1995,7 @@ static BOOL CRYPT_AsnEncodeUnicodeStringCoerce(const CERT_NAME_VALUE *value,
if (value->Value.cbData) if (value->Value.cbData)
encodedLen = value->Value.cbData / sizeof(WCHAR); encodedLen = value->Value.cbData / sizeof(WCHAR);
else if (str) else if (str)
encodedLen = strlenW(str); encodedLen = lstrlenW(str);
else else
encodedLen = 0; encodedLen = 0;
CRYPT_EncodeLen(encodedLen, NULL, &lenBytes); CRYPT_EncodeLen(encodedLen, NULL, &lenBytes);
...@@ -2036,7 +2032,7 @@ static BOOL CRYPT_AsnEncodeNumericString(const CERT_NAME_VALUE *value, ...@@ -2036,7 +2032,7 @@ static BOOL CRYPT_AsnEncodeNumericString(const CERT_NAME_VALUE *value,
if (value->Value.cbData) if (value->Value.cbData)
encodedLen = value->Value.cbData / sizeof(WCHAR); encodedLen = value->Value.cbData / sizeof(WCHAR);
else if (str) else if (str)
encodedLen = strlenW(str); encodedLen = lstrlenW(str);
else else
encodedLen = 0; encodedLen = 0;
CRYPT_EncodeLen(encodedLen, NULL, &lenBytes); CRYPT_EncodeLen(encodedLen, NULL, &lenBytes);
...@@ -2078,7 +2074,7 @@ static BOOL CRYPT_AsnEncodeNumericString(const CERT_NAME_VALUE *value, ...@@ -2078,7 +2074,7 @@ static BOOL CRYPT_AsnEncodeNumericString(const CERT_NAME_VALUE *value,
static inline BOOL isprintableW(WCHAR wc) static inline BOOL isprintableW(WCHAR wc)
{ {
return isalnumW(wc) || isspaceW(wc) || wc == '\'' || wc == '(' || return iswalnum(wc) || iswspace(wc) || wc == '\'' || wc == '(' ||
wc == ')' || wc == '+' || wc == ',' || wc == '-' || wc == '.' || wc == ')' || wc == '+' || wc == ',' || wc == '-' || wc == '.' ||
wc == '/' || wc == ':' || wc == '=' || wc == '?'; wc == '/' || wc == ':' || wc == '=' || wc == '?';
} }
...@@ -2094,7 +2090,7 @@ static BOOL CRYPT_AsnEncodePrintableString(const CERT_NAME_VALUE *value, ...@@ -2094,7 +2090,7 @@ static BOOL CRYPT_AsnEncodePrintableString(const CERT_NAME_VALUE *value,
if (value->Value.cbData) if (value->Value.cbData)
encodedLen = value->Value.cbData / sizeof(WCHAR); encodedLen = value->Value.cbData / sizeof(WCHAR);
else if (str) else if (str)
encodedLen = strlenW(str); encodedLen = lstrlenW(str);
else else
encodedLen = 0; encodedLen = 0;
CRYPT_EncodeLen(encodedLen, NULL, &lenBytes); CRYPT_EncodeLen(encodedLen, NULL, &lenBytes);
...@@ -2145,7 +2141,7 @@ static BOOL CRYPT_AsnEncodeIA5String(const CERT_NAME_VALUE *value, ...@@ -2145,7 +2141,7 @@ static BOOL CRYPT_AsnEncodeIA5String(const CERT_NAME_VALUE *value,
if (value->Value.cbData) if (value->Value.cbData)
encodedLen = value->Value.cbData / sizeof(WCHAR); encodedLen = value->Value.cbData / sizeof(WCHAR);
else if (str) else if (str)
encodedLen = strlenW(str); encodedLen = lstrlenW(str);
else else
encodedLen = 0; encodedLen = 0;
CRYPT_EncodeLen(encodedLen, NULL, &lenBytes); CRYPT_EncodeLen(encodedLen, NULL, &lenBytes);
...@@ -2197,7 +2193,7 @@ static BOOL CRYPT_AsnEncodeUniversalString(const CERT_NAME_VALUE *value, ...@@ -2197,7 +2193,7 @@ static BOOL CRYPT_AsnEncodeUniversalString(const CERT_NAME_VALUE *value,
if (value->Value.cbData) if (value->Value.cbData)
strLen = value->Value.cbData / sizeof(WCHAR); strLen = value->Value.cbData / sizeof(WCHAR);
else if (str) else if (str)
strLen = strlenW(str); strLen = lstrlenW(str);
else else
strLen = 0; strLen = 0;
CRYPT_EncodeLen(strLen * 4, NULL, &lenBytes); CRYPT_EncodeLen(strLen * 4, NULL, &lenBytes);
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "wincrypt.h" #include "wincrypt.h"
#include "winnls.h" #include "winnls.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "crypt32_private.h" #include "crypt32_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt); WINE_DEFAULT_DEBUG_CHANNEL(crypt);
...@@ -356,7 +355,7 @@ WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv, ...@@ -356,7 +355,7 @@ WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv,
{ {
static const WCHAR spc[] = { 's','p','c',0 }; static const WCHAR spc[] = { 's','p','c',0 };
static const WCHAR p7c[] = { 'p','7','c',0 }; static const WCHAR p7c[] = { 'p','7','c',0 };
LPCWSTR ext = strrchrW(fileName, '.'); LPCWSTR ext = wcsrchr(fileName, '.');
if (ext) if (ext)
{ {
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +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>
#include <stdio.h> #include <stdio.h>
......
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,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 "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#define NONAMELESSUNION #define NONAMELESSUNION
#include "windef.h" #include "windef.h"
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "wintrust.h" #include "wintrust.h"
#include "crypt32_private.h" #include "crypt32_private.h"
#include "cryptres.h" #include "cryptres.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt); WINE_DEFAULT_DEBUG_CHANNEL(crypt);
...@@ -870,9 +869,9 @@ static BOOL WINAPI CRYPT_FormatHexString(DWORD dwCertEncodingType, ...@@ -870,9 +869,9 @@ static BOOL WINAPI CRYPT_FormatHexString(DWORD dwCertEncodingType,
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
...@@ -904,9 +903,9 @@ static BOOL CRYPT_FormatBits(BYTE bits, const struct BitToString *map, ...@@ -904,9 +903,9 @@ static BOOL CRYPT_FormatBits(BYTE bits, const struct BitToString *map,
if (bits & map[i].bit) if (bits & map[i].bit)
{ {
if (!localFirst) if (!localFirst)
bytesNeeded += strlenW(commaSpace) * sizeof(WCHAR); bytesNeeded += lstrlenW(commaSpace) * sizeof(WCHAR);
localFirst = FALSE; localFirst = FALSE;
bytesNeeded += strlenW(map[i].str) * sizeof(WCHAR); bytesNeeded += lstrlenW(map[i].str) * sizeof(WCHAR);
} }
if (!pbFormat) if (!pbFormat)
{ {
...@@ -931,12 +930,12 @@ static BOOL CRYPT_FormatBits(BYTE bits, const struct BitToString *map, ...@@ -931,12 +930,12 @@ static BOOL CRYPT_FormatBits(BYTE bits, const struct BitToString *map,
{ {
if (!localFirst) if (!localFirst)
{ {
strcpyW(str, commaSpace); lstrcpyW(str, commaSpace);
str += strlenW(commaSpace); str += lstrlenW(commaSpace);
} }
localFirst = FALSE; localFirst = FALSE;
strcpyW(str, map[i].str); lstrcpyW(str, map[i].str);
str += strlenW(map[i].str); str += lstrlenW(map[i].str);
} }
*first = localFirst; *first = localFirst;
} }
...@@ -981,7 +980,7 @@ static BOOL WINAPI CRYPT_FormatKeyUsage(DWORD dwCertEncodingType, ...@@ -981,7 +980,7 @@ static BOOL WINAPI CRYPT_FormatKeyUsage(DWORD dwCertEncodingType,
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable)); LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable));
if (!bits->cbData || bits->cbData > 2) if (!bits->cbData || bits->cbData > 2)
{ {
bytesNeeded += strlenW(infoNotAvailable) * sizeof(WCHAR); bytesNeeded += lstrlenW(infoNotAvailable) * sizeof(WCHAR);
if (!pbFormat) if (!pbFormat)
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
else if (*pcbFormat < bytesNeeded) else if (*pcbFormat < bytesNeeded)
...@@ -995,7 +994,7 @@ static BOOL WINAPI CRYPT_FormatKeyUsage(DWORD dwCertEncodingType, ...@@ -995,7 +994,7 @@ static BOOL WINAPI CRYPT_FormatKeyUsage(DWORD dwCertEncodingType,
LPWSTR str = pbFormat; LPWSTR str = pbFormat;
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
strcpyW(str, infoNotAvailable); lstrcpyW(str, infoNotAvailable);
} }
} }
else else
...@@ -1098,12 +1097,12 @@ static BOOL WINAPI CRYPT_FormatBasicConstraints2(DWORD dwCertEncodingType, ...@@ -1098,12 +1097,12 @@ static BOOL WINAPI CRYPT_FormatBasicConstraints2(DWORD dwCertEncodingType,
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
sep = crlf; sep = crlf;
sepLen = strlenW(crlf) * sizeof(WCHAR); sepLen = lstrlenW(crlf) * sizeof(WCHAR);
} }
else else
{ {
sep = commaSpace; sep = commaSpace;
sepLen = strlenW(commaSpace) * sizeof(WCHAR); sepLen = lstrlenW(commaSpace) * sizeof(WCHAR);
} }
if (!stringsLoaded) if (!stringsLoaded)
...@@ -1114,19 +1113,19 @@ static BOOL WINAPI CRYPT_FormatBasicConstraints2(DWORD dwCertEncodingType, ...@@ -1114,19 +1113,19 @@ static BOOL WINAPI CRYPT_FormatBasicConstraints2(DWORD dwCertEncodingType,
LoadStringW(hInstance, IDS_PATH_LENGTH, pathLengthHeader, ARRAY_SIZE(pathLengthHeader)); LoadStringW(hInstance, IDS_PATH_LENGTH, pathLengthHeader, ARRAY_SIZE(pathLengthHeader));
stringsLoaded = TRUE; stringsLoaded = TRUE;
} }
bytesNeeded += strlenW(subjectTypeHeader) * sizeof(WCHAR); bytesNeeded += lstrlenW(subjectTypeHeader) * sizeof(WCHAR);
if (info->fCA) if (info->fCA)
subjectType = subjectTypeCA; subjectType = subjectTypeCA;
else else
subjectType = subjectTypeEndCert; subjectType = subjectTypeEndCert;
bytesNeeded += strlenW(subjectType) * sizeof(WCHAR); bytesNeeded += lstrlenW(subjectType) * sizeof(WCHAR);
bytesNeeded += sepLen; bytesNeeded += sepLen;
bytesNeeded += strlenW(pathLengthHeader) * sizeof(WCHAR); bytesNeeded += lstrlenW(pathLengthHeader) * sizeof(WCHAR);
if (info->fPathLenConstraint) if (info->fPathLenConstraint)
sprintfW(pathLength, pathFmt, info->dwPathLenConstraint); swprintf(pathLength, ARRAY_SIZE(pathLength), pathFmt, info->dwPathLenConstraint);
else else
LoadStringW(hInstance, IDS_PATH_LENGTH_NONE, pathLength, ARRAY_SIZE(pathLength)); LoadStringW(hInstance, IDS_PATH_LENGTH_NONE, pathLength, ARRAY_SIZE(pathLength));
bytesNeeded += strlenW(pathLength) * sizeof(WCHAR); bytesNeeded += lstrlenW(pathLength) * sizeof(WCHAR);
if (!pbFormat) if (!pbFormat)
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
else if (*pcbFormat < bytesNeeded) else if (*pcbFormat < bytesNeeded)
...@@ -1140,15 +1139,15 @@ static BOOL WINAPI CRYPT_FormatBasicConstraints2(DWORD dwCertEncodingType, ...@@ -1140,15 +1139,15 @@ static BOOL WINAPI CRYPT_FormatBasicConstraints2(DWORD dwCertEncodingType,
LPWSTR str = pbFormat; LPWSTR str = pbFormat;
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
strcpyW(str, subjectTypeHeader); lstrcpyW(str, subjectTypeHeader);
str += strlenW(subjectTypeHeader); str += lstrlenW(subjectTypeHeader);
strcpyW(str, subjectType); lstrcpyW(str, subjectType);
str += strlenW(subjectType); str += lstrlenW(subjectType);
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen / sizeof(WCHAR); str += sepLen / sizeof(WCHAR);
strcpyW(str, pathLengthHeader); lstrcpyW(str, pathLengthHeader);
str += strlenW(pathLengthHeader); str += lstrlenW(pathLengthHeader);
strcpyW(str, pathLength); lstrcpyW(str, pathLength);
} }
LocalFree(info); LocalFree(info);
} }
...@@ -1165,7 +1164,7 @@ static BOOL CRYPT_FormatHexStringWithPrefix(const CRYPT_DATA_BLOB *blob, int id, ...@@ -1165,7 +1164,7 @@ static BOOL CRYPT_FormatHexStringWithPrefix(const CRYPT_DATA_BLOB *blob, int id,
LoadStringW(hInstance, id, buf, ARRAY_SIZE(buf)); LoadStringW(hInstance, id, buf, ARRAY_SIZE(buf));
CRYPT_FormatHexString(X509_ASN_ENCODING, 0, 0, NULL, NULL, CRYPT_FormatHexString(X509_ASN_ENCODING, 0, 0, NULL, NULL,
blob->pbData, blob->cbData, NULL, &bytesNeeded); blob->pbData, blob->cbData, NULL, &bytesNeeded);
bytesNeeded += strlenW(buf) * sizeof(WCHAR); bytesNeeded += lstrlenW(buf) * sizeof(WCHAR);
if (!str) if (!str)
{ {
*pcbStr = bytesNeeded; *pcbStr = bytesNeeded;
...@@ -1180,9 +1179,9 @@ static BOOL CRYPT_FormatHexStringWithPrefix(const CRYPT_DATA_BLOB *blob, int id, ...@@ -1180,9 +1179,9 @@ static BOOL CRYPT_FormatHexStringWithPrefix(const CRYPT_DATA_BLOB *blob, int id,
else else
{ {
*pcbStr = bytesNeeded; *pcbStr = bytesNeeded;
strcpyW(str, buf); lstrcpyW(str, buf);
str += strlenW(str); str += lstrlenW(str);
bytesNeeded -= strlenW(str) * sizeof(WCHAR); bytesNeeded -= lstrlenW(str) * sizeof(WCHAR);
ret = CRYPT_FormatHexString(X509_ASN_ENCODING, 0, 0, NULL, NULL, ret = CRYPT_FormatHexString(X509_ASN_ENCODING, 0, 0, NULL, NULL,
blob->pbData, blob->cbData, str, &bytesNeeded); blob->pbData, blob->cbData, str, &bytesNeeded);
} }
...@@ -1217,17 +1216,17 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel, ...@@ -1217,17 +1216,17 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
DWORD strType = CERT_X500_NAME_STR | CERT_NAME_STR_REVERSE_FLAG; DWORD strType = CERT_X500_NAME_STR | CERT_NAME_STR_REVERSE_FLAG;
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
bytesNeeded += indentLevel * strlenW(indent) * sizeof(WCHAR); bytesNeeded += indentLevel * lstrlenW(indent) * sizeof(WCHAR);
switch (entry->dwAltNameChoice) switch (entry->dwAltNameChoice)
{ {
case CERT_ALT_NAME_RFC822_NAME: case CERT_ALT_NAME_RFC822_NAME:
LoadStringW(hInstance, IDS_ALT_NAME_RFC822_NAME, buf, ARRAY_SIZE(buf)); LoadStringW(hInstance, IDS_ALT_NAME_RFC822_NAME, buf, ARRAY_SIZE(buf));
bytesNeeded += strlenW(entry->u.pwszRfc822Name) * sizeof(WCHAR); bytesNeeded += lstrlenW(entry->u.pwszRfc822Name) * sizeof(WCHAR);
ret = TRUE; ret = TRUE;
break; break;
case CERT_ALT_NAME_DNS_NAME: case CERT_ALT_NAME_DNS_NAME:
LoadStringW(hInstance, IDS_ALT_NAME_DNS_NAME, buf, ARRAY_SIZE(buf)); LoadStringW(hInstance, IDS_ALT_NAME_DNS_NAME, buf, ARRAY_SIZE(buf));
bytesNeeded += strlenW(entry->u.pwszDNSName) * sizeof(WCHAR); bytesNeeded += lstrlenW(entry->u.pwszDNSName) * sizeof(WCHAR);
ret = TRUE; ret = TRUE;
break; break;
case CERT_ALT_NAME_DIRECTORY_NAME: case CERT_ALT_NAME_DIRECTORY_NAME:
...@@ -1241,7 +1240,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel, ...@@ -1241,7 +1240,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
LoadStringW(hInstance, IDS_ALT_NAME_DIRECTORY_NAME, buf, ARRAY_SIZE(buf)); LoadStringW(hInstance, IDS_ALT_NAME_DIRECTORY_NAME, buf, ARRAY_SIZE(buf));
bytesNeeded += (directoryNameLen - 1) * sizeof(WCHAR); bytesNeeded += (directoryNameLen - 1) * sizeof(WCHAR);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
bytesNeeded += strlenW(colonCrlf) * sizeof(WCHAR); bytesNeeded += lstrlenW(colonCrlf) * sizeof(WCHAR);
else else
bytesNeeded += sizeof(WCHAR); /* '=' */ bytesNeeded += sizeof(WCHAR); /* '=' */
ret = TRUE; ret = TRUE;
...@@ -1249,7 +1248,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel, ...@@ -1249,7 +1248,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
} }
case CERT_ALT_NAME_URL: case CERT_ALT_NAME_URL:
LoadStringW(hInstance, IDS_ALT_NAME_URL, buf, ARRAY_SIZE(buf)); LoadStringW(hInstance, IDS_ALT_NAME_URL, buf, ARRAY_SIZE(buf));
bytesNeeded += strlenW(entry->u.pwszURL) * sizeof(WCHAR); bytesNeeded += lstrlenW(entry->u.pwszURL) * sizeof(WCHAR);
ret = TRUE; ret = TRUE;
break; break;
case CERT_ALT_NAME_IP_ADDRESS: case CERT_ALT_NAME_IP_ADDRESS:
...@@ -1266,26 +1265,26 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel, ...@@ -1266,26 +1265,26 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
LoadStringW(hInstance, IDS_ALT_NAME_MASK, mask, ARRAY_SIZE(mask)); LoadStringW(hInstance, IDS_ALT_NAME_MASK, mask, ARRAY_SIZE(mask));
bytesNeeded += strlenW(mask) * sizeof(WCHAR); bytesNeeded += lstrlenW(mask) * sizeof(WCHAR);
sprintfW(ipAddrBuf, ipAddrFmt, swprintf(ipAddrBuf, ARRAY_SIZE(ipAddrBuf), ipAddrFmt,
entry->u.IPAddress.pbData[0], entry->u.IPAddress.pbData[0],
entry->u.IPAddress.pbData[1], entry->u.IPAddress.pbData[1],
entry->u.IPAddress.pbData[2], entry->u.IPAddress.pbData[2],
entry->u.IPAddress.pbData[3]); entry->u.IPAddress.pbData[3]);
bytesNeeded += strlenW(ipAddrBuf) * sizeof(WCHAR); bytesNeeded += lstrlenW(ipAddrBuf) * sizeof(WCHAR);
/* indent again, for the mask line */ /* indent again, for the mask line */
bytesNeeded += indentLevel * strlenW(indent) * sizeof(WCHAR); bytesNeeded += indentLevel * lstrlenW(indent) * sizeof(WCHAR);
sprintfW(maskBuf, ipAddrFmt, swprintf(maskBuf, ARRAY_SIZE(maskBuf), ipAddrFmt,
entry->u.IPAddress.pbData[4], entry->u.IPAddress.pbData[4],
entry->u.IPAddress.pbData[5], entry->u.IPAddress.pbData[5],
entry->u.IPAddress.pbData[6], entry->u.IPAddress.pbData[6],
entry->u.IPAddress.pbData[7]); entry->u.IPAddress.pbData[7]);
bytesNeeded += strlenW(maskBuf) * sizeof(WCHAR); bytesNeeded += lstrlenW(maskBuf) * sizeof(WCHAR);
bytesNeeded += strlenW(crlf) * sizeof(WCHAR); bytesNeeded += lstrlenW(crlf) * sizeof(WCHAR);
} }
else else
{ {
sprintfW(ipAddrBuf, ipAddrWithMaskFmt, swprintf(ipAddrBuf, ARRAY_SIZE(ipAddrBuf), ipAddrWithMaskFmt,
entry->u.IPAddress.pbData[0], entry->u.IPAddress.pbData[0],
entry->u.IPAddress.pbData[1], entry->u.IPAddress.pbData[1],
entry->u.IPAddress.pbData[2], entry->u.IPAddress.pbData[2],
...@@ -1294,7 +1293,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel, ...@@ -1294,7 +1293,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
entry->u.IPAddress.pbData[5], entry->u.IPAddress.pbData[5],
entry->u.IPAddress.pbData[6], entry->u.IPAddress.pbData[6],
entry->u.IPAddress.pbData[7]); entry->u.IPAddress.pbData[7]);
bytesNeeded += (strlenW(ipAddrBuf) + 1) * sizeof(WCHAR); bytesNeeded += (lstrlenW(ipAddrBuf) + 1) * sizeof(WCHAR);
} }
ret = TRUE; ret = TRUE;
} }
...@@ -1312,7 +1311,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel, ...@@ -1312,7 +1311,7 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
} }
if (ret) if (ret)
{ {
bytesNeeded += strlenW(buf) * sizeof(WCHAR); bytesNeeded += lstrlenW(buf) * sizeof(WCHAR);
if (!str) if (!str)
*pcbStr = bytesNeeded; *pcbStr = bytesNeeded;
else if (*pcbStr < bytesNeeded) else if (*pcbStr < bytesNeeded)
...@@ -1330,24 +1329,24 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel, ...@@ -1330,24 +1329,24 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
{ {
for (i = 0; i < indentLevel; i++) for (i = 0; i < indentLevel; i++)
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
} }
strcpyW(str, buf); lstrcpyW(str, buf);
str += strlenW(str); str += lstrlenW(str);
switch (entry->dwAltNameChoice) switch (entry->dwAltNameChoice)
{ {
case CERT_ALT_NAME_RFC822_NAME: case CERT_ALT_NAME_RFC822_NAME:
case CERT_ALT_NAME_DNS_NAME: case CERT_ALT_NAME_DNS_NAME:
case CERT_ALT_NAME_URL: case CERT_ALT_NAME_URL:
strcpyW(str, entry->u.pwszURL); lstrcpyW(str, entry->u.pwszURL);
break; break;
case CERT_ALT_NAME_DIRECTORY_NAME: case CERT_ALT_NAME_DIRECTORY_NAME:
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
strcpyW(str, colonCrlf); lstrcpyW(str, colonCrlf);
str += strlenW(colonCrlf); str += lstrlenW(colonCrlf);
} }
else else
*str++ = '='; *str++ = '=';
...@@ -1358,24 +1357,24 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel, ...@@ -1358,24 +1357,24 @@ static BOOL CRYPT_FormatAltNameEntry(DWORD dwFormatStrType, DWORD indentLevel,
case CERT_ALT_NAME_IP_ADDRESS: case CERT_ALT_NAME_IP_ADDRESS:
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
strcpyW(str, ipAddrBuf); lstrcpyW(str, ipAddrBuf);
str += strlenW(ipAddrBuf); str += lstrlenW(ipAddrBuf);
strcpyW(str, crlf); lstrcpyW(str, crlf);
str += strlenW(crlf); str += lstrlenW(crlf);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
for (i = 0; i < indentLevel; i++) for (i = 0; i < indentLevel; i++)
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
} }
strcpyW(str, mask); lstrcpyW(str, mask);
str += strlenW(mask); str += lstrlenW(mask);
strcpyW(str, maskBuf); lstrcpyW(str, maskBuf);
} }
else else
strcpyW(str, ipAddrBuf); lstrcpyW(str, ipAddrBuf);
break; break;
} }
} }
...@@ -1394,12 +1393,12 @@ static BOOL CRYPT_FormatAltNameInfo(DWORD dwFormatStrType, DWORD indentLevel, ...@@ -1394,12 +1393,12 @@ static BOOL CRYPT_FormatAltNameInfo(DWORD dwFormatStrType, DWORD indentLevel,
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
sep = crlf; sep = crlf;
sepLen = strlenW(crlf) * sizeof(WCHAR); sepLen = lstrlenW(crlf) * sizeof(WCHAR);
} }
else else
{ {
sep = commaSpace; sep = commaSpace;
sepLen = strlenW(commaSpace) * sizeof(WCHAR); sepLen = lstrlenW(commaSpace) * sizeof(WCHAR);
} }
for (i = 0; ret && i < name->cAltEntry; i++) for (i = 0; ret && i < name->cAltEntry; i++)
...@@ -1436,7 +1435,7 @@ static BOOL CRYPT_FormatAltNameInfo(DWORD dwFormatStrType, DWORD indentLevel, ...@@ -1436,7 +1435,7 @@ static BOOL CRYPT_FormatAltNameInfo(DWORD dwFormatStrType, DWORD indentLevel,
str += size / sizeof(WCHAR) - 1; str += size / sizeof(WCHAR) - 1;
if (i < name->cAltEntry - 1) if (i < name->cAltEntry - 1)
{ {
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen / sizeof(WCHAR); str += sepLen / sizeof(WCHAR);
} }
} }
...@@ -1477,16 +1476,16 @@ static BOOL CRYPT_FormatCertIssuer(DWORD dwFormatStrType, ...@@ -1477,16 +1476,16 @@ static BOOL CRYPT_FormatCertIssuer(DWORD dwFormatStrType,
LoadStringW(hInstance, IDS_CERT_ISSUER, buf, ARRAY_SIZE(buf)); LoadStringW(hInstance, IDS_CERT_ISSUER, buf, ARRAY_SIZE(buf));
ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 1, issuer, NULL, ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 1, issuer, NULL,
&bytesNeeded); &bytesNeeded);
bytesNeeded += strlenW(buf) * sizeof(WCHAR); bytesNeeded += lstrlenW(buf) * sizeof(WCHAR);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
sep = colonCrlf; sep = colonCrlf;
sepLen = strlenW(colonCrlf) * sizeof(WCHAR); sepLen = lstrlenW(colonCrlf) * sizeof(WCHAR);
} }
else else
{ {
sep = colonSep; sep = colonSep;
sepLen = strlenW(colonSep) * sizeof(WCHAR); sepLen = lstrlenW(colonSep) * sizeof(WCHAR);
} }
bytesNeeded += sepLen; bytesNeeded += sepLen;
if (ret) if (ret)
...@@ -1502,10 +1501,10 @@ static BOOL CRYPT_FormatCertIssuer(DWORD dwFormatStrType, ...@@ -1502,10 +1501,10 @@ static BOOL CRYPT_FormatCertIssuer(DWORD dwFormatStrType,
else else
{ {
*pcbStr = bytesNeeded; *pcbStr = bytesNeeded;
strcpyW(str, buf); lstrcpyW(str, buf);
bytesNeeded -= strlenW(str) * sizeof(WCHAR); bytesNeeded -= lstrlenW(str) * sizeof(WCHAR);
str += strlenW(str); str += lstrlenW(str);
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen / sizeof(WCHAR); str += sepLen / sizeof(WCHAR);
ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 1, issuer, str, ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 1, issuer, str,
&bytesNeeded); &bytesNeeded);
...@@ -1539,12 +1538,12 @@ static BOOL WINAPI CRYPT_FormatAuthorityKeyId2(DWORD dwCertEncodingType, ...@@ -1539,12 +1538,12 @@ static BOOL WINAPI CRYPT_FormatAuthorityKeyId2(DWORD dwCertEncodingType,
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
sep = crlf; sep = crlf;
sepLen = strlenW(crlf) * sizeof(WCHAR); sepLen = lstrlenW(crlf) * sizeof(WCHAR);
} }
else else
{ {
sep = commaSpace; sep = commaSpace;
sepLen = strlenW(commaSpace) * sizeof(WCHAR); sepLen = lstrlenW(commaSpace) * sizeof(WCHAR);
} }
if (info->KeyId.cbData) if (info->KeyId.cbData)
...@@ -1613,7 +1612,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityKeyId2(DWORD dwCertEncodingType, ...@@ -1613,7 +1612,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityKeyId2(DWORD dwCertEncodingType,
{ {
if (needSeparator) if (needSeparator)
{ {
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen / sizeof(WCHAR); str += sepLen / sizeof(WCHAR);
} }
needSeparator = TRUE; needSeparator = TRUE;
...@@ -1630,7 +1629,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityKeyId2(DWORD dwCertEncodingType, ...@@ -1630,7 +1629,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityKeyId2(DWORD dwCertEncodingType,
{ {
if (needSeparator) if (needSeparator)
{ {
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen / sizeof(WCHAR); str += sepLen / sizeof(WCHAR);
} }
/* Overestimate size available, it's already been checked /* Overestimate size available, it's already been checked
...@@ -1679,7 +1678,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType, ...@@ -1679,7 +1678,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType,
WCHAR infoNotAvailable[MAX_STRING_RESOURCE_LEN]; WCHAR infoNotAvailable[MAX_STRING_RESOURCE_LEN];
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable)); LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable));
bytesNeeded += strlenW(infoNotAvailable) * sizeof(WCHAR); bytesNeeded += lstrlenW(infoNotAvailable) * sizeof(WCHAR);
if (!pbFormat) if (!pbFormat)
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
else if (*pcbFormat < bytesNeeded) else if (*pcbFormat < bytesNeeded)
...@@ -1691,7 +1690,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType, ...@@ -1691,7 +1690,7 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType,
else else
{ {
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
strcpyW(pbFormat, infoNotAvailable); lstrcpyW(pbFormat, infoNotAvailable);
} }
} }
else else
...@@ -1730,41 +1729,41 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType, ...@@ -1730,41 +1729,41 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType,
{ {
/* Heading */ /* Heading */
bytesNeeded += sizeof(WCHAR); /* left bracket */ bytesNeeded += sizeof(WCHAR); /* left bracket */
sprintfW(accessDescrNum, numFmt, i + 1); swprintf(accessDescrNum, ARRAY_SIZE(accessDescrNum), numFmt, i + 1);
bytesNeeded += strlenW(accessDescrNum) * sizeof(WCHAR); bytesNeeded += lstrlenW(accessDescrNum) * sizeof(WCHAR);
bytesNeeded += sizeof(WCHAR); /* right bracket */ bytesNeeded += sizeof(WCHAR); /* right bracket */
bytesNeeded += strlenW(aia) * sizeof(WCHAR); bytesNeeded += lstrlenW(aia) * sizeof(WCHAR);
bytesNeeded += strlenW(headingSep) * sizeof(WCHAR); bytesNeeded += lstrlenW(headingSep) * sizeof(WCHAR);
/* Access method */ /* Access method */
bytesNeeded += strlenW(accessMethod) * sizeof(WCHAR); bytesNeeded += lstrlenW(accessMethod) * sizeof(WCHAR);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
bytesNeeded += strlenW(indent) * sizeof(WCHAR); bytesNeeded += lstrlenW(indent) * sizeof(WCHAR);
if (!strcmp(info->rgAccDescr[i].pszAccessMethod, if (!strcmp(info->rgAccDescr[i].pszAccessMethod,
szOID_PKIX_OCSP)) szOID_PKIX_OCSP))
bytesNeeded += strlenW(ocsp) * sizeof(WCHAR); bytesNeeded += lstrlenW(ocsp) * sizeof(WCHAR);
else if (!strcmp(info->rgAccDescr[i].pszAccessMethod, else if (!strcmp(info->rgAccDescr[i].pszAccessMethod,
szOID_PKIX_CA_ISSUERS)) szOID_PKIX_CA_ISSUERS))
bytesNeeded += strlenW(caIssuers) * sizeof(caIssuers); bytesNeeded += lstrlenW(caIssuers) * sizeof(caIssuers);
else else
bytesNeeded += strlenW(unknown) * sizeof(WCHAR); bytesNeeded += lstrlenW(unknown) * sizeof(WCHAR);
bytesNeeded += sizeof(WCHAR); /* space */ bytesNeeded += sizeof(WCHAR); /* space */
bytesNeeded += sizeof(WCHAR); /* left paren */ bytesNeeded += sizeof(WCHAR); /* left paren */
bytesNeeded += strlen(info->rgAccDescr[i].pszAccessMethod) bytesNeeded += strlen(info->rgAccDescr[i].pszAccessMethod)
* sizeof(WCHAR); * sizeof(WCHAR);
bytesNeeded += sizeof(WCHAR); /* right paren */ bytesNeeded += sizeof(WCHAR); /* right paren */
/* Delimiter between access method and location */ /* Delimiter between access method and location */
bytesNeeded += strlenW(accessMethodSep) * sizeof(WCHAR); bytesNeeded += lstrlenW(accessMethodSep) * sizeof(WCHAR);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
bytesNeeded += strlenW(indent) * sizeof(WCHAR); bytesNeeded += lstrlenW(indent) * sizeof(WCHAR);
bytesNeeded += strlenW(accessLocation) * sizeof(WCHAR); bytesNeeded += lstrlenW(accessLocation) * sizeof(WCHAR);
bytesNeeded += strlenW(locationSep) * sizeof(WCHAR); bytesNeeded += lstrlenW(locationSep) * sizeof(WCHAR);
ret = CRYPT_FormatAltNameEntry(dwFormatStrType, 2, ret = CRYPT_FormatAltNameEntry(dwFormatStrType, 2,
&info->rgAccDescr[i].AccessLocation, NULL, &size); &info->rgAccDescr[i].AccessLocation, NULL, &size);
if (ret) if (ret)
bytesNeeded += size - sizeof(WCHAR); bytesNeeded += size - sizeof(WCHAR);
/* Need extra delimiter between access method entries */ /* Need extra delimiter between access method entries */
if (i < info->cAccDescr - 1) if (i < info->cAccDescr - 1)
bytesNeeded += strlenW(accessMethodSep) * sizeof(WCHAR); bytesNeeded += lstrlenW(accessMethodSep) * sizeof(WCHAR);
} }
if (ret) if (ret)
{ {
...@@ -1787,37 +1786,37 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType, ...@@ -1787,37 +1786,37 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType,
LPCSTR oidPtr; LPCSTR oidPtr;
*str++ = '['; *str++ = '[';
sprintfW(accessDescrNum, numFmt, i + 1); swprintf(accessDescrNum, ARRAY_SIZE(accessDescrNum), numFmt, i + 1);
strcpyW(str, accessDescrNum); lstrcpyW(str, accessDescrNum);
str += strlenW(accessDescrNum); str += lstrlenW(accessDescrNum);
*str++ = ']'; *str++ = ']';
strcpyW(str, aia); lstrcpyW(str, aia);
str += strlenW(aia); str += lstrlenW(aia);
strcpyW(str, headingSep); lstrcpyW(str, headingSep);
str += strlenW(headingSep); str += lstrlenW(headingSep);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
strcpyW(str, accessMethod); lstrcpyW(str, accessMethod);
str += strlenW(accessMethod); str += lstrlenW(accessMethod);
if (!strcmp(info->rgAccDescr[i].pszAccessMethod, if (!strcmp(info->rgAccDescr[i].pszAccessMethod,
szOID_PKIX_OCSP)) szOID_PKIX_OCSP))
{ {
strcpyW(str, ocsp); lstrcpyW(str, ocsp);
str += strlenW(ocsp); str += lstrlenW(ocsp);
} }
else if (!strcmp(info->rgAccDescr[i].pszAccessMethod, else if (!strcmp(info->rgAccDescr[i].pszAccessMethod,
szOID_PKIX_CA_ISSUERS)) szOID_PKIX_CA_ISSUERS))
{ {
strcpyW(str, caIssuers); lstrcpyW(str, caIssuers);
str += strlenW(caIssuers); str += lstrlenW(caIssuers);
} }
else else
{ {
strcpyW(str, unknown); lstrcpyW(str, unknown);
str += strlenW(unknown); str += lstrlenW(unknown);
} }
*str++ = ' '; *str++ = ' ';
*str++ = '('; *str++ = '(';
...@@ -1825,17 +1824,17 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType, ...@@ -1825,17 +1824,17 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType,
*oidPtr; oidPtr++, str++) *oidPtr; oidPtr++, str++)
*str = *oidPtr; *str = *oidPtr;
*str++ = ')'; *str++ = ')';
strcpyW(str, accessMethodSep); lstrcpyW(str, accessMethodSep);
str += strlenW(accessMethodSep); str += lstrlenW(accessMethodSep);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
strcpyW(str, accessLocation); lstrcpyW(str, accessLocation);
str += strlenW(accessLocation); str += lstrlenW(accessLocation);
strcpyW(str, locationSep); lstrcpyW(str, locationSep);
str += strlenW(locationSep); str += lstrlenW(locationSep);
/* This overestimates the size available, but that /* This overestimates the size available, but that
* won't matter since we checked earlier whether enough * won't matter since we checked earlier whether enough
* space for the entire string was available. * space for the entire string was available.
...@@ -1848,8 +1847,8 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType, ...@@ -1848,8 +1847,8 @@ static BOOL WINAPI CRYPT_FormatAuthorityInfoAccess(DWORD dwCertEncodingType,
str += altNameEntrySize / sizeof(WCHAR) - 1; str += altNameEntrySize / sizeof(WCHAR) - 1;
if (i < info->cAccDescr - 1) if (i < info->cAccDescr - 1)
{ {
strcpyW(str, accessMethodSep); lstrcpyW(str, accessMethodSep);
str += strlenW(accessMethodSep); str += lstrlenW(accessMethodSep);
} }
} }
} }
...@@ -1910,13 +1909,13 @@ static BOOL CRYPT_FormatReason(DWORD dwFormatStrType, ...@@ -1910,13 +1909,13 @@ static BOOL CRYPT_FormatReason(DWORD dwFormatStrType,
{ {
if (reasonFlags->pbData[0] & reason_map[i].reasonBit) if (reasonFlags->pbData[0] & reason_map[i].reasonBit)
{ {
bytesNeeded += strlenW(reason_map[i].reason) * sizeof(WCHAR); bytesNeeded += lstrlenW(reason_map[i].reason) * sizeof(WCHAR);
if (numReasons++) if (numReasons++)
bytesNeeded += strlenW(sep) * sizeof(WCHAR); bytesNeeded += lstrlenW(sep) * sizeof(WCHAR);
} }
} }
sprintfW(bits, bitsFmt, reasonFlags->pbData[0]); swprintf(bits, ARRAY_SIZE(bits), bitsFmt, reasonFlags->pbData[0]);
bytesNeeded += strlenW(bits); bytesNeeded += lstrlenW(bits);
if (!str) if (!str)
*pcbStr = bytesNeeded; *pcbStr = bytesNeeded;
else if (*pcbStr < bytesNeeded) else if (*pcbStr < bytesNeeded)
...@@ -1932,16 +1931,16 @@ static BOOL CRYPT_FormatReason(DWORD dwFormatStrType, ...@@ -1932,16 +1931,16 @@ static BOOL CRYPT_FormatReason(DWORD dwFormatStrType,
{ {
if (reasonFlags->pbData[0] & reason_map[i].reasonBit) if (reasonFlags->pbData[0] & reason_map[i].reasonBit)
{ {
strcpyW(str, reason_map[i].reason); lstrcpyW(str, reason_map[i].reason);
str += strlenW(reason_map[i].reason); str += lstrlenW(reason_map[i].reason);
if (i < ARRAY_SIZE(reason_map) - 1 && numReasons) if (i < ARRAY_SIZE(reason_map) - 1 && numReasons)
{ {
strcpyW(str, sep); lstrcpyW(str, sep);
str += strlenW(sep); str += lstrlenW(sep);
} }
} }
} }
strcpyW(str, bits); lstrcpyW(str, bits);
} }
return ret; return ret;
} }
...@@ -2007,16 +2006,16 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType, ...@@ -2007,16 +2006,16 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
if (distPoint->DistPointName.dwDistPointNameChoice != if (distPoint->DistPointName.dwDistPointNameChoice !=
CRL_DIST_POINT_NO_NAME) CRL_DIST_POINT_NO_NAME)
{ {
bytesNeeded += strlenW(distPointName) * sizeof(WCHAR); bytesNeeded += lstrlenW(distPointName) * sizeof(WCHAR);
bytesNeeded += strlenW(nameSep) * sizeof(WCHAR); bytesNeeded += lstrlenW(nameSep) * sizeof(WCHAR);
if (distPoint->DistPointName.dwDistPointNameChoice == if (distPoint->DistPointName.dwDistPointNameChoice ==
CRL_DIST_POINT_FULL_NAME) CRL_DIST_POINT_FULL_NAME)
bytesNeeded += strlenW(fullName) * sizeof(WCHAR); bytesNeeded += lstrlenW(fullName) * sizeof(WCHAR);
else else
bytesNeeded += strlenW(rdnName) * sizeof(WCHAR); bytesNeeded += lstrlenW(rdnName) * sizeof(WCHAR);
bytesNeeded += strlenW(nameSep) * sizeof(WCHAR); bytesNeeded += lstrlenW(nameSep) * sizeof(WCHAR);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
bytesNeeded += 2 * strlenW(indent) * sizeof(WCHAR); bytesNeeded += 2 * lstrlenW(indent) * sizeof(WCHAR);
/* The indent level (3) is higher than when used as the issuer, /* The indent level (3) is higher than when used as the issuer,
* because the name is subordinate to the name type (full vs. * because the name is subordinate to the name type (full vs.
* RDN.) * RDN.)
...@@ -2029,7 +2028,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType, ...@@ -2029,7 +2028,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
} }
else if (distPoint->ReasonFlags.cbData) else if (distPoint->ReasonFlags.cbData)
{ {
bytesNeeded += strlenW(reason) * sizeof(WCHAR); bytesNeeded += lstrlenW(reason) * sizeof(WCHAR);
ret = CRYPT_FormatReason(dwFormatStrType, ret = CRYPT_FormatReason(dwFormatStrType,
&distPoint->ReasonFlags, NULL, &size); &distPoint->ReasonFlags, NULL, &size);
if (ret) if (ret)
...@@ -2038,8 +2037,8 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType, ...@@ -2038,8 +2037,8 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
} }
else if (distPoint->CRLIssuer.cAltEntry) else if (distPoint->CRLIssuer.cAltEntry)
{ {
bytesNeeded += strlenW(issuer) * sizeof(WCHAR); bytesNeeded += lstrlenW(issuer) * sizeof(WCHAR);
bytesNeeded += strlenW(nameSep) * sizeof(WCHAR); bytesNeeded += lstrlenW(nameSep) * sizeof(WCHAR);
ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 2, ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 2,
&distPoint->CRLIssuer, NULL, &size); &distPoint->CRLIssuer, NULL, &size);
if (ret) if (ret)
...@@ -2049,13 +2048,13 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType, ...@@ -2049,13 +2048,13 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
if (haveAnEntry) if (haveAnEntry)
{ {
bytesNeeded += sizeof(WCHAR); /* left bracket */ bytesNeeded += sizeof(WCHAR); /* left bracket */
sprintfW(distPointNum, numFmt, i + 1); swprintf(distPointNum, ARRAY_SIZE(distPointNum), numFmt, i + 1);
bytesNeeded += strlenW(distPointNum) * sizeof(WCHAR); bytesNeeded += lstrlenW(distPointNum) * sizeof(WCHAR);
bytesNeeded += sizeof(WCHAR); /* right bracket */ bytesNeeded += sizeof(WCHAR); /* right bracket */
bytesNeeded += strlenW(crlDistPoint) * sizeof(WCHAR); bytesNeeded += lstrlenW(crlDistPoint) * sizeof(WCHAR);
bytesNeeded += strlenW(headingSep) * sizeof(WCHAR); bytesNeeded += lstrlenW(headingSep) * sizeof(WCHAR);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
bytesNeeded += strlenW(indent) * sizeof(WCHAR); bytesNeeded += lstrlenW(indent) * sizeof(WCHAR);
} }
} }
if (!haveAnEntry) if (!haveAnEntry)
...@@ -2063,7 +2062,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType, ...@@ -2063,7 +2062,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
WCHAR infoNotAvailable[MAX_STRING_RESOURCE_LEN]; WCHAR infoNotAvailable[MAX_STRING_RESOURCE_LEN];
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable)); LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable));
bytesNeeded += strlenW(infoNotAvailable) * sizeof(WCHAR); bytesNeeded += lstrlenW(infoNotAvailable) * sizeof(WCHAR);
if (!pbFormat) if (!pbFormat)
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
else if (*pcbFormat < bytesNeeded) else if (*pcbFormat < bytesNeeded)
...@@ -2075,7 +2074,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType, ...@@ -2075,7 +2074,7 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
else else
{ {
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
strcpyW(pbFormat, infoNotAvailable); lstrcpyW(pbFormat, infoNotAvailable);
} }
} }
else else
...@@ -2098,48 +2097,48 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType, ...@@ -2098,48 +2097,48 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
CRL_DIST_POINT *distPoint = &info->rgDistPoint[i]; CRL_DIST_POINT *distPoint = &info->rgDistPoint[i];
*str++ = '['; *str++ = '[';
sprintfW(distPointNum, numFmt, i + 1); swprintf(distPointNum, ARRAY_SIZE(distPointNum), numFmt, i + 1);
strcpyW(str, distPointNum); lstrcpyW(str, distPointNum);
str += strlenW(distPointNum); str += lstrlenW(distPointNum);
*str++ = ']'; *str++ = ']';
strcpyW(str, crlDistPoint); lstrcpyW(str, crlDistPoint);
str += strlenW(crlDistPoint); str += lstrlenW(crlDistPoint);
strcpyW(str, headingSep); lstrcpyW(str, headingSep);
str += strlenW(headingSep); str += lstrlenW(headingSep);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
if (distPoint->DistPointName.dwDistPointNameChoice != if (distPoint->DistPointName.dwDistPointNameChoice !=
CRL_DIST_POINT_NO_NAME) CRL_DIST_POINT_NO_NAME)
{ {
DWORD altNameSize = bytesNeeded; DWORD altNameSize = bytesNeeded;
strcpyW(str, distPointName); lstrcpyW(str, distPointName);
str += strlenW(distPointName); str += lstrlenW(distPointName);
strcpyW(str, nameSep); lstrcpyW(str, nameSep);
str += strlenW(nameSep); str += lstrlenW(nameSep);
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
strcpyW(str, indent); lstrcpyW(str, indent);
str += strlenW(indent); str += lstrlenW(indent);
} }
if (distPoint->DistPointName.dwDistPointNameChoice == if (distPoint->DistPointName.dwDistPointNameChoice ==
CRL_DIST_POINT_FULL_NAME) CRL_DIST_POINT_FULL_NAME)
{ {
strcpyW(str, fullName); lstrcpyW(str, fullName);
str += strlenW(fullName); str += lstrlenW(fullName);
} }
else else
{ {
strcpyW(str, rdnName); lstrcpyW(str, rdnName);
str += strlenW(rdnName); str += lstrlenW(rdnName);
} }
strcpyW(str, nameSep); lstrcpyW(str, nameSep);
str += strlenW(nameSep); str += lstrlenW(nameSep);
ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 3, ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 3,
&distPoint->DistPointName.u.FullName, str, &distPoint->DistPointName.u.FullName, str,
&altNameSize); &altNameSize);
...@@ -2150,8 +2149,8 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType, ...@@ -2150,8 +2149,8 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
{ {
DWORD reasonSize = bytesNeeded; DWORD reasonSize = bytesNeeded;
strcpyW(str, reason); lstrcpyW(str, reason);
str += strlenW(reason); str += lstrlenW(reason);
ret = CRYPT_FormatReason(dwFormatStrType, ret = CRYPT_FormatReason(dwFormatStrType,
&distPoint->ReasonFlags, str, &reasonSize); &distPoint->ReasonFlags, str, &reasonSize);
if (ret) if (ret)
...@@ -2161,10 +2160,10 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType, ...@@ -2161,10 +2160,10 @@ static BOOL WINAPI CRYPT_FormatCRLDistPoints(DWORD dwCertEncodingType,
{ {
DWORD crlIssuerSize = bytesNeeded; DWORD crlIssuerSize = bytesNeeded;
strcpyW(str, issuer); lstrcpyW(str, issuer);
str += strlenW(issuer); str += lstrlenW(issuer);
strcpyW(str, nameSep); lstrcpyW(str, nameSep);
str += strlenW(nameSep); str += lstrlenW(nameSep);
ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 2, ret = CRYPT_FormatAltNameInfo(dwFormatStrType, 2,
&distPoint->CRLIssuer, str, &distPoint->CRLIssuer, str,
&crlIssuerSize); &crlIssuerSize);
...@@ -2205,12 +2204,12 @@ static BOOL WINAPI CRYPT_FormatEnhancedKeyUsage(DWORD dwCertEncodingType, ...@@ -2205,12 +2204,12 @@ static BOOL WINAPI CRYPT_FormatEnhancedKeyUsage(DWORD dwCertEncodingType,
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
sep = crlf; sep = crlf;
sepLen = strlenW(crlf) * sizeof(WCHAR); sepLen = lstrlenW(crlf) * sizeof(WCHAR);
} }
else else
{ {
sep = commaSpace; sep = commaSpace;
sepLen = strlenW(commaSpace) * sizeof(WCHAR); sepLen = lstrlenW(commaSpace) * sizeof(WCHAR);
} }
LoadStringW(hInstance, IDS_USAGE_UNKNOWN, unknown, ARRAY_SIZE(unknown)); LoadStringW(hInstance, IDS_USAGE_UNKNOWN, unknown, ARRAY_SIZE(unknown));
...@@ -2220,9 +2219,9 @@ static BOOL WINAPI CRYPT_FormatEnhancedKeyUsage(DWORD dwCertEncodingType, ...@@ -2220,9 +2219,9 @@ static BOOL WINAPI CRYPT_FormatEnhancedKeyUsage(DWORD dwCertEncodingType,
usage->rgpszUsageIdentifier[i], CRYPT_ENHKEY_USAGE_OID_GROUP_ID); usage->rgpszUsageIdentifier[i], CRYPT_ENHKEY_USAGE_OID_GROUP_ID);
if (info) if (info)
bytesNeeded += strlenW(info->pwszName) * sizeof(WCHAR); bytesNeeded += lstrlenW(info->pwszName) * sizeof(WCHAR);
else else
bytesNeeded += strlenW(unknown) * sizeof(WCHAR); bytesNeeded += lstrlenW(unknown) * sizeof(WCHAR);
bytesNeeded += sizeof(WCHAR); /* space */ bytesNeeded += sizeof(WCHAR); /* space */
bytesNeeded += sizeof(WCHAR); /* left paren */ bytesNeeded += sizeof(WCHAR); /* left paren */
bytesNeeded += strlen(usage->rgpszUsageIdentifier[i]) * bytesNeeded += strlen(usage->rgpszUsageIdentifier[i]) *
...@@ -2253,13 +2252,13 @@ static BOOL WINAPI CRYPT_FormatEnhancedKeyUsage(DWORD dwCertEncodingType, ...@@ -2253,13 +2252,13 @@ static BOOL WINAPI CRYPT_FormatEnhancedKeyUsage(DWORD dwCertEncodingType,
if (info) if (info)
{ {
strcpyW(str, info->pwszName); lstrcpyW(str, info->pwszName);
str += strlenW(info->pwszName); str += lstrlenW(info->pwszName);
} }
else else
{ {
strcpyW(str, unknown); lstrcpyW(str, unknown);
str += strlenW(unknown); str += lstrlenW(unknown);
} }
*str++ = ' '; *str++ = ' ';
*str++ = '('; *str++ = '(';
...@@ -2269,7 +2268,7 @@ static BOOL WINAPI CRYPT_FormatEnhancedKeyUsage(DWORD dwCertEncodingType, ...@@ -2269,7 +2268,7 @@ static BOOL WINAPI CRYPT_FormatEnhancedKeyUsage(DWORD dwCertEncodingType,
*str = 0; *str = 0;
if (i < usage->cUsageIdentifier - 1) if (i < usage->cUsageIdentifier - 1)
{ {
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen / sizeof(WCHAR); str += sepLen / sizeof(WCHAR);
} }
} }
...@@ -2312,7 +2311,7 @@ static BOOL WINAPI CRYPT_FormatNetscapeCertType(DWORD dwCertEncodingType, ...@@ -2312,7 +2311,7 @@ static BOOL WINAPI CRYPT_FormatNetscapeCertType(DWORD dwCertEncodingType,
LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable)); LoadStringW(hInstance, IDS_INFO_NOT_AVAILABLE, infoNotAvailable, ARRAY_SIZE(infoNotAvailable));
if (!bits->cbData || bits->cbData > 1) if (!bits->cbData || bits->cbData > 1)
{ {
bytesNeeded += strlenW(infoNotAvailable) * sizeof(WCHAR); bytesNeeded += lstrlenW(infoNotAvailable) * sizeof(WCHAR);
if (!pbFormat) if (!pbFormat)
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
else if (*pcbFormat < bytesNeeded) else if (*pcbFormat < bytesNeeded)
...@@ -2326,7 +2325,7 @@ static BOOL WINAPI CRYPT_FormatNetscapeCertType(DWORD dwCertEncodingType, ...@@ -2326,7 +2325,7 @@ static BOOL WINAPI CRYPT_FormatNetscapeCertType(DWORD dwCertEncodingType,
LPWSTR str = pbFormat; LPWSTR str = pbFormat;
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
strcpyW(str, infoNotAvailable); lstrcpyW(str, infoNotAvailable);
} }
} }
else else
...@@ -2424,26 +2423,26 @@ static BOOL WINAPI CRYPT_FormatSpcFinancialCriteria(DWORD dwCertEncodingType, ...@@ -2424,26 +2423,26 @@ static BOOL WINAPI CRYPT_FormatSpcFinancialCriteria(DWORD dwCertEncodingType,
if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE) if (dwFormatStrType & CRYPT_FORMAT_STR_MULTI_LINE)
{ {
sep = crlf; sep = crlf;
sepLen = strlenW(crlf) * sizeof(WCHAR); sepLen = lstrlenW(crlf) * sizeof(WCHAR);
} }
else else
{ {
sep = commaSpace; sep = commaSpace;
sepLen = strlenW(commaSpace) * sizeof(WCHAR); sepLen = lstrlenW(commaSpace) * sizeof(WCHAR);
} }
bytesNeeded += strlenW(financialCriteria) * sizeof(WCHAR); bytesNeeded += lstrlenW(financialCriteria) * sizeof(WCHAR);
if (criteria.fFinancialInfoAvailable) if (criteria.fFinancialInfoAvailable)
{ {
bytesNeeded += strlenW(available) * sizeof(WCHAR); bytesNeeded += lstrlenW(available) * sizeof(WCHAR);
bytesNeeded += sepLen; bytesNeeded += sepLen;
bytesNeeded += strlenW(meetsCriteria) * sizeof(WCHAR); bytesNeeded += lstrlenW(meetsCriteria) * sizeof(WCHAR);
if (criteria.fMeetsCriteria) if (criteria.fMeetsCriteria)
bytesNeeded += strlenW(yes) * sizeof(WCHAR); bytesNeeded += lstrlenW(yes) * sizeof(WCHAR);
else else
bytesNeeded += strlenW(no) * sizeof(WCHAR); bytesNeeded += lstrlenW(no) * sizeof(WCHAR);
} }
else else
bytesNeeded += strlenW(notAvailable) * sizeof(WCHAR); bytesNeeded += lstrlenW(notAvailable) * sizeof(WCHAR);
if (!pbFormat) if (!pbFormat)
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
else if (*pcbFormat < bytesNeeded) else if (*pcbFormat < bytesNeeded)
...@@ -2457,24 +2456,24 @@ static BOOL WINAPI CRYPT_FormatSpcFinancialCriteria(DWORD dwCertEncodingType, ...@@ -2457,24 +2456,24 @@ static BOOL WINAPI CRYPT_FormatSpcFinancialCriteria(DWORD dwCertEncodingType,
LPWSTR str = pbFormat; LPWSTR str = pbFormat;
*pcbFormat = bytesNeeded; *pcbFormat = bytesNeeded;
strcpyW(str, financialCriteria); lstrcpyW(str, financialCriteria);
str += strlenW(financialCriteria); str += lstrlenW(financialCriteria);
if (criteria.fFinancialInfoAvailable) if (criteria.fFinancialInfoAvailable)
{ {
strcpyW(str, available); lstrcpyW(str, available);
str += strlenW(available); str += lstrlenW(available);
strcpyW(str, sep); lstrcpyW(str, sep);
str += sepLen / sizeof(WCHAR); str += sepLen / sizeof(WCHAR);
strcpyW(str, meetsCriteria); lstrcpyW(str, meetsCriteria);
str += strlenW(meetsCriteria); str += lstrlenW(meetsCriteria);
if (criteria.fMeetsCriteria) if (criteria.fMeetsCriteria)
strcpyW(str, yes); lstrcpyW(str, yes);
else else
strcpyW(str, no); lstrcpyW(str, no);
} }
else else
{ {
strcpyW(str, notAvailable); lstrcpyW(str, notAvailable);
} }
} }
} }
...@@ -2511,7 +2510,7 @@ static BOOL WINAPI CRYPT_FormatUnicodeString(DWORD dwCertEncodingType, ...@@ -2511,7 +2510,7 @@ static BOOL WINAPI CRYPT_FormatUnicodeString(DWORD dwCertEncodingType,
LPWSTR str = pbFormat; LPWSTR str = pbFormat;
*pcbFormat = value->Value.cbData; *pcbFormat = value->Value.cbData;
strcpyW(str, (LPWSTR)value->Value.pbData); lstrcpyW(str, (LPWSTR)value->Value.pbData);
} }
} }
return ret; return ret;
......
...@@ -18,11 +18,9 @@ ...@@ -18,11 +18,9 @@
* 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 "wine/port.h"
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#define NONAMELESSUNION #define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -119,7 +117,7 @@ HCRYPTOIDFUNCSET WINAPI CryptInitOIDFunctionSet(LPCSTR pszFuncName, ...@@ -119,7 +117,7 @@ HCRYPTOIDFUNCSET WINAPI CryptInitOIDFunctionSet(LPCSTR pszFuncName,
EnterCriticalSection(&funcSetCS); EnterCriticalSection(&funcSetCS);
LIST_FOR_EACH_ENTRY(cursor, &funcSets, struct OIDFunctionSet, next) LIST_FOR_EACH_ENTRY(cursor, &funcSets, struct OIDFunctionSet, next)
{ {
if (!_strnicmp(pszFuncName, cursor->name, -1)) if (!stricmp(pszFuncName, cursor->name))
{ {
ret = cursor; ret = cursor;
break; break;
...@@ -404,7 +402,7 @@ BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet, ...@@ -404,7 +402,7 @@ BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet,
if (!IS_INTOID(pszOID)) if (!IS_INTOID(pszOID))
{ {
if (!IS_INTOID(function->entry.pszOID) && if (!IS_INTOID(function->entry.pszOID) &&
!_strnicmp(function->entry.pszOID, pszOID, -1)) !stricmp(function->entry.pszOID, pszOID))
{ {
*ppvFuncAddr = function->entry.pvFuncAddr; *ppvFuncAddr = function->entry.pvFuncAddr;
*phFuncAddr = NULL; /* FIXME: what should it be? */ *phFuncAddr = NULL; /* FIXME: what should it be? */
...@@ -1828,7 +1826,7 @@ PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey, ...@@ -1828,7 +1826,7 @@ PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey,
EnterCriticalSection(&oidInfoCS); EnterCriticalSection(&oidInfoCS);
LIST_FOR_EACH_ENTRY(info, &oidInfo, struct OIDInfo, entry) LIST_FOR_EACH_ENTRY(info, &oidInfo, struct OIDInfo, entry)
{ {
if (!lstrcmpW(info->info.pwszName, pvKey) && if (!wcscmp(info->info.pwszName, pvKey) &&
(!dwGroupId || info->info.dwGroupId == dwGroupId)) (!dwGroupId || info->info.dwGroupId == dwGroupId))
{ {
ret = &info->info; ret = &info->info;
......
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,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 "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
...@@ -29,7 +26,6 @@ ...@@ -29,7 +26,6 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt); WINE_DEFAULT_DEBUG_CHANNEL(crypt);
...@@ -111,11 +107,11 @@ static BOOL set_key_prov_info( const void *ctx, HCRYPTPROV prov ) ...@@ -111,11 +107,11 @@ static BOOL set_key_prov_info( const void *ctx, HCRYPTPROV prov )
ptr = (WCHAR *)(prov_info + 1); ptr = (WCHAR *)(prov_info + 1);
prov_info->pwszContainerName = ptr; prov_info->pwszContainerName = ptr;
strcpyW( prov_info->pwszContainerName, container ); lstrcpyW( prov_info->pwszContainerName, container );
ptr += len_container; ptr += len_container;
prov_info->pwszProvName = ptr; prov_info->pwszProvName = ptr;
strcpyW( prov_info->pwszProvName, name ); lstrcpyW( prov_info->pwszProvName, name );
size = sizeof(prov_info->dwProvType); size = sizeof(prov_info->dwProvType);
CryptGetProvParam( prov, PP_PROVTYPE, (BYTE *)&prov_info->dwProvType, &size, 0 ); CryptGetProvParam( prov, PP_PROVTYPE, (BYTE *)&prov_info->dwProvType, &size, 0 );
......
...@@ -132,7 +132,7 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType, ...@@ -132,7 +132,7 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType,
TRACE("comparing %s\n", TRACE("comparing %s\n",
debugstr_w(asciiHash)); debugstr_w(asciiHash));
TRACE("with %s\n", debugstr_w(subKeyName)); TRACE("with %s\n", debugstr_w(subKeyName));
if (!lstrcmpW(asciiHash, subKeyName)) if (!wcscmp(asciiHash, subKeyName))
{ {
TRACE("hash matches, adding\n"); TRACE("hash matches, adding\n");
contextInterface->addContextToStore( contextInterface->addContextToStore(
......
...@@ -15,25 +15,9 @@ ...@@ -15,25 +15,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* 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>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#include <limits.h>
#ifdef HAVE_SECURITY_SECURITY_H
#include <Security/Security.h>
#endif
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "windef.h" #include "windef.h"
......
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,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 "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
......
...@@ -23,9 +23,6 @@ ...@@ -23,9 +23,6 @@
* - Many flags, options and whatnot are unimplemented. * - Many flags, options and whatnot are unimplemented.
*/ */
#include "config.h"
#include "wine/port.h"
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
...@@ -874,19 +871,19 @@ HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, ...@@ -874,19 +871,19 @@ HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider,
FIXME("unimplemented type %d\n", LOWORD(lpszStoreProvider)); FIXME("unimplemented type %d\n", LOWORD(lpszStoreProvider));
} }
} }
else if (!_strnicmp(lpszStoreProvider, sz_CERT_STORE_PROV_MEMORY, -1)) else if (!stricmp(lpszStoreProvider, sz_CERT_STORE_PROV_MEMORY))
openFunc = CRYPT_MemOpenStore; openFunc = CRYPT_MemOpenStore;
else if (!_strnicmp(lpszStoreProvider, sz_CERT_STORE_PROV_FILENAME_W, -1)) else if (!stricmp(lpszStoreProvider, sz_CERT_STORE_PROV_FILENAME_W))
openFunc = CRYPT_FileOpenStore; openFunc = CRYPT_FileOpenStore;
else if (!_strnicmp(lpszStoreProvider, sz_CERT_STORE_PROV_SYSTEM, -1)) else if (!stricmp(lpszStoreProvider, sz_CERT_STORE_PROV_SYSTEM))
openFunc = CRYPT_SysOpenStoreW; openFunc = CRYPT_SysOpenStoreW;
else if (!_strnicmp(lpszStoreProvider, sz_CERT_STORE_PROV_PKCS7, -1)) else if (!stricmp(lpszStoreProvider, sz_CERT_STORE_PROV_PKCS7))
openFunc = CRYPT_PKCSOpenStore; openFunc = CRYPT_PKCSOpenStore;
else if (!_strnicmp(lpszStoreProvider, sz_CERT_STORE_PROV_SERIALIZED, -1)) else if (!stricmp(lpszStoreProvider, sz_CERT_STORE_PROV_SERIALIZED))
openFunc = CRYPT_SerializedOpenStore; openFunc = CRYPT_SerializedOpenStore;
else if (!_strnicmp(lpszStoreProvider, sz_CERT_STORE_PROV_COLLECTION, -1)) else if (!stricmp(lpszStoreProvider, sz_CERT_STORE_PROV_COLLECTION))
openFunc = CRYPT_CollectionOpenStore; openFunc = CRYPT_CollectionOpenStore;
else if (!_strnicmp(lpszStoreProvider, sz_CERT_STORE_PROV_SYSTEM_REGISTRY, -1)) else if (!stricmp(lpszStoreProvider, sz_CERT_STORE_PROV_SYSTEM_REGISTRY))
openFunc = CRYPT_SysRegOpenStoreW; openFunc = CRYPT_SysRegOpenStoreW;
else else
{ {
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "winuser.h" #include "winuser.h"
#include "wincrypt.h" #include "wincrypt.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "crypt32_private.h" #include "crypt32_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt); WINE_DEFAULT_DEBUG_CHANNEL(crypt);
...@@ -233,10 +232,10 @@ static DWORD quote_rdn_value_to_str_a(DWORD dwValueType, ...@@ -233,10 +232,10 @@ static DWORD quote_rdn_value_to_str_a(DWORD dwValueType,
case CERT_RDN_UTF8_STRING: case CERT_RDN_UTF8_STRING:
len = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)pValue->pbData, len = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)pValue->pbData,
pValue->cbData / sizeof(WCHAR), NULL, 0, NULL, NULL); pValue->cbData / sizeof(WCHAR), NULL, 0, NULL, NULL);
if (pValue->cbData && isspaceW(((LPCWSTR)pValue->pbData)[0])) if (pValue->cbData && iswspace(((LPCWSTR)pValue->pbData)[0]))
needsQuotes = TRUE; needsQuotes = TRUE;
if (pValue->cbData && if (pValue->cbData &&
isspaceW(((LPCWSTR)pValue->pbData)[pValue->cbData / sizeof(WCHAR)-1])) iswspace(((LPCWSTR)pValue->pbData)[pValue->cbData / sizeof(WCHAR)-1]))
needsQuotes = TRUE; needsQuotes = TRUE;
for (i = 0; i < pValue->cbData / sizeof(WCHAR); i++) for (i = 0; i < pValue->cbData / sizeof(WCHAR); i++)
{ {
...@@ -561,7 +560,7 @@ static DWORD CRYPT_AddPrefixW(LPCWSTR prefix, LPWSTR psz, DWORD csz) ...@@ -561,7 +560,7 @@ static DWORD CRYPT_AddPrefixW(LPCWSTR prefix, LPWSTR psz, DWORD csz)
if (psz) if (psz)
{ {
chars = min(strlenW(prefix), csz); chars = min(lstrlenW(prefix), csz);
memcpy(psz, prefix, chars * sizeof(WCHAR)); memcpy(psz, prefix, chars * sizeof(WCHAR));
*(psz + chars) = '='; *(psz + chars) = '=';
chars++; chars++;
...@@ -643,11 +642,11 @@ DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indentLevel, ...@@ -643,11 +642,11 @@ DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indentLevel,
{ {
if (psz) if (psz)
{ {
chars = min(strlenW(indent), csz - ret - 1); chars = min(lstrlenW(indent), csz - ret - 1);
memcpy(psz + ret, indent, chars * sizeof(WCHAR)); memcpy(psz + ret, indent, chars * sizeof(WCHAR));
} }
else else
chars = strlenW(indent); chars = lstrlenW(indent);
ret += chars; ret += chars;
} }
} }
...@@ -812,14 +811,14 @@ static BOOL CRYPT_GetNextKeyW(LPCWSTR str, struct X500TokenW *token, ...@@ -812,14 +811,14 @@ static BOOL CRYPT_GetNextKeyW(LPCWSTR str, struct X500TokenW *token,
{ {
BOOL ret = TRUE; BOOL ret = TRUE;
while (*str && isspaceW(*str)) while (*str && iswspace(*str))
str++; str++;
if (*str) if (*str)
{ {
token->start = str; token->start = str;
while (*str && *str != '=' && !isspaceW(*str)) while (*str && *str != '=' && !iswspace(*str))
str++; str++;
if (*str && (*str == '=' || isspaceW(*str))) if (*str && (*str == '=' || iswspace(*str)))
token->end = str; token->end = str;
else else
{ {
...@@ -845,7 +844,7 @@ static BOOL CRYPT_GetNextValueW(LPCWSTR str, DWORD dwFlags, LPCWSTR separators, ...@@ -845,7 +844,7 @@ static BOOL CRYPT_GetNextValueW(LPCWSTR str, DWORD dwFlags, LPCWSTR separators,
ppszError); ppszError);
*separator_used = 0; *separator_used = 0;
while (*str && isspaceW(*str)) while (*str && iswspace(*str))
str++; str++;
if (*str) if (*str)
{ {
...@@ -1059,7 +1058,7 @@ BOOL WINAPI CertStrToNameW(DWORD dwCertEncodingType, LPCWSTR pszX500, ...@@ -1059,7 +1058,7 @@ BOOL WINAPI CertStrToNameW(DWORD dwCertEncodingType, LPCWSTR pszX500,
else else
{ {
str = token.end; str = token.end;
while (isspaceW(*str)) while (iswspace(*str))
str++; str++;
if (*str != '=') if (*str != '=')
{ {
...@@ -1260,10 +1259,10 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, ...@@ -1260,10 +1259,10 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType,
if (entry) if (entry)
{ {
if (!pszNameString) if (!pszNameString)
ret = strlenW(entry->u.pwszRfc822Name) + 1; ret = lstrlenW(entry->u.pwszRfc822Name) + 1;
else if (cchNameString) else if (cchNameString)
{ {
ret = min(strlenW(entry->u.pwszRfc822Name), cchNameString - 1); ret = min(lstrlenW(entry->u.pwszRfc822Name), cchNameString - 1);
memcpy(pszNameString, entry->u.pwszRfc822Name, memcpy(pszNameString, entry->u.pwszRfc822Name,
ret * sizeof(WCHAR)); ret * sizeof(WCHAR));
pszNameString[ret++] = 0; pszNameString[ret++] = 0;
...@@ -1347,10 +1346,10 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, ...@@ -1347,10 +1346,10 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType,
if (entry) if (entry)
{ {
if (!pszNameString) if (!pszNameString)
ret = strlenW(entry->u.pwszRfc822Name) + 1; ret = lstrlenW(entry->u.pwszRfc822Name) + 1;
else if (cchNameString) else if (cchNameString)
{ {
ret = min(strlenW(entry->u.pwszRfc822Name), ret = min(lstrlenW(entry->u.pwszRfc822Name),
cchNameString - 1); cchNameString - 1);
memcpy(pszNameString, entry->u.pwszRfc822Name, memcpy(pszNameString, entry->u.pwszRfc822Name,
ret * sizeof(WCHAR)); ret * sizeof(WCHAR));
...@@ -1384,10 +1383,10 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, ...@@ -1384,10 +1383,10 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType,
if (entry) if (entry)
{ {
if (!pszNameString) if (!pszNameString)
ret = strlenW(entry->u.pwszDNSName) + 1; ret = lstrlenW(entry->u.pwszDNSName) + 1;
else if (cchNameString) else if (cchNameString)
{ {
ret = min(strlenW(entry->u.pwszDNSName), cchNameString - 1); ret = min(lstrlenW(entry->u.pwszDNSName), cchNameString - 1);
memcpy(pszNameString, entry->u.pwszDNSName, ret * sizeof(WCHAR)); memcpy(pszNameString, entry->u.pwszDNSName, ret * sizeof(WCHAR));
pszNameString[ret++] = 0; pszNameString[ret++] = 0;
} }
...@@ -1408,10 +1407,10 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, ...@@ -1408,10 +1407,10 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType,
if (entry) if (entry)
{ {
if (!pszNameString) if (!pszNameString)
ret = strlenW(entry->u.pwszURL) + 1; ret = lstrlenW(entry->u.pwszURL) + 1;
else if (cchNameString) else if (cchNameString)
{ {
ret = min(strlenW(entry->u.pwszURL), cchNameString - 1); ret = min(lstrlenW(entry->u.pwszURL), cchNameString - 1);
memcpy(pszNameString, entry->u.pwszURL, ret * sizeof(WCHAR)); memcpy(pszNameString, entry->u.pwszURL, ret * sizeof(WCHAR));
pszNameString[ret++] = 0; pszNameString[ret++] = 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment