node/lib/metasm/metasm/os/windows.rb
def list_threads(pid=nil)
		h = WinAPI.createtoolhelp32snapshot(WinAPI::TH32CS_SNAPTHREAD, 0)
		list = []
		te = WinAPI.alloc_c_struct('THREADENTRY32', :dwsize => :size)
		return [] if not WinAPI.thread32first(h, te)
		loop do
			list << te.th32threadid if not pid or te.th32ownerprocessid == pid
			break if WinAPI.thread32next(h, te) == 0
		end
		WinAPI.closehandle(h)
		list
	end
# returns the list of thread ids of the system, optionally filtering by pid
returns the list of thread ids of the system, optionally filtering by pid
returns the list of thread ids of the system optionally filtering by pid
def list_threads(pid=nil)
		h = WinAPI.createtoolhelp32snapshot(WinAPI::TH32CS_SNAPTHREAD, 0)
		list = []
		te = WinAPI.alloc_c_struct('THREADENTRY32', :dwsize => :size)
		return [] if not WinAPI.thread32first(h, te)
		loop do
			list << te.th32threadid if not pid or te.th32ownerprocessid == pid
			break if WinAPI.thread32next(h, te) == 0
		end
		WinAPI.closehandle(h)
		list
	end
def list_threads ( pid = nil ) h = WinAPI . createtoolhelp32snapshot ( WinAPI :: TH32CS_SNAPTHREAD , 0 ) list = [ ] te = WinAPI . alloc_c_struct ( 'THREADENTRY32' , :dwsize => :size ) return [ ] if not WinAPI . thread32first ( h , te ) loop do list << te . th32threadid if not pid or te . th32ownerprocessid == pid break if WinAPI . thread32next ( h , te ) == 0 end WinAPI . closehandle ( h ) list end
returns the list of thread ids of the system, optionally filtering by pid
returns the list of thread ids of the system optionally filtering by pid
pid