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
- AutomationPropertyInfo.cs
- StringHandle.cs
- EntityClientCacheKey.cs
- ImpersonateTokenRef.cs
- IDispatchConstantAttribute.cs
- GridViewUpdatedEventArgs.cs
- LabelExpression.cs
- ProcessHostConfigUtils.cs
- SQLBinary.cs
- SettingsPropertyCollection.cs
- Metafile.cs
- SimpleHandlerFactory.cs
- CryptoApi.cs
- DataViewSettingCollection.cs
- Tablet.cs
- SQLDecimal.cs
- VarRemapper.cs
- InvalidAsynchronousStateException.cs
- PointConverter.cs
- PopupEventArgs.cs
- ToolBar.cs
- RightsManagementEncryptionTransform.cs
- Directory.cs
- XmlSchemaSet.cs
- WebPartAddingEventArgs.cs
- CultureNotFoundException.cs
- DoubleAnimation.cs
- WindowsStatusBar.cs
- CompoundFileStreamReference.cs
- DependencyPropertyKey.cs
- MsmqInputChannel.cs
- StackSpiller.Generated.cs
- RawStylusInputReport.cs
- Pts.cs
- TemplateBindingExtension.cs
- FileDialog.cs
- TextWriterTraceListener.cs
- SchemaImporter.cs
- XsltLoader.cs
- DynamicFilter.cs
- ContentElement.cs
- Identity.cs
- SafeFindHandle.cs
- Decimal.cs
- GeometryDrawing.cs
- ListViewItem.cs
- SqlDelegatedTransaction.cs
- PermissionSetTriple.cs
- AutoGeneratedField.cs
- X509Utils.cs
- SendKeys.cs
- ItemCollectionEditor.cs
- UrlParameterWriter.cs
- DynamicQueryableWrapper.cs
- TreeViewAutomationPeer.cs
- IndexOutOfRangeException.cs
- TextFormatterContext.cs
- ChangeInterceptorAttribute.cs
- keycontainerpermission.cs
- RsaSecurityKey.cs
- _NegotiateClient.cs
- DataGridViewImageColumn.cs
- TemplateBuilder.cs
- DataGridCellAutomationPeer.cs
- ControlAdapter.cs
- MessageAction.cs
- ACL.cs
- SendMailErrorEventArgs.cs
- WorkflowOperationBehavior.cs
- ClusterSafeNativeMethods.cs
- BaseAsyncResult.cs
- _ProxyChain.cs
- SchemaMerger.cs
- Delegate.cs
- BlurEffect.cs
- UserControl.cs
- CqlWriter.cs
- PerformanceCounter.cs
- FileLevelControlBuilderAttribute.cs
- TemplateControlBuildProvider.cs
- SourceFileBuildProvider.cs
- IPAddress.cs
- InputLanguage.cs
- WindowsAuthenticationModule.cs
- CalendarDayButton.cs
- BitmapEffectrendercontext.cs
- OracleConnectionString.cs
- MethodResolver.cs
- DetailsViewPageEventArgs.cs
- PopOutPanel.cs
- ZipIOLocalFileBlock.cs
- MulticastIPAddressInformationCollection.cs
- GridViewEditEventArgs.cs
- XmlSerializerFactory.cs
- ShaderEffect.cs
- XpsFilter.cs
- ReadOnlyObservableCollection.cs
- PrivacyNoticeElement.cs
- DataBindingExpressionBuilder.cs
- HorizontalAlignConverter.cs