My application interfaces with Task Manager. The code that handles this thus loads mstask.dll. The problem I have is that my application (which is 32-bit) fails on Windows 7 64-bit with the error message "%1 is not a valid win32 application".
Using a map file and some stack tracing I have determined that this error message is triggered when CoCreateInstance is called with the GUID of the Task Scheduling Service. By using Process Monitor from SysInternals I was able to determine that my application is actually trying to load C:\Windows\system32\mstask.dll instead of C:\Windows\SYSWOW64\mstask.dll which is the 32-bit version of mstask.dll.
The reason for the error message is thus that the application tries to load C:\Windows\system32\mstask.dll which is a 64-bit DLL, which will obviously not work from my 32-bit app.
Does anyone know any reason why CoCreateInstance would not correctly load the 32-bit version of mstask.dll? Obviously SYSWOW64 redirection is not working properly.
The strange thing is that I have created a small test app that just attempts to initialize the Task Scheduler service. In this test app the CoCreateInstance call succeeds without any problem. So something about my real application must be different, but I have no idea what.
Any and all input is appreciated!