// 1. Get root file node// cause "System Volume Information" is a system file and just under root folder// so we use it to find root folder
std::wstring cmpStr(L"System Volume Information");
m_rootFileNode =0x0;for(auto it = m_usnRecordMap.begin(); it != m_usnRecordMap.end(); it++){
UsnInfo usnInfo = it->second;if(0== usnInfo.fileNameWstr.compare(cmpStr)){
m_rootFileNode = usnInfo.pParentRef;break;}}if(m_rootFileNode ==0){
std::cout <<"Cannot find root folder"<< std::endl;
ret = E_FAIL;assert(0);}
2. 通过递归查找文件路径
VOID GetCurrentFilePathV2(std::wstring& path, std::wstring volName, DWORDLONG currentRef, DWORDLONG rootRef, unordered_map<DWORDLONG, UsnInfo>& recordMapAll){// 1. This is root node, just add root path and returnif(currentRef == rootRef){
path = volName + L"\\"+ path;return;}if(recordMapAll.find(currentRef)!= recordMapAll.end()){// 2. Normal node, loop more
std::wstring str = recordMapAll[currentRef].fileNameWstr;
path = str + L"\\"+ path;GetCurrentFilePathV2(path, volName, recordMapAll[currentRef].pParentRef, rootRef, recordMapAll);}else{// 3. Some system files's root node is not in current folder
std::wstring str = L"?";
path = str + L"\\"+ path;return;}}