VB.Net by API/System.Security.Permissions/RegistryPermission — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 12:50, 26 мая 2010
New RegistryPermission
Imports System.Security.Principal
Imports System.Security.Permissions
Imports System.IO
Imports System.Diagnostics
public class MainClass
Shared Sub Main()
Dim oRp As New RegistryPermission(Security.Permissions.PermissionState.Unrestricted)
oRp.Deny()
Dim objLog As New EventLog
Dim objLogEntryType As EventLogEntryType
Try
Throw (New EntryPointNotFoundException)
Catch objA As System.EntryPointNotFoundException
Try
If Not System.Diagnostics.EventLog.SourceExists("Example") Then
System.Diagnostics.EventLog.CreateEventSource("Example", "System")
End If
objLog.Source = "Example"
objLog.Log = "System"
objLogEntryType = EventLogEntryType.Information
objLog.WriteEntry("Error: " & objA.Message, objLogEntryType)
Catch objB As System.Exception
Console.WriteLine(objB.Message)
End Try
End Try
End Sub
End Class