MCPcopy Create free account
hub / github.com/DFIR-ORC/dfir-orc / BuildBlockViewTree

Function BuildBlockViewTree

src/OrcLib/FileFormat/PeVersionInfo.cpp:298–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298Result<void> BuildBlockViewTree(BlockViewTree& node, BufferView blockBuffer, std::optional<uint32_t> maxDepth = {})
299{
300 if (maxDepth.has_value())
301 {
302 if (*maxDepth == 0)
303 {
304 Log::Critical("PeVersionInfo: BuildBlockViewTree: maximum recursion depth reached");
305 return std::errc::bad_message;
306 }
307 else
308 {
309 maxDepth.value()--;
310 }
311 }
312
313 auto block = Parse(blockBuffer);
314 if (!block)
315 {
316 return block.error();
317 }
318
319 node.block = std::move(*block);
320 for (auto& childBuffer : node.block.rawChilds)
321 {
322 BlockViewTree childNode;
323 auto rv = BuildBlockViewTree(childNode, childBuffer, maxDepth);
324 if (rv.has_error())
325 {
326 continue;
327 }
328
329 node.childNodes.emplace_back(std::move(childNode));
330 }
331
332 return Orc::Success<void>();
333}
334
335bool IsPreferredLanguage(uint16_t lang, uint16_t codepage)
336{

Callers 1

ParseVersionInfoFunction · 0.85

Calls 3

ParseFunction · 0.85
CriticalFunction · 0.50
has_errorMethod · 0.45

Tested by

no test coverage detected