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
2553b460
Commit
2553b460
authored
Oct 14, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 14, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Use context_t in Context_CreateLinkContext.
parent
c72570ce
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
32 deletions
+29
-32
collectionstore.c
dlls/crypt32/collectionstore.c
+12
-16
context.c
dlls/crypt32/context.c
+11
-14
crypt32_private.h
dlls/crypt32/crypt32_private.h
+6
-2
No files found.
dlls/crypt32/collectionstore.c
View file @
2553b460
...
...
@@ -73,17 +73,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
,
BOOL
addRef
)
WINE_STORE_LIST_ENTRY
*
storeEntry
,
void
*
child
,
size_t
contextSize
)
{
void
*
ret
=
Context_CreateLinkContext
(
contextSize
,
child
,
sizeof
(
WINE_STORE_LIST_ENTRY
*
)
,
addRef
);
context_t
*
ret
=
Context_CreateLinkContext
(
contextSize
,
context_from_ptr
(
child
)
,
sizeof
(
WINE_STORE_LIST_ENTRY
*
));
if
(
ret
)
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
ret
,
contextSize
)
=
storeEntry
;
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
context_ptr
(
ret
),
contextSize
)
=
storeEntry
;
return
ret
;
return
context_ptr
(
ret
)
;
}
static
BOOL
CRYPT_CollectionAddContext
(
WINE_COLLECTIONSTORE
*
store
,
...
...
@@ -168,9 +166,10 @@ static void *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store,
}
else
child
=
contextFuncs
->
enumContext
(
storeEntry
->
store
,
NULL
);
if
(
child
)
ret
=
CRYPT_CollectionCreateContextFromChild
(
store
,
storeEntry
,
child
,
contextSize
,
FALSE
);
if
(
child
)
{
ret
=
CRYPT_CollectionCreateContextFromChild
(
store
,
storeEntry
,
child
,
contextSize
);
Context_Release
(
context_from_ptr
(
child
));
}
else
{
if
(
storeNext
)
...
...
@@ -211,8 +210,7 @@ static BOOL Collection_addCert(WINECRYPT_CERTSTORE *store, void *cert,
WINE_STORE_LIST_ENTRY
*
storeEntry
=
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
childContext
,
sizeof
(
CERT_CONTEXT
));
PCERT_CONTEXT
context
=
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
childContext
,
sizeof
(
CERT_CONTEXT
),
TRUE
);
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
childContext
,
sizeof
(
CERT_CONTEXT
));
if
(
context
)
context
->
hCertStore
=
store
;
...
...
@@ -291,8 +289,7 @@ static BOOL Collection_addCRL(WINECRYPT_CERTSTORE *store, void *crl,
WINE_STORE_LIST_ENTRY
*
storeEntry
=
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
childContext
,
sizeof
(
CRL_CONTEXT
));
PCRL_CONTEXT
context
=
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
childContext
,
sizeof
(
CRL_CONTEXT
),
TRUE
);
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
childContext
,
sizeof
(
CRL_CONTEXT
));
if
(
context
)
context
->
hCertStore
=
store
;
...
...
@@ -370,8 +367,7 @@ static BOOL Collection_addCTL(WINECRYPT_CERTSTORE *store, void *ctl,
WINE_STORE_LIST_ENTRY
*
storeEntry
=
*
(
WINE_STORE_LIST_ENTRY
**
)
Context_GetExtra
(
childContext
,
sizeof
(
CTL_CONTEXT
));
PCTL_CONTEXT
context
=
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
childContext
,
sizeof
(
CTL_CONTEXT
),
TRUE
);
CRYPT_CollectionCreateContextFromChild
(
cs
,
storeEntry
,
childContext
,
sizeof
(
CTL_CONTEXT
));
if
(
context
)
context
->
hCertStore
=
store
;
...
...
dlls/crypt32/context.c
View file @
2553b460
...
...
@@ -51,10 +51,9 @@ void *Context_CreateDataContext(size_t contextSize, const context_vtbl_t *vtbl)
return
CONTEXT_FROM_BASE_CONTEXT
(
context
);
}
void
*
Context_CreateLinkContext
(
unsigned
int
contextSize
,
void
*
linked
,
unsigned
int
extra
,
BOOL
addRef
)
context_t
*
Context_CreateLinkContext
(
unsigned
int
contextSize
,
context_t
*
linked
,
unsigned
int
extra
)
{
BASE_CONTEXT
*
context
;
context_t
*
context
;
TRACE
(
"(%d, %p, %d)
\n
"
,
contextSize
,
linked
,
extra
);
...
...
@@ -62,15 +61,14 @@ void *Context_CreateLinkContext(unsigned int contextSize, void *linked, unsigned
if
(
!
context
)
return
NULL
;
memcpy
(
CONTEXT_FROM_BASE_CONTEXT
(
context
),
linked
,
contextSize
);
context
->
vtbl
=
BASE_CONTEXT_FROM_CONTEXT
(
linked
)
->
vtbl
;
memcpy
(
context_ptr
(
context
),
context_ptr
(
linked
)
,
contextSize
);
context
->
vtbl
=
linked
->
vtbl
;
context
->
ref
=
1
;
context
->
linked
=
BASE_CONTEXT_FROM_CONTEXT
(
linked
);
if
(
addRef
)
Context_AddRef
(
BASE_CONTEXT_FROM_CONTEXT
(
linked
));
context
->
linked
=
linked
;
Context_AddRef
(
linked
);
TRACE
(
"returning %p
\n
"
,
context
);
return
CONTEXT_FROM_BASE_CONTEXT
(
context
)
;
return
context
;
}
void
Context_AddRef
(
context_t
*
context
)
...
...
@@ -185,15 +183,14 @@ static inline void *ContextList_EntryToContext(const struct ContextList *list,
void
*
ContextList_Add
(
struct
ContextList
*
list
,
void
*
toLink
,
void
*
toReplace
)
{
void
*
context
;
context_t
*
context
;
TRACE
(
"(%p, %p, %p)
\n
"
,
list
,
toLink
,
toReplace
);
context
=
Context_CreateLinkContext
(
list
->
contextSize
,
toLink
,
sizeof
(
struct
list
),
TRUE
);
context
=
Context_CreateLinkContext
(
list
->
contextSize
,
context_from_ptr
(
toLink
),
sizeof
(
struct
list
));
if
(
context
)
{
struct
list
*
entry
=
ContextList_ContextToEntry
(
list
,
context
);
struct
list
*
entry
=
ContextList_ContextToEntry
(
list
,
CONTEXT_FROM_BASE_CONTEXT
(
context
)
);
TRACE
(
"adding %p
\n
"
,
context
);
EnterCriticalSection
(
&
list
->
cs
);
...
...
@@ -212,7 +209,7 @@ void *ContextList_Add(struct ContextList *list, void *toLink, void *toReplace)
list_add_head
(
&
list
->
contexts
,
entry
);
LeaveCriticalSection
(
&
list
->
cs
);
}
return
context
;
return
CONTEXT_FROM_BASE_CONTEXT
(
context
)
;
}
void
*
ContextList_Enum
(
struct
ContextList
*
list
,
void
*
pPrev
)
...
...
dlls/crypt32/crypt32_private.h
View file @
2553b460
...
...
@@ -177,6 +177,11 @@ static inline context_t *context_from_ptr(const void *ptr)
return
(
context_t
*
)
ptr
-
1
;
}
static
inline
void
*
context_ptr
(
context_t
*
context
)
{
return
context
+
1
;
}
typedef
struct
{
context_t
base
;
CERT_CONTEXT
ctx
;
...
...
@@ -390,8 +395,7 @@ void *Context_CreateDataContext(size_t contextSize, const context_vtbl_t *vtbl)
* it should be) linked is addref'd.
* Free with Context_Release.
*/
void
*
Context_CreateLinkContext
(
unsigned
int
contextSize
,
void
*
linked
,
unsigned
int
extra
,
BOOL
addRef
)
DECLSPEC_HIDDEN
;
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.
...
...
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