We have an automation scenario (mostly MSUIA) between 2 application, the target is 32bit, my app (the automating one) is 64bit, on a 64bit win7. Some of the information that needs to be shared has to be accessed through direkt Win SDK calls (like SendMessage, GetFocus and the like).
From my understanding now, Win64 and 32 Subsystem are completely separate, so any such kind of interaction should fail straight away (trying to e. g. access parts of the 32bit app through a 64bit app). Strangely enough though, most stuff seems to work fine. So there seems to be some kind of marshalling/whatever internally.
I have run into a few scenarios now, though, where there seem to be problems with the way I define my p/invoke functions. I have declared them the "official MS way" with using IntPtr whenever something might change size (also using the great http://www.pinvoke.net/default.aspx/ site), so since I force my .net app to be 64bit (using compile switches), they should be compiled for 64bit using the 64bit versions of the dll.
The strange thing now is that when using those calls to access the 32bit app (like for example GetWindowText which actually reads from the other process' memory) those calls seem to work fine. But. Subsequent MSUIA calls seem to randomly fail.
If I (wrongly) declare a 32bit signature for the p/invoke calls even though compiling to 64bit, everything is running fine.
To me, this makes no sense.
Cleanest solution probably is to compile my app to 32bit as well (or same as target app), still.. I would be grateful for any insights into this one.