sandboxie-plus / Sandboxie

Sandboxie Plus & Classic
https://Sandboxie-Plus.com
GNU General Public License v3.0
13.6k stars 1.51k forks source link

game frame/fps drop in sandboxie #3920

Open yosukira opened 4 months ago

yosukira commented 4 months ago

Describe what you noticed and did

V_8LDUX$_~BTE) DXDM@3CM UPV67 NJ%RR4T(2R7RTWXC im using 7800xt,the game outside sanboxie has like 200fps,while in sandboxie its only 50,sometimes drop to 30 or 40. and its very interesting that when i drop some other window on the game window(must cover some part of the game),the fps will gat back to 200,but if not covered,the fps is 50, as u can see the gpu usage is different in above two scenes. anyone got same problem and maybe figured out any solves?

How often did you encounter it so far?

always

Expected behavior

wish for the regular fps inside sandboxie

Affected program

the game is called starbreak,u can find it on steam

Download link

https://store.steampowered.com/app/420790/StarBreak/

Where is the program located?

The program is installed both inside and outside the sandbox.

Did the program or any related process close unexpectedly?

No, not at all.

Crash dump

No response

What version of Sandboxie are you running now?

newest version sandboxie,also sandboxie plus1.13.7

Is it a new installation of Sandboxie?

I recently did a new clean installation.

Is it a regression from previous versions?

No response

In which sandbox type you have this problem?

In a standard isolation sandbox (yellow sandbox icon).

Can you reproduce this problem on a new empty sandbox?

I can confirm it also on a new empty sandbox.

What is your Windows edition and version?

windows10 pro 22h2 19045.4412

In which Windows account you have this problem?

A local account (Administrator).

Please mention any installed security software

nothing at all

Did you previously enable some security policy settings outside Sandboxie?

No response

Trace log

No response

Sandboxie.ini configuration

No response

xsmolasses commented 4 months ago

Hope not to derail any investigation into this, as I do report opposite results with this game.

Steam's Game Overlay-based in-game FPS counter: Up to 800 fps Un-Sandboxed and glitches like a bad display cable! Up to 1500 fps within Sandboxie! (v1.14.0). No gfx corruption. lol

StarBreak: 1240x700; Full Screen & VSync unticked (FPS sampled at main menu screen while windowed.) +GameStream: Sunshine (v0.23.0). moonlight-qt (v5.0.1).

CPU: i9-10900KF GPU: RTX 2070

Windows 10 > 11 Pro 10.0.22631.3447; HDR expansion is such a mess. Hardware-accelerated GPU scheduling; Message Signaled Interrupts enabled;

Too many occulting variables. Wanna talk about weird interactions: For instance, unrelated to Sbie, I have to boot a VirtualBox guest to eliminate games (Crash Bandicoot) micro-stuttering on the host!

If my Sandboxie.ini can offer any insight relevant or adjacent...:

[GlobalSettings]

FileRootPath=\??\%SystemDrive%\Sandbox\%USER%\%SANDBOX%
KeyRootPath=\REGISTRY\USER\Sandbox_%USER%_%SANDBOX%
IpcRootPath=\Sandbox\%USER%\%SANDBOX%\Session_%SESSION%

#
TemplateReject=WindowsRasMan
TemplateReject=WindowsLive
TemplateReject=OfficeLicensing
TemplateReject=7zipShellEx
TemplateReject=WindowBlinds
TemplateReject=Edge_Fix
TemplateReject=Volumouse
#

#
UseFileDeleteV2=y
UseRegDeleteV2=y
UseVolumeSerialNumbers=n
#

#
SandboxieLogon=y
#

#
NotifyStartRunAccessDenied=y
#

# "Prevent interference with the user interface (Experimental)"
BlockInterferenceControl=y
# =y interferes with Notepad++ Document Map mouse click drag scroll

# "Prevent sandboxed processes from interfering with power operations (Experimental)"
BlockInterferePower=y

# Because the following cause so much more trouble,
# will enable these case by case; per Sandbox role.

# "Prevent sandboxed processes from capturing window images (Experimental, may cause UI glitches)
IsBlockCapture=n
# renamed to
BlockScreenCapture=n
# aka "Prevent sandboxed processes from using public methods to capture window images"

# "Prevents getting an image of the window in the sandbox"
IsProtectScreen=n
# renamed to
CoverBoxedWindows=n

#
LingerExemptWnds=y
#
LingerLeniency=y
#

#
BlockWinHooks=y
#

#
#AllowForceSystem=y
#

#
EnableWin32kHooks=y
#

#
UseSecurityMode=y
#

#
OpenPipePath=|\Device\Null
#

#
AllowBoxedJobs=y
#

#
BlockPassword=y
#
OpenLsaEndpoint=n
OpenSamEndpoint=n
OpenDevCMApi=n
OpenProtectedStorage=n
OpenCredentials=n
#

#
OpenClipboard=n
#

#
NotifyProcessAccessDenied=y
#

#
AllowRawDiskRead=n
NotifyDirectDiskAccess=y
#

#
#BUG: explicit StripSystemPrivileges=y reads status NOT SECURE
#StripSystemPrivileges=y
RunServicesAsSystem=n
# RunServicesAsSystem=y incompatible with ProtectRpcSs=y ?
ProtectRpcSs=y
#

#
DontOpenForBoxed=n
#

#
ProtectHostImages=n
NotifyImageLoadDenied=y
#

#
HideOtherBoxes=y
#

#
HideHostProcess=SandMan.exe
#
HideHostProcess=SandboxieDcomLaunch.exe
HideHostProcess=SandboxieRpcSs.exe
#
HideHostProcess=conhost.exe
HideHostProcess=cmd.exe
HideHostProcess=explorer.exe
HideHostProcess=msedge.exe
HideHostProcess=svchost.exe
HideHostProcess=smartscreen.exe
HideHostProcess=rundll32.exe
HideHostProcess=dllhost.exe
HideHostProcess=SystemSettingsBroker.exe
HideHostProcess=RuntimeBroker.exe
HideHostProcess=ApplicationFrameHost.exe
HideHostProcess=SecurityHealthSystray.exe
HideHostProcess=TextInputHost.exe
HideHostProcess=SearchApp.exe
HideHostProcess=ShellExperienceHost.exe
HideHostProcess=CompPkgSrv.exe
HideHostProcess=StartMenuExperienceHost.exe
HideHostProcess=taskhostw.exe
HideHostProcess=sihost.exe

HideHostProcess=hh.exe
HideHostProcess=notepad.exe

HideHostProcess=sunshine.exe
HideHostProcess=sunshinesvc.exe

HideHostProcess=tvnserver.exe
HideHostProcess=Everything64.exe

HideHostProcess=StreamDeck.exe

HideHostProcess=pfmhost.exe
HideHostProcess=pfmstat.exe
HideHostProcess=OpenRGB.exe

HideHostProcess=NirLauncher.exe

HideHostProcess=AutoHotkeyA32.exe
HideHostProcess=AutoHotkeyU32.exe
HideHostProcess=AutoHotkeyU64.exe

HideHostProcess=python.exe

HideHostProcess=notepad++.exe

#
BlockWinRM=y
#

UseRuleSpecificity=y

UsePrivacyMode=y

# disable BITS
ClosedClsid={4991D34B-80A1-4291-83B6-3328366B9097}
#

#
#Template=Local_PersonalBlock
#Template=Local_Blacklist
#Template=Local_RegPrivacyMode
#Template=Local_SysPrivacyMode
#Template=Local_SamPrivacyMode
#Template=Local_CatPrivacyMode
#Template=Local_AppPrivacyMode
#Template=Local_AltPrivacyMode
#

#
#ClosePrintSpooler=
#OpenPrintSpooler=
#AllowSpoolerPrintToFile=
#

#
ReadFilePath=|C:\Program Files\7-Zip\*
#

#
WriteFilePath=*\WerFault.exe

#
WriteFilePath=C:\Program Files\Sandboxie-Plus\Certificate.dat
WriteFilePath=C:\Program Files\Sandboxie-Plus\Sandboxie.ini
WriteFilePath=C:\Windows\Sandboxie.ini
#

ForceDisableAdminOnly=y
#ForceDisableSeconds=86400
NotifyForceProcessDisabled=y

EditAdminOnly=y

#NetworkEnableWFP=y
#PromptForInternetAccess=n

BlockNetworkFiles=y
BlockNetParam=y

#NotifyInternetAccessDenied=y

# My networking rules, I have omitted.

[Template_Local_Xbox_Wireless_Adaptor]
Tmpl.Title=Local Xbox Wireless Adaptor
Tmpl.Class=Local

# Xbox Wireless Adapter for Windows
NormalFilePath=|\Device\0000????

[Template_Local_Steam]
Tmpl.Title=Local Steam
Tmpl.Class=Local

Template=Local_Xbox_Wireless_Adaptor

#
IsProtectScreen=n
CoverBoxedWindows=n
#
IsBlockCapture=n
BlockScreenCapture=n
#

#
AllowRawDiskRead=n
NotifyDirectDiskAccess=y
#

#
ProtectHostImages=n
#

#
DontOpenForBoxed=n
UseRuleSpecificity=y
#

#
UsePrivacyMode=y
#

# temporary login workaround for NoSecurityIsolation=y
ReadIpcPath=\RPC Control\protected_storage
#

#
StartProgram=CMD /C"MKDIR "%UserProfile%\AppData\Roaming\Microsoft""
StartProgram=CMD /C"MKDIR "%UserProfile%\Documents""
StartProgram=CMD /C"MKDIR "%UserProfile%\Desktop""
#

#
NormalFilePath=|%SystemRoot%\*
#

# Yeah, well, I have a hybrid Steam setup and still ironing out the kinks.
OpenPipePath=|C:\Program Files (x86)\Steam\*
OpenPipePath=|C:\Program Files (x86)\Common Files\Steam\*
#

#
ProcessGroup=<Steam>,steam.exe,steamservice.exe
#

#
OpenPipePath=<Steam>,|C:\Program Files (x86)\Steam\steamapps\*
OpenPipePath=<Steam>,|A:\SteamLibrary\*
#
NormalFilePath=!<Steam>,|C:\Program Files (x86)\Steam\steamapps\*
NormalFilePath=!<Steam>,|A:\SteamLibrary\steamapps\*
#

# Microsoft Shared\XNA
# CRYPTARK;
ReadFilePath=|C:\Program Files (x86)\Common Files\Microsoft Shared\XNA\*
#

# Spider-Man doesn't seem to need whatever junk this is
ClosedFilePath=|*\crs-handler.exe
#

# Restrict until something breaks!
ClosedFilePath=*\CompPkgSrv.exe
ClosedFilePath=*\RuntimeBroker.exe
#

[Steam_GameStream]
Enabled=y

Template=AutoRecoverIgnore
Template=OpenBluetooth
Template=SkipHook
Template=FileCopy
Template=qWave
Template=BlockPorts
Template=LingerPrograms
BorderColor=#1A9FFF,ttl,5
BoxNameTitle=-

NotifyInternetAccessDenied=y

#
NoSecurityIsolation=y
#
UseSecurityMode=y
#
SysCallLockDown=y
RestrictDevices=y
DropAdminRights=y
#
FakeAdminRights=y
#

Template=Local_Steam

BlockNetworkFiles=y

ConfigLevel=10

OpenClipboard=n
xsmolasses commented 4 months ago

Entered the game tutorial (given net access), and FPS now sits at 170, which would be a tie were it not for the very unsteady sandboxed framerate because (I didn't take notice before) when moving the mouse in circles the engine stalls, to a standstill with rapid movement; even holding any key sees a 25% drop in fps. Not seeing mentioned Window obscuring performance recovery thing, though I'd say a problem confirmed and worth looking into. May be an optimization opportunity; an unveiling of something clumsy!?

xsmolasses commented 4 months ago

Well, this is awkward or perfect timing ? Today it was exact same issue [with crippling performance impact as I described] but from a game I run on the daily - Noita!

So I close all the crypto miners, jk, yet freeing the CPU to idle had no effect, except when I terminated, I think the following processes then Noita and StarBreak came good, better than ever - but a mystery as to why it was only affecting the Sandboxed instances - even tried at random Sbie v1.10.0 (without rebooting).

Killed (having no inkling they were causing any havoc at the time): widgets.exe; tvnserver.exe; wfcui.exe; wfcs.exe; sunshine.exe; sunshinesvc.exe

(My system is in fact hosed at the moment, pre-existing to all this, I've had no use of the shell/taskbar (crashes 'cause perilous adventures in HKCR\CLSID land), just resorting to alt+tabbing, but that's a separate matter that I plan on addressing today with a clean install of Windows 10 Pro; [19045.4412] (Updated May 2024) .iso out now!)

So, perhaps disregard my previous posting a supposed confirmation; until I can reproduce this significant problem again.

xsmolasses commented 4 months ago

The culprit was actually NirSoft's Volumouse and its seemingly unnecessary system wide message hook. ^ in my case Reproduced on another PC. Issue isolated: https://github.com/xsmolasses/SetWindowsHookExcessMolasses

The peculiar thing, the dll's NOT actually loaded OR hooked ANY sandboxed process OR message queue?!

Most pervasive on the gaming PC when circling mouse on 120 Hz desktop display mode; is good to know!

32-bit: Destropolis; Noita; StarBreak; every other game and process? (Most resilience: Samorost 2 ;)

64-bit (start respective hooking dll): HELLDIVERS Dive Harder Edition; every other game and process?

Un-Sandboxed 0 hook: Noita 60 FPS 1 hook: Noita 49-55 FPS 2 hook: Noita 31-47 FPS

Sandboxed 0 hook: Noita 60 FPS 1 hook: Noita 0 FPS (Not when Fullscreen Exclusive because caps at 60 Hz case then less pronounced.)

JimmisAtha commented 3 months ago

Also, Sandboxie would be awesome to emulate Win7 (needed for some games, compatibility mode doesn't work e.g. Fallout NV). Imagine right click - "run in Win7" option!!!