fix service name handling

git-svn-id: file:///home/svn/framework3/trunk@11198 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Joshua Drake 2010-12-02 02:23:27 +00:00
parent 3fdfb3e945
commit 9e03e8a142
1 changed files with 13 additions and 7 deletions

View File

@ -411,7 +411,7 @@ require 'digest/sha1'
def self.to_win32pe_service(framework, code, opts={}) def self.to_win32pe_service(framework, code, opts={})
name = opts[:servicename] || 'SERVICENAME' name = opts[:servicename]
# Allow the user to specify their own service EXE template # Allow the user to specify their own service EXE template
set_template_default(opts, "template_x86_windows_svc.exe") set_template_default(opts, "template_x86_windows_svc.exe")
@ -425,9 +425,11 @@ require 'digest/sha1'
raise RuntimeError, "Invalid Win32 PE Service EXE template: missing \"PAYLOAD:\" tag" if not bo raise RuntimeError, "Invalid Win32 PE Service EXE template: missing \"PAYLOAD:\" tag" if not bo
pe[bo, 8192] = [code].pack("a8192") pe[bo, 8192] = [code].pack("a8192")
bo = pe.index('SERVICENAME') if name
raise RuntimeError, "Invalid Win32 PE Service EXE template: missing \"SERVICENAME\" tag" if not bo bo = pe.index('SERVICENAME')
pe[bo, 11] = [name].pack('a11') raise RuntimeError, "Invalid Win32 PE Service EXE template: missing \"SERVICENAME\" tag" if not bo
pe[bo, 11] = [name].pack('a11')
end
if not opts[:sub_method] if not opts[:sub_method]
pe[136, 4] = [rand(0x100000000)].pack('V') pe[136, 4] = [rand(0x100000000)].pack('V')
@ -438,6 +440,8 @@ require 'digest/sha1'
def self.to_win64pe_service(framework, code, opts={}) def self.to_win64pe_service(framework, code, opts={})
name = opts[:servicename]
# Allow the user to specify their own service EXE template # Allow the user to specify their own service EXE template
set_template_default(opts, "template_x64_windows_svc.exe") set_template_default(opts, "template_x64_windows_svc.exe")
@ -450,9 +454,11 @@ require 'digest/sha1'
raise RuntimeError, "Invalid Win64 PE Service EXE template: missing \"PAYLOAD:\" tag" if not bo raise RuntimeError, "Invalid Win64 PE Service EXE template: missing \"PAYLOAD:\" tag" if not bo
pe[bo, 8192] = [code].pack("a8192") pe[bo, 8192] = [code].pack("a8192")
bo = pe.index('SERVICENAME') if name
raise RuntimeError, "Invalid Win64 PE Service EXE template: missing \"SERVICENAME\" tag" if not bo bo = pe.index('SERVICENAME')
pe[bo, 11] = [name].pack('a11') raise RuntimeError, "Invalid Win64 PE Service EXE template: missing \"SERVICENAME\" tag" if not bo
pe[bo, 11] = [name].pack('a11')
end
if not opts[:sub_method] if not opts[:sub_method]
pe[136, 4] = [rand(0x100000000)].pack('V') pe[136, 4] = [rand(0x100000000)].pack('V')