; Define your application name !define COMPNAME "MyComp" !define APPNAME "MyApp" !define APPNAMEANDVERSION "MyApp v1.2.1.3" #------------------------------------------------------------------ ; Use compression SetCompressor /FINAL /SOLID LZMA ;Interface settings !include "XPUI.nsh" !include "FileFunc.nsh" !include "PPC-Registry.nsh" !include "LogicLib.nsh" ; Main Install settings ShowInstDetails show Name "${APPNAMEANDVERSION}" InstallDir "$PROGRAMFILES\${COMPNAME}\${APPNAME}" OutFile "MyApp03.exe" #------------------------------------------------------------------ ;Pages ${Page} Welcome ${LicensePage} "Licence.rtf" ${Page} InstFiles ${Page} Finish ;Uninstaller pages !insertmacro XPUI_PAGEMODE_UNINST !insertmacro XPUI_PAGE_UNINSTCONFIRM_NSIS !insertmacro XPUI_PAGE_INSTFILES ;Abort warning !define XPUI_ABORTWARNING #------------------------------------------------------------------ ;!insertmacro XPUI_LANGUAGE "English" ReserveFile "readme.txt" ReserveFile "licence.txt" ReserveFile "readme.ini" #------------------------------------------------------------------ Section "CEAppMgr" ; ; one-time initialization needed for InstallCAB subroutine ReadRegStr $1 HKEY_LOCAL_MACHINE "software\Microsoft\Windows\CurrentVersion\App Paths\CEAppMgr.exe" "" IfErrors Error Goto End Error: MessageBox MB_OK|MB_ICONEXCLAMATION \ "Unable to find Application Manager for PocketPC applications. \ Please install ActiveSync and reinstall WorkInTime" End: MessageBox MB_OK 'CEAppMgr Acquired' SectionEnd ; #------------------------------------------------------------------ Section "PPC-Registry" ; This Call opens the connection to the Pocket pc ; it returns 0 on success -1 on failure ${PPC-registry::CeRapiInit} $R0 ; This requires the LogicLib plugin included ${If} $R0 = '-1' MessageBox MB_OK 'Connection Failed' ${ElseIf} $R0 = '0' MessageBox MB_OK 'Connection Success' goto keyexist ${Else} MessageBox MB_OK '$$R0 is "$R0"' ${EndIf} keyexist: ${PPC-registry::CeRapiUninit} SectionEnd Section "Processor Type" !define PROCESSOR_ARCHITECTURE_INTEL 0 !define PROCESSOR_ARCHITECTURE_MIPS 1 !define PROCESSOR_ARCHITECTURE_SHX 4 !define PROCESSOR_ARCHITECTURE_ARM 5 System::Call "rapi::CeRapiInit()" MessageBox MB_OK "Processors defined" System::Alloc 40 MessageBox MB_OK "System::Alloc 40" Pop $0 MessageBox MB_OK "Pop is $0" System::Call "rapi::CeGetSystemInfo(i r0)" MessageBox MB_OK "System::Call CeGetSystemInfo" System::Call "*$0(i, &i2 .r1)" MessageBox MB_OK "System::Call" System::Free $0 MessageBox MB_OK "System::Free" ${Switch} $1 ${Case} ${PROCESSOR_ARCHITECTURE_INTEL} MessageBox MB_OK "PROCESSOR_ARCHITECTURE_INTEL" DetailPrint "intel processor" ${Break} ${Case} ${PROCESSOR_ARCHITECTURE_ARM} MessageBox MB_OK "PROCESSOR_ARCHITECTURE_ARM" DetailPrint "arm processor" ${Break} ${Case} ${PROCESSOR_ARCHITECTURE_SHX} MessageBox MB_OK "PROCESSOR_ARCHITECTURE_SHX" DetailPrint "shx processor" ${Break} ${Case} ${PROCESSOR_ARCHITECTURE_MIPS} MessageBox MB_OK "PROCESSOR_ARCHITECTURE_MIPS" DetailPrint "mips processor" ${Break} ${Default} DetailPrint "unknown processor" MessageBox MB_OK "PROCESSOR_ARCHITECTURE_UNKOWN" ${Break} ${EndSwitch} System::Call "rapi::CeCloseHandle(i R0)" System::Call "rapi::CeRapiUnInit()" SectionEnd #------------------------------------------------------------------ ; extracts two cab files and ini into the instdir then calls function ; to install the cabs, installs NETCFv2 Section "netcf.all" Section1 SetOutPath "$INSTDIR" File "NETCFv2.ppc.armv4.ini" File "NETCFv2.ppc.armv4.cab" File "NETCFv2.wm.armv4i.ini" File "NETCFv2.wm.armv4i.cab" StrCpy $0 "$INSTDIR\NETCFv2.ppc.armv4.ini" StrCpy $0 "$INSTDIR\NETCFv2.wm.armv4i.ini" Call InstallCAB SectionEnd #------------------------------------------------------------------ Function InstallCAB ExecWait '"$1" "$0"' FunctionEnd #------------------------------------------------------------------ ; On initialization Function .onInit !insertmacro XPUI_INSTALLOPTIONS_EXTRACT "readme.ini" !insertmacro XPUI_INSTALLOPTIONS_EXTRACT "readme.txt" FunctionEnd #------------------------------------------------------------------ Section "-post" ; (post install section, happens last after any optional sections) ; add any commands that need to happen after any optional sections here WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyApp" "DisplayName" "MyApp (remove only)" WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\MyApp" "UninstallString" '"$INSTDIR\uninst.exe"' ; write out uninstaller WriteUninstaller "$INSTDIR\uninstall.exe" SectionEnd ; end of -post section ;Uninstaller Section Section "Uninstall" DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MyApp" ;ADD YOUR OWN FILES HERE... Delete "$INSTDIR\uninstall.exe" RMDir "$INSTDIR" SectionEnd ; eof