PDA

View Full Version : How to call a DLL during uninstall (Standard Project)



NewsArchive
12-07-2001, 01:00 AM
Hi,
I migrated an install from IS 5.5x to ISDEV 7. There is a call in the
old script to modify the uninstall command line so it can call a custom dll
during uninstall (ISuninst.exe...-c{path to dll}. I looked at the knowledge
base about this and it states to add the OnUninstall( ) event to my script
and use the DLL in there. I have added the OnUninstall code, but it didn't
say what code to add regarding the custom dll. Can someone please help me as
to how to add this code so my custom dll is called during uninstall??? Here
is a code sample: Please add in the code I am missing to get it to work.
Thanks.

function OnUninstall()
BOOL bvOpt1, bvOpt2;
string szTitle, szMsg1, szMsg2, szOpt1, szOpt2, svResult, szCaption;
begin
svResult = SdLoadString(ISWI_IS5_UNINST_MSG);
szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
Sprintf (svResult, svResult, "My New Unistall");
if (IDCANCEL = SprintfBox(MB_OKCANCEL, szCaption, svResult)) then
abort;
endif;

Enable(STATUSEX);

//////////////////////////////////////
//DO NOT DELETE. The below code will
//initiate the uninstallation process.
ComponentRemoveAll();
ComponentTransferData(MEDIA);
//////////////////////////////////////

Disable(STATUSEX);

bvOpt1 = FALSE;
bvOpt2 = FALSE;
szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
SdFinishEx(szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bvOpt1, bvOpt2);
end;

NewsArchive
12-07-2001, 01:00 AM
You should add your DLL file to the setup files pane in the IDE. Those
files are streamed out to the system variable SUPPORTDIR. You could then
call UseDLL on that file and call a function on it.

If you search the Help Library for UseDLL there you will find an example of
calling a function in a DLL from InstallScript.

Regards
David Thornley

"Joe Antonelli" <Jantonelli@Symantec.com> wrote in message
news:3c110704$1@news.installshield.com...
> Hi,
> I migrated an install from IS 5.5x to ISDEV 7. There is a call in the
> old script to modify the uninstall command line so it can call a custom
dll
> during uninstall (ISuninst.exe...-c{path to dll}. I looked at the
knowledge
> base about this and it states to add the OnUninstall( ) event to my script
> and use the DLL in there. I have added the OnUninstall code, but it didn't
> say what code to add regarding the custom dll. Can someone please help me
as
> to how to add this code so my custom dll is called during uninstall???
Here
> is a code sample: Please add in the code I am missing to get it to work.
> Thanks.
>
> function OnUninstall()
> BOOL bvOpt1, bvOpt2;
> string szTitle, szMsg1, szMsg2, szOpt1, szOpt2, svResult, szCaption;
> begin
> svResult = SdLoadString(ISWI_IS5_UNINST_MSG);
> szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
> Sprintf (svResult, svResult, "My New Unistall");
> if (IDCANCEL = SprintfBox(MB_OKCANCEL, szCaption, svResult)) then
> abort;
> endif;
>
> Enable(STATUSEX);
>
> //////////////////////////////////////
> //DO NOT DELETE. The below code will
> //initiate the uninstallation process.
> ComponentRemoveAll();
> ComponentTransferData(MEDIA);
> //////////////////////////////////////
>
> Disable(STATUSEX);
>
> bvOpt1 = FALSE;
> bvOpt2 = FALSE;
> szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
> szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
> SdFinishEx(szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bvOpt1, bvOpt2);
> end;
>
>

NewsArchive
12-07-2001, 01:00 AM
Hi,
Perhaps my question is not clear. Sorry. I know how to call a function
in a dll. This is a special case where it needs to be called from Uninstall.
With IS 5.5x, you could pass a command line parameter to ISuninst.exe that
would use a custom dll to do cutom uninstall procedures. That dll would need
to contain 2 functions called UninstInitialize( ) and UninstUnInitialize( ).
I want to know how to do this using ISDev 7
"David Thornley" <davidt@installshield.com> wrote in message
news:3c110e35$1@news.installshield.com...
> You should add your DLL file to the setup files pane in the IDE. Those
> files are streamed out to the system variable SUPPORTDIR. You could then
> call UseDLL on that file and call a function on it.
>
> If you search the Help Library for UseDLL there you will find an example
of
> calling a function in a DLL from InstallScript.
>
> Regards
> David Thornley
>
> "Joe Antonelli" <Jantonelli@Symantec.com> wrote in message
> news:3c110704$1@news.installshield.com...
> > Hi,
> > I migrated an install from IS 5.5x to ISDEV 7. There is a call in
the
> > old script to modify the uninstall command line so it can call a custom
> dll
> > during uninstall (ISuninst.exe...-c{path to dll}. I looked at the
> knowledge
> > base about this and it states to add the OnUninstall( ) event to my
script
> > and use the DLL in there. I have added the OnUninstall code, but it
didn't
> > say what code to add regarding the custom dll. Can someone please help
me
> as
> > to how to add this code so my custom dll is called during uninstall???
> Here
> > is a code sample: Please add in the code I am missing to get it to work.
> > Thanks.
> >
> > function OnUninstall()
> > BOOL bvOpt1, bvOpt2;
> > string szTitle, szMsg1, szMsg2, szOpt1, szOpt2, svResult, szCaption;
> > begin
> > svResult = SdLoadString(ISWI_IS5_UNINST_MSG);
> > szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
> > Sprintf (svResult, svResult, "My New Unistall");
> > if (IDCANCEL = SprintfBox(MB_OKCANCEL, szCaption, svResult)) then
> > abort;
> > endif;
> >
> > Enable(STATUSEX);
> >
> > //////////////////////////////////////
> > //DO NOT DELETE. The below code will
> > //initiate the uninstallation process.
> > ComponentRemoveAll();
> > ComponentTransferData(MEDIA);
> > //////////////////////////////////////
> >
> > Disable(STATUSEX);
> >
> > bvOpt1 = FALSE;
> > bvOpt2 = FALSE;
> > szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
> > szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
> > SdFinishEx(szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bvOpt1, bvOpt2);
> > end;
> >
> >
>
>

NewsArchive
12-07-2001, 01:00 AM
The model for uninstall is different from 5.X. In Developer 7 the
OnUninstall event gets called before the uninstall begins. Call your custom
function here.

"Joe Antonelli" <Jantonelli@Symantec.com> wrote in message
news:3c111124@news.installshield.com...
> Hi,
> Perhaps my question is not clear. Sorry. I know how to call a function
> in a dll. This is a special case where it needs to be called from
Uninstall.
> With IS 5.5x, you could pass a command line parameter to ISuninst.exe that
> would use a custom dll to do cutom uninstall procedures. That dll would
need
> to contain 2 functions called UninstInitialize( ) and
UninstUnInitialize( ).
> I want to know how to do this using ISDev 7
> "David Thornley" <davidt@installshield.com> wrote in message
> news:3c110e35$1@news.installshield.com...
> > You should add your DLL file to the setup files pane in the IDE. Those
> > files are streamed out to the system variable SUPPORTDIR. You could
then
> > call UseDLL on that file and call a function on it.
> >
> > If you search the Help Library for UseDLL there you will find an example
> of
> > calling a function in a DLL from InstallScript.
> >
> > Regards
> > David Thornley
> >
> > "Joe Antonelli" <Jantonelli@Symantec.com> wrote in message
> > news:3c110704$1@news.installshield.com...
> > > Hi,
> > > I migrated an install from IS 5.5x to ISDEV 7. There is a call in
> the
> > > old script to modify the uninstall command line so it can call a
custom
> > dll
> > > during uninstall (ISuninst.exe...-c{path to dll}. I looked at the
> > knowledge
> > > base about this and it states to add the OnUninstall( ) event to my
> script
> > > and use the DLL in there. I have added the OnUninstall code, but it
> didn't
> > > say what code to add regarding the custom dll. Can someone please help
> me
> > as
> > > to how to add this code so my custom dll is called during uninstall???
> > Here
> > > is a code sample: Please add in the code I am missing to get it to
work.
> > > Thanks.
> > >
> > > function OnUninstall()
> > > BOOL bvOpt1, bvOpt2;
> > > string szTitle, szMsg1, szMsg2, szOpt1, szOpt2, svResult, szCaption;
> > > begin
> > > svResult = SdLoadString(ISWI_IS5_UNINST_MSG);
> > > szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
> > > Sprintf (svResult, svResult, "My New Unistall");
> > > if (IDCANCEL = SprintfBox(MB_OKCANCEL, szCaption, svResult)) then
> > > abort;
> > > endif;
> > >
> > > Enable(STATUSEX);
> > >
> > > //////////////////////////////////////
> > > //DO NOT DELETE. The below code will
> > > //initiate the uninstallation process.
> > > ComponentRemoveAll();
> > > ComponentTransferData(MEDIA);
> > > //////////////////////////////////////
> > >
> > > Disable(STATUSEX);
> > >
> > > bvOpt1 = FALSE;
> > > bvOpt2 = FALSE;
> > > szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
> > > szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
> > > SdFinishEx(szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bvOpt1, bvOpt2);
> > > end;
> > >
> > >
> >
> >
>
>

NewsArchive
12-07-2001, 01:00 AM
Joe:

Just call those two functions directly whereaver you want them to be called
from OnUnisntallEvent, either before or after files are deleted.

As a matter of fact, in 7.01, you don't need external DLLs as you did with
5.x (For 5.x, you can't put uninstall logic into your script). I'd prefer
you just convert the C code to script and call it from Uninstall. It will be
much easier to debug and maintain.

Fei

"Joe Antonelli" <Jantonelli@Symantec.com> wrote in message
news:3c111124@news.installshield.com...
> Hi,
> Perhaps my question is not clear. Sorry. I know how to call a function
> in a dll. This is a special case where it needs to be called from
Uninstall.
> With IS 5.5x, you could pass a command line parameter to ISuninst.exe that
> would use a custom dll to do cutom uninstall procedures. That dll would
need
> to contain 2 functions called UninstInitialize( ) and
UninstUnInitialize( ).
> I want to know how to do this using ISDev 7
> "David Thornley" <davidt@installshield.com> wrote in message
> news:3c110e35$1@news.installshield.com...
> > You should add your DLL file to the setup files pane in the IDE. Those
> > files are streamed out to the system variable SUPPORTDIR. You could
then
> > call UseDLL on that file and call a function on it.
> >
> > If you search the Help Library for UseDLL there you will find an example
> of
> > calling a function in a DLL from InstallScript.
> >
> > Regards
> > David Thornley
> >
> > "Joe Antonelli" <Jantonelli@Symantec.com> wrote in message
> > news:3c110704$1@news.installshield.com...
> > > Hi,
> > > I migrated an install from IS 5.5x to ISDEV 7. There is a call in
> the
> > > old script to modify the uninstall command line so it can call a
custom
> > dll
> > > during uninstall (ISuninst.exe...-c{path to dll}. I looked at the
> > knowledge
> > > base about this and it states to add the OnUninstall( ) event to my
> script
> > > and use the DLL in there. I have added the OnUninstall code, but it
> didn't
> > > say what code to add regarding the custom dll. Can someone please help
> me
> > as
> > > to how to add this code so my custom dll is called during uninstall???
> > Here
> > > is a code sample: Please add in the code I am missing to get it to
work.
> > > Thanks.
> > >
> > > function OnUninstall()
> > > BOOL bvOpt1, bvOpt2;
> > > string szTitle, szMsg1, szMsg2, szOpt1, szOpt2, svResult, szCaption;
> > > begin
> > > svResult = SdLoadString(ISWI_IS5_UNINST_MSG);
> > > szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
> > > Sprintf (svResult, svResult, "My New Unistall");
> > > if (IDCANCEL = SprintfBox(MB_OKCANCEL, szCaption, svResult)) then
> > > abort;
> > > endif;
> > >
> > > Enable(STATUSEX);
> > >
> > > //////////////////////////////////////
> > > //DO NOT DELETE. The below code will
> > > //initiate the uninstallation process.
> > > ComponentRemoveAll();
> > > ComponentTransferData(MEDIA);
> > > //////////////////////////////////////
> > >
> > > Disable(STATUSEX);
> > >
> > > bvOpt1 = FALSE;
> > > bvOpt2 = FALSE;
> > > szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
> > > szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
> > > SdFinishEx(szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bvOpt1, bvOpt2);
> > > end;
> > >
> > >
> >
> >
>
>