PDA

View Full Version : How to use Dev7 to uninstall an app installed with IS6.1



NewsArchive
12-04-2001, 01:00 AM
I have created a new application (not an import of the old project) that
should uninstall the previous release of my app from user's machines. This
is not a major upgrade - just a migration to Dev7. I copied the GUID from
IS6 into the product code under Dev7. This is the same code found in the
registry under HKLM\....\Uninstall\{...}. I would have expected the
installation to begin in maintenance mode when the build is deployed on a
machine already containing the app - but it doesn't. It acts as if this is
a first time install. What further do I need to do. Thanks in advance for
any help.

NewsArchive
12-05-2001, 01:00 AM
Hi...

Are you writing a Windows Installer installation using Dev 7???

If you do, the engine have routines for uninstall an IS6.1 automatically,
you have to do this manually, or create a CA that does it for you. I havent'
made any installations in IS 6.1, but I had our installations in IS 5.5 and
what I did was this:

1. Searched the registry for the old product to retrive the uninstall string
(located in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall).
2. Created a CA that triggers that uninstall string.
3. Started this CA in the beginning of the InstallUISequence (Remember: It
has to be after AppSearch action. I'd put it after CostFinalize)

A tip: Give a warning to the user what's happends.


Hope this helps.

--Rune G


"David" <david@ardentech.com> wrote in message
news:3c0d9d91@news.installshield.com...
> I have created a new application (not an import of the old project) that
> should uninstall the previous release of my app from user's machines.
This
> is not a major upgrade - just a migration to Dev7. I copied the GUID from
> IS6 into the product code under Dev7. This is the same code found in the
> registry under HKLM\....\Uninstall\{...}. I would have expected the
> installation to begin in maintenance mode when the build is deployed on a
> machine already containing the app - but it doesn't. It acts as if this
is
> a first time install. What further do I need to do. Thanks in advance
for
> any help.
>
>

NewsArchive
12-05-2001, 01:00 AM
The uninstall string can be determined by looking at this registry entry:

HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\<App Name>
Value: UninstallString

Getting this value will give you the command line you need to run to perform
the uninstall.

To get it to run silently, you'd need to add "-a" in front of the "-f" part
of the uninstall string.

For more info on running uninstallations, see KB articles Q100021, Q101507,
and Q101679.

"David" <david@ardentech.com> wrote in message
news:3c0d9d91@news.installshield.com...
> I have created a new application (not an import of the old project) that
> should uninstall the previous release of my app from user's machines.
This
> is not a major upgrade - just a migration to Dev7. I copied the GUID from
> IS6 into the product code under Dev7. This is the same code found in the
> registry under HKLM\....\Uninstall\{...}. I would have expected the
> installation to begin in maintenance mode when the build is deployed on a
> machine already containing the app - but it doesn't. It acts as if this
is
> a first time install. What further do I need to do. Thanks in advance
for
> any help.
>
>

NewsArchive
12-05-2001, 01:00 AM
Thanks for your reply. Yes this is a Windows Installer project using Dev7.
I basically understand your reply, though I'm not sure what a 'CA' is.
Would you have a code snippet that might clarify this issue. Thanks.

"Rune G" <rg#world-online.no> wrote in message
news:3c0dd9f7@news.installshield.com...
> Hi...
>
> Are you writing a Windows Installer installation using Dev 7???
>
> If you do, the engine have routines for uninstall an IS6.1 automatically,
> you have to do this manually, or create a CA that does it for you. I
havent'
> made any installations in IS 6.1, but I had our installations in IS 5.5
and
> what I did was this:
>
> 1. Searched the registry for the old product to retrive the uninstall
string
> (located in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall).
> 2. Created a CA that triggers that uninstall string.
> 3. Started this CA in the beginning of the InstallUISequence (Remember: It
> has to be after AppSearch action. I'd put it after CostFinalize)
>
> A tip: Give a warning to the user what's happends.
>
>
> Hope this helps.
>
> --Rune G
>
>
> "David" <david@ardentech.com> wrote in message
> news:3c0d9d91@news.installshield.com...
> > I have created a new application (not an import of the old project)
that
> > should uninstall the previous release of my app from user's machines.
> This
> > is not a major upgrade - just a migration to Dev7. I copied the GUID
from
> > IS6 into the product code under Dev7. This is the same code found in
the
> > registry under HKLM\....\Uninstall\{...}. I would have expected the
> > installation to begin in maintenance mode when the build is deployed on
a
> > machine already containing the app - but it doesn't. It acts as if this
> is
> > a first time install. What further do I need to do. Thanks in advance
> for
> > any help.
> >
> >
>
>

NewsArchive
12-05-2001, 01:00 AM
Hi..

CA is the commonly used short name for Custom Actions....

If you haven't worked with Custom Actions before I would advise you to read
MSI Help Library's documents
on the topic.

I made this Custom Action in C (Windows Installer DLL) (See MSI Help Library
documentation about this) the code is placed below... (I always use Windows
Installer Dlls to avoid installing special packages on client computers to
be able to run e.g Installscript)

A another (and possible more easier) way is to create a custom action of
type Launch an executable with location set to Stored in the Property table.
I have not tried this myself, so I don't know if it works...

Hopes this helps!

--Rune G


/*
THE CODE!

This function requires that the OLDPRODINSTALLED property is set before
calling this function.
*/
UINT __stdcall UninstallOldProduct(MSIHANDLE hMsi)
{
WCHAR* pwszPath = new WCHAR[255];
WCHAR wszProg[255] = TEXT("");
WCHAR wszParams[255] = TEXT("");
WCHAR* pwchPos = NULL;
DWORD dwSizeOfPath = 255;
UINT uiRes = ERROR_SUCCESS;
STARTUPINFO si;
PROCESS_INFORMATION pi;

uiRes =
MsiGetProperty(hMsi,TEXT("OLDPRODINSTALLED"),pwszPath,&dwSizeOfPath);

if(uiRes != ERROR_SUCCESS)
{
if(uiRes == ERROR_MORE_DATA)
{
delete [] pwszPath;
pwszPath = new WCHAR[dwSizeOfPath];

uiRes =
MsiGetProperty(hMsi,TEXT("OLDPRODINSTALLED"),pwszPath,&dwSizeOfPath);
if(uiRes != ERROR_SUCCESS)
goto endUninstallOldProduct;

}
else
goto endUninstallOldProduct;
}

pwchPos = wcschr(pwszPath,TEXT(' '));

wcsncpy(wszProg,pwszPath,pwchPos - pwszPath);


wcscpy(wszParams,pwchPos);

memset (&si, 0, sizeof(STARTUPINFO));
memset (&pi, 0, sizeof(PROCESS_INFORMATION));

si.cb = sizeof(si);

si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWNORMAL;

CreateProcess(wszProg,wszParams,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);


endUninstallOldProduct:
if(pwszPath)
delete [] pwszPath;
return 0;
}


"David" <david@ardentech.com> wrote in message
news:3c0e1233$1@news.installshield.com...
> Thanks for your reply. Yes this is a Windows Installer project using
Dev7.
> I basically understand your reply, though I'm not sure what a 'CA' is.
> Would you have a code snippet that might clarify this issue. Thanks.
>
> "Rune G" <rg#world-online.no> wrote in message
> news:3c0dd9f7@news.installshield.com...
> > Hi...
> >
> > Are you writing a Windows Installer installation using Dev 7???
> >
> > If you do, the engine have routines for uninstall an IS6.1
automatically,
> > you have to do this manually, or create a CA that does it for you. I
> havent'
> > made any installations in IS 6.1, but I had our installations in IS 5.5
> and
> > what I did was this:
> >
> > 1. Searched the registry for the old product to retrive the uninstall
> string
> > (located in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall).
> > 2. Created a CA that triggers that uninstall string.
> > 3. Started this CA in the beginning of the InstallUISequence (Remember:
It
> > has to be after AppSearch action. I'd put it after CostFinalize)
> >
> > A tip: Give a warning to the user what's happends.
> >
> >
> > Hope this helps.
> >
> > --Rune G
> >