@@ -249,7 +249,10 @@ HRESULT Main::RunFileSystem()
249
249
HRESULT hr = E_FAIL;
250
250
251
251
if (pStructuredOutput)
252
+ {
252
253
pStructuredOutput->BeginCollection (L" filesystem" );
254
+ pStructuredOutput->BeginElement (nullptr );
255
+ }
253
256
254
257
hr = config.FileSystem .Files .Find (
255
258
config.FileSystem .Locations ,
@@ -267,7 +270,11 @@ HRESULT Main::RunFileSystem()
267
270
if (pFileSystemTableOutput)
268
271
aMatch->Write (*pFileSystemTableOutput);
269
272
if (pStructuredOutput)
273
+ {
274
+ pStructuredOutput->BeginCollection (L" filefind_match" );
270
275
aMatch->Write (*pStructuredOutput, nullptr );
276
+ pStructuredOutput->EndCollection (L" filefind_match" );
277
+ }
271
278
272
279
return ;
273
280
},
@@ -281,7 +288,10 @@ HRESULT Main::RunFileSystem()
281
288
}
282
289
283
290
if (pStructuredOutput)
291
+ {
292
+ pStructuredOutput->EndElement (nullptr );
284
293
pStructuredOutput->EndCollection (L" filesystem" );
294
+ }
285
295
286
296
m_console.PrintNewLine ();
287
297
::PrintStatistics (m_console.OutputTree(), config.FileSystem.Files.AllSearchTerms());
@@ -311,7 +321,6 @@ HRESULT Main::RunRegistry()
311
321
},
312
322
false ,
313
323
ResurrectRecordsMode::kNo );
314
-
315
324
if (FAILED (hr))
316
325
{
317
326
Log::Error (L" Failed to parse location while searching for registry hives" );
@@ -320,6 +329,7 @@ HRESULT Main::RunRegistry()
320
329
if (pStructuredOutput)
321
330
{
322
331
pStructuredOutput->BeginCollection (L" registry" );
332
+ pStructuredOutput->BeginElement (nullptr );
323
333
}
324
334
325
335
for (const auto & aFileMatch : config.Registry .Files .Matches ())
@@ -328,6 +338,7 @@ HRESULT Main::RunRegistry()
328
338
329
339
if (pStructuredOutput)
330
340
{
341
+ pStructuredOutput->BeginCollection (L" hive" );
331
342
pStructuredOutput->BeginElement (nullptr );
332
343
pStructuredOutput->WriteNamed (L" volume_id" , aFileMatch->VolumeReader ->VolumeSerialNumber (), true );
333
344
@@ -385,11 +396,15 @@ HRESULT Main::RunRegistry()
385
396
}
386
397
387
398
if (pStructuredOutput)
399
+ {
388
400
pStructuredOutput->EndElement (nullptr );
401
+ pStructuredOutput->EndCollection (L" hive" );
402
+ }
389
403
}
390
404
391
405
if (pStructuredOutput)
392
406
{
407
+ pStructuredOutput->EndElement (nullptr );
393
408
pStructuredOutput->EndCollection (L" registry" );
394
409
}
395
410
@@ -403,10 +418,11 @@ Main::LogObjectMatch(const ObjectSpec::ObjectItem& spec, const ObjectDirectory::
403
418
404
419
if (pStructuredOutput)
405
420
{
406
- pStructuredOutput->BeginElement (szElement);
421
+ pStructuredOutput->BeginElement (L" object_match" );
422
+
407
423
pStructuredOutput->WriteNamed (L" description" , spec.Description ().c_str ());
408
424
obj.Write (*pStructuredOutput);
409
- pStructuredOutput->EndElement (szElement );
425
+ pStructuredOutput->EndElement (L" object_match " );
410
426
}
411
427
if (pObjectTableOutput)
412
428
{
@@ -423,10 +439,11 @@ Main::LogObjectMatch(const ObjectSpec::ObjectItem& spec, const FileDirectory::Fi
423
439
424
440
if (pStructuredOutput)
425
441
{
426
- pStructuredOutput->BeginElement (szElement);
442
+ pStructuredOutput->BeginElement (L" object_match" );
443
+
427
444
pStructuredOutput->WriteNamed (L" description" , spec.Description ().c_str ());
428
445
file.Write (*pStructuredOutput);
429
- pStructuredOutput->EndElement (szElement );
446
+ pStructuredOutput->EndElement (L" object_match " );
430
447
}
431
448
432
449
if (pObjectTableOutput)
@@ -442,7 +459,10 @@ HRESULT Main::RunObject()
442
459
HRESULT hr = E_FAIL;
443
460
444
461
if (pStructuredOutput)
445
- pStructuredOutput->BeginCollection (L" object_directory" );
462
+ {
463
+ pStructuredOutput->BeginCollection (L" object" );
464
+ pStructuredOutput->BeginElement (nullptr );
465
+ }
446
466
447
467
for (const auto & objdir : ObjectDirs)
448
468
{
@@ -600,7 +620,10 @@ HRESULT Main::RunObject()
600
620
}
601
621
602
622
if (pStructuredOutput)
603
- pStructuredOutput->EndCollection (L" object_directory" );
623
+ {
624
+ pStructuredOutput->EndElement (nullptr );
625
+ pStructuredOutput->EndCollection (L" object" );
626
+ }
604
627
605
628
return S_OK;
606
629
}
0 commit comments