Esempio n. 1
0
        /// <summary>
        /// Provides information about how the bind operation should be handled when called by an asynchronous moniker.
        /// </summary>
        void IBindStatusCallback.GetBindInfo(ref uint grfBINDF, ref BINDINFO pbindinfo)
        {
            if (DownloadAction == DownloadActions.POST)
            {
                grfBINDF |= (uint)BINDF.FORMS_SUBMIT;
                grfBINDF |= (uint)BINDF.IGNORESECURITYPROBLEM;

                pbindinfo.dwBindVerb = BINDVERB.POST;

                pbindinfo.stgmedData.tymed    = TYMED.HGLOBAL;
                pbindinfo.stgmedData.contents = Marshal.AllocHGlobal(PostData.Length);
                Marshal.Copy(PostData, 0, pbindinfo.stgmedData.contents, PostData.Length);
                pbindinfo.stgmedData.pUnkForRelease = IntPtr.Zero;

                pbindinfo.cbstgmedData = (uint)PostData.Length;
            }

            LOG("IBindStatusCallback", "GetBindInfo");
        }
        private int Start(string szUrl, IInternetProtocolSink protocolSink, IInternetBindInfo bindInfo, PI_FLAGS grfPI, uint dwReserved)
        {
            ClearData();

            currentProtocolSink = protocolSink;
            currentUrl          = szUrl;

            BINDINFO bindInfoData = new BINDINFO();

            bindInfoData.cbSize = (uint)Marshal.SizeOf(bindInfoData);
            bindInfo.GetBindInfo(out currentBindFlags, ref bindInfoData);

            if ((grfPI & PI_FLAGS.PI_FORCE_ASYNC) != 0)
            {
                PROTOCOLDATA protocolData = new PROTOCOLDATA();
                protocolData.grfFlags = PI_FLAGS.PI_FORCE_ASYNC;
                protocolSink.Switch(ref protocolData);
                return(NativeConstants.E_PENDING);
            }
            else
            {
                return(DoBind());
            }
        }