lordmulder / LameXP

Audio Encoder Front-End
http://lordmulder.github.io/LameXP
Other
184 stars 18 forks source link

Unhandled exception handler invoked w/new version, antivirus not triggered #102

Closed Moonswirl closed 2 years ago

Moonswirl commented 2 years ago

image

After using the last version's auto-updater I'm now getting this on a Windows 10 Pro system running 21H1 build 19043.1415 with an AMD Ryzen 7 3700x. I only use Windows Defender and occasionally Malwarebytes and neither are picking up anything to do with LameXP in protection logs. The Visual Studio 2015 redistributable is installed too so I can't imagine it's that, either.

Tried to redownload an older version but that started throwing the exact same error at me too, so something may have happened when the auto-updater was used?

Console isn't telling me anything I necessarily understand but there's nothing there either that jumps out at me as being the problem:

lameXPlog.txt

lordmulder commented 2 years ago

Hello!

For any "anti-virus" related problems please see:

Having said that, on my "main" development machine I use Windows 11 (until very recently Windows 10) with the "standard" Windows Defender installed and I haven't noticed any problems in this regard.

Console isn't telling me anything I necessarily understand but there's nothing there either that jumps out at me as being the problem: lameXPlog.txt

Indeed, your log does not show anything "unusual" 😖

The Visual Studio 2015 redistributable is installed too so I can't imagine it's that, either.

Not required for "static" builds (which the "release" builds are) anyway.

Tried to redownload an older version but that started throwing the exact same error at me too, so something may have happened when the auto-updater was used?

No. I can't imagine how that should be possible. LameXP is really just one fully self-contained EXE file.

If you revert to an older version, it means that you replace the "new" EXE file with the previous version. And that is that. Whether you use the installer or just grab the EXE file from the release ZIP file doesn't make a difference.

Consequently, if the problem suddenly started to occur, even with the "older" version which previous has worked for you, then it can only be explained by the fact that something on your side must have changed.

Have you tried turning it off and on again?

Just to be sure: Have you tried to completely turn off Windows Defener before starting LameXP? And have you checked the Windows Defener "history" for any actions it may have taken to "block" or "remove" stuff that we need?

Regards.


[Update]

Here is a "debug" build you may wish to try: https://www.mediafire.com/file/hfudlj5d9u6h68c/LameXP.2021-12-20.Debug.Build-2325.rar/file

Moonswirl commented 2 years ago

For clarity, I was just saying I don't think this has anything to do with my antivirus since they don't report anything when I try to load the app, and I can't find anything to do with LameXP in my protection logs either.

No. I can't imagine how that should be possible. LameXP is really just one fully self-contained EXE file.

I HAVE noticed that a config.ini file gets written to %localappdata%/LoRd_MuldeR/LameXP - Audio Encoder Front-End/ when launching but this is all it says:

[LameXP.2188] VersionNumber=4.19.2320

Consequently, if the problem suddenly started to occur, even with the "older" version which previous has worked for you, then it can only be explained by the fact that something on your side must have changed.

