;****************************************************************************
;* Norton DiskLock uninstallation Script												*
;* FOR VERSION 4.1 OF SYMANTEC INSTALL FOR WINDOWS                        	*
;****************************************************************************
;
; SWITCH_ISBOOTLOCKINST     40
;
; SWITCH_PREVIOUS           50  -- Previous Dialog
; SWITCH_NEXT               51  -- Next Dialog
; SWITCH_CANCEL             52  -- Exit Install
;
; SWITCH_SUCCESSFUL         55  -- Set if uninstall operation succeeds
;
; SWITCH_USERVALIDATE       56  -- TRUE if user can uninstall
; SWITCH_HASUSERVALIDATED   57  -- Set TRUE after user validates
;
; SWITCH_UNINSTFULL         60  -- Full Uninstall
;
; SWITCH_GENERIC_YES        83 -- Selected Yes
; SWITCH_GENERIC_NO         84 -- Selected No
;
; SWITCH_BOOTLOCK           85 -- Install BootLock (FALSE=Uninstall)
;
; SWITCH_ISINSTALL          86 -- TRUE for Install, FALSE for Uninstall
;
; SWITCH_BOOTLOCKOPER       87 -- Did BootLock Add/Remove operation succeed
;
;                           22 -- Don't delete Desktops
;                           23 -- Delete Indexes

;     Target Assignments
;------------------------
; TARGET    - Norton DiskLock directory
; TARGET2   - Symantec shared components
; TARGET5   - Misc. (redefinable)


[InstallVersion]
4.0

[process]
;*Uninstall()

FullUninstall()
EnableForceWrite()
EnableOverwrite()

;//////////////////////////////
;// Background Bitmaps
;//////////////////////////////

Bitmaps(Pix_DiskLock)


;//////////////////////////////
;// Initialization            
;//////////////////////////////

Backup(CustDLLCopy)            ; Backup the custom dll in case we need it
CallProc(UnattribSetup)
DisableHelp()
CallProc(Memory)
;CallProc(RestoreNavVxDKey)

; Abort silent uninstall if product isn't installed
#if(switch15)
    Exit()
#endif

SetActiveCopy(DiskLockCopy, uninstal.inf)

switch36=FALSE
switch37=TRUE
switch38=TRUE
switch55=FALSE
switch86=FALSE
;switch56=TRUE
;switch57=FALSE

; Set panel default options
switch60=FALSE
switch69=TRUE

switch35=CallProcEx(bIsSilentUninstall)


;////////////////////////////////////////////////////////////
;//  User validate & rights
;////////////////////////////////////////////////////////////
CallProc(InitializeSfi)
switch56=CallProcEx(ValidateCurrentUser)

#ifnot(switch56)
    #ifnot(switch52)
        MessageBox(InsufficientRights)
    #endif

    Exit()
#endif


CallProcEx(SetTarget2ToSymantecDir)
;ResetTarget(SourceTarget)
ResetTarget(CopyTarget4)

switch40=CallProcEx(bIsBootLockInstalled)

;////////////////////////////////////////////////////////////
;//  Select Uninstall Type
;////////////////////////////////////////////////////////////
WizardPanel(WizUninstallType, siwdlock.dll)
WizardIncludePanel(WizUnlockDiskAtUninstall)
WizardProcessPanel()

switch60=CallProcEx(bFullUninstall)
switch85=CallProcEx(bBootLockUninstallOperation)


;//////////////////////////////////////////////////////////
;// CREATE UNLOCK DISK?
;//////////////////////////////////////////////////////////
#if(switch60)
    #ifnot(switch36)
        WizardPanel(WizUnlockDiskAtUninstall, siwdlock.dll)
        WizardIncludePanel(UninstallConfirm)
        WizardProcessPanel()

        switch69=CallProcEx(bCreateUnlockDisk)

        #if(switch69)
            ExecChildProcess(ExecuteUnlock)
        #endif
    #else
        WizardExcludePanel(WizUnlockDiskAtUninstall)
    #endif

    WizardPanel(UninstallConfirm, siwdlock.dll)

    WizardIncludePanel(UninstallRestart)
    WizardExcludePanel(InstallBootLockReboot)
    WizardExcludePanel(UninstBootLockReboot)

    WizardProcessPanel()
#else
    WizardExcludePanel(WizUnlockDiskAtUninstall)
    WizardExcludePanel(UninstallConfirm)
#endif


;////////////////////////////////////////////////////////////
;//  Confirm Uninstall
;////////////////////////////////////////////////////////////
WizardIncludePanel(InstallBootLockConfirm)
WizardIncludePanel(UninstBootLockConfirm)


#ifnot(switch60)
    #if(switch85)
        WizardExcludePanel(UninstBootLockConfirm)

        WizardPanel(InstallBootLockConfirm, siwdlock.dll)

        WizardIncludePanel(InstallBootLockReboot)
        WizardExcludePanel(UninstBootLockReboot)
        WizardExcludePanel(UninstallRestart)

        WizardProcessPanel()
    #else
        WizardExcludePanel(InstallBootLockConfirm)

        WizardPanel(UninstBootLockConfirm, siwdlock.dll)

        WizardIncludePanel(UninstBootLockReboot)
        WizardExcludePanel(InstallBootLockReboot)
        WizardExcludePanel(UninstallRestart)

        WizardProcessPanel()
    #endif
#else
    WizardExcludePanel(InstallBootLockConfirm)
    WizardExcludePanel(UninstBootLockConfirm)
#endif


#if(switch52)
    Exit()
#endif


;////////////////////////////////////////////////////////////
;//  Validate user before continuing
;////////////////////////////////////////////////////////////
; Call SFI shutdown API
CallProc(ValidateShutdown)

#if(switch52)
    Exit()
#endif

;//////////////////////////////
;// Upload audit info
;//////////////////////////////
#if(switch60)
;    Launch(UploadAgent)
    CallProc(UploadAudit)
#endif

CallProc(ReleaseSfi)
CallProc(DisableDlvxdProtection)


;////////////////////////////////////////////////////////////
;//  Handle BootLock
;////////////////////////////////////////////////////////////
#if(switch85)
    CallProc(FindBootRootPath)

    switch21=CallProcEx(CheckConfigForQuickboot)

    #if(switch21)
        CallProc(AddInstallPath)
        switch87=CallProcEx(ConfigureBootLock)
        CallProc(RemoveInstallPath)
    #else
        Exit()
    #endif
#else
    #if(switch40)
        switch87=CallProcEx(RemoveBootLock)

        CallProc(CleanupBootLockFiles)
    #else
        switch87=TRUE
    #endif
#endif


;////////////////////////////////////////////////////////////
;//  Full uninstall
;////////////////////////////////////////////////////////////
#if(switch60)
    ;//////////////////////////////
    ;// Upload audit info
    ;//////////////////////////////
;    CallProc(UploadAudit)


    ;//////////////////////////////
    ;// Select all
    ;//////////////////////////////
    SelectOption(RequiredFiles)

    ;//////////////////////////////
    ;// Delete the files
    ;//////////////////////////////
    DisableUtils()
    Uncopy()
    EnableUtils()

    ;//////////////////////////////
    ;// Delete registry entries
    ;//////////////////////////////
    CallProc(DelRegKeyDiskLock)
    CallProc(DelRegKeyVxD)

    ;//////////////////////////////
    ;// Delete program items/groups
    ;//////////////////////////////
    EnableWin95Shell()
    Groups(DiskLockGroups)

    ;//////////////////////////////
    ;// Decrement usage counts
    ;//////////////////////////////
    CallProcEx(UninstallShared)

    ;////////////////////////////////////
    ;// Wave bye bye
    ;////////////////////////////////////
    WizardPanel(UninstallRestart, siwdlock.dll)
    WizardProcessPanel()

    ;//////////////////////////////
    ;// Clean Up
    ;//////////////////////////////
    delete(Leftovers)
    CallProc(CleanupLeftoverFiles)
    CallProcEx(PruneEmptyKeys)
    delete(CustDLLDel)
    CallProc(DeleteDirectories)


    ;//////////////////////////////
    ;// Restart
    ;//////////////////////////////
    CallProcEx(FlushRegistry)
#else
    ;////////////////////////////////////
    ;// Wave bye bye (BootLock)
    ;////////////////////////////////////
    #if(switch85)
        WizardPanel(InstallBootLockReboot, siwdlock.dll)
        WizardProcessPanel()
    #else
        WizardPanel(UninstBootLockReboot, siwdlock.dll)
        WizardProcessPanel()
    #endif

    ;//////////////////////////////
    ;// Clean Up
    ;//////////////////////////////


    ;//////////////////////////////
    ;// Restart
    ;//////////////////////////////
    CallProcEx(FlushRegistry)
#endif


; Removal has been successful
switch55=TRUE


;//////////////////////////////
;// Check for floppy in drive
;//////////////////////////////
;#ifnot(switch35)
    WizardPanel(WizFloppyDialog, siwdlock.dll)

    switch80=CallProcEx(IsFloppyInDrive)

    #if(switch80)
        WizardProcessPanel()
        WizardGotoPanel(WizFloppyDialog);
    #endif
;#endif

;//////////////////////////////
;// Reboot
;//////////////////////////////
#if(switch35)
    Exit()
#else
    ExitReboot()
#endif


;End()


;***************************************************************************
;* Dialog Info                                                             *
;***************************************************************************

[DiskLockCopy:CopyDialog]
caption = "Copying files..."
posx = 0
posy = 0


;***************************************************************************
;* Message Text                                                            *
;***************************************************************************

[cancel]
caption = "Exit Uninstall?"
text    = "Are you sure that you want to exit?"

[cancelshell]
caption = "Exit Uninstall?"
"You have chosen to cancel the Uninstall"
"program. In order to reset the Windows"
"environment, Uninstall will also close"
"Windows. Are you sure you want to exit?"

[WindowsVersion]
3.10
"This product requires"
"Windows 3.1 or greater."

[NotImplemented]
caption = "Feature Not Implemented"
"This feature has not yet been implemented."

[ConfirmExit]
caption = "Confirm Cancel"
"Uninstall has not been completed."
"Do you really wish to cancel?"

[InsufficientRights]
caption = "Insufficient Rights"
"You do not have sufficient rights to"
"perform the requested operation."


;***************************************************************************
;* Set Directories                                                         *
;***************************************************************************

[SourceTarget]
reset = TARGET
location = %s, SOURCE

[CopyTarget4]
reset = TARGET
location = %s, TARGET4


;***************************************************************************
;* Delete Files                                                            *
;***************************************************************************

[Leftovers]
dlapp.gid,      TARGET
dlaudit.gid,    TARGET
dlexplor.gid,   TARGET
unlock32.gid,   TARGET
dlapp.fts,      TARGET
dlaudit.fts,    TARGET
dlexplor.fts,   TARGET
unlock32.fts,   TARGET

[CustDLLDel]
siwdlock.dll,  TEMPDIR


;***************************************************************************
;* External function calls (DLL)                                           *
;***************************************************************************

[DelRegKeyDiskLock]
dll = siwdlock.dll
function = _DelRegKeyDiskLock@12

[DelRegKeyVxD]
dll = siwdlock.dll
function = _DelRegKeyVxD@12

;[HourglassOn]
;dll = siwdlock.dll
;function = HourglassOn

;[HourglassOff]
;dll = siwdlock.dll
;function = HourglassOff

[SetTarget2ToSymantecDir]
dll = siwdlock.dll
function = _SetTarget2ToSymantecDir@12

[AreTargetsSame]
dll = siwdlock.dll
function = _AreTargetsSame@12

[DeleteDirectories]
dll = siwdlock.dll
function = _DeleteDirectories@12

[UninstallShared]
dll = siwdlock.dll
function = _UninstallShared@12

[RemoveFromRun]
dll = siwdlock.dll
function = _RemoveFromRun@12

[PruneEmptykeys]
dll = siwdlock.dll
function = _PruneEmptyKeys@12

[FlushRegistry]
dll = siwdlock.dll
function = _FlushRegistry@12

[RestoreNavVxDKey]
dll = siwdlock.dll
function = _RestoreNavVxDKey@12

[UnattribSetup]
dll = siwdlock.dll
function = _UnattribSetup@12

[bIsBootLockInstalled]
dll = siwdlock.dll
function = _bIsBootLockInstalled@12

[ConfigureBootLock]
dll = siwdlock.dll
function = _ConfigureBootLock@12

[RemoveBootLock]
dll = siwdlock.dll
function = _RemoveBootLock@12

[AddInstallPath]
dll = siwdlock.dll
function = _AddInstallPath@12

[RemoveInstallPath]
dll = siwdlock.dll
function = _RemoveInstallPath@12

[bFullUninstall]
dll = siwdlock.dll
function = _bFullUninstall@12

[bBootLockUninstallOperation]
dll = siwdlock.dll
function = _bBootLockUninstallOperation@12

[Memory]
dll = siwdlock.dll
function = _InitMemory@12

[UploadAudit]
dll = siwdlock.dll
function = _UploadAudit@12

[ExitHookProc]
dll = siwdlock.dll
function = _ReleaseDLL@12

[bCanUserUninstall]
dll = siwdlock.dll
function = _bCanUserUninstall@12

[FindBootRootPath]
dll = siwdlock.dll
function = _FindBootRootPath@12

[ValidateCurrentUser]
dll = siwdlock.dll
function = _ValidateCurrentUser@12

[ValidateShutdown]
dll = siwdlock.dll
function = _ValidateShutdown@12

[CleanupLeftoverFiles]
dll = siwdlock.dll
function = _CleanupLeftoverFiles@12

[CleanupBootLockFiles]
dll = siwdlock.dll
function = _CleanupBootLockFiles@12

[InitializeSfi]
dll = siwdlock.dll
function = _InitializeSfi@12

[ReleaseSfi]
dll = siwdlock.dll
function = _ReleaseSfi@12

[bCreateUnlockDisk]
dll = siwdlock.dll
function = _bCreateUnlockDisk@12

[IsFloppyInDrive]
dll = siwdlock.dll
function = _IsFloppyInDrive@12

