Differences

This shows you the differences between the selected revisions of the page.

custom_distribution 2005-05-13 custom_distribution 2017-01-07 (current)
Line 1: Line 1:
====== Custom Distribution ====== ====== Custom Distribution ======
-This chapter includes hints for thos who want to prepare custom distribution +This chapter includes hints for those who want to prepare custom distribution 
-of WinSCP with own configuration (typicaly preconfigured sessions). +of WinSCP with own configuration (typically [[session_configuration#site|preconfigured sites]]).
- +
-You can help yourself when preparing custom distribution by:+
===== Creating Custom Installer ===== ===== Creating Custom Installer =====
 +WinSCP uses [[&url(innosetup)|Inno Setup]] as installer. The most simple Inno Setup script for WinSCP may look like the one below. For full WinSCP install script see file ''deployment/winscpsetup.iss'' in the source code.
<code iss> <code iss>
-Setup 
- 
[Setup] [Setup]
; Name of the application ; Name of the application
-AppName=WinSCP3 (provided by Some Company) +AppName=WinSCP (provided by Some Company) 
-; not to allow installation while WinSCP is running +; Name of the application including version 
-AppMutex=WinSCP+AppVerName=WinSCP 5.0
; Installation directory (can be changed by user) ; Installation directory (can be changed by user)
-DefaultDirName={pf}\WinSCP3+DefaultDirName={pf}\WinSCP
; Start menu group name ; Start menu group name
-DefaultGroupName=WinSCP3 (provided by Some Company) +DefaultGroupName=WinSCP (provided by Some Company) 
-; Name of the application including version +; Not to allow installation while WinSCP is running 
-AppVerName=WinSCP 3.7.5+AppMutex=WinSCP
[Files] [Files]
; Install WinSCP itself ; Install WinSCP itself
-Source: "WinSCP3.exe"; DestDir: "{app}"; \+Source: "WinSCP.exe"; DestDir: "{app}"; \
  Flags: ignoreversion   Flags: ignoreversion
; It is recommended (especially for not experienced users) to install ; It is recommended (especially for not experienced users) to install
; drag&drop shell extension ; drag&drop shell extension
Source: "DragExt.dll"; DestDir: "{app}"; \ Source: "DragExt.dll"; DestDir: "{app}"; \
-  Flags: ignoreversion regserver restartreplace restartreplace uninsrestartdelete+  Flags: regserver restartreplace uninsrestartdelete
[Icons] [Icons]
; Start menu icon ; Start menu icon
-Name: "{group}\WinSCP"; Filename: "{app}\WinSCP3.exe"+Name: "{group}\WinSCP"; Filename: "{app}\WinSCP.exe"
; Desktop icon ; Desktop icon
-Name: "{userdesktop}\WinSCP3"; Filename: "{app}\WinSCP3.exe"+Name: "{userdesktop}\WinSCP"; Filename: "{app}\WinSCP.exe"
[Registry] [Registry]
#define RegistryKey "Software\Martin Prikryl\WinSCP 2" #define RegistryKey "Software\Martin Prikryl\WinSCP 2"
-; Make Explorer-like interface initial setting+; Make Explorer interface initial setting
; (recommended especially for not experienced users) ; (recommended especially for not experienced users)
-; Remove or use value 0 for Norton Commander interface+; Remove or use value 0 for Commander interface
Root: HKCU; SubKey: "{#RegistryKey}\Configuration\Interface"; ValueType: dword; \ Root: HKCU; SubKey: "{#RegistryKey}\Configuration\Interface"; ValueType: dword; \
  ValueName: "Interface"; ValueData: 1   ValueName: "Interface"; ValueData: 1
; Enable using of drag&drop shell extension ; Enable using of drag&drop shell extension
 +; (and make sure it is disabled again when the extension is uninstalled)
Root: HKCU; SubKey: "{#RegistryKey}\Configuration\Interface"; ValueType: dword; \ Root: HKCU; SubKey: "{#RegistryKey}\Configuration\Interface"; ValueType: dword; \
  ValueName: "DDExtEnabled"; ValueData: 1; \   ValueName: "DDExtEnabled"; ValueData: 1; \
Line 52: Line 50:
[Run] [Run]
; Offer starting WinSCP after installation ; Offer starting WinSCP after installation
-Filename: "{app}\WinSCP3.exe"; Description: "Launch &WinSCP"; \+Filename: "{app}\WinSCP.exe"; Description: "Launch &WinSCP"; \
  Flags: nowait postinstall skipifsilent   Flags: nowait postinstall skipifsilent
[UninstallRun] [UninstallRun]
; Offer configuration cleanup on uninstallation ; Offer configuration cleanup on uninstallation
-Filename: "{app}\WinSCP3.exe"; Parameters: "/UninstallCleanup"; \+Filename: "{app}\WinSCP.exe"; Parameters: "/UninstallCleanup"; \
  RunOnceId: "UninstallCleanup"   RunOnceId: "UninstallCleanup"
 +</code>
-; ???? +Save the script into file (e.g. ''winscpsetup.iss''), put files ''WinSCP.exe'' and ''DragExt.dll'' to the same directory and run Inno Setup compiler:
-[UninstallDelete] +
-Type: files; Name: &quot;{app}\WinSCP3.ini&quot;+
 +<code>
 +iscc winscpsetup.iss
</code> </code>
-===== Using INI File as Configuration Storage ===== +===== [[preconfigured_site]] Preconfigured Site ===== 
-Read [[config|documentation]].+You may have the installer pre-configure [[session_configuration#site|sites]], to make it easier for your users to connect to your server. 
 + 
 +The easiest way is to configure the session using GUI and then check the [[config|configuration storage]] to see how WinSCP stores the site settings. Then add corresponding commands to the installer script. 
 + 
 +Simple example of "Server" session configuration, including hostname and username only, is shown below. You can also use hidden option ''Special'' to prevent user from [[administration#special_session|accidentally deleting or modifying the session]]. 
 + 
 +<code iss> 
 +[Registry] 
 +#define RegistryKey "Software\Martin Prikryl\WinSCP 2" 
 +; Configure hostname/username 
 +Root: HKCU; SubKey: "{#RegistryKey}\Sessions\Server"; ValueType: string; \ 
 +  ValueName: "HostName"; ValueData: "example.com" 
 +Root: HKCU; SubKey: "{#RegistryKey}\Sessions\Server"; ValueType: string; \ 
 +  ValueName: "UserName"; ValueData: "customer" 
 +; Prevent user from accidentally deleting or modifing the session 
 +Root: HKCU; SubKey: "{#RegistryKey}\Sessions\Server"; ValueType: dword; \ 
 +  ValueName: "Special"; ValueData: 1 
 +</code> 
 + 
 +===== [[ini]] Using INI File as Configuration Storage ===== 
 + 
 +Instead of modifying the registry from install script you can make the installer create [[config|configuration INI file]].  
 + 
 +You can also have the installer install the embedded INI file, like: 
 + 
 +<code ini> 
 +[Configuration\Interface] 
 +Interface=1 
 + 
 +[Sessions\Server] 
 +HostName=example.com 
 +UserName=customer 
 +Special=1 
 +</code> 
 + 
 +===== [[distributing_passwords]] Distributing Passwords ===== 
 +While not recommended, you can distribute even session passwords. By default the password needs to be stored in encrypted form to option ''Password''. You can store the password from GUI to get the correct encrypted form (note that key for encryption is hostname and username, so the encrypted password cannot be misused for other session). 
 + 
 +If you need to store the password in plain-text, use session option ''PasswordPlain'', instead of ''Password''. Note that WinSCP will, if possible, replace the ''PasswordPlain'' with equivalent ''Password'' option on the first start-up. The same way, you can use ''TunnelPasswordPlain'' instead of ''TunnelPassword'' and ''ProxyPassword'' instead of ''ProxyPasswordEnc''. 
 + 
 +===== [[embedded_settings]] Embedded Settings ===== 
 + 
 +As alternative to own installer you can directly embed site settings to WinSCP executable. 
 + 
 +You can do it by inserting INI file with site settings to ''RCData'' resource named "WINSCP_SESSION".  
 + 
 +<code ini> 
 +[Sessions\Server] 
 +HostName=example.com 
 +UserName=customer 
 +</code> 
 + 
 +When WinSCP finds such resource it loads the session list from it instead of [[config|configured storage]]. In addition it automatically starts the first session in the list, unless overridden by specifying name of another session on [[commandline|command line]]. Note that general configuration options will be ignored, when present in the INI file. 
 + 
 +You can also embed [[public_key#private|private key]] to be used for authentication to ''RCData'' resource named "WINSCP_KEY". WinSCP will automatically try to use it for authentication unless session has its own key configured. 
 + 
 +==== Using Resource Hacker ==== 
 + 
 +To embed the ''RCData'' resource you can use any resource editor, for example [[http://www.angusj.com/resourcehacker/|Resource Hacker]].  
 + 
 +Using a command-line interface of the Resource Hacker, you add the "WINSCP_SESSION" resource like: 
 + 
 +<code batch> 
 +ResourceHacker.exe -addoverwrite WinSCP.exe, WinSCP.exe, session.ini, RCDATA, WINSCP_SESSION, 0 
 +</code> 
 + 
 +where the ''session.ini'' is the INI file with your session. 
 + 
 +Check the generated ''ResourceHacker.log'' for results of the operation. 
 + 
 +You can of course also use a GUI interface 
-===== Setting Up Autologin =====+===== Administration Tasks ===== 
 +The custom installer can utilize ability of the application to [[administration|restrict or enforce its certain functionality]].
-··* Using INI file as [[config|configuration storage]]+===== [[hyperlink]] Distributing Site Settings Using Hyperlink =====
-  * Setting up autologin. +
-  * Using embedded settings (that cannot be overridden).+
 +WinSCP supports [[integration_url#save|save extension]] to [[integration_url|URL format of protocols it handles]] that makes it [[session_configuration#site|save session settings]] provided by URL instead of opening a session.
 +===== License =====
 +When creating custom distribution of WinSCP, please bear in mind that you need to follow [[license|WinSCP license]], unless arranged otherwise with an author.

Last modified: by martin