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

Double-click video opens forced MPC-BE without video file in commandline #3791

Open
MrSmite opened this issue Apr 6, 2024 · 13 comments
Open
Labels
more info needed More information is needed to move forward Workaround Temporary or alternative solution

Comments

@MrSmite
Copy link

MrSmite commented Apr 6, 2024

Describe what you noticed and did

I have MPC-BE set as default for audio/video in windows 10. In Sandboxie-Plus I have the following setting:

Forced program: mpc-be64.exe
Resource Access: Program: mpc-be64.exe Access: open Path: *.*

When I double-click a video file in Explorer, MPC-BE opens in the sandbox but it does not include the video file on the commandline so no file is opened. If I right-click the video file in Explorer and choose "Run Sandboxed", MPC-BE opens in the sandbox and properly plays the video file.

Notes:

  • This does not happen with MPC-HC but this player is very old and unstable
  • When observing the Sandboxie GUI, I see different behavior for different open methods:
  1. Double-Click opens two instances of MPC-BE64.exe in the sandbox and after a few seconds, terminates the first process. The second remaining process contains no file to play. This also leaves the spinning mouse pointer in Windows and has a chance to crash Explorer if you try to close it.

  2. Right-click and "open in sandbox" only opens a single instance of MPC-BE64.exe which contains the file and plays properly

How often did you encounter it so far?

Always

Expected behavior

Double-clicking a video file should open the forced program in the sandbox and play

Affected program

MPC-BE64.exe

Download link

https://sourceforge.net/projects/mpcbe/files/MPC-BE/Release%20builds/

Where is the program located?

The program is installed only 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?

1.13.4 64-bit

Is it a new installation of Sandboxie?

I recently did a new clean installation.

Is it a regression from previous versions?

Don't know

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?

Windows 10 Pro H22 64-bit

In which Windows account you have this problem?

A local account (Administrator).

Please mention any installed security software

Norton 360

Did you previously enable some security policy settings outside Sandboxie?

No

Trace log

No response

Sandboxie.ini configuration

No response

@MrSmite MrSmite added the Confirmation pending Further confirmation is requested label Apr 6, 2024
@MrSmite MrSmite changed the title MPC-BE opens in sandbox without video file (double-click) Double-click video opens forced MPC-BE without video file in commandline Apr 6, 2024
@offhub
Copy link
Collaborator

offhub commented Apr 6, 2024

Please test to see if NoRestartOnPCA=y solves your issue.

@MrSmite
Copy link
Author

MrSmite commented Apr 9, 2024

NoRestartOnPAC=y

Thanks for the suggestion, I just checked the sandbox's INI and that setting already exists.

Further testing shows that MPC-BE offers two right-click options on a video file: "Play with MPC-BE" or "Add to MPC-BE playlist". In both cases, the double instance of MPC-BE opens but no file is on the commandline. In the second instance, viewing the playlist is empty.

This might be helpful: I loaded the RegHive file from the sandbox into HKLM as a temporary key and I noticed it didn't include a complete copy of the MPC-BE registry entries. It only included:

user\Software\MPC-BE.Shellext\(REG_DWORD) MultipleInstances

but there should be two keys, each with several key/value pairss:

HKCU\Software\MPC-BE\ShellExt
HKCU\Software\MPC-BE.ShellExt

It also didn't contain any of the information from HKCR such as: mpc-be64.avi, mpc-be64.mkv which define the shell commands that are created when you set it as the default application. I used "Delete content" and tried again just to make sure there wasn't some kind of copy error.

As for the Explorer issue, if you close MPC-BE when it opens without the file, the cursor will continue to "wait" and if you click on a file the whole window will turn white. If you attempt to close it at this point, it will crash. If you wait about 30 to 60 seconds and don't click anything, it will return to normal.

Finally, to clarify the "Multiple Instances" registry entry corresponds to the player's setting : "New process for every file"

@offhub
Copy link
Collaborator

offhub commented Apr 9, 2024

Sorry, I wrote it wrong. Try changing the PAC section at the end of that setting to PCA.

NoRestartOnPCA=y

@MrSmite
Copy link
Author

MrSmite commented Apr 9, 2024

That changed it so only one instance of MPC-BE64.exe opens but it still does not have the filename on the commandline so nothing plays. I also tried a couple more tests:

  1. Right-click the mpc-be64.exe process in Sandboxie and choose "preset / pin to run menu"
  2. Right-click the sandbox, choose "Run" then "mpc-be64.exe"

This results in Start.exe launching a single instance of mpc-be64.exe instead of two instances and terminating one. Of course there was no filename supplied, I was testing how many instances of the program appeared.

  1. Right-click the sandbox, choose "Run / run program"
  2. Enter the full path to a video file

This launched Start.exe which then launched mpc-be64.exe and did not include the filename in the commandline section of the main Sandboxie window but it did play the file

  1. Right-click the sandbox, choose "Run / run program"
  2. Enter the full path to mpc-be64.exe a space and the full quoted path to a video file

This launched Start.exe which then launched mpc-be64.exe and included the filename in the commandline section of the main Sandboxie window and also played the file

