Ejemplo n.º 1
0
 internal static NativeMethods.WINTRUST_FILE_INFO InitWintrustFileInfoStruct(
     string fileName)
 {
     NativeMethods.WINTRUST_FILE_INFO wintrustFileInfo = new NativeMethods.WINTRUST_FILE_INFO();
     wintrustFileInfo.cbStruct              = (uint)Marshal.SizeOf((object)wintrustFileInfo);
     wintrustFileInfo.pcwszFilePath         = fileName;
     wintrustFileInfo.hFileNotUsed          = IntPtr.Zero;
     wintrustFileInfo.pgKnownSubjectNotUsed = IntPtr.Zero;
     return(wintrustFileInfo);
 }
Ejemplo n.º 2
0
        internal static NativeMethods.WINTRUST_DATA InitWintrustDataStructFromFile(
            NativeMethods.WINTRUST_FILE_INFO wfi)
        {
            NativeMethods.WINTRUST_DATA wintrustData = new NativeMethods.WINTRUST_DATA();
            wintrustData.cbStruct            = (uint)Marshal.SizeOf((object)wintrustData);
            wintrustData.pPolicyCallbackData = IntPtr.Zero;
            wintrustData.pSIPClientData      = IntPtr.Zero;
            wintrustData.dwUIChoice          = 2U;
            wintrustData.fdwRevocationChecks = 0U;
            wintrustData.dwUnionChoice       = 1U;
            IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf((object)wfi));

            Marshal.StructureToPtr((object)wfi, ptr, false);
            wintrustData.Choice.pFile     = ptr;
            wintrustData.dwStateAction    = 1U;
            wintrustData.hWVTStateData    = IntPtr.Zero;
            wintrustData.pwszURLReference = (string)null;
            wintrustData.dwProvFlags      = 0U;
            return(wintrustData);
        }