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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: daebe6fe343ceb5ee6a226edd4528a9aa2540c9adbb502738a483d8d30f18302
4
- data.tar.gz: cf3a4619ee6294496ebb4690afcc82f64c4adccab8633c47035757789c67df52
3
+ metadata.gz: 549d42791fee93a96721851c2d4311affcac0518c27b3f813232909c2f714ef3
4
+ data.tar.gz: 15ef2c5d0abf1edcd6b87affc2c8660787d6fe67c4289cf76e8743bb3f13688e
5
5
  SHA512:
6
- metadata.gz: e0e0154f80009838480068032ddc7e30a0e1d734fa5d0d322829c039048c0ba1f12f6ba2fce0002029db3b6dad510d6ea6e226ff6e090ba8b222c6413e2e0ef3
7
- data.tar.gz: 606760e22e450fe632053055278a755af7438b72772dba82c270b16bd8d2ca60eb2c480f4bf81ab44a8b904625f3056717970de7fe067e765b60717aabfa3198
6
+ metadata.gz: 89ff8942faaf4463d92319ff68215042b5582ec3fca8488f1fbc995f7a8be91270c801cf7ddd7b02cf3bcb3b2e1f02300af26ccfadbe5c2476ca104f4f28e8f5
7
+ data.tar.gz: 8b6f7abca4e7d1f80e82a86133e38bcbf967e53dd14f06ee02966b8d612e6eab35e4adab06ccb0e925e0512254b8211c761a67ddd0d30a5f39aa6ed539339e24
@@ -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")
@@ -42,7 +42,7 @@ rb_winevt_channel_each(VALUE self)
42
42
  {
43
43
  EVT_HANDLE hChannels;
44
44
  struct WinevtChannel *winevtChannel;
45
- char *errBuf = NULL;
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
- sprintf(errBuf, "Failed to enumerate channels with %s\n", GetLastError());
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
- sprintf(errBuf, "EvtNextChannelPath failed with %lu.\n", status);
84
+ _snprintf_s(errBuf, 256, _TRUNCATE, "EvtNextChannelPath failed with %lu.\n", status);
85
85
  rb_raise(rb_eRuntimeError, errBuf);
86
86
  }
87
87
  }
@@ -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::string sResult;
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
- sprintf(&sResult[0], "%f", pRenderedValues[i].SingleVal);
220
- rb_ary_push(userValues, rb_utf8_str_new_cstr(sResult.c_str()));
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
- sprintf(&sResult[0], "%lf", pRenderedValues[i].DoubleVal);
224
- rb_ary_push(userValues, rb_utf8_str_new_cstr(sResult.c_str()));
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
- sprintf(strTime, "%04d-%02d-%02d %02d:%02d:%02d.%dZ",
250
- st.wYear , st.wMonth , st.wDay ,
251
- st.wHour , st.wMinute , st.wSecond,
252
- st.wMilliseconds);
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
- sprintf(strTime, "%04d-%02d-%02d %02d:%02d:%02d.%dZ",
262
- st.wYear , st.wMonth , st.wDay ,
263
- st.wHour , st.wMinute , st.wSecond,
264
- st.wMilliseconds);
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("?"));
@@ -1,3 +1,3 @@
1
1
  module Winevt
2
- VERSION = "0.4.7.rc"
2
+ VERSION = "0.4.7.rc2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winevt_c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7.rc
4
+ version: 0.4.7.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Hatake