installscript


InstallScript detect app during upgrade?


MyApp.exe is installed using an InstallScript 2014 project. The folks in manufacturing recently tried to upgrade to a more recent development version but did not close the existing instance of MyApp. This resulted in many permission denied errors since the various dll's used by the app were locked and in use.
I expected the InstallScript executable to do the usual "stage and reboot" thing that all Windows folks are intimate with. It did not do that, and I can't see anything in the InstallShield project editor that obviously lets me force that behavior.
I also expected InstallScript to allow me to somehow detect that my app was already running - if I can do that, I can display a dialog to give the user a chance to close the app and continue. The only solution for this is InstallSite.org List and Shutdown Running Processes. (Note this is unanswered on another S/O question.)
That does not properly detect all of the running tasks, including my own.
Before I spend a couple of days trying to fix what seems to be an obviously missing feature of InstallScript, I thought I'd ask if there's a better approach.
Here's what I came up with. Hope this helps.
// defines/protos for finding a process
#define TH32CS_SNAPPROCESS 0x00000002
// in Kernel32.dll
prototype NUMBER Kernel32.CreateToolhelp32Snapshot(NUMBER , NUMBER);
prototype BOOL Kernel32.Process32First(HWND , POINTER );
prototype BOOL Kernel32.Process32Next(HWND , POINTER );
// from minwindef.h, windows api
typedef PROCESSENTRY32
begin
number dwSize;
number cntUsage;
number th32ProcessID; // this process
number th32DefaultHeapID;
number th32ModuleID; // associated exe
number cntThreads;
number th32ParentProcessID; // this process's parent process
number pcPriClassBase; // Base priority of process's threads
number dwFlags;
STRING szExeFile[MAX_PATH]; // Path
end;
// ========================================================================================
// list all of the running processes, see if Flex is running
// based on https://msdn.microsoft.com/en-us/library/windows/desktop/ms686701(v=vs.85).aspx
// ========================================================================================
function BOOL IsProcessRunning(sProcessName)
HWND hProcessSnap;
PROCESSENTRY32 pe;
POINTER ppe;
NUMBER ret;
begin
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
pe.dwSize = SizeOf(pe);
ppe = &pe;
ret = Process32First(hProcessSnap, ppe);
if (ret == 0) then
//printError(TEXT("Process32First")); // show cause of failure
CloseHandle(hProcessSnap); // clean the snapshot object
return(FALSE);
endif;
repeat
if (StrCompare(sProcessName, pe.szExeFile) == 0) then
CloseHandle(hProcessSnap); // clean the snapshot object
return(TRUE);
endif;
ret = Process32Next(hProcessSnap, ppe);
until (ret == 0);
return(FALSE);
end;
You then call it
if (IsProcessRunning("WORD.EXE")) then
blah blah
endif;

Related Links

Let Setup.exe return '0'(success) when reinstalling - installshield
Limitations of InstallScript “Is(FILE_EXISTS, filename)”?
InstallScript Reboot after multiple prequisites
InstallScript detect app during upgrade?
InstallShield - Detect USB 3.0 Ports
Execute command line statement in installshield / installscript
InstallScript and machine.config
Need an example of /installfromweb command line switch for Installscript Project Setup.exe
How do you compare versions in InstallScript?
unInstallApplication of InstallShield is not working
How to find if the Installatoion was per user or per machine installation
During uninstallation the dll does not remove from system32 folder
Good resources on InstallScript

Categories

HOME
paraview
ecmascript-6
alexa-skills-kit
interface
solaris
edge
web-hosting
pyqt4
odoo-8
nfs
arangodb
g++
cumulocity
searchview
dynamic-sql
job-scheduling
google-content-api
wolframalpha
imessage
joptionpane
event-store
data.stackexchange.com
entity-relationship-model
firebase-analytics
rpgle
custom-controls
send
cart
modalviewcontroller
hivemq
sessionstorage
tex
modernizr
node-mssql
password-protection
magento-1.9.3
laravel-elixir
ssrs-2014
libgphoto2
hammer.js
avx
skin
jqchart
swingworker
stripe-connect
hadoop-2.7.2
greatest-n-per-group
scaffolding
gogs
kango-framework
qbxml
toolkit
zscript
viola-jones
liquid-layout
mirror
alloy-ui
entity-framework-4.3
openbabel
procedural-programming
contrast
metatrader5
cuba
verold
parallel-testing
malformedurlexception
dct
gae-quotas
synapse
openargs
eclipse-kepler
gtm-oauth2
ice-cube
css-reset
android-icons
swfobject
patricia-trie
faye
apache-whirr
virtualpathprovider
gobject-introspection
u2netdk
uipagecontrol
inline-formset
django-paypal
codebase
undefined-index
ie-compatibility-mode
nstokenfield
silverlight-oob
application-planning
idatareader

Resources

Encrypt Message