/*

  REXX Script to install the InJoy Firewall - and create a desktop folder

*/

if RxFuncQuery('SysLoadFuncs') then do
   call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
   call SysLoadFuncs
end

say "Creating Desktop Folder..."

dir = directory() || '\'

say "Creating folder"
call SysCreateObject "WPFolder", "InJoy Firewall", "<WP_DESKTOP>", "OBJECTID=<INJOYFIREFOLDER>;ICONVIEW=FLOWED,NORMAL;ALWAYSSORT=NO;ICONFONT=10.Helv;BACKGROUND=" || dir || "back.bmp,T;ICONFILE=" || dir || "FOLDER.ICO", "replace"
call SysCreateObject "WPFolder", "Extras", "<INJOYFIREFOLDER>", "OBJECTID=<INJOYFIREEXTRASFOLDER>;ICONVIEW=FLOWED,NORMAL;ALWAYSSORT=NO;ICONFONT=8.Helv;BACKGROUND=" || dir || "back.bmp,T", "replace"
call SysCreateObject "WPFolder", "Packet Tracing", "<INJOYFIREFOLDER>", "OBJECTID=<INJOYFIRETRACEFOLDER>;ICONVIEW=FLOWED,NORMAL;ALWAYSSORT=NO;ICONFONT=8.Helv;BACKGROUND=" || dir || "back.bmp,T", "replace"
call SysCreateObject "WPFolder", "Tools", "<INJOYFIREFOLDER>", "OBJECTID=<INJOYFIREUTILFOLDER>;ICONVIEW=FLOWED,NORMAL;ALWAYSSORT=NO;ICONFONT=8.Helv;BACKGROUND=" || dir || "back.bmp,T", "replace"
call SysCreateObject "WPFolder", "Log Files", "<INJOYFIREFOLDER>", "OBJECTID=<INJOYFIRELOGFOLDER>;ICONVIEW=FLOWED,NORMAL;ALWAYSSORT=NO;ICONFONT=8.Helv;BACKGROUND=" || dir || "back.bmp,T", "replace"
call SysCreateObject "WPFolder", "Information", "<INJOYFIREFOLDER>", "OBJECTID=<INJOYFIREINFOFOLDER>;ICONVIEW=FLOWED,NORMAL;ALWAYSSORT=NO;ICONFONT=8.Helv;BACKGROUND=" || dir || "back.bmp,T", "replace"

say "Creating program objects..."


/* Extras */
call SysCreateObject "WPProgram", "IP Forwarding" || d2c(10) || "(Disable)", "<INJOYFIREEXTRASFOLDER>", "EXENAME=CMD.EXE;PARAMETERS=" || "/C " || '"' || "ipgate off" || '"', "replace"
call SysCreateObject "WPProgram", "IP Forwarding" || d2c(10) || "(Enable)", "<INJOYFIREEXTRASFOLDER>", "EXENAME=CMD.EXE;PARAMETERS=" || "/C " || '"' || "ipgate on" || '"', "replace"
call SysCreateObject "WPProgram", "Uninstall" || d2c(10) || "Device Driver", "<INJOYFIREEXTRASFOLDER>", "EXENAME=" || dir || "UNINSTAL.CMD;STARTUPDIR=" || dir || ";ICONVIEW=FLOWED,NORMAL;ALWAYSSORT=YES;"
call SysCreateObject "WPProgram", "Run Firewall Server"  || d2c(10) || "in Background", "<INJOYFIREEXTRASFOLDER>", "EXENAME=" || dir || "GATEWAY.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "-b", "replace"
call SysCreateObject "WPProgram", "Admin Remote Firewall", "<INJOYFIREEXTRASFOLDER>", "EXENAME=" || dir || "FGUI.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "-remote", "replace"


/* TOOLS */
call SysCreateObject "WPProgram", "Reload DHCP Server" || d2c(10) || "Configuration", "<INJOYFIREUTILFOLDER>", "EXENAME=" || dir || "SYNC.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "-dhcpd", "replace"
call SysCreateObject "WPProgram", "Reload IPSec" || d2c(10) || "Configuration", "<INJOYFIREUTILFOLDER>", "EXENAME=" || dir || "SYNC.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "-ipsec", "replace"
call SysCreateObject "WPProgram", "Kill Firewall", "<INJOYFIREUTILFOLDER>", "EXENAME=" || dir || "SYNC.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "-kill", "replace"
call SysCreateObject "WPProgram", "Restart Firewall", "<INJOYFIREUTILFOLDER>", "EXENAME=" || dir || "SYNC.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "-restart", "replace"


/* TRACE */
call SysCreateObject "WPProgram", "Delete Trace File", "<INJOYFIRETRACEFOLDER>", "EXENAME=CMD.EXE;PARAMETERS=" || "/C " || '"' || "del " || dir || "packet.trc" || '"', "replace"
call SysCreateObject "WPProgram", "Format Trace" || d2c(10) || "(to Screen)", "<INJOYFIRETRACEFOLDER>", "EXENAME=" || dir || "IPFORMAT.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "-r packet.trc", "replace"
call SysCreateObject "WPProgram", "IP Trace" || d2c(10) || "(Stop)", "<INJOYFIRETRACEFOLDER>", "EXENAME=" || dir || "SYNC.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "-off:logbin", "replace"
call SysCreateObject "WPProgram", "IP Trace" || d2c(10) || "(Start)", "<INJOYFIRETRACEFOLDER>", "EXENAME=" || dir || "SYNC.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "-on:logbin", "replace"


/* LOG FILES */
call SysCreateObject "WPProgram", "PPTP Logs", "<INJOYFIRELOGFOLDER>", "EXENAME=" || dir || "LOGVIEW.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "LVIEW\PPTP.INI", "replace"
call SysCreateObject "WPProgram", "PPPoE Logs", "<INJOYFIRELOGFOLDER>", "EXENAME=" || dir || "LOGVIEW.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "LVIEW\PPPOE.INI", "replace"
call SysCreateObject "WPProgram", "DHCPd Logs", "<INJOYFIRELOGFOLDER>", "EXENAME=" || dir || "LOGVIEW.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "LVIEW\DHCPD.INI", "replace"
call SysCreateObject "WPProgram", "IPSec Logs", "<INJOYFIRELOGFOLDER>", "EXENAME=" || dir || "LOGVIEW.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "LVIEW\IPSEC.INI", "replace"


/* URL OBJECTS */
call SysCreateObject "WPUrl", "Online Documentation", "<INJOYFIREINFOFOLDER>", "URL=http://www.fx.dk/docs", "replace"
call SysCreateObject "WPUrl", "Purchase", "<INJOYFIREINFOFOLDER>", "URL=http://www.fx.dk/firewall/purchase", "replace"
call SysCreateObject "WPUrl", "Product Homepage", "<INJOYFIREINFOFOLDER>", "URL=http://www.fx.dk/firewall/", "replace"
call SysCreateObject "WPUrl", "F/X Communication", "<INJOYFIREINFOFOLDER>", "URL=http://www.fx.dk", "replace"

/* MAIN ICONS */
call SysCreateObject "WPProgram", "Reload Firewall" || d2c(10) || "Configuration", "<INJOYFIREFOLDER>", "EXENAME=" || dir || "SYNC.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "-firewall", "replace"
call SysCreateObject "WPProgram", "Security Logs", "<INJOYFIREFOLDER>", "EXENAME=" || dir || "LOGVIEW.EXE;STARTUPDIR=" || dir || ";PARAMETERS=" || "LVIEW\FIREWALL.INI", "replace"
call SysCreateObject "WPProgram", "InJoy Firewall GUI", "<INJOYFIREFOLDER>", "EXENAME=" || dir || "FGUI.EXE;STARTUPDIR=" || dir || ";ICONVIEW=FLOWED,NORMAL;ALWAYSSORT=YES;"
call SysCreateObject "WPProgram", "InJoy Firewall Server", "<INJOYFIREFOLDER>", "EXENAME=" || dir || "GATEWAY.EXE;STARTUPDIR=" || dir || ";ICONVIEW=FLOWED,NORMAL;ALWAYSSORT=YES;"
say "Folder creation completed!"
