KillProcDLL plug-in: Difference between revisions
m (Updated author and download links, and changed format of some pages.) |
m (→Download Links: interwiki) |
||
(9 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{PageAuthor|DITMan}} | |||
''KillProcDLL ©2003 by DITMan, based upon the KILL_PROC_BY_NAME function programmed by Ravi, reach him at: http://www.physiology.wisc.edu/ravi/ '' | ''KillProcDLL ©2003 by DITMan, based upon the KILL_PROC_BY_NAME function programmed by Ravi, reach him at: http://www.physiology.wisc.edu/ravi/ '' | ||
== Links == | == Download Links == | ||
<attach>KillProcDLL-bin.zip</attach><br> | |||
Plug-in plus the source code in C++. | |||
optimized by size binaries of [[FindProcDLL plug-in|FindProcDll]] and KillProcDll are available here: | |||
<attach>KillProcDll&FindProcDll.zip</attach> | |||
== Introduction == | == Introduction == | ||
This NSIS DLL | This NSIS DLL plug-in provides one function that has the ability to close any process running, without the need to have the 'class name' or 'window handle' you used to need when using the Windows API TerminateProcess or ExitProcess, just with the name of its .exe file. | ||
''''KillProc "process_name.exe"'''' | ''''KillProc "process_name.exe"'''' | ||
Line 50: | Line 56: | ||
AllowRootDirInstall false | AllowRootDirInstall false | ||
OutFile "MSN6-Spanish.exe" | OutFile "MSN6-Spanish.exe" | ||
Caption " | Caption "Traducción al Español del MSN 6 (BETA)" | ||
ShowInstDetails show | ShowInstDetails show | ||
InstallDir "$PROGRAMFILES\MSN Messenger" | InstallDir "$PROGRAMFILES\MSN Messenger" | ||
Section "Main" | Section "Main" | ||
MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON1 "�Desea instalar la | MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON1 "�Desea instalar la actualización al español | ||
del MSN Messenger 6 (BETA)?" IDNO cancelar | |||
## Instalamos el pack en | ## Instalamos el pack en español... | ||
DetailPrint "Instalando | DetailPrint "Instalando traducción." | ||
## Matamos el proceso del MSN Messenger | ## Matamos el proceso del MSN Messenger | ||
Line 75: | Line 82: | ||
## Si no quiere instalarlo, no lo hacemos... | ## Si no quiere instalarlo, no lo hacemos... | ||
cancelar: | cancelar: | ||
DetailPrint " | DetailPrint "Instalación abortada..." | ||
SectionEnd</highlight-nsis> | SectionEnd</highlight-nsis> | ||
Line 108: | Line 115: | ||
-EOF- | -EOF- | ||
[[Category:Plugins]] |
Latest revision as of 17:09, 27 January 2016
Author: DITMan (talk, contrib) |
KillProcDLL ©2003 by DITMan, based upon the KILL_PROC_BY_NAME function programmed by Ravi, reach him at: http://www.physiology.wisc.edu/ravi/
Download Links
KillProcDLL-bin.zip (27 KB)
Plug-in plus the source code in C++.
optimized by size binaries of FindProcDll and KillProcDll are available here: KillProcDll&FindProcDll.zip (3 KB)
Introduction
This NSIS DLL plug-in provides one function that has the ability to close any process running, without the need to have the 'class name' or 'window handle' you used to need when using the Windows API TerminateProcess or ExitProcess, just with the name of its .exe file.
'KillProc "process_name.exe"'
the parameter "process_name.exe" is passed through the stack, and the return code is stored in the $R0 variable.
The meaning of the return codes is this:
- 0 = Process was successfully terminated
- 603 = Process was not currently running
- 604 = No permission to terminate process
- 605 = Unable to load PSAPI.DLL
- 602 = Unable to terminate process for some other reason
- 606 = Unable to identify system type
- 607 = Unsupported OS
- 632 = Invalid process name
- 700 = Unable to get procedure address from PSAPI.DLL
- 701 = Unable to get process list, EnumProcesses failed
- 702 = Unable to load KERNEL32.DLL
- 703 = Unable to get procedure address from KERNEL32.DLL
- 704 = CreateToolhelp32Snapshot failed
Usage with NSIS
Just copy the 'KillProcDLL.dll' in your NSIS plugins directory, and call the function with one of the two suggested syntax in the NSIS documentation:
KillProcDLL::KillProc "process_name.exe"
OR
; Pre 2.0a4 syntax SetOutPath $TEMP GetTempFileName $8 File /oname=$8 KillProcDLL.dll Push "process_name.exe" CallInstDLL KillProc
then check out $R0 to get the return value if you need it.
Example Script
I made this plug-in to fit my need to close MSN Messenger application in order to overwrite a DLL without the need of prompting the user to do it (so it can be installed by REAL newbies) or rebooting the computer through the installation process. Here is the code (it's very simple)
Name "MSN6-Spanish" AllowRootDirInstall false OutFile "MSN6-Spanish.exe" Caption "Traducción al Español del MSN 6 (BETA)" ShowInstDetails show InstallDir "$PROGRAMFILES\MSN Messenger" Section "Main" MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON1 "�Desea instalar la actualización al español del MSN Messenger 6 (BETA)?" IDNO cancelar ## Instalamos el pack en español... DetailPrint "Instalando traducción." ## Matamos el proceso del MSN Messenger KillProcDLL::KillProc "msnmsgr.exe" ## Descomprimimos el archivo... File /oname=$INSTDIR\msgslang.dll "msgslang.dll" DetailPrint "Traducido!" ## Volvemos a cargar el MSN Messenger... Exec $INSTDIR\msnmsgr.exe goto +2 ## Si no quiere instalarlo, no lo hacemos... cancelar: DetailPrint "Instalación abortada..." SectionEnd
Warning
According to MSDN (Microsoft Developers Network):
The TerminateProcess function is used to unconditionally cause a process to exit. Use it only in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used rather than ExitProcess.
So use this DLL carefully as your LAST and EXTREME option :)
Copyrights and all that stuff
The original source file for the KILL_PROC_BY_NAME function is provided, the file is: exam28.cpp, and it MUST BE in this zip file.
You can redistribute this archive if you do it without changing anything on it, otherwise you're NOT allowed to do so.
You may use this source code in any of your projects, while you keep all the files intact, otherwise you CAN NOT use this code.
Contact information:
My homepage: http://petra.euitio.uniovi.es/~i6948857/index.php
Greetings
First of all, thanks to Ravi for his great function...
Then all the winamp.com forums people who helped me doing this (kichik, Joost Verburg, Afrow UK...)
Last but not least, I want to devote this source code to my Girl, Natalia... :)
Compiled in La Felguera, Spain, June-7th-2003
while listening to 'The Cure - Greatest Hits'
(in Winamp 2.91, of course :D)
-EOF-