Class: Trevil
Instance Method Summary collapse
- #clear! ⇒ Object
- #go ⇒ Object
-
#initialize(p) ⇒ Trevil
constructor
A new instance of Trevil.
Constructor Details
#initialize(p) ⇒ Trevil
Returns a new instance of Trevil.
73 74 75 76 77 |
# File 'lib/ragweed/trampoline.rb', line 73 def initialize(p) @p = p @ev1, @ev2 = [WinEvent.new, WinEvent.new] @a = @p.arena end |
Instance Method Details
#clear! ⇒ Object
79 80 81 |
# File 'lib/ragweed/trampoline.rb', line 79 def clear! @a.release end |
#go ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/ragweed/trampoline.rb', line 83 def go mem = @a.alloc(1024) base = @p.ptr(mem) data = base + 512 swch = ["OpenProcess", "DuplicateHandle", "ResetEvent", "SetEvent", "WaitForSingleObject"]. map {|x| @p.get_proc("kernel32!#{x}").to_i}. pack("LLLLL") state = [Ragweed::Wrap32::get_current_process_id, @ev1.handle, @ev2.handle]. pack("LLL") data.write(swch + state) base.write(event_pair_stub(:debug => false).assemble) Ragweed::Wrap32::create_remote_thread(@p.handle, base, data) @ev1.wait @ev2 end |