Palm installer routines: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Added category links.)
m (Adding new author and category links.)
Line 1: Line 1:
{|align=right
{{PageAuthor|spekary}}
|<small>Author: [[{{ns:2}}:spekary|spekary]] ([[{{ns:3}}:spekary|talk]], [[{{ns:-1}}:Contributions/spekary|contrib]])</small>
 
|}
<br style="clear:both;">
== Description ==
== Description ==
The following is a set of Palm installer routines I use for installers. It helps to separate out the Palm only stuff.
The following is a set of Palm installer routines I use for installers. It helps to separate out the Palm only stuff.
Line 921: Line 919:
</highlight-ini>
</highlight-ini>


[[{{ns:14}}:System Related Functions]]
[[Category:System Related Functions]]

Revision as of 13:33, 24 June 2005

Author: spekary (talk, contrib)


Description

The following is a set of Palm installer routines I use for installers. It helps to separate out the Palm only stuff.

How To Use

To use it, you will need to create a directory, and put some CDK DLLs, and a couple of ini files for it to get to.

If you don't use all the routines, you will get warnings, but oh well. Improving it is an exercise for the reader.

Not all translations are complete, but I thought I would post what we have so far.

palminst.nsi

; Include file for Palm install function calls
; Most functions preserve user registers and return results on the stack
; Written by Shannon Pekary
; Hands High Software, Inc.
; http://www.handshigh.com/
; This is now in the public domain. No warranty expressed or implied. Use it at your own risk. Etc. etc.
 
 
; If you are installing a conduit, also !define CONDUIT to include the conduit stuff
 
!define PALM_INSTAIDE_DIR    "\put\the\local\directory\where\you\store\the\following:"
        ; InstAide.dll
        ; userlist.ini
        ; hotsync.ini
        ; and if using a conduit:
        ; hsapi.dll
 
; InstAide dll definitions
 
; returns the number of users
!define PltGetUserCount "InstAide::PltGetUserCount(v) i"
 
; returns the name of the nth user
; (n, returnedName, size)
; you need to allocate space for the returned name, and put that amount in size
; returns an error number
!define PltGetUser "InstAide::PltGetUser(i, t, *i) i"
 
; returns the path to the given user's directory
!define PltGetUserDirectory "InstAide::PltGetUserDirectory(t, t, *i) i"
 
; installs the file to the given user
; (user, file path)
!define PltInstallFile "InstAide::PltInstallFile(t, t) i"
; returns the given path
; (n, returnedName, size)
!define PILOT_PATH_HOME         1
!define PILOT_PATH_HOTSYNC      2
!define PILOT_PATH_TUTORIAL     3
!define PltGetPath "Instaide::PltGetPath(i, t, *i) i"
;System::Call "${MyFunc} ('another string', 3, )"
 
 
!ifdef CONDUIT
 
; control the hotsync application
; First parameter:
; 0 close app
; 1 start app
; 2 restart app
; Second paramater is a compbined bit field:
; 0 do nothin
; 1 restore registery
; 2 restore config entries to default
; 4 verbose
; 8 debug level 1
; 16 debug level 2
; 32 sync check
 
!define HSSetState "HSAPI::HsSetAppStatus(i, i) i"
 
; register a conduit notifier dll
; creator code, dll dir path (should be palm dir), dll name
!define HHRegisterNotifier "HHInstServ::RegisterNotifier(t,t,t) i"
 
; install conduit creator
; creator name, conduit type (probably 1)
!define CmInstallCreator "CondMgr::CmInstallCreator(t, i) i"
 
!define CmSetCreatorName "CondMgr::CmSetCreatorName(t, t) i"
!define CmGetCreatorName "CondMgr::CmGetCreatorName(t,t,*i) i"
!define CmSetCreatorTitle "CondMgr::CmSetCreatorTitle(t, t) i"
!define CmSetCreatorDirectory "CondMgr::CmSetCreatorDirectory(t, t) i"
!define CmSetCreatorIntegrate "CondMgr::CmSetCreatorIntegrate(t, i) i"
!define CmSetCreatorPriority "CondMgr::CmSetCreatorPriority(t, i) i"
!define CmSetCreatorModule "CondMgr::CmSetCreatorModule(t, t) i"
!define CmSetCreatorFile "CondMgr::CmSetCreatorFile(t, t) i"
!define CmGetCreatorFile "CondMgr::CmGetCreatorFile(t, t, *i) i"
!define CmRemoveConduit "CondMgr::CmRemoveConduitByCreatorID(t) i"
 
