Jump to content

Eventlog__Read problem in beta


Recommended Posts

Just wanted to put this out there. When using _EventLog__Read from the Eventlog.au3 UDFs with the beta version, the array does not return the description in the 13th array slot as it is supposed to. Instead it returns nothing or multiples of 0s. (I did submit a bug report)

The release version of AutoIt processes it better. I can't guarantee that it's completely correct but at least some of the description comes out.

I'm using release 3.3.0.0 and Beta 3.3.1.1 and I'm on Vista Business.

Just curious if anyone else has seen this issue and/or if anyone knows the fix. (sure, use the release instead of the beta vs)

I used some code from Irongeek to test it.

#include <EventLog.au3>
#include <String.au3>
#include <array.au3>
_Main()

Func _Main()
    Local $hEventLog

    $box=""
    $hEventLog = _EventLog__Open( $box, "System")

    $x=_EventLog__Count ($hEventLog)
    For $i=0 To $x
        $aEvent = _EventLog__Read($hEventLog)
        for $j=0 to 14
            ConsoleWrite($j & ":   " & $aEvent[$j] & @CRLF )
        next
    next
    _EventLog__Close($hEventLog)

EndFunc   ;==>_Main

Func GrabUsername($eventdescription)
    $aArray =_StringBetween($eventdescription,"User Name:", @cr)
    If IsArray($aArray) Then
        return StringStripWS($aArray[0], 1)
    EndIf
EndFunc

I should note that looking closer at the current release 3.3.0.0 the description output is not correct there either. Sometimes it's close, sometimes it's right but there are often times it's completely wrong.

Thanks for any info anyone has.

Adam

Edited by twillster
Link to comment
Share on other sites

Just wanted to put this out there. When using _EventLog__Read from the Eventlog.au3 UDFs with the beta version, the array does not return the description in the 13th array slot as it is supposed to. Instead it returns nothing or multiples of 0s. (I did submit a bug report)

The release version of AutoIt processes it better. I can't guarantee that it's completely correct but at least some of the description comes out.

I'm using release 3.3.0.0 and Beta 3.3.1.1 and I'm on Vista Business.

Just curious if anyone else has seen this issue and/or if anyone knows the fix. (sure, use the release instead of the beta vs)

I used some code from Irongeek to test it.

#include <EventLog.au3>
#include <String.au3>
#include <array.au3>
_Main()

Func _Main()
    Local $hEventLog

    $box=""
    $hEventLog = _EventLog__Open( $box, "System")

    $x=_EventLog__Count ($hEventLog)
    For $i=0 To $x
        $aEvent = _EventLog__Read($hEventLog)
        for $j=0 to 14
            ConsoleWrite($j & ":   " & $aEvent[$j] & @CRLF )
        next
    next
    _EventLog__Close($hEventLog)

EndFunc   ;==>_Main

Func GrabUsername($eventdescription)
    $aArray =_StringBetween($eventdescription,"User Name:", @cr)
    If IsArray($aArray) Then
        return StringStripWS($aArray[0], 1)
    EndIf
EndFunc

I should note that looking closer at the current release 3.3.0.0 the description output is not correct there either. Sometimes it's close, sometimes it's right but there are often times it's completely wrong.

Thanks for any info anyone has.

Adam

Hmm... fails on Beta for me too, but I simplified my script to only read the last 10 records:
#include <EventLog.au3>

Global $box = @ComputerName
Global $hEventLog = _EventLog__Open($box, "System")
Global $iCnt = _EventLog__Count($hEventLog)
Global $iOldest = _EventLog__Oldest($hEventLog)
Global $aEvent

ConsoleWrite(@LF & "; Show newest 10 records" & @LF)
$aEvent = _EventLog__Read($hEventLog, False, True, $iCnt + $iOldest - 11) ; Set pointer to desired record
For $i = $iCnt + $iOldest - 10 To $iCnt + $iOldest - 1
    $aEvent = _EventLog__Read($hEventLog, True)
    For $j = 0 To 14
        ConsoleWrite($i & ": [" & $j & "] = " & $aEvent[$j] & @CRLF)
    Next
Next

_EventLog__Close($hEventLog)

The ones that work in Prod and fail in Beta are [10] Event Source, [11] Computer name, and [13] Description for me.

:)

Edit: Updated Bug Trac #1058 with simplified reproducer.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...