The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
More win32-process updates

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
More win32-process updates Posted: Jul 16, 2009 7:48 AM
Reply to this message Reply

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.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

Advertisement
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.

Read: More win32-process updates

Topic: Three Years of Real-World Ruby Previous Topic   Next Topic Topic: Live JavaScript TDD Action Coming to raleigh.rb

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use