Skip to content

Graphics Capture doesn't work when running as different user? #54

@elvissteinjr

Description

@elvissteinjr

Been a while, but it's me again. Hopefully I didn't miss anything obvious this time.

The scenario is the following:
A user of my application is using a standard user account for daily use, but needs to run my application as administrator sometimes. They are launching the application from their standard account, but as the separate admin account (as opposed to straight elevating from an admin account).

In this scenario, Graphics Capture appears to be unavailable. Win32CaptureSample crashes, but this is recoverable by catching exceptions when calling GraphicsCaptureSession::IsSupported().
From what I've observed, it throws winrt::hresult_error (0x80070424, "Service does not exist" afaik) on Windows 11 and std::bad_alloc on Windows 10 (haven't gone through all major versions though). The latter threw me off as I was only catching winrt::hresult_error in my app, which seemed to be good enough on older versions of Windows that didn't support Graphics Capture.

I suppose I can at least not crash with this, but I've been wondering if this is intentional. Guess the desktop and windows of another user may be inaccessible here? The way it fails is a bit unexpected though, and Desktop Duplication still works fine.

I don't disagree if the answer is just "don't do that". Their case here is that they have things in the chain that need admin (Steam with some launchers apparently) and my application is affected down the line (SteamVR as another user won't connect to my app).
Admin account just elevating when necessary works fine, of course.

This more of an API question again, I suppose (unless you want to catch this in the sample), but I'm thankful that you can be reached through this project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-bugA bug in the underlying Windows APIs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions