![]() |
#1 |
Major Dude
Join Date: Jul 2004
Posts: 671
|
nsProcess plugin
Features:
- Find/kill a process by name - Kill all processes with specified name (not only one) - The process name is case-insensitive - Win95/98/ME/NT/2000/XP support - Small plugin size (4,5 Kb) Source function FIND_PROC_BY_NAME based upon the Ravi Kochhar code Thanks iceman_k (FindProcDLL plugin) and DITMan (KillProcDLL plugin) for direct me "nsProcess" plugin v1.0 |
![]() |
![]() |
![]() |
#2 |
Major Dude
Join Date: May 2005
Location: New Zealand
Posts: 923
|
You just keep churning out the plugins. Good one.
"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me) NSIS 3 POSIX Ninja Wiki Profile |
![]() |
![]() |
![]() |
#3 |
Major Dude
|
you just rock, man.
this will revolutionize my installers ![]() maybe i should collect all the good plugins into a package on day, so everyone may download and setup them easily ... hand by comm@nder21 ---------- WiKi pages:CreateInternetShortcut|Enhanced FindWindow|Parse CSV-Data|Open/Close CD-Drive|Installer without Icon|Vista application compatibility |
![]() |
![]() |
![]() |
#4 |
Major Dude
Join Date: Jul 2004
Posts: 671
|
Thanks
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
Join Date: Dec 2004
Location: Turkey
Posts: 447
|
Good to see "Win95/98/ME" support, thanks man!
"Just do it" |
![]() |
![]() |
![]() |
#6 | |
Major Dude
|
Quote:
|
|
![]() |
![]() |
![]() |
#7 |
Major Dude
|
... and include this header file together with the plugins into the package ...
hand by comm@nder21 ---------- WiKi pages:CreateInternetShortcut|Enhanced FindWindow|Parse CSV-Data|Open/Close CD-Drive|Installer without Icon|Vista application compatibility |
![]() |
![]() |
![]() |
#8 |
Major Dude
Join Date: Jul 2004
Posts: 671
|
Fixed: removed CRT dependency (Windows 95 by default does not have msvcrt.dll)
"nsProcess" plugin v1.1 |
![]() |
![]() |
![]() |
#9 |
Major Dude
Join Date: Jul 2004
Posts: 671
|
Changed: Now plugin used header "nsProcess.nsh" for custom user variables and
better compile errors check. Update from previous versions: - Insert line in script: !include "nsProcess.nsh" - Replace: nsProcess::FindProcess -> ${nsProcess::FindProcess} ... - Replace: .r0 -> $0, .r1 -> $1 ... .R0 -> $R0, .R1 -> $R1 ... "nsProcess" plugin v1.2 |
![]() |
![]() |
![]() |
#10 |
Senior Member
Join Date: Dec 2005
Location: Glow
Posts: 285
|
About the code
What is the benefit of using PSAPI for WinNT/2000/XP? Shouldn't the Win95/98/ME method work just as fine in this case?
Edit: Never mind. It's the Toolhelp32.dll what Windows NT does not have. |
![]() |
![]() |
![]() |
#11 |
Senior Member
Join Date: Dec 2005
Location: Glow
Posts: 285
|
Hmm in Win95/98/ME method the hSnapShot HANDLE leaves open if the process was found and bTerminate is FALSE.
|
![]() |
![]() |
![]() |
#12 | |
Major Dude
Join Date: Jul 2004
Posts: 671
|
Quote:
|
|
![]() |
![]() |
![]() |
#13 |
Major Dude
Join Date: Jul 2004
Posts: 671
|
Fixed: removed memory leak.
"nsProcess" plugin v1.3 |
![]() |
![]() |
![]() |
#14 |
Member
Join Date: Apr 2006
Posts: 66
|
hmm I do not understand, can this plugin kill current open notepad ???
Is this able to find notepad that is currently running and kill it immediately ??? |
![]() |
![]() |
![]() |
#15 | |
Senior Member
Join Date: Dec 2005
Location: Glow
Posts: 285
|
Quote:
|
|
![]() |
![]() |
![]() |
#16 | |
Member
Join Date: Apr 2006
Posts: 66
|
How do I create the following thing
1. remove the loop 2. find the processes to find notepad , wordpad means in mutiple form and single finding 3. kill all the following process after finding it existence Quote:
|
|
![]() |
![]() |
![]() |
#17 |
Junior Member
Join Date: Jul 2006
Posts: 6
|
error code 603
I'd downloaded this plugin and had tested it. Test install script always returns Error level 603. If I run script single or with calc.exe
Help me please! What does this error mean? Where I can find error code list? Thank you. I have Windows XP prof x64. |
![]() |
![]() |
![]() |
#18 | |
Major Dude
Join Date: Jul 2004
Posts: 671
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#19 |
Junior Member
Join Date: Jul 2006
Posts: 6
|
I've found that EnumProcessModules fails when is called for 64 bit applications (calc.exe is 64-bit application) on 64 bit OS with error
299 ERROR_PARTIAL_COPY Only part of a ReadProcessMemory or WriteProcessMemory request was completed. I will try to find solution for this problem. |
![]() |
![]() |
![]() |
#20 |
Junior Member
Join Date: Jul 2006
Posts: 6
|
Hello Instructor.
It's me again. Have you tried CreateToolhelp32Snapshot, Process32First, Process32Next functions on NT platforms? It works fine at my comp (I'm administrator). This functions are located in kernel32.dll as MSDN says - no psapi is required and should work on Win95/98, WinNT, Win2000 and Windows XP. Why OpenProcess and EnumProcessModules are used for NT like OS now (Windows 2000, XP, 2003)? Only for Windows NT 4.0 support? |
![]() |
![]() |
![]() |
#21 |
Senior Member
Join Date: Dec 2005
Location: Glow
Posts: 285
|
@oleksa
Could you try this. I removed the PSAPI and OS check and now it's using only the "Win95/98" method. |
![]() |
![]() |
![]() |
#22 |
Junior Member
Join Date: Jul 2006
Posts: 6
|
Hello {_trueparuex^}
Yes - that sample code (based on CreateToolhelp32Snapshot, Process32First, Process32Next functions) works fine on my comp. To save Windows NT 4.0 compatibility I suggest rewrite OS check from code: to code: This check should be true only on Windows NT (as MSDN says). So on NT will work code that gets processes name with PSAPI. Windows 95, 98, Me, 2000, 2003 and XP should support Tool help functions. Last edited by oleksa; 18th July 2006 at 08:42. |
![]() |
![]() |
![]() |
#23 |
Senior Member
Join Date: Dec 2005
Location: Glow
Posts: 285
|
Good. I have my own NSIS unrelated stuff based on the same code... But there is one major disadvantage in CreateToolhelp32Snapshot method. It doesn't work with file names longer than 15 characters. So trying to kill process with name like this "ThisIsPrettyLongName.exe" won't work. One solution would be simply to limit the file names to 15 characters, but that could cause kill of unintentional processes.
So let's see what Instructor gets up to with. ![]() |
![]() |
![]() |
![]() |
#24 |
Major Dude
Join Date: Jul 2004
Posts: 671
|
oleksa can you test it on the x64
Fixed: WinNT 4.0 by default doesn't have PSAPI.DLL. Code for WinNT/2000/XP has been rewritten (using NTDLL.DLL). Note: on WinNT 4.0 process name limited to 15 characters. Changed: error codes. "nsProcess" plugin v1.4 |
![]() |
![]() |
![]() |
#25 |
Junior Member
Join Date: Jul 2006
Posts: 6
|
Instructor works fine, thank you.
looks for calc.exe (603 if process hasn't been started and 0 if process has been started) checks does notepad.exe running and closes all three notepads succesfully. Thank you. |
![]() |
![]() |
![]() |
#26 | |
Junior Member
Join Date: Jul 2006
Posts: 6
|
Quote:
How could wou know that CreateToolhelp32Snapshot method won't work? I have test it and all works fine: code: I could post test code (from MSDN) here or send you e-mail as you wish. Good bye. |
|
![]() |
![]() |
![]() |
#27 | |
Senior Member
Join Date: Dec 2005
Location: Glow
Posts: 285
|
Quote:
![]() @Instructor That 15 characters name limitation is also in Windows 2000 when using NTDLL.DLL ![]() |
|
![]() |
![]() |
![]() |
#28 |
Senior Member
Join Date: Oct 2005
Posts: 189
|
Instructor,
There is a spyware app with a DLL that has the same name as this plug-in: http://www3.ca.com/securityadvisor/p...x?id=453097507 This is too bad...I don't know of a way around having your plug-in associated with adware other than renaming it. Those of you who are already using it may want to rename it to avoid having your installer raise anti-virus/spy flags when running. |
![]() |
![]() |
![]() |
#29 |
Major Dude
Join Date: Jul 2004
Posts: 671
|
Fixed: removed memory leak in WinNT/2000/XP method.
"nsProcess" plugin v1.5 |
![]() |
![]() |
![]() |
#30 | |
Junior Member
Join Date: Feb 2005
Location: Orsay, France
Posts: 10
|
Quote:
Since recent update of McAfee VirusScan, the use of a previous nsProcess version was detected as a Trojan (generic prockill.a)!! The last version (1.5) does not cause the problem. Thanks a lot! Cheers |
|
![]() |
![]() |
![]() |
#31 |
Junior Member
Join Date: Oct 2006
Posts: 13
|
problem trying to kill a service process. i can find the process but when i try to kill it i get return code 601 (no permission to kill process). i am running the installer as an administrator and can kill the process manually.
please help. |
![]() |
![]() |
![]() |
#32 |
Senior Member
Join Date: Dec 2005
Location: Glow
Posts: 285
|
Killing service like that is really not very smart. Rather try to stop it with some of these methods.
http://nsis.sourceforge.net/How_do_I...heck_a_service |
![]() |
![]() |
![]() |
#33 |
Junior Member
Join Date: Oct 2006
Posts: 13
|
thanks but i already have service control implemented in the installer. the problem is when the service is unresponsive and cannot be shut down any other way. i think we can all agree that it is bad to have the installer hang indefinitely.
|
![]() |
![]() |
![]() |
#34 |
Junior Member
Join Date: Oct 2006
Posts: 13
|
i found a solution by modifying the nsProcess source code and using code provided here:
http://www.alexfedotov.com/articles/killproc.asp?pane=0 |
![]() |
![]() |
![]() |
#35 |
Junior Member
Join Date: Oct 2006
Posts: 15
|
Hi jpodtbc, I'm having the exact same problem as you.
Could you be so kind to post your solution here? Thanks a lot |
![]() |
![]() |
![]() |
#36 |
Junior Member
Join Date: Oct 2006
Posts: 15
|
I ended up changing it myself. Here is the source code and dll if someone wants to use it.
|
![]() |
![]() |
![]() |
#37 |
Junior Member
Join Date: Oct 2006
Posts: 13
|
thanks man...i was about to put up my modified source but you beat me to it.
|
![]() |
![]() |
![]() |
#38 |
Junior Member
Join Date: Oct 2006
Posts: 15
|
No problem, I was facing a really tight deadline so I had to go for it.
![]() |
![]() |
![]() |
![]() |
#39 | |
Junior Member
Join Date: Feb 2007
Posts: 5
|
![]() Quote:
Is there any chance of a major change with this DLL to prevent this detection? The DLL itself is really useful, but it looks like someone has used it for less than honest purposes ![]() I have had to take it out of several of my installers for until this can be fixed. |
|
![]() |
![]() |
![]() |
#40 | |
Junior Member
Join Date: Feb 2005
Location: Orsay, France
Posts: 10
|
Re: Trojan AV Trigger
Quote:
Cheers |
|
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|