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
dffccbf1
Commit
dffccbf1
authored
Dec 23, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 23, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Implement CryptCATEnumerateMember.
Based on work done by Maarten Lankhorst.
parent
c7109645
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
143 additions
and
2 deletions
+143
-2
crypt.c
dlls/wintrust/crypt.c
+143
-2
No files found.
dlls/wintrust/crypt.c
View file @
dffccbf1
...
...
@@ -30,6 +30,7 @@
#include "mscat.h"
#include "mssip.h"
#include "imagehlp.h"
#include "winternl.h"
#include "wine/debug.h"
#include "wine/unicode.h"
...
...
@@ -499,9 +500,149 @@ BOOL WINAPI CryptCATClose(HANDLE hCatalog)
/***********************************************************************
* CryptCATEnumerateMember (WINTRUST.@)
*/
CRYPTCATMEMBER
*
WINAPI
CryptCATEnumerateMember
(
HANDLE
hCatalog
,
CRYPTCATMEMBER
*
pPrevMember
)
CRYPTCATMEMBER
*
WINAPI
CryptCATEnumerateMember
(
HANDLE
hCatalog
,
CRYPTCATMEMBER
*
prev
)
{
FIXME
(
"(%p, %p) stub
\n
"
,
hCatalog
,
pPrevMember
);
struct
cryptcat
*
cc
=
hCatalog
;
CRYPTCATMEMBER
*
member
=
prev
;
CTL_ENTRY
*
entry
;
DWORD
size
,
i
;
TRACE
(
"%p, %p
\n
"
,
hCatalog
,
prev
);
if
(
!
hCatalog
||
hCatalog
==
INVALID_HANDLE_VALUE
||
cc
->
magic
!=
CRYPTCAT_MAGIC
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
/* dumping the contents makes me think that dwReserved is the iteration number */
if
(
!
member
)
{
if
(
!
(
member
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
member
))))
{
SetLastError
(
ERROR_OUTOFMEMORY
);
return
NULL
;
}
member
->
cbStruct
=
sizeof
(
*
member
);
member
->
pwszFileName
=
member
->
pwszReferenceTag
=
NULL
;
member
->
dwReserved
=
0
;
member
->
hReserved
=
NULL
;
member
->
gSubjectType
=
cc
->
subject
;
member
->
fdwMemberFlags
=
0
;
member
->
pIndirectData
=
NULL
;
member
->
dwCertVersion
=
cc
->
inner
->
dwVersion
;
}
else
member
->
dwReserved
++
;
if
(
member
->
dwReserved
>=
cc
->
inner
->
cCTLEntry
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
goto
error
;
}
/* list them backwards, like native */
entry
=
&
cc
->
inner
->
rgCTLEntry
[
cc
->
inner
->
cCTLEntry
-
member
->
dwReserved
-
1
];
member
->
sEncodedIndirectData
.
cbData
=
member
->
sEncodedMemberInfo
.
cbData
=
0
;
member
->
sEncodedIndirectData
.
pbData
=
member
->
sEncodedMemberInfo
.
pbData
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
member
->
pIndirectData
);
member
->
pIndirectData
=
NULL
;
for
(
i
=
0
;
i
<
entry
->
cAttribute
;
i
++
)
{
CRYPT_ATTRIBUTE
*
attr
=
entry
->
rgAttribute
+
i
;
if
(
attr
->
cValue
!=
1
)
{
ERR
(
"Can't handle attr->cValue of %u
\n
"
,
attr
->
cValue
);
continue
;
}
if
(
!
strcmp
(
attr
->
pszObjId
,
CAT_MEMBERINFO_OBJID
))
{
CAT_MEMBERINFO
*
mi
;
BOOL
ret
;
member
->
sEncodedMemberInfo
.
cbData
=
attr
->
rgValue
->
cbData
;
member
->
sEncodedMemberInfo
.
pbData
=
attr
->
rgValue
->
pbData
;
CryptDecodeObject
(
cc
->
encoding
,
CAT_MEMBERINFO_OBJID
,
attr
->
rgValue
->
pbData
,
attr
->
rgValue
->
cbData
,
0
,
NULL
,
&
size
);
if
(
!
(
mi
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
{
SetLastError
(
ERROR_OUTOFMEMORY
);
goto
error
;
}
ret
=
CryptDecodeObject
(
cc
->
encoding
,
CAT_MEMBERINFO_OBJID
,
attr
->
rgValue
->
pbData
,
attr
->
rgValue
->
cbData
,
0
,
mi
,
&
size
);
if
(
ret
)
{
UNICODE_STRING
guid
;
member
->
dwCertVersion
=
mi
->
dwCertVersion
;
RtlInitUnicodeString
(
&
guid
,
mi
->
pwszSubjGuid
);
if
(
RtlGUIDFromString
(
&
guid
,
&
member
->
gSubjectType
))
{
HeapFree
(
GetProcessHeap
(),
0
,
mi
);
goto
error
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
mi
);
if
(
!
ret
)
goto
error
;
}
else
if
(
!
strcmp
(
attr
->
pszObjId
,
SPC_INDIRECT_DATA_OBJID
))
{
/* SPC_INDIRECT_DATA_CONTENT is equal to SIP_INDIRECT_DATA */
member
->
sEncodedIndirectData
.
cbData
=
attr
->
rgValue
->
cbData
;
member
->
sEncodedIndirectData
.
pbData
=
attr
->
rgValue
->
pbData
;
CryptDecodeObject
(
cc
->
encoding
,
SPC_INDIRECT_DATA_OBJID
,
attr
->
rgValue
->
pbData
,
attr
->
rgValue
->
cbData
,
0
,
NULL
,
&
size
);
if
(
!
(
member
->
pIndirectData
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
{
SetLastError
(
ERROR_OUTOFMEMORY
);
goto
error
;
}
CryptDecodeObject
(
cc
->
encoding
,
SPC_INDIRECT_DATA_OBJID
,
attr
->
rgValue
->
pbData
,
attr
->
rgValue
->
cbData
,
0
,
member
->
pIndirectData
,
&
size
);
}
else
/* this object id should probably be handled in CryptCATEnumerateAttr */
FIXME
(
"unhandled object id
\"
%s
\"\n
"
,
attr
->
pszObjId
);
}
if
(
!
member
->
sEncodedMemberInfo
.
cbData
||
!
member
->
sEncodedIndirectData
.
cbData
)
{
ERR
(
"Corrupted catalog entry?
\n
"
);
SetLastError
(
CRYPT_E_ATTRIBUTES_MISSING
);
goto
error
;
}
size
=
(
2
*
member
->
pIndirectData
->
Digest
.
cbData
+
1
)
*
sizeof
(
WCHAR
);
if
(
member
->
pwszReferenceTag
)
member
->
pwszReferenceTag
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
member
->
pwszReferenceTag
,
size
);
else
member
->
pwszReferenceTag
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
member
->
pwszReferenceTag
)
{
SetLastError
(
ERROR_OUTOFMEMORY
);
goto
error
;
}
/* FIXME: reference tag is usually the file hash but doesn't have to be */
for
(
i
=
0
;
i
<
member
->
pIndirectData
->
Digest
.
cbData
;
i
++
)
{
DWORD
sub
;
sub
=
member
->
pIndirectData
->
Digest
.
pbData
[
i
]
>>
4
;
member
->
pwszReferenceTag
[
i
*
2
]
=
(
sub
<
10
?
'0'
+
sub
:
'A'
+
sub
-
10
);
sub
=
member
->
pIndirectData
->
Digest
.
pbData
[
i
]
&
0xf
;
member
->
pwszReferenceTag
[
i
*
2
+
1
]
=
(
sub
<
10
?
'0'
+
sub
:
'A'
+
sub
-
10
);
}
member
->
pwszReferenceTag
[
i
*
2
]
=
0
;
return
member
;
error:
HeapFree
(
GetProcessHeap
(),
0
,
member
->
pIndirectData
);
HeapFree
(
GetProcessHeap
(),
0
,
member
->
pwszReferenceTag
);
HeapFree
(
GetProcessHeap
(),
0
,
member
);
return
NULL
;
}
...
...
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