From noreply at rubyforge.org Wed Feb 2 13:41:30 2011 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Wed, 2 Feb 2011 13:41:30 -0500 (EST) Subject: [Win32utils-devel] [ win32utils-Bugs-28904 ] Gem win32-eventlog v0.5.2 on Ruby 1.9.1 and 1.9.2 Message-ID: <20110202184130.E232F18583AF@rubyforge.org> Bugs item #28904, was opened at 2011-02-02 18:41 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=28904&group_id=85 Category: win32-eventlog Group: Code Status: Open Resolution: None Priority: 3 Submitted By: Jason Bourne (jbourne) Assigned to: Nobody (None) Summary: Gem win32-eventlog v0.5.2 on Ruby 1.9.1 and 1.9.2 Initial Comment: 1.Requirement: Read the latest lines of the Windows Application Event Viewer to verify deployment status executions. 2. Environment: Ruby 1.9.1 On Windows win32-eventlog (0.5.2) windows-api (0.4.0) windows-pr (1.1.3) 3. Problem: On Ruby 1.8.7 my scripts using win32 evenlog api works fine but on ruby 1.9.1 they don't. I know the String management has changed on Ruby 1.9.1 and above. 4. Exception Details. C:/Ruby191/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.5.2/lib/win32/eventlog.rb:14:in `[]': invalid byte sequence in US-ASCII (ArgumentError) from C:/Ruby191/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.5.2/lib/win32/eventlog.rb:14:in `nstrip' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.5.2/lib/win32/eventlog.rb:613:in `read' from bw_logutil.rb:49:in `read_event_log' from bw_logutil.rb:97:in `block in
' from bw_logutil.rb:96:in `each' from bw_logutil.rb:96:in `
' 5. Source of Information : http://raa.ruby-lang.org/project/win32-eventlog/ 6. Tried Solutions. Tried to use WMI but there is no way to filter the latest results. By the way I already use Ruby 1.9.2 and i have the same results. Could someone help me with this. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=28904&group_id=85 From djberg96 at gmail.com Mon Feb 7 21:56:14 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Mon, 7 Feb 2011 19:56:14 -0700 Subject: [Win32utils-devel] WSAStartup failure Message-ID: <000101cbc73b$c1ca9c70$455fd550$@com> Hi, I added the Windows::WSA module to windows-pr recently (it's in the latest git repo). However, I can't seem to make WSAStartup work. I tried the following bit of code, only to get "The Windows Sockets version requested is not supported" on my Vista box. Is it really not supported on Vista? The docs say Win2k or later. Or is there another issue? require 'windows/wsa' require 'windows/error' require 'windows/system_info' include Windows::WSA include Windows::Error include Windows::SystemInfo begin version = MAKEWORD(2,2) buffer = 0.chr * 532 err = WSAStartup(version, buffer) if err != 0 puts "Oops: " + get_last_error(err) end ensure WSACleanup() end From phasis at gmail.com Tue Feb 8 01:02:53 2011 From: phasis at gmail.com (Heesob Park) Date: Tue, 8 Feb 2011 15:02:53 +0900 Subject: [Win32utils-devel] WSAStartup failure In-Reply-To: <000101cbc73b$c1ca9c70$455fd550$@com> References: <000101cbc73b$c1ca9c70$455fd550$@com> Message-ID: Hi, 2011/2/8 Daniel Berger : > Hi, > > I added the Windows::WSA module to windows-pr recently (it's in the latest > git repo). However, I can't seem to make WSAStartup work. I tried the > following bit of code, only to get "The Windows Sockets version requested is > not supported" on my Vista box. > > Is it really not supported on Vista? The docs say Win2k or later. Or is > there another issue? > > require 'windows/wsa' > require 'windows/error' > require 'windows/system_info' > > include Windows::WSA > include Windows::Error > include Windows::SystemInfo > > begin > ?version = MAKEWORD(2,2) > ?buffer = 0.chr * 532 > ?err = WSAStartup(version, buffer) > > ?if err != 0 > ? ?puts "Oops: " + get_last_error(err) > ?end > ensure > ?WSACleanup() > end > The current definition of MAKEWORD and MAKELONG is wroing. Here is fixed version of MAKEWORD and MAKELONG. def MAKEWORD(a, b) ((a & 0xff) | ((b & 0xff) << 8)) end def MAKELONG(a, b) ((a & 0xffff) | ((b & 0xffff) << 16)) end Regards, Park Heesob From djberg96 at gmail.com Tue Feb 8 23:23:51 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Tue, 8 Feb 2011 21:23:51 -0700 Subject: [Win32utils-devel] WSAStartup failure In-Reply-To: References: <000101cbc73b$c1ca9c70$455fd550$@com> Message-ID: On Mon, Feb 7, 2011 at 11:02 PM, Heesob Park wrote: > Hi, > > 2011/2/8 Daniel Berger : >> Hi, >> >> I added the Windows::WSA module to windows-pr recently (it's in the latest >> git repo). However, I can't seem to make WSAStartup work. I tried the >> following bit of code, only to get "The Windows Sockets version requested is >> not supported" on my Vista box. >> >> Is it really not supported on Vista? The docs say Win2k or later. Or is >> there another issue? >> >> require 'windows/wsa' >> require 'windows/error' >> require 'windows/system_info' >> >> include Windows::WSA >> include Windows::Error >> include Windows::SystemInfo >> >> begin >> ?version = MAKEWORD(2,2) >> ?buffer = 0.chr * 532 >> ?err = WSAStartup(version, buffer) >> >> ?if err != 0 >> ? ?puts "Oops: " + get_last_error(err) >> ?end >> ensure >> ?WSACleanup() >> end >> > The current definition of MAKEWORD and MAKELONG is wroing. > > Here is fixed version of MAKEWORD and MAKELONG. > > def MAKEWORD(a, b) > ? ? ?((a & 0xff) | ((b & 0xff) << 8)) > end > def MAKELONG(a, b) > ? ? ?((a & 0xffff) | ((b & 0xffff) << 16)) > end Ack, thanks. I'm pretty sure I copy/pasted this, so I'm assuming there's a precedence issue. Ruby is *usually* the same as C, so I'm somewhat surprised here. Regards, Dan From djberg96 at gmail.com Fri Feb 11 12:29:26 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Fri, 11 Feb 2011 10:29:26 -0700 Subject: [Win32utils-devel] pctcpu and pctmem for windows? Message-ID: Hi, Given the fields currently available in sys-proctable (from Win32_Process), what's a good way to calculate %cpu and %mem for a given process? Thanks, Dan From phasis at gmail.com Fri Feb 11 22:06:21 2011 From: phasis at gmail.com (Heesob Park) Date: Sat, 12 Feb 2011 12:06:21 +0900 Subject: [Win32utils-devel] pctcpu and pctmem for windows? In-Reply-To: References: Message-ID: Hi, 2011/2/12 Daniel Berger : > Hi, > > Given the fields currently available in sys-proctable (from > Win32_Process), what's a good way to calculate %cpu and %mem for a > given process? > I think that using WbemScripting.SWbemRefresher is more appropriate for getting cpu usage. Here is a sample code: require 'win32ole' computer = "." intPasses = 5 intPause = 0.1 wmi = WIN32OLE.connect("winmgmts:{impersonationLevel=impersonate}!//#{computer}/root/cimv2") refresher = WIN32OLE.new("WbemScripting.SWbemRefresher") items = refresher.addEnum(wmi, "Win32_PerfFormattedData_PerfProc_Process").objectSet refresher.refresh for i in (1..intPasses) sleep intPause puts "Pass #{i}" puts Time.now items.each do |item| refresher.refresh if item.IDProcess==4 puts "Name: #{item.Name}" puts " Process ID: #{item.IDProcess}" puts " Percent Processor Time: #{item.PercentProcessorTime}" end end end Regards, Park Heesob From noreply at rubyforge.org Tue Feb 22 00:56:05 2011 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 22 Feb 2011 00:56:05 -0500 (EST) Subject: [Win32utils-devel] [ win32utils-Bugs-28938 ] Incorrect Constant Name KEY_CURRENT_USER:line 13:registry.rb Message-ID: <20110222055606.021D31858374@rubyforge.org> Bugs item #28938, was opened at 2011-02-19 22:11 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=28938&group_id=85 Category: windows-pr Group: Code Status: Open Resolution: None Priority: 3 Submitted By: Dan Rathbun (danzoid61) Assigned to: Nobody (None) Summary: Incorrect Constant Name KEY_CURRENT_USER:line 13:registry.rb Initial Comment: windows-pr : registry.rb line 13 is: KEY_CURRENT_USER = 0x80000001 should be: HKEY_CURRENT_USER = 0x80000001 ~ ---------------------------------------------------------------------- >Comment By: Dan Rathbun (danzoid61) Date: 2011-02-22 00:56 Message: reposted on the gith site. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=28938&group_id=85