winevt_c 0.4.0-x86-mingw32 → 0.4.1-x86-mingw32
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/2.4/winevt.so +0 -0
- data/lib/winevt/2.5/winevt.so +0 -0
- data/lib/winevt/2.6/winevt.so +0 -0
- 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: 9524469dfab709e5ccab74919030550448efb1565a53a5841cfb76c0d611d9f5
|
4
|
+
data.tar.gz: 5c6ec4637fa2e018f0673518defef25cc9d5a32fac0bfa624c27ed71c624d8b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 189388df964b905a4ea276a5704b7deda991f35b8f4ada4591725ec99a50929545a68e4b69c95210f9ef621ef9bc420397de33ad5e99ccc4ef77becf56c15190
|
7
|
+
data.tar.gz: 567defa57d64a8941312641cae88a8672c1218739aa0b281d971eb694f6fafebba893faac22700f4c87bf34950d5c048527627393fe605ae07915d6168e7e0f4
|
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/2.4/winevt.so
CHANGED
Binary file
|
data/lib/winevt/2.5/winevt.so
CHANGED
Binary file
|
data/lib/winevt/2.6/winevt.so
CHANGED
Binary file
|
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: x86-mingw32
|
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
|