Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeEventLogReadHandle.cs / 1 / SafeEventLogReadHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeEventLogReadHandle ** **Author: David Gutierrez ([....]) ** ** A wrapper for event log handles ** ** Date: July 8, 2002 ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; using System.Runtime.ConstrainedExecution; namespace Microsoft.Win32.SafeHandles { [HostProtectionAttribute(MayLeakOnAbort = true)] [SuppressUnmanagedCodeSecurityAttribute] internal sealed class SafeEventLogReadHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note: OpenEventLog returns 0 on failure. internal SafeEventLogReadHandle () : base(true) { } [DllImport(ExternDll.Advapi32, CharSet=System.Runtime.InteropServices.CharSet.Unicode, SetLastError=true)] internal static extern SafeEventLogReadHandle OpenEventLog(string UNCServerName, string sourceName); [DllImport(ExternDll.Advapi32, SetLastError=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool CloseEventLog(IntPtr hEventLog); override protected bool ReleaseHandle() { return CloseEventLog(handle); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OdbcConnectionString.cs
- DataGridViewControlCollection.cs
- HelpProvider.cs
- HtmlInputFile.cs
- XmlReaderDelegator.cs
- LogicalTreeHelper.cs
- OracleInfoMessageEventArgs.cs
- AsyncSerializedWorker.cs
- dbenumerator.cs
- MenuStrip.cs
- CursorConverter.cs
- ConfigurationSettings.cs
- OdbcException.cs
- EUCJPEncoding.cs
- EncryptedData.cs
- OperandQuery.cs
- LocalizedNameDescriptionPair.cs
- XMLSchema.cs
- TextEndOfSegment.cs
- RemotingServices.cs
- PropertyGroupDescription.cs
- PersonalizationStateInfoCollection.cs
- querybuilder.cs
- IDReferencePropertyAttribute.cs
- ScrollBar.cs
- VectorConverter.cs
- EdgeModeValidation.cs
- PersonalizationProviderCollection.cs
- SqlDataSourceWizardForm.cs
- SerializerProvider.cs
- HandlerFactoryWrapper.cs
- PtsHelper.cs
- EntitySqlQueryState.cs
- MailWebEventProvider.cs
- SamlAuthorizationDecisionClaimResource.cs
- BasicHttpBinding.cs
- WithParamAction.cs
- DataSvcMapFile.cs
- UseLicense.cs
- TreeNodeMouseHoverEvent.cs
- EventItfInfo.cs
- UnsafePeerToPeerMethods.cs
- UxThemeWrapper.cs
- FormViewDesigner.cs
- ObjectParameterCollection.cs
- BindingExpressionUncommonField.cs
- RowToFieldTransformer.cs
- DesignerObject.cs
- DisplayNameAttribute.cs
- RemoteHelper.cs
- elementinformation.cs
- DataServiceKeyAttribute.cs
- SQLSingle.cs
- CharAnimationBase.cs
- SystemNetHelpers.cs
- HiddenFieldPageStatePersister.cs
- PersonalizationProviderCollection.cs
- LinearQuaternionKeyFrame.cs
- IsolatedStorageFileStream.cs
- HttpCookieCollection.cs
- GridView.cs
- MailAddress.cs
- DataControlCommands.cs
- ValueTypeFieldReference.cs
- HtmlCalendarAdapter.cs
- CacheEntry.cs
- CSharpCodeProvider.cs
- ExtentJoinTreeNode.cs
- BufferModesCollection.cs
- ArgumentNullException.cs
- FileUtil.cs
- ValidatedControlConverter.cs
- InputBuffer.cs
- MetadataItemEmitter.cs
- ClientTargetCollection.cs
- CalendarModeChangedEventArgs.cs
- BookmarkScope.cs
- WrapPanel.cs
- QueryExpression.cs
- CodeCommentStatement.cs
- FlagsAttribute.cs
- SQlBooleanStorage.cs
- ToolStripDropDownDesigner.cs
- SelectedCellsChangedEventArgs.cs
- ErrorHandler.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- FormsAuthenticationConfiguration.cs
- BamlRecords.cs
- XmlSchemaSubstitutionGroup.cs
- WorkflowInstanceExtensionCollection.cs
- Viewport3DAutomationPeer.cs
- FunctionDetailsReader.cs
- HostedAspNetEnvironment.cs
- FilterableAttribute.cs
- ForwardPositionQuery.cs
- Base64Encoder.cs
- Timer.cs
- ObjectDataSourceSelectingEventArgs.cs
- ToolStripItemTextRenderEventArgs.cs
- StrokeSerializer.cs