Repository: microsoft/PowerToys
File: src/modules/Workspaces/WorkspacesSnapshotTool/SnapshotUtils.cpp (C++)

Code before:
        pe.dwSize = sizeof(PROCESSENTRY32);

        if (Process32First(h, &pe))
        {
            do
            {
                if (pe.th32ProcessID == pid)
                {
                    res = pe.th32ParentProcessID;
                }
            } while (Process32Next(h, &pe));
        }

        CloseHandle(h);
        return res;
    }

    bool IsFileManagerApp(std::wstring processPath)
    {
        std::wstring appName = std::filesystem::path(processPath).stem();
        std::transform(appName.begin(), appName.end(), appName.begin(), towupper);
        return ((appName == L"EXPLORER") // windows explorer
                || (appName.starts_with(L"TOTALCMD")) // total commander
                || (appName == L"DOPUS") // directory opus
                || (appName == L"Q-DIR") // Q-Dir
                || (appName.starts_with(L"XPLORER2"))); // Xplorer2
    }

    std::vector<WorkspacesData::WorkspacesProject::Application> GetApps(const std::function<unsigned int(HWND)> getMonitorNumberFromWindowHandle)
    {
        std::vector<WorkspacesData::WorkspacesProject::Application> apps{};

        auto installedApps = Utils::Apps::GetAppsList();
        auto windows = WindowEnumerator::Enumerate(WindowFilter::Filter);
        
        // for command line args detection
        // WbemHelper wbemHelper;
        // wbemHelper.Initialize();

        for (const auto window : windows)
        {
            // filter by window rect size
            RECT rect = WindowUtils::GetWindowRect(window);
            if (rect.right - rect.left <= 0 || rect.bottom - rect.top <= 0)
            {
                continue;
            }

            // filter by window title
            std::wstring title = WindowUtils::GetWindowTitle(window);
            if (title.empty())

Review comment (suggestion):
```suggestion
return ((appName == NonLocalizable::FileManagers::FileExplorer)
        || (appName.starts_with(NonLocalizable::FileManagers::TotalCommander))
        || (appName == NonLocalizable::FileManagers::DirectoryOpus)
        || (appName == NonLocalizable::FileManagers::QDir)
        || (appName.starts_with(NonLocalizable::FileManagers::Xplorer2)));
```

Code after:

        return false;
    }

    DWORD GetParentPid(DWORD pid)
    {
        DWORD res = 0;
        HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
        PROCESSENTRY32 pe = { 0 };
        pe.dwSize = sizeof(PROCESSENTRY32);

        if (Process32First(h, &pe))
        {
            do
            {
                if (pe.th32ProcessID == pid)
                {
                    res = pe.th32ParentProcessID;
                }
            } while (Process32Next(h, &pe));
        }

        CloseHandle(h);
        return res;
    }

    bool IsFileManagerApp(std::wstring processPath)
    {
        std::wstring appName = std::filesystem::path(processPath).stem();
        std::transform(appName.begin(), appName.end(), appName.begin(), towupper);
        return ((appName == NonLocalizable::FileManagers::FileExplorer)                 // windows explorer
                || (appName.starts_with(NonLocalizable::FileManagers::TotalCommander))  // total commander
                || (appName == NonLocalizable::FileManagers::DirectoryOpus)             // directory opus
                || (appName == NonLocalizable::FileManagers::QDir)                      // Q-Dir
                || (appName.starts_with(NonLocalizable::FileManagers::Xplorer2)));      // Xplorer2
    }

    std::vector<WorkspacesData::WorkspacesProject::Application> GetApps(const std::function<unsigned int(HWND)> getMonitorNumberFromWindowHandle)
    {
        std::vector<WorkspacesData::WorkspacesProject::Application> apps{};

        auto installedApps = Utils::Apps::GetAppsList();
        auto windows = WindowEnumerator::Enumerate(WindowFilter::Filter);
        
        // for command line args detection
        // WbemHelper wbemHelper;
        // wbemHelper.Initialize();

        for (const auto window : windows)
        {
            // filter by window rect size