Defines | |
#define | ARG_SEPARATOR "\x08\x01\x04\x02\x03\x07\x05" |
Internal argument separator. | |
Functions | |
HANDLE | SetEventSource (LPTSTR pszSrcName, LPTSTR pszMsgDLL, DWORD dwNum) |
Register an event source. | |
PSID | GetEventSid () |
Obtain a SID for logging. | |
void | ClearEventSid (PSID sid) |
Deallocate the SID that was created by GetEventSid(). | |
void | v_log_event (log_event_data const *log, DWORD id, DWORD b_len, void *blob, va_list args) |
Log the event using a va_list . | |
void | log_event (log_event_data const *log, DWORD id,...) |
Log an event. | |
void | log_event_blob (log_event_data const *log, DWORD id, DWORD blob_length, void *blob,...) |
Log an event and save additional binary data. | |
int | log_init (log_event_data *log, int category, LPTSTR pszSrcName, LPTSTR pszMsgDLL) |
Initialize a log_event_data structure. | |
void | log_clear (log_event_data *log) |
Free resources and zero the memory. |
|
Internal argument separator. This sequence is used internally to separate formats given to fprintf. It should never be part of data. (If that happens, the insertions string will be split (thus becoming two) and the last valid insertion is discarded.) |
|
Deallocate the SID that was created by GetEventSid().
|
|
Obtain a SID for logging. This functions tries to obtain a user SID, an owner SID or the groups logon SID, in that order. If it fails returns NULL. This function is called as part of the initialization, so it should be called only if doing custom initialization.
|
|
Free resources and zero the memory. This function may be needed if you are concerned with handle inheritance or before exiting the program if you use a tool to detect memory leakages.
|
|
Log an event. This is coded as
|
|
Log an event and save additional binary data.
|
|
Initialize a log_event_data structure. After the structure is initialized, it will not be altered until you clear it, so there is no need to protect it from simultaneous acces by different threads. The caller can allocate the structure in static storage or wherever it can be easily accessed. Initialization fails with error 120 if not on WIN32, e.g. on win98. However, if NDEBUG is not defined, event will still be seen on stderr. In that case log_init returns 120. Pass a positive category for logging all messages with it. If the category is 0 or negative, the message facility will be used. Initializing an already initialized structure results in resource leaking.
|
|
Register an event source.
Create or update the key This function is called as part of the initialization, so it should be called only when doing custom initialization.
|
|
Log the event using a
This is the workhorse function. It arranges the parameters for The category is read from log_event_data. If it is less than 1, then the facility number will be used, thus implementing the category == facility schema. If the category is higher than the last_category, then the latter will be used.
It retrieves the formal argument definition and rewrites it so as to exclude spurious characters (typically newlines). It recognizes a sequence
The special sequence
For simple formats, Up to MAX_INSERTIONS parameters are accepted. That way, callers can seamlessly pass any parameter that printf would accept, including 64 bits data. All parameterts are converted to strings according to the format specified in the message file. Note that NT can make a savvy use of temporary files (most probably it will never reach the hard disk) therefore you only pay a negligible performance penality for this. However, under pathological circumstance this can fail:
NDEBUG when compiling this module, after registering the event this function will call FormatMessage to format the message and output it on stdout along with the return code from ReportEvent .
|