Opened on Mar 4, 2011 at 4:46:27 PM
#1892 closed Bug (Wont Fix)
eventlog
| Reported by: | Owned by: | ||
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.6.1 | Severity: | None |
| Keywords: | eventlog description | Cc: |
Description
Hi, I have a problem with eventlog.au3. when I use _eventlog_read() all components of array are ok except description. Sometimes the description do not show how in event viewer.
image of error
http://img683.imageshack.us/img683/8637/errorob.png
The problem seem caused by _eventlog_read() ->> $aEvent[13]=EventLog_DecodeDesc($tEventLog) ->> Local $aStrings = EventLog_DecodeStrings($tEventLog) ->>
$sDesc = StringReplace($sDesc, "%" & $iI, $aStrings[$iI])
Func EventLog_DecodeStrings($tEventLog)
Local $pEventLog = DllStructGetPtr($tEventLog)
Local $iNumStrs = DllStructGetData($tEventLog, "NumStrings")
Local $iOffset = DllStructGetData($tEventLog, "StringOffset")
; The data offset is used to calculate buffer sizes.
Local $iDataOffset = DllStructGetData($tEventLog, "DataOffset")
Local $tBuffer = DllStructCreate("wchar Text& $iDataOffset - $iOffset &", $pEventLog + $iOffset)
Local $aStrings[$iNumStrs + 1]
$aStrings[0] = $iNumStrs
For $iI = 1 To $iNumStrs
$aStrings[$iI] = DllStructGetData($tBuffer, "Text")
$iOffset += StringLen($aStrings[$iI]) + 1
$tBuffer = DllStructCreate("wchar Text& $iDataOffset - $iOffset &", $pEventLog + $iOffset)
Next
Return $aStrings
EndFunc ;==>EventLog_DecodeStrings
Can you help me?
contact: djmunis@…
best regards
Attachments (1)
Change History (7)
by , on Mar 4, 2011 at 4:48:31 PM
| Attachment: | Notificator Plus v1.0.zip added |
|---|
comment:1 by , on Mar 4, 2011 at 4:53:10 PM
Hi, I have a problem with eventlog.au3
Can you help me?
Nope.
This section is for Bug-reports ... ONLY.
For user problems there is the Forum Section. -> http://www.autoitscript.com/forum
comment:2 by , on Mar 4, 2011 at 6:14:09 PM
How this is a bug of EventLog3.au3 that is part of autoit I thought that its a bug and i had post here.
Sorry,
Now I post on http://www.autoitscript.com/forum/topic/126175-eventlog-description
comment:3 by , on Mar 6, 2011 at 3:14:56 AM
Seems someone forgot to adjust the offset counter to count wchar's instead of single byte chr's.
Func __EventLog_DecodeStrings($tEventLog)
Local $pEventLog = DllStructGetPtr($tEventLog)
Local $iNumStrs = DllStructGetData($tEventLog, "NumStrings")
Local $iOffset = DllStructGetData($tEventLog, "StringOffset")
; The data offset is used to calculate buffer sizes.
Local $iDataOffset = DllStructGetData($tEventLog, "DataOffset")
Local $tBuffer = DllStructCreate("wchar Text[" & $iDataOffset - $iOffset & "]", $pEventLog + $iOffset)
Local $aStrings[$iNumStrs + 1]
$aStrings[0] = $iNumStrs
For $iI = 1 To $iNumStrs
$aStrings[$iI] = DllStructGetData($tBuffer, "Text")
;~ $iOffset += StringLen($aStrings[$iI]) + 1 ;; org code
$iOffset += StringLen($aStrings[$iI])*2 + 2 ;; suggested change.
$tBuffer = DllStructCreate("wchar Text[" & $iDataOffset - $iOffset & "]", $pEventLog + $iOffset)
Next
Return $aStrings
EndFunc ;==>__EventLog_DecodeStrings
follow-up: 5 comment:4 by , on Mar 6, 2011 at 11:34:05 AM
2 other suggestions/fixes ... (only tested on "(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X86 OS:X86)")
Func __EventLog_DecodeUserName($tEventLog) <snip> If IsArray($aAcctInfo) Then ... ;~ Return $aAcctInfo[1] ;; org, contains computer name. need user type Return $aAcctInfo[0] ;; change: user type. <snip>
Func __EventLog_DecodeComputer($tEventLog) <snip> Local $tBuffer ;~ $iOffset += StringLen(__EventLog_DecodeSource($tBuffer)) + 1 ;; org, wrong count, + trigers a dllstruc error. $iOffset += StringLen(__EventLog_DecodeSource($tEventLog))*2 + 2 ;; changed, count + $tBuffer -> $tEventLog <snip>
comment:5 by , on Mar 6, 2011 at 12:22:37 PM
Solved,
"$iOffset += StringLen($aStrings[$iI])*2 + 2" ;; suggested change works fine.
Other suggested changes i did not test.
A lot of thanks
comment:6 by , on May 22, 2011 at 7:46:41 PM
| Resolution: | → Wont Fix |
|---|---|
| Status: | new → closed |

the code of script and image of error