p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional VB 2005 ISBN: 0-7645-7536-8 (http://p2p.wrox.com/forumdisplay.php?f=227)
-   -   Chapter 13:The test for RegistryPermissions failed (http://p2p.wrox.com/showthread.php?t=66816)

kate2008 March 22nd, 2008 12:51 AM

Chapter 13:The test for RegistryPermissions failed
 
Why the objLog.WriteEntry are always successful???
================================================== ==============
Private Sub btnTestRegistryPermissions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTestRegistryPermissions.Click
        Dim oRp As New RegistryPermission(Security.Permissions.Permission State.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("Exa mple", "System")
                End If
                objLog.Source = "Example"
                objLog.Log = "System"
                objLogEntryType = EventLogEntryType.Information
                objLog.WriteEntry("Error: " & objA.Message, objLogEntryType)
            Catch objB As System.Exception
                MessageBox.Show(objB.Message)
            End Try
        End Try
    End Sub
================================================== ==
Why the objLog.WriteEntry are always successful???



All times are GMT -4. The time now is 05:14 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.