MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / forEachEntry

Method forEachEntry

src/envfs.cpp:331–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331void DirectoryWalker::forEachEntry(const std::wstring& path, void* cx,
332 DirStartF* dirStartF, DirEndF* dirEndF, FileF* fileF)
333{
334 auto& hc = g_handleClosers.request();
335
336 if (!NtOpenFile) {
337 LibraryPtr m(::LoadLibraryW(L"ntdll.dll"));
338 NtOpenFile = (NtOpenFile_type)::GetProcAddress(m.get(), "NtOpenFile");
339 NtQueryDirectoryFile =
340 (NtQueryDirectoryFile_type)::GetProcAddress(m.get(), "NtQueryDirectoryFile");
341 NtClose = (NtClose_type)::GetProcAddress(m.get(), "NtClose");
342 }
343
344 const std::wstring ntpath = makeNtPath(path);
345
346 UNICODE_STRING ObjectName = {};
347 ObjectName.Buffer = const_cast<wchar_t*>(ntpath.c_str());
348 ObjectName.Length = (USHORT)ntpath.size() * sizeof(wchar_t);
349 ObjectName.MaximumLength = ObjectName.Length;
350
351 OBJECT_ATTRIBUTES oa = {};
352 oa.Length = sizeof(oa);
353 oa.ObjectName = &ObjectName;
354
355 forEachEntryImpl(cx, hc, m_buffers, &oa, 0, dirStartF, dirEndF, fileF);
356 hc.wakeup();
357}
358
359void forEachEntry(const std::wstring& path, void* cx, DirStartF* dirStartF,
360 DirEndF* dirEndF, FileF* fileF)

Callers 2

forEachEntryFunction · 0.80
addFilesMethod · 0.80

Calls 5

makeNtPathFunction · 0.85
forEachEntryImplFunction · 0.85
getMethod · 0.45
sizeMethod · 0.45
wakeupMethod · 0.45

Tested by

no test coverage detected