Giter Club home page Giter Club logo

Comments (5)

robmikh avatar robmikh commented on June 14, 2024

Generally there are a few conditions where CreateFromMonitor can give you an access denied error:

  • MDM policy (if it works at all, it's not this)
  • App container (UWP)
  • LowIL

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.

from windows.ui.composition-win32-samples.

HuntCode avatar HuntCode commented on June 14, 2024

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"

Using the SYSTEM account or calling from a non-interactive session is not supported at this time.

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?

from windows.ui.composition-win32-samples.

robmikh avatar robmikh commented on June 14, 2024

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.

from windows.ui.composition-win32-samples.

HuntCode avatar HuntCode commented on June 14, 2024

Running elevated as the same user shouldn't impact the capture API, but running as a different user will.

Yes, I think this is the reason for my case 1) and 2),result like the table below:

Windows User Run as Admin C# MFC Demo
Administrator asInvoker(double click run) work fine work fine
Administrator Admin work fine work fine
Standard User asInvoker(double click run) work fine work fine
Standard User Admin don‘t work don‘t work

The dependence is app->A.dll->OBS libs(use IGraphicsCaptureItemInterop::CreateForMonitor)

This is not my key question, I can understand the reason you point out

What are the steps you take to run the application as administrator that causes it not to work? I can't repro this.

Sorry, maybe my description is not clear?

In case 3), I write an Electron app through C++ addons(wrapped with A.dll), the dependence is
Electron app->addon.node->A.dll->OBS libs(use IGraphicsCaptureItemInterop::CreateForMonitor)

Windows User Powershell Electron app
Administrator click run(non-admin) work fine
Administrator Run as Admin don‘t work
Windows User Debug with VS2022 Electron app C# MFC Demo
Administrator non-admin launch VS2022 work fine work fine work fine
Administrator Admin launch VS2022 don‘t work work fine work fine

Debug Electron app with VS2022(non-admin launch)
image
The IntegrityLevel is SECURITY_MANDATORY_MEDIUM_RID(8192) and the CreateForMonitor is OK, so can capture the monitor

Debug Electron app with VS2022(admin launch)
image
The IntegrityLevel is SECURITY_MANDATORY_HIGH_RID(12288) and the CreateForMonitor is access_denied, so can't capture the monitor

So I don't know if the electron has some constraint or something else?

from windows.ui.composition-win32-samples.

HuntCode avatar HuntCode commented on June 14, 2024

Debug MFC app with VS2022(non-admin launch)
image
The IntegrityLevel is SECURITY_MANDATORY_MEDIUM_RID(8192) and the CreateForMonitor is OK, so can capture the monitor

Debug MFC app with VS2022(admin launch)
image
The IntegrityLevel is SECURITY_MANDATORY_HIGH_RID(12288) and the CreateForMonitor is OK, so can capture the monitor

GetProcessIL is from Cannot use IGraphicsCaptureItemInterop::CreateForWindow with electron apps #111

from windows.ui.composition-win32-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.