mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-07 12:53:00 -05:00
more adds from win32-branch
This commit is contained in:
307
win32/nsi/mt-daapd-example.conf
Normal file
307
win32/nsi/mt-daapd-example.conf
Normal file
@@ -0,0 +1,307 @@
|
||||
# $Id$
|
||||
#
|
||||
# This is the mt-daapd config file.
|
||||
#
|
||||
# If you have problems or questions with the format of this file,
|
||||
# direct your questions to rpedde@users.sourceforge.net.
|
||||
#
|
||||
# You can also check the website at http://mt-daapd.sourceforge.net,
|
||||
# as there is a growing documentation library there, peer-supported
|
||||
# forums and possibly more.
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# web_root (required)
|
||||
#
|
||||
# Location of the admin web pages.
|
||||
#
|
||||
# If you installed from .RPM, .deb, or tarball with --prefix=/usr, then
|
||||
# this is correct.
|
||||
#
|
||||
# If you installed from tarball without --prefix=/usr, then the correct
|
||||
# path is probably /usr/local/share/mt-daapd/admin-root.
|
||||
#
|
||||
|
||||
web_root admin-root
|
||||
|
||||
#
|
||||
# port (required)
|
||||
#
|
||||
# What port to listen on. It is possible to use a different
|
||||
# port, but this is the default iTunes port
|
||||
#
|
||||
|
||||
port 9999
|
||||
|
||||
#
|
||||
# admin_pw (required)
|
||||
#
|
||||
# This is the password to the administrative pages
|
||||
#
|
||||
|
||||
admin_pw mt-daapd
|
||||
|
||||
|
||||
#
|
||||
# db_type (required)
|
||||
#
|
||||
# This is what kind of backend database to store the song
|
||||
# info in. Valid choices are "sqlite" and "sqlite3".
|
||||
#
|
||||
|
||||
db_type sqlite
|
||||
|
||||
#
|
||||
# db_parms
|
||||
#
|
||||
# This is any extra information the db needs to connect.
|
||||
# in the case of sqlite and sqlite3, this is the name
|
||||
# of the directory to store the database in
|
||||
#
|
||||
# If you installed from RPM or .deb, this path likely already
|
||||
# exists. If not, then you must create it. The directory itself
|
||||
# must be writable by the "runas" user.
|
||||
#
|
||||
|
||||
db_parms .
|
||||
|
||||
#
|
||||
# mp3_dir (required)
|
||||
#
|
||||
# Location of the mp3 files to share. Note that because the
|
||||
# files are stored in the database by inode, these must be
|
||||
# in the same physical filesystem.
|
||||
#
|
||||
|
||||
mp3_dir c:\documents and settings
|
||||
|
||||
#
|
||||
# servername (required)
|
||||
#
|
||||
# This is both the name of the server as advertised
|
||||
# via rendezvous, and the name of the database
|
||||
# exported via DAAP. Also know as "What shows up in iTunes".
|
||||
#
|
||||
|
||||
servername mt-daapd
|
||||
|
||||
#
|
||||
# runas (required)
|
||||
#
|
||||
# This is the user to drop privs to if running as
|
||||
# root. If mt-daapd is not started as root, this
|
||||
# configuration option is ignored. Notice that this
|
||||
# must be specified whether the server is running
|
||||
# as root or not.
|
||||
#
|
||||
|
||||
runas nobody
|
||||
|
||||
#
|
||||
# playlist (optional)
|
||||
#
|
||||
# This is the location of a playlist file.
|
||||
# This is for Apple-style "Smart Playlists"
|
||||
# See the mt-daapd.playlist file in the
|
||||
# contrib directory for syntax and examples
|
||||
#
|
||||
# This doesn't control static playlists... these
|
||||
# are controlled with the "process_m3u" directive
|
||||
# below.
|
||||
#
|
||||
|
||||
playlist /etc/mt-daapd.playlist
|
||||
|
||||
#
|
||||
# password (optional)
|
||||
#
|
||||
# This is the password required to listen to MP3 files
|
||||
# i.e. the password that iTunes prompts for
|
||||
#
|
||||
|
||||
#password mp3
|
||||
|
||||
#
|
||||
# extensions (optional)
|
||||
#
|
||||
# These are the file extensions that the daap server will
|
||||
# try to index and serve. By default, it only indexes and
|
||||
# serves .mp3 files. It can also server .m4a and .m4p files,
|
||||
# and just about any other files, really. Unfortunately, while
|
||||
# it can *attempt* to serve other files (.ogg?), iTunes won't
|
||||
# play them. Perhaps this would be useful on Linux with
|
||||
# Rhythmbox, once it understands daap. (hurry up!)
|
||||
#
|
||||
# Failing that, one can use server-side conversion to transcode
|
||||
# non-standard (.ogg, .flac) music to wav on the server side.
|
||||
# See the ssc_* options below.
|
||||
#
|
||||
|
||||
extensions .mp3,.m4a,.m4p
|
||||
|
||||
#
|
||||
# ssc_codectypes (optional)
|
||||
#
|
||||
# List of codectypes for files that the daap server should
|
||||
# perform internal format conversion and present to clients
|
||||
# as WAV files. The file extensions that these codectypes correspond
|
||||
# to must also be present in 'extensions'
|
||||
# configuration value, or files are not probed in the first
|
||||
# place.
|
||||
#
|
||||
# Valid codectypes:
|
||||
#
|
||||
# mp4a - for AAC (.aac, .mp4, .m4a, .m4p)
|
||||
# mpeg - for mp3
|
||||
# wav - for wav
|
||||
# wma - for wma
|
||||
# ogg - for ogg
|
||||
# flac - for flac (.flac, .fla)
|
||||
# mpc for musepack (.mpc, .mpp, .mp+)
|
||||
# alac for alac (.m4a)
|
||||
#
|
||||
|
||||
#ssc_codectypes ogg,flac,alac
|
||||
|
||||
#
|
||||
# ssc_prog (optional)
|
||||
#
|
||||
# Program that is used in server side format conversion.
|
||||
# Program must accept following command line syntax:
|
||||
# ssc_prog filename offset length ...
|
||||
# Parameter filename is the real name of the file that is
|
||||
# to be converted and streamed, offset is number of bytes
|
||||
# that are skipped from the beginning of the _output_ file
|
||||
# before streaming is started, length is length of the song
|
||||
# in seconds (or zero). All other possible arguments must
|
||||
# be ignored. The resulting wav file (or the rest of
|
||||
# the file after initial seek) is written to the standard
|
||||
# output by the ssc_prog program. This is typically
|
||||
# a script that is a front end for different conversion tools
|
||||
# handling different formats.
|
||||
#
|
||||
|
||||
#ssc_prog /etc/mt-daapd-ssc-script
|
||||
|
||||
#
|
||||
# logfile (optional)
|
||||
#
|
||||
# This is the file to log to. If this is not configured,
|
||||
# then it will log to the syslog.
|
||||
#
|
||||
# Not that the -d <level> switch will control the log verbosity.
|
||||
# By default, it runs at log level 1. Log level 9 will churn
|
||||
# out scads of useless debugging information. Values in between
|
||||
# will vary the amount of logging you get.
|
||||
#
|
||||
|
||||
#logfile /var/log/mt-daapd.log
|
||||
|
||||
#
|
||||
# art_filename (optional)
|
||||
#
|
||||
# There is experimental support thanks to Hiren Joshi
|
||||
# (hirenj@mooh.org) for dynamically adding art to the id3v2
|
||||
# header as it is streamed (!!). If you were using a music system
|
||||
# like zina or andromeda, for example, with cover art called
|
||||
# "_folderOpenImage.jpg", you could use the parameter
|
||||
# art_file _folderOpenImage.jpg and if the file _folderOpenImage.jpg
|
||||
# was located in the same folder as the .mp3 file, it would appear
|
||||
# in iTunes. Cool, eh?
|
||||
#
|
||||
|
||||
#art_filename _folderOpenImage.jpg
|
||||
|
||||
#
|
||||
# rescan_interval
|
||||
#
|
||||
# How often to check the file system to see if any mp3 files
|
||||
# have been added or removed.
|
||||
#
|
||||
# if not specified, the default is 0, which disables background scanning.
|
||||
#
|
||||
# If background rescanning is disabled, a scan can still be forced from the
|
||||
# "status" page of the administrative web interface
|
||||
#
|
||||
# Setting a rescan_interval lower than the time it takes to rescan
|
||||
# won't hurt anything, it will just waste CPU, and make connect times
|
||||
# to the daap server longer.
|
||||
#
|
||||
#
|
||||
|
||||
#rescan_interval 300
|
||||
|
||||
# always_scan
|
||||
#
|
||||
# The default behavior is not not do background rescans of the
|
||||
# filesystem unless there are clients connected. The thought is to
|
||||
# allow the drives to spin down unless they are in use. This might be
|
||||
# of more importance in IDE drives that aren't designed to be run
|
||||
# 24x7. Forcing a scan through the web interface will always work
|
||||
# though, even if no users are connected.
|
||||
|
||||
# always_scan 0
|
||||
|
||||
#
|
||||
# process_m3u
|
||||
#
|
||||
# By default m3u processing is turned off, since most m3u files
|
||||
# sitting around in peoples mp3 directories have bad paths, and
|
||||
# I hear about it. :)
|
||||
#
|
||||
# If you are sure your m3u files have good paths (i.e. unixly pathed,
|
||||
# with relative paths relative to the directory the m3u is in), then
|
||||
# you can turn on m3u processing by setting this directive to 1.
|
||||
#
|
||||
# I'm not sure "unixly" is a word, but you get the idea.
|
||||
#
|
||||
|
||||
# process_m3u 0
|
||||
|
||||
#
|
||||
# scan_type
|
||||
#
|
||||
#
|
||||
# This sets how aggressively mp3 files should be scanned to determine
|
||||
# file length. There are three values:
|
||||
#
|
||||
# 0 (Normal)
|
||||
# Just scan the first mp3 frame to try and calculate size. This will
|
||||
# be accurate for most files, but VBR files without an Xing tag will
|
||||
# probably have wildly inaccurate file times. This is the default.
|
||||
#
|
||||
# 1 (Aggressive)
|
||||
# This checks the bitrates of 10 frames in the middle of the song.
|
||||
# This will still be inaccurate for VBR files without an Xing tag,
|
||||
# but they probably won't be quite as inaccurate as 0. This takes
|
||||
# more time, obviously, although the time hit will only happen the
|
||||
# first time you scan a particular file.
|
||||
#
|
||||
# 2 (Painfully aggressive)
|
||||
# This walks through the entire song, counting the number of frames.
|
||||
# This should result in accurate song times, but will take the most
|
||||
# time. Again, this will only have to be incurred the first time
|
||||
# the file is indexed.
|
||||
#
|
||||
|
||||
scan_type 2
|
||||
|
||||
#
|
||||
# compress
|
||||
#
|
||||
# Whether to use gzip content-encoding when transferring playlists etc.
|
||||
# This was contributed as a patch by Ciamac Moallemi just prior to the 0.2.1
|
||||
# release, and as such, hasn't gotten as much testing as other features.
|
||||
#
|
||||
# This feature should substantially speed up transfers of large databases
|
||||
# and playlists.
|
||||
#
|
||||
# It will eventually default to 1, but currently it defaults to 0.
|
||||
#
|
||||
|
||||
# compress 0
|
||||
|
||||
|
||||
|
||||
|
||||
190
win32/nsi/mt-daapd.nsi
Normal file
190
win32/nsi/mt-daapd.nsi
Normal file
@@ -0,0 +1,190 @@
|
||||
; $Id$
|
||||
; Script generated by the HM NIS Edit Script Wizard.
|
||||
|
||||
; HM NIS Edit Wizard helper defines
|
||||
!define PRODUCT_NAME "mt-daapd"
|
||||
!define PRODUCT_SERVICE "Multi-Threaded DAAP Daemon"
|
||||
!define /date DATEVER "%Y%m%d"
|
||||
!define PRODUCT_VERSION "cvs-${DATEVER}"
|
||||
!define PRODUCT_PUBLISHER "Ron Pedde"
|
||||
!define PRODUCT_WEB_SITE "http://www.mt-daapd.org"
|
||||
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\mt-daapd.exe"
|
||||
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
||||
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
|
||||
|
||||
; MUI 1.67 compatible ------
|
||||
!include "MUI.nsh"
|
||||
!include "servicelib.nsh"
|
||||
|
||||
; MUI Settings
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
|
||||
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
|
||||
|
||||
; Welcome page
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
; License page
|
||||
!insertmacro MUI_PAGE_LICENSE "..\..\admin-root\gpl-license.txt"
|
||||
; Directory page
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
; Instfiles page
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
; Finish page
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
; Uninstaller pages
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
; Language files
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
; MUI end ------
|
||||
|
||||
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
||||
OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}.exe"
|
||||
InstallDir "$PROGRAMFILES\mt-daapd"
|
||||
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
|
||||
ShowInstDetails show
|
||||
ShowUnInstDetails show
|
||||
|
||||
Section "MainSection" SEC01
|
||||
SetOutPath "$INSTDIR"
|
||||
SetOverwrite ifnewer
|
||||
File "..\Release\mt-daapd.exe"
|
||||
File "..\..\..\win32\dll\gnu_regex.dll"
|
||||
File "..\..\..\win32\dll\pthreadVC2.dll"
|
||||
File "..\..\..\win32\dll\sqlite.dll"
|
||||
File "..\..\..\win32\dll\zlib.dll"
|
||||
|
||||
SetOutPath "$INSTDIR\admin-root"
|
||||
File "..\..\admin-root\thanks.html"
|
||||
File "..\..\admin-root\status.html"
|
||||
File "..\..\admin-root\smartpopup.html"
|
||||
File "..\..\admin-root\smart.js"
|
||||
File "..\..\admin-root\smart.html"
|
||||
File "..\..\admin-root\required.gif"
|
||||
File "..\..\admin-root\playlist.js"
|
||||
File "..\..\admin-root\playlist.html"
|
||||
File "..\..\admin-root\mt-daapd.png"
|
||||
File "..\..\admin-root\mt-daapd.js"
|
||||
File "..\..\admin-root\mt-daapd.css"
|
||||
File "..\..\admin-root\linkTransparent.gif"
|
||||
File "..\..\admin-root\linkOpaque.gif"
|
||||
File "..\..\admin-root\index.html"
|
||||
File "..\..\admin-root\hdr.html"
|
||||
File "..\..\admin-root\gpl-license.txt"
|
||||
File "..\..\admin-root\gpl-license.html"
|
||||
File "..\..\admin-root\ftr.html"
|
||||
File "..\..\admin-root\feedback.html"
|
||||
File "..\..\admin-root\favicon.ico"
|
||||
File "..\..\admin-root\DAAPApplet-0.1.jar"
|
||||
File "..\..\admin-root\CREDITS"
|
||||
File "..\..\admin-root\config-update.html"
|
||||
File "..\..\admin-root\config.html"
|
||||
File "..\..\admin-root\aspl-license.txt"
|
||||
File "..\..\admin-root\aspl-license.html"
|
||||
File "..\..\admin-root\applet.html"
|
||||
SetOutPath "$INSTDIR"
|
||||
File "mt-daapd-example.conf"
|
||||
SetOverwrite off
|
||||
CopyFiles "$INSTDIR\mt-daapd-example.conf" "$INSTDIR\mt-daapd.conf"
|
||||
SectionEnd
|
||||
|
||||
Section -AdditionalIcons
|
||||
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
|
||||
CreateDirectory "$SMPROGRAMS\mt-daapd"
|
||||
CreateShortCut "$SMPROGRAMS\mt-daapd\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
|
||||
CreateShortCut "$SMPROGRAMS\mt-daapd\Uninstall.lnk" "$INSTDIR\uninst.exe"
|
||||
CreateShortCut "$SMPROGRAMS\mt-daapd\Debug Mode.lnk" "$INSTDIR\mt-daapd.exe" "-d9 -f"
|
||||
CreateShortCut "$SMPROGRAMS\mt-daapd\Config File.lnk" "notepad.exe" "$INSTDIR\mt-daapd.conf"
|
||||
SectionEnd
|
||||
|
||||
Section -Post
|
||||
WriteUninstaller "$INSTDIR\uninst.exe"
|
||||
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\mt-daapd.exe"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\mt-daapd.exe"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
|
||||
ExecWait "$INSTDIR\mt-daapd.exe -i"
|
||||
; !insertmacro SERVICE "create" "${PRODUCT_SERVICE}" "path=$INSTDIR\mt-daapd.exe;autostart=1;interact=0;shortname=mt-daapd;"
|
||||
SectionEnd
|
||||
|
||||
|
||||
Function un.onUninstSuccess
|
||||
HideWindow
|
||||
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
|
||||
FunctionEnd
|
||||
|
||||
Function un.onInit
|
||||
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
||||
Section Uninstall
|
||||
; !undef UN
|
||||
; !define UN "un."
|
||||
; !insertmacro SERVICE "running" "${PRODUCT_SERVICE}" ""
|
||||
; IntCmp $0 0 lbl_check_install
|
||||
; !insertmacro SERVICE "stop" "${PRODUCT_SERVICE}" ""
|
||||
|
||||
; lbl_check_install:
|
||||
; !insertmacro SERVICE "installed" "${PRODUCT_SERVICE}" ""
|
||||
; IntCmp $0 0 lbl_svc_done
|
||||
; !insertmacro SERVICE "uninstall" "${PRODUCT_SERVICE}" ""
|
||||
|
||||
; lbl_svc_done:
|
||||
|
||||
ExecWait "net stop mt-daapd"
|
||||
ExecWait "$INSTDIR\mt-daapd.exe -u"
|
||||
Delete "$INSTDIR\${PRODUCT_NAME}.url"
|
||||
Delete "$INSTDIR\uninst.exe"
|
||||
Delete "$INSTDIR\gnu_regex.dll"
|
||||
Delete "$INSTDIR\pthreadVC2.dll"
|
||||
Delete "$INSTDIR\sqlite.dll"
|
||||
Delete "$INSTDIR\zlib.dll"
|
||||
Delete "$INSTDIR\mt-daapd-example.conf"
|
||||
Delete "$INSTDIR/admin-root\applet.html"
|
||||
Delete "$INSTDIR/admin-root\aspl-license.html"
|
||||
Delete "$INSTDIR/admin-root\aspl-license.txt"
|
||||
Delete "$INSTDIR/admin-root\config.html"
|
||||
Delete "$INSTDIR/admin-root\config-update.html"
|
||||
Delete "$INSTDIR/admin-root\CREDITS"
|
||||
Delete "$INSTDIR/admin-root\DAAPApplet-0.1.jar"
|
||||
Delete "$INSTDIR/admin-root\favicon.ico"
|
||||
Delete "$INSTDIR/admin-root\feedback.html"
|
||||
Delete "$INSTDIR/admin-root\ftr.html"
|
||||
Delete "$INSTDIR/admin-root\gpl-license.html"
|
||||
Delete "$INSTDIR/admin-root\gpl-license.txt"
|
||||
Delete "$INSTDIR/admin-root\hdr.html"
|
||||
Delete "$INSTDIR/admin-root\index.html"
|
||||
Delete "$INSTDIR/admin-root\linkOpaque.gif"
|
||||
Delete "$INSTDIR/admin-root\linkTransparent.gif"
|
||||
Delete "$INSTDIR/admin-root\mt-daapd.css"
|
||||
Delete "$INSTDIR/admin-root\mt-daapd.js"
|
||||
Delete "$INSTDIR/admin-root\mt-daapd.png"
|
||||
Delete "$INSTDIR/admin-root\playlist.html"
|
||||
Delete "$INSTDIR/admin-root\playlist.js"
|
||||
Delete "$INSTDIR/admin-root\required.gif"
|
||||
Delete "$INSTDIR/admin-root\smart.html"
|
||||
Delete "$INSTDIR/admin-root\smart.js"
|
||||
Delete "$INSTDIR/admin-root\smartpopup.html"
|
||||
Delete "$INSTDIR/admin-root\status.html"
|
||||
Delete "$INSTDIR/admin-root\thanks.html"
|
||||
Delete "$INSTDIR\mt-daapd.exe"
|
||||
|
||||
Delete "$SMPROGRAMS\mt-daapd\Uninstall.lnk"
|
||||
Delete "$SMPROGRAMS\mt-daapd\Website.lnk"
|
||||
Delete "$SMPROGRAMS\mt-daapd\Config File.lnk"
|
||||
Delete "$SMPROGRAMS\mt-daapd\Debug Mode.lnk"
|
||||
|
||||
RMDir "$SMPROGRAMS\mt-daapd"
|
||||
RMDir "$INSTDIR/admin-root"
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
|
||||
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
|
||||
SetAutoClose true
|
||||
SectionEnd
|
||||
348
win32/nsi/servicelib.nsh
Normal file
348
win32/nsi/servicelib.nsh
Normal file
@@ -0,0 +1,348 @@
|
||||
; NSIS SERVICE LIBRARY - servicelib.nsh
|
||||
; Version 1.3 - January 5th, 2006
|
||||
; Questions/Comments - dselkirk@hotmail.com
|
||||
;
|
||||
; Description:
|
||||
; Provides an interface to window services
|
||||
;
|
||||
; Inputs:
|
||||
; action - systemlib action ie. create, delete, start, stop, pause,
|
||||
; continue, installed, running, status
|
||||
; name - name of service to manipulate
|
||||
; param - action parameters; usage: var1=value1;var2=value2;...etc.
|
||||
; (don't forget to add a ';' after the last value!)
|
||||
;
|
||||
; Actions:
|
||||
; create - creates a new windows service
|
||||
; Parameters:
|
||||
; path - path to service executable
|
||||
; autostart - automatically start with system ie. 1|0
|
||||
; interact - interact with the desktop ie. 1|0
|
||||
; machine - machine name where to install service
|
||||
; user - user that runs the service
|
||||
; password - password of the above user
|
||||
;
|
||||
; delete - deletes a windows service
|
||||
; start - start a stopped windows service
|
||||
; stop - stops a running windows service
|
||||
; pause - pauses a running windows service
|
||||
; continue - continues a paused windows service
|
||||
; installed - is the provided service installed
|
||||
; Parameters:
|
||||
; action - if true then invokes the specified action
|
||||
; running - is the provided service running
|
||||
; Parameters:
|
||||
; action - if true then invokes the specified action
|
||||
; status - check the status of the provided service
|
||||
;
|
||||
; If run from uninstall define "UN" as "un." gefore running.
|
||||
;
|
||||
; Usage:
|
||||
; Method 1:
|
||||
; Push "action"
|
||||
; Push "name"
|
||||
; Push "param"
|
||||
; Call Service
|
||||
; Pop $0 ;response
|
||||
;
|
||||
; Method 2:
|
||||
; !insertmacro SERVICE "action" "name" "param"
|
||||
;
|
||||
; History:
|
||||
; 1.0 - 09/15/2003 - Initial release
|
||||
; 1.1 - 09/16/2003 - Changed &l to i, thx brainsucker
|
||||
; 1.2 - 02/29/2004 - Fixed documentation.
|
||||
|
||||
!ifndef SERVICELIB
|
||||
!define SERVICELIB
|
||||
|
||||
!define SC_MANAGER_ALL_ACCESS 0x3F
|
||||
!define SERVICE_ALL_ACCESS 0xF01FF
|
||||
|
||||
!define SERVICE_CONTROL_STOP 1
|
||||
!define SERVICE_CONTROL_PAUSE 2
|
||||
!define SERVICE_CONTROL_CONTINUE 3
|
||||
|
||||
!define SERVICE_STOPPED 0x1
|
||||
!define SERVICE_START_PENDING 0x2
|
||||
!define SERVICE_STOP_PENDING 0x3
|
||||
!define SERVICE_RUNNING 0x4
|
||||
!define SERVICE_CONTINUE_PENDING 0x5
|
||||
!define SERVICE_PAUSE_PENDING 0x6
|
||||
!define SERVICE_PAUSED 0x7
|
||||
|
||||
!ifndef UN
|
||||
!define UN ""
|
||||
!endif
|
||||
|
||||
!macro SERVICE ACTION NAME PARAM
|
||||
Push '${ACTION}'
|
||||
Push '${NAME}'
|
||||
Push '${PARAM}'
|
||||
Call ${UN}Service
|
||||
!macroend
|
||||
|
||||
!macro FUNC_GETPARAM
|
||||
Push $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
Push $5
|
||||
Push $6
|
||||
Push $7
|
||||
Exch 8
|
||||
Pop $1 ;name
|
||||
Exch 8
|
||||
Pop $2 ;source
|
||||
StrCpy $0 ""
|
||||
StrLen $7 $2
|
||||
StrCpy $3 0
|
||||
lbl_loop:
|
||||
IntCmp $3 $7 0 0 lbl_done
|
||||
StrLen $4 "$1="
|
||||
StrCpy $5 $2 $4 $3
|
||||
StrCmp $5 "$1=" 0 lbl_next
|
||||
IntOp $5 $3 + $4
|
||||
StrCpy $3 $5
|
||||
lbl_loop2:
|
||||
IntCmp $3 $7 0 0 lbl_done
|
||||
StrCpy $6 $2 1 $3
|
||||
StrCmp $6 ";" 0 lbl_next2
|
||||
IntOp $6 $3 - $5
|
||||
StrCpy $0 $2 $6 $5
|
||||
Goto lbl_done
|
||||
lbl_next2:
|
||||
IntOp $3 $3 + 1
|
||||
Goto lbl_loop2
|
||||
lbl_next:
|
||||
IntOp $3 $3 + 1
|
||||
Goto lbl_loop
|
||||
lbl_done:
|
||||
Pop $5
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Exch 2
|
||||
Pop $6
|
||||
Pop $7
|
||||
Exch $0
|
||||
!macroend
|
||||
|
||||
!macro CALL_GETPARAM VAR NAME DEFAULT LABEL
|
||||
Push $1
|
||||
Push ${NAME}
|
||||
Call ${UN}GETPARAM
|
||||
Pop $6
|
||||
StrCpy ${VAR} "${DEFAULT}"
|
||||
StrCmp $6 "" "${LABEL}" 0
|
||||
StrCpy ${VAR} $6
|
||||
!macroend
|
||||
|
||||
!macro FUNC_SERVICE UN
|
||||
Push $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
Push $5
|
||||
Push $6
|
||||
Push $7
|
||||
Exch 8
|
||||
Pop $1 ;param
|
||||
Exch 8
|
||||
Pop $2 ;name
|
||||
Exch 8
|
||||
Pop $3 ;action
|
||||
;$0 return
|
||||
;$4 OpenSCManager
|
||||
;$5 OpenService
|
||||
|
||||
|
||||
StrCpy $0 "false"
|
||||
System::Call 'advapi32::OpenSCManagerA(n, n, i ${SC_MANAGER_ALL_ACCESS}) i.r4'
|
||||
IntCmp $4 0 lbl_done
|
||||
StrCmp $3 "create" lbl_create
|
||||
System::Call 'advapi32::OpenServiceA(i r4, t r2, i ${SERVICE_ALL_ACCESS}) i.r5'
|
||||
IntCmp $5 0 lbl_done
|
||||
|
||||
lbl_select:
|
||||
StrCmp $3 "delete" lbl_delete
|
||||
StrCmp $3 "start" lbl_start
|
||||
StrCmp $3 "stop" lbl_stop
|
||||
StrCmp $3 "pause" lbl_pause
|
||||
StrCmp $3 "continue" lbl_continue
|
||||
StrCmp $3 "installed" lbl_installed
|
||||
StrCmp $3 "running" lbl_running
|
||||
StrCmp $3 "status" lbl_status
|
||||
Goto lbl_done
|
||||
|
||||
; create service
|
||||
lbl_create:
|
||||
Push $R1 ;machine
|
||||
Push $R2 ;user
|
||||
Push $R3 ;password
|
||||
Push $R4 ;interact
|
||||
Push $R5 ;autostart
|
||||
Push $R6 ;path
|
||||
Push $R7 ;shortname
|
||||
|
||||
!insertmacro CALL_GETPARAM $R1 "machine" "n" "lbl_machine"
|
||||
lbl_machine:
|
||||
|
||||
!insertmacro CALL_GETPARAM $R2 "user" "n" "lbl_user"
|
||||
lbl_user:
|
||||
|
||||
!insertmacro CALL_GETPARAM $R3 "password" "n" "lbl_password"
|
||||
lbl_password:
|
||||
|
||||
!insertmacro CALL_GETPARAM $R4 "interact" "0x10" "lbl_interact"
|
||||
StrCpy $6 0x10
|
||||
IntCmp $R4 0 +2
|
||||
IntOp $6 $6 | 0x100
|
||||
StrCpy $R4 $6
|
||||
lbl_interact:
|
||||
|
||||
!insertmacro CALL_GETPARAM $R5 "autostart" "0x3" "lbl_autostart"
|
||||
StrCpy $6 0x3
|
||||
IntCmp $R5 0 +2
|
||||
StrCpy $6 0x2
|
||||
StrCpy $R5 $6
|
||||
lbl_autostart:
|
||||
|
||||
!insertmacro CALL_GETPARAM $R6 "path" "n" "lbl_path"
|
||||
lbl_path:
|
||||
|
||||
!insertmacro CALL_GETPARAM $R7 "shortname" r2 "lbl_shortname"
|
||||
lbl_shortname:
|
||||
|
||||
System::Call 'advapi32::CreateServiceA(i r4, t r7, t r2, i ${SERVICE_ALL_ACCESS}, \
|
||||
i R4, i R5, i 0, t R6, n, n, R1, R2, R3) i.r6'
|
||||
Pop $R7
|
||||
Pop $R6
|
||||
Pop $R5
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
StrCmp $6 0 lbl_done lbl_good
|
||||
|
||||
; delete service
|
||||
lbl_delete:
|
||||
System::Call 'advapi32::DeleteService(i r5) i.r6'
|
||||
StrCmp $6 0 lbl_done lbl_good
|
||||
|
||||
; start service
|
||||
lbl_start:
|
||||
System::Call 'advapi32::StartServiceA(i r5, i 0, i 0) i.r6'
|
||||
StrCmp $6 0 lbl_done lbl_good
|
||||
|
||||
; stop service
|
||||
lbl_stop:
|
||||
Push $R1
|
||||
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
||||
System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_STOP}, i $R1) i'
|
||||
System::Free $R1
|
||||
Pop $R1
|
||||
StrCmp $6 0 lbl_done lbl_good
|
||||
|
||||
; pause service
|
||||
lbl_pause:
|
||||
Push $R1
|
||||
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
||||
System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_PAUSE}, i $R1) i'
|
||||
System::Free $R1
|
||||
Pop $R1
|
||||
StrCmp $6 0 lbl_done lbl_good
|
||||
|
||||
; continue service
|
||||
lbl_continue:
|
||||
Push $R1
|
||||
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
||||
System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_CONTINUE}, i $R1) i'
|
||||
System::Free $R1
|
||||
Pop $R1
|
||||
StrCmp $6 0 lbl_done lbl_good
|
||||
|
||||
; is installed
|
||||
lbl_installed:
|
||||
!insertmacro CALL_GETPARAM $7 "action" "" "lbl_good"
|
||||
StrCpy $3 $7
|
||||
Goto lbl_select
|
||||
|
||||
; is service running
|
||||
lbl_running:
|
||||
Push $R1
|
||||
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
||||
System::Call 'advapi32::QueryServiceStatus(i r5, i $R1) i'
|
||||
System::Call '*$R1(i, i.r6)'
|
||||
System::Free $R1
|
||||
Pop $R1
|
||||
IntFmt $6 "0x%X" $6
|
||||
StrCmp $6 ${SERVICE_RUNNING} 0 lbl_done
|
||||
!insertmacro CALL_GETPARAM $7 "action" "" "lbl_good"
|
||||
StrCpy $3 $7
|
||||
Goto lbl_select
|
||||
|
||||
lbl_status:
|
||||
Push $R1
|
||||
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
||||
System::Call 'advapi32::QueryServiceStatus(i r5, i $R1) i'
|
||||
System::Call '*$R1(i, i .r6)'
|
||||
System::Free $R1
|
||||
Pop $R1
|
||||
IntFmt $6 "0x%X" $6
|
||||
StrCpy $0 "running"
|
||||
IntCmp $6 ${SERVICE_RUNNING} lbl_done
|
||||
StrCpy $0 "stopped"
|
||||
IntCmp $6 ${SERVICE_STOPPED} lbl_done
|
||||
StrCpy $0 "start_pending"
|
||||
IntCmp $6 ${SERVICE_START_PENDING} lbl_done
|
||||
StrCpy $0 "stop_pending"
|
||||
IntCmp $6 ${SERVICE_STOP_PENDING} lbl_done
|
||||
StrCpy $0 "running"
|
||||
IntCmp $6 ${SERVICE_RUNNING} lbl_done
|
||||
StrCpy $0 "continue_pending"
|
||||
IntCmp $6 ${SERVICE_CONTINUE_PENDING} lbl_done
|
||||
StrCpy $0 "pause_pending"
|
||||
IntCmp $6 ${SERVICE_PAUSE_PENDING} lbl_done
|
||||
StrCpy $0 "paused"
|
||||
IntCmp $6 ${SERVICE_PAUSED} lbl_done
|
||||
StrCpy $0 "unknown"
|
||||
|
||||
lbl_good:
|
||||
StrCpy $0 "true"
|
||||
lbl_done:
|
||||
IntCmp $5 0 +2
|
||||
System::Call 'advapi32::CloseServiceHandle(i r5) n'
|
||||
IntCmp $4 0 +2
|
||||
System::Call 'advapi32::CloseServiceHandle(i r4) n'
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Exch 3
|
||||
Pop $5
|
||||
Pop $7
|
||||
Pop $6
|
||||
Exch $0
|
||||
!macroend
|
||||
|
||||
Function Service
|
||||
!insertmacro FUNC_SERVICE ""
|
||||
FunctionEnd
|
||||
|
||||
Function un.Service
|
||||
!insertmacro FUNC_SERVICE "un."
|
||||
FunctionEnd
|
||||
|
||||
Function GetParam
|
||||
!insertmacro FUNC_GETPARAM
|
||||
FunctionEnd
|
||||
|
||||
Function un.GetParam
|
||||
!insertmacro FUNC_GETPARAM
|
||||
FunctionEnd
|
||||
|
||||
!endif
|
||||
Reference in New Issue
Block a user