You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
869 B
32 lines
869 B
//+-------------------------------------------------------------------------
|
|
// File: hashexample.cpp
|
|
//
|
|
// Contents: An example calling WTHelperGetFileHash to get the hash
|
|
// of a signed file
|
|
//--------------------------------------------------------------------------
|
|
|
|
#include <windows.h>
|
|
#include <wincrypt.h>
|
|
#include <wintrust.h>
|
|
#include <wintrustp.h>
|
|
|
|
#define MAX_HASH_LEN 20
|
|
|
|
|
|
// Returns ERROR_SUCCESS if the file has a valid signed hash
|
|
LONG GetSignedFileHashExample(
|
|
IN LPCWSTR pwszFilename,
|
|
OUT BYTE rgbFileHash[MAX_HASH_LEN],
|
|
OUT DWORD *pcbFileHash,
|
|
OUT ALG_ID *pHashAlgid
|
|
)
|
|
{
|
|
return WTHelperGetFileHash(
|
|
pwszFilename,
|
|
0, // dwFlags
|
|
NULL, // pvReserved
|
|
rgbFileHash,
|
|
pcbFileHash,
|
|
pHashAlgid
|
|
);
|
|
}
|