FarManager: PictureView Plugin Load Error and likely related Editor Crashing on Plugin Load

Far Manager version

3.0.6026.0 x64

OS version

10.0.22621.963

Other software

I am using Latest Version of PictureView Plugin: 2021.04.19

Steps to reproduce

Navigate to a jpg file and hit Enter. Or alternatively invoke plugin from Plugins menu.

Expected behavior

PictureView plugin loads and shows an image.

Actual behavior

╔══════════════════════════════ Error ══════════════════════════════╗
║                       Error loading plugin                        ║
║ A:\Software\Exe\Files\FAR\3\Plugins\PictureView3\0PictureView.dll ║
╟───────────────────────────────────────────────────────────────────╢
║         0x000000C1 - %1 is not a valid Win32 application.         ║
╟───────────────────────────────────────────────────────────────────╢
║                              { OK }                               ║
╚═══════════════════════════════════════════════════════════════════╝

Explanation

A couple of points:

  • This started happening today for no apparent reason. I have not changed anything - neither FAR, no version of the plugin, nor even restarted the computer.
  • This initially occurred with new FAR instances (older FAR instances started a day ago were working normally). However as part of investigating the issue I closed all FAR processes and started fresh. Then the issue was present in all FAR instances.
  • I ruled out the possibility of a corrupted plugin files - I restored one from a backup, checked that all the files match hash-wise and they did. Moreover the same issue started happening with the backup-restored version.
  • I cleaned plugin cache multiple times - did not work.
  • Running FAR in ConEmu or standalone makes no difference.
  • What works for like ~15 minutes is if I either:
  1. Create a new plugin folder under plugins, i.e. PictureViewB with exactly the same files, then the new FAR instance will happily load and work with the plugin’s PictureViewB copy. However, if I then run yet another FAR instance, this time it will fail again (i.e. it would load neither PictureView nor PictureViewB).
  2. What also worked is simply closing all FAR instances, deleting original PictureViewf older and then restoring that folder from a backup and then launching FAR instances. First few FAR instances will work fine, however others will fail.

Now, just as I was writing this issue, I had to open FAR’s Viewer to see txt files (i.e. F3). And then FAR displayed the same error message about PictureView plugin, even though I was F3-ing a txt file.

What’s even more interesting is if I F4 (edit) a txt file instead, FAR actually crashes: Oops Something went wrong, and when I go to examine its bug_report.txt, I see it got a StackOverflow apparently when loading plugin(s):

002F5D07   Far.exe!MessageImpl(unsigned int,class std::basic_string_view<wchar_t,struct std::char_traits<wchar_t> >,class std::vector<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class std::allocator<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > > && __ptr64,class std::vector<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class std::allocator<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > > && __ptr64,struct error_state_ex const * __ptr64 const,class span<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const >,class std::basic_string_view<wchar_t,struct std::char_traits<wchar_t> >,class Plugin * __ptr64 const,struct _GUID const * __ptr64 const)+0xD27 (message.obj)
002F66C8   Far.exe!Message(unsigned int,struct error_state_ex const & __ptr64,class std::basic_string_view<wchar_t,struct std::char_traits<wchar_t> >,class std::vector<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class std::allocator<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > >,class span<enum lng const >,class std::basic_string_view<wchar_t,struct std::char_traits<wchar_t> >,struct _GUID const * __ptr64,class span<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const >)+0x148 (message.obj)
0032CC9E   Far.exe!native_plugin_factory::Create(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const & __ptr64) __ptr64+0x24E (plclass.obj)
0032FF0A   Far.exe!Plugin::LoadData(void) __ptr64+0x23A (plclass.obj)
00330353   Far.exe!Plugin::Load(void) __ptr64+0x23 (plclass.obj)
00331527   Far.exe!Plugin::ProcessEditorEvent(struct ProcessEditorEventInfo * __ptr64) __ptr64+0x27 (plclass.obj)
00367A4D   Far.exe!PluginManager::ProcessEditorEvent(int,void * __ptr64,class Editor const * __ptr64)const __ptr64+0x1BD (plugins.obj)
001BBC8B   Far.exe!Editor::ShowEditor(void) __ptr64+0x32B (editor.obj)
001FD2EC   Far.exe!FileEditor::DisplayObject(void) __ptr64+0x2C (fileedit.obj)
0038C383   Far.exe!ScreenObject::Show(void) __ptr64+0xE3 (scrobj.obj)
002EEB40   Far.exe!Manager::RefreshAllCommit(void) __ptr64+0x160 (manager.obj)
002EE536   Far.exe!Manager::DoActivation(class std::shared_ptr<class window> const & __ptr64,class std::shared_ptr<class window> const & __ptr64) __ptr64+0x146 (manager.obj)
002EE75E   Far.exe!Manager::ExecuteCommit(class std::shared_ptr<class window> const & __ptr64) __ptr64+0x9E (manager.obj)
002EDCB1   Far.exe!Manager::Commit(void) __ptr64+0xE1 (manager.obj)
002EB4C9   Far.exe!Manager::ExecuteModal(class std::shared_ptr<class window> const & __ptr64) __ptr64+0x79 (manager.obj)
00192C03   Far.exe!Dialog::Process(void) __ptr64+0x2D3 (dialog.obj)

