Changeset 846
- Timestamp:
- 1/2/2009 1:19:03 PM (3 years ago)
- File:
-
- 1 edited
-
branches/eraser6/Util/WintrustAPI.cs (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Util/WintrustAPI.cs
r845 r846 40 40 fileinfo.cbStruct = (uint)Marshal.SizeOf(typeof(WINTRUST_FILE_INFO)); 41 41 fileinfo.pcwszFilePath = pathToFile; 42 fileinfo.hFile = IntPtr.Zero;43 42 44 43 WINTRUST_DATA data = new WINTRUST_DATA(); … … 47 46 data.fdwRevocationChecks = WINTRUST_DATA.RevocationChecks.WTD_REVOKE_NONE; 48 47 data.dwUnionChoice = WINTRUST_DATA.UnionChoices.WTD_CHOICE_FILE; 49 data.pUnion = Marshal.AllocHGlobal((int) data.cbStruct);48 data.pUnion = Marshal.AllocHGlobal((int)fileinfo.cbStruct); 50 49 Marshal.StructureToPtr(fileinfo, data.pUnion, false); 51 50 52 int result = WinVerifyTrust(IntPtr.Zero, WINTRUST_ACTION_GENERIC_VERIFY_V2, data); 51 Guid guid = WINTRUST_ACTION_GENERIC_VERIFY_V2; 52 int result = WinVerifyTrust(IntPtr.Zero, ref guid, ref data); 53 53 Marshal.FreeHGlobal(data.pUnion); 54 54 return result == 0; … … 124 124 /// specified for the subject.</returns> 125 125 [DllImport("Wintrust.dll", CharSet = CharSet.Unicode)] 126 private static extern int WinVerifyTrust(IntPtr hWnd, Guid pgActionID,127 WINTRUST_DATA pWVTData);126 private static extern int WinVerifyTrust(IntPtr hWnd, ref Guid pgActionID, 127 ref WINTRUST_DATA pWVTData); 128 128 129 129 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] … … 133 133 public string pcwszFilePath; // required, file name to be verified 134 134 public IntPtr hFile; // optional, open handle to pcwszFilePath 135 public Guid pgKnownSubject;// optional: fill if the subject type is known.135 public IntPtr pgKnownSubject; // optional: fill if the subject type is known. 136 136 } 137 137 138 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 138 139 private struct WINTRUST_DATA 139 140 { … … 142 143 public IntPtr pPolicyCallbackData; // optional: used to pass data between the app and policy 143 144 public IntPtr pSIPClientData; // optional: used to pass data between the app and SIP. 145 public UIChoices dwUIChoice; // required: UI choice. One of the following. 146 public RevocationChecks fdwRevocationChecks;// required: certificate revocation check options 147 public UnionChoices dwUnionChoice; // required: which structure is being passed in? 148 149 public IntPtr pUnion; 150 151 public StateActions dwStateAction; // optional (Catalog File Processing) 152 public IntPtr hWVTStateData; // optional (Catalog File Processing) 153 private string pwszURLReference; // optional: (future) used to determine zone. 154 public ProviderFlags dwProvFlags; 155 public UIContexts dwUIContext; 144 156 145 157 public enum UIChoices : uint … … 150 162 WTD_UI_NOGOOD = 4, 151 163 } 152 public UIChoices dwUIChoice; // required: UI choice. One of the following.153 154 164 public enum RevocationChecks : uint 155 165 { … … 157 167 WTD_REVOKE_WHOLECHAIN = 0x00000001 158 168 } 159 public RevocationChecks fdwRevocationChecks;// required: certificate revocation check options160 161 169 public enum UnionChoices : uint 162 170 { … … 167 175 WTD_CHOICE_CERT = 5 168 176 } 169 public UnionChoices dwUnionChoice; // required: which structure is being passed in?170 171 public IntPtr pUnion;172 177 173 178 public enum StateActions : uint … … 179 184 WTD_STATEACTION_AUTO_CACHE_FLUSH = 0x00000004 180 185 } 181 public StateActions dwStateAction; // optional (Catalog File Processing)182 IntPtr hWVTStateData; // optional (Catalog File Processing)183 string pwszURLReference; // optional: (future) used to determine zone.184 185 186 public enum ProviderFlags : uint 186 187 { … … 199 200 WTD_CACHE_ONLY_URL_RETRIEVAL = 0x00001000 200 201 } 201 public ProviderFlags dwProvFlags;202 203 204 // 17-Dec-2004 JSchwart: re-added to fix build break in other depots205 202 public enum UIContexts 206 203 { … … 208 205 WTD_UICONTEXT_INSTALL = 1 209 206 } 210 public UIContexts dwUIContext;211 207 } 212 208
Note: See TracChangeset
for help on using the changeset viewer.
