Var CustomBits

${SegmentFile}

${Segment.OnInit}
	; Borrowed the following from PAL 2.2, Remove on release of PAL 2.2
	; Work out if it's 64-bit or 32-bit
	System::Call kernel32::GetCurrentProcess()i.s
	System::Call kernel32::IsWow64Process(is,*i.r0)
	
	ReadRegStr $1 HKLM "Software\Microsoft\Windows NT\CurrentVersion" "CurrentBuild"

	${If} $0 == 0
	${OrIf} $1 < 10000 ;Earlier than Win10
		StrCpy $CustomBits 32
		${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\Notes32"
	${Else}
		StrCpy $CustomBits 64
		${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\Notes"
	${EndIf}
	StrCpy $Bits $CustomBits
!macroend

${SegmentInit}
	${If} $CustomBits != ""
		StrCpy $Bits $CustomBits
	${EndIf}
!macroend
