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
f3f25af9
Commit
f3f25af9
authored
Mar 30, 2011
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Implement MsiGetFileSignatureInformationA/W.
parent
8d58ddfe
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
16 deletions
+109
-16
Makefile.in
dlls/msi/Makefile.in
+1
-1
msi.c
dlls/msi/msi.c
+66
-14
msi.c
dlls/msi/tests/msi.c
+42
-1
No files found.
dlls/msi/Makefile.in
View file @
f3f25af9
MODULE
=
msi.dll
IMPORTLIB
=
msi
IMPORTS
=
uuid urlmon wininet comctl32 shell32 shlwapi cabinet oleaut32 ole32 version user32 gdi32 advapi32
DELAYIMPORTS
=
odbccp32
DELAYIMPORTS
=
odbccp32
wintrust crypt32
C_SRCS
=
\
action.c
\
...
...
dlls/msi/msi.c
View file @
f3f25af9
...
...
@@ -28,7 +28,6 @@
#include "winreg.h"
#include "winnls.h"
#include "shlwapi.h"
#include "wine/debug.h"
#include "msi.h"
#include "msidefs.h"
#include "msiquery.h"
...
...
@@ -39,6 +38,10 @@
#include "shlobj.h"
#include "shobjidl.h"
#include "objidl.h"
#include "wintrust.h"
#include "softpub.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
msi
);
...
...
@@ -2261,22 +2264,71 @@ UINT WINAPI MsiProvideComponentFromDescriptorW( LPCWSTR szDescriptor,
return
ERROR_CALL_NOT_IMPLEMENTED
;
}
HRESULT
WINAPI
MsiGetFileSignatureInformationA
(
LPCSTR
szSignedObjectPath
,
DWORD
dwFlags
,
PCCERT_CONTEXT
*
ppcCertContext
,
LPBYTE
pbHashData
,
LPDWORD
pcbHashData
)
HRESULT
WINAPI
MsiGetFileSignatureInformationA
(
LPCSTR
path
,
DWORD
flags
,
PCCERT_CONTEXT
*
cert
,
LPBYTE
hash
,
LPDWORD
hashlen
)
{
FIXME
(
"%s %08x %p %p %p
\n
"
,
debugstr_a
(
szSignedObjectPath
),
dwFlags
,
ppcCertContext
,
pbHashData
,
pcbHashData
);
return
ERROR_CALL_NOT_IMPLEMENTED
;
UINT
r
;
WCHAR
*
pathW
=
NULL
;
TRACE
(
"%s %08x %p %p %p
\n
"
,
debugstr_a
(
path
),
flags
,
cert
,
hash
,
hashlen
);
if
(
path
&&
!
(
pathW
=
strdupAtoW
(
path
)))
return
ERROR_OUTOFMEMORY
;
r
=
MsiGetFileSignatureInformationW
(
pathW
,
flags
,
cert
,
hash
,
hashlen
);
msi_free
(
pathW
);
return
r
;
}
HRESULT
WINAPI
MsiGetFileSignatureInformationW
(
LPCWSTR
szSignedObjectPath
,
DWORD
dwFlags
,
PCCERT_CONTEXT
*
ppcCertContext
,
LPBYTE
pbHashData
,
LPDWORD
pcbHashData
)
{
FIXME
(
"%s %08x %p %p %p
\n
"
,
debugstr_w
(
szSignedObjectPath
),
dwFlags
,
ppcCertContext
,
pbHashData
,
pcbHashData
);
return
ERROR_CALL_NOT_IMPLEMENTED
;
HRESULT
WINAPI
MsiGetFileSignatureInformationW
(
LPCWSTR
path
,
DWORD
flags
,
PCCERT_CONTEXT
*
cert
,
LPBYTE
hash
,
LPDWORD
hashlen
)
{
static
GUID
generic_verify_v2
=
WINTRUST_ACTION_GENERIC_VERIFY_V2
;
HRESULT
hr
;
WINTRUST_DATA
data
;
WINTRUST_FILE_INFO
info
;
CRYPT_PROVIDER_SGNR
*
signer
;
CRYPT_PROVIDER_CERT
*
provider
;
TRACE
(
"%s %08x %p %p %p
\n
"
,
debugstr_w
(
path
),
flags
,
cert
,
hash
,
hashlen
);
if
(
!
path
||
!
cert
)
return
E_INVALIDARG
;
info
.
cbStruct
=
sizeof
(
info
);
info
.
pcwszFilePath
=
path
;
info
.
hFile
=
NULL
;
info
.
pgKnownSubject
=
NULL
;
data
.
cbStruct
=
sizeof
(
data
);
data
.
pPolicyCallbackData
=
NULL
;
data
.
pSIPClientData
=
NULL
;
data
.
dwUIChoice
=
WTD_UI_NONE
;
data
.
fdwRevocationChecks
=
WTD_REVOKE_WHOLECHAIN
;
data
.
dwUnionChoice
=
WTD_CHOICE_FILE
;
data
.
u
.
pFile
=
&
info
;
data
.
dwStateAction
=
WTD_STATEACTION_VERIFY
;
data
.
hWVTStateData
=
NULL
;
data
.
pwszURLReference
=
NULL
;
data
.
dwProvFlags
=
0
;
data
.
dwUIContext
=
WTD_UICONTEXT_INSTALL
;
hr
=
WinVerifyTrustEx
(
INVALID_HANDLE_VALUE
,
&
generic_verify_v2
,
&
data
);
if
(
FAILED
(
hr
))
return
hr
;
signer
=
WTHelperGetProvSignerFromChain
(
data
.
hWVTStateData
,
0
,
FALSE
,
0
);
if
(
!
signer
)
return
TRUST_E_NOSIGNATURE
;
if
(
hash
)
{
DWORD
len
=
signer
->
psSigner
->
EncryptedHash
.
cbData
;
if
(
*
hashlen
<
len
)
{
*
hashlen
=
len
;
return
HRESULT_FROM_WIN32
(
ERROR_MORE_DATA
);
}
memcpy
(
hash
,
signer
->
psSigner
->
EncryptedHash
.
pbData
,
len
);
*
hashlen
=
len
;
}
provider
=
WTHelperGetProvCertFromChain
(
signer
,
0
);
if
(
!
provider
)
return
TRUST_E_PROVIDER_UNKNOWN
;
*
cert
=
CertDuplicateCertificateContext
(
provider
->
pCert
);
return
S_OK
;
}
/******************************************************************
...
...
dlls/msi/tests/msi.c
View file @
f3f25af9
...
...
@@ -11753,6 +11753,47 @@ static void test_MsiEnumProducts(void)
LocalFree
(
usersid
);
}
static
void
test_MsiGetFileSignatureInformation
(
void
)
{
HRESULT
hr
;
const
CERT_CONTEXT
*
cert
;
DWORD
len
;
hr
=
MsiGetFileSignatureInformationA
(
NULL
,
0
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG got 0x%08x
\n
"
,
hr
);
hr
=
MsiGetFileSignatureInformationA
(
NULL
,
0
,
NULL
,
NULL
,
&
len
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG got 0x%08x
\n
"
,
hr
);
hr
=
MsiGetFileSignatureInformationA
(
NULL
,
0
,
&
cert
,
NULL
,
&
len
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG got 0x%08x
\n
"
,
hr
);
hr
=
MsiGetFileSignatureInformationA
(
""
,
0
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG got 0x%08x
\n
"
,
hr
);
hr
=
MsiGetFileSignatureInformationA
(
"signature.bin"
,
0
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG got 0x%08x
\n
"
,
hr
);
hr
=
MsiGetFileSignatureInformationA
(
"signature.bin"
,
0
,
NULL
,
NULL
,
&
len
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG got 0x%08x
\n
"
,
hr
);
hr
=
MsiGetFileSignatureInformationA
(
"signature.bin"
,
0
,
&
cert
,
NULL
,
&
len
);
todo_wine
ok
(
hr
==
CRYPT_E_FILE_ERROR
,
"expected CRYPT_E_FILE_ERROR got 0x%08x
\n
"
,
hr
);
create_file
(
"signature.bin"
,
"signature"
,
sizeof
(
"signature"
)
);
hr
=
MsiGetFileSignatureInformationA
(
"signature.bin"
,
0
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG got 0x%08x
\n
"
,
hr
);
hr
=
MsiGetFileSignatureInformationA
(
"signature.bin"
,
0
,
NULL
,
NULL
,
&
len
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG got 0x%08x
\n
"
,
hr
);
hr
=
MsiGetFileSignatureInformationA
(
"signature.bin"
,
0
,
&
cert
,
NULL
,
&
len
);
todo_wine
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FUNCTION_FAILED
),
"got 0x%08x
\n
"
,
hr
);
DeleteFileA
(
"signature.bin"
);
}
START_TEST
(
msi
)
{
init_functionpointers
();
...
...
@@ -11786,6 +11827,6 @@ START_TEST(msi)
test_MsiGetPatchInfo
();
test_MsiEnumProducts
();
}
test_MsiGetFileVersion
();
test_MsiGetFileSignatureInformation
();
}
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