In my tool at a certain point I want to kill a process by it\'s name. I\'m testing now on Win7 64-bit, but the error I receive is:
A 32 bit processes cann
It is not the Kill() call that fails, it is the foreach on process.Modules. Which is very problematic in a 32-bit process when the target process is 64-bit, this doesn't get emulated perfectly in the Wow64 emulation layer. That's surely a //TODO comment somewhere in the Windows source code with good odds that it just can't easily be implemented.
You'll have to make do with the Process.Name property. Or change your project's Target platform setting in the Compile tab to AnyCPU so that you'll run as a 64-bit process as well. Using the Modules property like you do doesn't otherwise make the code any safer, you are just as likely to kill the wrong process.