вторник, августа 14, 2012

The task category text is missing in event viewer in Vista+

I bet you see the text because you can't see your category string for your event that defined inside EXE file. Calm down. I know how to resolve the issue. There are a few steps to go:

1. Run regedit, open your event source at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application\SRC_NAME
2. Right click it and select Permissions.
3. Give READ access to Everyone. This will allow system to determine where the strings are located exactly. Without this action you won't see messages for events if running your program in Vista+
4. Start the Windows Explorer up and locate your EXE
5. Again, right click it, then Properties->Security and allow Everyone to READ the exe. This allows event subsystem to read category definitions to be added into Event Viewer

So, you need only 2 additional permissions to see both message text and task category name for the event:
- READ permission for Event Source in the Registry
- READ permission for your executable containing task category definitions

понедельник, августа 13, 2012

Совместимость поддержана на отлично!

Дано. Windows 7. По всем правилам написанный файл сообщений .mc. Полученные .res-файлы корректно встраиваются в итоговый файл. Источник событий корректно инициализирован в реестре. А вот при попытке вызвать ReportEvent получаем в журнале Windows вот такое:

"the message resource is present but the message is not found in the string/message table"

Почему? Ответ, как оказалось, в Windows 7. Если приложение не запущено от имени администратора и не имеет прав читать реестр, то источник сообщений (пусть он хоть сто раз описан в реестре) будет проигнорирован. Вот так-то.

Настоящие молодцы. Прахрамисты!