/src/libevt/libevt/libevt_record.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Record functions |
3 | | * |
4 | | * Copyright (C) 2011-2024, Joachim Metz <joachim.metz@gmail.com> |
5 | | * |
6 | | * Refer to AUTHORS for acknowledgements. |
7 | | * |
8 | | * This program is free software: you can redistribute it and/or modify |
9 | | * it under the terms of the GNU Lesser General Public License as published by |
10 | | * the Free Software Foundation, either version 3 of the License, or |
11 | | * (at your option) any later version. |
12 | | * |
13 | | * This program is distributed in the hope that it will be useful, |
14 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | * GNU General Public License for more details. |
17 | | * |
18 | | * You should have received a copy of the GNU Lesser General Public License |
19 | | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
20 | | */ |
21 | | |
22 | | #include <common.h> |
23 | | #include <memory.h> |
24 | | #include <types.h> |
25 | | |
26 | | #include "libevt_definitions.h" |
27 | | #include "libevt_io_handle.h" |
28 | | #include "libevt_libbfio.h" |
29 | | #include "libevt_libcerror.h" |
30 | | #include "libevt_libcthreads.h" |
31 | | #include "libevt_record.h" |
32 | | #include "libevt_record_values.h" |
33 | | |
34 | | /* Creates record |
35 | | * Make sure the value record is referencing, is set to NULL |
36 | | * Returns 1 if successful or -1 on error |
37 | | */ |
38 | | int libevt_record_initialize( |
39 | | libevt_record_t **record, |
40 | | libevt_io_handle_t *io_handle, |
41 | | libbfio_handle_t *file_io_handle, |
42 | | libevt_record_values_t *record_values, |
43 | | libcerror_error_t **error ) |
44 | 202 | { |
45 | 202 | libevt_internal_record_t *internal_record = NULL; |
46 | 202 | static char *function = "libevt_record_initialize"; |
47 | | |
48 | 202 | if( record == NULL ) |
49 | 0 | { |
50 | 0 | libcerror_error_set( |
51 | 0 | error, |
52 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
53 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
54 | 0 | "%s: invalid record.", |
55 | 0 | function ); |
56 | |
|
57 | 0 | return( -1 ); |
58 | 0 | } |
59 | 202 | if( *record != NULL ) |
60 | 0 | { |
61 | 0 | libcerror_error_set( |
62 | 0 | error, |
63 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
64 | 0 | LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, |
65 | 0 | "%s: invalid record value already set.", |
66 | 0 | function ); |
67 | |
|
68 | 0 | return( -1 ); |
69 | 0 | } |
70 | 202 | if( record_values == NULL ) |
71 | 0 | { |
72 | 0 | libcerror_error_set( |
73 | 0 | error, |
74 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
75 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
76 | 0 | "%s: invalid record values.", |
77 | 0 | function ); |
78 | |
|
79 | 0 | return( -1 ); |
80 | 0 | } |
81 | 202 | internal_record = memory_allocate_structure( |
82 | 202 | libevt_internal_record_t ); |
83 | | |
84 | 202 | if( internal_record == NULL ) |
85 | 0 | { |
86 | 0 | libcerror_error_set( |
87 | 0 | error, |
88 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
89 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
90 | 0 | "%s: unable to create internal record.", |
91 | 0 | function ); |
92 | |
|
93 | 0 | goto on_error; |
94 | 0 | } |
95 | 202 | if( memory_set( |
96 | 202 | internal_record, |
97 | 202 | 0, |
98 | 202 | sizeof( libevt_internal_record_t ) ) == NULL ) |
99 | 0 | { |
100 | 0 | libcerror_error_set( |
101 | 0 | error, |
102 | 0 | LIBCERROR_ERROR_DOMAIN_MEMORY, |
103 | 0 | LIBCERROR_MEMORY_ERROR_SET_FAILED, |
104 | 0 | "%s: unable to clear internal record.", |
105 | 0 | function ); |
106 | |
|
107 | 0 | memory_free( |
108 | 0 | internal_record ); |
109 | |
|
110 | 0 | return( -1 ); |
111 | 0 | } |
112 | 202 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
113 | 202 | if( libcthreads_read_write_lock_initialize( |
114 | 202 | &( internal_record->read_write_lock ), |
115 | 202 | error ) != 1 ) |
116 | 0 | { |
117 | 0 | libcerror_error_set( |
118 | 0 | error, |
119 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
120 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
121 | 0 | "%s: unable to initialize read/write lock.", |
122 | 0 | function ); |
123 | |
|
124 | 0 | goto on_error; |
125 | 0 | } |
126 | 202 | #endif |
127 | 202 | internal_record->file_io_handle = file_io_handle; |
128 | 202 | internal_record->io_handle = io_handle; |
129 | 202 | internal_record->record_values = record_values; |
130 | | |
131 | 202 | *record = (libevt_record_t *) internal_record; |
132 | | |
133 | 202 | return( 1 ); |
134 | | |
135 | 0 | on_error: |
136 | 0 | if( internal_record != NULL ) |
137 | 0 | { |
138 | 0 | memory_free( |
139 | 0 | internal_record ); |
140 | 0 | } |
141 | 0 | return( -1 ); |
142 | 202 | } |
143 | | |
144 | | /* Frees a record |
145 | | * Returns 1 if successful or -1 on error |
146 | | */ |
147 | | int libevt_record_free( |
148 | | libevt_record_t **record, |
149 | | libcerror_error_t **error ) |
150 | 202 | { |
151 | 202 | libevt_internal_record_t *internal_record = NULL; |
152 | 202 | static char *function = "libevt_record_free"; |
153 | 202 | int result = 1; |
154 | | |
155 | 202 | if( record == NULL ) |
156 | 0 | { |
157 | 0 | libcerror_error_set( |
158 | 0 | error, |
159 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
160 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
161 | 0 | "%s: invalid record.", |
162 | 0 | function ); |
163 | |
|
164 | 0 | return( -1 ); |
165 | 0 | } |
166 | 202 | if( *record != NULL ) |
167 | 202 | { |
168 | 202 | internal_record = (libevt_internal_record_t *) *record; |
169 | 202 | *record = NULL; |
170 | | |
171 | 202 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
172 | 202 | if( libcthreads_read_write_lock_free( |
173 | 202 | &( internal_record->read_write_lock ), |
174 | 202 | error ) != 1 ) |
175 | 0 | { |
176 | 0 | libcerror_error_set( |
177 | 0 | error, |
178 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
179 | 0 | LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, |
180 | 0 | "%s: unable to free read/write lock.", |
181 | 0 | function ); |
182 | |
|
183 | 0 | result = -1; |
184 | 0 | } |
185 | 202 | #endif |
186 | | /* The file_io_handle, io_handle and record_values references are freed elsewhere |
187 | | */ |
188 | 202 | memory_free( |
189 | 202 | internal_record ); |
190 | 202 | } |
191 | 202 | return( result ); |
192 | 202 | } |
193 | | |
194 | | /* Retrieves the offset |
195 | | * Returns 1 if successful or -1 on error |
196 | | */ |
197 | | int libevt_record_get_offset( |
198 | | libevt_record_t *record, |
199 | | off64_t *offset, |
200 | | libcerror_error_t **error ) |
201 | 0 | { |
202 | 0 | libevt_internal_record_t *internal_record = NULL; |
203 | 0 | static char *function = "libevt_record_get_offset"; |
204 | 0 | int result = 1; |
205 | |
|
206 | 0 | if( record == NULL ) |
207 | 0 | { |
208 | 0 | libcerror_error_set( |
209 | 0 | error, |
210 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
211 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
212 | 0 | "%s: invalid record.", |
213 | 0 | function ); |
214 | |
|
215 | 0 | return( -1 ); |
216 | 0 | } |
217 | 0 | internal_record = (libevt_internal_record_t *) record; |
218 | |
|
219 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
220 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
221 | 0 | internal_record->read_write_lock, |
222 | 0 | error ) != 1 ) |
223 | 0 | { |
224 | 0 | libcerror_error_set( |
225 | 0 | error, |
226 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
227 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
228 | 0 | "%s: unable to grab read/write lock for reading.", |
229 | 0 | function ); |
230 | |
|
231 | 0 | return( -1 ); |
232 | 0 | } |
233 | 0 | #endif |
234 | 0 | if( libevt_record_values_get_offset( |
235 | 0 | internal_record->record_values, |
236 | 0 | offset, |
237 | 0 | error ) != 1 ) |
238 | 0 | { |
239 | 0 | libcerror_error_set( |
240 | 0 | error, |
241 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
242 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
243 | 0 | "%s: unable to retrieve offset.", |
244 | 0 | function ); |
245 | |
|
246 | 0 | result = -1; |
247 | 0 | } |
248 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
249 | 0 | if( libcthreads_read_write_lock_release_for_read( |
250 | 0 | internal_record->read_write_lock, |
251 | 0 | error ) != 1 ) |
252 | 0 | { |
253 | 0 | libcerror_error_set( |
254 | 0 | error, |
255 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
256 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
257 | 0 | "%s: unable to release read/write lock for reading.", |
258 | 0 | function ); |
259 | |
|
260 | 0 | return( -1 ); |
261 | 0 | } |
262 | 0 | #endif |
263 | 0 | return( result ); |
264 | 0 | } |
265 | | |
266 | | /* Retrieves the identifier (record number) |
267 | | * Returns 1 if successful or -1 on error |
268 | | */ |
269 | | int libevt_record_get_identifier( |
270 | | libevt_record_t *record, |
271 | | uint32_t *identifier, |
272 | | libcerror_error_t **error ) |
273 | 0 | { |
274 | 0 | libevt_internal_record_t *internal_record = NULL; |
275 | 0 | static char *function = "libevt_record_get_identifier"; |
276 | 0 | int result = 1; |
277 | |
|
278 | 0 | if( record == NULL ) |
279 | 0 | { |
280 | 0 | libcerror_error_set( |
281 | 0 | error, |
282 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
283 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
284 | 0 | "%s: invalid record.", |
285 | 0 | function ); |
286 | |
|
287 | 0 | return( -1 ); |
288 | 0 | } |
289 | 0 | internal_record = (libevt_internal_record_t *) record; |
290 | |
|
291 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
292 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
293 | 0 | internal_record->read_write_lock, |
294 | 0 | error ) != 1 ) |
295 | 0 | { |
296 | 0 | libcerror_error_set( |
297 | 0 | error, |
298 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
299 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
300 | 0 | "%s: unable to grab read/write lock for reading.", |
301 | 0 | function ); |
302 | |
|
303 | 0 | return( -1 ); |
304 | 0 | } |
305 | 0 | #endif |
306 | 0 | if( libevt_record_values_get_number( |
307 | 0 | internal_record->record_values, |
308 | 0 | identifier, |
309 | 0 | error ) != 1 ) |
310 | 0 | { |
311 | 0 | libcerror_error_set( |
312 | 0 | error, |
313 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
314 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
315 | 0 | "%s: unable to retrieve number.", |
316 | 0 | function ); |
317 | |
|
318 | 0 | result = -1; |
319 | 0 | } |
320 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
321 | 0 | if( libcthreads_read_write_lock_release_for_read( |
322 | 0 | internal_record->read_write_lock, |
323 | 0 | error ) != 1 ) |
324 | 0 | { |
325 | 0 | libcerror_error_set( |
326 | 0 | error, |
327 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
328 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
329 | 0 | "%s: unable to release read/write lock for reading.", |
330 | 0 | function ); |
331 | |
|
332 | 0 | return( -1 ); |
333 | 0 | } |
334 | 0 | #endif |
335 | 0 | return( result ); |
336 | 0 | } |
337 | | |
338 | | /* Retrieves the creation time |
339 | | * The timestamp is a 32-bit POSIX date and time value |
340 | | * Returns 1 if successful or -1 on error |
341 | | */ |
342 | | int libevt_record_get_creation_time( |
343 | | libevt_record_t *record, |
344 | | uint32_t *posix_time, |
345 | | libcerror_error_t **error ) |
346 | 0 | { |
347 | 0 | libevt_internal_record_t *internal_record = NULL; |
348 | 0 | static char *function = "libevt_record_get_creation_time"; |
349 | 0 | int result = 1; |
350 | |
|
351 | 0 | if( record == NULL ) |
352 | 0 | { |
353 | 0 | libcerror_error_set( |
354 | 0 | error, |
355 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
356 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
357 | 0 | "%s: invalid record.", |
358 | 0 | function ); |
359 | |
|
360 | 0 | return( -1 ); |
361 | 0 | } |
362 | 0 | internal_record = (libevt_internal_record_t *) record; |
363 | |
|
364 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
365 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
366 | 0 | internal_record->read_write_lock, |
367 | 0 | error ) != 1 ) |
368 | 0 | { |
369 | 0 | libcerror_error_set( |
370 | 0 | error, |
371 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
372 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
373 | 0 | "%s: unable to grab read/write lock for reading.", |
374 | 0 | function ); |
375 | |
|
376 | 0 | return( -1 ); |
377 | 0 | } |
378 | 0 | #endif |
379 | 0 | if( libevt_record_values_get_creation_time( |
380 | 0 | internal_record->record_values, |
381 | 0 | posix_time, |
382 | 0 | error ) != 1 ) |
383 | 0 | { |
384 | 0 | libcerror_error_set( |
385 | 0 | error, |
386 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
387 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
388 | 0 | "%s: unable to retrieve creation time from record values.", |
389 | 0 | function ); |
390 | |
|
391 | 0 | result = -1; |
392 | 0 | } |
393 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
394 | 0 | if( libcthreads_read_write_lock_release_for_read( |
395 | 0 | internal_record->read_write_lock, |
396 | 0 | error ) != 1 ) |
397 | 0 | { |
398 | 0 | libcerror_error_set( |
399 | 0 | error, |
400 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
401 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
402 | 0 | "%s: unable to release read/write lock for reading.", |
403 | 0 | function ); |
404 | |
|
405 | 0 | return( -1 ); |
406 | 0 | } |
407 | 0 | #endif |
408 | 0 | return( result ); |
409 | 0 | } |
410 | | |
411 | | /* Retrieves the written time |
412 | | * The timestamp is a 32-bit POSIX date and time value |
413 | | * Returns 1 if successful or -1 on error |
414 | | */ |
415 | | int libevt_record_get_written_time( |
416 | | libevt_record_t *record, |
417 | | uint32_t *posix_time, |
418 | | libcerror_error_t **error ) |
419 | 0 | { |
420 | 0 | libevt_internal_record_t *internal_record = NULL; |
421 | 0 | static char *function = "libevt_record_get_written_time"; |
422 | 0 | int result = 1; |
423 | |
|
424 | 0 | if( record == NULL ) |
425 | 0 | { |
426 | 0 | libcerror_error_set( |
427 | 0 | error, |
428 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
429 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
430 | 0 | "%s: invalid record.", |
431 | 0 | function ); |
432 | |
|
433 | 0 | return( -1 ); |
434 | 0 | } |
435 | 0 | internal_record = (libevt_internal_record_t *) record; |
436 | |
|
437 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
438 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
439 | 0 | internal_record->read_write_lock, |
440 | 0 | error ) != 1 ) |
441 | 0 | { |
442 | 0 | libcerror_error_set( |
443 | 0 | error, |
444 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
445 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
446 | 0 | "%s: unable to grab read/write lock for reading.", |
447 | 0 | function ); |
448 | |
|
449 | 0 | return( -1 ); |
450 | 0 | } |
451 | 0 | #endif |
452 | 0 | if( libevt_record_values_get_written_time( |
453 | 0 | internal_record->record_values, |
454 | 0 | posix_time, |
455 | 0 | error ) != 1 ) |
456 | 0 | { |
457 | 0 | libcerror_error_set( |
458 | 0 | error, |
459 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
460 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
461 | 0 | "%s: unable to retrieve written time from record values.", |
462 | 0 | function ); |
463 | |
|
464 | 0 | result = -1; |
465 | 0 | } |
466 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
467 | 0 | if( libcthreads_read_write_lock_release_for_read( |
468 | 0 | internal_record->read_write_lock, |
469 | 0 | error ) != 1 ) |
470 | 0 | { |
471 | 0 | libcerror_error_set( |
472 | 0 | error, |
473 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
474 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
475 | 0 | "%s: unable to release read/write lock for reading.", |
476 | 0 | function ); |
477 | |
|
478 | 0 | return( -1 ); |
479 | 0 | } |
480 | 0 | #endif |
481 | 0 | return( result ); |
482 | 0 | } |
483 | | |
484 | | /* Retrieves the event identifier |
485 | | * Returns 1 if successful or -1 on error |
486 | | */ |
487 | | int libevt_record_get_event_identifier( |
488 | | libevt_record_t *record, |
489 | | uint32_t *event_identifier, |
490 | | libcerror_error_t **error ) |
491 | 0 | { |
492 | 0 | libevt_internal_record_t *internal_record = NULL; |
493 | 0 | static char *function = "libevt_record_get_event_identifier"; |
494 | 0 | int result = 1; |
495 | |
|
496 | 0 | if( record == NULL ) |
497 | 0 | { |
498 | 0 | libcerror_error_set( |
499 | 0 | error, |
500 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
501 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
502 | 0 | "%s: invalid record.", |
503 | 0 | function ); |
504 | |
|
505 | 0 | return( -1 ); |
506 | 0 | } |
507 | 0 | internal_record = (libevt_internal_record_t *) record; |
508 | |
|
509 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
510 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
511 | 0 | internal_record->read_write_lock, |
512 | 0 | error ) != 1 ) |
513 | 0 | { |
514 | 0 | libcerror_error_set( |
515 | 0 | error, |
516 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
517 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
518 | 0 | "%s: unable to grab read/write lock for reading.", |
519 | 0 | function ); |
520 | |
|
521 | 0 | return( -1 ); |
522 | 0 | } |
523 | 0 | #endif |
524 | 0 | if( libevt_record_values_get_event_identifier( |
525 | 0 | internal_record->record_values, |
526 | 0 | event_identifier, |
527 | 0 | error ) != 1 ) |
528 | 0 | { |
529 | 0 | libcerror_error_set( |
530 | 0 | error, |
531 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
532 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
533 | 0 | "%s: unable to retrieve event identifier.", |
534 | 0 | function ); |
535 | |
|
536 | 0 | result = -1; |
537 | 0 | } |
538 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
539 | 0 | if( libcthreads_read_write_lock_release_for_read( |
540 | 0 | internal_record->read_write_lock, |
541 | 0 | error ) != 1 ) |
542 | 0 | { |
543 | 0 | libcerror_error_set( |
544 | 0 | error, |
545 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
546 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
547 | 0 | "%s: unable to release read/write lock for reading.", |
548 | 0 | function ); |
549 | |
|
550 | 0 | return( -1 ); |
551 | 0 | } |
552 | 0 | #endif |
553 | 0 | return( result ); |
554 | 0 | } |
555 | | |
556 | | /* Retrieves the event type |
557 | | * Returns 1 if successful or -1 on error |
558 | | */ |
559 | | int libevt_record_get_event_type( |
560 | | libevt_record_t *record, |
561 | | uint16_t *event_type, |
562 | | libcerror_error_t **error ) |
563 | 0 | { |
564 | 0 | libevt_internal_record_t *internal_record = NULL; |
565 | 0 | static char *function = "libevt_record_get_event_type"; |
566 | 0 | int result = 1; |
567 | |
|
568 | 0 | if( record == NULL ) |
569 | 0 | { |
570 | 0 | libcerror_error_set( |
571 | 0 | error, |
572 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
573 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
574 | 0 | "%s: invalid record.", |
575 | 0 | function ); |
576 | |
|
577 | 0 | return( -1 ); |
578 | 0 | } |
579 | 0 | internal_record = (libevt_internal_record_t *) record; |
580 | |
|
581 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
582 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
583 | 0 | internal_record->read_write_lock, |
584 | 0 | error ) != 1 ) |
585 | 0 | { |
586 | 0 | libcerror_error_set( |
587 | 0 | error, |
588 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
589 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
590 | 0 | "%s: unable to grab read/write lock for reading.", |
591 | 0 | function ); |
592 | |
|
593 | 0 | return( -1 ); |
594 | 0 | } |
595 | 0 | #endif |
596 | 0 | if( libevt_record_values_get_event_type( |
597 | 0 | internal_record->record_values, |
598 | 0 | event_type, |
599 | 0 | error ) != 1 ) |
600 | 0 | { |
601 | 0 | libcerror_error_set( |
602 | 0 | error, |
603 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
604 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
605 | 0 | "%s: unable to retrieve event type.", |
606 | 0 | function ); |
607 | |
|
608 | 0 | result = -1; |
609 | 0 | } |
610 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
611 | 0 | if( libcthreads_read_write_lock_release_for_read( |
612 | 0 | internal_record->read_write_lock, |
613 | 0 | error ) != 1 ) |
614 | 0 | { |
615 | 0 | libcerror_error_set( |
616 | 0 | error, |
617 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
618 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
619 | 0 | "%s: unable to release read/write lock for reading.", |
620 | 0 | function ); |
621 | |
|
622 | 0 | return( -1 ); |
623 | 0 | } |
624 | 0 | #endif |
625 | 0 | return( result ); |
626 | 0 | } |
627 | | |
628 | | /* Retrieves the event category |
629 | | * Returns 1 if successful or -1 on error |
630 | | */ |
631 | | int libevt_record_get_event_category( |
632 | | libevt_record_t *record, |
633 | | uint16_t *event_category, |
634 | | libcerror_error_t **error ) |
635 | 0 | { |
636 | 0 | libevt_internal_record_t *internal_record = NULL; |
637 | 0 | static char *function = "libevt_record_get_event_category"; |
638 | 0 | int result = 1; |
639 | |
|
640 | 0 | if( record == NULL ) |
641 | 0 | { |
642 | 0 | libcerror_error_set( |
643 | 0 | error, |
644 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
645 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
646 | 0 | "%s: invalid record.", |
647 | 0 | function ); |
648 | |
|
649 | 0 | return( -1 ); |
650 | 0 | } |
651 | 0 | internal_record = (libevt_internal_record_t *) record; |
652 | |
|
653 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
654 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
655 | 0 | internal_record->read_write_lock, |
656 | 0 | error ) != 1 ) |
657 | 0 | { |
658 | 0 | libcerror_error_set( |
659 | 0 | error, |
660 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
661 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
662 | 0 | "%s: unable to grab read/write lock for reading.", |
663 | 0 | function ); |
664 | |
|
665 | 0 | return( -1 ); |
666 | 0 | } |
667 | 0 | #endif |
668 | 0 | if( libevt_record_values_get_event_category( |
669 | 0 | internal_record->record_values, |
670 | 0 | event_category, |
671 | 0 | error ) != 1 ) |
672 | 0 | { |
673 | 0 | libcerror_error_set( |
674 | 0 | error, |
675 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
676 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
677 | 0 | "%s: unable to retrieve event category.", |
678 | 0 | function ); |
679 | |
|
680 | 0 | result = -1; |
681 | 0 | } |
682 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
683 | 0 | if( libcthreads_read_write_lock_release_for_read( |
684 | 0 | internal_record->read_write_lock, |
685 | 0 | error ) != 1 ) |
686 | 0 | { |
687 | 0 | libcerror_error_set( |
688 | 0 | error, |
689 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
690 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
691 | 0 | "%s: unable to release read/write lock for reading.", |
692 | 0 | function ); |
693 | |
|
694 | 0 | return( -1 ); |
695 | 0 | } |
696 | 0 | #endif |
697 | 0 | return( result ); |
698 | 0 | } |
699 | | |
700 | | /* Retrieves the size of the UTF-8 encoded source name |
701 | | * The returned size includes the end of string character |
702 | | * Returns 1 if successful, 0 if not available or -1 on error |
703 | | */ |
704 | | int libevt_record_get_utf8_source_name_size( |
705 | | libevt_record_t *record, |
706 | | size_t *utf8_string_size, |
707 | | libcerror_error_t **error ) |
708 | 0 | { |
709 | 0 | libevt_internal_record_t *internal_record = NULL; |
710 | 0 | static char *function = "libevt_record_get_utf8_source_name_size"; |
711 | 0 | int result = 0; |
712 | |
|
713 | 0 | if( record == NULL ) |
714 | 0 | { |
715 | 0 | libcerror_error_set( |
716 | 0 | error, |
717 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
718 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
719 | 0 | "%s: invalid record.", |
720 | 0 | function ); |
721 | |
|
722 | 0 | return( -1 ); |
723 | 0 | } |
724 | 0 | internal_record = (libevt_internal_record_t *) record; |
725 | |
|
726 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
727 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
728 | 0 | internal_record->read_write_lock, |
729 | 0 | error ) != 1 ) |
730 | 0 | { |
731 | 0 | libcerror_error_set( |
732 | 0 | error, |
733 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
734 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
735 | 0 | "%s: unable to grab read/write lock for reading.", |
736 | 0 | function ); |
737 | |
|
738 | 0 | return( -1 ); |
739 | 0 | } |
740 | 0 | #endif |
741 | 0 | result = libevt_record_values_get_utf8_source_name_size( |
742 | 0 | internal_record->record_values, |
743 | 0 | utf8_string_size, |
744 | 0 | error ); |
745 | |
|
746 | 0 | if( result == -1 ) |
747 | 0 | { |
748 | 0 | libcerror_error_set( |
749 | 0 | error, |
750 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
751 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
752 | 0 | "%s: unable to retrieve UTF-8 source name size.", |
753 | 0 | function ); |
754 | |
|
755 | 0 | result = -1; |
756 | 0 | } |
757 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
758 | 0 | if( libcthreads_read_write_lock_release_for_read( |
759 | 0 | internal_record->read_write_lock, |
760 | 0 | error ) != 1 ) |
761 | 0 | { |
762 | 0 | libcerror_error_set( |
763 | 0 | error, |
764 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
765 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
766 | 0 | "%s: unable to release read/write lock for reading.", |
767 | 0 | function ); |
768 | |
|
769 | 0 | return( -1 ); |
770 | 0 | } |
771 | 0 | #endif |
772 | 0 | return( result ); |
773 | 0 | } |
774 | | |
775 | | /* Retrieves the UTF-8 encoded source name |
776 | | * The size should include the end of string character |
777 | | * Returns 1 if successful, 0 if not available or -1 on error |
778 | | */ |
779 | | int libevt_record_get_utf8_source_name( |
780 | | libevt_record_t *record, |
781 | | uint8_t *utf8_string, |
782 | | size_t utf8_string_size, |
783 | | libcerror_error_t **error ) |
784 | 0 | { |
785 | 0 | libevt_internal_record_t *internal_record = NULL; |
786 | 0 | static char *function = "libevt_record_get_utf8_source_name"; |
787 | 0 | int result = 0; |
788 | |
|
789 | 0 | if( record == NULL ) |
790 | 0 | { |
791 | 0 | libcerror_error_set( |
792 | 0 | error, |
793 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
794 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
795 | 0 | "%s: invalid record.", |
796 | 0 | function ); |
797 | |
|
798 | 0 | return( -1 ); |
799 | 0 | } |
800 | 0 | internal_record = (libevt_internal_record_t *) record; |
801 | |
|
802 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
803 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
804 | 0 | internal_record->read_write_lock, |
805 | 0 | error ) != 1 ) |
806 | 0 | { |
807 | 0 | libcerror_error_set( |
808 | 0 | error, |
809 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
810 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
811 | 0 | "%s: unable to grab read/write lock for reading.", |
812 | 0 | function ); |
813 | |
|
814 | 0 | return( -1 ); |
815 | 0 | } |
816 | 0 | #endif |
817 | 0 | result = libevt_record_values_get_utf8_source_name( |
818 | 0 | internal_record->record_values, |
819 | 0 | utf8_string, |
820 | 0 | utf8_string_size, |
821 | 0 | error ); |
822 | |
|
823 | 0 | if( result == -1 ) |
824 | 0 | { |
825 | 0 | libcerror_error_set( |
826 | 0 | error, |
827 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
828 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
829 | 0 | "%s: unable to retrieve UTF-8 source name.", |
830 | 0 | function ); |
831 | |
|
832 | 0 | result = -1; |
833 | 0 | } |
834 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
835 | 0 | if( libcthreads_read_write_lock_release_for_read( |
836 | 0 | internal_record->read_write_lock, |
837 | 0 | error ) != 1 ) |
838 | 0 | { |
839 | 0 | libcerror_error_set( |
840 | 0 | error, |
841 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
842 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
843 | 0 | "%s: unable to release read/write lock for reading.", |
844 | 0 | function ); |
845 | |
|
846 | 0 | return( -1 ); |
847 | 0 | } |
848 | 0 | #endif |
849 | 0 | return( result ); |
850 | 0 | } |
851 | | |
852 | | /* Retrieves the size of the UTF-16 encoded source name |
853 | | * The returned size includes the end of string character |
854 | | * Returns 1 if successful, 0 if not available or -1 on error |
855 | | */ |
856 | | int libevt_record_get_utf16_source_name_size( |
857 | | libevt_record_t *record, |
858 | | size_t *utf16_string_size, |
859 | | libcerror_error_t **error ) |
860 | 0 | { |
861 | 0 | libevt_internal_record_t *internal_record = NULL; |
862 | 0 | static char *function = "libevt_record_get_utf16_source_name_size"; |
863 | 0 | int result = 0; |
864 | |
|
865 | 0 | if( record == NULL ) |
866 | 0 | { |
867 | 0 | libcerror_error_set( |
868 | 0 | error, |
869 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
870 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
871 | 0 | "%s: invalid record.", |
872 | 0 | function ); |
873 | |
|
874 | 0 | return( -1 ); |
875 | 0 | } |
876 | 0 | internal_record = (libevt_internal_record_t *) record; |
877 | |
|
878 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
879 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
880 | 0 | internal_record->read_write_lock, |
881 | 0 | error ) != 1 ) |
882 | 0 | { |
883 | 0 | libcerror_error_set( |
884 | 0 | error, |
885 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
886 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
887 | 0 | "%s: unable to grab read/write lock for reading.", |
888 | 0 | function ); |
889 | |
|
890 | 0 | return( -1 ); |
891 | 0 | } |
892 | 0 | #endif |
893 | 0 | result = libevt_record_values_get_utf16_source_name_size( |
894 | 0 | internal_record->record_values, |
895 | 0 | utf16_string_size, |
896 | 0 | error ); |
897 | |
|
898 | 0 | if( result == -1 ) |
899 | 0 | { |
900 | 0 | libcerror_error_set( |
901 | 0 | error, |
902 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
903 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
904 | 0 | "%s: unable to retrieve UTF-16 source name.", |
905 | 0 | function ); |
906 | |
|
907 | 0 | result = -1; |
908 | 0 | } |
909 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
910 | 0 | if( libcthreads_read_write_lock_release_for_read( |
911 | 0 | internal_record->read_write_lock, |
912 | 0 | error ) != 1 ) |
913 | 0 | { |
914 | 0 | libcerror_error_set( |
915 | 0 | error, |
916 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
917 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
918 | 0 | "%s: unable to release read/write lock for reading.", |
919 | 0 | function ); |
920 | |
|
921 | 0 | return( -1 ); |
922 | 0 | } |
923 | 0 | #endif |
924 | 0 | return( result ); |
925 | 0 | } |
926 | | |
927 | | /* Retrieves the UTF-16 encoded source name |
928 | | * The size should include the end of string character |
929 | | * Returns 1 if successful, 0 if not available or -1 on error |
930 | | */ |
931 | | int libevt_record_get_utf16_source_name( |
932 | | libevt_record_t *record, |
933 | | uint16_t *utf16_string, |
934 | | size_t utf16_string_size, |
935 | | libcerror_error_t **error ) |
936 | 0 | { |
937 | 0 | libevt_internal_record_t *internal_record = NULL; |
938 | 0 | static char *function = "libevt_record_get_utf16_source_name"; |
939 | 0 | int result = 0; |
940 | |
|
941 | 0 | if( record == NULL ) |
942 | 0 | { |
943 | 0 | libcerror_error_set( |
944 | 0 | error, |
945 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
946 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
947 | 0 | "%s: invalid record.", |
948 | 0 | function ); |
949 | |
|
950 | 0 | return( -1 ); |
951 | 0 | } |
952 | 0 | internal_record = (libevt_internal_record_t *) record; |
953 | |
|
954 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
955 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
956 | 0 | internal_record->read_write_lock, |
957 | 0 | error ) != 1 ) |
958 | 0 | { |
959 | 0 | libcerror_error_set( |
960 | 0 | error, |
961 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
962 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
963 | 0 | "%s: unable to grab read/write lock for reading.", |
964 | 0 | function ); |
965 | |
|
966 | 0 | return( -1 ); |
967 | 0 | } |
968 | 0 | #endif |
969 | 0 | result = libevt_record_values_get_utf16_source_name( |
970 | 0 | internal_record->record_values, |
971 | 0 | utf16_string, |
972 | 0 | utf16_string_size, |
973 | 0 | error ); |
974 | |
|
975 | 0 | if( result == -1 ) |
976 | 0 | { |
977 | 0 | libcerror_error_set( |
978 | 0 | error, |
979 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
980 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
981 | 0 | "%s: unable to retrieve UTF-16 source name.", |
982 | 0 | function ); |
983 | |
|
984 | 0 | result = -1; |
985 | 0 | } |
986 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
987 | 0 | if( libcthreads_read_write_lock_release_for_read( |
988 | 0 | internal_record->read_write_lock, |
989 | 0 | error ) != 1 ) |
990 | 0 | { |
991 | 0 | libcerror_error_set( |
992 | 0 | error, |
993 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
994 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
995 | 0 | "%s: unable to release read/write lock for reading.", |
996 | 0 | function ); |
997 | |
|
998 | 0 | return( -1 ); |
999 | 0 | } |
1000 | 0 | #endif |
1001 | 0 | return( result ); |
1002 | 0 | } |
1003 | | |
1004 | | /* Retrieves the size of the UTF-8 encoded computer name |
1005 | | * The returned size includes the end of string character |
1006 | | * Returns 1 if successful, 0 if not available or -1 on error |
1007 | | */ |
1008 | | int libevt_record_get_utf8_computer_name_size( |
1009 | | libevt_record_t *record, |
1010 | | size_t *utf8_string_size, |
1011 | | libcerror_error_t **error ) |
1012 | 0 | { |
1013 | 0 | libevt_internal_record_t *internal_record = NULL; |
1014 | 0 | static char *function = "libevt_record_get_utf8_computer_name_size"; |
1015 | 0 | int result = 0; |
1016 | |
|
1017 | 0 | if( record == NULL ) |
1018 | 0 | { |
1019 | 0 | libcerror_error_set( |
1020 | 0 | error, |
1021 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1022 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1023 | 0 | "%s: invalid record.", |
1024 | 0 | function ); |
1025 | |
|
1026 | 0 | return( -1 ); |
1027 | 0 | } |
1028 | 0 | internal_record = (libevt_internal_record_t *) record; |
1029 | |
|
1030 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1031 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1032 | 0 | internal_record->read_write_lock, |
1033 | 0 | error ) != 1 ) |
1034 | 0 | { |
1035 | 0 | libcerror_error_set( |
1036 | 0 | error, |
1037 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1038 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1039 | 0 | "%s: unable to grab read/write lock for reading.", |
1040 | 0 | function ); |
1041 | |
|
1042 | 0 | return( -1 ); |
1043 | 0 | } |
1044 | 0 | #endif |
1045 | 0 | result = libevt_record_values_get_utf8_computer_name_size( |
1046 | 0 | internal_record->record_values, |
1047 | 0 | utf8_string_size, |
1048 | 0 | error ); |
1049 | |
|
1050 | 0 | if( result == -1 ) |
1051 | 0 | { |
1052 | 0 | libcerror_error_set( |
1053 | 0 | error, |
1054 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1055 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1056 | 0 | "%s: unable to retrieve UTF-8 computer name size.", |
1057 | 0 | function ); |
1058 | |
|
1059 | 0 | result = -1; |
1060 | 0 | } |
1061 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1062 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1063 | 0 | internal_record->read_write_lock, |
1064 | 0 | error ) != 1 ) |
1065 | 0 | { |
1066 | 0 | libcerror_error_set( |
1067 | 0 | error, |
1068 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1069 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1070 | 0 | "%s: unable to release read/write lock for reading.", |
1071 | 0 | function ); |
1072 | |
|
1073 | 0 | return( -1 ); |
1074 | 0 | } |
1075 | 0 | #endif |
1076 | 0 | return( result ); |
1077 | 0 | } |
1078 | | |
1079 | | /* Retrieves the UTF-8 encoded computer name |
1080 | | * The size should include the end of string character |
1081 | | * Returns 1 if successful, 0 if not available or -1 on error |
1082 | | */ |
1083 | | int libevt_record_get_utf8_computer_name( |
1084 | | libevt_record_t *record, |
1085 | | uint8_t *utf8_string, |
1086 | | size_t utf8_string_size, |
1087 | | libcerror_error_t **error ) |
1088 | 0 | { |
1089 | 0 | libevt_internal_record_t *internal_record = NULL; |
1090 | 0 | static char *function = "libevt_record_get_utf8_computer_name"; |
1091 | 0 | int result = 0; |
1092 | |
|
1093 | 0 | if( record == NULL ) |
1094 | 0 | { |
1095 | 0 | libcerror_error_set( |
1096 | 0 | error, |
1097 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1098 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1099 | 0 | "%s: invalid record.", |
1100 | 0 | function ); |
1101 | |
|
1102 | 0 | return( -1 ); |
1103 | 0 | } |
1104 | 0 | internal_record = (libevt_internal_record_t *) record; |
1105 | |
|
1106 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1107 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1108 | 0 | internal_record->read_write_lock, |
1109 | 0 | error ) != 1 ) |
1110 | 0 | { |
1111 | 0 | libcerror_error_set( |
1112 | 0 | error, |
1113 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1114 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1115 | 0 | "%s: unable to grab read/write lock for reading.", |
1116 | 0 | function ); |
1117 | |
|
1118 | 0 | return( -1 ); |
1119 | 0 | } |
1120 | 0 | #endif |
1121 | 0 | result = libevt_record_values_get_utf8_computer_name( |
1122 | 0 | internal_record->record_values, |
1123 | 0 | utf8_string, |
1124 | 0 | utf8_string_size, |
1125 | 0 | error ); |
1126 | |
|
1127 | 0 | if( result == -1 ) |
1128 | 0 | { |
1129 | 0 | libcerror_error_set( |
1130 | 0 | error, |
1131 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1132 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1133 | 0 | "%s: unable to retrieve UTF-8 computer name.", |
1134 | 0 | function ); |
1135 | |
|
1136 | 0 | result = -1; |
1137 | 0 | } |
1138 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1139 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1140 | 0 | internal_record->read_write_lock, |
1141 | 0 | error ) != 1 ) |
1142 | 0 | { |
1143 | 0 | libcerror_error_set( |
1144 | 0 | error, |
1145 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1146 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1147 | 0 | "%s: unable to release read/write lock for reading.", |
1148 | 0 | function ); |
1149 | |
|
1150 | 0 | return( -1 ); |
1151 | 0 | } |
1152 | 0 | #endif |
1153 | 0 | return( result ); |
1154 | 0 | } |
1155 | | |
1156 | | /* Retrieves the size of the UTF-16 encoded computer name |
1157 | | * The returned size includes the end of string character |
1158 | | * Returns 1 if successful, 0 if not available or -1 on error |
1159 | | */ |
1160 | | int libevt_record_get_utf16_computer_name_size( |
1161 | | libevt_record_t *record, |
1162 | | size_t *utf16_string_size, |
1163 | | libcerror_error_t **error ) |
1164 | 0 | { |
1165 | 0 | libevt_internal_record_t *internal_record = NULL; |
1166 | 0 | static char *function = "libevt_record_get_utf16_computer_name_size"; |
1167 | 0 | int result = 0; |
1168 | |
|
1169 | 0 | if( record == NULL ) |
1170 | 0 | { |
1171 | 0 | libcerror_error_set( |
1172 | 0 | error, |
1173 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1174 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1175 | 0 | "%s: invalid record.", |
1176 | 0 | function ); |
1177 | |
|
1178 | 0 | return( -1 ); |
1179 | 0 | } |
1180 | 0 | internal_record = (libevt_internal_record_t *) record; |
1181 | |
|
1182 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1183 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1184 | 0 | internal_record->read_write_lock, |
1185 | 0 | error ) != 1 ) |
1186 | 0 | { |
1187 | 0 | libcerror_error_set( |
1188 | 0 | error, |
1189 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1190 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1191 | 0 | "%s: unable to grab read/write lock for reading.", |
1192 | 0 | function ); |
1193 | |
|
1194 | 0 | return( -1 ); |
1195 | 0 | } |
1196 | 0 | #endif |
1197 | 0 | result = libevt_record_values_get_utf16_computer_name_size( |
1198 | 0 | internal_record->record_values, |
1199 | 0 | utf16_string_size, |
1200 | 0 | error ); |
1201 | |
|
1202 | 0 | if( result == -1 ) |
1203 | 0 | { |
1204 | 0 | libcerror_error_set( |
1205 | 0 | error, |
1206 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1207 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1208 | 0 | "%s: unable to retrieve UTF-16 computer name.", |
1209 | 0 | function ); |
1210 | |
|
1211 | 0 | result = -1; |
1212 | 0 | } |
1213 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1214 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1215 | 0 | internal_record->read_write_lock, |
1216 | 0 | error ) != 1 ) |
1217 | 0 | { |
1218 | 0 | libcerror_error_set( |
1219 | 0 | error, |
1220 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1221 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1222 | 0 | "%s: unable to release read/write lock for reading.", |
1223 | 0 | function ); |
1224 | |
|
1225 | 0 | return( -1 ); |
1226 | 0 | } |
1227 | 0 | #endif |
1228 | 0 | return( result ); |
1229 | 0 | } |
1230 | | |
1231 | | /* Retrieves the UTF-16 encoded computer name |
1232 | | * The size should include the end of string character |
1233 | | * Returns 1 if successful, 0 if not available or -1 on error |
1234 | | */ |
1235 | | int libevt_record_get_utf16_computer_name( |
1236 | | libevt_record_t *record, |
1237 | | uint16_t *utf16_string, |
1238 | | size_t utf16_string_size, |
1239 | | libcerror_error_t **error ) |
1240 | 0 | { |
1241 | 0 | libevt_internal_record_t *internal_record = NULL; |
1242 | 0 | static char *function = "libevt_record_get_utf16_computer_name"; |
1243 | 0 | int result = 0; |
1244 | |
|
1245 | 0 | if( record == NULL ) |
1246 | 0 | { |
1247 | 0 | libcerror_error_set( |
1248 | 0 | error, |
1249 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1250 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1251 | 0 | "%s: invalid record.", |
1252 | 0 | function ); |
1253 | |
|
1254 | 0 | return( -1 ); |
1255 | 0 | } |
1256 | 0 | internal_record = (libevt_internal_record_t *) record; |
1257 | |
|
1258 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1259 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1260 | 0 | internal_record->read_write_lock, |
1261 | 0 | error ) != 1 ) |
1262 | 0 | { |
1263 | 0 | libcerror_error_set( |
1264 | 0 | error, |
1265 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1266 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1267 | 0 | "%s: unable to grab read/write lock for reading.", |
1268 | 0 | function ); |
1269 | |
|
1270 | 0 | return( -1 ); |
1271 | 0 | } |
1272 | 0 | #endif |
1273 | 0 | result = libevt_record_values_get_utf16_computer_name( |
1274 | 0 | internal_record->record_values, |
1275 | 0 | utf16_string, |
1276 | 0 | utf16_string_size, |
1277 | 0 | error ); |
1278 | |
|
1279 | 0 | if( result == -1 ) |
1280 | 0 | { |
1281 | 0 | libcerror_error_set( |
1282 | 0 | error, |
1283 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1284 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1285 | 0 | "%s: unable to retrieve UTF-16 computer name.", |
1286 | 0 | function ); |
1287 | |
|
1288 | 0 | result = -1; |
1289 | 0 | } |
1290 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1291 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1292 | 0 | internal_record->read_write_lock, |
1293 | 0 | error ) != 1 ) |
1294 | 0 | { |
1295 | 0 | libcerror_error_set( |
1296 | 0 | error, |
1297 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1298 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1299 | 0 | "%s: unable to release read/write lock for reading.", |
1300 | 0 | function ); |
1301 | |
|
1302 | 0 | return( -1 ); |
1303 | 0 | } |
1304 | 0 | #endif |
1305 | 0 | return( result ); |
1306 | 0 | } |
1307 | | |
1308 | | /* Retrieves the size of the UTF-8 encoded user security identifier |
1309 | | * The returned size includes the end of string character |
1310 | | * Returns 1 if successful, 0 if not available or -1 on error |
1311 | | */ |
1312 | | int libevt_record_get_utf8_user_security_identifier_size( |
1313 | | libevt_record_t *record, |
1314 | | size_t *utf8_string_size, |
1315 | | libcerror_error_t **error ) |
1316 | 0 | { |
1317 | 0 | libevt_internal_record_t *internal_record = NULL; |
1318 | 0 | static char *function = "libevt_record_get_utf8_user_security_identifier_size"; |
1319 | 0 | int result = 0; |
1320 | |
|
1321 | 0 | if( record == NULL ) |
1322 | 0 | { |
1323 | 0 | libcerror_error_set( |
1324 | 0 | error, |
1325 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1326 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1327 | 0 | "%s: invalid record.", |
1328 | 0 | function ); |
1329 | |
|
1330 | 0 | return( -1 ); |
1331 | 0 | } |
1332 | 0 | internal_record = (libevt_internal_record_t *) record; |
1333 | |
|
1334 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1335 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1336 | 0 | internal_record->read_write_lock, |
1337 | 0 | error ) != 1 ) |
1338 | 0 | { |
1339 | 0 | libcerror_error_set( |
1340 | 0 | error, |
1341 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1342 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1343 | 0 | "%s: unable to grab read/write lock for reading.", |
1344 | 0 | function ); |
1345 | |
|
1346 | 0 | return( -1 ); |
1347 | 0 | } |
1348 | 0 | #endif |
1349 | 0 | result = libevt_record_values_get_utf8_user_security_identifier_size( |
1350 | 0 | internal_record->record_values, |
1351 | 0 | utf8_string_size, |
1352 | 0 | error ); |
1353 | |
|
1354 | 0 | if( result == -1 ) |
1355 | 0 | { |
1356 | 0 | libcerror_error_set( |
1357 | 0 | error, |
1358 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1359 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1360 | 0 | "%s: unable to retrieve the of the user security identifier as UTF-8 string.", |
1361 | 0 | function ); |
1362 | |
|
1363 | 0 | result = -1; |
1364 | 0 | } |
1365 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1366 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1367 | 0 | internal_record->read_write_lock, |
1368 | 0 | error ) != 1 ) |
1369 | 0 | { |
1370 | 0 | libcerror_error_set( |
1371 | 0 | error, |
1372 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1373 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1374 | 0 | "%s: unable to release read/write lock for reading.", |
1375 | 0 | function ); |
1376 | |
|
1377 | 0 | return( -1 ); |
1378 | 0 | } |
1379 | 0 | #endif |
1380 | 0 | return( result ); |
1381 | 0 | } |
1382 | | |
1383 | | /* Retrieves the UTF-8 encoded user security identifier |
1384 | | * The size should include the end of string character |
1385 | | * Returns 1 if successful, 0 if not available or -1 on error |
1386 | | */ |
1387 | | int libevt_record_get_utf8_user_security_identifier( |
1388 | | libevt_record_t *record, |
1389 | | uint8_t *utf8_string, |
1390 | | size_t utf8_string_size, |
1391 | | libcerror_error_t **error ) |
1392 | 0 | { |
1393 | 0 | libevt_internal_record_t *internal_record = NULL; |
1394 | 0 | static char *function = "libevt_record_get_utf8_user_security_identifier"; |
1395 | 0 | int result = 0; |
1396 | |
|
1397 | 0 | if( record == NULL ) |
1398 | 0 | { |
1399 | 0 | libcerror_error_set( |
1400 | 0 | error, |
1401 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1402 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1403 | 0 | "%s: invalid record.", |
1404 | 0 | function ); |
1405 | |
|
1406 | 0 | return( -1 ); |
1407 | 0 | } |
1408 | 0 | internal_record = (libevt_internal_record_t *) record; |
1409 | |
|
1410 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1411 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1412 | 0 | internal_record->read_write_lock, |
1413 | 0 | error ) != 1 ) |
1414 | 0 | { |
1415 | 0 | libcerror_error_set( |
1416 | 0 | error, |
1417 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1418 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1419 | 0 | "%s: unable to grab read/write lock for reading.", |
1420 | 0 | function ); |
1421 | |
|
1422 | 0 | return( -1 ); |
1423 | 0 | } |
1424 | 0 | #endif |
1425 | 0 | result = libevt_record_values_get_utf8_user_security_identifier( |
1426 | 0 | internal_record->record_values, |
1427 | 0 | utf8_string, |
1428 | 0 | utf8_string_size, |
1429 | 0 | error ); |
1430 | |
|
1431 | 0 | if( result == -1 ) |
1432 | 0 | { |
1433 | 0 | libcerror_error_set( |
1434 | 0 | error, |
1435 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1436 | 0 | LIBCERROR_RUNTIME_ERROR_COPY_FAILED, |
1437 | 0 | "%s: unable to copy user security identifier to UTF-8 string.", |
1438 | 0 | function ); |
1439 | |
|
1440 | 0 | result = -1; |
1441 | 0 | } |
1442 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1443 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1444 | 0 | internal_record->read_write_lock, |
1445 | 0 | error ) != 1 ) |
1446 | 0 | { |
1447 | 0 | libcerror_error_set( |
1448 | 0 | error, |
1449 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1450 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1451 | 0 | "%s: unable to release read/write lock for reading.", |
1452 | 0 | function ); |
1453 | |
|
1454 | 0 | return( -1 ); |
1455 | 0 | } |
1456 | 0 | #endif |
1457 | 0 | return( result ); |
1458 | 0 | } |
1459 | | |
1460 | | /* Retrieves the size of the UTF-16 encoded user security identifier |
1461 | | * The returned size includes the end of string character |
1462 | | * Returns 1 if successful, 0 if not available or -1 on error |
1463 | | */ |
1464 | | int libevt_record_get_utf16_user_security_identifier_size( |
1465 | | libevt_record_t *record, |
1466 | | size_t *utf16_string_size, |
1467 | | libcerror_error_t **error ) |
1468 | 0 | { |
1469 | 0 | libevt_internal_record_t *internal_record = NULL; |
1470 | 0 | static char *function = "libevt_record_get_utf16_user_security_identifier_size"; |
1471 | 0 | int result = 0; |
1472 | |
|
1473 | 0 | if( record == NULL ) |
1474 | 0 | { |
1475 | 0 | libcerror_error_set( |
1476 | 0 | error, |
1477 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1478 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1479 | 0 | "%s: invalid record.", |
1480 | 0 | function ); |
1481 | |
|
1482 | 0 | return( -1 ); |
1483 | 0 | } |
1484 | 0 | internal_record = (libevt_internal_record_t *) record; |
1485 | |
|
1486 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1487 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1488 | 0 | internal_record->read_write_lock, |
1489 | 0 | error ) != 1 ) |
1490 | 0 | { |
1491 | 0 | libcerror_error_set( |
1492 | 0 | error, |
1493 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1494 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1495 | 0 | "%s: unable to grab read/write lock for reading.", |
1496 | 0 | function ); |
1497 | |
|
1498 | 0 | return( -1 ); |
1499 | 0 | } |
1500 | 0 | #endif |
1501 | 0 | result = libevt_record_values_get_utf16_user_security_identifier_size( |
1502 | 0 | internal_record->record_values, |
1503 | 0 | utf16_string_size, |
1504 | 0 | error ); |
1505 | |
|
1506 | 0 | if( result == -1 ) |
1507 | 0 | { |
1508 | 0 | libcerror_error_set( |
1509 | 0 | error, |
1510 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1511 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1512 | 0 | "%s: unable to retrieve the of the user security identifier as UTF-16 string.", |
1513 | 0 | function ); |
1514 | |
|
1515 | 0 | result = -1; |
1516 | 0 | } |
1517 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1518 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1519 | 0 | internal_record->read_write_lock, |
1520 | 0 | error ) != 1 ) |
1521 | 0 | { |
1522 | 0 | libcerror_error_set( |
1523 | 0 | error, |
1524 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1525 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1526 | 0 | "%s: unable to release read/write lock for reading.", |
1527 | 0 | function ); |
1528 | |
|
1529 | 0 | return( -1 ); |
1530 | 0 | } |
1531 | 0 | #endif |
1532 | 0 | return( result ); |
1533 | 0 | } |
1534 | | |
1535 | | /* Retrieves the UTF-16 encoded user security identifier |
1536 | | * The size should include the end of string character |
1537 | | * Returns 1 if successful, 0 if not available or -1 on error |
1538 | | */ |
1539 | | int libevt_record_get_utf16_user_security_identifier( |
1540 | | libevt_record_t *record, |
1541 | | uint16_t *utf16_string, |
1542 | | size_t utf16_string_size, |
1543 | | libcerror_error_t **error ) |
1544 | 0 | { |
1545 | 0 | libevt_internal_record_t *internal_record = NULL; |
1546 | 0 | static char *function = "libevt_record_get_utf16_user_security_identifier"; |
1547 | 0 | int result = 0; |
1548 | |
|
1549 | 0 | if( record == NULL ) |
1550 | 0 | { |
1551 | 0 | libcerror_error_set( |
1552 | 0 | error, |
1553 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1554 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1555 | 0 | "%s: invalid record.", |
1556 | 0 | function ); |
1557 | |
|
1558 | 0 | return( -1 ); |
1559 | 0 | } |
1560 | 0 | internal_record = (libevt_internal_record_t *) record; |
1561 | |
|
1562 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1563 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1564 | 0 | internal_record->read_write_lock, |
1565 | 0 | error ) != 1 ) |
1566 | 0 | { |
1567 | 0 | libcerror_error_set( |
1568 | 0 | error, |
1569 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1570 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1571 | 0 | "%s: unable to grab read/write lock for reading.", |
1572 | 0 | function ); |
1573 | |
|
1574 | 0 | return( -1 ); |
1575 | 0 | } |
1576 | 0 | #endif |
1577 | 0 | result = libevt_record_values_get_utf16_user_security_identifier( |
1578 | 0 | internal_record->record_values, |
1579 | 0 | utf16_string, |
1580 | 0 | utf16_string_size, |
1581 | 0 | error ); |
1582 | |
|
1583 | 0 | if( result == -1 ) |
1584 | 0 | { |
1585 | 0 | libcerror_error_set( |
1586 | 0 | error, |
1587 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1588 | 0 | LIBCERROR_RUNTIME_ERROR_COPY_FAILED, |
1589 | 0 | "%s: unable to copy user security identifier to UTF-16 string.", |
1590 | 0 | function ); |
1591 | |
|
1592 | 0 | result = -1; |
1593 | 0 | } |
1594 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1595 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1596 | 0 | internal_record->read_write_lock, |
1597 | 0 | error ) != 1 ) |
1598 | 0 | { |
1599 | 0 | libcerror_error_set( |
1600 | 0 | error, |
1601 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1602 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1603 | 0 | "%s: unable to release read/write lock for reading.", |
1604 | 0 | function ); |
1605 | |
|
1606 | 0 | return( -1 ); |
1607 | 0 | } |
1608 | 0 | #endif |
1609 | 0 | return( result ); |
1610 | 0 | } |
1611 | | |
1612 | | /* Retrieves the number of strings |
1613 | | * Returns 1 if successful or -1 on error |
1614 | | */ |
1615 | | int libevt_record_get_number_of_strings( |
1616 | | libevt_record_t *record, |
1617 | | int *number_of_strings, |
1618 | | libcerror_error_t **error ) |
1619 | 0 | { |
1620 | 0 | libevt_internal_record_t *internal_record = NULL; |
1621 | 0 | static char *function = "libevt_record_get_number_of_strings"; |
1622 | 0 | int result = 1; |
1623 | |
|
1624 | 0 | if( record == NULL ) |
1625 | 0 | { |
1626 | 0 | libcerror_error_set( |
1627 | 0 | error, |
1628 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1629 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1630 | 0 | "%s: invalid record.", |
1631 | 0 | function ); |
1632 | |
|
1633 | 0 | return( -1 ); |
1634 | 0 | } |
1635 | 0 | internal_record = (libevt_internal_record_t *) record; |
1636 | |
|
1637 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1638 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1639 | 0 | internal_record->read_write_lock, |
1640 | 0 | error ) != 1 ) |
1641 | 0 | { |
1642 | 0 | libcerror_error_set( |
1643 | 0 | error, |
1644 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1645 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1646 | 0 | "%s: unable to grab read/write lock for reading.", |
1647 | 0 | function ); |
1648 | |
|
1649 | 0 | return( -1 ); |
1650 | 0 | } |
1651 | 0 | #endif |
1652 | 0 | if( libevt_record_values_get_number_of_strings( |
1653 | 0 | internal_record->record_values, |
1654 | 0 | number_of_strings, |
1655 | 0 | error ) != 1 ) |
1656 | 0 | { |
1657 | 0 | libcerror_error_set( |
1658 | 0 | error, |
1659 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1660 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1661 | 0 | "%s: unable to retrieve number of strings.", |
1662 | 0 | function ); |
1663 | |
|
1664 | 0 | result = -1; |
1665 | 0 | } |
1666 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1667 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1668 | 0 | internal_record->read_write_lock, |
1669 | 0 | error ) != 1 ) |
1670 | 0 | { |
1671 | 0 | libcerror_error_set( |
1672 | 0 | error, |
1673 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1674 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1675 | 0 | "%s: unable to release read/write lock for reading.", |
1676 | 0 | function ); |
1677 | |
|
1678 | 0 | return( -1 ); |
1679 | 0 | } |
1680 | 0 | #endif |
1681 | 0 | return( result ); |
1682 | 0 | } |
1683 | | |
1684 | | /* Retrieves the size of a specific UTF-8 encoded string |
1685 | | * The returned size includes the end of string character |
1686 | | * Returns 1 if successful or -1 on error |
1687 | | */ |
1688 | | int libevt_record_get_utf8_string_size( |
1689 | | libevt_record_t *record, |
1690 | | int string_index, |
1691 | | size_t *utf8_string_size, |
1692 | | libcerror_error_t **error ) |
1693 | 0 | { |
1694 | 0 | libevt_internal_record_t *internal_record = NULL; |
1695 | 0 | static char *function = "libevt_record_get_utf8_string_size"; |
1696 | 0 | int result = 1; |
1697 | |
|
1698 | 0 | if( record == NULL ) |
1699 | 0 | { |
1700 | 0 | libcerror_error_set( |
1701 | 0 | error, |
1702 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1703 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1704 | 0 | "%s: invalid record.", |
1705 | 0 | function ); |
1706 | |
|
1707 | 0 | return( -1 ); |
1708 | 0 | } |
1709 | 0 | internal_record = (libevt_internal_record_t *) record; |
1710 | |
|
1711 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1712 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1713 | 0 | internal_record->read_write_lock, |
1714 | 0 | error ) != 1 ) |
1715 | 0 | { |
1716 | 0 | libcerror_error_set( |
1717 | 0 | error, |
1718 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1719 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1720 | 0 | "%s: unable to grab read/write lock for reading.", |
1721 | 0 | function ); |
1722 | |
|
1723 | 0 | return( -1 ); |
1724 | 0 | } |
1725 | 0 | #endif |
1726 | 0 | if( libevt_record_values_get_utf8_string_size( |
1727 | 0 | internal_record->record_values, |
1728 | 0 | string_index, |
1729 | 0 | utf8_string_size, |
1730 | 0 | error ) != 1 ) |
1731 | 0 | { |
1732 | 0 | libcerror_error_set( |
1733 | 0 | error, |
1734 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1735 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1736 | 0 | "%s: unable to retrieve UTF-8 string size of strings value entry: %d.", |
1737 | 0 | function, |
1738 | 0 | string_index ); |
1739 | |
|
1740 | 0 | result = -1; |
1741 | 0 | } |
1742 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1743 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1744 | 0 | internal_record->read_write_lock, |
1745 | 0 | error ) != 1 ) |
1746 | 0 | { |
1747 | 0 | libcerror_error_set( |
1748 | 0 | error, |
1749 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1750 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1751 | 0 | "%s: unable to release read/write lock for reading.", |
1752 | 0 | function ); |
1753 | |
|
1754 | 0 | return( -1 ); |
1755 | 0 | } |
1756 | 0 | #endif |
1757 | 0 | return( result ); |
1758 | 0 | } |
1759 | | |
1760 | | /* Retrieves a specific UTF-8 encoded string |
1761 | | * The size should include the end of string character |
1762 | | * Returns 1 if successful or -1 on error |
1763 | | */ |
1764 | | int libevt_record_get_utf8_string( |
1765 | | libevt_record_t *record, |
1766 | | int string_index, |
1767 | | uint8_t *utf8_string, |
1768 | | size_t utf8_string_size, |
1769 | | libcerror_error_t **error ) |
1770 | 0 | { |
1771 | 0 | libevt_internal_record_t *internal_record = NULL; |
1772 | 0 | static char *function = "libevt_record_get_utf8_string"; |
1773 | 0 | int result = 1; |
1774 | |
|
1775 | 0 | if( record == NULL ) |
1776 | 0 | { |
1777 | 0 | libcerror_error_set( |
1778 | 0 | error, |
1779 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1780 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1781 | 0 | "%s: invalid record.", |
1782 | 0 | function ); |
1783 | |
|
1784 | 0 | return( -1 ); |
1785 | 0 | } |
1786 | 0 | internal_record = (libevt_internal_record_t *) record; |
1787 | |
|
1788 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1789 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1790 | 0 | internal_record->read_write_lock, |
1791 | 0 | error ) != 1 ) |
1792 | 0 | { |
1793 | 0 | libcerror_error_set( |
1794 | 0 | error, |
1795 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1796 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1797 | 0 | "%s: unable to grab read/write lock for reading.", |
1798 | 0 | function ); |
1799 | |
|
1800 | 0 | return( -1 ); |
1801 | 0 | } |
1802 | 0 | #endif |
1803 | 0 | if( libevt_record_values_get_utf8_string( |
1804 | 0 | internal_record->record_values, |
1805 | 0 | string_index, |
1806 | 0 | utf8_string, |
1807 | 0 | utf8_string_size, |
1808 | 0 | error ) != 1 ) |
1809 | 0 | { |
1810 | 0 | libcerror_error_set( |
1811 | 0 | error, |
1812 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1813 | 0 | LIBCERROR_RUNTIME_ERROR_COPY_FAILED, |
1814 | 0 | "%s: unable to copy strings value entry: %d to UTF-8 string.", |
1815 | 0 | function, |
1816 | 0 | string_index ); |
1817 | |
|
1818 | 0 | result = -1; |
1819 | 0 | } |
1820 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1821 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1822 | 0 | internal_record->read_write_lock, |
1823 | 0 | error ) != 1 ) |
1824 | 0 | { |
1825 | 0 | libcerror_error_set( |
1826 | 0 | error, |
1827 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1828 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1829 | 0 | "%s: unable to release read/write lock for reading.", |
1830 | 0 | function ); |
1831 | |
|
1832 | 0 | return( -1 ); |
1833 | 0 | } |
1834 | 0 | #endif |
1835 | 0 | return( result ); |
1836 | 0 | } |
1837 | | |
1838 | | /* Retrieves the size of a specific UTF-16 encoded string |
1839 | | * The returned size includes the end of string character |
1840 | | * Returns 1 if successful or -1 on error |
1841 | | */ |
1842 | | int libevt_record_get_utf16_string_size( |
1843 | | libevt_record_t *record, |
1844 | | int string_index, |
1845 | | size_t *utf16_string_size, |
1846 | | libcerror_error_t **error ) |
1847 | 0 | { |
1848 | 0 | libevt_internal_record_t *internal_record = NULL; |
1849 | 0 | static char *function = "libevt_record_get_utf16_string_size"; |
1850 | 0 | int result = 1; |
1851 | |
|
1852 | 0 | if( record == NULL ) |
1853 | 0 | { |
1854 | 0 | libcerror_error_set( |
1855 | 0 | error, |
1856 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1857 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1858 | 0 | "%s: invalid record.", |
1859 | 0 | function ); |
1860 | |
|
1861 | 0 | return( -1 ); |
1862 | 0 | } |
1863 | 0 | internal_record = (libevt_internal_record_t *) record; |
1864 | |
|
1865 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1866 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1867 | 0 | internal_record->read_write_lock, |
1868 | 0 | error ) != 1 ) |
1869 | 0 | { |
1870 | 0 | libcerror_error_set( |
1871 | 0 | error, |
1872 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1873 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1874 | 0 | "%s: unable to grab read/write lock for reading.", |
1875 | 0 | function ); |
1876 | |
|
1877 | 0 | return( -1 ); |
1878 | 0 | } |
1879 | 0 | #endif |
1880 | 0 | if( libevt_record_values_get_utf16_string_size( |
1881 | 0 | internal_record->record_values, |
1882 | 0 | string_index, |
1883 | 0 | utf16_string_size, |
1884 | 0 | error ) != 1 ) |
1885 | 0 | { |
1886 | 0 | libcerror_error_set( |
1887 | 0 | error, |
1888 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1889 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1890 | 0 | "%s: unable to retrieve UTF-16 string size of strings value entry: %d.", |
1891 | 0 | function, |
1892 | 0 | string_index ); |
1893 | |
|
1894 | 0 | result = -1; |
1895 | 0 | } |
1896 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1897 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1898 | 0 | internal_record->read_write_lock, |
1899 | 0 | error ) != 1 ) |
1900 | 0 | { |
1901 | 0 | libcerror_error_set( |
1902 | 0 | error, |
1903 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1904 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1905 | 0 | "%s: unable to release read/write lock for reading.", |
1906 | 0 | function ); |
1907 | |
|
1908 | 0 | return( -1 ); |
1909 | 0 | } |
1910 | 0 | #endif |
1911 | 0 | return( result ); |
1912 | 0 | } |
1913 | | |
1914 | | /* Retrieves a specific UTF-16 encoded string |
1915 | | * The size should include the end of string character |
1916 | | * Returns 1 if successful or -1 on error |
1917 | | */ |
1918 | | int libevt_record_get_utf16_string( |
1919 | | libevt_record_t *record, |
1920 | | int string_index, |
1921 | | uint16_t *utf16_string, |
1922 | | size_t utf16_string_size, |
1923 | | libcerror_error_t **error ) |
1924 | 0 | { |
1925 | 0 | libevt_internal_record_t *internal_record = NULL; |
1926 | 0 | static char *function = "libevt_record_get_utf16_string"; |
1927 | 0 | int result = 1; |
1928 | |
|
1929 | 0 | if( record == NULL ) |
1930 | 0 | { |
1931 | 0 | libcerror_error_set( |
1932 | 0 | error, |
1933 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1934 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1935 | 0 | "%s: invalid record.", |
1936 | 0 | function ); |
1937 | |
|
1938 | 0 | return( -1 ); |
1939 | 0 | } |
1940 | 0 | internal_record = (libevt_internal_record_t *) record; |
1941 | |
|
1942 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1943 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1944 | 0 | internal_record->read_write_lock, |
1945 | 0 | error ) != 1 ) |
1946 | 0 | { |
1947 | 0 | libcerror_error_set( |
1948 | 0 | error, |
1949 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1950 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1951 | 0 | "%s: unable to grab read/write lock for reading.", |
1952 | 0 | function ); |
1953 | |
|
1954 | 0 | return( -1 ); |
1955 | 0 | } |
1956 | 0 | #endif |
1957 | 0 | if( libevt_record_values_get_utf16_string( |
1958 | 0 | internal_record->record_values, |
1959 | 0 | string_index, |
1960 | 0 | utf16_string, |
1961 | 0 | utf16_string_size, |
1962 | 0 | error ) != 1 ) |
1963 | 0 | { |
1964 | 0 | libcerror_error_set( |
1965 | 0 | error, |
1966 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1967 | 0 | LIBCERROR_RUNTIME_ERROR_COPY_FAILED, |
1968 | 0 | "%s: unable to copy strings value entry: %d to UTF-16 string.", |
1969 | 0 | function, |
1970 | 0 | string_index ); |
1971 | |
|
1972 | 0 | result = -1; |
1973 | 0 | } |
1974 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
1975 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1976 | 0 | internal_record->read_write_lock, |
1977 | 0 | error ) != 1 ) |
1978 | 0 | { |
1979 | 0 | libcerror_error_set( |
1980 | 0 | error, |
1981 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1982 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1983 | 0 | "%s: unable to release read/write lock for reading.", |
1984 | 0 | function ); |
1985 | |
|
1986 | 0 | return( -1 ); |
1987 | 0 | } |
1988 | 0 | #endif |
1989 | 0 | return( result ); |
1990 | 0 | } |
1991 | | |
1992 | | /* Retrieves the size of the data |
1993 | | * Returns 1 if successful, 0 if not available or -1 on error |
1994 | | */ |
1995 | | int libevt_record_get_data_size( |
1996 | | libevt_record_t *record, |
1997 | | size_t *data_size, |
1998 | | libcerror_error_t **error ) |
1999 | 0 | { |
2000 | 0 | libevt_internal_record_t *internal_record = NULL; |
2001 | 0 | static char *function = "libevt_record_get_data_size"; |
2002 | 0 | int result = 0; |
2003 | |
|
2004 | 0 | if( record == NULL ) |
2005 | 0 | { |
2006 | 0 | libcerror_error_set( |
2007 | 0 | error, |
2008 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2009 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2010 | 0 | "%s: invalid record.", |
2011 | 0 | function ); |
2012 | |
|
2013 | 0 | return( -1 ); |
2014 | 0 | } |
2015 | 0 | internal_record = (libevt_internal_record_t *) record; |
2016 | |
|
2017 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
2018 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2019 | 0 | internal_record->read_write_lock, |
2020 | 0 | error ) != 1 ) |
2021 | 0 | { |
2022 | 0 | libcerror_error_set( |
2023 | 0 | error, |
2024 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2025 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2026 | 0 | "%s: unable to grab read/write lock for reading.", |
2027 | 0 | function ); |
2028 | |
|
2029 | 0 | return( -1 ); |
2030 | 0 | } |
2031 | 0 | #endif |
2032 | 0 | result = libevt_record_values_get_data_size( |
2033 | 0 | internal_record->record_values, |
2034 | 0 | data_size, |
2035 | 0 | error ); |
2036 | |
|
2037 | 0 | if( result == -1 ) |
2038 | 0 | { |
2039 | 0 | libcerror_error_set( |
2040 | 0 | error, |
2041 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2042 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2043 | 0 | "%s: unable to retrieve data size.", |
2044 | 0 | function ); |
2045 | |
|
2046 | 0 | result = -1; |
2047 | 0 | } |
2048 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
2049 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2050 | 0 | internal_record->read_write_lock, |
2051 | 0 | error ) != 1 ) |
2052 | 0 | { |
2053 | 0 | libcerror_error_set( |
2054 | 0 | error, |
2055 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2056 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2057 | 0 | "%s: unable to release read/write lock for reading.", |
2058 | 0 | function ); |
2059 | |
|
2060 | 0 | return( -1 ); |
2061 | 0 | } |
2062 | 0 | #endif |
2063 | 0 | return( result ); |
2064 | 0 | } |
2065 | | |
2066 | | /* Retrieves the data |
2067 | | * Returns 1 if successful, 0 if not available or -1 on error |
2068 | | */ |
2069 | | int libevt_record_get_data( |
2070 | | libevt_record_t *record, |
2071 | | uint8_t *data, |
2072 | | size_t data_size, |
2073 | | libcerror_error_t **error ) |
2074 | 0 | { |
2075 | 0 | libevt_internal_record_t *internal_record = NULL; |
2076 | 0 | static char *function = "libevt_record_get_data"; |
2077 | 0 | int result = 0; |
2078 | |
|
2079 | 0 | if( record == NULL ) |
2080 | 0 | { |
2081 | 0 | libcerror_error_set( |
2082 | 0 | error, |
2083 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2084 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2085 | 0 | "%s: invalid record.", |
2086 | 0 | function ); |
2087 | |
|
2088 | 0 | return( -1 ); |
2089 | 0 | } |
2090 | 0 | internal_record = (libevt_internal_record_t *) record; |
2091 | |
|
2092 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
2093 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2094 | 0 | internal_record->read_write_lock, |
2095 | 0 | error ) != 1 ) |
2096 | 0 | { |
2097 | 0 | libcerror_error_set( |
2098 | 0 | error, |
2099 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2100 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2101 | 0 | "%s: unable to grab read/write lock for reading.", |
2102 | 0 | function ); |
2103 | |
|
2104 | 0 | return( -1 ); |
2105 | 0 | } |
2106 | 0 | #endif |
2107 | 0 | result = libevt_record_values_get_data( |
2108 | 0 | internal_record->record_values, |
2109 | 0 | data, |
2110 | 0 | data_size, |
2111 | 0 | error ); |
2112 | |
|
2113 | 0 | if( result == -1 ) |
2114 | 0 | { |
2115 | 0 | libcerror_error_set( |
2116 | 0 | error, |
2117 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2118 | 0 | LIBCERROR_RUNTIME_ERROR_COPY_FAILED, |
2119 | 0 | "%s: unable to copy data.", |
2120 | 0 | function ); |
2121 | |
|
2122 | 0 | result = -1; |
2123 | 0 | } |
2124 | 0 | #if defined( HAVE_LIBEVT_MULTI_THREAD_SUPPORT ) |
2125 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2126 | 0 | internal_record->read_write_lock, |
2127 | 0 | error ) != 1 ) |
2128 | 0 | { |
2129 | 0 | libcerror_error_set( |
2130 | 0 | error, |
2131 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2132 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2133 | 0 | "%s: unable to release read/write lock for reading.", |
2134 | 0 | function ); |
2135 | |
|
2136 | 0 | return( -1 ); |
2137 | 0 | } |
2138 | 0 | #endif |
2139 | 0 | return( result ); |
2140 | 0 | } |
2141 | | |