From: Shashank Date Date: 2004-01-12T00:01:45+09:00 Subject: Re: dereferencing pointers in Win32 API This worked : > Just use memcpy. > Try this code. > > require "Win32API" > > SERVICE_WORKSTATION = [ > 76,0,97,0,110,0,109,0,97,0,110,0,87,0,111,0,114,0, > 107,0,115,0,116,0,97,0,116,0,105,0,111,0,110,0,0,0] > > > SERVICE_WORKSTATION.each{|e| print "%c" % e if e > 0} > puts > > service = SERVICE_WORKSTATION.pack("U*") # Unicode > > NetStatisticsGet = Win32API.new('netapi32','NetStatisticsGet','PPNNP','I') > > bufptr = "\0" * 4 > ret = NetStatisticsGet.call(0,service,0,0,bufptr) > > if 0 != ret > puts "Failed:#{ret}" > exit > end > > STAT_WORKSTATION_SIZE = (13*8) + (28*4) > > rbuf = "\0" * STAT_WORKSTATION_SIZE > memcpy = Win32API.new('msvcrt','memcpy','PPL','P') > memcpy.Call(rbuf,bufptr,STAT_WORKSTATION_SIZE) > > struct = rbuf.unpack("L*") > p struct > > __END__ > > Regards, > > Park Heesob Thanks, Park. -- shanko