winevt_c 0.4.5 → 0.4.6
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 +3 -0
- data/ext/winevt/winevt_subscribe.c +3 -0
- data/ext/winevt/winevt_utils.cpp +12 -8
- 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: 8e35c2969b85874f8a795430b9ce36b6a8d7e6622ec5d9e3924d65ff3171095d
|
4
|
+
data.tar.gz: 0c7008c5273f506703f3a278c8c1404796a28e9933d29c025b587f2a07d1491a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8e2119e6de7b988a57d9ea04cb18370dbfaac84f1b2fe48b9fa44763bf7e73ed4ad8aa5458e970a21b0f054296a08c6835b118b58d5a4fb0b8c3c8903b237cd
|
7
|
+
data.tar.gz: 3f41be719b834e8aa0b72624f852e334e669974af0151f5ba83562b9bffaa4f997908f50de4b40426ce9298df17374f4ce1c394d858e39796ee6e0137b5e79d7
|
data/ext/winevt/winevt_query.c
CHANGED
data/ext/winevt/winevt_utils.cpp
CHANGED
@@ -23,9 +23,13 @@ void free_allocated_mbstr(const char* str)
|
|
23
23
|
VALUE
|
24
24
|
wstr_to_rb_str(UINT cp, const WCHAR *wstr, int clen)
|
25
25
|
{
|
26
|
+
char *ptr;
|
26
27
|
int len = WideCharToMultiByte(cp, 0, wstr, clen, nullptr, 0, nullptr, nullptr);
|
27
|
-
|
28
|
-
WideCharToMultiByte(cp, 0, wstr, clen,
|
28
|
+
if (!(ptr = static_cast<char *>(xmalloc(len)))) return rb_utf8_str_new_cstr("");
|
29
|
+
WideCharToMultiByte(cp, 0, wstr, clen, ptr, len, nullptr, nullptr);
|
30
|
+
|
31
|
+
VALUE str = rb_utf8_str_new_cstr(ptr);
|
32
|
+
xfree(ptr);
|
29
33
|
|
30
34
|
return str;
|
31
35
|
}
|
@@ -160,7 +164,7 @@ VALUE get_values(EVT_HANDLE handle)
|
|
160
164
|
LARGE_INTEGER timestamp;
|
161
165
|
SYSTEMTIME st;
|
162
166
|
FILETIME ft;
|
163
|
-
|
167
|
+
CHAR strTime[128];
|
164
168
|
std::string sResult;
|
165
169
|
VALUE rbObj;
|
166
170
|
|
@@ -247,11 +251,11 @@ VALUE get_values(EVT_HANDLE handle)
|
|
247
251
|
ft.dwHighDateTime = timestamp.HighPart;
|
248
252
|
ft.dwLowDateTime = timestamp.LowPart;
|
249
253
|
if (FileTimeToSystemTime( &ft, &st )) {
|
250
|
-
sprintf(
|
254
|
+
sprintf(strTime, "%04d-%02d-%02d %02d:%02d:%02d.%dZ",
|
251
255
|
st.wYear , st.wMonth , st.wDay ,
|
252
256
|
st.wHour , st.wMinute , st.wSecond,
|
253
257
|
st.wMilliseconds);
|
254
|
-
rb_ary_push(userValues, rb_utf8_str_new_cstr(strTime
|
258
|
+
rb_ary_push(userValues, rb_utf8_str_new_cstr(strTime));
|
255
259
|
} else {
|
256
260
|
rb_ary_push(userValues, rb_utf8_str_new_cstr("?"));
|
257
261
|
}
|
@@ -259,11 +263,11 @@ VALUE get_values(EVT_HANDLE handle)
|
|
259
263
|
case EvtVarTypeSysTime:
|
260
264
|
if (pRenderedValues[i].SysTimeVal != nullptr) {
|
261
265
|
st = *pRenderedValues[i].SysTimeVal;
|
262
|
-
sprintf(
|
266
|
+
sprintf(strTime, "%04d-%02d-%02d %02d:%02d:%02d.%dZ",
|
263
267
|
st.wYear , st.wMonth , st.wDay ,
|
264
268
|
st.wHour , st.wMinute , st.wSecond,
|
265
269
|
st.wMilliseconds);
|
266
|
-
rb_ary_push(userValues, rb_utf8_str_new_cstr(strTime
|
270
|
+
rb_ary_push(userValues, rb_utf8_str_new_cstr(strTime));
|
267
271
|
} else {
|
268
272
|
rb_ary_push(userValues, rb_utf8_str_new_cstr("?"));
|
269
273
|
}
|
@@ -471,5 +475,5 @@ cleanup:
|
|
471
475
|
if (hMetadata)
|
472
476
|
EvtClose(hMetadata);
|
473
477
|
|
474
|
-
return
|
478
|
+
return _wcsdup(result.c_str());
|
475
479
|
}
|
data/lib/winevt/version.rb
CHANGED