Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1e424138
Commit
1e424138
authored
Oct 16, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Oct 20, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement CryptFindCertificateInStore for unicode strings.
parent
af4b5303
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
3 deletions
+66
-3
cert.c
dlls/crypt32/cert.c
+66
-0
cert.c
dlls/crypt32/tests/cert.c
+0
-3
No files found.
dlls/crypt32/cert.c
View file @
1e424138
...
...
@@ -1422,6 +1422,69 @@ static PCCERT_CONTEXT find_cert_by_issuer(HCERTSTORE store, DWORD dwType,
return
found
;
}
static
BOOL
compare_cert_by_name_str
(
PCCERT_CONTEXT
pCertContext
,
DWORD
dwType
,
DWORD
dwFlags
,
const
void
*
pvPara
)
{
PCERT_NAME_BLOB
name
;
DWORD
len
;
BOOL
ret
=
FALSE
;
if
(
dwType
&
CERT_INFO_SUBJECT_FLAG
)
name
=
&
pCertContext
->
pCertInfo
->
Subject
;
else
name
=
&
pCertContext
->
pCertInfo
->
Issuer
;
len
=
CertNameToStrW
(
pCertContext
->
dwCertEncodingType
,
name
,
CERT_SIMPLE_NAME_STR
,
NULL
,
0
);
if
(
len
)
{
LPWSTR
str
=
CryptMemAlloc
(
len
*
sizeof
(
WCHAR
));
if
(
str
)
{
LPWSTR
ptr
;
CertNameToStrW
(
pCertContext
->
dwCertEncodingType
,
name
,
CERT_SIMPLE_NAME_STR
,
str
,
len
);
for
(
ptr
=
str
;
*
ptr
;
ptr
++
)
*
ptr
=
tolowerW
(
*
ptr
);
if
(
strstrW
(
str
,
pvPara
))
ret
=
TRUE
;
CryptMemFree
(
str
);
}
}
return
ret
;
}
static
PCCERT_CONTEXT
find_cert_by_name_str
(
HCERTSTORE
store
,
DWORD
dwType
,
DWORD
dwFlags
,
const
void
*
pvPara
,
PCCERT_CONTEXT
prev
)
{
PCCERT_CONTEXT
found
=
NULL
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
pvPara
));
if
(
pvPara
)
{
DWORD
len
=
strlenW
(
pvPara
);
LPWSTR
str
=
CryptMemAlloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
str
)
{
LPCWSTR
src
;
LPWSTR
dst
;
for
(
src
=
pvPara
,
dst
=
str
;
*
src
;
src
++
,
dst
++
)
*
dst
=
tolowerW
(
*
src
);
*
dst
=
0
;
found
=
cert_compare_certs_in_store
(
store
,
prev
,
compare_cert_by_name_str
,
dwType
,
dwFlags
,
str
);
CryptMemFree
(
str
);
}
}
else
found
=
find_cert_any
(
store
,
dwType
,
dwFlags
,
NULL
,
prev
);
return
found
;
}
PCCERT_CONTEXT
WINAPI
CertFindCertificateInStore
(
HCERTSTORE
hCertStore
,
DWORD
dwCertEncodingType
,
DWORD
dwFlags
,
DWORD
dwType
,
const
void
*
pvPara
,
PCCERT_CONTEXT
pPrevCertContext
)
...
...
@@ -1450,6 +1513,9 @@ PCCERT_CONTEXT WINAPI CertFindCertificateInStore(HCERTSTORE hCertStore,
case
CERT_COMPARE_PUBLIC_KEY
:
compare
=
compare_cert_by_public_key
;
break
;
case
CERT_COMPARE_NAME_STR_W
:
find
=
find_cert_by_name_str
;
break
;
case
CERT_COMPARE_SUBJECT_CERT
:
compare
=
compare_cert_by_subject_cert
;
break
;
...
...
dlls/crypt32/tests/cert.c
View file @
1e424138
...
...
@@ -1148,7 +1148,6 @@ static void testFindCert(void)
if
(
context
)
count
++
;
}
while
(
context
);
todo_wine
ok
(
count
==
3
,
"expected 3 contexts
\n
"
);
count
=
0
;
context
=
NULL
;
...
...
@@ -1158,7 +1157,6 @@ static void testFindCert(void)
if
(
context
)
count
++
;
}
while
(
context
);
todo_wine
ok
(
count
==
2
,
"expected 2 contexts
\n
"
);
count
=
0
;
context
=
NULL
;
...
...
@@ -1168,7 +1166,6 @@ static void testFindCert(void)
if
(
context
)
count
++
;
}
while
(
context
);
todo_wine
ok
(
count
==
3
,
"expected 3 contexts
\n
"
);
SetLastError
(
0xdeadbeef
);
context
=
CertFindCertificateInStore
(
store
,
X509_ASN_ENCODING
,
0
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment