[Win32utils-devel] Service.services bug (pure Ruby version)

Daniel Berger djberg96 at gmail.com
Sat Nov 3 21:12:46 EDT 2007


Heesob Park wrote:

<snip>


> The segfaulting is due to the memcpy in service.rb 
>  
>             dep_buf = 0.chr * 260
>             memcpy(dep_buf, config_buf[24,4].unpack('L').first, 
> dep_buf.size)
>             dependencies = dep_buf.split("\000\000").first.split(0.chr)
>  
> Here is an agly but working code:
>  
>             dep_buf = "" 
>             psz_depend = config_buf[24,4].unpack('L').first
>             while psz_depend!=0
>               char_buf = 0.chr
>               memcpy(char_buf, psz_depend, 1)
>               psz_depend += 1             
>               dep_buf += char_buf
>               break if dep_buf[-2,2]=="\0\0"             
>             end
>             dependencies = []
>             if dep_buf != "\0\0"
>               dependencies = dep_buf.split("\000\000").first.split(0.chr)
>             end
>  
> Regards,
>  
> Park Heesob

Excellent, that works, thanks! It does seem like there ought to be a 
more efficient way, but we can worry about that later.

Thanks,

Dan


More information about the win32utils-devel mailing list