I solved the problem like this:
[DllImport("MyTest.dll", CharSet = CharSet.Ansi)]
private static extern IntPtr DoSomething();
public static string Do_Something()
{
IntPtr tempPointer = DoSomething();
string tempSomething = Marshal.PtrToStringAnsi(tempPointer);
return tempSomething ;
}
The problem had to do with a corrupted heap. The handling of corrupted heaps is different in newer version of Windows and because of that my application crashed. It can be solved through changing the C#-Code or the C++-Code.
Detailed information about the problem can be found here: http://blogs.msdn.com/b/asiatech/archive/2009/12/24/net-application-may-crash-on-windows-2008-when-calling-function-from-native-c-dll.aspx