I found this code from CathalMF here:
ProcessInfo[] list = ProcessCE.GetProcesses();
foreach (ProcessInfo pinfo in list)
{
if (pinfo.FullPath.EndsWith("MyExe.exe"))
pinfo.Kill();
}
...and modified it to my ends (no pun intended) like so:
ProcessInfo[] list = ProcessCE.GetProcesses();
foreach (ProcessInfo pinfo in list)
{
if (pinfo.FullPath.EndsWith("HHS.exe"))
pinfo.Kill();
// This should work, too, eh?
if (pinfo.FullPath.EndsWith("HUtilCE.dll"))
pinfo.Kill();
}
...but several things are unresolvable in that code (ProcessInfo's FullPath property and Kill method, and ProcessCE). What assembl[ies,y] need I reference to get this to compile?
I added System.Web, which made ProcessInfo itself resolvable, but that is not enough. This indicates that I need System.Diagnostics.Process, but I don't have that on my system...???
This is a small VS 2008 util targeting the Windows CE platform.
UPDATE
Apparently (although a hard-drive search for "System.Diagnostics.Process.dll" turned up nothing), adding the following usings did the trick:
using System.Collections.Generic; using System.Runtime.InteropServices; using System.ComponentModel;
I added these usings in conjunction with this code I got from here:
ProcessInfo[] list = ProcessCE.GetProcesses();
foreach (ProcessInfo item in list)
{
//Debug.WriteLine("Process item: " + item.FullPath);
MessageBox.Show("Process item: " + item.FullPath);
if (item.FullPath.EndsWith("HHS.exe"))
{
MessageBox.Show("about to kill hhs.exe");
item.Kill();
}
if (item.FullPath.EndsWith("HUtilCE.dll"))
{
MessageBox.Show("about to kill hutilce.dll");
item.Kill();
}
}
Did the simple act of running that code cause the resident-in-memory binaries to be freed? I don't know, but being a little bit (albeit not super)-stitious, I'll run this code again if I ever run into the same problem again.
Note, though, that it never showed me my .exe or .dll in the list of running processes. All I saw were:
nk.exe
shell.exe
udevice.exe <= 5 times!
RTLogExport.exe
explorer.exe
servicesd.exe
WCLaunch.exe <= this explains a lot -- somebody is apparently launching a water closet on the device
keyicons.exe
repllog.exe
rapisrv.exe
rnaapp.exe
udp2ftp.exe
cerdisp.exe
PrinterCommanderCE.exe <= this is my util that was running this code
Is it a problem that there were five instances of udevice?
Why did running this solve my problem (if, indeed, that was the solution)?