On Thu Apr 13 13:29:33 2023 +0000, Alexandros Frantzis wrote:
... You'll probably get a HWND for it, but NtUserGetWindowThread
returns nothing yet.
You're working around it in get_desktop_process_id by returning
GetCurrentProcessId() in case things failed, but that looks wrong imho, and instead you should probably try to make this work without having to guess the desktop process id. I have been looking at the relevant code paths and experimenting with a few alternatives, and it seems that getting an invalid desktop HWND during process startup combined with the process path having the "c:\windows\system32\explorer.exe /desktop..." form, should be a reliable indicator of being in the desktop window process. What do you think?
I'm not completely sure why this if statement is needed.
For me the only reason this if statement should be here would be for security or stability purposes.
But after looking at the code I'm not sure what security improvement this if statement introduce...
If it's for stability and the code should not be called outside the desktop window thread, adding some logging seems more like welcome here.
And if it's neither for security or stability purposes I think it would be a better idea to put the if statement somewhere else, because putting a if statement for a specific window that deep into a core part of `winewayland.drv` feel more like a workaround.