WinMerge / winmerge

WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
https://winmerge.org/
GNU General Public License v2.0
6.36k stars 787 forks source link

Exception loading plugins when winmerge is launched #2077

Open smadasnal opened 10 months ago

smadasnal commented 10 months ago

With a recent update I am seeing the attached error for a few plugins when comparing files. Any ideas?

Regards, Sheetal 2023-10-28 19_57_00-WinMerge

sdottaka commented 10 months ago

Some plugins are written in VBScript. Does the VBScript script engine c:\windows\system32\vbscript.dll file exist on your PC?

smadasnal commented 10 months ago

Some plugins are written in VBScript. Does the VBScript script engine c:\windows\system32\vbscript.dll file exist on your PC?

Yes, it does exist and has following attributes: 09/08/2022 08:37 AM 607,232 vbscript.dll

Regards, Sheetal

sdottaka commented 10 months ago

Thank you for the information. This issue does not currently reproduce in my environment. I would appreciate it if you could let me know if you can find the conditions to reproduce this. As a workaround, I think this error will disappear if you delete the *.sct files in the C:\Program Files\WinMerge\MergePlugins folder.

sheshibodla commented 9 months ago

Hi @sdottaka I am also facing the same problem and vbscript.dll file exists in the specified location.

11/17/2023 08:28 AM 626,688 vbscript.dll

Is there anyway we can run the winmerge in debug mode to get more details of the problem? Windows event manager also did not have any information regarding the error.

Just to clarify the error in loading the plug-ins was occurring before the recent windows upgrade which is the timestamp shown above.

OS Version details: Microsoft Windows [Version 10.0.22621.2715] Removed the sct files and upgraded the winmerge and still the problem persists.

When using the workaround of removing the plugins but will it not remove the functionality?

sdottaka commented 9 months ago

Is there anyway we can run the winmerge in debug mode to get more details of the problem?

I tried displaying the error type with commit 9f554cbf312c6e167ecbb65b7447ac7a909ec533. This will be reflected in version 2.16.36, which is scheduled to be released today, but you probably won't get much information.

When using the workaround of removing the plugins but will it not remove the functionality?

Of course, the deleted plug-in (*.sct) will no longer be usable.

Another workaround is to disable the entire plugin as follows:

image

sheshibodla commented 9 months ago

@sdottaka I downloaded the version 2.16.36 and got little more info that the error is access violation 0xc0000005

Screenshot 2023-12-02 111200

sdottaka commented 9 months ago

@sheshibodla

Thank you for the information. I have not been able to reproduce this problem in my environment. It would be helpful if you could let me know the conditions under which this problem occurs. For example, "This problem occurs if a certain antivirus software is installed." "This problem does not occur in versions earlier than this one." "The problem occurs with this OS version."

sheshibodla commented 9 months ago

@sdottaka I am not sure, tried all the options suggested for access violation problems suggested by articles but that did not help. I am still facing the same problem. If the application was giving more details on where it is failing I can look at that setting and say that it could be because of antivirus, or old version or on certain OS version

Anti virus did not change before the issue occurred. Older winmerge versions and new version is also failing with same error.

Hence in the initial comment, I was asking if Winmerge can write some logs/indication around when it is loading the plug-ins it may be easier to identify where/why it is failing.

Will there be any stack trace or something similar which can give the context of where it failed instead of simple access violation message. The stack trace might help.

sdottaka commented 9 months ago

Unfortunately, there is no function to output detailed logs or stack traces. It's probably a crash in vbscript.dll, or an abnormal state has occurred in WinMerge due to memory corruption due to a buffer overrun etc. even before the plug-in was loaded. It may be necessary to add a function to output core dumps like other native applications.

MicobyteMichael commented 2 months ago

Ok, I believe I'm encountering this same issue and I'd like to help in resolving it if possible. I'm observing the same exception ACCESS_VIOLATION error popups, one for every file .sct file in the MergePlugins directory. I've tried debugging these scripts by running them from a very simple VB script:

