-
Notifications
You must be signed in to change notification settings - Fork 186
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
access_denied in CreateForMonitor in some cases #125
Comments
Generally there are a few conditions where CreateFromMonitor can give you an access denied error:
Aside from that, the API works best if used from the same user account as the interactive session. Using the SYSTEM account or calling from a non-interactive session is not supported at this time. |
Thanks for your answer In my cases, "If I switch Standard User Logon Windows, app works fine when double click run, but access_denied in CreateForMonitor when run as Administrator"
This is the reason?so even Administrator couldn't capture stantard user's monitor? case 3) The only clue I guess is the Electron's constraint, but I'm not familiar with it, so I don't kown why when run as admin, CreateFromMonitor return access denied error, LowIL? How to resolve this issue? or I can use DXGI? |
Running elevated as the same user shouldn't impact the capture API, but running as a different user will. You can give DDA a try, it is allowed as the SYSTEM user (and that will allow you to capture the secure desktop). What are the steps you take to run the application as administrator that causes it not to work? I can't repro this. |
Debug MFC app with VS2022(non-admin launch) Debug MFC app with VS2022(admin launch) GetProcessIL is from Cannot use IGraphicsCaptureItemInterop::CreateForWindow with electron apps #111 |
Hello,
I developed A.dll with OSB libs(use IGraphicsCaptureItemInterop::CreateForMonitor),A.dll used default UAC level like:
Three apps use A.dll :
1) C#(wpf) app doesn't have a UAC shield, when Administrator User Logon Windows, app works fine both when double click run and run as Administrator. I think the process level is right, so app works fine. If I switch Standard User Logon Windows, app works fine when double click run, but access_denied in CreateForMonitor when run as Administrator, in this case I think the process level or token info is not matched.
2)I also write a MFC demo with default UAC level(asInvoker), the running performance is the same as C# app
3)Electron app through C++ addons(wrapped with A.dll), when run use non-admin Powershell, it works fine, but it doesn't work when use admin Powershell(access_denied in CreateForMonitor)
I use VS2022 and log in to Windows as an administrator. I found that when I launch VS2022 and debug with electon app, it works fine, but it doesn't work when I launch VS2022 as an administrator. The running performance is the same as run with Powershell
so I'm confused,is it a program permission problem?
Some similar but unsolved issues:
Cannot use IGraphicsCaptureItemInterop::CreateForWindow with electron apps#111
winrt::hresult_access_denied in CreateForWindow in some cases#49
The text was updated successfully, but these errors were encountered: