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
23884726
Commit
23884726
authored
Oct 17, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Use list struct directly instead of ContextList wrapper.
parent
724754da
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
55 deletions
+31
-55
context.c
dlls/crypt32/context.c
+8
-30
crypt32_private.h
dlls/crypt32/crypt32_private.h
+5
-7
store.c
dlls/crypt32/store.c
+18
-18
No files found.
dlls/crypt32/context.c
View file @
23884726
...
...
@@ -110,23 +110,7 @@ void Context_CopyProperties(const void *to, const void *from)
ContextPropertyList_Copy
(
toProperties
,
fromProperties
);
}
struct
ContextList
{
struct
list
contexts
;
};
struct
ContextList
*
ContextList_Create
(
void
)
{
struct
ContextList
*
list
=
CryptMemAlloc
(
sizeof
(
struct
ContextList
));
if
(
list
)
{
list_init
(
&
list
->
contexts
);
}
return
list
;
}
context_t
*
ContextList_Add
(
struct
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
toLink
,
context_t
*
ContextList_Add
(
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
toLink
,
context_t
*
existing
,
struct
WINE_CRYPTCERTSTORE
*
store
,
BOOL
use_link
)
{
context_t
*
context
;
...
...
@@ -148,13 +132,13 @@ context_t *ContextList_Add(struct ContextList *list, CRITICAL_SECTION *cs, conte
Context_Release
(
existing
);
}
else
list_add_head
(
&
list
->
contexts
,
&
context
->
u
.
entry
);
list_add_head
(
list
,
&
context
->
u
.
entry
);
LeaveCriticalSection
(
cs
);
}
return
context
;
}
context_t
*
ContextList_Enum
(
struct
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
prev
)
context_t
*
ContextList_Enum
(
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
prev
)
{
struct
list
*
listNext
;
context_t
*
ret
;
...
...
@@ -162,11 +146,11 @@ context_t *ContextList_Enum(struct ContextList *list, CRITICAL_SECTION *cs, cont
EnterCriticalSection
(
cs
);
if
(
prev
)
{
listNext
=
list_next
(
&
list
->
contexts
,
&
prev
->
u
.
entry
);
listNext
=
list_next
(
list
,
&
prev
->
u
.
entry
);
Context_Release
(
prev
);
}
else
listNext
=
list_next
(
&
list
->
contexts
,
&
list
->
contexts
);
listNext
=
list_next
(
list
,
list
);
LeaveCriticalSection
(
cs
);
if
(
listNext
)
...
...
@@ -179,7 +163,7 @@ context_t *ContextList_Enum(struct ContextList *list, CRITICAL_SECTION *cs, cont
return
ret
;
}
BOOL
ContextList_Remove
(
struct
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
context
)
BOOL
ContextList_Remove
(
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
context
)
{
BOOL
inList
=
FALSE
;
...
...
@@ -195,20 +179,14 @@ BOOL ContextList_Remove(struct ContextList *list, CRITICAL_SECTION *cs, context_
return
inList
;
}
static
void
ContextList_Empty
(
struct
ContextList
*
list
)
void
ContextList_Free
(
ContextList
*
list
)
{
context_t
*
context
,
*
next
;
LIST_FOR_EACH_ENTRY_SAFE
(
context
,
next
,
&
list
->
contexts
,
context_t
,
u
.
entry
)
LIST_FOR_EACH_ENTRY_SAFE
(
context
,
next
,
list
,
context_t
,
u
.
entry
)
{
TRACE
(
"removing %p
\n
"
,
context
);
list_remove
(
&
context
->
u
.
entry
);
Context_Release
(
context
);
}
}
void
ContextList_Free
(
struct
ContextList
*
list
)
{
ContextList_Empty
(
list
);
CryptMemFree
(
list
);
}
dlls/crypt32/crypt32_private.h
View file @
23884726
...
...
@@ -436,22 +436,20 @@ void ContextPropertyList_Free(CONTEXT_PROPERTY_LIST *list) DECLSPEC_HIDDEN;
/**
* Context list functions. A context list is a simple list of link contexts.
*/
struc
t
ContextList
;
typedef
struct
lis
t
ContextList
;
struct
ContextList
*
ContextList_Create
(
void
)
DECLSPEC_HIDDEN
;
context_t
*
ContextList_Add
(
struct
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
toLink
,
context_t
*
toReplace
,
context_t
*
ContextList_Add
(
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
toLink
,
context_t
*
toReplace
,
struct
WINE_CRYPTCERTSTORE
*
store
,
BOOL
use_link
)
DECLSPEC_HIDDEN
;
context_t
*
ContextList_Enum
(
struct
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
prev
)
DECLSPEC_HIDDEN
;
context_t
*
ContextList_Enum
(
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
prev
)
DECLSPEC_HIDDEN
;
/* Removes a context from the list. Returns TRUE if the context was removed,
* or FALSE if not. (The context may have been duplicated, so subsequent
* removes have no effect.)
*/
BOOL
ContextList_Remove
(
struct
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
context
)
DECLSPEC_HIDDEN
;
BOOL
ContextList_Remove
(
ContextList
*
list
,
CRITICAL_SECTION
*
cs
,
context_t
*
context
)
DECLSPEC_HIDDEN
;
void
ContextList_Free
(
struct
ContextList
*
list
)
DECLSPEC_HIDDEN
;
void
ContextList_Free
(
ContextList
*
list
)
DECLSPEC_HIDDEN
;
extern
WINECRYPT_CERTSTORE
empty_store
;
void
init_empty_store
(
void
)
DECLSPEC_HIDDEN
;
...
...
dlls/crypt32/store.c
View file @
23884726
...
...
@@ -83,9 +83,9 @@ typedef struct _WINE_MEMSTORE
{
WINECRYPT_CERTSTORE
hdr
;
CRITICAL_SECTION
cs
;
struct
ContextList
*
certs
;
struct
ContextList
*
crls
;
struct
ContextList
*
ctls
;
struct
list
certs
;
struct
list
crls
;
struct
list
ctls
;
}
WINE_MEMSTORE
;
void
CRYPT_InitStore
(
WINECRYPT_CERTSTORE
*
store
,
DWORD
dwFlags
,
CertStoreType
type
,
const
store_vtbl_t
*
vtbl
)
...
...
@@ -151,7 +151,7 @@ static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert,
TRACE
(
"(%p, %p, %p, %p)
\n
"
,
store
,
cert
,
toReplace
,
ppStoreContext
);
context
=
ContextList_Add
(
ms
->
certs
,
&
ms
->
cs
,
cert
,
toReplace
,
store
,
use_link
);
context
=
ContextList_Add
(
&
ms
->
certs
,
&
ms
->
cs
,
cert
,
toReplace
,
store
,
use_link
);
if
(
!
context
)
return
FALSE
;
...
...
@@ -169,7 +169,7 @@ static context_t *MemStore_enumCert(WINECRYPT_CERTSTORE *store, context_t *prev)
TRACE
(
"(%p, %p)
\n
"
,
store
,
prev
);
ret
=
ContextList_Enum
(
ms
->
certs
,
&
ms
->
cs
,
prev
);
ret
=
ContextList_Enum
(
&
ms
->
certs
,
&
ms
->
cs
,
prev
);
if
(
!
ret
)
SetLastError
(
CRYPT_E_NOT_FOUND
);
...
...
@@ -181,7 +181,7 @@ static BOOL MemStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context)
{
WINE_MEMSTORE
*
ms
=
(
WINE_MEMSTORE
*
)
store
;
if
(
ContextList_Remove
(
ms
->
certs
,
&
ms
->
cs
,
context
))
if
(
ContextList_Remove
(
&
ms
->
certs
,
&
ms
->
cs
,
context
))
Context_Release
(
context
);
return
TRUE
;
...
...
@@ -195,7 +195,7 @@ static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl,
TRACE
(
"(%p, %p, %p, %p)
\n
"
,
store
,
crl
,
toReplace
,
ppStoreContext
);
context
=
ContextList_Add
(
ms
->
crls
,
&
ms
->
cs
,
crl
,
toReplace
,
store
,
use_link
);
context
=
ContextList_Add
(
&
ms
->
crls
,
&
ms
->
cs
,
crl
,
toReplace
,
store
,
use_link
);
if
(
!
context
)
return
FALSE
;
...
...
@@ -213,7 +213,7 @@ static context_t *MemStore_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev)
TRACE
(
"(%p, %p)
\n
"
,
store
,
prev
);
ret
=
ContextList_Enum
(
ms
->
crls
,
&
ms
->
cs
,
prev
);
ret
=
ContextList_Enum
(
&
ms
->
crls
,
&
ms
->
cs
,
prev
);
if
(
!
ret
)
SetLastError
(
CRYPT_E_NOT_FOUND
);
...
...
@@ -225,7 +225,7 @@ static BOOL MemStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context)
{
WINE_MEMSTORE
*
ms
=
(
WINE_MEMSTORE
*
)
store
;
if
(
!
ContextList_Remove
(
ms
->
crls
,
&
ms
->
cs
,
context
))
if
(
!
ContextList_Remove
(
&
ms
->
crls
,
&
ms
->
cs
,
context
))
Context_Release
(
context
);
return
TRUE
;
...
...
@@ -239,7 +239,7 @@ static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl,
TRACE
(
"(%p, %p, %p, %p)
\n
"
,
store
,
ctl
,
toReplace
,
ppStoreContext
);
context
=
ContextList_Add
(
ms
->
ctls
,
&
ms
->
cs
,
ctl
,
toReplace
,
store
,
use_link
);
context
=
ContextList_Add
(
&
ms
->
ctls
,
&
ms
->
cs
,
ctl
,
toReplace
,
store
,
use_link
);
if
(
!
context
)
return
FALSE
;
...
...
@@ -257,7 +257,7 @@ static context_t *MemStore_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev)
TRACE
(
"(%p, %p)
\n
"
,
store
,
prev
);
ret
=
ContextList_Enum
(
ms
->
ctls
,
&
ms
->
cs
,
prev
);
ret
=
ContextList_Enum
(
&
ms
->
ctls
,
&
ms
->
cs
,
prev
);
if
(
!
ret
)
SetLastError
(
CRYPT_E_NOT_FOUND
);
...
...
@@ -269,7 +269,7 @@ static BOOL MemStore_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *context)
{
WINE_MEMSTORE
*
ms
=
(
WINE_MEMSTORE
*
)
store
;
if
(
!
ContextList_Remove
(
ms
->
ctls
,
&
ms
->
cs
,
context
))
if
(
!
ContextList_Remove
(
&
ms
->
ctls
,
&
ms
->
cs
,
context
))
Context_Release
(
context
);
return
TRUE
;
...
...
@@ -294,9 +294,9 @@ static DWORD MemStore_release(WINECRYPT_CERTSTORE *cert_store, DWORD flags)
if
(
ref
)
return
(
flags
&
CERT_CLOSE_STORE_CHECK_FLAG
)
?
CRYPT_E_PENDING_CLOSE
:
ERROR_SUCCESS
;
ContextList_Free
(
store
->
certs
);
ContextList_Free
(
store
->
crls
);
ContextList_Free
(
store
->
ctls
);
ContextList_Free
(
&
store
->
certs
);
ContextList_Free
(
&
store
->
crls
);
ContextList_Free
(
&
store
->
ctls
);
store
->
cs
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
store
->
cs
);
CRYPT_FreeStore
(
&
store
->
hdr
);
...
...
@@ -350,9 +350,9 @@ static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv,
CRYPT_InitStore
(
&
store
->
hdr
,
dwFlags
,
StoreTypeMem
,
&
MemStoreVtbl
);
InitializeCriticalSection
(
&
store
->
cs
);
store
->
cs
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": ContextList.cs"
);
store
->
certs
=
ContextList_Create
(
);
store
->
crls
=
ContextList_Create
(
);
store
->
ctls
=
ContextList_Create
(
);
list_init
(
&
store
->
certs
);
list_init
(
&
store
->
crls
);
list_init
(
&
store
->
ctls
);
/* Mem store doesn't need crypto provider, so close it */
if
(
hCryptProv
&&
!
(
dwFlags
&
CERT_STORE_NO_CRYPT_RELEASE_FLAG
))
CryptReleaseContext
(
hCryptProv
,
0
);
...
...
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