Changes to the nasm wrapper to enable windows support

git-svn-id: file:///home/svn/framework3/trunk@4553 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2007-03-24 18:09:14 +00:00
parent bff79e05f8
commit 1fd83b3fe6
1 changed files with 8 additions and 6 deletions

View File

@ -18,9 +18,11 @@ class Nasm
# Ensures that the nasm environment is sane.
#
def self.check
if (Rex::FileUtils.find_full_path('nasm') == nil)
raise RuntimeError, "No nasm installation was found."
end
path =
Rex::FileUtils.find_full_path('nasm') ||
Rex::FileUtils.find_full_path('nasm.exe') ||
Rex::FileUtils.find_full_path('nasmw.exe') ||
raise(RuntimeError, "No nasm installation was found.")
end
#
@ -30,7 +32,7 @@ class Nasm
check
# Open the temporary file
tmp = Tempfile.new('nasm').path
tmp = Tempfile.new('nasmXXXX').path
file = File.new(tmp, "w")
# Write the assembly data to a file
@ -43,7 +45,7 @@ class Nasm
end
# Run nasm
if (system("nasm -f bin -o #{tmp}.out #{tmp}") == false)
if (system("nasm -f bin -o '#{tmp}.out' '#{tmp}'") == false)
raise RuntimeError, "Assembler did not complete successfully: #{$?.exitstatus}"
end
@ -67,7 +69,7 @@ class Nasm
tmp = Tempfile.new('nasmout').path
File.open(tmp, "wb") { |f| f.write(raw) }
p = ::IO.popen("ndisasm -u #{tmp}")
p = ::IO.popen("ndisasm -u '#{tmp}'")
o = ''
begin