winevt_c 0.4.7.rc → 0.4.7.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/winevt/extconf.rb +2 -1
- data/ext/winevt/winevt_channel.c +3 -3
- data/ext/winevt/winevt_utils.cpp +13 -13
- data/lib/winevt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 549d42791fee93a96721851c2d4311affcac0518c27b3f813232909c2f714ef3
|
4
|
+
data.tar.gz: 15ef2c5d0abf1edcd6b87affc2c8660787d6fe67c4289cf76e8743bb3f13688e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89ff8942faaf4463d92319ff68215042b5582ec3fca8488f1fbc995f7a8be91270c801cf7ddd7b02cf3bcb3b2e1f02300af26ccfadbe5c2476ca104f4f28e8f5
|
7
|
+
data.tar.gz: 8b6f7abca4e7d1f80e82a86133e38bcbf967e53dd14f06ee02966b8d612e6eab35e4adab06ccb0e925e0512254b8211c761a67ddd0d30a5f39aa6ed539339e24
|
data/ext/winevt/extconf.rb
CHANGED
@@ -18,6 +18,7 @@ have_library("ole32")
|
|
18
18
|
$LDFLAGS << " -lwevtapi -ladvapi32 -lole32"
|
19
19
|
$CFLAGS << " -std=c99 -fPIC -fms-extensions "
|
20
20
|
$CXXFLAGS << " -std=c++11 -fPIC -fms-extensions "
|
21
|
-
# $CFLAGS << " -g -O0"
|
21
|
+
# $CFLAGS << " -g -O0 -ggdb"
|
22
|
+
# $CXXFLAGS << " -g -O0 -ggdb"
|
22
23
|
|
23
24
|
create_makefile("winevt/winevt")
|
data/ext/winevt/winevt_channel.c
CHANGED
@@ -42,7 +42,7 @@ rb_winevt_channel_each(VALUE self)
|
|
42
42
|
{
|
43
43
|
EVT_HANDLE hChannels;
|
44
44
|
struct WinevtChannel *winevtChannel;
|
45
|
-
char
|
45
|
+
char errBuf[256];
|
46
46
|
LPWSTR buffer = NULL;
|
47
47
|
LPWSTR temp = NULL;
|
48
48
|
DWORD bufferSize = 0;
|
@@ -59,7 +59,7 @@ rb_winevt_channel_each(VALUE self)
|
|
59
59
|
if (hChannels) {
|
60
60
|
winevtChannel->channels = hChannels;
|
61
61
|
} else {
|
62
|
-
|
62
|
+
_snprintf_s(errBuf, 256, _TRUNCATE, "Failed to enumerate channels with %s\n", GetLastError());
|
63
63
|
rb_raise(rb_eRuntimeError, errBuf);
|
64
64
|
}
|
65
65
|
|
@@ -81,7 +81,7 @@ rb_winevt_channel_each(VALUE self)
|
|
81
81
|
rb_raise(rb_eRuntimeError, "realloc failed");
|
82
82
|
}
|
83
83
|
} else {
|
84
|
-
|
84
|
+
_snprintf_s(errBuf, 256, _TRUNCATE, "EvtNextChannelPath failed with %lu.\n", status);
|
85
85
|
rb_raise(rb_eRuntimeError, errBuf);
|
86
86
|
}
|
87
87
|
}
|
data/ext/winevt/winevt_utils.cpp
CHANGED
@@ -159,7 +159,7 @@ VALUE get_values(EVT_HANDLE handle)
|
|
159
159
|
SYSTEMTIME st;
|
160
160
|
FILETIME ft;
|
161
161
|
CHAR strTime[128];
|
162
|
-
std::
|
162
|
+
std::unique_ptr<CHAR[]> sResult(new CHAR[256]);
|
163
163
|
VALUE rbObj;
|
164
164
|
|
165
165
|
for (int i = 0; i < propCount; i++) {
|
@@ -216,12 +216,12 @@ VALUE get_values(EVT_HANDLE handle)
|
|
216
216
|
rb_ary_push(userValues, rbObj);
|
217
217
|
break;
|
218
218
|
case EvtVarTypeSingle:
|
219
|
-
|
220
|
-
rb_ary_push(userValues, rb_utf8_str_new_cstr(sResult.
|
219
|
+
_snprintf_s(sResult.get(), 256, _TRUNCATE, "%f", pRenderedValues[i].SingleVal);
|
220
|
+
rb_ary_push(userValues, rb_utf8_str_new_cstr(sResult.get()));
|
221
221
|
break;
|
222
222
|
case EvtVarTypeDouble:
|
223
|
-
|
224
|
-
rb_ary_push(userValues, rb_utf8_str_new_cstr(sResult.
|
223
|
+
_snprintf_s(sResult.get(), 256, _TRUNCATE, "%lf", pRenderedValues[i].DoubleVal);
|
224
|
+
rb_ary_push(userValues, rb_utf8_str_new_cstr(sResult.get()));
|
225
225
|
break;
|
226
226
|
case EvtVarTypeBoolean:
|
227
227
|
result = const_cast<char *>(pRenderedValues[i].BooleanVal ? "true" : "false");
|
@@ -246,10 +246,10 @@ VALUE get_values(EVT_HANDLE handle)
|
|
246
246
|
ft.dwHighDateTime = timestamp.HighPart;
|
247
247
|
ft.dwLowDateTime = timestamp.LowPart;
|
248
248
|
if (FileTimeToSystemTime( &ft, &st )) {
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
249
|
+
_snprintf_s(strTime, 128, _TRUNCATE, "%04d-%02d-%02d %02d:%02d:%02d.%dZ",
|
250
|
+
st.wYear , st.wMonth , st.wDay ,
|
251
|
+
st.wHour , st.wMinute , st.wSecond,
|
252
|
+
st.wMilliseconds);
|
253
253
|
rb_ary_push(userValues, rb_utf8_str_new_cstr(strTime));
|
254
254
|
} else {
|
255
255
|
rb_ary_push(userValues, rb_utf8_str_new_cstr("?"));
|
@@ -258,10 +258,10 @@ VALUE get_values(EVT_HANDLE handle)
|
|
258
258
|
case EvtVarTypeSysTime:
|
259
259
|
if (pRenderedValues[i].SysTimeVal != nullptr) {
|
260
260
|
st = *pRenderedValues[i].SysTimeVal;
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
261
|
+
_snprintf_s(strTime, 128, _TRUNCATE, "%04d-%02d-%02d %02d:%02d:%02d.%dZ",
|
262
|
+
st.wYear , st.wMonth , st.wDay ,
|
263
|
+
st.wHour , st.wMinute , st.wSecond,
|
264
|
+
st.wMilliseconds);
|
265
265
|
rb_ary_push(userValues, rb_utf8_str_new_cstr(strTime));
|
266
266
|
} else {
|
267
267
|
rb_ary_push(userValues, rb_utf8_str_new_cstr("?"));
|
data/lib/winevt/version.rb
CHANGED