winevt_c 0.7.1 → 0.7.2
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_channel.c +43 -6
- 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: 1069bcfe57cfd91d05fcff1a7314929c01c675d30678b8a624c926eb0a91b09f
|
4
|
+
data.tar.gz: bea008c2cf452539b59a9d22800183797babcbb5158e5f6688dd3fd749dc4e3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81ef978d005e6c87607cc187509f8e5ae52b33b7687100148139b050c09d61cbb813fe1e77f8ccc0a02fa881d6a8066b6f7c959f45be3ff65c79e77b03dbd247
|
7
|
+
data.tar.gz: c27480331ce8d8cfab82cd00ef4bd940e3a4224076db6641e9bb49019a2d88dac2ee73790153a20cf2bbafa1db6844b876f59cb53c249251460b6eb97b895c99
|
data/ext/winevt/winevt_channel.c
CHANGED
@@ -9,7 +9,9 @@
|
|
9
9
|
* require 'winevt'
|
10
10
|
* channels = []
|
11
11
|
* @channel = Winevt::EventLog::Channel.new
|
12
|
-
* # If users want to
|
12
|
+
* # If users want to retrieve all channel names that
|
13
|
+
* # including type of Debug and Analytical,
|
14
|
+
* # it should be set as true.
|
13
15
|
* @channel.force_enumerate = false
|
14
16
|
* @channel.each do |channel|
|
15
17
|
* channels << channel
|
@@ -117,7 +119,7 @@ DWORD is_subscribable_channel_p(EVT_HANDLE hChannel, BOOL force_enumerate)
|
|
117
119
|
DWORD status = ERROR_SUCCESS;
|
118
120
|
|
119
121
|
for (int Id = 0; Id < EvtChannelConfigPropertyIdEND; Id++) {
|
120
|
-
if
|
122
|
+
if (!EvtGetChannelConfigProperty(hChannel, (EVT_CHANNEL_CONFIG_PROPERTY_ID)Id, 0, dwBufferSize, pProperty, &dwBufferUsed)) {
|
121
123
|
status = GetLastError();
|
122
124
|
if (ERROR_INSUFFICIENT_BUFFER == status) {
|
123
125
|
dwBufferSize = dwBufferUsed;
|
@@ -126,18 +128,20 @@ DWORD is_subscribable_channel_p(EVT_HANDLE hChannel, BOOL force_enumerate)
|
|
126
128
|
pProperty = pTemp;
|
127
129
|
pTemp = NULL;
|
128
130
|
EvtGetChannelConfigProperty(hChannel, (EVT_CHANNEL_CONFIG_PROPERTY_ID)Id, 0, dwBufferSize, pProperty, &dwBufferUsed);
|
131
|
+
status = GetLastError();
|
129
132
|
} else {
|
130
133
|
free(pProperty);
|
131
134
|
|
132
135
|
status = ERROR_OUTOFMEMORY;
|
133
|
-
|
136
|
+
|
137
|
+
goto cleanup;
|
134
138
|
}
|
135
139
|
}
|
136
140
|
|
137
|
-
if (ERROR_SUCCESS !=
|
141
|
+
if (ERROR_SUCCESS != status) {
|
138
142
|
free(pProperty);
|
139
143
|
|
140
|
-
|
144
|
+
goto cleanup;
|
141
145
|
}
|
142
146
|
}
|
143
147
|
|
@@ -146,6 +150,8 @@ DWORD is_subscribable_channel_p(EVT_HANDLE hChannel, BOOL force_enumerate)
|
|
146
150
|
break;
|
147
151
|
}
|
148
152
|
|
153
|
+
cleanup:
|
154
|
+
|
149
155
|
free(pProperty);
|
150
156
|
|
151
157
|
return status;
|
@@ -246,6 +252,10 @@ rb_winevt_channel_each(VALUE self)
|
|
246
252
|
_TRUNCATE,
|
247
253
|
"EvtOpenChannelConfig failed with %lu.\n",
|
248
254
|
GetLastError());
|
255
|
+
|
256
|
+
EvtClose(winevtChannel->channels);
|
257
|
+
winevtChannel->channels = NULL;
|
258
|
+
|
249
259
|
free(buffer);
|
250
260
|
buffer = NULL;
|
251
261
|
bufferSize = 0;
|
@@ -254,8 +264,35 @@ rb_winevt_channel_each(VALUE self)
|
|
254
264
|
}
|
255
265
|
|
256
266
|
status = is_subscribable_channel_p(hChannelConfig, winevtChannel->force_enumerate);
|
257
|
-
|
267
|
+
EvtClose(hChannelConfig);
|
268
|
+
|
269
|
+
if (status == ERROR_INVALID_DATA) {
|
270
|
+
free(buffer);
|
271
|
+
buffer = NULL;
|
272
|
+
bufferSize = 0;
|
273
|
+
|
258
274
|
continue;
|
275
|
+
}
|
276
|
+
|
277
|
+
if (status == ERROR_OUTOFMEMORY) {
|
278
|
+
EvtClose(winevtChannel->channels);
|
279
|
+
winevtChannel->channels = NULL;
|
280
|
+
|
281
|
+
free(buffer);
|
282
|
+
buffer = NULL;
|
283
|
+
bufferSize = 0;
|
284
|
+
|
285
|
+
rb_raise(rb_eRuntimeError, "realloc failed\n");
|
286
|
+
} else if (status != ERROR_SUCCESS) {
|
287
|
+
EvtClose(winevtChannel->channels);
|
288
|
+
winevtChannel->channels = NULL;
|
289
|
+
|
290
|
+
free(buffer);
|
291
|
+
buffer = NULL;
|
292
|
+
bufferSize = 0;
|
293
|
+
|
294
|
+
rb_raise(rb_eRuntimeError, "is_subscribe_channel_p is failed with %ld\n", status);
|
295
|
+
}
|
259
296
|
|
260
297
|
utf8str = wstr_to_rb_str(CP_UTF8, buffer, -1);
|
261
298
|
|
data/lib/winevt/version.rb
CHANGED