Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / Msmq.cs / 1 / Msmq.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.Channels
{
using System.Threading;
using System.Net.Security;
internal static class Msmq
{
static Version longhornVersion = new Version(4, 0);
static Version version;
static bool activeDirectoryEnabled;
static object xpSendLock = null;
static UriPrefixTable transportManagerTable = new UriPrefixTable();
static object staticLock = new object();
static SafeLibraryHandle errorStrings = null;
static Msmq()
{
MsmqQueue.GetMsmqInformation(ref version, ref activeDirectoryEnabled);
MsmqDiagnostics.MsmqDetected(version);
Version osVersion = System.Environment.OSVersion.Version;
if (osVersion.Major == 5 && osVersion.Minor == 1)
xpSendLock = new object();
}
internal static bool ActiveDirectoryEnabled
{
get { return activeDirectoryEnabled; }
}
internal static Version Version
{
get { return version; }
}
internal static bool IsPerAppDeadLetterQueueSupported
{
get { return Msmq.Version >= longhornVersion; }
}
internal static bool IsAdvancedPoisonHandlingSupported
{
get { return Msmq.Version >= longhornVersion; }
}
internal static bool IsRejectMessageSupported
{
get { return Msmq.Version >= longhornVersion; }
}
internal static UriPrefixTable StaticTransportManagerTable
{
get { return transportManagerTable; }
}
internal static IPoisonHandlingStrategy CreatePoisonHandler(MsmqReceiveHelper receiver)
{
if (receiver.Transactional)
{
if (Msmq.Version < longhornVersion)
{
return new Msmq3PoisonHandler(receiver);
}
else
{
if (receiver.ListenUri.AbsoluteUri.Contains(";"))
return new Msmq4SubqueuePoisonHandler(receiver);
else
return new Msmq4PoisonHandler(receiver);
}
}
else
{
return new MsmqNonTransactedPoisonHandler(receiver);
}
}
internal static SafeLibraryHandle ErrorStrings
{
get
{
if (null == errorStrings)
{
lock (staticLock)
{
if (null == errorStrings)
{
#pragma warning suppress 56523 // Callers (there is only one) handle an invalid handle returned from here.
errorStrings = UnsafeNativeMethods.LoadLibrary("MQUTIL.DLL");
}
}
}
return errorStrings;
}
}
internal static void EnterXPSendLock(out bool lockHeld, ProtectionLevel protectionLevel)
{
lockHeld = false;
if (null != xpSendLock && (ProtectionLevel.None != protectionLevel))
{
try { }
finally
{
Monitor.Enter(xpSendLock);
lockHeld = true;
}
}
}
internal static void LeaveXPSendLock()
{
Monitor.Exit(xpSendLock);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TraceHandlerErrorFormatter.cs
- TextBoxBaseDesigner.cs
- DesignerAttribute.cs
- ServiceAuthorizationManager.cs
- Size3DConverter.cs
- CachedBitmap.cs
- BrowserCapabilitiesFactory35.cs
- ToolStripSeparatorRenderEventArgs.cs
- MediaSystem.cs
- HandleCollector.cs
- ErrorProvider.cs
- CodeObjectCreateExpression.cs
- AssociationProvider.cs
- CalendarDateChangedEventArgs.cs
- DataRelationCollection.cs
- FilePresentation.cs
- HtmlControl.cs
- WebPartDisplayModeCancelEventArgs.cs
- UrlMappingCollection.cs
- HwndAppCommandInputProvider.cs
- AttributedMetaModel.cs
- ResXResourceWriter.cs
- OperatorExpressions.cs
- ReliableRequestSessionChannel.cs
- SynchronizationContextHelper.cs
- TextTreeUndoUnit.cs
- GregorianCalendar.cs
- XsltArgumentList.cs
- DescendentsWalker.cs
- RestHandler.cs
- HtmlTableRowCollection.cs
- Stroke2.cs
- Model3D.cs
- RequestCacheEntry.cs
- RoutedEventConverter.cs
- GroupQuery.cs
- CharKeyFrameCollection.cs
- ErrorHandler.cs
- DataGridViewControlCollection.cs
- ImageSourceConverter.cs
- DesignerAdRotatorAdapter.cs
- AnchoredBlock.cs
- RequestContext.cs
- DataGridRowHeaderAutomationPeer.cs
- pingexception.cs
- XmlChildEnumerator.cs
- SerializationObjectManager.cs
- BaseValidator.cs
- SiteMapDesignerDataSourceView.cs
- HwndSource.cs
- XhtmlBasicLabelAdapter.cs
- XPathNavigatorReader.cs
- ServiceOperationInfoTypeConverter.cs
- ObjectDataSource.cs
- ExceptionUtil.cs
- DispatcherExceptionEventArgs.cs
- GridSplitterAutomationPeer.cs
- TextElementEnumerator.cs
- DetailsViewPageEventArgs.cs
- DbConvert.cs
- DataGridViewButtonColumn.cs
- SqlConnectionManager.cs
- HashMembershipCondition.cs
- CaseCqlBlock.cs
- DocumentXPathNavigator.cs
- SqlParameterCollection.cs
- OleDragDropHandler.cs
- mongolianshape.cs
- EdmScalarPropertyAttribute.cs
- ListControlConvertEventArgs.cs
- PreviewKeyDownEventArgs.cs
- DropShadowBitmapEffect.cs
- WebBrowserEvent.cs
- DataGridViewCellStyleChangedEventArgs.cs
- StringDictionaryEditor.cs
- UpdateProgress.cs
- IListConverters.cs
- XPathExpr.cs
- Walker.cs
- CookieHandler.cs
- RecognitionEventArgs.cs
- sitestring.cs
- MsmqMessageSerializationFormat.cs
- EqualityComparer.cs
- FieldDescriptor.cs
- XmlSchemaAnnotation.cs
- ControlAdapter.cs
- Queue.cs
- ParserExtension.cs
- Point3DAnimationUsingKeyFrames.cs
- HMACSHA384.cs
- EnumerationRangeValidationUtil.cs
- DataGridViewSelectedColumnCollection.cs
- BasicExpandProvider.cs
- LeafCellTreeNode.cs
- _FtpDataStream.cs
- ToolStripDropDownClosingEventArgs.cs
- OleAutBinder.cs
- DataService.cs
- PtsHelper.cs