We need you! We're working hard on the next version of Developer Fusion -
Let us know what you think we should be up to!
-
Expand
Microsoft.Win32
-
Expand
Microsoft.Win32.SafeHandles
-
Expand
System
-
Expand
System.Runtime.Hosting
-
Expand
System.Runtime.InteropServices
-
Expand
System.Runtime.CompilerServices
-
Expand
System.Collections
-
Expand
System.Collections.Generic
-
Expand
System.Collections.ObjectModel
-
Expand
System.Configuration.Assemblies
-
Expand
System.Diagnostics
-
Expand
System.Diagnostics.CodeAnalysis
-
Expand
System.Diagnostics.SymbolStore
-
Expand
System.Globalization
-
Expand
System.IO
-
Expand
System.IO.IsolatedStorage
-
Expand
System.Reflection
-
Expand
System.Reflection.Cache
-
Expand
System.Reflection.Emit
-
Expand
System.Resources
-
Expand
System.Runtime
-
Expand
System.Runtime.InteropServices.Expando
-
Expand
System.Runtime.ConstrainedExecution
-
Expand
System.Runtime.Remoting.Activation
-
Expand
System.Runtime.Remoting.Messaging
-
Expand
System.Runtime.Remoting.Channels
-
Expand
System.Runtime.Remoting.Lifetime
-
Expand
System.Runtime.Remoting
-
Expand
System.Runtime.Remoting.Contexts
-
Expand
System.Runtime.Remoting.Proxies
-
Expand
System.Runtime.Remoting.Metadata
-
Expand
System.Runtime.Remoting.Metadata.W3cXsd2001
-
Expand
System.Runtime.Remoting.Services
-
Expand
System.Runtime.Serialization
-
Expand
System.Runtime.Serialization.Formatters
-
Expand
System.Runtime.Serialization.Formatters.Binary
-
Expand
System.Runtime.Versioning
-
Expand
System.Security
-
Expand
System.Security.Cryptography
-
Expand
System.Security.Cryptography.X509Certificates
-
Expand
System.Security.Permissions
-
Expand
System.Security.Policy
-
Expand
System.Security.Principal
-
Expand
System.Security.Util
-
Expand
System.Text
-
Expand
System.Threading
-
Expand
System.Runtime.Remoting.Channels.Http
-
Expand
System.Runtime.Remoting.Channels.Tcp
-
Expand
System.Runtime.Remoting.MetadataServices
-
Expand
System.Runtime.Serialization.Formatters.Soap.Xml
-
Expand
System.Runtime.Serialization.Formatters.Soap
-
Expand
Microsoft.Tools.Caspol
-
Expand
Microsoft.Tools.Build
-
Expand
Microsoft.CSharp
-
Expand
System.CodeDom
-
Expand
System.CodeDom.Compiler
-
Expand
System.Collections.Specialized
-
Expand
System.ComponentModel
-
Expand
System.ComponentModel.Design
-
Expand
System.ComponentModel.Design.Serialization
-
Expand
System.Configuration
-
Expand
System.Web
-
Expand
System.Configuration.Provider
-
Expand
System.Configuration.Internal
-
Expand
System.Internal
-
Expand
System.Windows.Forms
-
Expand
System.Net
-
Expand
AbortState
-
Expand
AddressInfo
-
Expand
AddressInfoHints
-
Expand
AsyncConnectionPoolRequest
-
Expand
AsyncTriState
-
Expand
AuthenticationManager
-
Expand
AuthenticationState
-
Expand
Authorization
-
Expand
AutoWebProxyScriptEngine
-
Expand
AutoWebProxyScriptWrapper
-
AutoWebProxyScriptWrapper()
-
AutoWebProxyScriptWrapper()
-
Buffer()
-
Buffer()
-
Close()
-
Close()
-
CloseAppDomain(int)
-
CloseAppDomainCallback(TimerThread.Timer, int, object)
-
Compile(Uri, string, byte)
-
Compile(Uri, string, byte)
-
CreateAppDomain()
-
CreateInstance()
-
FindProxyForURL(string, string)
-
FindProxyForURL(string, string)
-
InterruptCallback(TimerThread.Timer, int, object)
-
LastModified()
-
LastModified()
-
OnDomainUnload(object, EventArgs)
-
ScriptBody()
-
ScriptBody()
-
Expand
AutoWebProxyScriptWrapper
-
AutoWebProxyScriptWrapper()
-
AutoWebProxyScriptWrapper()
-
Buffer()
-
Buffer()
-
Close()
-
Close()
-
CloseAppDomain(int)
-
CloseAppDomainCallback(TimerThread.Timer, int, object)
-
Compile(Uri, string, byte)
-
Compile(Uri, string, byte)
-
CreateAppDomain()
-
CreateInstance()
-
FindProxyForURL(string, string)
-
FindProxyForURL(string, string)
-
InterruptCallback(TimerThread.Timer, int, object)
-
LastModified()
-
LastModified()
-
OnDomainUnload(object, EventArgs)
-
ScriptBody()
-
ScriptBody()
-
Expand
AutoWebProxyState
-
Expand
BaseLoggingObject
-
Expand
BasicClient
-
Expand
Blob
-
Expand
Booleans
-
Expand
BufferChunkBytes
-
Expand
BufferOffsetSize
-
Expand
CallbackClosure
-
Expand
CaseInsensitiveAscii
-
Expand
ChunkParse
-
Expand
CloseExState
-
Expand
CommandStream
-
Expand
Comparer
-
Expand
Connection
-
Expand
ConnectionGroup
-
Expand
ConnectionModes
-
Expand
ConnectionMonitorEntry
-
Expand
ConnectionPool
-
Expand
ConnectionPoolManager
-
Expand
ConnectionReturnResult
-
Expand
ConnectSocketState
-
Expand
ConnectStream
-
Expand
ContextAwareResult
-
Expand
ControlData
-
Expand
ControlDataIPv6
-
Expand
Cookie
-
Expand
CookieCollection
-
Expand
CookieCollectionEnumerator
-
Expand
CookieContainer
-
Expand
CookieException
-
Expand
CookieModule
-
Expand
CookieParser
-
Expand
CookieToken
-
Expand
CookieTokenizer
-
Expand
CookieVariant
-
Expand
CoreResponseData
-
Expand
CredentialCache
-
Expand
CredentialEnumerator
-
Expand
CredentialHostKey
-
Expand
CredentialKey
-
Expand
DataParseStatus
-
Expand
DebugCriticalHandleMinusOneIsInvalid
-
Expand
DebugCriticalHandleZeroOrMinusOneIsInvalid
-
Expand
DebugSafeHandle
-
Expand
DebugSafeHandleMinusOneIsInvalid
-
Expand
DecompressionMethods
-
Expand
DefaultPorts
-
Expand
DeflateWrapperStream
-
Expand
DelayedRegex
-
Expand
DirectProxy
-
Expand
Dns
-
Expand
DnsPermission
-
Expand
DnsPermissionAttribute
-
Expand
DownloadBitsState
-
Expand
DownloadDataCompletedEventArgs
-
Expand
DownloadProgressChangedEventArgs
-
Expand
DownloadStringCompletedEventArgs
-
Expand
EmptyStream
-
Expand
EmptyWebProxy
-
Expand
EndPoint
-
Expand
EndpointPermission
-
Expand
EndPointType
-
Expand
ErrorCodes
-
Expand
ExceptionHelper
-
Expand
File
-
Expand
FileWebRequest
-
Expand
FileWebRequestCreator
-
Expand
FileWebResponse
-
Expand
FileWebStream
-
Expand
Ftp
-
Expand
FtpControlStream
-
Expand
FtpDataStream
-
Expand
FtpLoginState
-
Expand
FtpMethodFlags
-
Expand
FtpMethodInfo
-
Expand
FtpOperation
-
Expand
FtpPrimitive
-
Expand
FtpStatusCode
-
Expand
FtpWebRequest
-
Expand
FtpWebRequestCreator
-
Expand
FtpWebResponse
-
Expand
GetPathOption
-
Expand
GlobalLog
-
Expand
GlobalProxySelection
-
Expand
GZipWrapperStream
-
Expand
HeaderEncoding
-
Expand
HeaderInfo
-
Expand
HeaderInfoTable
-
Expand
HeaderVariantInfo
-
Expand
hostent
-
Expand
Http
-
Expand
HttpBehaviour
-
Expand
HttpDateParse
-
Expand
HttpKnownHeaderNames
-
Expand
HttpProcessingResult
-
Expand
HttpProtocolUtils
-
Expand
HttpRequestCreator
-
Expand
HttpRequestHeader
-
Expand
HttpResponseHeader
-
Expand
HttpStatusCode
-
Expand
HttpVersion
-
Expand
HttpWebRequest
-
Expand
HttpWebRequestComparer
-
Expand
HttpWebResponse
-
Expand
HttpWriteMode
-
Expand
IAuthenticationModule
-
Expand
IAutoWebProxy
-
Expand
ICloseEx
-
Expand
ICredentialPolicy
-
Expand
ICredentials
-
Expand
ICredentialsByHost
-
Expand
InfiniteTimer
-
Expand
InfiniteTimerQueue
-
Expand
InnerSafeCloseSocket
-
Expand
InterlockedGate
-
Expand
InterlockedStack
-
Expand
InternalException
-
Expand
IntPtrHelper
-
Expand
IPAddress
-
Expand
IPEndPoint
-
Expand
IPHostEntry
-
Expand
IPMulticastRequest
-
Expand
IPv6MulticastRequest
-
Expand
IReadChunkBytes
-
Expand
ISessionAuthenticationModule
-
Expand
IWebProxy
-
Expand
IWebProxyScript
-
Expand
IWebRequestCreate
-
Expand
KnownHttpVerb
-
Expand
LazyAsyncResult
-
Expand
Linger
-
Expand
Logging
-
Expand
MemoryChunk
-
Expand
MyMethodInfo
-
Expand
NameInfoFlags
-
Expand
NclConstants
-
Expand
NclTraceSource
-
Expand
NclUtilities
-
Expand
NestedMultipleAsyncResult
-
Expand
NestedSingleAsyncResult
-
Expand
Nesting
-
Expand
NetRes
-
Expand
NetworkAccess
-
Expand
NetworkCredential
-
Expand
OpenReadCompletedEventArgs
-
Expand
OpenWriteCompletedEventArgs
-
Expand
OSSOCK
-
Expand
PathList
-
Expand
PathListComparer
-
Expand
PipelineEntry
-
Expand
PipelineEntryFlags
-
Expand
PipelineInstruction
-
Expand
PooledStream
-
Expand
PrefixLookup
-
Expand
ProgressData
-
Expand
ProtocolViolationException
-
Expand
ProxyChain
-
Expand
ProxyEnumerator
-
Expand
ProxyRegBlob
-
Expand
ProxyScriptChain
-
Expand
Queue
-
Expand
ReadState
-
Expand
ReceiveState
-
Expand
RecognizedAttribute
-
Expand
RequestContext
-
Expand
RequestStage
-
Expand
ResolveAsyncResult
-
Expand
ResponseDescription
-
Expand
RfcChar
-
Expand
SafeCloseHandle
-
Expand
SafeCloseHandle
-
Expand
SafeCloseSocket
-
Expand
SafeCloseSocket
-
Expand
SafeCloseSocketAndEvent
-
Expand
SafeGlobalFree
-
Expand
SafeGlobalFree
-
Expand
SafeLocalFree
-
Expand
SafeLocalFree
-
Expand
SafeNetHandles
-
Expand
SafeNetHandlesSafeOverlappedFree
-
Expand
SafeOverlappedFree
-
Expand
SafeOverlappedFree
-
Expand
ScatterGatherBuffers
-
Expand
ScriptHost
-
Expand
Semaphore
-
Expand
ServicePoint
-
Expand
ServicePointManager
-
Expand
ShellExpression
-
Expand
ShExpTokens
-
Expand
SocketAddress
-
Expand
SocketConstructorFlags
-
Expand
SocketPermission
-
Expand
SocketPermissionAttribute
-
Expand
SplitWritesState
-
Expand
SpnDictionary
-
Expand
Stamp
-
Expand
State
-
Expand
StateFlags
-
Expand
StaticProxy
-
Expand
StatusLineValues
-
Expand
StreamChunkBytes
-
Expand
SyncMemoryStream
-
Expand
SyncStatus
-
Expand
SystemNetworkCredential
-
Expand
ThreadContext
-
Expand
ThreadKindFrame
-
Expand
ThreadKinds
-
Expand
TimeoutValidator
-
Expand
Timer
-
Expand
TimerNode
-
Expand
TimerQueue
-
Expand
TimerState
-
Expand
TimerThread
-
Expand
TimerThreadState
-
Expand
TransmitFileBuffers
-
Expand
TransportType
-
Expand
TriState
-
Expand
TunnelStateObject
-
Expand
UnsafeNclNativeMethods
-
Expand
UploadBitsState
-
Expand
UploadDataCompletedEventArgs
-
Expand
UploadFileCompletedEventArgs
-
Expand
UploadProgressChangedEventArgs
-
Expand
UploadStringCompletedEventArgs
-
Expand
UploadValuesCompletedEventArgs
-
Expand
ValidationHelper
-
Expand
WebClient
-
Expand
WebClientWriteStream
-
Expand
WebException
-
Expand
WebExceptionInternalStatus
-
Expand
WebExceptionMapping
-
Expand
WebExceptionStatus
-
Expand
WebHeaderCollection
-
Expand
WebHeaderCollectionType
-
Expand
WebParseError
-
Expand
WebParseErrorCode
-
Expand
WebParseErrorSection
-
Expand
WebPermission
-
Expand
WebPermissionAttribute
-
Expand
WebProxy
-
Expand
WebProxyData
-
Expand
WebProxyScriptHelper
-
Expand
WebProxyScriptHelper
-
Expand
WebProxyWrapper
-
Expand
WebProxyWrapperOpaque
-
Expand
WebRequest
-
Expand
WebRequestMethods
-
Expand
WebRequestPrefixElement
-
Expand
WebResponse
-
Expand
Win32
-
Expand
WriteBufferState
-
Expand
WriteHeadersCallbackState
-
Expand
WSABuffer
-
Expand
WSAData
-
Expand
WSAMsg
-
Expand
WSAPROTOCOL_INFO
-
Expand
WSAPROTOCOLCHAIN
-
Expand
System.Net.Sockets
-
Expand
System.Net.NetworkInformation
-
Expand
System.Net.ComImports
-
Expand
System.Net.Security
-
Expand
System.Net.Cache
-
Expand
System.Net.Configuration
-
Expand
System.Text.RegularExpressions
-
Expand
System.Tools
-
Expand
System.IO.Compression
-
Expand
System.IO.Ports
-
Expand
System.Security.AccessControl
-
Expand
System.Xml
-
Expand
System.Xml.XPath.DataBinding
-
Expand
System.Xml.Schema
-
Expand
System.Xml.Serialization
-
Expand
System.Xml.Serialization.Advanced
-
Expand
System.Xml.Serialization.Configuration
-
Expand
System.Xml.XPath
-
Expand
System.Xml.Xsl
-
Expand
System.Xml.Xsl.IlGen
-
Expand
System.Xml.Xsl.Qil
-
Expand
System.Xml.Xsl.Runtime
-
Expand
System.Xml.Xsl.XPath
-
Expand
System.Xml.Xsl.Xslt
-
Expand
System.Xml.Xsl.XsltOld
-
Expand
System.Xml.Xsl.XsltOld.Debugger
-
Expand
Microsoft.JScript
-
Expand
Microsoft.Vsa
-
Expand
Microsoft.JScript.Vsa
- #pragma warning disable 618
- #define AUTOPROXY_MANAGED_JSCRIPT
- #if !AUTOPROXY_MANAGED_JSCRIPT
- namespace System.Net
- {
- using System.Net.ComImports;
- using System.Runtime.InteropServices;
- using EXCEPINFO = System.Runtime.InteropServices.ComTypes.EXCEPINFO;
- using System.Threading;
- using System.Reflection;
- using System.Net.Configuration;
- using System.Globalization;
-
- internal class AutoWebProxyScriptWrapper
- {
- const string c_ScriptHelperName = "__AutoWebProxyScriptHelper";
-
- private static TimerThread.Queue s_TimerQueue = TimerThread.CreateQueue(SettingsSectionInternal.Section.ExecutionTimeout);
- private static TimerThread.Callback s_InterruptCallback = new TimerThread.Callback(InterruptCallback);
-
-
-
-
-
-
- static internal AutoWebProxyScriptWrapper CreateInstance()
- {
- return new AutoWebProxyScriptWrapper();
- }
-
- internal void Close()
- {
- if (Interlocked.Increment(ref closed) != 1) {
- return;
- }
-
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::Close() Closing engine.");
-
-
- TimerThread.Timer timer = activeTimer;
- if (timer != null) {
- if (timer.Cancel()) {
- InterruptCallback(timer, 0, this);
- }
- activeTimer = null;
- }
-
- jscript.Close();
- jscriptObject = null;
- jscript = null;
- host = null;
- jscriptParser = null;
- dispatch = null;
- script = null;
- scriptText = null;
- lastModified = DateTime.MinValue;
- }
-
- internal string FindProxyForURL(string url, string host)
- {
- if (url == null || host == null) {
- throw new ArgumentNullException(url == null ? "url" : "host");
- }
- if (closed != 0) {
- throw new ObjectDisposedException(GetType().Name);
- }
-
- EXCEPINFO exceptionInfo = new EXCEPINFO();
- object result = null;
- jscript.GetCurrentScriptThreadID(out interruptThreadId);
- TimerThread.Timer timer = s_TimerQueue.CreateTimer(s_InterruptCallback, this);
- activeTimer = timer;
- try {
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::FindProxyForURL() Calling url:" + url + " host:" + host);
- result = script.FindProxyForURL(url, host);
- }
- catch (Exception exception) {
- if (NclUtilities.IsFatal(exception))
- throw;
- if (exception is TargetInvocationException) {
- exception = exception.InnerException;
- }
- COMException comException = exception as COMException;
- if (comException == null || comException.ErrorCode != (int)HRESULT.SCRIPT_E_REPORTED) {
- throw;
- }
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::FindProxyForURL() Script error:[" + this.host.ExceptionMessage == null ? "" : this.host.ExceptionMessage + "]");
- }
- catch {
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::FindProxyForURL() Script error:[Non-CLS Compliant Exception]");
- throw;
- }
- finally {
- activeTimer = null;
- timer.Cancel();
- }
-
- string proxy = result as string;
- if (proxy != null) {
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::FindProxyForURL() found:" + proxy);
- return proxy;
- }
-
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::FindProxyForURL() Returning null. result:" + ValidationHelper.ToString(exceptionInfo.bstrDescription) + " result:" + ValidationHelper.ToString(result) + " error:" + ValidationHelper.ToString(exceptionInfo.bstrDescription));
- return null;
- }
-
- internal AutoWebProxyState Compile(Uri engineScriptLocation, string scriptBody, byte[] buffer)
- {
- if (closed != 0) {
- throw new ObjectDisposedException(GetType().Name);
- }
-
- if (jscriptObject != null) {
- jscript.Close();
- }
-
- scriptText = null;
- scriptBytes = null;
- jscriptObject = new JScriptEngine();
- jscript = (IActiveScript)jscriptObject;
- host = new ScriptHost();
-
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::Compile() Binding to ScriptHost#" + ValidationHelper.HashString(this));
-
- jscriptParser = new ActiveScriptParseWrapper(jscriptObject);
- jscriptParser.InitNew();
-
- jscript.SetScriptSite(host);
- jscript.SetScriptState(ScriptState.Initialized);
-
-
-
-
-
- IObjectSafety objSafety = jscript as IObjectSafety;
- if (objSafety != null) {
- Guid guid = Guid.Empty;
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::Compile() Setting up IInternetHostSecurityManager");
- objSafety.SetInterfaceSafetyOptions(ref guid, ComConstants.INTERFACE_USES_SECURITY_MANAGER, ComConstants.INTERFACE_USES_SECURITY_MANAGER);
- objSafety = null;
- }
-
- EXCEPINFO exceptionInfo = new EXCEPINFO();
- object result = null;
- try {
- jscriptParser.ParseScriptText(scriptBody, null, null, null, IntPtr.Zero, 0, ScriptText.IsPersistent | ScriptText.IsVisible, out result, out exceptionInfo);
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::Compile() ParseScriptText() success:" + ValidationHelper.ToString(exceptionInfo.bstrDescription) + " result:" + ValidationHelper.ToString(result));
- }
- catch (Exception exception) {
- if (NclUtilities.IsFatal(exception))
- throw;
- if (exception is TargetInvocationException) {
- exception = exception.InnerException;
- }
- COMException comException = exception as COMException;
- if (comException == null || comException.ErrorCode != (int)HRESULT.SCRIPT_E_REPORTED) {
- throw;
- }
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::Compile() Script load error:[" + host.ExceptionMessage == null ? "" : host.ExceptionMessage + "]");
- throw new COMException(SR.GetString(SR.net_jscript_load, host.ExceptionMessage), comException.ErrorCode);
- }
- catch {
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::Compile() Script load error:[Non-CLS Compliant Exception]");
- throw;
- }
-
- jscript.AddNamedItem(c_ScriptHelperName, ScriptItem.GlobalMembers | ScriptItem.IsPersistent | ScriptItem.IsVisible);
-
-
- jscript.GetCurrentScriptThreadID(out interruptThreadId);
- TimerThread.Timer timer = s_TimerQueue.CreateTimer(s_InterruptCallback, this);
- activeTimer = timer;
- try {
- jscript.SetScriptState(ScriptState.Started);
- jscript.SetScriptState(ScriptState.Connected);
- }
- finally {
- activeTimer = null;
- timer.Cancel();
- }
-
- jscript.GetScriptDispatch(null, out script);
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::Compile() Got IDispatch:" + ValidationHelper.ToString(dispatch));
-
- scriptText = scriptBody;
- scriptBytes = buffer;
-
- return AutoWebProxyState.CompilationSuccess;
- }
-
- internal string ScriptBody {
- get { return scriptText; }
- }
-
- internal byte[] Buffer {
- get { return scriptBytes; }
-
- set { scriptBytes = value; }
- }
-
- internal DateTime LastModified {
- get { return lastModified; }
-
- set { lastModified = value; }
- }
-
- private static void InterruptCallback(TimerThread.Timer timer, int timeNoticed, object context)
- {
- AutoWebProxyScriptWrapper pThis = (AutoWebProxyScriptWrapper)context;
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(pThis) + "::InterruptCallback()");
-
- if (!object.ReferenceEquals(timer, pThis.activeTimer)) {
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(pThis) + "::InterruptCallback() Spurious - returning.");
- return;
- }
-
- EXCEPINFO exceptionInfo;
- try {
- pThis.jscript.InterruptScriptThread(pThis.interruptThreadId, out exceptionInfo, 0);
- }
- catch (Exception ex) {
- if (NclUtilities.IsFatal(ex))
- throw;
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(pThis) + "::InterruptCallback() InterruptScriptThread() threw:" + ValidationHelper.ToString(ex));
- }
- catch {
- GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(pThis) + "::InterruptCallback() InterruptScriptThread() threw: Non-CLS Compliant Exception");
- }
- }
-
-
-
-
-
-
- private JScriptEngine jscriptObject;
- private IActiveScript jscript;
- private ActiveScriptParseWrapper jscriptParser;
- private ScriptHost host;
- private object dispatch;
- private IScript script;
- private string scriptText;
- private byte[] scriptBytes;
- private DateTime lastModified;
-
-
- private TimerThread.Timer activeTimer;
- private uint interruptThreadId;
-
- private int closed;
-
-
-
- private class ScriptHost : IActiveScriptSite, IInternetHostSecurityManager, IOleServiceProvider
- {
- private WebProxyScriptHelper helper = new WebProxyScriptHelper();
- private string exceptionMessage;
-
- internal string ExceptionMessage {
- get { return exceptionMessage; }
- }
-
-
-
-
-
- public void GetLCID(out int lcid)
- {
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::GetLCID()");
- lcid = Thread.CurrentThread.CurrentCulture.LCID;
- }
-
- public void GetItemInfo(string name, ScriptInfo returnMask, [Out()]
- [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.IUnknown)]
- object[] item, [Out()]
- [MarshalAs(UnmanagedType.LPArray)]
- IntPtr[] typeInfo)
- {
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::GetItemInfo() name:" + ValidationHelper.ToString(name));
- if (name == null) {
- throw new ArgumentNullException("name");
- }
-
- if (name != c_ScriptHelperName) {
- throw new COMException(null, (int)HRESULT.TYPE_E_ELEMENTNOTFOUND);
- }
-
- if ((returnMask & ScriptInfo.IUnknown) != 0) {
- if (item == null) {
- throw new ArgumentNullException("item");
- }
-
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::GetItemInfo() Setting item.");
- item[0] = helper;
- }
-
- if ((returnMask & ScriptInfo.ITypeInfo) != 0) {
- if (typeInfo == null) {
- throw new ArgumentNullException("typeInfo");
- }
-
- typeInfo[0] = IntPtr.Zero;
- }
-
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::GetItemInfo() Done.");
- }
-
- public void GetDocVersionString(out string version)
- {
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::GetDocVersionString()");
- throw new NotImplementedException();
- }
-
- public void OnScriptTerminate(object result, EXCEPINFO exceptionInfo)
- {
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::OnScriptTerminate() result:" + ValidationHelper.ToString(result) + " error:" + ValidationHelper.ToString(exceptionInfo.bstrDescription));
- }
-
- public void OnStateChange(ScriptState scriptState)
- {
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::OnStateChange() state:" + ValidationHelper.ToString(scriptState));
- if (scriptState == ScriptState.Closed) {
- helper = null;
- }
- }
-
- public void OnScriptError(IActiveScriptError scriptError)
- {
- EXCEPINFO exceptionInfo;
- uint dummy;
- uint line;
- int pos;
- scriptError.GetExceptionInfo(out exceptionInfo);
- scriptError.GetSourcePosition(out dummy, out line, out pos);
- exceptionMessage = exceptionInfo.bstrDescription + " (" + line + "," + pos + ")";
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::OnScriptError() error:" + ValidationHelper.ToString(exceptionInfo.bstrDescription) + " line:" + line + " pos:" + pos);
- }
-
- public void OnEnterScript()
- {
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::OnEnterScript()");
- }
-
- public void OnLeaveScript()
- {
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::OnLeaveScript()");
- }
-
-
-
- public int QueryService(ref Guid guidService, ref Guid riid, out IntPtr ppvObject)
- {
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::QueryService(" + guidService.ToString() + ")");
-
- int hr = (int)HRESULT.E_NOINTERFACE;
- ppvObject = IntPtr.Zero;
-
- if (guidService == typeof(IInternetHostSecurityManager).GUID) {
- IntPtr ppObj = Marshal.GetIUnknownForObject(this);
- try {
- hr = Marshal.QueryInterface(ppObj, ref riid, out ppvObject);
- }
- finally {
- Marshal.Release(ppObj);
- }
- }
-
- return hr;
- }
-
-
-
-
-
- public int GetSecurityId(byte[] pbSecurityId, ref IntPtr pcbSecurityId, IntPtr dwReserved)
- {
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::GetSecurityId()");
- return (int)HRESULT.E_NOTIMPL;
- }
-
- public int ProcessUrlAction(int dwAction, int[] pPolicy, int cbPolicy, byte[] pContext, int cbContext, int dwFlags, int dwReserved)
- {
- GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::ProcessUrlAction()");
- if (pPolicy != null && cbPolicy >= Marshal.SizeOf(typeof(int))) {
- pPolicy[0] = (int)UrlPolicy.DisAllow;
- }
-
- return (int)HRESULT.S_FALSE;
-
- }
-
- public int QueryCustomPolicy(Guid guidKey, out byte[] ppPolicy, out int pcbPolicy, byte[] pContext, int cbContext, int dwReserved)
- &nb