Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
f2b98325
Commit
f2b98325
authored
Dec 22, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Dec 23, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cryptui: Test importing from a store.
parent
f1796209
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
138 additions
and
0 deletions
+138
-0
cryptui.c
dlls/cryptui/tests/cryptui.c
+138
-0
No files found.
dlls/cryptui/tests/cryptui.c
View file @
f2b98325
...
...
@@ -327,6 +327,9 @@ static void test_crypt_ui_wiz_import(void)
BOOL
ret
;
CRYPTUI_WIZ_IMPORT_SRC_INFO
info
;
HCERTSTORE
store
;
PCCERT_CONTEXT
cert
;
PCCRL_CONTEXT
crl
;
DWORD
count
;
if
(
!
pCryptUIWizImport
)
{
...
...
@@ -507,6 +510,141 @@ static void test_crypt_ui_wiz_import(void)
}
CertFreeCertificateContext
(
info
.
u
.
pCertContext
);
info
.
u
.
hCertStore
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
CertAddEncodedCertificateToStore
(
info
.
u
.
hCertStore
,
X509_ASN_ENCODING
,
v1CertWithValidPubKey
,
sizeof
(
v1CertWithValidPubKey
),
CERT_STORE_ADD_ALWAYS
,
NULL
);
CertAddEncodedCRLToStore
(
info
.
u
.
hCertStore
,
X509_ASN_ENCODING
,
signedCRL
,
sizeof
(
signedCRL
),
CERT_STORE_ADD_ALWAYS
,
NULL
);
info
.
dwSubjectChoice
=
CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_STORE
;
/* The ALLOW flags aren't allowed with a store as the source if the source
* contains types other than those allowed.
*/
store
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptUIWizImport
(
CRYPTUI_WIZ_NO_UI
|
CRYPTUI_WIZ_IMPORT_ALLOW_CERT
,
0
,
NULL
,
&
info
,
store
);
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptUIWizImport
(
CRYPTUI_WIZ_NO_UI
|
CRYPTUI_WIZ_IMPORT_ALLOW_CRL
,
0
,
NULL
,
&
info
,
store
);
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CryptUIWizImport
(
CRYPTUI_WIZ_NO_UI
|
CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE
|
CRYPTUI_WIZ_IMPORT_ALLOW_CERT
|
CRYPTUI_WIZ_IMPORT_ALLOW_CRL
,
0
,
NULL
,
&
info
,
store
);
todo_wine
ok
(
ret
,
"CryptUIWizImport failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
count
=
0
;
cert
=
NULL
;
do
{
cert
=
CertEnumCertificatesInStore
(
store
,
cert
);
if
(
cert
)
count
++
;
}
while
(
cert
);
ok
(
count
==
1
,
"expected 1 cert, got %d
\n
"
,
count
);
count
=
0
;
crl
=
NULL
;
do
{
crl
=
CertEnumCRLsInStore
(
store
,
crl
);
if
(
crl
)
count
++
;
}
while
(
cert
);
ok
(
count
==
1
,
"expected 1 CRL, got %d
\n
"
,
count
);
}
CertCloseStore
(
store
,
0
);
CertCloseStore
(
info
.
u
.
hCertStore
,
0
);
/* If the ALLOW flags match the content of the store, the store can be
* imported.
*/
info
.
u
.
hCertStore
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
CertAddEncodedCertificateToStore
(
info
.
u
.
hCertStore
,
X509_ASN_ENCODING
,
v1CertWithValidPubKey
,
sizeof
(
v1CertWithValidPubKey
),
CERT_STORE_ADD_ALWAYS
,
NULL
);
store
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptUIWizImport
(
CRYPTUI_WIZ_NO_UI
|
CRYPTUI_WIZ_IMPORT_ALLOW_CERT
,
0
,
NULL
,
&
info
,
store
);
todo_wine
ok
(
ret
,
"CryptUIWizImport failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
count
=
0
;
cert
=
NULL
;
do
{
cert
=
CertEnumCertificatesInStore
(
store
,
cert
);
if
(
cert
)
count
++
;
}
while
(
cert
);
ok
(
count
==
1
,
"expected 1 cert, got %d
\n
"
,
count
);
count
=
0
;
crl
=
NULL
;
do
{
crl
=
CertEnumCRLsInStore
(
store
,
crl
);
if
(
crl
)
count
++
;
}
while
(
cert
);
ok
(
count
==
0
,
"expected 0 CRLs, got %d
\n
"
,
count
);
}
SetLastError
(
0xdeadbeef
);
ret
=
CryptUIWizImport
(
CRYPTUI_WIZ_NO_UI
|
CRYPTUI_WIZ_IMPORT_ALLOW_CRL
,
0
,
NULL
,
&
info
,
store
);
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
CertCloseStore
(
store
,
0
);
CertCloseStore
(
info
.
u
.
hCertStore
,
0
);
/* Again, if the ALLOW flags match the content of the store, the store can
* be imported.
*/
info
.
u
.
hCertStore
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
CertAddEncodedCRLToStore
(
info
.
u
.
hCertStore
,
X509_ASN_ENCODING
,
signedCRL
,
sizeof
(
signedCRL
),
CERT_STORE_ADD_ALWAYS
,
NULL
);
store
=
CertOpenStore
(
CERT_STORE_PROV_MEMORY
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptUIWizImport
(
CRYPTUI_WIZ_NO_UI
|
CRYPTUI_WIZ_IMPORT_ALLOW_CRL
,
0
,
NULL
,
&
info
,
store
);
todo_wine
ok
(
ret
,
"CryptUIWizImport failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
count
=
0
;
cert
=
NULL
;
do
{
cert
=
CertEnumCertificatesInStore
(
store
,
cert
);
if
(
cert
)
count
++
;
}
while
(
cert
);
ok
(
count
==
0
,
"expected 0 certs, got %d
\n
"
,
count
);
count
=
0
;
crl
=
NULL
;
do
{
crl
=
CertEnumCRLsInStore
(
store
,
crl
);
if
(
crl
)
count
++
;
}
while
(
cert
);
ok
(
count
==
1
,
"expected 1 CRL, got %d
\n
"
,
count
);
}
SetLastError
(
0xdeadbeef
);
ret
=
CryptUIWizImport
(
CRYPTUI_WIZ_NO_UI
|
CRYPTUI_WIZ_IMPORT_ALLOW_CERT
,
0
,
NULL
,
&
info
,
store
);
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
CertCloseStore
(
store
,
0
);
CertCloseStore
(
info
.
u
.
hCertStore
,
0
);
UnhookWindowsHookEx
(
hook
);
}
...
...
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