2012-12-26 72 views
0

我想在Ruby中使用WIN32API和管理clusapi-红宝石WIN32API集群

require "Win32API" 

OpenCluster = Win32API.new('clusapi','OpenCluster',['P'], 'L') 
OpenCluster.call('cc-fs01') 

CreateClusterGroup = Win32API.new('clusapi','CreateClusterGroup',['P','P'], 'L') 
CreateClusterGroup.call ('cc-fs01','testing') 

这是用管理员权限运行,并且没有错误退出,但它不会做任何事情。 我曾尝试类似的活动与win32/api和ffi但无济于事。我不想使用通过ole的mscluster_cluster,因为它已被弃用。这确实有效我的猜测是这与处理有关,但我不是一个c家伙。这是功能 - http://msdn.microsoft.com/en-us/library/windows/desktop/aa369315(v=vs.85).aspx

感谢您的帮助提前。

+1

我没有时间来运行它我拥有。但是你对CreateClusterGroup的调用不正确(你可能猜到了)。您需要从OpenCluster捕获返回值并将该句柄作为CreateClusterGroup的第一个参数传递。 –

回答

0

你是正确的,但真正的问题是,名字,组,资源等,都被.encode(“UTF-16LE”)