Skip to content

Fix GetWindowTitle to use EnumWindows API instead of reading PEB#88

Closed
Copilot wants to merge 5 commits intowindow-titlefrom
copilot/sub-pr-87
Closed

Fix GetWindowTitle to use EnumWindows API instead of reading PEB#88
Copilot wants to merge 5 commits intowindow-titlefrom
copilot/sub-pr-87

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

Window titles cannot be read from the PEB (Process Environment Block). The previous implementation attempted to read from various PEB offsets (0xB0/0x70, 0x50/0x60), but RTL_USER_PROCESS_PARAMETERS only contains CommandLine, ImagePathName, and CurrentDirectory—not WindowTitle.

Changes

  • Replaced PEB memory reading (335 lines) with EnumWindows API (58 lines)

    • Enumerate all top-level windows via EnumWindows
    • Match windows to target process using GetWindowThreadProcessId
    • Filter for visible windows with titles
    • Prioritize main windows (no owner, not a tool window)
    • Return empty string for headless processes
  • API corrections

    • Use GetWindowLongPtr instead of deprecated GetWindowLong for 64-bit compatibility

Rationale

Window titles are properties of HWND (window handles), not processes. The correct approach is window enumeration, not process memory inspection.

Expected behavior

explorer.exe  → "C:\Users\..."     (folder window title)
notepad.exe   → "Untitled - Notepad"
svchost.exe   → "svchost.exe"      (no window, fallback to process name)
win-witr.exe  → "Windows - Why Is This Running?"

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 13, 2026 18:24
Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
…uplication

Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 13, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/supervoidcoder/win-witr/actions/runs/21998053117
    • Triggering command: /usr/bin/curl curl -sL -H Accept: application/vnd.github&#43;json REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add window title display for process inspection Fix GetWindowTitle to use EnumWindows API instead of reading PEB Feb 13, 2026
Copilot AI requested a review from supervoidcoder February 13, 2026 18:30
@supervoidcoder
Copy link
Owner

stupid slop this crap ain't even compile you dimwitted clanker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants