This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: More win32-process updates
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
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.