| 1640 | |
| 1641 | |
| 1642 | void WindowSearch::UpdateCandidateAttributes() |
| 1643 | // This function must be kept thread-safe because it may be called (indirectly) by hook thread too. |
| 1644 | { |
| 1645 | // Nothing to do until SetCandidate() is called with a non-NULL candidate and SetCriteria() |
| 1646 | // has been called for the first time (otherwise, mCriterionExcludeTitle and other things |
| 1647 | // are not yet initialized: |
| 1648 | if (!mCandidateParent || !mCriteria) |
| 1649 | return; |
| 1650 | if ((mCriteria & CRITERION_TITLE) || *mCriterionExcludeTitle) // Need the window's title in both these cases. |
| 1651 | if (!GetWindowText(mCandidateParent, mCandidateTitle, _countof(mCandidateTitle))) |
| 1652 | *mCandidateTitle = '\0'; // Failure or blank title is okay. |
| 1653 | if (mCriteria & CRITERION_PID) // In which case mCriterionPID should already be filled in, though it might be an explicitly specified zero. |
| 1654 | GetWindowThreadProcessId(mCandidateParent, &mCandidatePID); |
| 1655 | if (mCriteria & CRITERION_PATH) |
| 1656 | { |
| 1657 | DWORD dwPid; |
| 1658 | if (GetWindowThreadProcessId(mCandidateParent, &dwPid)) |
| 1659 | if (!GetProcessName(dwPid, mCandidatePath, _countof(mCandidatePath), mCriterionPathIsNameOnly)) |
| 1660 | *mCandidatePath = '\0'; |
| 1661 | } |
| 1662 | if (mCriteria & CRITERION_CLASS) |
| 1663 | GetClassName(mCandidateParent, mCandidateClass, _countof(mCandidateClass)); // Limit to WINDOW_CLASS_SIZE in this case since that's the maximum that can be searched. |
| 1664 | // Nothing to do for these: |
| 1665 | //CRITERION_GROUP: Can't be pre-processed at this stage. |
| 1666 | //CRITERION_ID: It is mCandidateParent, which has already been set by SetCandidate(). |
| 1667 | } |
| 1668 | |
| 1669 | |
| 1670 |
nothing calls this directly
no test coverage detected