In my code, if something terribly goes wrong, I write something in the event log (using the ReportEvent function). For those entries, I get a user-id in the event log entry (5th argument of ReportEvent functions).
For lots of other entries (from other applications or from Windows itself), the user field is shown as "N/A".
The problem is that Windows also adds entries for my application by itself, especially:
- if the application shows a MesssageBox (with MB_TASKMODAL flag). The Event log shows an entry with source "Application Popup".
- if my application is busy and not responding immediately. The Event log shows an entry with source "Application Hang".
Why doesn't Windows show a User Name or User SID in the event log entries? Why is it "N/A" most of the times? Is there any way I can force Windows to use a User Name or SID in the Windows-generated event log entries?