Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PT Run] [WindowWalker] Process ID is zero for win32 apps #15326

Closed
1 task
htcfreek opened this issue Jan 7, 2022 · 8 comments
Closed
1 task

[PT Run] [WindowWalker] Process ID is zero for win32 apps #15326

htcfreek opened this issue Jan 7, 2022 · 8 comments
Assignees
Labels
Issue-Bug Something isn't working Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@htcfreek
Copy link
Collaborator

htcfreek commented Jan 7, 2022

Microsoft PowerToys version

0.53.1

Running as admin

  • Yes

Area(s) with issue?

PowerToys Run

Steps to reproduce

While working on the code for #6084 I detected that the process ID of the detected windows is incorrect/zero. It only happens on non-packaged apps.

Note: I use the NativeMethods.cs from PR #15186.

✔️ Expected Behavior

Correct PID.

❌ Actual Behavior

It is incorrect for non-packaged apps:
image

It is correct for packaged apps and the process that is shown for it:
image

Other Software

No response

@htcfreek htcfreek added Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Product-PowerToys Run Improved app launch PT Run (Win+R) Window Status-In progress This issue or work-item is under development and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Jan 7, 2022
@htcfreek htcfreek self-assigned this Jan 7, 2022
htcfreek added a commit to htcfreek/PowerToys that referenced this issue Jan 7, 2022
@htcfreek
Copy link
Collaborator Author

htcfreek commented Jan 7, 2022

@davidegiacometti
Do you have an idea why the PID for win32 apps is only available if I add this additional assignment (5b9b632)? For title and process name it works as expected without such an assignment.

@davidegiacometti
Copy link
Collaborator

@davidegiacometti Do you have an idea why the PID for win32 apps is only available if I add this additional assignment (5b9b632)? For title and process name it works as expected without such an assignment.

Not sure. Does it happen with programs that aren't running elevated?

@htcfreek
Copy link
Collaborator Author

htcfreek commented Jan 7, 2022

@davidegiacometti Do you have an idea why the PID for win32 apps is only available if I add this additional assignment (5b9b632)? For title and process name it works as expected without such an assignment.

Not sure. Does it happen with programs that aren't running elevated?

every one. I don't understand why it's gone and only for win32. It seems that we instantiate the windows on every query but keep the window cache as static class variable.
The debug output show that it is set and gets lost at some point. 🤨

Maybe we should look when the windows gets instanced and maybe we should rework the entire class.

I don't like the fix I have added. It feels a bit ugly.

@htcfreek
Copy link
Collaborator Author

htcfreek commented Jan 7, 2022

@davidegiacometti Do you have an idea why the PID for win32 apps is only available if I add this additional assignment (5b9b632)? For title and process name it works as expected without such an assignment.

Not sure. Does it happen with programs that aren't running elevated?

every one. I don't understand why it's gone and only for win32. It seems that we instantiate the windows on every query but keep the window cache as static class variable.
The debug output show that it is set and gets lost at some point. 🤨

Maybe we should look when the windows gets instanced and maybe we should rework the entire class.

I don't like the fix I have added. It feels a bit ugly.

@davidegiacometti
I have looked into it. I will rework some parts of the class (process name, PID detection).

htcfreek added a commit to htcfreek/PowerToys that referenced this issue Jan 8, 2022
@htcfreek
Copy link
Collaborator Author

htcfreek commented Jan 8, 2022

@davidegiacometti
I have improved the code and now it works as expected. And it seems that the plugin works now faster. ;-)

@htcfreek htcfreek changed the title [PT Run] [WindowWalker] Incorrect process ID [PT Run] [WindowWalker] Process ID is zero for win32 apps Jan 8, 2022
@htcfreek htcfreek added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development labels Jan 25, 2022
@htcfreek
Copy link
Collaborator Author

@crutkas
Please update the assigned project.

@Aaron-Junker
Copy link
Collaborator

@htcfreek done

@crutkas
Copy link
Member

crutkas commented Jan 31, 2022

The was fixed in in 0.55. Head over to https://aka.ms/installpowertoys to try it out

@crutkas crutkas closed this as completed Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Something isn't working Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

No branches or pull requests

4 participants