Unable to retrieve the complete description string of the event log record
I have an MFC application that reads and displays event log records using the ::ReadEventLog() API. The problem is with reading the "Description" message string of the event log record. The MFC application is unable to read the complete "Description" message string and displays only some part of it. However the Windows System Event Log Viewer reads and displays the compl开发者_如何学Cete "Description" message string correctly.
I have ensured that my MFC application reads the entire "Description" message string by retrieving all the strings as provided by the "NumStrings" and "StringOffset" member variables of the EVENTLOGRECORD structure and merging all of them. Also as mentioned in MSDN my application loads the Source Name specific message library file (whose path is specified in the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application[SourceName]) that further contains additional message string information and merges it with the earlier read strings.
I am still unable to get the entire "Description" message string.
Please provide any help towards resolving the issue.
Regards,
Santosh.
Is this consistent for all description messages in events, or are you only monitoring certain event entries that you have previously created from your own application?
Perhaps there are embedded NUL characters in the description that are causing your MFC code to prematurely terminate the string when it is being displayed, even if the original string was retrieved correctly?
精彩评论