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
4f62230e
Commit
4f62230e
authored
Aug 29, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Sep 02, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement CertFindCTLInStore.
parent
7a2cedad
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
127 additions
and
1 deletion
+127
-1
crypt32.spec
dlls/crypt32/crypt32.spec
+1
-1
ctl.c
dlls/crypt32/ctl.c
+126
-0
No files found.
dlls/crypt32/crypt32.spec
View file @
4f62230e
...
...
@@ -38,7 +38,7 @@
@ stdcall CertEnumSystemStore(long ptr ptr ptr)
@ stdcall CertFindAttribute(str long ptr)
@ stdcall CertFindCRLInStore(long long long long ptr ptr)
@ st
ub CertFindCTLInStore
@ st
dcall CertFindCTLInStore(long long long long ptr ptr)
@ stdcall CertFindCertificateInStore(long long long long ptr ptr)
@ stdcall CertFindCertificateInCRL(ptr ptr long ptr ptr)
@ stdcall CertFindExtension(str long ptr)
...
...
dlls/crypt32/ctl.c
View file @
4f62230e
...
...
@@ -68,6 +68,132 @@ PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(HCERTSTORE hCertStore,
return
ret
;
}
typedef
BOOL
(
*
CtlCompareFunc
)(
PCCTL_CONTEXT
pCtlContext
,
DWORD
dwType
,
DWORD
dwFlags
,
const
void
*
pvPara
);
static
BOOL
compare_ctl_any
(
PCCTL_CONTEXT
pCtlContext
,
DWORD
dwType
,
DWORD
dwFlags
,
const
void
*
pvPara
)
{
return
TRUE
;
}
static
BOOL
compare_ctl_by_md5_hash
(
PCCTL_CONTEXT
pCtlContext
,
DWORD
dwType
,
DWORD
dwFlags
,
const
void
*
pvPara
)
{
BOOL
ret
;
BYTE
hash
[
16
];
DWORD
size
=
sizeof
(
hash
);
ret
=
CertGetCTLContextProperty
(
pCtlContext
,
CERT_MD5_HASH_PROP_ID
,
hash
,
&
size
);
if
(
ret
)
{
const
CRYPT_HASH_BLOB
*
pHash
=
(
const
CRYPT_HASH_BLOB
*
)
pvPara
;
if
(
size
==
pHash
->
cbData
)
ret
=
!
memcmp
(
pHash
->
pbData
,
hash
,
size
);
else
ret
=
FALSE
;
}
return
ret
;
}
static
BOOL
compare_ctl_by_sha1_hash
(
PCCTL_CONTEXT
pCtlContext
,
DWORD
dwType
,
DWORD
dwFlags
,
const
void
*
pvPara
)
{
BOOL
ret
;
BYTE
hash
[
20
];
DWORD
size
=
sizeof
(
hash
);
ret
=
CertGetCTLContextProperty
(
pCtlContext
,
CERT_SHA1_HASH_PROP_ID
,
hash
,
&
size
);
if
(
ret
)
{
const
CRYPT_HASH_BLOB
*
pHash
=
(
const
CRYPT_HASH_BLOB
*
)
pvPara
;
if
(
size
==
pHash
->
cbData
)
ret
=
!
memcmp
(
pHash
->
pbData
,
hash
,
size
);
else
ret
=
FALSE
;
}
return
ret
;
}
static
BOOL
compare_ctl_existing
(
PCCTL_CONTEXT
pCtlContext
,
DWORD
dwType
,
DWORD
dwFlags
,
const
void
*
pvPara
)
{
BOOL
ret
;
if
(
pvPara
)
{
PCCTL_CONTEXT
ctl
=
(
PCCTL_CONTEXT
)
pvPara
;
if
(
pCtlContext
->
cbCtlContext
==
ctl
->
cbCtlContext
)
{
if
(
ctl
->
cbCtlContext
)
ret
=
!
memcmp
(
pCtlContext
->
pbCtlContext
,
ctl
->
pbCtlContext
,
ctl
->
cbCtlContext
);
else
ret
=
TRUE
;
}
else
ret
=
FALSE
;
}
else
ret
=
FALSE
;
return
ret
;
}
PCCTL_CONTEXT
WINAPI
CertFindCTLInStore
(
HCERTSTORE
hCertStore
,
DWORD
dwCertEncodingType
,
DWORD
dwFindFlags
,
DWORD
dwFindType
,
const
void
*
pvFindPara
,
PCCTL_CONTEXT
pPrevCtlContext
)
{
PCCTL_CONTEXT
ret
;
CtlCompareFunc
compare
;
TRACE
(
"(%p, %d, %d, %d, %p, %p)
\n
"
,
hCertStore
,
dwCertEncodingType
,
dwFindFlags
,
dwFindType
,
pvFindPara
,
pPrevCtlContext
);
switch
(
dwFindType
)
{
case
CTL_FIND_ANY
:
compare
=
compare_ctl_any
;
break
;
case
CTL_FIND_SHA1_HASH
:
compare
=
compare_ctl_by_sha1_hash
;
break
;
case
CTL_FIND_MD5_HASH
:
compare
=
compare_ctl_by_md5_hash
;
break
;
case
CTL_FIND_EXISTING
:
compare
=
compare_ctl_existing
;
break
;
default:
FIXME
(
"find type %08x unimplemented
\n
"
,
dwFindType
);
compare
=
NULL
;
}
if
(
compare
)
{
BOOL
matches
=
FALSE
;
ret
=
pPrevCtlContext
;
do
{
ret
=
CertEnumCTLsInStore
(
hCertStore
,
ret
);
if
(
ret
)
matches
=
compare
(
ret
,
dwFindType
,
dwFindFlags
,
pvFindPara
);
}
while
(
ret
!=
NULL
&&
!
matches
);
if
(
!
ret
)
SetLastError
(
CRYPT_E_NOT_FOUND
);
}
else
{
SetLastError
(
CRYPT_E_NOT_FOUND
);
ret
=
NULL
;
}
return
ret
;
}
BOOL
WINAPI
CertDeleteCTLFromStore
(
PCCTL_CONTEXT
pCtlContext
)
{
BOOL
ret
;
...
...
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