The only things that have changed recently in my system that I know of that could possibly cause something like this was a GPU upgrade to an RTX 3060 Ti (weird beyond belief if that's the cause) and plugging in an external DVD/CD drive (unplugging it did nothing). Maybe a Windows update messed something up at some point, but I feel like if that were the case the app would've crashed before it had a chance to go through the auto update today.

And yeah, I've restarted the system multiple times, have turned off Defender's active protections and - as mentioned above - there's nothing in the protection history that points to anything LameXP related.

Here is a "debug" build you may wish to try:

That gives me a new error which pops up 4 times before closing:

image

At a glance that's apparently something to do with not having the Visual Studio workspace installed...which I wouldn't because I don't work with code. I'm assuming this doesn't really have anything to do with the stable build though from what little I do understand.

lordmulder commented 2 years ago

For clarity, I was just saying I don't think this has anything to do with my antivirus since they don't report anything when I try to load the app, and I can't find anything to do with LameXP in my protection logs either.

Anyhow, please try disabling Windows Defener completely, just to be sure.

I HAVE noticed that a config.ini file gets written to %localappdata%/LoRd_MuldeR/LameXP

Yeah, but that files just stores your settings. It can safely be deleted at any time in order to "reset" everything to default.

(LameXP re-creates the file on next start)

The only things that have changed recently in my system that I know of that could possibly cause something like this was a GPU upgrade to an RTX 3060 Ti (weird beyond belief if that's the cause) and plugging in an external DVD/CD drive (unplugging it did nothing). Maybe a Windows update messed something up at some point, but I feel like if that were the case the app would've crashed before it had a chance to go through the auto update today.

Well, I have an RTX 2070 SUPER, which should be quite simmilar. And I usually install the latest "game ready" drivers.

Anyhow, something must have changed on your system, if the problem occurs now in the "old" version too (but didn't before).

That gives me a new error which pops up 4 times before closing:

Yeah, ucrtbased.dll is the "debug" version of the normal ucrtbase.dll (Universal CRT).

Unlike the "normal" version, the "debug" version of the Universal CRT apparently is not included with Windows 😨

Please try this download: https://www.mediafire.com/file/uk8dur6td6wvhog/LameXP.2021-12-20.Debug.Build-2325.r2.rar/file

Debugging tools for Windows: https://www.sendspace.com/file/y3aocg

Regards.

Moonswirl commented 2 years ago

Please try this download:

So, that one loads but as soon as it finishes it immediately closes itself without so much as an error message.

That download for the debugging tools does the same thing.

I might try loading LameXP on my side laptop and see if anything goes wrong there just to see if it's something either with this version of Windows or my desktop.

lordmulder commented 2 years ago

So, that one loads but as soon as it finishes it immediately closes itself without so much as an error message.

That download for the debugging tools does the same thing.

You are talking about the program when you run it (after all files were extracted from the RAR) or the download itself?

(If download fails, maybe try other web-browser)

Moonswirl commented 2 years ago

You are talking about the program when you run it (after all files were extracted from the RAR) or the download itself?

The program when it's ran, sorry! The downloads were both fine.

As an aside, the laptop loads LameXP just fine but it's also running on version 20H2, so I can't really say that's useful until I get both systems at parity.

lordmulder commented 2 years ago

That download for the debugging tools does the same thing.

If even WinDbg doesn't start, which is a standard tool from Microsoft, then I have no idea what is wrong on your system.

Otherwise, please try running the "debug" build of LameXP in WinDbg and see the output...

(In WinDbg, use "File" → "Open Executable". Then, once the executable was loaded, do "Debug" → "Go" or press F5)


As an aside, the laptop loads LameXP just fine but it's also running on version 20H2

Before I upgraded to Windows 11, I was using Windows 10 "21H1" too. So I doubt that (alone) is the problem.

(I also regularly test on Windows 8.1, Vista and XP, just to be sure)

Moonswirl commented 2 years ago

Otherwise, please try running the "debug" build of LameXP in WinDbg and see the output...

The Windows Store version of WinDbg (WinDbg Preview) worked so I used that and this was the output in the Command window:

windbg_output.txt

LameXP did finish loading and showed the console, but it gave me a completely white window I couldn't click on or anything.

lordmulder commented 2 years ago

LameXP did finish loading and showed the console, but it gave me a completely white window I couldn't click on or anything.

(244c.4ae4): Access violation - code c0000005 (first chance)

This is probably because an "access violation" occured – at which points the debugger "freezes" the application.

We need look at the call stack at that moment, to see where exactly the exception occureed.

This should look something like this, but please be sure to select the correct thread for displaying the call stack:

windbg

(here I manually paused the execution, just for illustartion)

Moonswirl commented 2 years ago

So, this? Sorry if I'm getting it wrong, again I'm not experienced at all with code or debugging:

image

lordmulder commented 2 years ago

Maybe. I'm not exactly sure 😬

You are not showing the callstack of the LameXP "main" thread here. It looks like what you are showing is some thread that belongs to the Windows Multi-Media API. As can easily be seen, this callstack does not go through any LameXP code! My guess would be that the Windows Multi-Media API creates this thread to "asynchronously" play a sound (WAV file). If that really is the thread where the "crash" occurred, then it is related to sound playback. It happens somewhere in the Windows Multi-Media libraries.

Can you try to replace the content of your config.ini with:

[LameXP.2188]
VersionNumber=4.19.2320
LicenseAccepted=1
Flags\EnableSounds=false

Maybe if we disable all sound effects...

Moonswirl commented 2 years ago

Maybe if we disable all sound effects...

And it worked, I was able to load both the stable and the debug version just fine! And now weirdly enough, I can re-enable sounds and it still loads without problems, and was able to do a conversion.

I'm at a loss for words but, hey...if it works, it works.

lordmulder commented 2 years ago

Okay. Not quite sure what is going on. I never encountered such problem. You are the first person to report it.

Am I right to assume it works with the "normal" (non-debug) build too now?

Anyhow, can you please check in your registry the value of AppInit_DLLs at this key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows

Sometimes "injected" DLLs can cause weird things. If there are any "injected" DLLs on your system, try removing them! https://en.wikipedia.org/wiki/DLL_injection#Approaches_on_Microsoft_Windows

Moonswirl commented 2 years ago

Anyhow, can you please check in your registry the value of AppInit_DLLs at this key:

It's empty, so that's a no go.

Am I right to assume it works with the "normal" (non-debug) build too now?

Yeah, completely. The only thing I can maybe guess is that maybe there's a startup sound when first loading the program that's corrupted and causes my sound drivers/the API to freak out and crash it? Something similar happened with Discord where certain corrupted videos would cause it to crash when played.

lordmulder commented 2 years ago

Well, yes. There is a "startup" sound. But, first of all, a multi-media library that plays a sound file must not crash with "access violation" even with a corrupted (intentionally or by transmission error) input file. That would be a severe security flaw. Instead, if the file contains any data that violates the spec or just doesn't make sense, then the library must simply reject the file.

Furthermore, I can guarantee the sound files "embedded" in LameXP are not corrupted. The program has been tested on machines ranging from Windows XP all the way to Windows 11 (and even in the Wine emulator on Linux) and there has been no problem thus far. So, I'm pretty confident that this is not a problem with the specific sound file or with the LameXP code.

Moonswirl commented 2 years ago

Upon further testing it looks like it's actually LicenseAccepted=1 that's letting the program work rather than the sounds being disabled. I guess something's happening when the license agreement pops up and the sound thing was a red herring.

lordmulder commented 2 years ago

I guess something's happening when the license agreement pops up and the sound thing was a red herring.

First start takes you to the "About" screen in order to accept the license. And that also plays a certain sound.

Because of the stack trace, I believe the "crash" is somehow related to sound playback.

A bug in LameXP code, Qt code as well as a bug in Windows is unlikely, because this was never reported by anyone before.

I would suspect an audio driver bug, or something in that vein. Or some 3rd-party software interfering?

(e.g. why is there a Wacom_Tablet thread in the LameXP process? Certainly, this was injected by some 3rd party tool)

Moonswirl commented 2 years ago

I would suspect an audio driver bug, or something in that vein. Or some 3rd-party software interfering?

I do happen to have a Sound Blaster Z card plugged in, which is known to have a lot of problems with recent AMD boards/CPUs and PCI-E Gen 4. I could've sworn I used LameXP after switching to my Ryzen though.

I remember now I did have to switch my PCI-E down to Gen 3 so the darn thing would stop swapping the left/right channels at random. If that's the root cause, then I'll just live with it, especially since I can just fix it by throwing LicenseAccepted=1 into the .cfg whenever you update again.

(e.g. way is there a Wacom_Tablet thread in the LameXP process? Certainly, this was injected by some 3rd party tool)

That's...a really good question. I do have a Wacom One, though I keep it unplugged usually. I don't know why it would need to hook into the process when not only is my One not plugged in, but it should be just working as any other input driver.

Ah well, whatever. The problem's technically solved and I'm just glad I can actually use LameXP again when I need it. Unless you want to keep trying to dig into this in case it somehow happens to someone else, I'm happy to call "case closed" here and not take up too much more of your time.

Either way, merry christmas!

lordmulder commented 2 years ago

I do happen to have a Sound Blaster Z card plugged in, which is known to have a lot of problems with recent AMD boards

Is that so? Works okay for me 😏

grafik

lordmulder commented 2 years ago

If still interested, here is a new test build with additional debug output: https://www.mediafire.com/file/4v3wc8h4ydl56q5/LameXP.2021-12-21.Test.Build-2329.rar/file

Run DebugView before starting LameXP: https://docs.microsoft.com/en-us/sysinternals/downloads/debugview

Best delete/rename your config.ini before the test, so that you get the "first run" screen with sounds enabled.

Moonswirl commented 2 years ago

Here's the log:

dbgview.log

Is that so? Works okay for me 😏

What motherboard are you using? It's a pretty common issue on x570 and B550 boards, the latter of which I have. x570 boards did get a BIOS update a year ago that apparently fixes it, but my B550 still has problems with my card after its own BIOS update.

lordmulder commented 2 years ago

00000182 94.24223328 [9996] [LXP] AboutDialog::exec() 00000183 94.24225616 [9996] [LXP] firstStart -> YES 00000184 94.24227142 [9996] [LXP] soundsEnabled -> YES 00000185 94.24228668 [9996] [LXP] play_sound_file("imageres.dll", 5080) 00000186 94.24409485 [9996] [LXP] success!

So, from LameXP's side of view, it looks like the "startup" sound was played successfully. No crash this time, right?

(if there's no crash this time around, then whatever went wrong earlier is now "fixed" miraculously)

Note: There is a "fallback" path in the code, so if play_sound_file() fails for whatever reason – which it didn't in your case – we resort to play_system_sound() function. The latter will be used to play the standard "WindowsLogon" sound. And that can be freely chosen by the user, in the control panel. So, if user has configured a problematic "WindowsLogon" sound file, this might have been the problem. But, as we see, the play_system_sound() function is never called on your system.

What motherboard are you using? It's a pretty common issue on x570 and B550 boards, the latter of which I have. x570 boards did get a BIOS update a year ago that apparently fixes it, but my B550 still has problems with my card after its own BIOS update.

B550, yes.

FWIW, I have latest Firmware Update (version 2423) and latest AMD Chipset Drivers (version 3.10.22.706) installed.

Moonswirl commented 2 years ago

So, from LameXP's side of view, it looks like the "startup" sound was played successfully. No crash this time, right?

No, it still crashed.

The latter will be used to play the standard "WindowsLogon" sound. And that can be freely chosen by the user, in the control panel. So, if user has configured a problematic "WindowsLogon" sound file, this might have been the problem. But, as we see, the play_system_sound() function is never called on your system.

Oh my god...I'm a doofus. I did happen to change the system startup sound at one point to a custom file I made myself using Winaero Tweaker but it never played correctly, I assumed because my audio drivers took longer to start up than the sound took to play. I had no idea until you mentioned it because it never played, so I completely forgot I changed it.

I think I changed the file name and the folder structure it was in at some point, which may have been the cause for the crash this entire time. I went in there and set my system sounds and the startup sound back to default, restarted, and now LameXP loads as expected thanks to either one of the two. The sound still doesn't play when I boot the computer because the drivers aren't up yet (I guess,) but it does play when accepting the license agreement as expected.

I'm so sorry for wasting your time, I'm a moron lmfao