!define CmGetCreatorValueDWord "CondMgr::CmGetCreatorValueDword(t, t, *i, i) i"
!define CmGetCreatorValueString "CondMgr::CmGetCreatorValueString(t, t, t, *i, t) i"
!define CmSetCreatorValueDWord "CondMgr::CmSetCreatorValueDword(t, t, i) i"
!define CmSetCreatorValueString "CondMgr::CmSetCreatorValueString(t, t, t) i"
 
!define CmGetCreatorType "CondMgr::CmGetCreatorType(t) i"
 
; set creator name
!endif
 
; language strings
; NoPalmInstaller
!ifdef LANG_ENGLISH
LangString NoPalmInstaller ${LANG_ENGLISH} "No Palm Desktop was found on your \
system.  The installation cannot complete.  Please ensure that the latest \
version of the Palm Desktop Software is installed on your computer before \
installing."
LangString NoUserChoice ${LANG_ENGLISH} "You must choose a user to proceed!"
LangString ClickInstall ${LANG_ENGLISH} "After you have selected a user, click 'Install'."
LangString SelectUser ${LANG_ENGLISH} "Choose the handheld User Name for installation:"
LangString SyncNow ${LANG_ENGLISH} "Synchronize your handheld computer now to complete your installation."
LangString UserName ${LANG_ENGLISH} "User Name"
!endif
 
!ifdef LANG_GERMAN
LangString NoPalmInstaller ${LANG_GERMAN} "Auf Ihrem System wurde kein Palm-Desktop gefunden. Die Installation kann nicht vollst&copy;ig durchgef&copy;erden. Bitte stellen Sie sicher, da&copy;die aktuelle Version des Palm-Desktops auf Ihrem Computer installiert ist, damit Slap auf Ihrem Handheld installiert werden kann."
LangString NoUserChoice ${LANG_GERMAN} "Sie m&copy;einen Benutzer ausw&copy;en, um mit der Installation fortfahren zu k&copy;n!"
LangString ClickInstall ${LANG_GERMAN} "Nachdem Sie einen Benutzer vorgew&copy;t haben, klicken Sie 'Install' an."
LangString SelectUser ${LANG_GERMAN} "Bitte w&copy;en Sie den Benutzer aus, f&copy; die Installation durchgef&copy;erden soll:"
LangString SyncNow ${LANG_GERMAN} "Synchronisieren Sie bitte Ihren Handheld, um die Installation abzuschlie&copy;n.."
LangString UserName ${LANG_GERMAN} "Benutzername"
!endif
 
!ifdef LANG_FRENCH
LangString NoPalmInstaller ${LANG_FRENCH} "Aucun installateur de Palm Desktop n'a &copy; trouv&copy;ur le votre \
syst&copy;. L'installation ne peut pas accomplir. Veuillez s'assurer que le plus en retard \
version du logiciel de Palm Desktop est install&copy;ur votre ordinateur \
avant d'installant."
LangString NoUserChoice ${LANG_FRENCH} "Vous devez choisir un utilisateur pour proc&copy;r!"
LangString ClickInstall ${LANG_FRENCH} "Apr&copy;que vous ayez choisi un utilisateur, cliquez 'Installer'."
LangString SelectUser ${LANG_FRENCH} "Choisissez le nom du handheld pour l'installation:"
LangString SyncNow ${LANG_FRENCH} "Synchronisez votre handheld maintenant pour accomplir votre installation."
LangString UserName ${LANG_FRENCH} "Utilisateur"
!endif
 
; Functions
Function Palm_Init
;  Call from .onInit
   File /oname=$PLUGINSDIR\userlist.ini "${PALM_INSTAIDE_DIR}\userlist.ini"
   File /oname=$PLUGINSDIR\hotsync.ini "${PALM_INSTAIDE_DIR}\hotsync.ini"
   File /oname=$PLUGINSDIR\Instaide.dll "${PALM_INSTAIDE_DIR}\Instaide.dll"
 
!ifdef CONDUIT
   File /oname=$PLUGINSDIR\HSAPI.DLL "${PALM_INSTAIDE_DIR}\HSAPI.dll"
!endif
FunctionEnd
 
Function Palm_GetUserCount
; returns user count at the top of the stack
; Usage:
; Call Palm_GetUserCount
; pop $0
  Push $R0
   SetOutPath $PLUGINSDIR
   System::Call "${PltGetUserCount} .R0"
   ;MessageBox MB_OK|MB_ICONINFORMATION "There seem to be $R0 Palm users"
   Exch $R0
FunctionEnd
 
Function Palm_GetUser
; Given a user number, returns the corresponding user name
; Usage:
; Push $UserNumber
; Call Palm_GetUser
; Pop $UserName
  exch $0
  push $1
  push $R0
  SetOutPath $PLUGINSDIR
  StrCpy $1 ${NSIS_MAX_STRLEN}
  ;MessageBox MB_OK|MB_ICONINFORMATION "Is error: $0"
  System::Call "${PltGetUser} (r0, .R0, r1) ."
  ; R0 now has the name
  StrCpy $0 $R0
  pop $R0
  pop $1
  exch $0
FunctionEnd
 
Function Palm_GetUserDirectory
; Given a user name, returns the directory path to the user's palm directory
; Usage:
; Push $UserName
; Call Palm_GetUserDirectory
; Pop $UserPath
  exch $0
  push $1
  push $R0
  SetOutPath $PLUGINSDIR
  StrCpy $1 ${NSIS_MAX_STRLEN}
  ;MessageBox MB_OK|MB_ICONINFORMATION "Is error: $0"
  System::Call "${PltGetUserDirectory} (r0, .R0, r1r1) .r0"
  ; R0 now has the path
  StrCpy $0 $R0
  pop $R0
  pop $1
  exch $0
FunctionEnd
 
; The following macro is used to define both install and uninstall versions
!macro GETPILOTPATH UN
; puts pilot path on the stack
Function ${UN}Palm_GetPilotPath
   push $0
   push $1
   push $2
   push $R0
   push $OutDir
 
   SetOutPath $PLUGINSDIR
   StrCpy $1 ${NSIS_MAX_STRLEN}
   StrCpy $0 2
   System::Call '${PltGetPath}(r0, .R0, r1) .r2'
   StrCpy $0 $R0
 
   ; The path now has Hotsync.exe in it The following code takes that out
 TruncLoop:
   StrCpy $R0 $0 1 -1 ; get last character
   StrCpy $0 $0 -1 ; remove it
   ;MessageBox MB_OK|MB_ICONINFORMATION "The Pilot Path is: $0"
   StrLen $2 $0
   IntCmp $2 0 KeepGoing ; skip next instruction if we are at zero length to avoid endless loop
   StrCmp $R0 "\" 0 TruncLoop ; if it was a \, then quit
KeepGoing:
 
   pop $OutDir
   pop $R0
   pop $2
   pop $1
   exch $0
FunctionEnd
!macroend
 
; include both versions now
!insertmacro  GETPILOTPATH ""
!insertmacro GETPILOTPATH "un."
 
 
 
Function Palm_GetUserList
; Returns on the stack a list of Palm users separated by pipes "|" for use in creating a drop down list
; Will display an error message and set error if no users are found
; Usage: Call Palm_GetUserList
;        Pop $UserList
;
  push $0
  ; NSIS has to be using the directory containing the dll for it to find it
  SetOutPath $PLUGINSDIR
  System::Call '${PltGetUserCount} .r0'
 
  IntCmp $0 0 0 0 foundInstaller ; if return value of PltGetUserCount is 0 or negative, then we can't continue
    MessageBox MB_OK|MB_ICONINFORMATION $(NoPalmInstaller)
    SetErrors
    pop $0
    Return
 
  foundInstaller:
  push $1
  push $2
  push $3
  push $4
  push $5
 
  StrCpy $1 $0
  ; Compile the list of Palm Users
  StrCpy $2 0 ; Initialize counter
  StrCpy $0 ""  ; initialize user list
  Loop:
    StrCpy $4 ${NSIS_MAX_STRLEN} ; $4 will tell the function the buffer length of $3
    ; $3 will be set to the username of the user indexed by $2
    ;System::Call 'InstAide::PltGetUser(i r2, t .r3, *i r4) i .r5'
    System::Call '${PltGetUser}(r2, .r3, r4) .r5'
     ;MessageBox MB_OK|MB_ICONINFORMATION "Found User $3"
 
    StrCpy $0 "$0$3|"
    IntOp $2 $2 + 1 ; Increment the counter
    IntCmp $2 $1 0 Loop 0 ; continue looping until end
 
  ;user list built, but it has an extra | on the end of it
  StrCpy $0 "$0" -1
  pop $5
  pop $4
  pop $3
  pop $2
  pop $1
  exch $0
FunctionEnd
 
 
Function Palm_GetUserChoice
; either chooses the main user if there is only one, or asks for a PalmUser
; will return the user choice on the stack
 
  push $0
  StrCpy $0 0
  SetOutPath $PLUGINSDIR
 
  call Palm_GetUserCount
  pop $0
  IntCmp $0 1 GetOne Error
 
  ; more than one user
  Call Palm_GetUserList
  pop $0
  ;MessageBox MB_OK|MB_ICONINFORMATION "Found Users $PalmUserList"
  WriteINIStr "$PLUGINSDIR\userlist.ini" "Field 3" "ListItems" $0
  ; Get first user to set up as a default, or if a previous user was chosen, set that to the current choice (would happen if Back button was pressed)
  ReadINIStr $0 "$PLUGINSDIR\userlist.ini" "Field 3" "State" ; get selection
 
  StrCmp $0 "" GetDefault Popup
 
GetDefault:
  push 0
  Call Palm_GetUser
  pop $0
 
Popup:
   ;MessageBox MB_OK|MB_ICONINFORMATION "Default User $0"
  WriteINIStr "$PLUGINSDIR\userlist.ini" "Field 3" "State" $0
 
  ; Setup languages for dialog
  WriteINIStr "$PLUGINSDIR\userlist.ini" "Field 1" "Text" $(ClickInstall)
  WriteINIStr "$PLUGINSDIR\userlist.ini" "Field 2" "Text" $(SelectUser)
  WriteINIStr "$PLUGINSDIR\userlist.ini" "Settings" "Title" $(UserName)
 
  InstallOptions::dialog $PLUGINSDIR\userlist.ini
  pop $0 ;returns an error code
  ReadINIStr $0 "$PLUGINSDIR\userlist.ini" "Field 3" "State" ; get selection
;      MessageBox MB_OK|MB_ICONEXCLAMATION "UserChoice is $0."
 
  Goto Finish
 
GetOne:
  push 0
  Call Palm_GetUser
  pop $0
  GoTo Finish
 
Error:
   MessageBox MB_OK|MB_ICONINFORMATION $(NoPalmInstaller)
   StrCpy $0 0
   SetErrors
   GoTo Finish
 
Finish:
   ; user choice should be in $0 now
   ;MessageBox MB_OK|MB_ICONINFORMATION "User is $0"
   exch $0
FunctionEnd ; SetupUserChoice
 
 
Function Palm_ValidateUserChoice
; Call this as a validation routine for the User Choice page
  push $0
  ReadINIStr $0 "$PLUGINSDIR\userlist.ini" "Field 3" "State"
  StrCmp $0 "" 0 Continue
  MessageBox MB_OK|MB_ICONINFORMATION $(NoUserChoice)
  pop $0
  Abort
Continue:
 
FunctionEnd
 
; call this to tell the user to hotsync
Function Palm_HotSyncNowMessage
  SetOutPath $PLUGINSDIR
  WriteINIStr "$PLUGINSDIR\hotsync.ini" "Field 1" "Text" $(SyncNow)
  InstallOptions::dialog $PLUGINSDIR\hotsync.ini
FunctionEnd
 
Function Palm_InstallFile
; Install the given file to the given user name
; Usage:
; push $UserName
; push $FilePath
; call Palm_InstallFile
;
  exch $0 ; FilePath
  exch
  exch $1 ; UserName
  push $OutDir
 
  ;MessageBox MB_OK|MB_ICONINFORMATION "Installing $0 for $1"
 
  SetOutPath $PLUGINSDIR
  DetailPrint 'Installing Palm file $R1 to user $1'
  System::Call '${PltInstallFile} (r1, r0)'
 
  ;MessageBox MB_OK|MB_ICONINFORMATION "Result $R0"
  pop $OutDir
  pop $1
  pop $0
FunctionEnd
 
Function Palm_InstallDir
; Installs all the PRC files in the given directory to the given user name
; Usage:
; push $UserName
; push $DirPath  (should end in *.prc or *.pdb or some other file conglomeration)
; call Palm_InstallDir
  exch $0 ; DirPath
  exch
  exch $1 ; UserName
 
  push $R0
  push $R1
  push $R2
  push $R3
  push $R4
  ;MessageBox MB_OK|MB_ICONINFORMATION "Installing $0 for $1"
  push $OutDir
 
  ; extract the directory from the dirpath variable
  StrCpy $R3 $0
  Trunc:
  StrCpy $R4 $R3 1 -1
  StrCpy $R3 $R3 -1
  StrLen $R2 $R3
  IntCmp $R2 0 +2 ; keep from doing an endless loop
  StrCmp $R4 "\" 0 Trunc
 
 
  SetOutPath $PLUGINSDIR
 
  FindFirst $R0 $R1 $0
  StrCmp $R0 "" error
  again:
  StrCmp $R1 "" done
  DetailPrint 'Installing Palm file $R3\$R1 to user $1'
  System::Call '${PltInstallFile} (r1, "$R3\$R1")'
  FindNext $R0 $R1
  Goto again
  done:
  FindClose $R0
  error:
 
  ;MessageBox MB_OK|MB_ICONINFORMATION "Result $R0"
  pop $OutDir
  pop $R4
  pop $R3
  pop $R2
  pop $R1
  pop $R0
  pop $1
  pop $0
 
FunctionEnd
 
!ifdef CONDUIT                         ; conduit specific stuff
 
Function HotSync_SetState
; turn hotsync on or off
; Usage:
; push start/restart value
; push verbose logging flags
; call HotSync_SetState
 
  exch $0 ; verbose flags
  exch
  exch $1 ; start/restart
  push $OutDir
  SetOutPath $PLUGINSDIR
  System::Call '${HSSetState} (r1, r0)'
  pop $OutDir
  pop $1
  pop $0
FunctionEnd
 
Function Conduit_Install
; install the conduit
; usage:
; $0 = creator
; $1 = type (probably 1 for application)
; $2 = conduit dll file name
; $3 = visible conduit name to user
; $4 = priority (default to 2)
; $5 = directory name of conduit data (optional)
; $6 = path to integrated application (optional)
; $7 = file name (optional)
;
; call Conduit_Install
 
push $OutDir
push $R0
push $R1
push $R2
 
call Palm_GetPilotPath
pop $R0 ; pilotpath
  ;MessageBox MB_OK|MB_ICONINFORMATION "PilotPath is $R0"
 
SetOutPath $R0
 
System::Call '${CmRemoveConduit} (r0) .R1'
 
StrCpy $R2 "InstallCreator"
 
System::Call '${CmInstallCreator} (r0, r1) .R1'
IntCmp $R1 0 0 Fail Fail
 
StrCpy $R2 "Name"
System::Call '${CmSetCreatorName} (r0, r2) .R1'
IntCmp $R1 0 0 Fail Fail
 
StrCpy $R2 "Title"
System::Call '${CmSetCreatorTitle} (r0, r3) .R1'
IntCmp $R1 0 0 Fail Fail
 
StrCpy $R2 "Priority"
System::Call '${CmSetCreatorPriority} (r0, r4) .R1'
IntCmp $R1 0 0 Fail Fail
 
StrCpy $R2 "Directory"
StrCmp $5 "" Module
System::Call '${CmSetCreatorDirectory} (r0, r5) .R1'
IntCmp $R1 0 0 Fail Fail
 
Module:
StrCpy $R2 "Integrate"
StrCmp $6 "" File
System::Call '${CmSetCreatorIntegrate} (r0, "1") .R1'
IntCmp $R1 0 0 Fail Fail
 
StrCpy $R2 "Module"
System::Call '${CmSetCreatorModule} (r0, r6) .R1'
IntCmp $R1 0 0 Fail Fail
 
File:
StrCpy $R2 "File"
StrCmp $7 "" End
System::Call '${CmSetCreatorFile} (r0, r7) .R1'
IntCmp $R1 0 0 Fail Fail
 
DetailPrint "Registered Conduit '$0'"
GoTo End
 
