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
25cb6e08
Commit
25cb6e08
authored
Sep 09, 2005
by
Juan Lang
Committed by
Alexandre Julliard
Sep 09, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- call CertFreeCertificateContext from CertDeleteCertificateFromStore
- fix some ref counting problems
parent
110cfa34
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
14 deletions
+9
-14
cert.c
dlls/crypt32/cert.c
+9
-10
cert.c
dlls/crypt32/tests/cert.c
+0
-4
No files found.
dlls/crypt32/cert.c
View file @
25cb6e08
...
@@ -523,7 +523,6 @@ static BOOL WINAPI CRYPT_MemDeleteCert(HCERTSTORE hCertStore,
...
@@ -523,7 +523,6 @@ static BOOL WINAPI CRYPT_MemDeleteCert(HCERTSTORE hCertStore,
*/
*/
list_remove
(
&
cert
->
entry
);
list_remove
(
&
cert
->
entry
);
cert
->
entry
.
prev
=
cert
->
entry
.
next
=
&
store
->
certs
;
cert
->
entry
.
prev
=
cert
->
entry
.
next
=
&
store
->
certs
;
CertFreeCertificateContext
((
PCCERT_CONTEXT
)
cert
);
break
;
break
;
}
}
}
}
...
@@ -784,10 +783,7 @@ static BOOL WINAPI CRYPT_CollectionDeleteCert(HCERTSTORE hCertStore,
...
@@ -784,10 +783,7 @@ static BOOL WINAPI CRYPT_CollectionDeleteCert(HCERTSTORE hCertStore,
ret
=
CertDeleteCertificateFromStore
((
PCCERT_CONTEXT
)
context
->
childContext
);
ret
=
CertDeleteCertificateFromStore
((
PCCERT_CONTEXT
)
context
->
childContext
);
if
(
ret
)
if
(
ret
)
{
context
->
childContext
=
NULL
;
context
->
childContext
=
NULL
;
CertFreeCertificateContext
((
PCCERT_CONTEXT
)
context
);
}
return
ret
;
return
ret
;
}
}
...
@@ -1171,7 +1167,6 @@ static PWINE_CERT_CONTEXT_REF CRYPT_RegEnumCert(PWINECRYPT_CERTSTORE store,
...
@@ -1171,7 +1167,6 @@ static PWINE_CERT_CONTEXT_REF CRYPT_RegEnumCert(PWINECRYPT_CERTSTORE store,
ret
=
(
PWINE_REG_CERT_CONTEXT
)
pPrev
;
ret
=
(
PWINE_REG_CERT_CONTEXT
)
pPrev
;
memcpy
(
&
ret
->
cert
,
child
,
sizeof
(
WINE_CERT_CONTEXT_REF
));
memcpy
(
&
ret
->
cert
,
child
,
sizeof
(
WINE_CERT_CONTEXT_REF
));
ret
->
cert
.
cert
.
hCertStore
=
(
HCERTSTORE
)
store
;
ret
->
cert
.
cert
.
hCertStore
=
(
HCERTSTORE
)
store
;
InterlockedIncrement
(
&
ret
->
cert
.
context
->
ref
);
ret
->
childContext
=
child
;
ret
->
childContext
=
child
;
}
}
}
}
...
@@ -1186,7 +1181,6 @@ static PWINE_CERT_CONTEXT_REF CRYPT_RegEnumCert(PWINECRYPT_CERTSTORE store,
...
@@ -1186,7 +1181,6 @@ static PWINE_CERT_CONTEXT_REF CRYPT_RegEnumCert(PWINECRYPT_CERTSTORE store,
{
{
memcpy
(
&
ret
->
cert
,
child
,
sizeof
(
WINE_CERT_CONTEXT_REF
));
memcpy
(
&
ret
->
cert
,
child
,
sizeof
(
WINE_CERT_CONTEXT_REF
));
ret
->
cert
.
cert
.
hCertStore
=
(
HCERTSTORE
)
store
;
ret
->
cert
.
cert
.
hCertStore
=
(
HCERTSTORE
)
store
;
InterlockedIncrement
(
&
ret
->
cert
.
context
->
ref
);
ret
->
childContext
=
child
;
ret
->
childContext
=
child
;
}
}
else
else
...
@@ -2327,7 +2321,10 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
...
@@ -2327,7 +2321,10 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
if
(
!
pCertContext
)
if
(
!
pCertContext
)
ret
=
TRUE
;
ret
=
TRUE
;
else
if
(
!
pCertContext
->
hCertStore
)
else
if
(
!
pCertContext
->
hCertStore
)
{
ret
=
TRUE
;
ret
=
TRUE
;
CertFreeCertificateContext
(
pCertContext
);
}
else
else
{
{
PWINECRYPT_CERTSTORE
hcs
=
PWINECRYPT_CERTSTORE
hcs
=
...
@@ -2338,7 +2335,10 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
...
@@ -2338,7 +2335,10 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
else
if
(
hcs
->
dwMagic
!=
WINE_CRYPTCERTSTORE_MAGIC
)
else
if
(
hcs
->
dwMagic
!=
WINE_CRYPTCERTSTORE_MAGIC
)
ret
=
FALSE
;
ret
=
FALSE
;
else
else
{
ret
=
hcs
->
deleteCert
(
hcs
,
pCertContext
,
0
);
ret
=
hcs
->
deleteCert
(
hcs
,
pCertContext
,
0
);
CertFreeCertificateContext
(
pCertContext
);
}
}
}
return
ret
;
return
ret
;
}
}
...
@@ -2443,7 +2443,7 @@ BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
...
@@ -2443,7 +2443,7 @@ BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
if
(
InterlockedDecrement
(
&
hcs
->
ref
)
==
0
)
if
(
InterlockedDecrement
(
&
hcs
->
ref
)
==
0
)
{
{
TRACE
(
"
freeing %p
\n
"
,
hcs
);
TRACE
(
"
%p's ref count is 0, freeing
\n
"
,
hcs
);
hcs
->
dwMagic
=
0
;
hcs
->
dwMagic
=
0
;
if
(
!
(
hcs
->
dwOpenFlags
&
CERT_STORE_NO_CRYPT_RELEASE_FLAG
))
if
(
!
(
hcs
->
dwOpenFlags
&
CERT_STORE_NO_CRYPT_RELEASE_FLAG
))
CryptReleaseContext
(
hcs
->
cryptProv
,
0
);
CryptReleaseContext
(
hcs
->
cryptProv
,
0
);
...
@@ -2883,12 +2883,11 @@ BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
...
@@ -2883,12 +2883,11 @@ BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
if
(
InterlockedDecrement
(
&
ref
->
context
->
ref
)
==
0
)
if
(
InterlockedDecrement
(
&
ref
->
context
->
ref
)
==
0
)
{
{
TRACE
(
"
freeing %p
\n
"
,
ref
->
context
);
TRACE
(
"
%p's ref count is 0, freeing
\n
"
,
ref
->
context
);
CRYPT_FreeCert
(
ref
->
context
);
CRYPT_FreeCert
(
ref
->
context
);
}
}
else
else
TRACE
(
"%p's ref count is %ld
\n
"
,
ref
->
context
,
TRACE
(
"%p's ref count is %ld
\n
"
,
ref
->
context
,
ref
->
context
->
ref
);
ref
->
context
->
ref
);
if
(
store
&&
store
->
dwMagic
==
WINE_CRYPTCERTSTORE_MAGIC
&&
if
(
store
&&
store
->
dwMagic
==
WINE_CRYPTCERTSTORE_MAGIC
&&
store
->
freeCert
)
store
->
freeCert
)
store
->
freeCert
(
ref
);
store
->
freeCert
(
ref
);
...
...
dlls/crypt32/tests/cert.c
View file @
25cb6e08
...
@@ -166,7 +166,6 @@ static void testMemStore(void)
...
@@ -166,7 +166,6 @@ static void testMemStore(void)
ret
=
CertDeleteCertificateFromStore
(
context
);
ret
=
CertDeleteCertificateFromStore
(
context
);
ok
(
ret
,
"CertDeleteCertificateFromStore failed: %08lx
\n
"
,
ok
(
ret
,
"CertDeleteCertificateFromStore failed: %08lx
\n
"
,
GetLastError
());
GetLastError
());
CertFreeCertificateContext
(
context
);
}
}
/* add a cert to store1 */
/* add a cert to store1 */
ret
=
CertAddEncodedCertificateToStore
(
store1
,
X509_ASN_ENCODING
,
bigCert
,
ret
=
CertAddEncodedCertificateToStore
(
store1
,
X509_ASN_ENCODING
,
bigCert
,
...
@@ -727,10 +726,7 @@ static void testRegStore(void)
...
@@ -727,10 +726,7 @@ static void testRegStore(void)
context
=
CertEnumCertificatesInStore
(
store
,
NULL
);
context
=
CertEnumCertificatesInStore
(
store
,
NULL
);
ok
(
context
!=
NULL
,
"Expected a cert context
\n
"
);
ok
(
context
!=
NULL
,
"Expected a cert context
\n
"
);
if
(
context
)
if
(
context
)
{
CertDeleteCertificateFromStore
(
context
);
CertDeleteCertificateFromStore
(
context
);
CertFreeCertificateContext
(
context
);
}
ret
=
CertControlStore
(
store
,
0
,
CERT_STORE_CTRL_COMMIT
,
NULL
);
ret
=
CertControlStore
(
store
,
0
,
CERT_STORE_CTRL_COMMIT
,
NULL
);
ok
(
ret
,
"CertControlStore failed: %08lx
\n
"
,
GetLastError
());
ok
(
ret
,
"CertControlStore failed: %08lx
\n
"
,
GetLastError
());
...
...
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