node/lib/metasm/metasm/os/windows.rb
def teb_base
			@teb_base ||=
			if WinAPI.respond_to?(:ntqueryinformationthread)
				tinfo = WinAPI.alloc_c_struct('THREAD_BASIC_INFORMATION')
				if WinAPI.ntqueryinformationthread(handle, WinAPI::THREADBASICINFORMATION, tinfo, tinfo.sizeof, 0) == 0
					tinfo.tebbaseaddress
				end
			else
				fs = context { |c| c[:fs] }
				ldte = WinAPI.alloc_c_struct('LDT_ENTRY')
				if WinAPI.getthreadselectorentry(handle, fs, ldte)
					ldte.baselow | (ldte.basemid << 16) | (ldte.basehi << 24)
				end
			end
		end
# return the address of the TEB for the target thread
return the address of the TEB for the target thread
return the address of the TEB for the target thread
def teb_base
			@teb_base ||=
			if WinAPI.respond_to?(:ntqueryinformationthread)
				tinfo = WinAPI.alloc_c_struct('THREAD_BASIC_INFORMATION')
				if WinAPI.ntqueryinformationthread(handle, WinAPI::THREADBASICINFORMATION, tinfo, tinfo.sizeof, 0) == 0
					tinfo.tebbaseaddress
				end
			else
				fs = context { |c| c[:fs] }
				ldte = WinAPI.alloc_c_struct('LDT_ENTRY')
				if WinAPI.getthreadselectorentry(handle, fs, ldte)
					ldte.baselow | (ldte.basemid << 16) | (ldte.basehi << 24)
				end
			end
		end
def teb_base @teb_base ||= if WinAPI . respond_to? ( :ntqueryinformationthread ) tinfo = WinAPI . alloc_c_struct ( 'THREAD_BASIC_INFORMATION' ) if WinAPI . ntqueryinformationthread ( handle , WinAPI :: THREADBASICINFORMATION , tinfo , tinfo . sizeof , 0 ) == 0 tinfo . tebbaseaddress end else fs = context { | c | c [ :fs ] } ldte = WinAPI . alloc_c_struct ( 'LDT_ENTRY' ) if WinAPI . getthreadselectorentry ( handle , fs , ldte ) ldte . baselow | ( ldte . basemid << 16 ) | ( ldte . basehi << 24 ) end end end
return the address of the TEB for the target thread
return the address of the TEB for the target thread