-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Processes run as admin don't show up in WindowUtils.getAllWindows(boolean) #1269
Comments
I tested with my JNA build machine and can not verify this finding. Running as the main user of the system, I get all windows, regardless whether they are started "As Administrator" or not. I see test errors for x86 on appveyor, that might be the same problem, but this is all not reproducable and currently speculation what is the reason. Could you investigate, what is required to reproduce? |
I tested some more and read some more and this leads me to the question: What is the architecture your JVM is running on? Could it be, that it is a 32bit process? I found some documentation, that reading data from a 64bit process, when the calling process is 32 bit might fail, because the pointer is truncated when passed. |
I should first mention that this code used to work for me just fine, even when running as admin. I don't know what happened but at some point it just broke (iirc after a Windows Update), and after it broke I found out that running without admin made it work again. So as I was writing my response here, I added in a I've included the code I'm running at the bottom of this comment. It simply prints Here's the relevant part of the output, when I've run my music player (
(>>> added for clarity) The When I exit clementine and re-run without admin, I see this:
So somehow running as admin is making it so that OK sorry for the stream-of-consciousness writing but I just tried running a different 32-bit process (Skype) as admin and the filepath is missing for it too now! The output when I run Skype as admin is: Just checked the only other convenient 32-bit process I have on hand (Discord) and it does the same: Normal: So, conclusion from these new observations: Running a 32-bit process as admin may cause
|
Ah - I suspect your user has less privileges than my test user and you might hit his:
With a debugger and a break point on the return you should be able to check the problem. |
Please check latest master - it might help your case. |
When an executable is run with "Run this program as an administrator" toggled on in Compatibility settings in Windows 10, it appears to not show up in calls to
WindowUtils.getAllWindows(boolean)
.I guess this may be intentional as a restriction of the OS, and might be bypassed by running the Java process as admin, but perhaps it's worth mentioning in the docs somewhere (if it's not already)? Just spent a fair chunk of time trying to figure out why a process was missing from the list of DesktopWindows that is returned. I admit I haven't spent much time looking into it, was just glad to realize that turning off the "Run as admin" toggle made the process show up again. I figure even if it doesn't warrant a minor update to the docs it can't hurt to document it as an issue here for posterity!
(this is on latest JNA)
The text was updated successfully, but these errors were encountered: