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
95a38f3a
Commit
95a38f3a
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: Implement importing stores in CryptUIWizImport.
parent
31a78a76
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
3 deletions
+103
-3
main.c
dlls/cryptui/main.c
+103
-0
cryptui.c
dlls/cryptui/tests/cryptui.c
+0
-3
No files found.
dlls/cryptui/main.c
View file @
95a38f3a
...
...
@@ -3496,6 +3496,34 @@ static BOOL import_crl(PCCRL_CONTEXT crl, HCERTSTORE hDestCertStore)
return
ret
;
}
static
BOOL
import_ctl
(
PCCTL_CONTEXT
ctl
,
HCERTSTORE
hDestCertStore
)
{
HCERTSTORE
store
;
BOOL
ret
;
if
(
!
ctl
)
{
SetLastError
(
E_INVALIDARG
);
return
FALSE
;
}
if
(
hDestCertStore
)
store
=
hDestCertStore
;
else
{
static
const
WCHAR
trust
[]
=
{
'T'
,
'r'
,
'u'
,
's'
,
't'
,
0
};
if
(
!
(
store
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_W
,
0
,
0
,
CERT_SYSTEM_STORE_CURRENT_USER
,
trust
)))
{
WARN
(
"unable to open certificate store
\n
"
);
return
FALSE
;
}
}
ret
=
CertAddCTLContextToStore
(
store
,
ctl
,
CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES
,
NULL
);
if
(
!
hDestCertStore
)
CertCloseStore
(
store
,
0
);
return
ret
;
}
/* Checks type, a type such as CERT_QUERY_CONTENT_CERT returned by
* CryptQueryObject, against the allowed types. Returns TRUE if the
* type is allowed, FALSE otherwise.
...
...
@@ -3561,6 +3589,77 @@ static void import_warn_type_mismatch(DWORD dwFlags, HWND hwnd, LPCWSTR szTitle)
}
}
static
BOOL
check_store_context_type
(
DWORD
dwFlags
,
HCERTSTORE
store
)
{
BOOL
ret
;
if
(
dwFlags
&
(
CRYPTUI_WIZ_IMPORT_ALLOW_CERT
|
CRYPTUI_WIZ_IMPORT_ALLOW_CRL
|
CRYPTUI_WIZ_IMPORT_ALLOW_CTL
))
{
PCCERT_CONTEXT
cert
;
PCCRL_CONTEXT
crl
;
PCCTL_CONTEXT
ctl
;
ret
=
TRUE
;
if
((
cert
=
CertEnumCertificatesInStore
(
store
,
NULL
)))
{
CertFreeCertificateContext
(
cert
);
if
(
!
(
dwFlags
&
CRYPTUI_WIZ_IMPORT_ALLOW_CERT
))
ret
=
FALSE
;
}
if
(
ret
&&
(
crl
=
CertEnumCRLsInStore
(
store
,
NULL
)))
{
CertFreeCRLContext
(
crl
);
if
(
!
(
dwFlags
&
CRYPTUI_WIZ_IMPORT_ALLOW_CRL
))
ret
=
FALSE
;
}
if
(
ret
&&
(
ctl
=
CertEnumCTLsInStore
(
store
,
NULL
)))
{
CertFreeCTLContext
(
ctl
);
if
(
!
(
dwFlags
&
CRYPTUI_WIZ_IMPORT_ALLOW_CTL
))
ret
=
FALSE
;
}
}
else
ret
=
TRUE
;
if
(
!
ret
)
SetLastError
(
E_INVALIDARG
);
return
ret
;
}
static
BOOL
import_store
(
DWORD
dwFlags
,
HWND
hwnd
,
LPCWSTR
szTitle
,
HCERTSTORE
source
,
HCERTSTORE
dest
)
{
BOOL
ret
;
if
((
ret
=
check_store_context_type
(
dwFlags
,
source
)))
{
PCCERT_CONTEXT
cert
=
NULL
;
PCCRL_CONTEXT
crl
=
NULL
;
PCCTL_CONTEXT
ctl
=
NULL
;
do
{
cert
=
CertEnumCertificatesInStore
(
source
,
cert
);
if
(
cert
)
ret
=
import_cert
(
cert
,
dest
);
}
while
(
ret
&&
cert
);
do
{
crl
=
CertEnumCRLsInStore
(
source
,
crl
);
if
(
crl
)
ret
=
import_crl
(
crl
,
dest
);
}
while
(
ret
&&
crl
);
do
{
ctl
=
CertEnumCTLsInStore
(
source
,
ctl
);
if
(
ctl
)
ret
=
import_ctl
(
ctl
,
dest
);
}
while
(
ret
&&
ctl
);
}
else
import_warn_type_mismatch
(
dwFlags
,
hwnd
,
szTitle
);
return
ret
;
}
BOOL
WINAPI
CryptUIWizImport
(
DWORD
dwFlags
,
HWND
hwndParent
,
LPCWSTR
pwszWizardTitle
,
PCCRYPTUI_WIZ_IMPORT_SRC_INFO
pImportSrc
,
HCERTSTORE
hDestCertStore
)
{
...
...
@@ -3605,6 +3704,10 @@ BOOL WINAPI CryptUIWizImport(DWORD dwFlags, HWND hwndParent, LPCWSTR pwszWizardT
else
import_warn_type_mismatch
(
dwFlags
,
hwndParent
,
pwszWizardTitle
);
break
;
case
CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_STORE
:
ret
=
import_store
(
dwFlags
,
hwndParent
,
pwszWizardTitle
,
pImportSrc
->
u
.
hCertStore
,
hDestCertStore
);
break
;
default:
FIXME
(
"source type not implemented: %u
\n
"
,
pImportSrc
->
dwSubjectChoice
);
SetLastError
(
E_INVALIDARG
);
...
...
dlls/cryptui/tests/cryptui.c
View file @
95a38f3a
...
...
@@ -537,7 +537,6 @@ static void test_crypt_ui_wiz_import(void)
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
)
{
...
...
@@ -574,7 +573,6 @@ static void test_crypt_ui_wiz_import(void)
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
)
{
...
...
@@ -615,7 +613,6 @@ static void test_crypt_ui_wiz_import(void)
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
)
{
...
...
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