!define 64     `${APPDIR}\W7MPCL64.dll`
!define 32     `${APPDIR}\W7MPCL32.dll`
!define DLL    `${APPDIR}\W7MPCL.dll`
!define REG    `${SET}\Yamicsoft.reg`
!define DEFREG `${DEFDATA}\settings\Yamicsoft.reg`
!define MSG    `${PORTABLEAPPNAME} is only compatible with Windows 7.`

${SegmentFile}
${Segment.OnInit}
	Push $0
	${IsWOW64} $0
	StrCmp $0 0 0 IsWOW64
	${WriteSettings} 32 Architecture
	Goto END
	IsWOW64:
	SetRegView 64
	System::Call `${DISABLEREDIR}`
	${WriteSettings} 64 Architecture
	END:
	Pop $0
!macroend

!macro OS
	${IfNot} ${IsWin7}
		MessageBox MB_ICONSTOP|MB_TOPMOST `${MSG}`
		Call Unload
		Quit
	${EndIf}
!macroend

${SegmentInit}
	Push $0
	${IfThen} ${ProcessExists} 1-ClickCleaner.exe ${|} ${TerminateProcess} 1-ClickCleaner.exe $0 ${|}
	${IfThen} ${ProcessExists} ComputerManager.exe ${|} ${TerminateProcess} ComputerManager.exe $0 ${|}
	${IfThen} ${ProcessExists} ContextMenuManager.exe ${|} ${TerminateProcess} ContextMenuManager.exe $0 ${|}
	${IfThen} ${ProcessExists} DesktopCleaner.exe ${|} ${TerminateProcess} DesktopCleaner.exe $0 ${|}
	${IfThen} ${ProcessExists} DiskAnalyzer.exe ${|} ${TerminateProcess} DiskAnalyzer.exe $0 ${|}
	${IfThen} ${ProcessExists} DuplicateFilesFinder.exe ${|} ${TerminateProcess} DuplicateFilesFinder.exe $0 ${|}
	${IfThen} ${ProcessExists} FileSecurity.exe ${|} ${TerminateProcess} FileSecurity.exe $0 ${|}
	${IfThen} ${ProcessExists} FileSplitter.exe ${|} ${TerminateProcess} FileSplitter.exe $0 ${|}
	${IfThen} ${ProcessExists} FileUndelete.exe ${|} ${TerminateProcess} FileUndelete.exe $0 ${|}
	${IfThen} ${ProcessExists} FreeMemory.exe ${|} ${TerminateProcess} FreeMemory.exe $0 ${|}
	${IfThen} ${ProcessExists} HiddenDeviceManager.exe ${|} ${TerminateProcess} HiddenDeviceManager.exe $0 ${|}
	${IfThen} ${ProcessExists} IEManager.exe ${|} ${TerminateProcess} IEManager.exe $0 ${|}
	${IfThen} ${ProcessExists} IPSwitcher.exe ${|} ${TerminateProcess} IPSwitcher.exe $0 ${|}
	${IfThen} ${ProcessExists} JumpListQuickLauncher.exe ${|} ${TerminateProcess} JumpListQuickLauncher.exe $0 ${|}
	${IfThen} ${ProcessExists} JunkFileCleaner.exe ${|} ${TerminateProcess} JunkFileCleaner.exe $0 ${|}
	${IfThen} ${ProcessExists} LockSystem.exe ${|} ${TerminateProcess} LockSystem.exe $0 ${|}
	${IfThen} ${ProcessExists} LogonBackgroundChanger.exe ${|} ${TerminateProcess} LogonBackgroundChanger.exe $0 ${|}
	${IfThen} ${ProcessExists} MyTask.exe ${|} ${TerminateProcess} MyTask.exe $0 ${|}
	${IfThen} ${ProcessExists} OptimizationWizard.exe ${|} ${TerminateProcess} OptimizationWizard.exe $0 ${|}
	${IfThen} ${ProcessExists} PinnedManager.exe ${|} ${TerminateProcess} PinnedManager.exe $0 ${|}
	${IfThen} ${ProcessExists} PrivacyProtector.exe ${|} ${TerminateProcess} PrivacyProtector.exe $0 ${|}
	${IfThen} ${ProcessExists} ProcessManager.exe ${|} ${TerminateProcess} ProcessManager.exe $0 ${|}
	${IfThen} ${ProcessExists} RegistryCleaner.exe ${|} ${TerminateProcess} RegistryCleaner.exe $0 ${|}
	${IfThen} ${ProcessExists} RegistryDefrag.exe ${|} ${TerminateProcess} RegistryDefrag.exe $0 ${|}
	${IfThen} ${ProcessExists} RegistryTools.exe ${|} ${TerminateProcess} RegistryTools.exe $0 ${|}
	${IfThen} ${ProcessExists} RepairCenter.exe ${|} ${TerminateProcess} RepairCenter.exe $0 ${|}
	${IfThen} ${ProcessExists} RunShortcutCreator.exe ${|} ${TerminateProcess} RunShortcutCreator.exe $0 ${|}
	${IfThen} ${ProcessExists} ServiceManager.exe ${|} ${TerminateProcess} ServiceManager.exe $0 ${|}
	${IfThen} ${ProcessExists} SmartUninstaller.exe ${|} ${TerminateProcess} SmartUninstaller.exe $0 ${|}
	${IfThen} ${ProcessExists} StartupManager.exe ${|} ${TerminateProcess} StartupManager.exe $0 ${|}
	${IfThen} ${ProcessExists} SuperCopy.exe ${|} ${TerminateProcess} SuperCopy.exe $0 ${|}
	${IfThen} ${ProcessExists} SystemInfo.exe ${|} ${TerminateProcess} SystemInfo.exe $0 ${|}
	${IfThen} ${ProcessExists} TaskSchedulerManager.exe ${|} ${TerminateProcess} TaskSchedulerManager.exe $0 ${|}
	${IfThen} ${ProcessExists} VisualCustomizer.exe ${|} ${TerminateProcess} VisualCustomizer.exe $0 ${|}
	${IfThen} ${ProcessExists} WinUtilities.exe ${|} ${TerminateProcess} WinUtilities.exe $0 ${|}
	Pop $0
!macroend

!macro Init
	IfFileExists `${REG}` +2
	CopyFiles /SILENT `${DEFREG}` `${REG}`
!macroend

${SegmentPrePrimary}
	Push $0
	${ReadSettings} $0 Architecture
	StrCmp $0 32 0 +3
	Rename `${32}` `${DLL}`
	Goto +2
	Rename `${64}` `${DLL}`
	Pop $0
!macroend

${SegmentPostPrimary}
	Push $0
	${ReadSettings} $0 Architecture
	StrCmp $0 32 0 +3
	Rename `${DLL}` `${32}`
	Goto +2
	Rename `${DLL}` `${64}`
	Pop $0
!macroend