blob: 81fbec656e304164bdf74e7c6c42932d7cb543ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
namespace WixToolset
{
using System;
using System.Collections;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
internal class VerifyInterop
{
internal const string GenericVerify2 = "00AAC56B-CD44-11d0-8CC2-00C04FC295EE";
internal const uint WTD_UI_NONE = 2;
internal const uint WTD_REVOKE_NONE = 0;
internal const uint WTD_CHOICE_CATALOG = 2;
internal const uint WTD_STATEACTION_VERIFY = 1;
internal const uint WTD_REVOCATION_CHECK_NONE = 0x10;
internal const int ErrorInsufficientBuffer = 122;
[StructLayout(LayoutKind.Sequential)]
internal struct WinTrustData
{
internal uint cbStruct;
internal IntPtr pPolicyCallbackData;
internal IntPtr pSIPClientData;
internal uint dwUIChoice;
internal uint fdwRevocationChecks;
internal uint dwUnionChoice;
internal IntPtr pCatalog;
internal uint dwStateAction;
internal IntPtr hWVTStateData;
[MarshalAs(UnmanagedType.LPWStr)]
internal string pwszURLReference;
internal uint dwProvFlags;
internal uint dwUIContext;
}
[StructLayout(LayoutKind.Sequential)]
internal struct WinTrustCatalogInfo
{
internal uint cbStruct;
internal uint dwCatalogVersion;
[MarshalAs(UnmanagedType.LPWStr)]
internal string pcwszCatalogFilePath;
[MarshalAs(UnmanagedType.LPWStr)]
internal string pcwszMemberTag;
[MarshalAs(UnmanagedType.LPWStr)]
internal string pcwszMemberFilePath;
internal IntPtr hMemberFile;
internal IntPtr pbCalculatedFileHash;
internal uint cbCalculatedFileHash;
internal IntPtr pcCatalogContext;
}
[DllImport("wintrust.dll", SetLastError = true)]
internal static extern long WinVerifyTrust(IntPtr windowHandle, ref Guid actionGuid, ref WinTrustData trustData);
[DllImport("wintrust.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool CryptCATAdminCalcHashFromFileHandle(
IntPtr fileHandle,
[In, Out]
ref uint hashSize,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]
byte[] hashBytes,
uint flags);
}
}
|