- If you insist on using C++:
if the problem resists analysis, perhaps you could use Valgrind to help track down the problem. It's pretty easy to build the wine edition of valgrind, and you don't need any special changes to wine. You can download valgrind's sources at http://valgrind.kde.org Look for the 20031012-wine version.
In case there is trouble compiling valgrind the 20031012-wine version doesn't compile on my machine, debian unstable, 2.6.0-test11 kernel. It has a handful of compile issues with kernel headers(I think) that are fixed in valgrind cvs. Unfortunately the patch to make valgrind support wine doesn't apply cleanly to the cvs code. I sent mail to Adam Gundy asking him if he has a newer patch or plans to release another valgrind-wine but he hasn't gotten back to me yet.
Chris