// constructor for silent WinTrustDataChoice.File check public WinTrustData(string fileName) { // On Win7SP1+, don't allow MD2 or MD4 signatures if ((Environment.OSVersion.Version.Major > 6) || ((Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor > 1)) || ((Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor == 1) && !String.IsNullOrEmpty(Environment.OSVersion.ServicePack))) { ProvFlags |= WinTrustDataProvFlags.DisableMD2andMD4; } WinTrustFileInfo wtfiData = new WinTrustFileInfo(fileName); FileInfoPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(WinTrustFileInfo))); Marshal.StructureToPtr(wtfiData, FileInfoPtr, false); }