How to write Windows Event log records with non-existing source -
somebody gave me testing program write records windows event log (but don't have sources). understand general way of writing , reviewing event log, program behaves special in way can write records, have source not exist. there not registry entry in .../eventlog/application, hence no formatting libs.
if try own code, can write such record windows event viewer tells me "description cannot found" (which correct , understand why happens).
the question now: since foreign test prog can it, must possible somehow - how?
many thx!! :-)
ok, found (also, got sources) - prog creates registry entry (probably happens when calling createeventsource()), not visible until refreshing regedit :-|
and, register formatting lib, cannot rely on: c:\windows\microsoft.net\framework64\v2.0.50727\eventlogmessages.dll
or, can i?
ah, here go explanation: difference between eventlog.writeentry , eventlog.writeevent methods so, cannot, i'm not using .net ... :-|
now, if send event prog (with same, newly created source, foreign prog), see in event viewer normally. means, writeentry() not write different/special type of evt log record containing text directly (contrary standard method of writing msg catalog id + params) rather there must trick in formatting lib make eventviewer apply kind of "default" formatting.
any ideas how accomplish this? except copying eventlogmessages.dll above? :-)
ok, found answer 1 in http://msdn.microsoft.com/en-us/magazine/cc163446.aspx "this file called eventlogmessages.dll, , contains 65,536 event descriptions, each of consists of string "%1", placeholder whatever string want write"
i hoping "messageid=*" seems simple :-|
but maybe else interested in whats happening here ...
Comments
Post a Comment