@xsmolasses
Copy link

My inference-based guess is:

Presence of (thereby "registered" ?), e.g., HKEY_CLASSES_ROOT\mpc-be64.mp4\shell\open\DropTarget" with CLSID,
makes Explorer unintuitively open with this drag-and-Drop handler, which communicates via COM interface.

But that's between Explorer and MPC-BE's shell extension, the latter which, when the setting is not wanting multiple MPC-BE instances, -- and failing to find any, starts a new MPC-BE instance -- then waits around to find (foreground-most [recently active] by intrinsic z-order), a MPC-BE window via its Class name, then sends (blocking for a "reply") Window Message, WM_COPYDATA, consisting of filename argument(s) that is parsed as if passed in via command line parameters and not processed by user "MPC" API commands through the same message channel.

The issue is Sandboxie prefixes Window Class names like Sandbox:YOUR_SANDBOX_NAME:REAL_CLASS_NAME and MPC-BE's shell extension cannot find an exact match, so we must disable Sandboxie's renaming of Window Class names.

#OpenWinClass=#
# which does just that, doesn't rename Window Classes;
# and applies to all Window Class names within a Sandbox.
# or better yet, be explicit:
OpenWinClass=MPC-BE
# not renaming given Class name is apparently a side-effect of this form,
# which is intended for messages outbound to processes not sandboxed.

@MrSmite
Copy link
Author

MrSmite commented Apr 9, 2024

Since every method of opening it with Start.exe works, would it not be possible to capture the double-clicked forced program and reopen it with Start.exe? Maybe a new column with a check box on the forced programs tab:

"Always use Start.exe"

so users can set that if they encounter other programs that behave this way.

@offhub
Copy link
Collaborator

offhub commented Apr 9, 2024

This setting should fix the issue.

NoRenameWinClass=mpc-be64.exe,*

or

NoRenameWinClass=MPC-BE

offhub added a commit to offhub/Sandboxie that referenced this issue Apr 9, 2024
Update for Template_MPC-BE_Force sandboxie-plus#3791
@offhub offhub added the Workaround Temporary or alternative solution label Apr 9, 2024
@MrSmite
Copy link
Author

MrSmite commented Apr 9, 2024

Is there a way to test this locally or does it require a new build? I opened the INI to edit it and it says:

# A template section (official or local) may only contain the
# following settings:
#
# Tmpl.Title
# Tmpl.Class
# Tmpl.Url
# Tmpl.Comment
# Tmpl.Scan
# OpenFilePath
# OpenPipePath
# ReadFilePath
# ClosedFilePath
# OpenKeyPath
# ReadKeyPath
# ClosedKeyPath
# OpenIpcPath
# ClosedIpcPath
# OpenWinclass
# OpenClsid
# RecoverFolder
# AutoRecoverIgnore
# ForceProcess
# ForceFolder
# OpenProtectedStorage
# OpenCredentials
# ProcessGroup
#
# Any other settings must not be used, as it may confuse the
# Sandbox Control program.

Notice that NoRenameWinClass is not allowed. I copied the MPC-BE section from the merge here but it didn't solve the issue.

@offhub
Copy link
Collaborator

offhub commented Apr 9, 2024

Have you enabled the MPC-BE_Force template? If you haven't enabled it, add one of the above settings to your sandbox configuration.

sbie3791.mp4

@MrSmite
Copy link
Author

MrSmite commented Apr 10, 2024

Thank you, I hadn't done that because I still had the program listed under the "forced programs" tab and it wasn't clear that I needed to add the template to force it if I was already forcing it.

It does take a while to load, even with file migration disabled but at least it is working. Closing as fixed.

@MrSmite MrSmite closed this as completed Apr 10, 2024
@offhub offhub removed the Confirmation pending Further confirmation is requested label Apr 10, 2024
@MrSmite
Copy link
Author

MrSmite commented Apr 13, 2024

After adding the fix above, I started getting this error when I double-click a video but mpc-be.exe and the video still open sandboxed:

mpc-be64.exe: SBIE2203 Failed to communicate with Sandboxie Service: *GUIPROXY_00000001; MsgId: 19 - mpc-be64.exe [00000102]

@MrSmite MrSmite reopened this Apr 13, 2024
@offhub
Copy link
Collaborator

offhub commented Apr 13, 2024

Immediately after opening or after a certain period of time? I did not encounter any error messages in the virtual machine.

@offhub offhub added the more info needed More information is needed to move forward label Apr 14, 2024
@MrSmite
Copy link
Author

MrSmite commented Apr 15, 2024

It happens while the player is in the process of opening the file. And it usually only happens for the first file I open right after I start my computer, occasionally it will happen for the video I open after unlocking my PC too.

It seems to do it more often for MP4 than MKV though I don't see why. Also, the video still plays and all the player controls seem to work. I don't know if this is relevant but I have an RTX 3060 12GB and the most recent driver as of this post (game ready 552.12)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more info needed More information is needed to move forward Workaround Temporary or alternative solution
Projects
None yet
Development

No branches or pull requests

3 participants