I have looked through the forums a bit, and found this information.
Gizm0 wrote:Well you are not lucky,i'm out of town and i don't have my InstallAWARE here, so i can create a script for you.. It's quite easy actually, you have to call an API to do it.. It's TerminateProcess and before that you have to get the process handle by it's process name. To do that you have to EnumProcesses ( read here -> http://msdn.microsoft.com/library/defau ... cesses.asp ) and get the PIDs and then using the pids to get the process name/handle.
If what I am understanding from this post, it says to make an API call to psapi.dll to enumerate through the running processes.
I have written a c++ program to do this. Thats no problem. How do I link something like this to my InstallAware setup script? The only options I have come up with have been to build a dll that performs the following code, include it in the setup script, and then make a call to the dll. before running the main install. Does this make sense?
DWORD aProcesses [1024], cbNeeded, cProcesses;
if(!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
{
return 0;
}
cProcesses = cbNeeded / sizeof(DWORD);
for(int i = 0; i < cProcesses; i++)
{
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, aProcesses[i]);
if(hProcess == NULL)
{
continue;
}
HMODULE hMod;
if(!EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded))
{
continue;
}
TCHAR szProcName[1024];
GetModuleBaseName(hProcess, hMod, szProcName, 1024/sizeof(TCHAR));
// if the correct process name, terminate it.
}
I am not getting anywhere with this. I could really use a hand.