Code works on windows 7 and not on XP

My partner has been working from the Juce examples for the Audio Plugin Host and the InterprocessCommsDemo, modifying things as necessary to have certain functionality. He managed to get all the functionality we needed for now from JUCE to help us play piano notes with low latency, however when we tried to run the project on XP it crashes. To make it easier to look at the code and run it, he separated the flash functionality out of it.

He says:

I actually need the Juce code to be in a dll, so I can link to it from Flash. They have recently come out with a way to extend actionscript into C++ but it requires a dll. We have been very successful with this but recently noticed that it crashes on XP for some reason that we can’t seem to figure out. We know that all the functionality we require is perfectly capable of running on XP because it works fine in the Juce examples from which I have been working.

The chances of someone knowing Actionscript, Juce and the fairly new Flash Runtime Extensions is slim-to-none; whereas the chances of someone knowing Juce & C++ are very high. Therefore, I decided to strip out all the Flash from the dll and create a very basic C++ app to load it and call the method where I believe the problem to be. In this way a C++/Juce expert will be much more likely to a) give me the time of day and b) actually help point out the root of the problem.

You can download the code here:
The following are the instructions on how to get things working in Visual Studio 10:

My Steinberg path is C:\SDKs\vstsdk3.5.1. The same XP crash happens with the vstsdk2.4, so that’s not the issue. If you only have 2.4 and don’t want to jump through the Steinberg hoops to get 3.5.1, then just switch your path in the Additional Includes Directories field of the Properties->C+±>General
I have the latest Juce version on my C:\ drive (version 2.0.22)
Build the project and copy the colorKeysExtensions.dll and colorKeysExtensions.lib from the release folder

Paste the two files in with the soucre code found in the colorKeysDllLoader folder (which is in the outer colorKeysDllLoader folder). They will already be there so you can overwrite them, with any changes that you make.
Build the project and you will find the colorKeysDllLoader.exe in the outermost release folder.
The project will run from Visual Studio but if you want to use the colorKeysDllLoader.exe on it’s own, you need to make sure that the colorKeysExtensions.dll is in the same directory.
I have also included the colorKeysExtensions.dll and the colorKeysDllLoader.exe, in case you wanted to just run it quickly to observe the behavior.

The colorKeysDllLoader.exe runs just fine in Vista/7 but crashes every time on XP.

Note:Even though there is a lot of crash-causing crap in the colorKeysExtensions.dll after my serious butchering of it, none of it is getting called. The only two methods that get called are the startUp and shutDown methods and shutDown is only getting called on the closing of the main colorKeysDllLoader window. Since we know that the problem is occurring in the startUp method, this is not an issue.

So I am pretty sure we can trace the problem to the AudioDeviceManager (or rather how I may be misusing it).

startUp is found in HostStartup. startUp calls initialize; initialize calls the MainHostWindow constructor; MainHostWindow constructor calls deviceManager.initialise, which I believe is crashing XP. I just lack the knowledge to figure out what might be happening beyond that point.

Any insight that you might have would be greatly appreciated.

Thank you for your time and effort,

Little Sparky

Why don’t you place a breakpoint in the section of the code where you assume the crash to be occuring?