Fail:
DetailPrint "Conduit registration failed with at $R2 - $R1."
MessageBox MB_OK|MB_ICONEXCLAMATION "Conduit Registration Failed - $R1."
 
End:
pop $R2
pop $R1
pop $R0
pop $OutDir
pop $1
pop $0
 
FunctionEnd
 
 
 
 
Function un.UninstallConduit
; push $creatorID
;call un.UninstallConduit
 
exch $0
push $OutDir
push $R0
push $R1
 
call un.Palm_GetPilotPath
pop $R0 ; pilotpath
 
SetOutPath $R0
System::Call '${CmRemoveConduit} (r0) R1'
StrCmp $R1 0 Success
DetailPrint "Conduit Removal Failed - $R1."
Goto End
Success:
DetailPrint "Conduit Removal Succeeded."
 
End:
pop $R0
pop $OutDir
pop $0
FunctionEnd
 
Function _SaveSettingString
; a utility function to save one setting
; $0 is the ini file name
; $1 is conduit creator
; $2 is string name
 
push $3
push $4
 
  StrCpy $3 ${NSIS_MAX_STRLEN}
  System::Call '${CmGetCreatorValueString} (r1, r2, .r4, r3 r3, "") R0'
 
  WriteIniStr $0 "Conduit" $2 $4
 
pop $4
pop $3
FunctionEnd
 
Function _SaveSettingInt
; a utility function to save one setting
; $0 is the ini file name
; $1 is conduit creator
; $2 is setting name
 
push $4
 
  System::Call '${CmGetCreatorValueDWord} (r1, r2, .r4, "0") R0'
  WriteIniStr $0 "Conduit" $2 $4
 
pop $4
FunctionEnd
 
Function SaveConduitSettings
; puts all the settings for a particular conduit into a .ini file
; Usage:
; push $creatorID
; push $fileName
; call SaveConduitSettings
  exch $0 ; fileName
  exch
  exch $1 ; creatorID
  push $2
  push $R0
 
  push $OutDir
 
  call Palm_GetPilotPath
  pop $R0
  SetOutPath "$R0"
 
  StrCpy $R0 "0"
 
 ; MessageBox MB_OK|MB_ICONINFORMATION "creator $1"
   System::Call '${CmGetCreatorType}(r1) .R0'
   IntCmp $R0 0 Continue 0 Continue
;  MessageBox MB_OK|MB_ICONINFORMATION "Problem $R0"
 
  DetailPrint "Conduit not found."
  GoTo End
Continue:
 
  WriteIniStr $0 "Conduit" "Type" $R0
 
  StrCpy $2 "Conduit"
  call _SaveSettingString
 
  StrCpy $2 "Creator"
  WriteIniStr $0 "Conduit" $2 $1
 
  StrCpy $2 "Directory"
  call _SaveSettingString
 
  StrCpy $2 "File0"
  call _SaveSettingString
 
  StrCpy $2 "Remote0"
  call _SaveSettingString
 
  StrCpy $2 "Name"
  call _SaveSettingString
 
  StrCpy $2 "Priority"
  call _SaveSettingInt
 
  StrCpy $2 "Information"
  call _SaveSettingString
 
  StrCpy $2 "Username"
  call _SaveSettingString
 
  StrCpy $2 "Module"
  call _SaveSettingString
 
  StrCpy $2 "Arguments"
  call _SaveSettingString
 
  StrCpy $2 "Integrate"
  call _SaveSettingInt
 
End:
    pop $OutDir
    pop $R0
    pop $2
    pop $1
    pop $0
 
FunctionEnd
 
 
Function _RestoreSettingString
; a utility function to save one setting
; $0 is the ini file name
; $1 is conduit creator
; $2 is string name
 
  push $3
 
  ReadIniStr $3 $0 "Conduit" $2
  StrCmp $3 "" End
  ; we have a value
  System::Call '${CmSetCreatorValueString}(r1, r2, r3) .R0'
End:
  pop $3
FunctionEnd
 
Function _RestoreSettingInt
; a utility function to save one setting
; $0 is the ini file name
; $1 is conduit creator
; $2 is setting name
 
  push $3
 
  ReadIniStr $3 $0 "Conduit" $2
  IntCmp $3 0 End
  ; we have a value
  System::Call '${CmSetCreatorValueDWord}(r1, r2, r3) .R0'
