Archive: EXE not found


EXE not found
I have a function that exits the running EXE file before uninstall the whole thing (including the EZE).

Somehow it doesn't work and keeps on giving me that the exe is not running (I test it with a message box).

What could be wrong?

(at the top of the script)
!define MUI_PROGRAM_FILENAME "XYZ"

;**************************************************************************************************
;FUNCTION - un.KillProgramExe
;**************************************************************************************************

Function un.KillProgramExe

FindProcDLL::FindProc "${MUI_PROGRAM_FILENAME}.exe"
StrCmp $R0 1 foundexe notfoundexe

foundexe:
KillProcDLL::KillProc "${MUI_PROGRAM_FILENAME}.exe"

notfoundexe:
MessageBox MB_OK "Program is not running"

FunctionEnd


Very weird..............I run it, message box says it's not running but I quit the installer/uninstaller (the routine is run either way) and it closes the EXE file (thus process).

Just what is going on?

If it's supposedly not running it shouldn't run the code as if it was running....


That's something to do with the fact that after it hits "foundexe:", it will then execute the "notefoundexe:" label code - you have to jump over this if you want it to not be executed as well. E.g.


Function un.KillProgramExe

FindProcDLL::FindProc "${MUI_PROGRAM_FILENAME}.exe"
StrCmp $R0 1 foundexe notfoundexe

foundexe:
KillProcDLL::KillProc "${MUI_PROGRAM_FILENAME}.exe"
Goto +3

notfoundexe:
MessageBox MB_OK "Program is not running"

FunctionEnd

goto +2
Labels are not considered.

Aah I always wondered about that :)


You also must use proper lables when jumping over compile time Function/Section commands such as File, ReserveFile etc
A full list of these are in the documentation (somewhere!)

-Stu


Oh really? I thought you only had to use labels when you're jumping over macros.


See http://nsis.sourceforge.net/Docs/Chapter4.html#4.4

-Stu


Originally posted by Afrow UK
See http://nsis.sourceforge.net/Docs/Chapter4.html#4.4

-Stu
Well guys you do raise a worthy item of knowledge but some further testing seems to point it's something extra to what's already been proposed.

For some reasons it keeps on assuming the exe is not running when it is, my eyes do not lie and that I can be sure of.

Doing further testing, possibly it's mixing up the file name somehow.

Also after running FindProc the value of $R0 is "603".


"603" used to be one of the codes which FindProc could return:

From the documentation supplied with FindProc.dll dated 25 December 2003:

The meaning of the return codes is this:

0 = Process was successfully terminated
603 = Process was not currently running
605 = Unable to load PSAPI.DLL
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

From the documentation supplied with FindProc.dll dated 2 June 2004:

The meaning of the return codes is this:

0 = Process was not found
1 = Process was found
605 = Unable to search for process
606 = Unable to identify system type
607 = Unsupported OS
632 = Process name is invalid

Which version of FindProc.dll are you using?


Originally posted by pengyou
"603" used to be one of the codes which FindProc could return:

From the documentation supplied with FindProc.dll dated 25 December 2003:

The meaning of the return codes is this:

0 = Process was successfully terminated
603 = Process was not currently running
605 = Unable to load PSAPI.DLL
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

From the documentation supplied with FindProc.dll dated 2 June 2004:

The meaning of the return codes is this:

0 = Process was not found
1 = Process was found
605 = Unable to search for process
606 = Unable to identify system type
607 = Unsupported OS
632 = Process name is invalid

Which version of FindProc.dll are you using?
I looked at the DLL and it states "December 25th 2003".

It's definetly running "The process" as it's visible in task manager.