The above is repeated many, many times.

Some Guidance or Help Would be Appreciated

This is truly bizarre. Out of the blue FAR starts behaving weird, seemingly “disliking” PictureView plugin which it had no problem with for more than a year. What’s even more surprising is that nothing has changed - neither FAR nor Plugin’s version, nor anything else. Computer was not restarted. It just started happening.

Could it be some kind of profile corruption? But if so, why does it work when I delete and recreate plugin’s folder or create another plugin folder. It works for a few instances, but then again does not work.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

I just use the standard Windows console.

I’m on Windows 11 10.0.22623.1037.

Now, just as I was writing this issue, I had to open FAR’s Viewer to see txt files (i.e. F3). And then FAR displayed the same error message about PictureView plugin, even though I was F3-ing a txt file.

The Picture View plugin intercepts multiple actions, including View and Edit, based on configuration. If you go into the settings for the plugin, you’ll see Process actions along with checkboxes for Enter archive, View, QuickView and Edit. So, if you have these actions enabled, the plugin will do some processing regardless of the extension of the file. For example, even if you rename a .jpg file to .txt, the plugin will still show the image when you press F3 or F4. However, if you’re saying that the plugin failed to even load, then I’m not sure how it’s able to process these actions.

What’s even more interesting is if I F4 (edit) a txt file instead, FAR actually crashes: Oops Something went wrong, and when I go to examine its bug_report.txt, I see it got a StackOverflow apparently when loading plugin(s):

Same as above.

The plugin also loads additional decoders, which may be causing issues. Have you tried turning off Decoders in the plugin settings? You can also turn off the Edit action there, if you don’t want the plugin to handle F4 key. I believe it’s off by default.

the behavior is identical to FAR’s - it succeeds the first time, and fails afterwards

Then there is little we can do but speculate. I suggest talking to the author directly: perhaps he could build it differently to make the OS happy or suggest something else.

Let’s keep this issue open for now, the SO still has to be addressed.

Does FAR in any way indicate to the OS how it should load plugin dlls

No and I doubt something like that even exists / exposed.

Do you have issues with picture view only? If I remember correctly, its author fancies unorthodox compilation methods (you could notice that its DOS header is way shorter than usual), maybe recent Windows versions introduced some incompatibilities with such trickery.

You could try starting Far without the picture view plugin, attaching the debugger to the running process and then loading it manually (type load: to find more).

Could it be due to something else?

Unlikely.

Could they have started interfering with each other

Unlikely.

what about that Editor StackOverflow crash - surely it is related

It is not related to this particular issue, just a plain and simple stack overflow: Far tries to load a plugin from the cache, it fails, Far shows a message, doing so causes a redraw and generates some editor events, they are sent to plugins, but plugins are not fully loaded yet, so Far tries to load a plugin from the cache, it fails, Far shows a message, doing so causes a redraw and generates some editor events, they are sent to plugins, but plugins are not fully loaded yet, so Far tries to load a plugin from the cache, it fails, Far shows a message, doing so causes a redraw and generates some editor events, they are sent to plugins, but plugins are not fully loaded yet, so Far tries to load a plugin from the caEXCEPTION_STACK_OVERFLOW. It would be nice to fix this at some point though.

How can I maybe run it in debug mode to see exactly what is failing?

If there was a way to see exactly what is failing, I would’ve turn it on by default already 😃 Unfortunately, no. You could try pressing F3 in the error message to see the last NTSTATUS value. Sometimes they are more helpful, sometimes not, in your case it would probably be 0xC000007B, which is the same thing but worded differently. You could also try to build Far and put a breakpoint here: https://github.com/FarGroup/FarManager/blob/08b581622da20bc0b139c048a77f2c1a264c84de/far/platform.cpp#L636 but it won’t show anything particularly interesting either. You could also add SetErrorMode(0); right before that line and recompile. In this case Windows might show a slightly prettier error message, possibly with that %1 replaced with a proper dll name.