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"
......
...@@ -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