End:
  pop $3
FunctionEnd
 
 
Function RestoreConduitSettings
; resets all the settings for a particular conduit, reading them from a .ini file that was saved earlier with SaveConduitSettings
; Usage:
; push $creatorID
; push $fileName
; call SaveConduitSettings
  exch $0 ; fileName
  push $1
  push $2
  push $R0
 
  push $OutDir
 
  call Palm_GetPilotPath
  pop $R0
  SetOutPath $R0
 
  ReadIniStr $1 $0 "Conduit" "Creator"
 
  StrCmp $1 "" 0 Continue
  DetailPrint "Creator id of conduit not found."
  GoTo End
Continue:
 
  System::Call '${CmRemoveConduit} (r1)'
 
  ReadIniStr $2 $0 "Conduit" "Type"
  System::Call '${CmInstallCreator} (r1, r2)'
 
  StrCpy $2 "Conduit"
  call _RestoreSettingString
 
  StrCpy $2 "Directory"
  call _RestoreSettingString
 
  StrCpy $2 "File0"
  call _RestoreSettingString
 
  StrCpy $2 "Remote0"
  call _RestoreSettingString
 
  StrCpy $2 "Name"
  call _RestoreSettingString
 
  StrCpy $2 "Priority"
  call _RestoreSettingInt
 
  StrCpy $2 "Information"
  call _RestoreSettingString
 
  StrCpy $2 "Username"
  call _RestoreSettingString
 
  StrCpy $2 "Module"
  call _RestoreSettingString
 
  StrCpy $2 "Arguments"
  call _RestoreSettingString
 
  StrCpy $2 "Integrate"
  call _RestoreSettingInt
 
End:
    pop $OutDir
    pop $R0
    pop $2
    pop $1
    pop $0
 
FunctionEnd
 
Function ConduitGetName
; given the conduit creator, returns the conduit name. Returns blank if there is no conduit with that creator, or the conduit has not name.
 exch $0 ; creator
 push $1
 push $2
 push $R0
 
  push $OutDir
 
  call Palm_GetPilotPath
  pop $R0
  SetOutPath "$R0"
  StrCpy $2 ${NSIS_MAX_STRLEN}
;MessageBox MB_OK|MB_ICONINFORMATION "size $2"
 
 System::Call '${CmGetCreatorName}(r0, .r1, r2) .R0'
 ;MessageBox MB_OK|MB_ICONINFORMATION "result $R0"
 
 StrCpy $0 $1
 
 pop $OutDir
 pop $R0
 pop $2
 pop $1
 exch $0
FunctionEnd
 
Function ConduitGetFile
; given the conduit creator, returns the file name. Returns blank if there is no conduit with that creator.
 exch $0 ; creator
 push $1
 push $2
 push $R0
 
  push $OutDir
 
  call Palm_GetPilotPath
  pop $R0
  SetOutPath "$R0"
 
  StrCpy $2 ${NSIS_MAX_STRLEN}
 
 System::Call '${CmGetCreatorFile}(r0, .r1, r2) .R0'
 
 
 StrCpy $0 $1
 
 pop $OutDir
 pop $R0
 pop $2
 pop $1
 exch $0
FunctionEnd
 
Function RemoveConduit
; Deletes the settings for a conduit
; Usage:
; push $creatorID
; call RemoveConduit
  exch $0 ; creator
  push $R0
 
  push $OutDir
 
  call Palm_GetPilotPath
  pop $R0
  SetOutPath $R0
 
  System::Call '${CmRemoveConduit} (r0)'
 
  pop $OutDir
  pop $0
FunctionEnd
 
!endif

userlist.ini

[Settings]
NumFields=3
Title=User Name
 
[Field 1]
Type=Label
Text=After you have selected a user, click "Install".
Left=0
Right=300
Top=81
Bottom=102
 
[Field 2]
Type=Label
Text=Choose the Handheld User Name for Installation:
Left=0
Right=180
Top=9
Bottom=17
 
[Field 3]
Type=Droplist
Text=droplist
ListItems=
Left=24
Right=121
Top=28
Bottom=72

hotsync.ini

[Settings]
NumFields=1
Title=Hotsync
 
[Field 1]
Type=Label
Text=Synchronize your handheld computer now to complete your installation.
Left=0
Right=270
Top=19
Bottom=41