コード例 #1
0
 public static void DisposeAndClearHandle(ref SafeWinHttpHandle safeHandle)
 {
     if (safeHandle != null)
     {
         safeHandle.Dispose();
         safeHandle = null;
     }
 }
コード例 #2
0
        // Important: WinHttp API calls should not happen while another WinHttp call for the same handle did not
        // return. During finalization that was not initiated by the Dispose pattern we don't expect any other WinHttp
        // calls in progress.
        protected override bool ReleaseHandle()
        {
            if (_parentHandle != null)
            {
                _parentHandle.DangerousRelease();
                _parentHandle = null;
            }

            return(WinHttpCloseHandle(handle));
        }
コード例 #3
0
        public void SetParentHandle(SafeWinHttpHandle parentHandle)
        {
            Debug.Assert(_parentHandle == null);
            Debug.Assert(parentHandle != null);
            Debug.Assert(!parentHandle.IsInvalid);

            bool ignore = false;

            parentHandle.DangerousAddRef(ref ignore);

            _parentHandle = parentHandle;
        }
コード例 #4
0
 private static extern bool WinHttpGetProxyForUrl(
     SafeWinHttpHandle sessionHandle, string url,
     ref WINHTTP_AUTOPROXY_OPTIONS autoProxyOptions,
     out WINHTTP_PROXY_INFO proxyInfo);