예제 #1
0
            // constructor for silent WinTrustDataChoice.File check
            public WinTrustData(String _fileName, bool isCatalog, String _hash, String _catalogPath, IntPtr hCatAdmin)
            {
                // 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;
                }

                if (isCatalog)
                {
                    dwUnionChoice = WinTrustDataChoice.Catalog;
                    WinTrustCatalogInfo wtfiData = new WinTrustCatalogInfo(_catalogPath, _hash, _fileName, hCatAdmin);

                    FileInfoPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(WinTrustCatalogInfo)));
                    Marshal.StructureToPtr(wtfiData, FileInfoPtr, false);
                }
                else
                {
                    WinTrustFileInfo wtfiData = new WinTrustFileInfo(_fileName);

                    FileInfoPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(WinTrustFileInfo)));
                    Marshal.StructureToPtr(wtfiData, FileInfoPtr, false);
                }
            }
예제 #2
0
        public WinTrustData(String fileName)
        {
            WinTrustFileInfo wtfiData = new WinTrustFileInfo(fileName);

            FileInfoPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(WinTrustFileInfo)));
            Marshal.StructureToPtr(wtfiData, FileInfoPtr, false);
            UnionChoice = WinTrustDataChoice.File;
        }
예제 #3
0
                public WinTrustData(
                    WinTrustDataUIChoice uiChoice,
                    WinTrustDataRevocationChecks revocationCheck,
                    WinTrustDataChoice unionChoice,
                    WinTrustDataStateAction stateAction,
                    WinTrustDataProvFlags provFlags,
                    WinTrustDataUIContext uiContext,
                    WINTRUST_FILE_INFO fileInfo)
                {
                    this.UIChoice         = (uint)uiChoice;
                    this.RevocationChecks = (uint)revocationCheck;
                    this.UnionChoice      = (uint)unionChoice;
                    this.StateAction      = (uint)stateAction;
                    this.ProvFlags        = provFlags;
                    this.UIContext        = (uint)uiContext;

                    ProvFlags  |= WinTrustDataProvFlags.DisableMD2andMD4;
                    FileInfoPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(WINTRUST_FILE_INFO)));
                    Marshal.StructureToPtr(fileInfo, FileInfoPtr, false);
                }
예제 #4
0
 public WinTrustData(String fileName)
 {
     WinTrustFileInfo wtfiData = new WinTrustFileInfo(fileName);
     FileInfoPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(WinTrustFileInfo)));
     Marshal.StructureToPtr(wtfiData, FileInfoPtr, false);
     UnionChoice = WinTrustDataChoice.File;
 }