winevt_c 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/winevt/winevt_query.c +2 -0
- data/ext/winevt/winevt_subscribe.c +2 -0
- data/ext/winevt/winevt_utils.c +13 -6
- data/lib/winevt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30a062502e07cec9555ad59177552ddfadcd9148a270637921d8e27f6ee5f9e6
|
4
|
+
data.tar.gz: 34aac8326a5a636c8ceee31770d569372d8975710cf46134f51f2848e512515e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bc59bf70f5d06867c686caeae7c4d59135f6bd6e121c19d8b7665a026ce914278768de5b614548f3c86a35e216f8dea72ca0267bfb194a1d17d80759bcad899
|
7
|
+
data.tar.gz: b65a802022726202958c5c009f68fd941e569d60f4b6d9b0e539a7280b42fe3c732927a264e44681a9e5efae20b0bbb2018f26544961c63052e64cd6f86440d5
|
data/ext/winevt/winevt_query.c
CHANGED
data/ext/winevt/winevt_utils.c
CHANGED
@@ -69,7 +69,7 @@ WCHAR* render_event(EVT_HANDLE handle, DWORD flags)
|
|
69
69
|
rb_raise(rb_eWinevtQueryError, "ErrorCode: %d\nError: %s\n", status, RSTRING_PTR(errmsg));
|
70
70
|
}
|
71
71
|
|
72
|
-
result = buffer;
|
72
|
+
result = _wcsdup(buffer);
|
73
73
|
|
74
74
|
if (buffer)
|
75
75
|
xfree(buffer);
|
@@ -214,6 +214,7 @@ VALUE get_values(EVT_HANDLE handle)
|
|
214
214
|
result = wstr_to_mbstr(CP_UTF8, tmpWChar, -1);
|
215
215
|
rb_ary_push(userValues, rb_utf8_str_new_cstr(result));
|
216
216
|
free_allocated_mbstr(result);
|
217
|
+
CoTaskMemFree(tmpWChar);
|
217
218
|
} else {
|
218
219
|
rb_ary_push(userValues, rb_utf8_str_new_cstr("?"));
|
219
220
|
}
|
@@ -253,6 +254,7 @@ VALUE get_values(EVT_HANDLE handle)
|
|
253
254
|
result = wstr_to_mbstr(CP_UTF8, tmpWChar, -1);
|
254
255
|
rb_ary_push(userValues, rb_utf8_str_new_cstr(result));
|
255
256
|
free_allocated_mbstr(result);
|
257
|
+
LocalFree(tmpWChar);
|
256
258
|
} else {
|
257
259
|
rb_ary_push(userValues, rb_utf8_str_new_cstr("?"));
|
258
260
|
}
|
@@ -300,6 +302,7 @@ static WCHAR* get_message(EVT_HANDLE hMetadata, EVT_HANDLE handle)
|
|
300
302
|
LPVOID lpMsgBuf;
|
301
303
|
WCHAR* prevBuffer;
|
302
304
|
WCHAR *message;
|
305
|
+
WCHAR *reallocatedMessage;
|
303
306
|
|
304
307
|
message = (WCHAR *)xmalloc(sizeof(WCHAR) * BUFSIZE);
|
305
308
|
if (!EvtFormatMessage(hMetadata, handle, 0xffffffff, 0, NULL, EvtFormatMessageEvent, BUFSIZE, message, &bufferSizeNeeded)) {
|
@@ -328,7 +331,7 @@ static WCHAR* get_message(EVT_HANDLE hMetadata, EVT_HANDLE handle)
|
|
328
331
|
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
|
329
332
|
(WCHAR *) &lpMsgBuf, 0, NULL);
|
330
333
|
|
331
|
-
result = (WCHAR *)lpMsgBuf;
|
334
|
+
result = _wcsdup((WCHAR *)lpMsgBuf);
|
332
335
|
LocalFree(lpMsgBuf);
|
333
336
|
|
334
337
|
goto cleanup;
|
@@ -342,7 +345,11 @@ static WCHAR* get_message(EVT_HANDLE hMetadata, EVT_HANDLE handle)
|
|
342
345
|
|
343
346
|
if (status == ERROR_INSUFFICIENT_BUFFER) {
|
344
347
|
prevBuffer = message;
|
345
|
-
|
348
|
+
reallocatedMessage = (WCHAR *)realloc(prevBuffer, sizeof(WCHAR) * bufferSizeNeeded);
|
349
|
+
if (reallocatedMessage == NULL) {
|
350
|
+
rb_raise(rb_eWinevtQueryError, "Reallocation failed.");
|
351
|
+
}
|
352
|
+
message = reallocatedMessage;
|
346
353
|
|
347
354
|
if(!EvtFormatMessage(hMetadata, handle, 0xffffffff, 0, NULL, EvtFormatMessageEvent, bufferSizeNeeded, message, &bufferSizeNeeded)) {
|
348
355
|
status = GetLastError();
|
@@ -370,7 +377,7 @@ static WCHAR* get_message(EVT_HANDLE hMetadata, EVT_HANDLE handle)
|
|
370
377
|
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
|
371
378
|
(WCHAR *) &lpMsgBuf, 0, NULL);
|
372
379
|
|
373
|
-
result = (WCHAR *)lpMsgBuf;
|
380
|
+
result = _wcsdup((WCHAR *)lpMsgBuf);
|
374
381
|
LocalFree(lpMsgBuf);
|
375
382
|
|
376
383
|
goto cleanup;
|
@@ -382,7 +389,7 @@ static WCHAR* get_message(EVT_HANDLE hMetadata, EVT_HANDLE handle)
|
|
382
389
|
}
|
383
390
|
}
|
384
391
|
|
385
|
-
result = message;
|
392
|
+
result = _wcsdup(message);
|
386
393
|
|
387
394
|
cleanup:
|
388
395
|
|
@@ -450,7 +457,7 @@ WCHAR* get_description(EVT_HANDLE handle)
|
|
450
457
|
goto cleanup;
|
451
458
|
}
|
452
459
|
|
453
|
-
result = get_message(hMetadata, handle);
|
460
|
+
result = _wcsdup(get_message(hMetadata, handle));
|
454
461
|
|
455
462
|
#undef BUFSIZE
|
456
463
|
|
data/lib/winevt/version.rb
CHANGED
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.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Hatake
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|