forked from msmakhlouf/evtx-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecord.cpp
48 lines (38 loc) · 1.11 KB
/
Record.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "Record.h"
namespace Evtx {
const char Record::MAGIC[Record::MAGIC_LENGTH] = { 0x42, 0x42, 0x00, 0x00 };
Record::Record(void)
{
BinXmlStream = NULL;
Xml = NULL;
}
Record::Record(FILE* stream) {
Record();
// We suppose that stream pointer is set correctly.
fseek(stream, Record::MAGIC_LENGTH, SEEK_CUR); // TODO: check whether record signature is correct
fread(&Length1, sizeof uint32, 1, stream);
fread(&NumLogRecord, sizeof int64, 1, stream);
fread(&TimeCreated, sizeof FILETIME, 1, stream);
uint32 binXmlStreamSize = Length1 - Record::MAGIC_LENGTH - 2*(sizeof uint32) - sizeof FILETIME;
BinXmlStream = new char[binXmlStreamSize];
fread(BinXmlStream, sizeof (char), binXmlStreamSize, stream);
fread(&Length2, sizeof uint32, 1, stream);
}
Record::~Record(void)
{
delete []BinXmlStream;
if (Xml != NULL) {
delete []Xml;
}
}
uint32 Record::getLength(void) {
return Length1;
}
const wchar_t* Record::toXml() {
if (Xml == NULL) {
// TODO: create Bxml::Parser and parse Bxml
// TODO: get XML and save it to the Xml
}
return (const wchar_t*) Xml;
}
}