${SegmentFile}

${SegmentPreExecPrimary}
	SetOutPath $AppDirectory\Fetion
	ExecWait 'regsvr32 /S "$AppDirectory\Fetion\DynamicGifCtl2.dll"'
	ExecWait 'regsvr32 /S "$AppDirectory\Fetion\Fetion.WebDetect.dll"'
	ExecWait 'regsvr32 /S "$AppDirectory\Fetion\FetionExt.dll"'
	ExecWait 'regsvr32 /S "$AppDirectory\Fetion\sensmon.dll"'
	
	CreateDirectory "$DataDirectory\Users"
	FileOpen $0 "$DataDirectory\Users\AppboxConfig" w
	FileClose $0
	FileOpen $0 "$DataDirectory\Users\temp" w
	FileClose $0
	FileOpen $0 "$DataDirectory\Users\ExtendedConfig" w
	FileClose $0
	SetFileAttributes "$DataDirectory\Users\AppboxConfig" READONLY
	SetFileAttributes "$DataDirectory\Users\temp" READONLY
	SetFileAttributes "$DataDirectory\Users\ExtendedConfig" READONLY
!macroend
 
${SegmentPostExecPrimary}
	FindFirst $0 $1 "$AppDirectory\Fetion\*.exe"
	${DoUntil} $1 == ""
		${TerminateProcess} $1 $2
		FindNext $0 $1
	${Loop}
	FindClose $0
	
	Delete "$DataDirectory\Users\AppboxConfig"
	Delete "$DataDirectory\Users\temp"
	Delete "$DataDirectory\Users\ExtendedConfig"
	
	SetOutPath $AppDirectory\Fetion
	ExecWait 'regsvr32 /S /U "$AppDirectory\Fetion\DynamicGifCtl2.dll"'
	ExecWait 'regsvr32 /S /U "$AppDirectory\Fetion\Fetion.WebDetect.dll"'
	ExecWait 'regsvr32 /S /U "$AppDirectory\Fetion\FetionExt.dll"'
	ExecWait 'regsvr32 /S /U "$AppDirectory\Fetion\sensmon.dll"'
!macroend