rhodes 3.2.0.beta.5 → 3.2.0.beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/Manifest.txt +10 -1
- data/Rakefile +6 -0
- data/bin/get-rhodes-info +4 -27
- data/bin/set-rhodes-sdk +4 -1
- data/doc/build.txt +12 -3
- data/doc/extensions.txt +26 -0
- data/installer/Rakefile +156 -0
- data/installer/ServiceLib.nsh +369 -0
- data/installer/jake.rb +478 -0
- data/installer/rhostudio.nsi +76 -143
- data/lib/extensions/digest-sha1/ext/Rakefile +58 -40
- data/lib/extensions/fileutils/fileutils.rb +3 -2
- data/lib/extensions/hmac/hmac-md5.rb +11 -0
- data/lib/extensions/hmac/hmac-rmd160.rb +11 -0
- data/lib/extensions/hmac/hmac-sha1.rb +11 -0
- data/lib/extensions/hmac/hmac-sha2.rb +25 -0
- data/lib/extensions/hmac/hmac.rb +118 -0
- data/lib/extensions/hmac/ruby_hmac.rb +2 -0
- data/lib/extensions/net-http/net/http.rb +1 -1
- data/lib/framework/rho/render.rb +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +1 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +52 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +8 -15
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +4 -5
- data/platform/android/build/android.rake +3 -1
- data/platform/iphone/rbuild/iphone.rake +7 -7
- data/platform/shared/common/RhodesApp.cpp +18 -14
- data/platform/shared/common/RhodesApp.h +1 -0
- data/platform/shared/rubyext/System.cpp +3 -0
- data/platform/symbian/build/symbian.rake +13 -5
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +9 -1
- data/rakefile.rb +6 -0
- data/res/generators/templates/application/Rakefile +10 -1
- data/res/generators/templates/application/app/layout.erb +1 -1
- data/res/generators/templates/application/build.yml +2 -2
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile.iphone.css → jquery-mobile-iphone.css} +0 -0
- data/res/generators/templates/application/public/js/jqmobile-patch.js +23 -20
- data/spec/framework_spec/app/spec/library/digest/sha1/file_spec.rb +3 -3
- data/spec/framework_spec/app/spec/library/net/http/http/Proxy_spec.rb +3 -2
- data/spec/framework_spec/app/spec/library/net/http/http/copy_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/delete_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/finish_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/fixtures/http_server.rb +18 -12
- data/spec/framework_spec/app/spec/library/net/http/http/get_print_spec.rb +2 -2
- data/spec/framework_spec/app/spec/library/net/http/http/get_response_spec.rb +2 -2
- data/spec/framework_spec/app/spec/library/net/http/http/get_spec.rb +3 -3
- data/spec/framework_spec/app/spec/library/net/http/http/head_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/initialize_spec.rb +2 -2
- data/spec/framework_spec/app/spec/library/net/http/http/inspect_spec.rb +4 -4
- data/spec/framework_spec/app/spec/library/net/http/http/lock_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/mkcol_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/move_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/new_spec.rb +7 -7
- data/spec/framework_spec/app/spec/library/net/http/http/newobj_spec.rb +2 -2
- data/spec/framework_spec/app/spec/library/net/http/http/options_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/port_spec.rb +2 -2
- data/spec/framework_spec/app/spec/library/net/http/http/post_form_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/post_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/propfind_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/proppatch_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/proxy_address_spec.rb +2 -2
- data/spec/framework_spec/app/spec/library/net/http/http/proxy_pass_spec.rb +3 -3
- data/spec/framework_spec/app/spec/library/net/http/http/proxy_port_spec.rb +3 -3
- data/spec/framework_spec/app/spec/library/net/http/http/proxy_user_spec.rb +3 -3
- data/spec/framework_spec/app/spec/library/net/http/http/put_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/request_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/send_request_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/set_debug_output_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/shared/request_get.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/shared/request_head.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/shared/request_post.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/shared/request_put.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/shared/started.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/start_spec.rb +8 -8
- data/spec/framework_spec/app/spec/library/net/http/http/trace_spec.rb +1 -1
- data/spec/framework_spec/app/spec/library/net/http/http/unlock_spec.rb +1 -1
- data/spec/framework_spec/app/spec_runner.rb +1 -1
- data/spec/framework_spec/build.yml +2 -2
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +43 -2
- data/version +1 -1
- metadata +14 -5
data/CHANGELOG
CHANGED
@@ -7,6 +7,9 @@
|
|
7
7
|
* RhoSimulator for OSX Lion
|
8
8
|
* iOS 5 support
|
9
9
|
* Fix Symbian emulator build
|
10
|
+
* Make sdk in application build.yml optional, use latest Rhodes by default
|
11
|
+
* Add hmac ruby extension
|
12
|
+
* Symbian: build unsigned sis-file
|
10
13
|
|
11
14
|
## 3.1
|
12
15
|
* Symbian support(Beta)
|
data/Manifest.txt
CHANGED
@@ -46,11 +46,14 @@ ext/extconf.rb
|
|
46
46
|
installer/EnvVarUpdate.nsh
|
47
47
|
installer/icon.ico
|
48
48
|
installer/instant-rhodes.nsi
|
49
|
+
installer/jake.rb
|
49
50
|
installer/OLD-README.html
|
51
|
+
installer/Rakefile
|
50
52
|
installer/README.html
|
51
53
|
installer/RHOSTUDIO-LICENSE.txt
|
52
54
|
installer/rhostudio.nsi
|
53
55
|
installer/RHOSYNC-LICENSE.txt
|
56
|
+
installer/ServiceLib.nsh
|
54
57
|
lib/build/compileERB/bb.rb
|
55
58
|
lib/build/compileERB/default.rb
|
56
59
|
lib/build/compileRB/compileRB.rb
|
@@ -533,6 +536,12 @@ lib/extensions/fcntl/ext/fcntl.vcproj
|
|
533
536
|
lib/extensions/fcntl/ext/Rakefile
|
534
537
|
lib/extensions/fcntl/ext.yml
|
535
538
|
lib/extensions/fileutils/fileutils.rb
|
539
|
+
lib/extensions/hmac/hmac-md5.rb
|
540
|
+
lib/extensions/hmac/hmac-rmd160.rb
|
541
|
+
lib/extensions/hmac/hmac-sha1.rb
|
542
|
+
lib/extensions/hmac/hmac-sha2.rb
|
543
|
+
lib/extensions/hmac/hmac.rb
|
544
|
+
lib/extensions/hmac/ruby_hmac.rb
|
536
545
|
lib/extensions/json/json/common.rb
|
537
546
|
lib/extensions/json/json/pure/generator.rb
|
538
547
|
lib/extensions/json/json/pure.rb
|
@@ -4682,11 +4691,11 @@ res/generators/templates/application/public/jqmobile/images/icons-18-black.png
|
|
4682
4691
|
res/generators/templates/application/public/jqmobile/images/icons-18-white.png
|
4683
4692
|
res/generators/templates/application/public/jqmobile/images/icons-36-black.png
|
4684
4693
|
res/generators/templates/application/public/jqmobile/images/icons-36-white.png
|
4694
|
+
res/generators/templates/application/public/jqmobile/jquery-mobile-iphone.css
|
4685
4695
|
res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.css
|
4686
4696
|
res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.js
|
4687
4697
|
res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.min.css
|
4688
4698
|
res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.min.js
|
4689
|
-
res/generators/templates/application/public/jqmobile/jquery.mobile.iphone.css
|
4690
4699
|
res/generators/templates/application/public/jquery/jquery-1.6.4.js
|
4691
4700
|
res/generators/templates/application/public/jquery/jquery-1.6.4.min.js
|
4692
4701
|
res/generators/templates/application/public/js/application.js
|
data/Rakefile
CHANGED
@@ -1098,6 +1098,12 @@ namespace "run" do
|
|
1098
1098
|
$appname = $app_config["name"].nil? ? "Rhodes" : $app_config["name"]
|
1099
1099
|
if !File.exists?($path)
|
1100
1100
|
puts "Cannot find RhoSimulator: '#{$path}' does not exists"
|
1101
|
+
puts "Check sdk path in build.yml - it should point to latest rhodes (run set-rhodes-sdk in application folder) OR"
|
1102
|
+
|
1103
|
+
if $config['env']['paths']['rhosimulator'] and $config['env']['paths']['rhosimulator'].length() > 0
|
1104
|
+
puts "Check 'env:paths:rhosimulator' path in '<rhodes>/rhobuild.yml' OR"
|
1105
|
+
end
|
1106
|
+
|
1101
1107
|
puts "Install Rhodes gem OR"
|
1102
1108
|
puts "Install RhoSimulator and modify 'env:paths:rhosimulator' section in '<rhodes>/rhobuild.yml'"
|
1103
1109
|
exit 1
|
data/bin/get-rhodes-info
CHANGED
@@ -1,34 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'rhodes')
|
7
|
-
|
8
|
-
# Stub this method to force 1.8 compatibility (come on templater!)
|
9
|
-
class Encoding
|
10
|
-
def find
|
11
|
-
"utf-8"
|
12
|
-
end
|
13
|
-
|
14
|
-
def dummy?
|
15
|
-
false
|
16
|
-
end
|
3
|
+
if ARGV && ARGV.size > 0 && ARGV[0] == "--rhodes-path"
|
4
|
+
puts File.dirname(__FILE__)
|
5
|
+
exit(0)
|
17
6
|
end
|
18
7
|
|
19
|
-
|
20
|
-
def force_encoding(enc)
|
21
|
-
return self
|
22
|
-
end
|
23
|
-
|
24
|
-
def encoding
|
25
|
-
if RUBY_VERSION =~ /1\.8/ and Encoding.responds_to?('new')
|
26
|
-
Encoding.new
|
27
|
-
else
|
28
|
-
Encoding.default_external
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
8
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'rhodes')
|
32
9
|
|
33
10
|
params = ["--rhodes-ver"]
|
34
11
|
|
data/bin/set-rhodes-sdk
CHANGED
@@ -9,10 +9,13 @@ if File.exists? "build.yml"
|
|
9
9
|
$app_config = YAML::load_file("build.yml")
|
10
10
|
|
11
11
|
unless $app_config["sdk"].nil?
|
12
|
-
$app_config["sdk"] =
|
12
|
+
$app_config["sdk"] = nil
|
13
13
|
|
14
14
|
File.open( 'build.yml', 'w' ) do |out|
|
15
15
|
YAML.dump( $app_config, out )
|
16
16
|
end
|
17
|
+
|
18
|
+
rakefilepath = File.join( File.dirname(`get-rhodes-info --rhodes-path`), 'res/generators/templates/application/Rakefile' )
|
19
|
+
cp rakefilepath, '.'
|
17
20
|
end
|
18
21
|
end
|
data/doc/build.txt
CHANGED
@@ -46,17 +46,23 @@ You don't have to do it if you cloned sources, but if you want to build a Rhodes
|
|
46
46
|
|
47
47
|
## Setting Up build.yml
|
48
48
|
|
49
|
-
|
49
|
+
By default application use latest Rhodes gem installed on computer.
|
50
|
+
|
51
|
+
If you wish to use special version of Rhodes or use Rhodes git sources :
|
50
52
|
|
51
53
|
:::term
|
52
54
|
sdk: /Library/Ruby/Gems/1.8/gems/rhodes-3.0.2
|
55
|
+
|
56
|
+
OR for Rhodes sources:
|
57
|
+
|
58
|
+
sdk: ~/Projects/rhodes
|
53
59
|
|
54
|
-
|
60
|
+
After installing new Rhodes gem(3.2.x over any version less then 3.2.x), you can also open a command line window, navigate to the directory of your Rhodes application, and run the following command:
|
55
61
|
|
56
62
|
:::term
|
57
63
|
$ set-rhodes-sdk
|
58
64
|
|
59
|
-
The set-rhodes-sdk command will
|
65
|
+
The set-rhodes-sdk command will remove sdk line from your build.yml to use latest Rhodes gem, it also upgrade application Rakefile.
|
60
66
|
|
61
67
|
## Building a Rhodes Application for iPhone/iPad
|
62
68
|
|
@@ -709,6 +715,9 @@ Add pathes to Qt SDK and MS Visual Studio 2005 to rhobuild.yml in the Rhodes fol
|
|
709
715
|
|
710
716
|
:::term
|
711
717
|
$ rake device:symbian:production
|
718
|
+
|
719
|
+
NOTE: This command creates two sis-files: signed for testing and unsigned for production signing. See <app_root>/bin/target/sym folder for sis-files.
|
720
|
+
|
712
721
|
|
713
722
|
### To clean all binaries run:
|
714
723
|
|
data/doc/extensions.txt
CHANGED
@@ -194,6 +194,32 @@ Add to build.yml:
|
|
194
194
|
|
195
195
|
See details [here](device-caps#barcode).
|
196
196
|
|
197
|
+
### net/http
|
198
|
+
|
199
|
+
Add to build.yml:
|
200
|
+
|
201
|
+
extensions: ["net-http", "thread", "timeout", "uri"]
|
202
|
+
|
203
|
+
### hmac
|
204
|
+
|
205
|
+
Add to build.yml:
|
206
|
+
|
207
|
+
extensions: ["hmac", "digest", "digest-sha1"]
|
208
|
+
|
209
|
+
Example:
|
210
|
+
:::ruby
|
211
|
+
require 'base64'
|
212
|
+
require 'hmac-sha1'
|
213
|
+
|
214
|
+
def test_hmac
|
215
|
+
key = '1234'
|
216
|
+
signature = 'abcdef'
|
217
|
+
hmac = HMAC::SHA1.new(key)
|
218
|
+
hmac.update(signature)
|
219
|
+
|
220
|
+
puts Rho::RhoSupport.url_encode(Base64.encode64("#{hmac.digest}\n"))
|
221
|
+
end
|
222
|
+
|
197
223
|
### FileUtils
|
198
224
|
|
199
225
|
Add to build.yml:
|
data/installer/Rakefile
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
# rake script
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'jake.rb'
|
6
|
+
|
7
|
+
$majorVer = "1"
|
8
|
+
$minorVer = "2"
|
9
|
+
$miniVer = "0"
|
10
|
+
$betaVer = "7"
|
11
|
+
|
12
|
+
$isRhodesBeta = true
|
13
|
+
$isConnBeta = false
|
14
|
+
$isAdapterBeta = false
|
15
|
+
|
16
|
+
$nsisPath = "C:/Program Files (x86)/NSIS/makensis.exe"
|
17
|
+
$rubyPath = "C:/Android/RhoSync/ruby"
|
18
|
+
$rubyInstallPath = "C:/Android/Installer/ruby"
|
19
|
+
$macImage = "/Users/antonvisnevski/rho/RhoStudioDMG.dmg"
|
20
|
+
$installScript = "rhostudio.nsi"
|
21
|
+
$commonName = "RhoStudioInstaller"
|
22
|
+
$extWinExe = '.exe'
|
23
|
+
$extOsxExe = '.dmg'
|
24
|
+
|
25
|
+
namespace "installer" do
|
26
|
+
|
27
|
+
def renameInstaller(installerPrefix)
|
28
|
+
installerName = ""
|
29
|
+
currTime = Time.now
|
30
|
+
currDate = currTime.strftime("%d%m%Y%H%M")
|
31
|
+
|
32
|
+
if RUBY_PLATFORM =~ /(win|w)32$/
|
33
|
+
# Windows
|
34
|
+
installerName = $commonName + $majorVer.to_s + "." + $minorVer.to_s + "." + $miniVer + installerPrefix + $extWinExe
|
35
|
+
puts 'new installer file name: ' + installerName
|
36
|
+
File.rename($commonName + $extWinExe, installerName)
|
37
|
+
else
|
38
|
+
installerName = $commonName + $majorVer.to_s + "." + $minorVer.to_s + "." + $miniVer + installerPrefix + $extOsxExe
|
39
|
+
puts 'new installer file name: ' + installerName
|
40
|
+
Jake.run2 "hdiutil", ["convert", $macImage, "-format", "UDZO", "-o", installerName], {:nowait => false}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def changeRubyFolder()
|
45
|
+
if RUBY_PLATFORM =~ /(win|w)32$/
|
46
|
+
#copy ruby folder
|
47
|
+
FileUtils.rm_rf $rubyInstallPath
|
48
|
+
FileUtils.cp_r $rubyPath, $rubyInstallPath
|
49
|
+
else
|
50
|
+
return
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def installGems(isRhodesBeta, isConnBeta, isAdapterBeta)
|
55
|
+
if RUBY_PLATFORM =~ /(win|w)32$/
|
56
|
+
else
|
57
|
+
return
|
58
|
+
end
|
59
|
+
|
60
|
+
Jake.run2 "gem", ["uninstall", "rhomobile-debug", "-a"], {:nowait => false}
|
61
|
+
Jake.run2 "gem", ["uninstall", "rhodes", "-a"], {:nowait => false}
|
62
|
+
Jake.run2 "gem", ["uninstall", "rhoconnect", "-a"], {:nowait => false}
|
63
|
+
Jake.run2 "gem", ["uninstall", "rhoconnect-adapters", "-a"], {:nowait => false}
|
64
|
+
|
65
|
+
Jake.run2 "gem", ["install", "rhomobile-debug"], {:nowait => false}
|
66
|
+
|
67
|
+
if isRhodesBeta == false
|
68
|
+
Jake.run2 "gem", ["install", "rhodes"], {:nowait => false}
|
69
|
+
else
|
70
|
+
Jake.run2 "gem", ["install", "rhodes", "--pre"], {:nowait => false}
|
71
|
+
end
|
72
|
+
|
73
|
+
if $isConnBeta == false
|
74
|
+
Jake.run2 "gem", ["install", "rhoconnect"], {:nowait => false}
|
75
|
+
else
|
76
|
+
Jake.run2 "gem", ["install", "rhoconnect", "--pre"], {:nowait => false}
|
77
|
+
end
|
78
|
+
|
79
|
+
if $isAdapterBeta == false
|
80
|
+
Jake.run2 "gem", ["install", "rhoconnect-adapters"], {:nowait => false}
|
81
|
+
else
|
82
|
+
Jake.run2 "gem", ["install", "rhoconnect-adapters", "--pre"], {:nowait => false}
|
83
|
+
end
|
84
|
+
|
85
|
+
changeRubyFolder()
|
86
|
+
end
|
87
|
+
|
88
|
+
def runInstallerScript
|
89
|
+
if RUBY_PLATFORM =~ /(win|w)32$/
|
90
|
+
puts 'start build nsis script: ' + $installScript
|
91
|
+
Jake.run2 $nsisPath, [$installScript], {:nowait => false}
|
92
|
+
else
|
93
|
+
return
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
namespace "release" do
|
98
|
+
task :gems do
|
99
|
+
puts 'release - reinstall gems task'
|
100
|
+
installGems(false, false, false)
|
101
|
+
end
|
102
|
+
|
103
|
+
task :nsis => "gems" do
|
104
|
+
runInstallerScript
|
105
|
+
end
|
106
|
+
|
107
|
+
task :rename => "nsis" do
|
108
|
+
puts 'release - start rename task'
|
109
|
+
renameInstaller("")
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
namespace "beta" do
|
115
|
+
|
116
|
+
task :gems do
|
117
|
+
installGems(true, true, true)
|
118
|
+
end
|
119
|
+
|
120
|
+
task :nsis => "gems" do
|
121
|
+
runInstallerScript
|
122
|
+
end
|
123
|
+
|
124
|
+
task :rename => "nsis" do
|
125
|
+
renameInstaller(".beta" + $betaVer)
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
namespace "user" do
|
131
|
+
task :gems do
|
132
|
+
installGems($isRhodesBeta, $isConnBeta, $isAdapterBeta)
|
133
|
+
end
|
134
|
+
|
135
|
+
task :nsis => "gems" do
|
136
|
+
runInstallerScript
|
137
|
+
end
|
138
|
+
|
139
|
+
task :rename => "nsis" do
|
140
|
+
renameInstaller(".beta" + $betaVer)
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
########################################################
|
146
|
+
|
147
|
+
task :release => "release:rename" do
|
148
|
+
end
|
149
|
+
|
150
|
+
task :beta => "beta:rename" do
|
151
|
+
end
|
152
|
+
|
153
|
+
task :user => "user:rename" do
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
@@ -0,0 +1,369 @@
|
|
1
|
+
; NSIS SERVICE LIBRARY - servicelib.nsh
|
2
|
+
; Version 1.5 - Jun 25th, 2008
|
3
|
+
; Questions/Comments - dselkirk@hotmail.com
|
4
|
+
;
|
5
|
+
; Description:
|
6
|
+
; Provides an interface to window services
|
7
|
+
;
|
8
|
+
; Inputs:
|
9
|
+
; action - systemlib action ie. create, delete, start, stop, pause,
|
10
|
+
; continue, installed, running, status
|
11
|
+
; name - name of service to manipulate
|
12
|
+
; param - action parameters; usage: var1=value1;var2=value2;...etc.
|
13
|
+
; (don't forget to add a ';' after the last value!)
|
14
|
+
;
|
15
|
+
; Actions:
|
16
|
+
; create - creates a new windows service
|
17
|
+
; Parameters:
|
18
|
+
; path - path to service executable
|
19
|
+
; autostart - automatically start with system ie. 1|0
|
20
|
+
; interact - interact with the desktop ie. 1|0
|
21
|
+
; depend - service dependencies
|
22
|
+
; user - user that runs the service
|
23
|
+
; password - password of the above user
|
24
|
+
; display - display name in service's console
|
25
|
+
; description - Description of service
|
26
|
+
;
|
27
|
+
; delete - deletes a windows service
|
28
|
+
; start - start a stopped windows service
|
29
|
+
; stop - stops a running windows service
|
30
|
+
; pause - pauses a running windows service
|
31
|
+
; continue - continues a paused windows service
|
32
|
+
; installed - is the provided service installed
|
33
|
+
; Parameters:
|
34
|
+
; action - if true then invokes the specified action
|
35
|
+
; running - is the provided service running
|
36
|
+
; Parameters:
|
37
|
+
; action - if true then invokes the specified action
|
38
|
+
; status - check the status of the provided service
|
39
|
+
;
|
40
|
+
; If run from uninstall define "UN" as "un." before running.
|
41
|
+
;
|
42
|
+
; Usage:
|
43
|
+
; Method 1:
|
44
|
+
; Push "action"
|
45
|
+
; Push "name"
|
46
|
+
; Push "param"
|
47
|
+
; Call Service
|
48
|
+
; Pop $0 ;response
|
49
|
+
;
|
50
|
+
; Method 2:
|
51
|
+
; !insertmacro SERVICE "action" "name" "param"
|
52
|
+
;
|
53
|
+
; History:
|
54
|
+
; 1.0 - 09/15/2003 - Initial release
|
55
|
+
; 1.1 - 09/16/2003 - Changed &l to i, thx brainsucker
|
56
|
+
; 1.2 - 02/29/2004 - Fixed documentation.
|
57
|
+
; 1.3 - 01/05/2006 - Fixed interactive flag and pop order (Kichik)
|
58
|
+
; 1.4 - 12/07/2006 - Added display and depend, fixed datatypes (Vitoco)
|
59
|
+
; 1.5 - 06/25/2008 - Added description of service.(DeSafe.com/liuqixing#gmail.com)
|
60
|
+
|
61
|
+
!ifndef SERVICELIB
|
62
|
+
!define SERVICELIB
|
63
|
+
|
64
|
+
!define SC_MANAGER_ALL_ACCESS 0x3F
|
65
|
+
!define SERVICE_ALL_ACCESS 0xF01FF
|
66
|
+
|
67
|
+
!define SERVICE_CONTROL_STOP 1
|
68
|
+
!define SERVICE_CONTROL_PAUSE 2
|
69
|
+
!define SERVICE_CONTROL_CONTINUE 3
|
70
|
+
|
71
|
+
!define SERVICE_STOPPED 0x1
|
72
|
+
!define SERVICE_START_PENDING 0x2
|
73
|
+
!define SERVICE_STOP_PENDING 0x3
|
74
|
+
!define SERVICE_RUNNING 0x4
|
75
|
+
!define SERVICE_CONTINUE_PENDING 0x5
|
76
|
+
!define SERVICE_PAUSE_PENDING 0x6
|
77
|
+
!define SERVICE_PAUSED 0x7
|
78
|
+
|
79
|
+
!ifndef UN
|
80
|
+
!define UN ""
|
81
|
+
!endif
|
82
|
+
|
83
|
+
!macro SERVICE ACTION NAME PARAM
|
84
|
+
Push '${ACTION}'
|
85
|
+
Push '${NAME}'
|
86
|
+
Push '${PARAM}'
|
87
|
+
Call ${UN}Service
|
88
|
+
!macroend
|
89
|
+
|
90
|
+
!macro FUNC_GETPARAM
|
91
|
+
Push $0
|
92
|
+
Push $1
|
93
|
+
Push $2
|
94
|
+
Push $3
|
95
|
+
Push $4
|
96
|
+
Push $5
|
97
|
+
Push $6
|
98
|
+
Push $7
|
99
|
+
Exch 8
|
100
|
+
Pop $1 ;name
|
101
|
+
Exch 8
|
102
|
+
Pop $2 ;source
|
103
|
+
StrCpy $0 ""
|
104
|
+
StrLen $7 $2
|
105
|
+
StrCpy $3 0
|
106
|
+
lbl_loop:
|
107
|
+
IntCmp $3 $7 0 0 lbl_done
|
108
|
+
StrLen $4 "$1="
|
109
|
+
StrCpy $5 $2 $4 $3
|
110
|
+
StrCmp $5 "$1=" 0 lbl_next
|
111
|
+
IntOp $5 $3 + $4
|
112
|
+
StrCpy $3 $5
|
113
|
+
lbl_loop2:
|
114
|
+
IntCmp $3 $7 0 0 lbl_done
|
115
|
+
StrCpy $6 $2 1 $3
|
116
|
+
StrCmp $6 ";" 0 lbl_next2
|
117
|
+
IntOp $6 $3 - $5
|
118
|
+
StrCpy $0 $2 $6 $5
|
119
|
+
Goto lbl_done
|
120
|
+
lbl_next2:
|
121
|
+
IntOp $3 $3 + 1
|
122
|
+
Goto lbl_loop2
|
123
|
+
lbl_next:
|
124
|
+
IntOp $3 $3 + 1
|
125
|
+
Goto lbl_loop
|
126
|
+
lbl_done:
|
127
|
+
Pop $5
|
128
|
+
Pop $4
|
129
|
+
Pop $3
|
130
|
+
Pop $2
|
131
|
+
Pop $1
|
132
|
+
Exch 2
|
133
|
+
Pop $6
|
134
|
+
Pop $7
|
135
|
+
Exch $0
|
136
|
+
!macroend
|
137
|
+
|
138
|
+
!macro CALL_GETPARAM VAR NAME DEFAULT LABEL
|
139
|
+
Push $1
|
140
|
+
Push ${NAME}
|
141
|
+
Call ${UN}GETPARAM
|
142
|
+
Pop $6
|
143
|
+
StrCpy ${VAR} "${DEFAULT}"
|
144
|
+
StrCmp $6 "" "${LABEL}" 0
|
145
|
+
StrCpy ${VAR} $6
|
146
|
+
!macroend
|
147
|
+
|
148
|
+
!macro FUNC_SERVICE UN
|
149
|
+
Push $0
|
150
|
+
Push $1
|
151
|
+
Push $2
|
152
|
+
Push $3
|
153
|
+
Push $4
|
154
|
+
Push $5
|
155
|
+
Push $6
|
156
|
+
Push $7
|
157
|
+
Exch 8
|
158
|
+
Pop $1 ;param
|
159
|
+
Exch 8
|
160
|
+
Pop $2 ;name
|
161
|
+
Exch 8
|
162
|
+
Pop $3 ;action
|
163
|
+
;$0 return
|
164
|
+
;$4 OpenSCManager
|
165
|
+
;$5 OpenService
|
166
|
+
|
167
|
+
StrCpy $0 "false"
|
168
|
+
System::Call 'advapi32::OpenSCManagerA(n, n, i ${SC_MANAGER_ALL_ACCESS}) i.r4'
|
169
|
+
IntCmp $4 0 lbl_done
|
170
|
+
StrCmp $3 "create" lbl_create
|
171
|
+
System::Call 'advapi32::OpenServiceA(i r4, t r2, i ${SERVICE_ALL_ACCESS}) i.r5'
|
172
|
+
IntCmp $5 0 lbl_done
|
173
|
+
|
174
|
+
lbl_select:
|
175
|
+
StrCmp $3 "delete" lbl_delete
|
176
|
+
StrCmp $3 "start" lbl_start
|
177
|
+
StrCmp $3 "stop" lbl_stop
|
178
|
+
StrCmp $3 "pause" lbl_pause
|
179
|
+
StrCmp $3 "continue" lbl_continue
|
180
|
+
StrCmp $3 "installed" lbl_installed
|
181
|
+
StrCmp $3 "running" lbl_running
|
182
|
+
StrCmp $3 "status" lbl_status
|
183
|
+
Goto lbl_done
|
184
|
+
|
185
|
+
; create service
|
186
|
+
lbl_create:
|
187
|
+
Push $R1 ;depend
|
188
|
+
Push $R2 ;user
|
189
|
+
Push $R3 ;password
|
190
|
+
Push $R4 ;interact
|
191
|
+
Push $R5 ;autostart
|
192
|
+
Push $R6 ;path
|
193
|
+
Push $R7 ;display
|
194
|
+
Push $R8 ;description
|
195
|
+
|
196
|
+
!insertmacro CALL_GETPARAM $R1 "depend" "n" "lbl_depend"
|
197
|
+
StrCpy $R1 't "$R1"'
|
198
|
+
lbl_depend:
|
199
|
+
StrCmp $R1 "n" 0 lbl_machine ;old name of depend param
|
200
|
+
!insertmacro CALL_GETPARAM $R1 "machine" "n" "lbl_machine"
|
201
|
+
StrCpy $R1 't "$R1"'
|
202
|
+
lbl_machine:
|
203
|
+
|
204
|
+
!insertmacro CALL_GETPARAM $R2 "user" "n" "lbl_user"
|
205
|
+
StrCpy $R2 't "$R2"'
|
206
|
+
lbl_user:
|
207
|
+
|
208
|
+
!insertmacro CALL_GETPARAM $R3 "password" "n" "lbl_password"
|
209
|
+
StrCpy $R3 't "$R3"'
|
210
|
+
lbl_password:
|
211
|
+
|
212
|
+
!insertmacro CALL_GETPARAM $R4 "interact" "0x10" "lbl_interact"
|
213
|
+
StrCpy $6 0x10
|
214
|
+
IntCmp $R4 0 +2
|
215
|
+
IntOp $6 $6 | 0x100
|
216
|
+
StrCpy $R4 $6
|
217
|
+
lbl_interact:
|
218
|
+
|
219
|
+
!insertmacro CALL_GETPARAM $R5 "autostart" "0x3" "lbl_autostart"
|
220
|
+
StrCpy $6 0x3
|
221
|
+
IntCmp $R5 0 +2
|
222
|
+
StrCpy $6 0x2
|
223
|
+
StrCpy $R5 $6
|
224
|
+
lbl_autostart:
|
225
|
+
|
226
|
+
!insertmacro CALL_GETPARAM $R6 "path" "n" "lbl_path"
|
227
|
+
lbl_path:
|
228
|
+
|
229
|
+
!insertmacro CALL_GETPARAM $R7 "display" "$2" "lbl_display"
|
230
|
+
lbl_display:
|
231
|
+
|
232
|
+
!insertmacro CALL_GETPARAM $R8 "description" "$2" "lbl_description"
|
233
|
+
lbl_description:
|
234
|
+
|
235
|
+
System::Call 'advapi32::CreateServiceA(i r4, t r2, t R7, i ${SERVICE_ALL_ACCESS}, \
|
236
|
+
i R4, i R5, i 0, t R6, n, n, $R1, $R2, $R3) i.r6'
|
237
|
+
|
238
|
+
; write description of service
|
239
|
+
WriteRegStr HKLM "SYSTEM\ControlSet001\Services\$2" "Description" $R8
|
240
|
+
|
241
|
+
Pop $R8
|
242
|
+
Pop $R7
|
243
|
+
Pop $R6
|
244
|
+
Pop $R5
|
245
|
+
Pop $R4
|
246
|
+
Pop $R3
|
247
|
+
Pop $R2
|
248
|
+
Pop $R1
|
249
|
+
StrCmp $6 0 lbl_done lbl_good
|
250
|
+
|
251
|
+
; delete service
|
252
|
+
lbl_delete:
|
253
|
+
System::Call 'advapi32::DeleteService(i r5) i.r6'
|
254
|
+
StrCmp $6 0 lbl_done lbl_good
|
255
|
+
|
256
|
+
; start service
|
257
|
+
lbl_start:
|
258
|
+
System::Call 'advapi32::StartServiceA(i r5, i 0, i 0) i.r6'
|
259
|
+
StrCmp $6 0 lbl_done lbl_good
|
260
|
+
|
261
|
+
; stop service
|
262
|
+
lbl_stop:
|
263
|
+
Push $R1
|
264
|
+
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
265
|
+
System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_STOP}, i $R1) i'
|
266
|
+
System::Free $R1
|
267
|
+
Pop $R1
|
268
|
+
StrCmp $6 0 lbl_done lbl_good
|
269
|
+
|
270
|
+
; pause service
|
271
|
+
lbl_pause:
|
272
|
+
Push $R1
|
273
|
+
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
274
|
+
System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_PAUSE}, i $R1) i'
|
275
|
+
System::Free $R1
|
276
|
+
Pop $R1
|
277
|
+
StrCmp $6 0 lbl_done lbl_good
|
278
|
+
|
279
|
+
; continue service
|
280
|
+
lbl_continue:
|
281
|
+
Push $R1
|
282
|
+
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
283
|
+
System::Call 'advapi32::ControlService(i r5, i ${SERVICE_CONTROL_CONTINUE}, i $R1) i'
|
284
|
+
System::Free $R1
|
285
|
+
Pop $R1
|
286
|
+
StrCmp $6 0 lbl_done lbl_good
|
287
|
+
|
288
|
+
; is installed
|
289
|
+
lbl_installed:
|
290
|
+
!insertmacro CALL_GETPARAM $7 "action" "" "lbl_good"
|
291
|
+
StrCpy $3 $7
|
292
|
+
Goto lbl_select
|
293
|
+
|
294
|
+
; is service running
|
295
|
+
lbl_running:
|
296
|
+
Push $R1
|
297
|
+
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
298
|
+
System::Call 'advapi32::QueryServiceStatus(i r5, i $R1) i'
|
299
|
+
System::Call '*$R1(i, i.r6)'
|
300
|
+
System::Free $R1
|
301
|
+
Pop $R1
|
302
|
+
IntFmt $6 "0x%X" $6
|
303
|
+
StrCmp $6 ${SERVICE_RUNNING} 0 lbl_done
|
304
|
+
!insertmacro CALL_GETPARAM $7 "action" "" "lbl_good"
|
305
|
+
StrCpy $3 $7
|
306
|
+
Goto lbl_select
|
307
|
+
|
308
|
+
lbl_status:
|
309
|
+
Push $R1
|
310
|
+
System::Call '*(i,i,i,i,i,i,i) i.R1'
|
311
|
+
System::Call 'advapi32::QueryServiceStatus(i r5, i $R1) i'
|
312
|
+
System::Call '*$R1(i, i .r6)'
|
313
|
+
System::Free $R1
|
314
|
+
Pop $R1
|
315
|
+
IntFmt $6 "0x%X" $6
|
316
|
+
StrCpy $0 "running"
|
317
|
+
IntCmp $6 ${SERVICE_RUNNING} lbl_done
|
318
|
+
StrCpy $0 "stopped"
|
319
|
+
IntCmp $6 ${SERVICE_STOPPED} lbl_done
|
320
|
+
StrCpy $0 "start_pending"
|
321
|
+
IntCmp $6 ${SERVICE_START_PENDING} lbl_done
|
322
|
+
StrCpy $0 "stop_pending"
|
323
|
+
IntCmp $6 ${SERVICE_STOP_PENDING} lbl_done
|
324
|
+
StrCpy $0 "running"
|
325
|
+
IntCmp $6 ${SERVICE_RUNNING} lbl_done
|
326
|
+
StrCpy $0 "continue_pending"
|
327
|
+
IntCmp $6 ${SERVICE_CONTINUE_PENDING} lbl_done
|
328
|
+
StrCpy $0 "pause_pending"
|
329
|
+
IntCmp $6 ${SERVICE_PAUSE_PENDING} lbl_done
|
330
|
+
StrCpy $0 "paused"
|
331
|
+
IntCmp $6 ${SERVICE_PAUSED} lbl_done
|
332
|
+
StrCpy $0 "unknown"
|
333
|
+
Goto lbl_done
|
334
|
+
|
335
|
+
lbl_good:
|
336
|
+
StrCpy $0 "true"
|
337
|
+
lbl_done:
|
338
|
+
IntCmp $5 0 +2
|
339
|
+
System::Call 'advapi32::CloseServiceHandle(i r5) n'
|
340
|
+
IntCmp $4 0 +2
|
341
|
+
System::Call 'advapi32::CloseServiceHandle(i r4) n'
|
342
|
+
Pop $4
|
343
|
+
Pop $3
|
344
|
+
Pop $2
|
345
|
+
Pop $1
|
346
|
+
Exch 3
|
347
|
+
Pop $5
|
348
|
+
Pop $7
|
349
|
+
Pop $6
|
350
|
+
Exch $0
|
351
|
+
!macroend
|
352
|
+
|
353
|
+
Function Service
|
354
|
+
!insertmacro FUNC_SERVICE ""
|
355
|
+
FunctionEnd
|
356
|
+
|
357
|
+
Function un.Service
|
358
|
+
!insertmacro FUNC_SERVICE "un."
|
359
|
+
FunctionEnd
|
360
|
+
|
361
|
+
Function GetParam
|
362
|
+
!insertmacro FUNC_GETPARAM
|
363
|
+
FunctionEnd
|
364
|
+
|
365
|
+
Function un.GetParam
|
366
|
+
!insertmacro FUNC_GETPARAM
|
367
|
+
FunctionEnd
|
368
|
+
|
369
|
+
!endif
|