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
779dd45e
Commit
779dd45e
authored
Sep 27, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Sep 28, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add a function to serialize a store to an arbitrary stream.
parent
bc819295
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
0 deletions
+75
-0
crypt32_private.h
dlls/crypt32/crypt32_private.h
+9
-0
serialize.c
dlls/crypt32/serialize.c
+66
-0
No files found.
dlls/crypt32/crypt32_private.h
View file @
779dd45e
...
...
@@ -268,6 +268,15 @@ HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root,
const
void
*
CRYPT_ReadSerializedElement
(
const
BYTE
*
pbElement
,
DWORD
cbElement
,
DWORD
dwContextTypeFlags
,
DWORD
*
pdwContentType
);
typedef
BOOL
(
*
SerializedOutputFunc
)(
void
*
handle
,
const
void
*
buffer
,
DWORD
size
);
/* Writes contexts from the memory store to the output function, passing handle
* as the handle parameter to the output function.
*/
BOOL
CRYPT_WriteSerializedStoreToStream
(
HCERTSTORE
store
,
SerializedOutputFunc
output
,
void
*
handle
);
/* Writes contexts from the memory store to the file. */
BOOL
CRYPT_WriteSerializedStoreToFile
(
HANDLE
file
,
HCERTSTORE
store
);
...
...
dlls/crypt32/serialize.c
View file @
779dd45e
...
...
@@ -533,6 +533,72 @@ static BOOL WINAPI CRYPT_SerializeCTLNoHash(PCCTL_CONTEXT pCtlContext,
CERT_CTL_PROP_ID
,
pCTLInterface
,
dwFlags
,
TRUE
,
pbElement
,
pcbElement
);
}
static
BOOL
CRYPT_SerializeContextsToStream
(
SerializedOutputFunc
output
,
void
*
handle
,
const
WINE_CONTEXT_INTERFACE
*
contextInterface
,
HCERTSTORE
store
)
{
const
void
*
context
=
NULL
;
BOOL
ret
;
do
{
context
=
contextInterface
->
enumContextsInStore
(
store
,
context
);
if
(
context
)
{
DWORD
size
=
0
;
LPBYTE
buf
=
NULL
;
ret
=
contextInterface
->
serialize
(
context
,
0
,
NULL
,
&
size
);
if
(
size
)
buf
=
CryptMemAlloc
(
size
);
if
(
buf
)
{
ret
=
contextInterface
->
serialize
(
context
,
0
,
buf
,
&
size
);
if
(
ret
)
ret
=
output
(
handle
,
buf
,
size
);
}
CryptMemFree
(
buf
);
}
else
ret
=
TRUE
;
}
while
(
ret
&&
context
!=
NULL
);
if
(
context
)
contextInterface
->
free
(
context
);
return
ret
;
}
BOOL
CRYPT_WriteSerializedStoreToStream
(
HCERTSTORE
store
,
SerializedOutputFunc
output
,
void
*
handle
)
{
static
const
BYTE
fileTrailer
[
12
]
=
{
0
};
WINE_CONTEXT_INTERFACE
interface
;
BOOL
ret
;
ret
=
output
(
handle
,
fileHeader
,
sizeof
(
fileHeader
));
if
(
ret
)
{
memcpy
(
&
interface
,
pCertInterface
,
sizeof
(
interface
));
interface
.
serialize
=
(
SerializeElementFunc
)
CRYPT_SerializeCertNoHash
;
ret
=
CRYPT_SerializeContextsToStream
(
output
,
handle
,
&
interface
,
store
);
}
if
(
ret
)
{
memcpy
(
&
interface
,
pCRLInterface
,
sizeof
(
interface
));
interface
.
serialize
=
(
SerializeElementFunc
)
CRYPT_SerializeCRLNoHash
;
ret
=
CRYPT_SerializeContextsToStream
(
output
,
handle
,
&
interface
,
store
);
}
if
(
ret
)
{
memcpy
(
&
interface
,
pCTLInterface
,
sizeof
(
interface
));
interface
.
serialize
=
(
SerializeElementFunc
)
CRYPT_SerializeCTLNoHash
;
ret
=
CRYPT_SerializeContextsToStream
(
output
,
handle
,
&
interface
,
store
);
}
if
(
ret
)
ret
=
output
(
handle
,
fileTrailer
,
sizeof
(
fileTrailer
));
return
ret
;
}
static
BOOL
CRYPT_SerializeContextsToFile
(
HANDLE
file
,
const
WINE_CONTEXT_INTERFACE
*
contextInterface
,
HCERTSTORE
store
)
{
...
...
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