[Win32utils-devel] Service.start arguments failing or causing segfault

Daniel Berger djberg96 at gmail.com
Sat Nov 24 09:40:38 EST 2007


Heesob Park wrote:

<snip>

> Don't ask me why, just follow the rule of the microsoft :)
>  
> Acording to http://msdn2.microsoft.com/en-US/library/ms686321.aspx ,
> StartService function requires NULL or an argument which the first 
> element must be service name.
> And argument type is not LPCSTR, but LPCTSTR* ( pointer of string), so 
> it need to be packed. 

Oops, I did see a mistake with num_args. It should be like this I think:

num_args = 0

if args.empty?
    args = nil
else
    args.unshift(service)
    num_args = args.length
    args = [args.join("\000")].pack('p*')
end

I forgot to add 1 for the service name.

The only problem is, now it segfaults. :(

Dan


More information about the win32utils-devel mailing list