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
3a945c39
Commit
3a945c39
authored
May 03, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
May 03, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Fix CryptSIPGetSignedMsg (from PE file).
parent
3a6196b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
crypt.c
dlls/wintrust/crypt.c
+24
-4
No files found.
dlls/wintrust/crypt.c
View file @
3a945c39
...
...
@@ -1016,16 +1016,27 @@ static BOOL WINTRUST_GetSignedMsgFromPEFile(SIP_SUBJECTINFO *pSubjectInfo,
{
BOOL
ret
;
WIN_CERTIFICATE
*
pCert
=
NULL
;
HANDLE
file
;
TRACE
(
"(%p %p %d %p %p)
\n
"
,
pSubjectInfo
,
pdwEncodingType
,
dwIndex
,
pcbSignedDataMsg
,
pbSignedDataMsg
);
if
(
pSubjectInfo
->
hFile
&&
pSubjectInfo
->
hFile
!=
INVALID_HANDLE_VALUE
)
file
=
pSubjectInfo
->
hFile
;
else
{
file
=
CreateFileW
(
pSubjectInfo
->
pwsFileName
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
file
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
}
if
(
!
pbSignedDataMsg
)
{
WIN_CERTIFICATE
cert
;
/* app hasn't passed buffer, just get the length */
ret
=
ImageGetCertificateHeader
(
pSubjectInfo
->
hF
ile
,
dwIndex
,
&
cert
);
ret
=
ImageGetCertificateHeader
(
f
ile
,
dwIndex
,
&
cert
);
if
(
ret
)
{
switch
(
cert
.
wCertificateType
)
...
...
@@ -1044,7 +1055,7 @@ static BOOL WINTRUST_GetSignedMsgFromPEFile(SIP_SUBJECTINFO *pSubjectInfo,
{
DWORD
len
=
0
;
ret
=
ImageGetCertificateData
(
pSubjectInfo
->
hF
ile
,
dwIndex
,
NULL
,
&
len
);
ret
=
ImageGetCertificateData
(
f
ile
,
dwIndex
,
NULL
,
&
len
);
if
(
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
goto
error
;
pCert
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
...
...
@@ -1053,10 +1064,10 @@ static BOOL WINTRUST_GetSignedMsgFromPEFile(SIP_SUBJECTINFO *pSubjectInfo,
ret
=
FALSE
;
goto
error
;
}
ret
=
ImageGetCertificateData
(
pSubjectInfo
->
hFile
,
dwIndex
,
pCert
,
&
len
);
ret
=
ImageGetCertificateData
(
file
,
dwIndex
,
pCert
,
&
len
);
if
(
!
ret
)
goto
error
;
pCert
->
dwLength
-=
FIELD_OFFSET
(
WIN_CERTIFICATE
,
bCertificate
);
if
(
*
pcbSignedDataMsg
<
pCert
->
dwLength
)
{
*
pcbSignedDataMsg
=
pCert
->
dwLength
;
...
...
@@ -1066,6 +1077,7 @@ static BOOL WINTRUST_GetSignedMsgFromPEFile(SIP_SUBJECTINFO *pSubjectInfo,
else
{
memcpy
(
pbSignedDataMsg
,
pCert
->
bCertificate
,
pCert
->
dwLength
);
*
pcbSignedDataMsg
=
pCert
->
dwLength
;
switch
(
pCert
->
wCertificateType
)
{
case
WIN_CERT_TYPE_X509
:
...
...
@@ -1083,6 +1095,8 @@ static BOOL WINTRUST_GetSignedMsgFromPEFile(SIP_SUBJECTINFO *pSubjectInfo,
}
}
error:
if
(
pSubjectInfo
->
hFile
!=
file
)
CloseHandle
(
file
);
HeapFree
(
GetProcessHeap
(),
0
,
pCert
);
return
ret
;
}
...
...
@@ -1351,6 +1365,12 @@ BOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO* pSubjectInfo, DWORD* pdwEn
TRACE
(
"(%p %p %d %p %p)
\n
"
,
pSubjectInfo
,
pdwEncodingType
,
dwIndex
,
pcbSignedDataMsg
,
pbSignedDataMsg
);
if
(
!
pSubjectInfo
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
!
memcmp
(
pSubjectInfo
->
pgSubjectType
,
&
unknown
,
sizeof
(
unknown
)))
ret
=
WINTRUST_GetSignedMsgFromPEFile
(
pSubjectInfo
,
pdwEncodingType
,
dwIndex
,
pcbSignedDataMsg
,
pbSignedDataMsg
);
...
...
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