Skip to content

Don't fail scaling on unreadable integrity level when elevated#1428

Closed
Kamefrede wants to merge 1 commit into
Blinue:devfrom
Kamefrede:dev
Closed

Don't fail scaling on unreadable integrity level when elevated#1428
Kamefrede wants to merge 1 commit into
Blinue:devfrom
Kamefrede:dev

Conversation

@Kamefrede

Copy link
Copy Markdown

Description

SrcTracker::Set rejects scaling with ScalingError:LowIntegrityLevel and shows the run as administrator toast in two different scenarios, and treats them indetically:

  1. When the source window has a higher integrity than Magpie
  2. When Magpie can't determine the source window's integrity

The second scenario occurs when a handle to the source process can't be opened (GetProcessHandleFromHwnd returns ERROR_ACCESS_DENIED). This is common on games protected by anti-cheat driver.

When this happens, Magpie prompts the user saying that for it to scale the window it needs to be running as administrator, which can be misleading in case if it is already running as administrator.

Change

When the integrity level can't be read because the process handle can't be opened and Magpie is running with elevated privileges, log a warning and proceed instead of failing.

This should be ok in most scenarios as Windows.Graphics.Capture operates at the compositor level and does not need the source process.

Video

Before the change

devenv_z7pUX6dZpK.mp4

After the change

devenv_yBgyBZUyhp.mp4

}
} else if (currentIL >= SECURITY_MANDATORY_HIGH_RID &&
!Win32Helper::GetWindowProcessHandle(hWnd)) {
Logger::Get().Warn("Cannot read source window integrity level; process is elevated, proceeding anyway");

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know Mandarin and I didn't want to put an AI translated message here, so if anyone could advise I'd be grateful

@Blinue

Blinue commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution. The integrity level check exists to prevent operations such as changing the cursor position or foreground window from being blocked by UIPI. This is especially important for windowed mode scaling.

When Magpie is running with administrator privileges, refusing to scale if it cannot obtain a handle to the game process is intentional (although I agree the current error message is misleading). The reasoning is that if a game has protection mechanisms in place, attempting to manipulate its window is inherently risky, and there’s no guarantee those operations will succeed.

You can certainly modify the code to force scaling, but you'll need to do so at your own risk.

@Kamefrede

Copy link
Copy Markdown
Author

I see, I wasn't aware of that.
My knowledge of Windows internals is still very small, thank you for taking the time to explain it!
I'll close the PR and keep this in my fork, that way if anyone else has this issue and wants to take a risk themselves, they can just cherry pick the commit!

@Kamefrede Kamefrede closed this Jul 13, 2026
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

Successfully merging this pull request may close these issues.

2 participants