Heap Corruption Exception When Running "Search Everything"

1

I'm afraid this questions concerns a bit of an older framework that I don't entirely understand (hence the question).

Anyhow, I'm attempting to use the Search Everything SDK in order to implement a search functionality on a small application that I'm making. I managed to get the old demo file that they provided up and running, and they were able to return file names of what I searched using a certain Everything_GetResultFileName function. I'll provide a link to the documentation for this function (which also contains the example file they presented to me) here.

The problem with the program is that whenever I try to call this specific function, the program fails and exits with a certain error code 0xc0000374 (which I looked up and found to be a sort of corrupted heap exception). The kicker is that in the example file they provided, they call the function in the exact same fashion, yet this time the function does not exit with this particular state; in fact, it works just as intended.

Not sure how many people are familiar with this concept, but I'll try to provide as much information as I can to make this easier on those trying to respond.

  • I was using the Everything64.dll file as the source of the method. I have not tried the 32-bit variant, Everything32.dll.
  • The method failed when used in a WPF application (mine) but worked in a WinForms application (the provided demo).

There is also a debug log which I will provide:

** SOME OF THESE NAMES HAVE BEEN MODIFIED BUT IT SHOULDN'T DETRACT FROM THE LOG **

'Winkwonk.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\Winky\Documents\Visual Studio 2017\Projects\Winkwonk\WW\WWSoln\WW\bin\x64\Debug\Winkwonk.exe'. Symbols loaded.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsBase.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Remote Debugger\x64\Runtime\Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Step into: Stepping over non-user code 'Winkwonk.App..ctor'
Step into: Stepping over non-user code 'Winkwonk.App.InitializeComponent'
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework.Aero2\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.Aero2.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\Users\Winky\Documents\Visual Studio 2017\Projects\Winkwonk\WW\WWSoln\WW\bin\x64\Debug\WpfAnimatedGif.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\Users\Winky\AppData\Local\Temp\VisualStudio.XamlDiagnostics.16884\Microsoft.VisualStudio.DesignTools.WpfTap.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\SMDiagnostics\v4.0_4.0.0.0__b77a5c561934e089\SMDiagnostics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Internals\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Internals.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\UIAutomationTypes\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationTypes.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\UIAutomationProvider\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationProvider.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Wink! // This is the debug message printed just before the method was called
The program '[16884] Winkwonk.exe' has exited with code -1073740940 (0xc0000374).

The answer may be obvious but I am too oblivious to see it. Any help would be very much appreciated. If any of you have suggestions about better search APIs to use with C#, pointers about those would be helpful as well. If you have any questions, please reference the documentation provided above.

Another note: Although trivial, I'd like to include that a try/catch statement was insufficient to contain the error.

c#
exception
search
asked on Stack Overflow May 27, 2018 by Peter L. • edited May 28, 2018 by Peter L.

1 Answer

1

I figured out the problem, and answer my own question only to leave a remnant that someday may help someone else in figuring out this problem. The problem is that there was some compatibility issue with .NET 4.7.1 and Everything64.dll's methods (well it wasn't a compatibility issue, it's moreso that .NET throws errors for attempts to read/write protected memory post .NET 3.0 or so). I reverted the framework to .NET 2.0 (this is likely a bit extreme but it was what the demo was programmed in, might as well be safe). The program now works as intended.

Boy, the answer was sort of obvious. Did I call it or what?

answered on Stack Overflow May 28, 2018 by Peter L. • edited Jun 5, 2018 by Peter L.

User contributions licensed under CC BY-SA 3.0