Data Structures | |
struct | log_event_data |
Structure for log resources. More... | |
Defines | |
#define | MAX_INSERTIONS 32 |
Maximum number of insertion strings. | |
Typedefs | |
typedef log_event_data | log_event_data |
Structure for log resources. | |
Functions | |
HANDLE | SetEventSource (LPTSTR pszSrcName, LPTSTR pszMsgDLL, DWORD dwNum) |
Register an event source. | |
PSID | GetEventSid (void) |
Obtain a SID for logging. | |
void | ClearEventSid (PSID) |
Deallocate the SID that was created by GetEventSid(). | |
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. | |
void | log_event (log_event_data const *log, DWORD msg,...) |
Log an event. | |
void | log_event_blob (log_event_data const *log, DWORD msg, DWORD blob_length, void *blob,...) |
Log an event and save additional binary data. | |
void | v_log_event (log_event_data const *log, DWORD msg, DWORD b_len, void *blob, va_list args) |
Log the event using a va_list . |
|
Maximum number of insertion strings.
This is the maximum size of an array of string passed to
|
|
Structure for log resources.
That data has to be allocated by the user before initialization. The members are exposed so that they can be used independently of the functions defined in this module, e.g. to call Note that log_event(), log_event_blob(), and v_log_event() consider this structure as read-only data. Therefore you may safely make a copy of the structure and use that instead of the original.
|
|
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 .
|