Old 6th May 2010, 11:44   #1
dhiraj3301
Junior Member
 
Join Date: Apr 2010
Posts: 39
Question KillProc plug-in is not working in x64 bit machines

KillProc plug-in is not working in x64 bit machines

I have written following code:

StrCpy $0 "Draw.exe"
KillProc::FindProcesses
${If} $0 > 0
StrCpy $0 "Draw.exe"
KillProc::KillProcesses
${Endif}

this code is working fine on 32 bit machine,
anyone can please suggest what to do for for killing process in x64 bit machine.
dhiraj3301 is offline   Reply With Quote
Old 6th May 2010, 13:40   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Is the process a 32-bit process or a 64-bit one? What is $1 set to after calling KillProcesses?

Stu
Afrow UK is offline   Reply With Quote
Old 6th May 2010, 14:21   #3
dhiraj3301
Junior Member
 
Join Date: Apr 2010
Posts: 39
it is 64 bit process

process name is same but it is not able to find that process using
KillProc::FindProcesses
dhiraj3301 is offline   Reply With Quote
Old 6th May 2010, 16:11   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
What is the value of $1 after the KillProcesses call?
Does the plug-in kill 32-bit processes OK?

Stu
Afrow UK is offline   Reply With Quote
Old 7th May 2010, 04:37   #5
dhiraj3301
Junior Member
 
Join Date: Apr 2010
Posts: 39
the value of $1 after the KillProcesses call is 0
this plug in kill 32-bit machines processes sucessfully.
dhiraj3301 is offline   Reply With Quote
Old 7th May 2010, 09:38   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
This is a problem with the EnumProcessModules API and 32-bit processes. It cannot enumerate modules of a 64-bit process when the caller is a 32-bit process, therefore it fails to find your process name. If you must kill your application (i.e. you cannot safely close it with WM_CLOSE for example) then you will need to write a 64-bit executable to do it that you execute with NSIS. Don't bother trying any other plug-ins either because the EnumProcessModules limitation is not plug-in specific.

Stu
Afrow UK is offline   Reply With Quote
Old 2nd November 2010, 13:29   #7
Javarome
Junior Member
 
Join Date: Oct 2010
Location: Paris, France
Posts: 9
I confirm the need for a 64 bit process killing ability. Anything planned about that?
Javarome is offline   Reply With Quote
Old 2nd November 2010, 18:44   #8
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
Have you tried to use WMI? You should be able to query the processes (by name) and when you have the one you want to kill, call the Terminate method on the WMI process object.
demiller9 is offline   Reply With Quote
Old 11th February 2011, 11:14   #9
Javarome
Junior Member
 
Join Date: Oct 2010
Location: Paris, France
Posts: 9
Yes WMI seems to be the recommended approach to implement it, but I was more expecting a support from NSIS (or a NSIS plugin).

That said, I also found the EnumProcessModulesEx is your friend for listing both 32 and 64 bits processes, but with static linking issues however (not located in the same library since Win7).
Javarome is offline   Reply With Quote
Old 11th February 2011, 15:12   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
As I've already said, EnumProcessModulesEx is no good when the calling process is 32-bit. It will return the same results as EnumProcessModules (MSDN states this too). The only way is to use WMI (or write a 64-bit app to do it).

Stu
Afrow UK is offline   Reply With Quote
Old 21st July 2011, 20:26   #11
chironex
Junior Member
 
Join Date: Jul 2011
Posts: 1
I had the same problem and updated the code to use WMI as was suggested.

http://chironexsoftware.com/blog/?p=34
chironex is offline   Reply With Quote
Old 8th January 2012, 23:30   #12
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
the documentation of this plugin is really poor
Quote:
KillProcWMI , is an NSIS plugin based on the original KillProc plugin. KillProcWMI uses WMI to acheive the same results, which avoids problems with 32bit processes not being able to kill 64 bit processes.

All Code is freely provided, no guarantees or warranties about its quality, use at your own risk.

Jared Allen.
ChironexSoftware.com
i have tried all options to get it working - failed

tried it with "killproc", "killprocwmi" with same filename...
http://nsis.sourceforge.net/KillProc_plug-in

anyone with a working example? (and file places to put in except \plugins)
Brummelchen is offline   Reply With Quote
Old 9th January 2012, 00:24   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Did you use the DLL he provided? http://www.chironexsoftware.com/down...illProcWMI.zip

Stu
Afrow UK is offline   Reply With Quote
Old 9th January 2012, 16:23   #14
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
ofc - thats why i wonder it does not work.
the major problem is that i can not compile the file!
Brummelchen is offline   Reply With Quote
Old 9th January 2012, 18:38   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
What do you mean it does not work? What do you mean you cannot compile the file? Please elaborate.

Stu
Afrow UK is offline   Reply With Quote
Old 9th January 2012, 21:01   #16
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
compiling
KillProc::FindProcesses

not compiling
KillProcWMI::FindProcesses

> Invalid command: KillProcWMI::FindProcesses

if i rename KillProcWMI.dll to KillProc.dll
and use the regular Killproc syntax

> Invalid command: KillProc::FindProcesses

bleh

so what is the correct syntax?

both dll are in \plugins
Brummelchen is offline   Reply With Quote
Old 9th January 2012, 21:03   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
There is only one function KillProcWMI::KillProc (if in doubt look at the source code, or look at the output from makensis which lists all plug-in functions).

Stu
Afrow UK is offline   Reply With Quote
Old 9th January 2012, 21:59   #18
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
omg how stupid ist that?
ofc i can force terminating a thread but more polite is the option for user to end it manually
so i try to find the process at first but there is no plugin for x64 which can do that.
Brummelchen is offline   Reply With Quote
Old 14th January 2012, 16:24   #19
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
sorry, wont work here

StrCpy $0 "filename.exe"
KillProcWMI::KillProc

any new hints for 64bit?
Brummelchen is offline   Reply With Quote
Old 16th February 2012, 04:17   #20
Rapport12
Junior Member
 
Join Date: Feb 2012
Posts: 3
I was successful using:

KillProcWMI::KillProc "ProcessName.exe"

In that way I guess it works more like the older KillProc Plug-in rather than the new one. However, I was able to terminate a 64-bit process on Windows Server 2008 R2 using it.
Rapport12 is offline   Reply With Quote
Old 16th February 2012, 21:12   #21
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
i will try next days, actually i still need WMIC to determine task and to kill it.
Brummelchen is offline   Reply With Quote
Old 20th February 2018, 13:51   #22
lkn
Junior Member
 
Join Date: Feb 2018
Posts: 1
Quote:
Originally Posted by Afrow UK View Post
This link has expired. Does anyone have a copy??
I googled it, but I'm not lucky.
lkn is offline   Reply With Quote
Old 20th February 2018, 14:33   #23
stass
Senior Member
 
Join Date: Nov 2012
Posts: 145
https://github.com/axelstudios/Mouse...illProcWMI.zip
stass is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump