FarManager icon indicating copy to clipboard operation
FarManager copied to clipboard

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

Open fitdev opened this issue 3 years ago • 18 comments

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.

fitdev avatar Dec 21 '22 14:12 fitdev

The message basically says that LoadLibrary does not recognize 0PictureView.dll (or one of its static dependencies) as a valid dll for some reason, usually because the file is corrupted, but you've ruled that out already. Another possibility is an antivirus or a similar monitoring tool - they usually intercept dll loading for their shenanigans. Have you tried rebooting?

alabuzhev avatar Dec 21 '22 18:12 alabuzhev

@alabuzhev Thank you for your fast response and thank you for explanation. I have not yet tried rebooting as I thought to investigate this a bit more first. I have only Windows Defender with its default settings, and have checked that it did not quarantine any files or showed any alerts. The weird part is that it works just fine for 1 FAR instance. However for any additional FAR instances I get this error. So it is something like this: 0. It does not work any more.

  1. I close all FAR processes
  2. I delete A:\Software\Exe\Files\FAR\3\Plugins\PictureView3 folder
  3. I then start first FAR instance (obviously without this plugin now as it has been deleted), everything is fine.
  4. I restore A:\Software\Exe\Files\FAR\3\Plugins\PictureView3 folder and start another FAR instance. This time it loads just fine and plugin works - no errors (and will continue to work in that FAR instance).
  5. I then start another FAR instance (3rd), and now it fails with the above error.
  6. At this point I verify that the folder and all the plugin's dlls are accessible, and they are - I can view, open them without problems). So it is not a file access / locking / permissions issue.
  7. At this point the only way to make it work, is to go back to step 1, OR to make a 2nd folder with the same plugin but call it say A:\Software\Exe\Files\FAR\3\Plugins\PictureView3b, start new FAR instance, and then the new instance will use the plugin from this second folder - just fine - no errors, but then if I open yet another FAR instance, it will again show error (so now both copies of the plugin are not working)

I also ran Process Monitor and found no differences between when FAR was accessing failing 0PictureView.dll vs when it was accessing a dll from another plugin - file access patterns looked identical and showed no errors, yet one works but the other does not.

In that regard I have a few questions / suggestions, and maybe you can help:

  1. So the weird 0x000000C1 - %1 is not a valid Win32 application error message indicates that LoadLibrary failed. Could it be due to something else?
  2. I run multiple FAR instances at the same time. Could they have started interfering with each other, causing conflicts, and thus preventing the second instance of FAR from loading the plugin?
  3. And what about that Editor StackOverflow crash - surely it is related, as it never happens once I got the first error message (and presumably plugin was simply not loaded)?
  4. How can I maybe run it in debug mode to see exactly what is failing? Is there a way to get some diagnostic log from FAR? Right now all I get is the error message I reported. Of course when the editor crashes I get more info, but it seems to be a different but related (to this plugin) issue.

fitdev avatar Dec 21 '22 19:12 fitdev

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.

alabuzhev avatar Dec 21 '22 20:12 alabuzhev

Thank you for your suggestions. I will try researching some more. I was sort of hoping there would be a way to "properly" crash FAR when it attempts to load a plugin, such that if it is attached to a debugger, I could see exactly at what point it crashes. I suppose I could try using the Editor crash somehow, but it is still handled; is there a way to run FAR under debugger without recompiling from source (I don't have CPP and libraries installed)?

fitdev avatar Dec 21 '22 20:12 fitdev

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).

alabuzhev avatar Dec 21 '22 20:12 alabuzhev

Thank you for your suggestion. I will try that. I know that this is definitely not an issue with FAR and very likely not an issue with plugin either, however I was hoping you could shed some light. So thank you for your suggestions.

The only thing I discovered so far is that it definitely works with first instance, and definitely fails with the second instance, and works again if I delete and recover the plugin file. The interesting bit I found using ProcMon is the 2 load library attempts look different:

Working (plugin load by 1st FAR instance)
Operation - FileSystemControl: SUCCESS FSCTL_READ_FILE_USN_DATA

