winevt_c 0.3.7-x64-mingw32 → 0.3.8-x64-mingw32

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: 5c7791720b42de0b83936093a72a624d6e2299e9f1f6016f314c0a92a33c16c4
4
- data.tar.gz: 1f03167cb8b8b964390a62fc77ac6f0e154e64c0ffd5d8844e78d6b5212689d6
3
+ metadata.gz: b27f73e02d0f7008b45a13f4c387b7c56bd35e2a09ce651567ff207f9ebfc20f
4
+ data.tar.gz: 603032df87a9905a851b762c17a71b41d11d63ea5fbf81d2771c29cb4677c6dc
5
5
  SHA512:
6
- metadata.gz: 0173d0f95fe50b624d2e19c31c61e716e19335167e98a014948fc3b88598a4518242371f6654fbc5556de12777b6652f9f83f89b76b42eb734f811c81b860840
7
- data.tar.gz: ded694ff608926eb2637eb8725075553ed3470c054ac1ad58cef7bdfc9525646ce9858461c12ae0da98bfebd2952d85c95821ad7f9024e793bbfd0e6bf6dc8b5
6
+ metadata.gz: 15916af51fe7d755b9faffcddb800b79b731af1ab6d4ab2d4163e9f6174fb70124f17d4fa51d0ce6365d639d24964a6e88237f7e70efbdd949a05d0943aff7c3
7
+ data.tar.gz: 1e061b1a1cd8a52978ae75ad928646fc833257c45fa0a95af29183b5ccddd98c02f6c097c91a7ba4ac5eb52360a0f561b42d735c9691705617e6d14dd20df4c0
@@ -18,9 +18,7 @@ char* render_event(EVT_HANDLE handle, DWORD flags)
18
18
  PWSTR buffer = NULL;
19
19
  ULONG bufferSize = 0;
20
20
  ULONG bufferSizeNeeded = 0;
21
- EVT_HANDLE event;
22
21
  ULONG status, count;
23
- char* errBuf;
24
22
  char* result;
25
23
  LPTSTR msgBuf;
26
24
 
@@ -286,13 +284,12 @@ char* get_description(EVT_HANDLE handle)
286
284
  WCHAR descriptionBuffer[MAX_BUFFER];
287
285
  ULONG bufferSize = 0;
288
286
  ULONG bufferSizeNeeded = 0;
289
- EVT_HANDLE event;
290
287
  ULONG status, count;
291
288
  char* result = "";
292
289
  LPTSTR msgBuf = "";
293
290
  EVT_HANDLE hMetadata = NULL;
294
291
  PEVT_VARIANT values = NULL;
295
- PWSTR pwBuffer = NULL;
292
+ LPVOID lpMsgBuf;
296
293
 
297
294
  static PCWSTR eventProperties[] = {L"Event/System/Provider/@Name"};
298
295
  EVT_HANDLE renderContext = EvtCreateRenderContext(1, eventProperties, EvtRenderContextValues);
@@ -348,8 +345,27 @@ char* get_description(EVT_HANDLE handle)
348
345
  case ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND:
349
346
  case ERROR_RESOURCE_LANG_NOT_FOUND:
350
347
  case ERROR_MUI_FILE_NOT_FOUND:
351
- case ERROR_EVT_UNRESOLVED_PARAMETER_INSERT:
352
- return "";
348
+ case ERROR_EVT_UNRESOLVED_PARAMETER_INSERT: {
349
+ if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
350
+ FORMAT_MESSAGE_FROM_SYSTEM |
351
+ FORMAT_MESSAGE_IGNORE_INSERTS,
352
+ NULL,
353
+ status,
354
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
355
+ (WCHAR *) &lpMsgBuf, 0, NULL) == 0)
356
+ FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
357
+ FORMAT_MESSAGE_FROM_SYSTEM |
358
+ FORMAT_MESSAGE_IGNORE_INSERTS,
359
+ NULL,
360
+ status,
361
+ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
362
+ (WCHAR *) &lpMsgBuf, 0, NULL);
363
+
364
+ result = wstr_to_mbstr(CP_UTF8, (WCHAR *)lpMsgBuf, -1);
365
+
366
+ goto cleanup;
367
+ }
368
+
353
369
  }
354
370
 
355
371
  if (status != ERROR_INSUFFICIENT_BUFFER)
@@ -370,7 +386,24 @@ char* get_description(EVT_HANDLE handle)
370
386
  case ERROR_RESOURCE_LANG_NOT_FOUND:
371
387
  case ERROR_MUI_FILE_NOT_FOUND:
372
388
  case ERROR_EVT_UNRESOLVED_PARAMETER_INSERT:
373
- return "";
389
+ if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
390
+ FORMAT_MESSAGE_FROM_SYSTEM |
391
+ FORMAT_MESSAGE_IGNORE_INSERTS,
392
+ NULL,
393
+ status,
394
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
395
+ (WCHAR *) &lpMsgBuf, 0, NULL) == 0)
396
+ FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
397
+ FORMAT_MESSAGE_FROM_SYSTEM |
398
+ FORMAT_MESSAGE_IGNORE_INSERTS,
399
+ NULL,
400
+ status,
401
+ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
402
+ (WCHAR *) &lpMsgBuf, 0, NULL);
403
+
404
+ result = wstr_to_mbstr(CP_UTF8, (WCHAR *)lpMsgBuf, -1);
405
+
406
+ goto cleanup;
374
407
  }
375
408
 
376
409
  rb_raise(rb_eWinevtQueryError, "ErrorCode: %d", status);
Binary file
Binary file
Binary file
@@ -1,3 +1,3 @@
1
1
  module Winevt
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winevt_c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Hiroshi Hatake
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2019-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler