Jul 16, 2009 08:12
We've added a few methods in win32-process to the Process module that were previously unimplemented. Specifically:
* Process.uid
* Process.getpriority
* Process.setpriority
For Process.uid I decided to return the RID of the owning user's SID. This is the same value that you'll get if you look at the local user account id on your Windows box. The only difference is that I allow an optional parameter which, if set to true, will instead return the binary SID. That way you can use it directly if you need to.
One use would be to use it in conjunction with the win32-security library.
require 'win32/process'
require 'win32/security'
p Process.uid # 1000
p Win32::Security::SID.open(Process.uid(true)) # Security object
Implementing Process.getpriority and Process.setpriority was fairly trivial for processes. I just used the GetPriorityClass and SetPriorityClass functions. The only difference is that you can only set the priority for processes, not process groups or users. Also, the values are different (and limited) when compared to its UNIX counterpart.
ruby,
windows