diff options
Diffstat (limited to 'src/WixToolset.Core.Burn/VerifyInterop.cs')
-rw-r--r-- | src/WixToolset.Core.Burn/VerifyInterop.cs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/WixToolset.Core.Burn/VerifyInterop.cs b/src/WixToolset.Core.Burn/VerifyInterop.cs new file mode 100644 index 00000000..81fbec65 --- /dev/null +++ b/src/WixToolset.Core.Burn/VerifyInterop.cs | |||
@@ -0,0 +1,68 @@ | |||
1 | // 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. | ||
2 | |||
3 | namespace WixToolset | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections; | ||
7 | using System.Runtime.CompilerServices; | ||
8 | using System.Runtime.InteropServices; | ||
9 | |||
10 | internal class VerifyInterop | ||
11 | { | ||
12 | internal const string GenericVerify2 = "00AAC56B-CD44-11d0-8CC2-00C04FC295EE"; | ||
13 | internal const uint WTD_UI_NONE = 2; | ||
14 | internal const uint WTD_REVOKE_NONE = 0; | ||
15 | internal const uint WTD_CHOICE_CATALOG = 2; | ||
16 | internal const uint WTD_STATEACTION_VERIFY = 1; | ||
17 | internal const uint WTD_REVOCATION_CHECK_NONE = 0x10; | ||
18 | internal const int ErrorInsufficientBuffer = 122; | ||
19 | |||
20 | [StructLayout(LayoutKind.Sequential)] | ||
21 | internal struct WinTrustData | ||
22 | { | ||
23 | internal uint cbStruct; | ||
24 | internal IntPtr pPolicyCallbackData; | ||
25 | internal IntPtr pSIPClientData; | ||
26 | internal uint dwUIChoice; | ||
27 | internal uint fdwRevocationChecks; | ||
28 | internal uint dwUnionChoice; | ||
29 | internal IntPtr pCatalog; | ||
30 | internal uint dwStateAction; | ||
31 | internal IntPtr hWVTStateData; | ||
32 | [MarshalAs(UnmanagedType.LPWStr)] | ||
33 | internal string pwszURLReference; | ||
34 | internal uint dwProvFlags; | ||
35 | internal uint dwUIContext; | ||
36 | } | ||
37 | |||
38 | [StructLayout(LayoutKind.Sequential)] | ||
39 | internal struct WinTrustCatalogInfo | ||
40 | { | ||
41 | internal uint cbStruct; | ||
42 | internal uint dwCatalogVersion; | ||
43 | [MarshalAs(UnmanagedType.LPWStr)] | ||
44 | internal string pcwszCatalogFilePath; | ||
45 | [MarshalAs(UnmanagedType.LPWStr)] | ||
46 | internal string pcwszMemberTag; | ||
47 | [MarshalAs(UnmanagedType.LPWStr)] | ||
48 | internal string pcwszMemberFilePath; | ||
49 | internal IntPtr hMemberFile; | ||
50 | internal IntPtr pbCalculatedFileHash; | ||
51 | internal uint cbCalculatedFileHash; | ||
52 | internal IntPtr pcCatalogContext; | ||
53 | } | ||
54 | |||
55 | [DllImport("wintrust.dll", SetLastError = true)] | ||
56 | internal static extern long WinVerifyTrust(IntPtr windowHandle, ref Guid actionGuid, ref WinTrustData trustData); | ||
57 | |||
58 | [DllImport("wintrust.dll", SetLastError = true)] | ||
59 | [return: MarshalAs(UnmanagedType.Bool)] | ||
60 | internal static extern bool CryptCATAdminCalcHashFromFileHandle( | ||
61 | IntPtr fileHandle, | ||
62 | [In, Out] | ||
63 | ref uint hashSize, | ||
64 | [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] | ||
65 | byte[] hashBytes, | ||
66 | uint flags); | ||
67 | } | ||
68 | } | ||