0	FLTMGR.SYS	FltGetFileNameInformation + 0x1f1a	0xfffff8041392939a	C:\Windows\System32\drivers\FLTMGR.SYS
1	FLTMGR.SYS	FltGetFileNameInformation + 0x19a1	0xfffff80413928e21	C:\Windows\System32\drivers\FLTMGR.SYS
2	FLTMGR.SYS	FltGetFileNameInformation + 0x929	0xfffff80413927da9	C:\Windows\System32\drivers\FLTMGR.SYS
3	FLTMGR.SYS	FltGetTopInstance + 0x523	0xfffff8041395d813	C:\Windows\System32\drivers\FLTMGR.SYS
4	ntoskrnl.exe	IofCallDriver + 0x55	0xfffff804172cb975	C:\Windows\system32\ntoskrnl.exe
5	ntoskrnl.exe	ObReferenceObjectByHandle + 0x8a0	0xfffff804176c2cb0	C:\Windows\system32\ntoskrnl.exe
6	ntoskrnl.exe	NtClose + 0x1d0c	0xfffff804176c127c	C:\Windows\system32\ntoskrnl.exe
7	ntoskrnl.exe	NtFsControlFile + 0x56	0xfffff804177b1016	C:\Windows\system32\ntoskrnl.exe
8	ntoskrnl.exe	setjmpex + 0x8cd8	0xfffff8041743d4e8	C:\Windows\system32\ntoskrnl.exe
9	ntoskrnl.exe	KeSynchronizeExecution + 0x4140	0xfffff8041742df90	C:\Windows\system32\ntoskrnl.exe
10	appid.sys	appid.sys + 0x2be9c	0xfffff80429c5be9c	C:\Windows\system32\drivers\appid.sys
11	appid.sys	appid.sys + 0x2afbb	0xfffff80429c5afbb	C:\Windows\system32\drivers\appid.sys
12	appid.sys	appid.sys + 0x298d1	0xfffff80429c598d1	C:\Windows\system32\drivers\appid.sys
13	appid.sys	appid.sys + 0x293ea	0xfffff80429c593ea	C:\Windows\system32\drivers\appid.sys
14	appid.sys	appid.sys + 0x22cf6	0xfffff80429c52cf6	C:\Windows\system32\drivers\appid.sys
15	appid.sys	appid.sys + 0x1e4fb	0xfffff80429c4e4fb	C:\Windows\system32\drivers\appid.sys
16	ntoskrnl.exe	IofCallDriver + 0x55	0xfffff804172cb975	C:\Windows\system32\ntoskrnl.exe
17	ntoskrnl.exe	ObReferenceObjectByHandle + 0x8a0	0xfffff804176c2cb0	C:\Windows\system32\ntoskrnl.exe
18	ntoskrnl.exe	NtClose + 0x1d0c	0xfffff804176c127c	C:\Windows\system32\ntoskrnl.exe
19	ntoskrnl.exe	NtDeviceIoControlFile + 0x56	0xfffff804176bf556	C:\Windows\system32\ntoskrnl.exe
20	ntoskrnl.exe	setjmpex + 0x8cd8	0xfffff8041743d4e8	C:\Windows\system32\ntoskrnl.exe
21	ntdll.dll	NtDeviceIoControlFile + 0x14	0x7fff736aeee4	C:\Windows\System32\ntdll.dll
22	ntdll.dll	RtlLengthSecurityDescriptor + 0x339	0x7fff73683619	C:\Windows\System32\ntdll.dll
23	ntdll.dll	RtlLengthSecurityDescriptor + 0x120	0x7fff73683400	C:\Windows\System32\ntdll.dll
24	ntdll.dll	RtlQueryPerformanceCounter + 0x236	0x7fff73620d76	C:\Windows\System32\ntdll.dll
25	ntdll.dll	RtlQueryPerformanceCounter + 0xc30	0x7fff73621770	C:\Windows\System32\ntdll.dll
26	ntdll.dll	RtlQueryPerformanceCounter + 0x9ff	0x7fff7362153f	C:\Windows\System32\ntdll.dll
27	ntdll.dll	RtlImageRvaToSection + 0x1e4	0x7fff73639014	C:\Windows\System32\ntdll.dll
28	ntdll.dll	RtlUnicodeToCustomCPN + 0x3fc	0x7fff7362932c	C:\Windows\System32\ntdll.dll
29	ntdll.dll	LdrLoadDll + 0xfa	0x7fff7363a99a	C:\Windows\System32\ntdll.dll
30	KernelBase.dll	LoadLibraryExW + 0x172	0x7fff70c9bbb2	C:\Windows\System32\KernelBase.dll
31	Far.exe	Far.exe + 0x311146	0x7ff734ad1146	A:\Software\Exe\Files\FAR\3\Far.exe
32	Far.exe	Far.exe + 0x32caf5	0x7ff734aecaf5	A:\Software\Exe\Files\FAR\3\Far.exe
33	Far.exe	Far.exe + 0x32ff0a	0x7ff734aeff0a	A:\Software\Exe\Files\FAR\3\Far.exe
34	Far.exe	Far.exe + 0x330353	0x7ff734af0353	A:\Software\Exe\Files\FAR\3\Far.exe
35	Far.exe	Far.exe + 0x3311c7	0x7ff734af11c7	A:\Software\Exe\Files\FAR\3\Far.exe
36	Far.exe	Far.exe + 0x364f21	0x7ff734b24f21	A:\Software\Exe\Files\FAR\3\Far.exe
37	Far.exe	Far.exe + 0x22ba72	0x7ff7349eba72	A:\Software\Exe\Files\FAR\3\Far.exe
38	Far.exe	Far.exe + 0x21fca5	0x7ff7349dfca5	A:\Software\Exe\Files\FAR\3\Far.exe
39	Far.exe	Far.exe + 0x21e4be	0x7ff7349de4be	A:\Software\Exe\Files\FAR\3\Far.exe
40	Far.exe	Far.exe + 0x24e510	0x7ff734a0e510	A:\Software\Exe\Files\FAR\3\Far.exe
41	Far.exe	Far.exe + 0x2ed312	0x7ff734aad312	A:\Software\Exe\Files\FAR\3\Far.exe
42	Far.exe	Far.exe + 0x2ecd01	0x7ff734aacd01	A:\Software\Exe\Files\FAR\3\Far.exe
43	Far.exe	Far.exe + 0x2ecb06	0x7ff734aacb06	A:\Software\Exe\Files\FAR\3\Far.exe
44	Far.exe	Far.exe + 0x2e4c87	0x7ff734aa4c87	A:\Software\Exe\Files\FAR\3\Far.exe
45	Far.exe	Far.exe + 0x2e9ad9	0x7ff734aa9ad9	A:\Software\Exe\Files\FAR\3\Far.exe
46	Far.exe	Far.exe + 0x1e9601	0x7ff7349a9601	A:\Software\Exe\Files\FAR\3\Far.exe
47	Far.exe	Far.exe + 0x2e8f12	0x7ff734aa8f12	A:\Software\Exe\Files\FAR\3\Far.exe
48	Far.exe	Far.exe + 0x2e8a19	0x7ff734aa8a19	A:\Software\Exe\Files\FAR\3\Far.exe
49	Far.exe	Far.exe + 0x2e9248	0x7ff734aa9248	A:\Software\Exe\Files\FAR\3\Far.exe
50	Far.exe	Far.exe + 0x2e9b62	0x7ff734aa9b62	A:\Software\Exe\Files\FAR\3\Far.exe
51	Far.exe	Far.exe + 0x1e9601	0x7ff7349a9601	A:\Software\Exe\Files\FAR\3\Far.exe
52	Far.exe	Far.exe + 0x2e9372	0x7ff734aa9372	A:\Software\Exe\Files\FAR\3\Far.exe
53	Far.exe	Far.exe + 0x2e9168	0x7ff734aa9168	A:\Software\Exe\Files\FAR\3\Far.exe
54	Far.exe	Far.exe + 0x2e9b9e	0x7ff734aa9b9e	A:\Software\Exe\Files\FAR\3\Far.exe
55	Far.exe	Far.exe + 0x1e963d	0x7ff7349a963d	A:\Software\Exe\Files\FAR\3\Far.exe
56	Far.exe	Far.exe + 0x2e94aa	0x7ff734aa94aa	A:\Software\Exe\Files\FAR\3\Far.exe
57	Far.exe	Far.exe + 0x3ee360	0x7ff734bae360	A:\Software\Exe\Files\FAR\3\Far.exe
58	kernel32.dll	BaseThreadInitThunk + 0x1d	0x7fff721e26bd	C:\Windows\System32\kernel32.dll
59	ntdll.dll	RtlUserThreadStart + 0x28	0x7fff7366dfb8	C:\Windows\System32\ntdll.dll
Failing (plugin load by 2nd instance of FAR)
Operation - FileSystemControl: INVALID DEVICE REQUEST (0x90390 (Device:0x9 Function:228 Method: 0)

0	FLTMGR.SYS	FltGetFileNameInformation + 0x1f1a	0xfffff8041392939a	C:\Windows\System32\drivers\FLTMGR.SYS
1	FLTMGR.SYS	FltGetFileNameInformation + 0x19a1	0xfffff80413928e21	C:\Windows\System32\drivers\FLTMGR.SYS
2	FLTMGR.SYS	FltGetFileNameInformation + 0x929	0xfffff80413927da9	C:\Windows\System32\drivers\FLTMGR.SYS
3	FLTMGR.SYS	FltGetTopInstance + 0x523	0xfffff8041395d813	C:\Windows\System32\drivers\FLTMGR.SYS
4	ntoskrnl.exe	IofCallDriver + 0x55	0xfffff804172cb975	C:\Windows\system32\ntoskrnl.exe
5	ntoskrnl.exe	FsRtlKernelFsControlFile + 0x171	0xfffff80417744211	C:\Windows\system32\ntoskrnl.exe
6	CI.dll	CiFreePolicyInfo + 0x5c8a	0xfffff80413f3a00a	C:\Windows\system32\CI.dll
7	CI.dll	CiFreePolicyInfo + 0x50ed	0xfffff80413f3946d	C:\Windows\system32\CI.dll
8	CI.dll	CiFreePolicyInfo + 0x1055d	0xfffff80413f448dd	C:\Windows\system32\CI.dll
9	CI.dll	CiFreePolicyInfo + 0xe416	0xfffff80413f42796	C:\Windows\system32\CI.dll
10	ntoskrnl.exe	PoFxUnregisterDevice + 0x4299	0xfffff804176800e9	C:\Windows\system32\ntoskrnl.exe
11	ntoskrnl.exe	PoFxUnregisterDevice + 0x3d27	0xfffff8041767fb77	C:\Windows\system32\ntoskrnl.exe
12	ntoskrnl.exe	FsRtlGetFileSize + 0xee7	0xfffff80417779557	C:\Windows\system32\ntoskrnl.exe
13	ntoskrnl.exe	FsRtlGetFileSize + 0xc6c	0xfffff804177792dc	C:\Windows\system32\ntoskrnl.exe
14	ntoskrnl.exe	MmChangeImageProtection + 0x380	0xfffff804176cfca0	C:\Windows\system32\ntoskrnl.exe
15	ntoskrnl.exe	NtOpenProcess + 0xa0b	0xfffff804176cde0b	C:\Windows\system32\ntoskrnl.exe
16	ntoskrnl.exe	NtOpenProcess + 0x124	0xfffff804176cd524	C:\Windows\system32\ntoskrnl.exe
17	ntoskrnl.exe	RtlCopySid + 0x425	0xfffff804176cf1d5	C:\Windows\system32\ntoskrnl.exe
18	ntoskrnl.exe	NtCreateSection + 0x5c	0xfffff804176cf3cc	C:\Windows\system32\ntoskrnl.exe
19	ntoskrnl.exe	setjmpex + 0x8cd8	0xfffff8041743d4e8	C:\Windows\system32\ntoskrnl.exe
20	ntdll.dll	ZwCreateSection + 0x14	0x7fff736af744	C:\Windows\System32\ntdll.dll
21	ntdll.dll	RtlQueryPerformanceCounter + 0x1f6	0x7fff73620d36	C:\Windows\System32\ntdll.dll
22	ntdll.dll	RtlQueryPerformanceCounter + 0xc30	0x7fff73621770	C:\Windows\System32\ntdll.dll
23	ntdll.dll	RtlQueryPerformanceCounter + 0x9ff	0x7fff7362153f	C:\Windows\System32\ntdll.dll
24	ntdll.dll	RtlImageRvaToSection + 0x1e4	0x7fff73639014	C:\Windows\System32\ntdll.dll
25	ntdll.dll	RtlUnicodeToCustomCPN + 0x3fc	0x7fff7362932c	C:\Windows\System32\ntdll.dll
26	ntdll.dll	LdrLoadDll + 0xfa	0x7fff7363a99a	C:\Windows\System32\ntdll.dll
27	KernelBase.dll	LoadLibraryExW + 0x172	0x7fff70c9bbb2	C:\Windows\System32\KernelBase.dll
28	Far.exe	Far.exe + 0x311146	0x7ff734ad1146	A:\Software\Exe\Files\FAR\3\Far.exe
29	Far.exe	Far.exe + 0x32caf5	0x7ff734aecaf5	A:\Software\Exe\Files\FAR\3\Far.exe
30	Far.exe	Far.exe + 0x32ff0a	0x7ff734aeff0a	A:\Software\Exe\Files\FAR\3\Far.exe
31	Far.exe	Far.exe + 0x330353	0x7ff734af0353	A:\Software\Exe\Files\FAR\3\Far.exe
32	Far.exe	Far.exe + 0x3311c7	0x7ff734af11c7	A:\Software\Exe\Files\FAR\3\Far.exe
33	Far.exe	Far.exe + 0x364f21	0x7ff734b24f21	A:\Software\Exe\Files\FAR\3\Far.exe
34	Far.exe	Far.exe + 0x22ba72	0x7ff7349eba72	A:\Software\Exe\Files\FAR\3\Far.exe
35	Far.exe	Far.exe + 0x21fca5	0x7ff7349dfca5	A:\Software\Exe\Files\FAR\3\Far.exe
36	Far.exe	Far.exe + 0x21e4be	0x7ff7349de4be	A:\Software\Exe\Files\FAR\3\Far.exe
37	Far.exe	Far.exe + 0x24e510	0x7ff734a0e510	A:\Software\Exe\Files\FAR\3\Far.exe
38	Far.exe	Far.exe + 0x2ed312	0x7ff734aad312	A:\Software\Exe\Files\FAR\3\Far.exe
39	Far.exe	Far.exe + 0x2ecd01	0x7ff734aacd01	A:\Software\Exe\Files\FAR\3\Far.exe
40	Far.exe	Far.exe + 0x2ecb06	0x7ff734aacb06	A:\Software\Exe\Files\FAR\3\Far.exe
41	Far.exe	Far.exe + 0x2e4c87	0x7ff734aa4c87	A:\Software\Exe\Files\FAR\3\Far.exe
42	Far.exe	Far.exe + 0x2e9ad9	0x7ff734aa9ad9	A:\Software\Exe\Files\FAR\3\Far.exe
43	Far.exe	Far.exe + 0x1e9601	0x7ff7349a9601	A:\Software\Exe\Files\FAR\3\Far.exe
44	Far.exe	Far.exe + 0x2e8f12	0x7ff734aa8f12	A:\Software\Exe\Files\FAR\3\Far.exe
45	Far.exe	Far.exe + 0x2e8a19	0x7ff734aa8a19	A:\Software\Exe\Files\FAR\3\Far.exe
46	Far.exe	Far.exe + 0x2e9248	0x7ff734aa9248	A:\Software\Exe\Files\FAR\3\Far.exe
47	Far.exe	Far.exe + 0x2e9b62	0x7ff734aa9b62	A:\Software\Exe\Files\FAR\3\Far.exe
48	Far.exe	Far.exe + 0x1e9601	0x7ff7349a9601	A:\Software\Exe\Files\FAR\3\Far.exe
49	Far.exe	Far.exe + 0x2e9372	0x7ff734aa9372	A:\Software\Exe\Files\FAR\3\Far.exe
50	Far.exe	Far.exe + 0x2e9168	0x7ff734aa9168	A:\Software\Exe\Files\FAR\3\Far.exe
51	Far.exe	Far.exe + 0x2e9b9e	0x7ff734aa9b9e	A:\Software\Exe\Files\FAR\3\Far.exe
52	Far.exe	Far.exe + 0x1e963d	0x7ff7349a963d	A:\Software\Exe\Files\FAR\3\Far.exe
53	Far.exe	Far.exe + 0x2e94aa	0x7ff734aa94aa	A:\Software\Exe\Files\FAR\3\Far.exe
54	Far.exe	Far.exe + 0x3ee360	0x7ff734bae360	A:\Software\Exe\Files\FAR\3\Far.exe
55	kernel32.dll	BaseThreadInitThunk + 0x1d	0x7fff721e26bd	C:\Windows\System32\kernel32.dll
56	ntdll.dll	RtlUserThreadStart + 0x28	0x7fff7366dfb8	C:\Windows\System32\ntdll.dll

Disabling Windows Defender realtime protection made no difference. I have no clue why it would behave differently on 2 occasions, but from what I could guess the OS tries to reuse somehow the originally loaded plugin dll by the first FAR instance, but fails for some reason. Does FAR in any way indicate to the OS how it should load plugin dlls, i.e. make them shareable between different FAR processes or not?

fitdev avatar Dec 21 '22 22:12 fitdev

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.

alabuzhev avatar Dec 21 '22 23:12 alabuzhev

Do you have issues with picture view only?

Yes, at the moment only with that plugin. And I have 20 or so installed, but I do not use most of them often (unlike Picture View), so it might be hard to notice. Though I did experiment with the "loading sequence" of another multimedia plugin - Review, and it gets loaded just fine all the time - similar to how Picture View gets treated when it works the first time.

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.

I did examine its dll, and CEF Explorer tool complained about invalid Address of Entry Point being just 0. However the mystery is that it has worked previously without any issues, even during current Windows session (I have not yet restarted only because I wanted to investigate it more, fearing the issue might affect other plugins / programs), and yet I did not install any updates or made any system changes during the session - a true mystery.

BTW, I did try F3 on the error dialog and it gave me 0xC000007B - {Bad Image}, which is funny because it is the same plugin dll file all along which never changes and is perfectly readable by even non-elevated users.

I am sorry to have diverted your attention to this since it's clearly not related to FAR, but thank you for your suggestions, and perhaps it will be useful to others who come across a similar situation. Meanwhile, perhaps this issue may serve to track the StackOverflow due to plugin load in the Editor, since it is something that would be nice to fix.

fitdev avatar Dec 22 '22 07:12 fitdev

For those interested some more updates...

After doing some more tests, I confirm fully that it has nothing to do with FAR. I wrote a simple console app that does nothing else but loads this plugin dll using LoadLaibraryEx. And the behavior is identical to FAR's - it succeeds the first time, and fails afterwards. In fact any process that attempts to load the same dll again will from now on fail, until that dll is deleted and recreated.

I do not think it has anything to do with this particular plugin/dll either, as it has worked for a long time without issues. Most likely some dll flags that this dll was built with makes recent Windows 11 builds (I am using 22H2) to prohibit any subsequent dll loading for whatever reason. So I suspect that as more people upgrade their Windows 10s and 11s, it is likely that the issue will become more widespread (at least as long as more than one process needs to load the same dll, which in the case of FAR is quite common).

fitdev avatar Dec 22 '22 11:12 fitdev

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.

alabuzhev avatar Dec 22 '22 19:12 alabuzhev

For now I have "fixed" it by restarting PC. But I guess it won't be long before it happens again. So ended up opening 20 FAR instances in advance with the plugin loaded in all of them... Not ideal, but a workaround. Thank you once again for looking into this!

fitdev avatar Dec 22 '22 19:12 fitdev

Just FYI, I've been using the Picture View plugin with Far for over 6 years, and have never noticed this particular issue.

rohitab avatar Dec 24 '22 13:12 rohitab

@rohitab So have I. In fact I have used it for almost 10 years. But what version of Windows are you on?

fitdev avatar Dec 24 '22 21:12 fitdev

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.

rohitab avatar Dec 25 '22 16:12 rohitab

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.

It definitely was failing to load. Verified it multiple times - through Process Monitor, and through Process Hacker's list of loaded modules - it was not listed.

Have you tried turning off Decoders in the plugin settings?

Absolutely! I had just one 0PictureView.dll with only hlf and non-dll files. ANd surely it failed. In fact when it fails, it never ieven gets to loading any decoders. It fails at the stage of LoadLibraryEx, so none of its code is ever executed by FAR process because it never finishes loading the library.

It is reassuring though that some Windows 11 installations work fine. Mine has been working fine for 2 days now since restart, but who know for how long... I suspect Windows 11's most recent December patch might have introduced some strangeness.

fitdev avatar Dec 25 '22 17:12 fitdev

Have you try running in Windows Sandbox? That way, it will be the same version of Windows that you're using, but without any other software that might be causing issues. If it works in the Sandbox, then it's most likely some other software that's causing it to fail.

rohitab avatar Dec 26 '22 14:12 rohitab

No, I have not tried that, but thank you for the tip. Out of curiosity and a bit off topic - what Terminal are you suing for FAR on Win11 - ConEmu?

fitdev avatar Dec 26 '22 18:12 fitdev

I just use the standard Windows console.

rohitab avatar Dec 27 '22 15:12 rohitab