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
03ff35c2
Commit
03ff35c2
authored
Oct 15, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Store extra pointer directly in context_t and get rid of Context_GetExtra.
parent
06f5ee4b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
36 deletions
+24
-36
collectionstore.c
dlls/crypt32/collectionstore.c
+17
-25
context.c
dlls/crypt32/context.c
+4
-4
crypt32_private.h
dlls/crypt32/crypt32_private.h
+3
-7
No files found.
dlls/crypt32/collectionstore.c
View file @
03ff35c2
...
...
@@ -72,14 +72,15 @@ static DWORD Collection_release(WINECRYPT_CERTSTORE *store, DWORD flags)
}
static
void
*
CRYPT_CollectionCreateContextFromChild
(
WINE_COLLECTIONSTORE
*
store
,
WINE_STORE_LIST_ENTRY
*
storeEntry
,
void
*
child
,
size_t
contextSize
)
WINE_STORE_LIST_ENTRY
*
storeEntry
,
context_t
*
child
,
size_t
contextSize
)
{
context_t
*
ret
=
Context_CreateLinkContext
(
contextSize
,
context_from_ptr
(
child
),
sizeof
(
WINE_STORE_LIST_ENTRY
*
));
context_t
*
ret
;
if
(
ret
)
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
context_ptr
(
ret
),
contextSize
)
=
storeEntry
;
ret
=
Context_CreateLinkContext
(
contextSize
,
child
);
if
(
!
ret
)
return
NULL
;
ret
->
u
.
ptr
=
storeEntry
;
return
context_ptr
(
ret
);
}
...
...
@@ -100,8 +101,7 @@ static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store,
void
*
existingLinked
=
Context_GetLinkedContext
(
toReplace
);
CONTEXT_FUNCS
*
contextFuncs
;
storeEntry
=
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
toReplace
,
contextSize
);
storeEntry
=
context_from_ptr
(
toReplace
)
->
u
.
ptr
;
contextFuncs
=
(
CONTEXT_FUNCS
*
)((
LPBYTE
)
storeEntry
->
store
->
vtbl
+
contextFuncsOffset
);
ret
=
contextFuncs
->
addContext
(
storeEntry
->
store
,
context
,
...
...
@@ -166,7 +166,7 @@ static void *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store,
else
child
=
contextFuncs
->
enumContext
(
storeEntry
->
store
,
NULL
);
if
(
child
)
{
ret
=
CRYPT_CollectionCreateContextFromChild
(
store
,
storeEntry
,
c
hild
,
contextSize
);
ret
=
CRYPT_CollectionCreateContextFromChild
(
store
,
storeEntry
,
c
ontext_from_ptr
(
child
)
,
contextSize
);
Context_Release
(
context_from_ptr
(
child
));
}
else
...
...
@@ -206,10 +206,9 @@ static BOOL Collection_addCert(WINECRYPT_CERTSTORE *store, void *cert,
cert
,
toReplace
,
sizeof
(
CERT_CONTEXT
),
&
childContext
);
if
(
ppStoreContext
&&
childContext
)
{
WINE_STORE_LIST_ENTRY
*
storeEntry
=
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
childContext
,
sizeof
(
CERT_CONTEXT
));
WINE_STORE_LIST_ENTRY
*
storeEntry
=
context_from_ptr
(
childContext
)
->
u
.
ptr
;
PCERT_CONTEXT
context
=
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
c
hildContext
,
sizeof
(
CERT_CONTEXT
));
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
c
ontext_from_ptr
(
childContext
)
,
sizeof
(
CERT_CONTEXT
));
if
(
context
)
context
->
hCertStore
=
store
;
...
...
@@ -229,9 +228,7 @@ static void *Collection_enumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
EnterCriticalSection
(
&
cs
->
cs
);
if
(
pPrev
)
{
WINE_STORE_LIST_ENTRY
*
storeEntry
=
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
pPrev
,
sizeof
(
CERT_CONTEXT
));
WINE_STORE_LIST_ENTRY
*
storeEntry
=
context_from_ptr
(
pPrev
)
->
u
.
ptr
;
ret
=
CRYPT_CollectionAdvanceEnum
(
cs
,
storeEntry
,
&
storeEntry
->
store
->
vtbl
->
certs
,
pCertInterface
,
pPrev
,
...
...
@@ -285,10 +282,9 @@ static BOOL Collection_addCRL(WINECRYPT_CERTSTORE *store, void *crl,
crl
,
toReplace
,
sizeof
(
CRL_CONTEXT
),
&
childContext
);
if
(
ppStoreContext
&&
childContext
)
{
WINE_STORE_LIST_ENTRY
*
storeEntry
=
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
childContext
,
sizeof
(
CRL_CONTEXT
));
WINE_STORE_LIST_ENTRY
*
storeEntry
=
context_from_ptr
(
childContext
)
->
u
.
ptr
;
PCRL_CONTEXT
context
=
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
c
hildContext
,
sizeof
(
CRL_CONTEXT
));
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
c
ontext_from_ptr
(
childContext
)
,
sizeof
(
CRL_CONTEXT
));
if
(
context
)
context
->
hCertStore
=
store
;
...
...
@@ -308,9 +304,7 @@ static void *Collection_enumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
EnterCriticalSection
(
&
cs
->
cs
);
if
(
pPrev
)
{
WINE_STORE_LIST_ENTRY
*
storeEntry
=
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
pPrev
,
sizeof
(
CRL_CONTEXT
));
WINE_STORE_LIST_ENTRY
*
storeEntry
=
context_from_ptr
(
pPrev
)
->
u
.
ptr
;
ret
=
CRYPT_CollectionAdvanceEnum
(
cs
,
storeEntry
,
&
storeEntry
->
store
->
vtbl
->
crls
,
pCRLInterface
,
pPrev
,
sizeof
(
CRL_CONTEXT
));
...
...
@@ -363,10 +357,9 @@ static BOOL Collection_addCTL(WINECRYPT_CERTSTORE *store, void *ctl,
ctl
,
toReplace
,
sizeof
(
CTL_CONTEXT
),
&
childContext
);
if
(
ppStoreContext
&&
childContext
)
{
WINE_STORE_LIST_ENTRY
*
storeEntry
=
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
childContext
,
sizeof
(
CTL_CONTEXT
));
WINE_STORE_LIST_ENTRY
*
storeEntry
=
context_from_ptr
(
childContext
)
->
u
.
ptr
;
PCTL_CONTEXT
context
=
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
c
hildContext
,
sizeof
(
CTL_CONTEXT
));
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
c
ontext_from_ptr
(
childContext
)
,
sizeof
(
CTL_CONTEXT
));
if
(
context
)
context
->
hCertStore
=
store
;
...
...
@@ -386,8 +379,7 @@ static void *Collection_enumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
EnterCriticalSection
(
&
cs
->
cs
);
if
(
pPrev
)
{
WINE_STORE_LIST_ENTRY
*
storeEntry
=
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
pPrev
,
sizeof
(
CTL_CONTEXT
));
WINE_STORE_LIST_ENTRY
*
storeEntry
=
context_from_ptr
(
pPrev
)
->
u
.
ptr
;
ret
=
CRYPT_CollectionAdvanceEnum
(
cs
,
storeEntry
,
&
storeEntry
->
store
->
vtbl
->
ctls
,
pCTLInterface
,
pPrev
,
sizeof
(
CTL_CONTEXT
));
...
...
dlls/crypt32/context.c
View file @
03ff35c2
...
...
@@ -50,13 +50,13 @@ void *Context_CreateDataContext(size_t contextSize, const context_vtbl_t *vtbl)
return
CONTEXT_FROM_BASE_CONTEXT
(
context
);
}
context_t
*
Context_CreateLinkContext
(
unsigned
int
contextSize
,
context_t
*
linked
,
unsigned
int
extra
)
context_t
*
Context_CreateLinkContext
(
unsigned
int
contextSize
,
context_t
*
linked
)
{
context_t
*
context
;
TRACE
(
"(%d, %p
, %d)
\n
"
,
contextSize
,
linked
,
extra
);
TRACE
(
"(%d, %p
)
\n
"
,
contextSize
,
linked
);
context
=
CryptMemAlloc
(
contextSize
+
sizeof
(
BASE_CONTEXT
)
+
extra
);
context
=
CryptMemAlloc
(
sizeof
(
context_t
)
+
contextSize
);
if
(
!
context
)
return
NULL
;
...
...
@@ -168,7 +168,7 @@ void *ContextList_Add(struct ContextList *list, void *toLink, void *toReplace)
TRACE
(
"(%p, %p, %p)
\n
"
,
list
,
toLink
,
toReplace
);
context
=
Context_CreateLinkContext
(
list
->
contextSize
,
context_from_ptr
(
toLink
)
,
0
);
context
=
Context_CreateLinkContext
(
list
->
contextSize
,
context_from_ptr
(
toLink
));
if
(
context
)
{
TRACE
(
"adding %p
\n
"
,
context
);
...
...
dlls/crypt32/crypt32_private.h
View file @
03ff35c2
...
...
@@ -174,6 +174,7 @@ typedef struct _context_t {
CONTEXT_PROPERTY_LIST
*
properties
;
union
{
struct
list
entry
;
void
*
ptr
;
}
u
;
}
BASE_CONTEXT
;
...
...
@@ -395,17 +396,12 @@ DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indent,
*/
void
*
Context_CreateDataContext
(
size_t
contextSize
,
const
context_vtbl_t
*
vtbl
)
DECLSPEC_HIDDEN
;
/* Creates a new link context
with extra bytes
. The context refers to linked
/* Creates a new link context. The context refers to linked
* rather than owning its own properties. If addRef is TRUE (which ordinarily
* it should be) linked is addref'd.
* Free with Context_Release.
*/
context_t
*
Context_CreateLinkContext
(
unsigned
contextSize
,
context_t
*
linked
,
unsigned
extra
)
DECLSPEC_HIDDEN
;
/* Returns a pointer to the extra bytes allocated with context, which must be
* a link context.
*/
void
*
Context_GetExtra
(
const
void
*
context
,
size_t
contextSize
)
DECLSPEC_HIDDEN
;
context_t
*
Context_CreateLinkContext
(
unsigned
contextSize
,
context_t
*
linked
)
DECLSPEC_HIDDEN
;
/* Gets the context linked to by context, which must be a link context. */
void
*
Context_GetLinkedContext
(
void
*
)
DECLSPEC_HIDDEN
;
...
...
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