dim x
set x = GetObject("script:C:\Program Files (x86)\WinMerge\MergePlugins\CompareMSWordFiles.sct")

And this also crashes with the same error code, -1073741819, which in hex is 0xC0000005. (The same thing happens with every other .sct file.) It also isn't my first assumption (an issue with my MS office installation) because the non MS office-related .sct files crash in the same way.

For reference, I'm on Windows 10 22H2. I've tried reinstalling WinMerge three times with no difference. I would like to help debug this issue, since this software is a significant part of my workflow. @sdottaka Is there anyway I can help here?

sdottaka commented 2 months ago

Thank you for your help.

Version 2.16.40 replaces VBScript with JScript, so if you're not using this version yet, upgrade to 2.16.40 and see if that resolves the issue.

If not, could you try the following JScript script snippet and see if it throws an exception?

test.js

var x = GetObject("script:C:\\Program Files (x86)\\WinMerge\\MergePlugins\\compareMSWordFiles.sct");
cscript test.js
MicobyteMichael commented 2 months ago

Hello, I'm currently on 2.16.40 (although the exact same issue also occurred on whatever version I was running previously, from about 6 months ago I believe? I don't know the exact version).

No difference when I try JScript instead of VBScript. Also crashes in the same way when I use PyWin32 (Python library to access Win32 COM objects): image

In the above test, CScript exits after about 1-2 seconds with the exact same error (ACCESS_VIOLATION).

sdottaka commented 2 months ago

It's unfortunate that it still crashes even with version 2.16.40. I think a cscript.exe crash is recorded in Windows Logs → Application in Event Viewer (eventvwr.exe), but is there any interesting information?

image

MicobyteMichael commented 2 months ago

Here's the CScript crash report: image

XML:

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
  <Provider Name="Application Error" /> 
  <EventID Qualifiers="0">1000</EventID> 
  <Version>0</Version> 
  <Level>2</Level> 
  <Task>100</Task> 
  <Opcode>0</Opcode> 
  <Keywords>0x80000000000000</Keywords> 
  <TimeCreated SystemTime="2024-06-27T20:31:51.7115221Z" /> 
  <EventRecordID>286493</EventRecordID> 
  <Correlation /> 
  <Execution ProcessID="0" ThreadID="0" /> 
  <Channel>Application</Channel> 
  <Computer>(censored)</Computer> 
  <Security /> 
  </System>
<EventData>
  <Data>cscript.exe</Data> 
  <Data>5.812.10240.16384</Data> 
  <Data>da002f48</Data> 
  <Data>dgapi64.dll</Data> 
  <Data>7.9.4.26</Data> 
  <Data>653f40a4</Data> 
  <Data>c0000005</Data> 
  <Data>00000000000514c5</Data> 
  <Data>75b0</Data> 
  <Data>01dac8d10a8b712b</Data> 
  <Data>C:\Windows\system32\cscript.exe</Data> 
  <Data>c:\windows\system32\dgapi64.dll</Data> 
  <Data>0bbd445c-1bd4-41c2-8e7f-a8006a32cae6</Data> 
  <Data /> 
  <Data /> 
</EventData>
</Event>
sdottaka commented 2 months ago

It seems to be crashing in dgapi64.dll, which seems to be a Digital Guardian product. The version seems to be 7.9.4.26, but various crashes seem to have been fixed in version 8.0, so I would recommend trying a newer version if possible.

https://hstechdocs.helpsystems.com/releasenotes/Content/_ProductPages/Digital%20Guardian/Digital%20Guardian_windows.htm#Digital

MicobyteMichael commented 2 months ago

Whelp, at least I now know it isn't your program's fault. Thanks for helping me track this down. Time to go talk to corporate IT... yay...

For what it's worth, seems like there's a lot of people experiencing Digital Guarding causing random ACCESS_VIOLATION crashes. Google turns up lots of them.