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

Function SkipToElementEnd

src/OrcLib/Configuration/ConfigFileReader.cpp:28–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26namespace {
27
28HRESULT SkipToElementEnd(const CComPtr<IXmlReader>& pReader)
29{
30 XmlNodeType type = XmlNodeType_None;
31
32 // Elements such as '<foo/>' does not need to be skipped as next call will do
33 if (pReader->IsEmptyElement())
34 {
35 return S_OK;
36 }
37
38 UINT depth;
39 HRESULT hr = pReader->GetDepth(&depth);
40 if (FAILED(hr))
41 {
42 Log::Error(L"Failed get root element depth [{}]", SystemError(hr));
43 return hr;
44 }
45
46 UINT currentDepth;
47 do
48 {
49 hr = pReader->Read(&type);
50 if (FAILED(hr))
51 {
52 Log::Error(L"Failed to read element [{}]", SystemError(hr));
53 return hr;
54 }
55
56 hr = pReader->GetDepth(&currentDepth);
57 if (FAILED(hr))
58 {
59 Log::Error(L"Failed get element depth [{}]", SystemError(hr));
60 return hr;
61 }
62
63 } while ((type != XmlNodeType_EndElement && type != XmlNodeType_None) && currentDepth >= depth);
64
65 return S_OK;
66}
67
68} // namespace
69

Callers 1

NavigateConfigNodeMethod · 0.85

Calls 3

SystemErrorFunction · 0.85
ErrorFunction · 0.50
ReadMethod · 0.45

Tested by

no test coverage detected