winevt_c 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bdf0fc0bcbfe5bb9159a97beeb3d927abc91b7c778d294d3278c5a5070ef653
4
- data.tar.gz: 3c331edbac89075b6f3d19efbc7bd6bf4fe538329f4b5366b0ae653ee673e13f
3
+ metadata.gz: ceb67692c7a6324d2bad7e87b741d74abc6779ab9d3952eca5fe1852feefdfaa
4
+ data.tar.gz: 1c15645f07fbec4a07d3cb3f61eb702a9c7876784d03a56fbe3a0a24720c6067
5
5
  SHA512:
6
- metadata.gz: 5baa4bb0952f3c81ce3eebc2f36fdecb467cc79f980e6b6d77c7542c4a262a2f56ba67d2888923f6a1f52e9e258ed6561b8c0700f39313dd7c0b31f220db6ad1
7
- data.tar.gz: a34ef222a4b7977a3c688288470a3e30df3f9c145b279b85c03c4b911a364b4c9c9aba05820bc1269c862b01c605c7a96ff105125cf9d8eb6164be896b20b4c4
6
+ metadata.gz: 6e903c5dfdefbc8add788b0bc3a5585ddaab32cb3811f4600a9126ec5f7d27977348955302b1e68700030e67af66b3c4d4e670d95ac1da3f11333df350bea23d
7
+ data.tar.gz: a48f284b8b70926a5cba4b92e98e5b172e88b4603701baf081648dfd9e5775fd6c9849cdefebfe92c8dbe46e0a82ced4d51c487827dc8eb70f5673e4a7ccdfc5
@@ -90,8 +90,9 @@ char* get_description(EVT_HANDLE handle)
90
90
  TCHAR paramEXE[MAX_PATH], messageEXE[MAX_PATH];
91
91
  HMODULE hModule = NULL;
92
92
 
93
- static PCWSTR eventProperties[] = {L"Event/System/Provider/@Name", L"Event/System/EventID"};
94
- EVT_HANDLE renderContext = EvtCreateRenderContext(2, eventProperties, EvtRenderContextValues);
93
+ static PCWSTR eventProperties[] = {L"Event/System/Provider/@Name", L"Event/System/EventID",
94
+ L"Event/System/EventID/@Qualifiers"};
95
+ EVT_HANDLE renderContext = EvtCreateRenderContext(3, eventProperties, EvtRenderContextValues);
95
96
  if (renderContext == NULL) {
96
97
  rb_raise(rb_eWinevtQueryError, "Failed to create renderContext");
97
98
  }
@@ -127,11 +128,15 @@ char* get_description(EVT_HANDLE handle)
127
128
  WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR, values[0].StringVal, -1, publisherName, MAX_PATH, NULL, NULL);
128
129
  }
129
130
 
130
- DWORD eventId = 0;
131
+ DWORD eventId = 0, qualifiers = 0;
131
132
  if (values[1].Type == EvtVarTypeUInt16) {
132
133
  eventId = values[1].UInt16Val;
133
134
  }
134
135
 
136
+ if (values[2].Type == EvtVarTypeUInt16) {
137
+ qualifiers = values[2].UInt16Val;
138
+ }
139
+
135
140
  // Open publisher metadata
136
141
  hMetadata = EvtOpenPublisherMetadata(NULL, values[0].StringVal, NULL, MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT), 0);
137
142
  if (hMetadata == NULL) {
@@ -202,21 +207,25 @@ char* get_description(EVT_HANDLE handle)
202
207
  hModule = LoadLibraryEx(messageEXE, NULL,
203
208
  DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
204
209
 
205
- if(FormatMessageW(FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS,
206
- hModule,
207
- eventId,
208
- 0, // Use current code page. Users must specify character encoding in Ruby side.
209
- descriptionBuffer,
210
- MAX_BUFFER,
211
- NULL) == 0){
212
-
213
- FormatMessageW(FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS,
214
- hModule,
215
- 0xB0000000 | eventId,
216
- 0, // Use current code page. Users must specify character encoding in Ruby side.
217
- descriptionBuffer,
218
- MAX_BUFFER,
219
- NULL);
210
+ if(!FormatMessageW(FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS,
211
+ hModule,
212
+ eventId,
213
+ 0, // Use current code page. Users must specify character encoding in Ruby side.
214
+ descriptionBuffer,
215
+ MAX_BUFFER,
216
+ NULL)) {
217
+ if (ERROR_MR_MID_NOT_FOUND == GetLastError()) {
218
+ // clear buffer
219
+ ZeroMemory(descriptionBuffer, sizeof(descriptionBuffer));
220
+ eventId = qualifiers << 16 | eventId;
221
+ FormatMessageW(FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS,
222
+ hModule,
223
+ eventId,
224
+ 0, // Use current code page. Users must specify character encoding in Ruby side.
225
+ descriptionBuffer,
226
+ MAX_BUFFER,
227
+ NULL);
228
+ }
220
229
  }
221
230
  }
222
231
 
@@ -1,3 +1,3 @@
1
1
  module Winevt
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winevt_c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Hatake