Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / BidOverLoads.cs / 1305376 / BidOverLoads.cs
//------------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] //----------------------------------------------------------------------------------- // // Note: Supressions for the FxCop rule CA2129 were added as it is being incorrectly flagged in this case. // SecuritySafeCritical code is allowed to call non-public SecurityCritical code. // using System; using System.Text; using System.Security; using System.Reflection; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.Versioning; internal static partial class EntityBid { private const string dllName = "System.Data.dll, " + AssemblyRef.SystemData; #region PutStr internal static void PutStrChunked(System.String str) { // It sure would be nice if this were something that didn't have to be chunked... if (TraceOn && IsInitialized) { RawPutStrChuncked(str); } } // See note in file header about this suppression. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2129:SecurityTransparentCodeShouldNotReferenceNonpublicSecurityCriticalCode")] [SecuritySafeCritical] private static void RawPutStrChuncked(System.String str) { for (int i = 0; i < str.Length; i += 1000) { NativeMethods.PutStr(modID, UIntPtr.Zero, UIntPtr.Zero, str.Substring(i, Math.Min(str.Length - i, 1000))); } } #endregion #region PlanCompiler internal static bool PlanCompilerOn { get { return IsOn(ApiGroup.PlanCompiler) && (IsInitialized); } } internal static void PlanCompilerPutStr(System.String str) { if (PlanCompilerOn) { RawPutStrChuncked(str); } } // See note in file header about this suppression. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2129:SecurityTransparentCodeShouldNotReferenceNonpublicSecurityCriticalCode")] [SecuritySafeCritical] [EntityBidMethod] internal static void PlanCompilerTrace(string fmtPrintfW, System.Int32 a1, System.Int32 a2) { if (PlanCompilerOn) NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, a1, a2); } #endregion #region ScopeAuto internal struct ScopeAuto : IDisposable { // See note in file header about this suppression. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2129:SecurityTransparentCodeShouldNotReferenceNonpublicSecurityCriticalCode")] [SecuritySafeCritical] [EntityBidMethod] internal ScopeAuto(string fmtPrintfW, System.Int32 arg) { if (EntityBid.ScopeOn && EntityBid.IsInitialized) { NativeMethods.ScopeEnter(modID, UIntPtr.Zero, UIntPtr.Zero, out _hscp, fmtPrintfW, arg); } else { _hscp = EntityBid.NoData; } } // See note in file header about this suppression. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2129:SecurityTransparentCodeShouldNotReferenceNonpublicSecurityCriticalCode")] [SecuritySafeCritical] [EntityBidMethod] internal ScopeAuto(string fmtPrintfW, System.Int32 a1, System.Int32 a2) { if (EntityBid.ScopeOn && EntityBid.IsInitialized) { NativeMethods.ScopeEnter(modID, UIntPtr.Zero, UIntPtr.Zero, out _hscp, fmtPrintfW, a1, a2); } else { _hscp = EntityBid.NoData; } } // See note in file header about this suppression. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2129:SecurityTransparentCodeShouldNotReferenceNonpublicSecurityCriticalCode")] [SecuritySafeCritical] public void Dispose() { if (EntityBid.ScopeOn && EntityBid.IsInitialized && _hscp != EntityBid.NoData) { NativeMethods.ScopeLeave(modID, UIntPtr.Zero, UIntPtr.Zero, ref _hscp); } // NOTE: In contrast with standalone ScopeLeave, // there is no need to assign "EntityBid.NoData" to _hscp. } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")] private IntPtr _hscp; } #endregion #region Trace with 1 parameter // See note in file header about this suppression. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2129:SecurityTransparentCodeShouldNotReferenceNonpublicSecurityCriticalCode")] [SecuritySafeCritical] [EntityBidMethod] internal static void Trace(string fmtPrintfW, System.Int32 a1) { if (EntityBid.TraceOn && EntityBid.IsInitialized) NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, a1); } #endregion #region Trace with 2 parameters // See note in file header about this suppression. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2129:SecurityTransparentCodeShouldNotReferenceNonpublicSecurityCriticalCode")] [SecuritySafeCritical] [EntityBidMethod] internal static void Trace(string fmtPrintfW, System.Int32 a1, System.Int32 a2) { if (EntityBid.TraceOn && EntityBid.IsInitialized) NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, a1, a2); } // See note in file header about this suppression. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2129:SecurityTransparentCodeShouldNotReferenceNonpublicSecurityCriticalCode")] [SecuritySafeCritical] [EntityBidMethod] internal static void Trace(string fmtPrintfW, System.Int32 a1, System.String a2) { if (EntityBid.TraceOn && EntityBid.IsInitialized) NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, a1, a2); } // See note in file header about this suppression. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2129:SecurityTransparentCodeShouldNotReferenceNonpublicSecurityCriticalCode")] [SecuritySafeCritical] [EntityBidMethod] internal static void Trace(string fmtPrintfW, System.String a1, System.String a2) { if (EntityBid.TraceOn && EntityBid.IsInitialized) NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, a1, a2); } #endregion #region Trace with 3 parameters // See note in file header about this suppression. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2129:SecurityTransparentCodeShouldNotReferenceNonpublicSecurityCriticalCode")] [SecuritySafeCritical] [EntityBidMethod] internal static void Trace(string fmtPrintfW, System.Int32 a1, System.Int32 a2, System.Int32 a3) { if (EntityBid.TraceOn && EntityBid.IsInitialized) NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, a1, a2, a3); } #endregion // // Interop calls to pluggable hooks [SuppressUnmanagedCodeSecurity] applied // [SuppressUnmanagedCodeSecurity] private static partial class NativeMethods { #region Trace with 1 parameter [DllImport(dllName, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DllBidTraceCW")] [ResourceExposure(ResourceScope.None)] //The method does not expose any resource extern internal static void Trace(IntPtr hID, UIntPtr src, UIntPtr info, string fmtPrintfW, System.Int32 a1); #endregion #region Trace with 2 parameters [ResourceExposure(ResourceScope.None)] //The method does not expose any resource [DllImport(dllName, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DllBidTraceCW")] extern internal static void Trace(IntPtr hID, UIntPtr src, UIntPtr info, string fmtPrintfW, System.Int32 a1, System.Int64 a2); [ResourceExposure(ResourceScope.None)] //The method does not expose any resource [DllImport(dllName, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DllBidTraceCW")] extern internal static void Trace(IntPtr hID, UIntPtr src, UIntPtr info, string fmtPrintfW, System.Int32 a1, System.String a2); [ResourceExposure(ResourceScope.None)] //The method does not expose any resource [DllImport(dllName, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DllBidTraceCW")] extern internal static void Trace(IntPtr hID, UIntPtr src, UIntPtr info, string fmtPrintfW, System.String a1, System.String a2); #endregion #region Trace with 3 parameters [ResourceExposure(ResourceScope.None)] //The method does not expose any resource [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [DllImport(dllName, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DllBidTraceCW")] extern internal static void Trace(IntPtr hID, UIntPtr src, UIntPtr info, string fmtPrintfW, System.Int32 a1, System.Int32 a2, System.String a3); [ResourceExposure(ResourceScope.None)] //The method does not expose any resource [DllImport(dllName, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DllBidTraceCW")] extern internal static void Trace(IntPtr hID, UIntPtr src, UIntPtr info, string fmtPrintfW, System.Int32 a1, System.Int32 a2, System.Int32 a3); [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [DllImport(dllName, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DllBidTraceCW")] [ResourceExposure(ResourceScope.None)] //The method does not expose any resource extern internal static void Trace(IntPtr hID, UIntPtr src, UIntPtr info, string fmtPrintfW, System.Int32 a1, System.String a2, System.String a3); #endregion #region Trace with 4 parameters [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [DllImport(dllName, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DllBidTraceCW")] [ResourceExposure(ResourceScope.None)] //The method does not expose any resource extern internal static void Trace(IntPtr hID, UIntPtr src, UIntPtr info, string fmtPrintfW, System.Int32 a1, System.Int32 a2, System.Int32 a3, System.Int32 a4); [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [DllImport(dllName, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DllBidTraceCW")] [ResourceExposure(ResourceScope.None)] //The method does not expose any resource extern internal static void Trace(IntPtr hID, UIntPtr src, UIntPtr info, string fmtPrintfW, System.Int32 a1, System.Int32 a2, System.String a3, System.String a4); #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SoapObjectInfo.cs
- AssociationSetMetadata.cs
- base64Transforms.cs
- LoginUtil.cs
- Win32MouseDevice.cs
- PropertyEntry.cs
- HttpWebResponse.cs
- Repeater.cs
- ErrorWrapper.cs
- LinkedResourceCollection.cs
- GroupBoxRenderer.cs
- DispatchChannelSink.cs
- OracleTimeSpan.cs
- TimerEventSubscriptionCollection.cs
- ByeOperationCD1AsyncResult.cs
- RegionInfo.cs
- Image.cs
- RegisteredScript.cs
- SoapAttributeOverrides.cs
- KnownBoxes.cs
- DrawListViewSubItemEventArgs.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- LayoutExceptionEventArgs.cs
- CodeCommentStatementCollection.cs
- dsa.cs
- IntegerValidator.cs
- LoadGrammarCompletedEventArgs.cs
- Mutex.cs
- EditCommandColumn.cs
- ImageUrlEditor.cs
- FrameworkElementFactoryMarkupObject.cs
- PropertyMapper.cs
- PathSegment.cs
- SplitterCancelEvent.cs
- ErrorTableItemStyle.cs
- DefaultAutoFieldGenerator.cs
- ConfigurationStrings.cs
- FilterException.cs
- CompositeActivityMarkupSerializer.cs
- ControlDesignerState.cs
- SystemResourceHost.cs
- ISSmlParser.cs
- GridViewAutomationPeer.cs
- EdmToObjectNamespaceMap.cs
- MaskedTextBoxTextEditorDropDown.cs
- TextUtf8RawTextWriter.cs
- TextRunCache.cs
- GetPageNumberCompletedEventArgs.cs
- Completion.cs
- ByteConverter.cs
- SchemaImporterExtensionElement.cs
- DbConnectionStringBuilder.cs
- ScrollBarAutomationPeer.cs
- ByteKeyFrameCollection.cs
- SiteIdentityPermission.cs
- Roles.cs
- ExceptionUtil.cs
- RuleProcessor.cs
- CompilationLock.cs
- Converter.cs
- DigitShape.cs
- Material.cs
- OutgoingWebRequestContext.cs
- InProcStateClientManager.cs
- SqlConnectionPoolGroupProviderInfo.cs
- CodeExporter.cs
- ListSortDescriptionCollection.cs
- HttpConfigurationSystem.cs
- DataGridViewSelectedCellCollection.cs
- SortDescription.cs
- DataGridCommandEventArgs.cs
- IntranetCredentialPolicy.cs
- DesignSurface.cs
- RequestNavigateEventArgs.cs
- AppSecurityManager.cs
- DataGridViewColumnCollection.cs
- BaseConfigurationRecord.cs
- DesignTimeType.cs
- ADMembershipUser.cs
- assertwrapper.cs
- StylusShape.cs
- Enlistment.cs
- TranslateTransform.cs
- AVElementHelper.cs
- ToolStripItemClickedEventArgs.cs
- UnmanagedHandle.cs
- Invariant.cs
- RadioButtonList.cs
- DefaultAsyncDataDispatcher.cs
- DiscoveryDocumentLinksPattern.cs
- SoapAttributes.cs
- RelatedImageListAttribute.cs
- BuildProviderCollection.cs
- OdbcEnvironmentHandle.cs
- XLinq.cs
- Ticks.cs
- ParseHttpDate.cs
- RijndaelManaged.cs
- HttpPostProtocolImporter.cs
- MergeFilterQuery.cs