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

access_denied in CreateForMonitor #40455

Closed
HuntCode opened this issue Nov 6, 2023 · 5 comments
Closed

access_denied in CreateForMonitor #40455

HuntCode opened this issue Nov 6, 2023 · 5 comments

Comments

@HuntCode
Copy link

HuntCode commented Nov 6, 2023

Hello,
I developed A.dll with OSB libs(use IGraphicsCaptureItemInterop::CreateForMonitor),when I write a addon.node with A.dll,it works fine when run with non-admin Powershell,but it doesn't work when run with amin Powershell. The results is same as I debug with VS2022

Details in access_denied in CreateForMonitor in some cases #125

I'm not familiar with Electron, so I'm confused with the different results between MFC and Electron apps

A LowIP or a cef sandbox problem?

@codebytere
Copy link
Member

We require the template to be filled out on all new issues and pull requests. We do this so that we can be certain we have all the information we need to address your submission efficiently. This allows the maintainers to spend more time fixing bugs, implementing enhancements, and reviewing and merging pull requests.

We will be able to more closely look at your issue once you do so. This issue will be closed in 10 days if the above is not addressed.

@codebytere codebytere added the blocked/need-repro Needs a test case to reproduce the bug label Nov 6, 2023
@electron-issue-triage
Copy link

Hello @HuntCode. Thanks for reporting this and helping to make Electron better!

Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.

Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.

Now adding the blocked/need-repro Needs a test case to reproduce the bug label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.

@HuntCode
Copy link
Author

HuntCode commented Nov 7, 2023

Thanks for your answer,I will close this issue and submit a new issue with bug template

@electron-issue-triage electron-issue-triage bot removed the blocked/need-repro Needs a test case to reproduce the bug label Nov 7, 2023
@HuntCode HuntCode closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2023
@shixiaolong-tech
Copy link

@HuntCode Have you fixed this problem? I come across the same problem with electron add-on when useing CreateForMonitor.

@HuntCode
Copy link
Author

@shixiaolong-tech I didn't fix this problem,but I had a workaround. I will check if the D3D11 supported,like this

bool SupportD3D11()
{
    auto activation_factory = winrt::get_activation_factory<
        winrt::Windows::Graphics::Capture::GraphicsCaptureItem>();
    auto interop_factory =
        activation_factory.as<IGraphicsCaptureItemInterop>();

    winrt::Windows::Graphics::Capture::GraphicsCaptureItem item = { nullptr };

    struct monitor_info monitor = { 0 };
    monitor.desired_id = 0;
    EnumDisplayMonitors(NULL, NULL, enum_monitor, (LPARAM)&monitor);

    const HRESULT hr = interop_factory->CreateForMonitor(
        monitor.handle,
        winrt::guid_of<ABI::Windows::Graphics::Capture::
        IGraphicsCaptureItem>(),
        reinterpret_cast<void**>(
            winrt::put_abi(item)));
    if (FAILED(hr))
    {
        blog(LOG_ERROR, "CreateForMonitor (0x%08X)", hr);
        return false;
    }

    return true;
       
}```

if D3D11 is not supported,I will use OpenGL

Hope this method could help you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants