Here is the code sample
var startInfo = new ProcessStartInfo
{
Arguments = commandStr,
FileName = @"C:\Windows\SysWOW64\logman.exe",
};
using (var createCounterProc = new Process { StartInfo = startInfo })
{
createCounterProc.Start();
createCounterProc.WaitForExit();
}
After running the code I get "A 32 bit processes cannot access modules of a 64 bit process." message in MainModule (NativeErrorCode:299). My solution is configured to AnyCPU. I've tried both 64 and 32 bit versions of logman.exe (C:\Windows\SysWOW64\logman.exe and C:\Windows\System32\logman.exe) but I still have the same error. My OS is Win8.1Prox64. What could cause the problem?
Stack trace:
at System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId, Boolean firstModuleOnly) at System.Diagnostics.NtProcessManager.GetFirstModuleInfo(Int32 processId) at System.Diagnostics.Process.get_MainModule()
Here is the Build configuration:
Choosing Any CPU for Platform target is not enough, you also have to uncheck Prefer 32-bit, otherwise the application will still be run as a 32-bit application.
This is only possible on application projects, not on library project. If your project is a library, you must do it in the project using your library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With