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
d0baa506
Commit
d0baa506
authored
Oct 20, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 20, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cryptui: Add a partial implementation of CryptUIWizImport.
This is just enough to make importing a certificate in Outlook 2007 work.
parent
d6544f04
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
2 deletions
+75
-2
Makefile.in
dlls/cryptui/Makefile.in
+1
-1
cryptui.spec
dlls/cryptui/cryptui.spec
+1
-1
main.c
dlls/cryptui/main.c
+73
-0
No files found.
dlls/cryptui/Makefile.in
View file @
d0baa506
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
MODULE
=
cryptui.dll
IMPORTS
=
kernel32
IMPORTS
=
crypt32
kernel32
IMPORTLIB
=
cryptui
C_SRCS
=
\
...
...
dlls/cryptui/cryptui.spec
View file @
d0baa506
...
...
@@ -34,7 +34,7 @@
34 stub CryptUIWizExport
35 stub CryptUIWizFreeCertRequestNoDS
36 stub CryptUIWizFreeDigitalSignContext
37 st
ub CryptUIWizImport
37 st
dcall CryptUIWizImport(long ptr wstr ptr ptr)
38 stub CryptUIWizQueryCertRequestNoDS
39 stub CryptUIWizSubmitCertRequestNoDS
40 stub DllRegisterServer
...
...
dlls/cryptui/main.c
View file @
d0baa506
...
...
@@ -98,3 +98,76 @@ BOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertVi
if
(
pfPropertiesChanged
)
*
pfPropertiesChanged
=
FALSE
;
return
TRUE
;
}
BOOL
WINAPI
CryptUIWizImport
(
DWORD
dwFlags
,
HWND
hwndParent
,
LPCWSTR
pwszWizardTitle
,
PCCRYPTUI_WIZ_IMPORT_SRC_INFO
pImportSrc
,
HCERTSTORE
hDestCertStore
)
{
static
const
WCHAR
Root
[]
=
{
'R'
,
'o'
,
'o'
,
't'
,
0
};
BOOL
ret
;
HANDLE
file
;
HCERTSTORE
store
;
BYTE
*
buffer
;
DWORD
size
,
encoding
=
X509_ASN_ENCODING
|
PKCS_7_ASN_ENCODING
;
const
CERT_CONTEXT
*
cert
;
TRACE
(
"(0x%08x, %p, %s, %p, %p)
\n
"
,
dwFlags
,
hwndParent
,
debugstr_w
(
pwszWizardTitle
),
pImportSrc
,
hDestCertStore
);
FIXME
(
"only certificate files are supported
\n
"
);
if
(
!
(
dwFlags
&
CRYPTUI_WIZ_NO_UI
))
FIXME
(
"UI not implemented
\n
"
);
if
(
pImportSrc
->
dwSubjectChoice
!=
CRYPTUI_WIZ_IMPORT_SUBJECT_FILE
)
{
FIXME
(
"source type not implemented: %u
\n
"
,
pImportSrc
->
dwSubjectChoice
);
return
FALSE
;
}
file
=
CreateFileW
(
pImportSrc
->
pwszFileName
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
file
==
INVALID_HANDLE_VALUE
)
{
WARN
(
"can't open certificate file %s
\n
"
,
debugstr_w
(
pImportSrc
->
pwszFileName
));
return
FALSE
;
}
if
((
size
=
GetFileSize
(
file
,
NULL
)))
{
if
((
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
{
DWORD
read
;
if
(
!
ReadFile
(
file
,
buffer
,
size
,
&
read
,
NULL
)
||
read
!=
size
)
{
WARN
(
"can't read certificate file %s
\n
"
,
debugstr_w
(
pImportSrc
->
pwszFileName
));
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
CloseHandle
(
file
);
return
FALSE
;
}
}
}
else
{
WARN
(
"empty file %s
\n
"
,
debugstr_w
(
pImportSrc
->
pwszFileName
));
CloseHandle
(
file
);
return
FALSE
;
}
CloseHandle
(
file
);
if
(
!
(
cert
=
CertCreateCertificateContext
(
encoding
,
buffer
,
size
)))
{
WARN
(
"unable to create certificate context
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
FALSE
;
}
/* FIXME: verify certificate and determine store name dynamically */
if
(
!
(
store
=
CertOpenStore
(
CERT_STORE_PROV_SYSTEM_W
,
0
,
0
,
CERT_SYSTEM_STORE_CURRENT_USER
,
Root
)))
{
WARN
(
"unable to open certificate store
\n
"
);
CertFreeCertificateContext
(
cert
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
FALSE
;
}
ret
=
CertAddCertificateContextToStore
(
store
,
cert
,
CERT_STORE_ADD_REPLACE_EXISTING
,
NULL
);
CertCloseStore
(
store
,
0
);
CertFreeCertificateContext
(
cert
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
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