Skip to content

Commit 84e73c1

Browse files
cosmo0920edsiper
authored andcommitted
in_winevtlog: Process remote handle to retrive metadata if available
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent 1d6d32c commit 84e73c1

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

plugins/in_winevtlog/winevtlog.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct winevtlog_channel *winevtlog_subscribe(const char *channel, struct winevt
8383
return NULL;
8484
}
8585
ch->query = NULL;
86+
ch->remote = NULL;
8687

8788
signal_event = CreateEvent(NULL, TRUE, TRUE, NULL);
8889

@@ -508,7 +509,7 @@ PWSTR get_message(EVT_HANDLE metadata, EVT_HANDLE handle, unsigned int *message_
508509
return message;
509510
}
510511

511-
PWSTR get_description(EVT_HANDLE handle, LANGID langID, unsigned int *message_size)
512+
PWSTR get_description(EVT_HANDLE handle, LANGID langID, unsigned int *message_size, HANDLE remote)
512513
{
513514
PEVT_VARIANT values = NULL;
514515
DWORD buffer_size = 0;
@@ -555,7 +556,7 @@ PWSTR get_description(EVT_HANDLE handle, LANGID langID, unsigned int *message_si
555556
/* Metadata can be NULL because some of the events do not have an
556557
* associated publisher metadata. */
557558
metadata = EvtOpenPublisherMetadata(
558-
NULL, // TODO: Remote handle
559+
remote,
559560
values[0].StringVal,
560561
NULL,
561562
MAKELCID(langID, SORT_DEFAULT),
@@ -890,7 +891,7 @@ int winevtlog_read(struct winevtlog_channel *ch, struct winevtlog_config *ctx,
890891
for (i = 0; i < ch->count; i++) {
891892
if (ctx->render_event_as_xml) {
892893
system_xml = render_event(ch->events[i], EvtRenderEventXml, &system_size);
893-
message = get_description(ch->events[i], LANG_NEUTRAL, &message_size);
894+
message = get_description(ch->events[i], LANG_NEUTRAL, &message_size, ch->remote);
894895
get_string_inserts(ch->events[i], &string_inserts, &count_inserts, &string_inserts_size);
895896
if (system_xml) {
896897
/* Caluculate total allocated size: system + message + string_inserts */
@@ -906,7 +907,7 @@ int winevtlog_read(struct winevtlog_channel *ch, struct winevtlog_config *ctx,
906907
}
907908
else {
908909
render_system_event(ch->events[i], &rendered_system, &system_size);
909-
message = get_description(ch->events[i], LANG_NEUTRAL, &message_size);
910+
message = get_description(ch->events[i], LANG_NEUTRAL, &message_size, ch->remote);
910911
get_string_inserts(ch->events[i], &string_inserts, &count_inserts, &string_inserts_size);
911912
if (rendered_system) {
912913
/* Caluculate total allocated size: system + message + string_inserts */

0 commit comments

Comments
 (0)