[DisableDlvxdProtection]
dll = siwdlock.dll
function = _DisableDlvxdProtection@12

[bIsSilentUninstall]
dll = siwdlock.dll
function = _bIsSilentUninstall@12

[CheckConfigForQuickboot]
dll = siwdlock.dll
function = _CheckConfigForQuickboot@12


;***************************************************************************
;* Misc install functions                                                  *
;***************************************************************************

[Pix_DiskLock]
color = %s\bigblu.rle
color = %s\symantec.rle, -1, -1

;***************************************************************************
;* File backup                                                             *
;***************************************************************************

[CustDLLCopy]
siwdlock.dll, siwdlock.dll, SOURCE, TEMPDIR

[ExecuteUnlock]
"%s\unlock32.exe /INSTALL", TARGET, TARGET2

[UploadAgent]
"%s\dlaudagt.exe", TARGET, TARGET2


;***************************************************************************
;* Groups                                                                  *
;***************************************************************************

[DiskLockGroups]
"Norton Your Eyes Only", disklock.grp

[Norton Your Eyes Only]
"Control Center",                   dlapp.exe,      RequiredFiles,,TARGET,,,,TARGET
"Audit Viewer",                     dlaudit.exe,    RequiredFiles,,TARGET,,,,TARGET
"Emergency UnLock Disk",            unlock32.exe,   RequiredFiles,,TARGET,,,,TARGET
"Release Notes",                    readme.txt,     RequiredFiles,,TARGET,,,,TARGET

;***************************************************************************
;* Copy                                                                    *
;***************************************************************************

[DiskLockCopy]
;SelectionType.ComponentName,   "SelectionDlgText",						Size,   Required?,<Files>?,ShowItem?

CopyMain.RequiredFiles,			"Required Files - %ldK",               0,			Y,				N,      	Y


;***************************************************************************
;* Wizard Panels                                                           *
;***************************************************************************

[WizUninstallType]
Caption="Norton Your Eyes Only for Windows 95 Add/Remove Programs"
Title="Installation Options"
DlgProc=_BamBamDlgProc@16
PanelDataProc=_DefaultDataProc@0
Bitmap16=666
ResourceId=146
PanelFlags=First

[UninstallConfirm]
Caption="Norton Your Eyes Only for Windows 95 Add/Remove Programs"
Title="Uninstall Norton Your Eyes Only?"
DlgProc=_BamBamDlgProc@16
PanelDataProc=_DefaultDataProc@0
ResourceId=137
Bitmap16=666
;PanelFlags=First

[UninstallRestart]
Caption="Norton Your Eyes Only for Windows 95 Add/Remove Programs"
Title="Uninstall Complete"
DlgProc=_BamBamDlgProc@16
PanelDataProc=_DefaultDataProc@0
ResourceId=138
Bitmap16=663
;Bitmap16=666
PanelFlags=First+Last+Finish

[UninstBootLockConfirm]
Caption="Norton Your Eyes Only for Windows 95 Add/Remove Programs"
Title="Uninstall Norton BootLock?"
DlgProc=_BamBamDlgProc@16
PanelDataProc=_DefaultDataProc@0
ResourceId=139
Bitmap16=666

[UninstBootLockReboot]
Caption="Norton Your Eyes Only for Windows 95 Add/Remove Programs"
Title="Uninstall BootLock Complete"
DlgProc=_BamBamDlgProc@16
PanelDataProc=_DefaultDataProc@0
ResourceId=140
Bitmap16=663
;Bitmap16=666
PanelFlags=First+Last+Finish

[InstallBootLockConfirm]
Caption="Norton Your Eyes Only for Windows 95 Add/Remove Programs"
Title="Install Norton BootLock?"
DlgProc=_BamBamDlgProc@16
PanelDataProc=_DefaultDataProc@0
ResourceId=139
Bitmap16=666

[InstallBootLockReboot]
Caption="Norton Your Eyes Only for Windows 95 Add/Remove Programs"
Title="Install BootLock Complete"
DlgProc=_BamBamDlgProc@16
PanelDataProc=_DefaultDataProc@0
ResourceId=140
Bitmap16=663
;Bitmap16=666
PanelFlags=First+Last+Finish

[WizUnlockDiskAtUninstall]
Caption="Norton Your Eyes Only for Windows 95 Add/Remove Programs"
Title="Create Emergency UnLock Disk"
DlgProc=_BamBamDlgProc@16
PanelDataProc=_DefaultDataProc@0
Bitmap16=666
ResourceId=121

[WizFloppyDialog]
Caption="Norton Your Eyes Only for Windows 95 Setup"
Title="Remove Floppy Diskette"
DlgProc=_BamBamDlgProc@16
PanelDataProc=_DefaultDataProc@0
Bitmap16=662
ResourceId=562
PanelFlags=Last+First+Finish
