Coverage Report

Created: 2025-06-13 07:22

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