noreply at rubyforge.org
2007-Aug-31 19:07 UTC
[Win32utils-devel] [ win32utils-Bugs-13560 ] Service dependencies has wierd string.
Bugs item #13560, was opened at 2007-08-31 15:07
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=411&aid=13560&group_id=85
Category: win32-service
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: Service dependencies has wierd string.
Initial Comment:
Hello,
My name is Jong Lee from Virginia, USA.
I am using win32/service which version is 0.5.2.
I think I am using latest version.
Following code displays service name, type and dependencies.
Service.services do |s|
puts "#{s.service_name} - #{s.service_type}"
s.dependencies.each {|d| puts " " + d} if s.dependencies != nil
end
Most of results are fine but some of them are displaying wierd string as
follwoing.
---------------------------------------------
wscsvc - share process
RpcSs
winmgmt
t
calSystem
tem
curity Center
Center
r
on Driver Extensions
ver Extensions
tensions
ns
Service
e
Service
ce
---------------------------------------------
WSTCODEC - kernel driver
---------------------------------------------
wuauserv - share process
---------------------------------------------
WZCSVC - share process
RpcSs
Ndisuio
o
calSystem
tem
reless Zero Configuration
Zero Configuration
Configuration
uration
n
tensions
ns
Service
e
Service
ce
I debugged service.c and service.h and found something wrong.
I modified the function "rb_get_dependencies" from service.h like
following and it works fine.
static VALUE rb_get_dependencies(LPTSTR lpDependencies){
VALUE v_dependencies = rb_ary_new();
if(lpDependencies){
TCHAR* pszDepend = 0;
int i = 0;
pszDepend = &lpDependencies[i];
while(*pszDepend != 0){
rb_ary_push(v_dependencies, rb_str_new2(pszDepend));
//i += _tcslen(lpDependencies) + 1; <-- Original code
i += _tcslen(&(lpDependencies[i])) + 1; // <-- Modified code
pszDepend = &lpDependencies[i];
}
}
if(RARRAY(v_dependencies)->len == 0)
v_dependencies = Qnil;
return v_dependencies;
}
The modified module displays as following and I think this change solves the
problem.
---------------------------------------------
wscsvc - share process
RpcSs
winmgmt
---------------------------------------------
WSTCODEC - kernel driver
---------------------------------------------
wuauserv - share process
---------------------------------------------
WZCSVC - share process
RpcSs
Ndisuio
Thanks,
Jong Lee (jolinhama at gmail dot com)
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=411&aid=13560&group_id=85
