From noreply at rubyforge.org Tue Jan 1 14:06:02 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 1 Jan 2008 14:06:02 -0500 (EST) Subject: [Win32utils-devel] [ win32utils-Bugs-16700 ] 1.0.5 x86-mswin32-60 gem is broken Message-ID: <20080101190602.2EA191858600@rubyforge.org> Bugs item #16700, was opened at 2007-12-29 22:04 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=16700&group_id=85 Category: win32-api Group: Packaging Status: Open Resolution: None Priority: 3 Submitted By: Luis Lavena (luislavena) Assigned to: Nobody (None) Summary: 1.0.5 x86-mswin32-60 gem is broken Initial Comment: Daniel, The gem you have created with RubyGems 0.9.5 for win32-api is broken, and is forcing users to the pure-ruby and extension building process instead. This is part of the specification yaml: --- !ruby/object:Gem::Specification name: win32-api version: !ruby/object:Gem::Version version: 1.0.5 platform: current authors: - Daniel J. Berger autorequire: bindir: bin cert_chain: [] platform shouldn't be current, but i386-mswin32 or x86-mswin32-60. This problem was fixed in rubygems 1.0, so I suggest you update and recreate the gem with the correction. I'm getting a lot of reports of unsuccessful installation of mongrel_service (which depends on win32-service) due this. Regards, Luis ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2008-01-01 12:06 Message: Ok, I built and uploaded a new gem for this library. I'll test it in an hour or so to make sure it works. - Dan ---------------------------------------------------------------------- Comment By: Luis Lavena (luislavena) Date: 2007-12-31 20:25 Message: it should look: platform: x86-mswin32-60 or if was packaged with 0.9.4: platform: i386-mswin32 The problem is that 0.9.5 was broken and setting platform to 'current' (actually, current is the text written in the spec, not Gem::Platform::CURRENT). So, the resulting gem will be excluded and not properly picked by rubyforge indexer. RubyGems 0.9.5 was setting the gem name to -x86-mswin32-60, but storing into the metadata the wrong information. RubyGems 1.0.x ships with fixes for this, generating not just the correct gem name like 0.9.5, but also storing the proper platform into the metadata. 0.9.5 => Gem::Platform::CURRENT => platform: current (WRONG) 1.0.1 => Gem::Platform::CURRENT => platform: x86-mswin32-60 (GOOD) Hope this shed some light to the situation. Regards, Luis ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2007-12-31 18:50 Message: Doesn't CURRENT set it to i386-mswin32-60 if that's the compiler it was built with? That's how the resulting gem name looks. I'm afraid I do not understand the platform system any more Luis. What should the gemspec look like? ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=16700&group_id=85 From noreply at rubyforge.org Tue Jan 1 17:01:26 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 1 Jan 2008 17:01:26 -0500 (EST) Subject: [Win32utils-devel] [ win32utils-Bugs-16700 ] 1.0.5 x86-mswin32-60 gem is broken Message-ID: <20080101220126.55CB618585FA@rubyforge.org> Bugs item #16700, was opened at 2007-12-29 22:04 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=16700&group_id=85 Category: win32-api Group: Packaging >Status: Closed >Resolution: Accepted Priority: 3 Submitted By: Luis Lavena (luislavena) >Assigned to: Daniel Berger (djberg96) Summary: 1.0.5 x86-mswin32-60 gem is broken Initial Comment: Daniel, The gem you have created with RubyGems 0.9.5 for win32-api is broken, and is forcing users to the pure-ruby and extension building process instead. This is part of the specification yaml: --- !ruby/object:Gem::Specification name: win32-api version: !ruby/object:Gem::Version version: 1.0.5 platform: current authors: - Daniel J. Berger autorequire: bindir: bin cert_chain: [] platform shouldn't be current, but i386-mswin32 or x86-mswin32-60. This problem was fixed in rubygems 1.0, so I suggest you update and recreate the gem with the correction. I'm getting a lot of reports of unsuccessful installation of mongrel_service (which depends on win32-service) due this. Regards, Luis ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2008-01-01 15:01 Message: Looks like it's fixed. I did a remote install and it did not attempt to build from source, so that's good. Please reopen if I messed up again. Thanks, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2008-01-01 12:06 Message: Ok, I built and uploaded a new gem for this library. I'll test it in an hour or so to make sure it works. - Dan ---------------------------------------------------------------------- Comment By: Luis Lavena (luislavena) Date: 2007-12-31 20:25 Message: it should look: platform: x86-mswin32-60 or if was packaged with 0.9.4: platform: i386-mswin32 The problem is that 0.9.5 was broken and setting platform to 'current' (actually, current is the text written in the spec, not Gem::Platform::CURRENT). So, the resulting gem will be excluded and not properly picked by rubyforge indexer. RubyGems 0.9.5 was setting the gem name to -x86-mswin32-60, but storing into the metadata the wrong information. RubyGems 1.0.x ships with fixes for this, generating not just the correct gem name like 0.9.5, but also storing the proper platform into the metadata. 0.9.5 => Gem::Platform::CURRENT => platform: current (WRONG) 1.0.1 => Gem::Platform::CURRENT => platform: x86-mswin32-60 (GOOD) Hope this shed some light to the situation. Regards, Luis ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2007-12-31 18:50 Message: Doesn't CURRENT set it to i386-mswin32-60 if that's the compiler it was built with? That's how the resulting gem name looks. I'm afraid I do not understand the platform system any more Luis. What should the gemspec look like? ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=16700&group_id=85 From noreply at rubyforge.org Tue Jan 1 17:36:25 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 1 Jan 2008 17:36:25 -0500 (EST) Subject: [Win32utils-devel] [ win32utils-Bugs-16648 ] Cannot find the file specified with Service.services Message-ID: <20080101223625.581CE18585FA@rubyforge.org> Bugs item #16648, was opened at 2007-12-27 13:58 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=16648&group_id=85 Category: win32-service Group: Code >Status: Closed >Resolution: Accepted Priority: 4 Submitted By: Daniel Berger (djberg96) >Assigned to: Daniel Berger (djberg96) Summary: Cannot find the file specified with Service.services Initial Comment: Hi, Just trying to help my dad out here while I'm on Christmas vacation and I hit this error while listing the Services via Service.services: Win32::Service::Error: The system cannot find the file specified. from c:/ruby/lib/ruby/gems/1.8/gems/win32-service-0.6.0-x86-mswin32-60/l ib/win32/service.rb:1334:in `get_config_info' from c:/ruby/lib/ruby/gems/1.8/gems/win32-service-0.6.0-x86-mswin32-60/l ib/win32/service.rb:1085:in `services' from c:/ruby/lib/ruby/gems/1.8/gems/win32-service-0.6.0-x86-mswin32-60/l ib/win32/service.rb:1047:in `upto' from c:/ruby/lib/ruby/gems/1.8/gems/win32-service-0.6.0-x86-mswin32-60/l ib/win32/service.rb:1047:in `services' from (irb):5 This happens after listing about a dozen services or so just fine. I can't tell which service is causing this problem, as there appear to be several services not listed in the Windows Services GUI that show up in the Service.services call. Dan ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2008-01-01 15:36 Message: Ok, I figured out what caused this. The underlying registry entry was deleted but the service still exists. Specifically, the QueryServiceConfig function queries the registry. I'll check for ERROR_FILE_NOT_FOUND specifically, issue a warning about the deleted registry entry, and set the various config variables to nil. I'll reassign this bug to myself now, too. :) Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2007-12-30 06:02 Message: Hi, I tried it again this morning and naturally I can no longer duplicate it either. Now it works fine. :( I can only guess that it was related to the Symantec services (aka Norton Antivirus), which I later disabled. Perhaps whatever was causing the problem was ultimately deleted. I tried several times to uninstall NAV but was only partially successful. The only thing I can think of is that there was a service installed, then disabled, then the executable it pointed to was deleted but the service itself was not. Could that have caused it? Otherwise, I'm not sure. I see one or two similar posts on Google, but nothing definitive. Anyway, feel free to reject this ticket if you like. We'll just have to keep it in mind if it ever shows up again. Regards, Dan ---------------------------------------------------------------------- Comment By: Park Heesob (phasis68) Date: 2007-12-30 02:50 Message: Hi, I cannot repeat your problem. So I have no idea. Please try with some debugging code insert before get_config_info to know what service_name, display_name and other information cause the problem. Regards, Park Heesob ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=16648&group_id=85 From djberg96 at gmail.com Tue Jan 1 19:51:31 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Tue, 01 Jan 2008 17:51:31 -0700 Subject: [Win32utils-devel] Happy New Year! Message-ID: <477AE013.2080408@gmail.com> Hi everyone, Just wanted to say Happy 2008! As you can see, I'm back in action, patching and updating stuff already. :) Regards, Dan From luislavena at gmail.com Tue Jan 1 20:57:36 2008 From: luislavena at gmail.com (Luis Lavena) Date: Tue, 1 Jan 2008 23:57:36 -0200 Subject: [Win32utils-devel] Happy New Year! In-Reply-To: <477AE013.2080408@gmail.com> References: <477AE013.2080408@gmail.com> Message-ID: <71166b3b0801011757g2ff56c62wf32f3e9038d3d5b9@mail.gmail.com> On Jan 1, 2008 10:51 PM, Daniel Berger wrote: > Hi everyone, > > Just wanted to say Happy 2008! > Happy new year to you too Dan! > As you can see, I'm back in action, patching and updating stuff already. :) > I'm glad to have you back! :-D > Regards, > Have a nice week! -- Luis Lavena Multimedia systems - A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. Douglas Adams From noreply at rubyforge.org Tue Jan 1 22:44:47 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 1 Jan 2008 22:44:47 -0500 (EST) Subject: [Win32utils-devel] [ win32utils-Bugs-16701 ] 0.6.0 x86-mswin32-60 gem is broken. Message-ID: <20080102034447.F318A18585BE@rubyforge.org> Bugs item #16701, was opened at 2007-12-29 22:06 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=16701&group_id=85 Category: win32-service Group: None >Status: Closed >Resolution: Accepted Priority: 3 Submitted By: Luis Lavena (luislavena) >Assigned to: Daniel Berger (djberg96) Summary: 0.6.0 x86-mswin32-60 gem is broken. Initial Comment: In the similar way of #16700, win32-service gem is broken too: --- !ruby/object:Gem::Specification name: win32-service version: !ruby/object:Gem::Version version: 0.6.0 platform: current authors: - Daniel J. Berger autorequire: bindir: bin cert_chain: [] I'm getting a lot of faulty reports of mongrel_service installation due this. Regards, Luis Lavena ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2008-01-01 20:44 Message: Ok, I killed two birds with one stone and put 0.6.1 tonight which fixed an obscure bug and updated some docs. Hopefully the newer gem is working now, too. If not, just reopen this ticket. Regards, Dan ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=16701&group_id=85 From nao16t at gmail.com Fri Jan 4 09:41:39 2008 From: nao16t at gmail.com (nao16t at gmail.com) Date: Fri, 4 Jan 2008 23:41:39 +0900 Subject: [Win32utils-devel] win32-api callback causes ruby to application error (crash). Message-ID: <5f5fd2840801040641s7e6200a2p69453ec5b4039938@mail.gmail.com> # I originally intended to post this question here. # But it took some time for subscription authorization process. # So I have posted the same question to the forum when I was waiting # for the subscription confirmation notice. # It seems to me the forum is not so active, let me drop here too. Hello, The following WinSNMP trap receive program 'win_snmp.rb' causes ruby interpreter to application error when the callback is invoked just after sending a trap by 'trapv2.rb'. This ruby program is written based on the WinSNMP C/C++ sample program at http://www.winsnmp.com/samples/c/cm_traps.c which works OK. So 'win_snmp.rb' should be OK, I think. Would someone please give me some advice ? My environment: Windows XP Pro SP2 with MS SNMP Agent and Trap Service. ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] win32-api (1.0.5) snmp (1.0.1) -----------start win_snmp.rb------------------- require 'win32/api' include Win32 SnmpStartup = API.new('SnmpStartup', 'PPPPP', 'L', 'Wsnmp32') SnmpGetLastError = API.new('SnmpGetLastError', 'L', 'L', 'Wsnmp32') SnmpCreateSession = API.new('SnmpCreateSession', 'LLKP', 'L', 'Wsnmp32') SnmpRegister = API.new('SnmpRegister', 'LLLLPL', 'L', 'Wsnmp32') nMajorVersion = 0.chr * 4 MinorVersion = 0.chr * 4 nTranslateMode = 0.chr * 4 nRetransmitMode = 0.chr * 4 nLevel = 0.chr * 4 result = SnmpStartup.call(nMajorVersion, MinorVersion, nLevel, nTranslateMode, nRetransmitMode) puts "SnmpStartup: #{result}" printf("nMajorVersion: %s MinorVersion: %s nLevel: %s nTranslateMode: %s nRetransmitMode: %s\n", nMajorVersion.unpack("L*"), MinorVersion.unpack("L*"), nLevel.unpack ("L*"), nTranslateMode.unpack("L*"), nRetransmitMode.unpack("L*")) puts "SnmpGetLastError: #{SnmpGetLastError.call(nil)}" SNMPAPI_CALLBACK = API::Callback.new('LLLLPP', 'L'){ |hSession, hWnd, wMsg, wParam, lParam, lpClientData| puts "Trap Recieved!" } session = SnmpCreateSession.call(nil, 0, SNMPAPI_CALLBACK, nil) puts "SnmpCreateSession: #{session}" puts "SnmpGetLastError: #{SnmpGetLastError.call(session)}" SNMPAPI_ON = 1 result = SnmpRegister.call(session, nil, nil, nil, nil, SNMPAPI_ON) puts "SnmpRegister: #{result}" puts "SnmpGetLastError: #{SnmpGetLastError.call(session)}" sleep(60) -----------end win_snmp.rb------------------- Console output of the win_snmp.rb: ------------------------------------------------ SnmpStartup: 1 nMajorVersion: 2 MinorVersion: 0 nLevel: 2 nTranslateMode: 1 nRetransmitMode: 1 SnmpGetLastError: 1 SnmpCreateSession: 1 SnmpGetLastError: 1 SnmpRegister: 1 SnmpGetLastError: 1 ------------------------------------------------ The following code is to send a SNMP trap. -----------start trapv2.rb------------------- require 'rubygems' require 'snmp' SNMP::Manager.open(:TrapPort => 162, :Version => :SNMPv2c) do |snmp| 1.times { |i| p i snmp.trap_v2(12345, "1.3.6.1", ["1.3.6.1.2", "1.3.6.1.3"]) } end -----------end trapv2.rb------------------- Thanks. -nao -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080104/372abf41/attachment.html From djberg96 at gmail.com Sat Jan 5 12:33:18 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Sat, 05 Jan 2008 10:33:18 -0700 Subject: [Win32utils-devel] win32-api callback causes ruby to application error (crash). In-Reply-To: <5f5fd2840801040641s7e6200a2p69453ec5b4039938@mail.gmail.com> References: <5f5fd2840801040641s7e6200a2p69453ec5b4039938@mail.gmail.com> Message-ID: <477FBF5E.1010409@gmail.com> Hi Nao, nao16t at gmail.com wrote: > # I originally intended to post this question here. > # But it took some time for subscription authorization process. > # So I have posted the same question to the forum when I was waiting > # for the subscription confirmation notice. > # It seems to me the forum is not so active, let me drop here too. That's fine. I monitor both. > SNMPAPI_CALLBACK = API::Callback.new('LLLLPP', 'L'){ |hSession, hWnd, > wMsg, wParam, lParam, lpClientData| > puts "Trap Recieved!" > } I haven't tested it, but shouldn't the 5th parameter be 'L'. The docs say lParam is a 32 bit identifier. Regards, Dan From nao16t at gmail.com Sun Jan 6 08:16:49 2008 From: nao16t at gmail.com (nao16t at gmail.com) Date: Sun, 6 Jan 2008 22:16:49 +0900 Subject: [Win32utils-devel] win32-api callback causes ruby to application error (crash). In-Reply-To: <477FBF5E.1010409@gmail.com> References: <5f5fd2840801040641s7e6200a2p69453ec5b4039938@mail.gmail.com> <477FBF5E.1010409@gmail.com> Message-ID: <5f5fd2840801060516p6a1a2ef2xc27c0358c3cb164e@mail.gmail.com> Dan-san, Thank you for finding out my careless mistake. Now the callback turned to be invoked. But still Ruby interpreter crashes inside the callback. Basically does the win32 callback run under the ruby main thread ? Isn't the win32 callback called by creating a new ruby thread ? If I call ruby "sleep()" at the bottom of code, the win32 callback is blocked until the ruby sleep returns. If I call win32 "Sleep()" at the bottom of code, ruby interpreter crushes inside the callback. How should the ruby mainthread wait for the asynchronous win32 callback ? I tried several work-arounds, but so far no luck. I commented out the lines what I did in the following code. Best regards, -nao require 'win32/api' include Win32 SNMPAPI_FAILURE = 0 SNMPAPI_SUCCESS = 1 SnmpStartup = API.new('SnmpStartup', 'PPPPP', 'L', 'Wsnmp32') SnmpGetLastError = API.new('SnmpGetLastError', 'L', 'L', 'Wsnmp32') SnmpCreateSession = API.new('SnmpCreateSession', 'LLKP', 'L', 'Wsnmp32') SnmpRegister = API.new('SnmpRegister', 'LLLLPL', 'L', 'Wsnmp32') SnmpRecvMsg = API.new('SnmpRecvMsg', 'LPPPP', 'L', 'Wsnmp32') SnmpGetPduData = API.new('SnmpGetPduData', 'LPPPPP', 'L', 'Wsnmp32') SnmpFreeVbl = API.new('SnmpFreeVbl','L', 'L', 'Wsnmp32') SnmpFreePdu = API.new('SnmpFreePdu', 'L', 'L', 'Wsnmp32') Sleep = API.new('Sleep', 'L', 'V') #th = Thread.new { nMajorVersion = 0.chr * 4 MinorVersion = 0.chr * 4 nTranslateMode = 0.chr * 4 nRetransmitMode = 0.chr * 4 nLevel = 0.chr * 4 result = SnmpStartup.call(nMajorVersion, MinorVersion, nLevel, nTranslateMode, nRetransmitMode) puts "SnmpStartup: #{result}" printf("nMajorVersion: %s MinorVersion: %s nLevel: %s nTranslateMode: %s nRetransmitMode: %s\n", nMajorVersion.unpack("L*"), MinorVersion.unpack("L*"), nLevel.unpack ("L*"), nTranslateMode.unpack("L*"), nRetransmitMode.unpack("L*")) puts "SnmpGetLastError: #{SnmpGetLastError.call(nil)}" SNMPAPI_CALLBACK = API::Callback.new('LLLLLP', 'L'){ |hSession, hWnd, wMsg, wParam, lParam, lpClientData| # Thread.new(hSession, hWnd, wMsg, wParam, lParam, lpClientData) {|hSession, hWnd, wMsg, wParam, lParam, lpClientData| hPdu = 0.chr * 4 lType = 0.chr * 4 lReqId = 0.chr * 4 lErr = 0.chr * 4 lIdx = 0.chr * 4 hVbl = 0.chr * 4 puts "Trap Recieved, start callback!" state = SnmpRecvMsg.call(hSession, nil, nil, nil, hPdu) puts "SnmpRecvMsg: #{state}" state = SnmpGetPduData.call(hPdu.pack("L*"), lType, lReqId, lErr, lIdx, hVbl) puts "SnmpGetPduData: #{state}" state = SnmpFreeVbl.call(hVbl.pack("L*")) puts "SnmpFreeVbl: #{state}" state = SnmpFreePdu.call(hPdu.pack("L*")) puts "SnmpFreePdu: #{state}" puts "Trap Recieved, end callback!" # } return(SNMPAPI_SUCCESS) } session = SnmpCreateSession.call(nil, 0, SNMPAPI_CALLBACK, nil) puts "SnmpCreateSession: #{session}" puts "SnmpGetLastError: #{SnmpGetLastError.call(session)}" SNMPAPI_ON = 1 result = SnmpRegister.call(session, nil, nil, nil, nil, SNMPAPI_ON) puts "SnmpRegister: #{result}" puts "SnmpGetLastError: #{SnmpGetLastError.call(session)}" #} #th.join #loop do # Thread.pass #end # Sleep.call(60000) #sleep(60) #60.times { # sleep(1) #} 2008/1/6, Daniel Berger : > > Hi Nao, > > nao16t at gmail.com wrote: > > # I originally intended to post this question here. > > # But it took some time for subscription authorization process. > > # So I have posted the same question to the forum when I was waiting > > # for the subscription confirmation notice. > > # It seems to me the forum is not so active, let me drop here too. > > That's fine. I monitor both. > > > > > SNMPAPI_CALLBACK = API::Callback.new('LLLLPP', 'L'){ |hSession, hWnd, > > wMsg, wParam, lParam, lpClientData| > > puts "Trap Recieved!" > > } > > I haven't tested it, but shouldn't the 5th parameter be 'L'. The docs > say lParam is a 32 bit identifier. > > Regards, > > Dan > _______________________________________________ > win32utils-devel mailing list > win32utils-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/win32utils-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080106/946e3fbc/attachment.html From djberg96 at gmail.com Sun Jan 6 08:41:02 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Sun, 06 Jan 2008 06:41:02 -0700 Subject: [Win32utils-devel] win32-api callback causes ruby to application error (crash). In-Reply-To: <5f5fd2840801060516p6a1a2ef2xc27c0358c3cb164e@mail.gmail.com> References: <5f5fd2840801040641s7e6200a2p69453ec5b4039938@mail.gmail.com> <477FBF5E.1010409@gmail.com> <5f5fd2840801060516p6a1a2ef2xc27c0358c3cb164e@mail.gmail.com> Message-ID: <4780DA6E.1080004@gmail.com> Hi, nao16t at gmail.com wrote: > Dan-san, > > Thank you for finding out my careless mistake. > Now the callback turned to be invoked. > > But still Ruby interpreter crashes inside the callback. > > Basically does the win32 callback run under the ruby main thread ? > Isn't the win32 callback called by creating a new ruby thread ? It runs in Ruby's main thread. Perhaps we should execute callbacks in their own Ruby thread. Does anyone else have any thoughts on this? It seems like a reasonable idea on the surface, but I may be missing deeper issues. > If I call ruby "sleep()" at the bottom of code, the win32 callback is > blocked until the ruby sleep returns. > > If I call win32 "Sleep()" at the bottom of code, ruby interpreter > crushes inside the callback. > > How should the ruby mainthread wait for the asynchronous win32 > callback ? > > I tried several work-arounds, but so far no luck. > I commented out the lines what I did in the following code. I'm on a business trip this week so I won't have much time to play with it until next week I'm afraid. Perhaps someone else on the list can give this a try and see what the issue is. Regards, Dan From nao16t at gmail.com Mon Jan 7 11:15:19 2008 From: nao16t at gmail.com (nao16t at gmail.com) Date: Tue, 8 Jan 2008 01:15:19 +0900 Subject: [Win32utils-devel] win32-api callback causes ruby to application error (crash). In-Reply-To: <4780DA6E.1080004@gmail.com> References: <5f5fd2840801040641s7e6200a2p69453ec5b4039938@mail.gmail.com> <477FBF5E.1010409@gmail.com> <5f5fd2840801060516p6a1a2ef2xc27c0358c3cb164e@mail.gmail.com> <4780DA6E.1080004@gmail.com> Message-ID: <5f5fd2840801070815i4a157de9hf0a39561892c98e0@mail.gmail.com> Hello all, & Dan-san, > It runs in Ruby's main thread. OK. Perhaps we should execute callbacks in > their own Ruby thread. Does anyone else have any thoughts on this? It > seems like a reasonable idea on the surface, but I may be missing deeper > issues. Ruby interpreter itself is single-threaded. But win32 callback is inherently multi-threaded. So I have no idea how win32-api C extension code should handle the win32 callback. In case of WinSNMP, is it better to write another C extension code somehow the win32 callback thread puts trap data into a queue, then ruby thread polls the queue ? Best regards, -nao -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080108/b96a1af4/attachment.html From djberg96 at gmail.com Sat Jan 12 14:36:20 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Sat, 12 Jan 2008 12:36:20 -0700 Subject: [Win32utils-devel] win32-taskscheduler and TaskScheduler#account_information Message-ID: <478916B4.1090605@gmail.com> Hi, This library has needed some work for a while, so I'm finally getting around to it. I've made some changes and updates in CVS, so grab the latest source to test the issue below. The first issue I'd like to tackle is why the TaskScheduler#account_information (GetAccountInformation) method fails if there's no user associated with a given task. The docs say it should return one of four values: http://msdn2.microsoft.com/en-us/library/aa381228.aspx In practice I would simply expect an empty string. But what I'm seeing is that it returns some bogus error number. Any ideas? Thanks, Dan From phasis at gmail.com Sat Jan 12 22:46:04 2008 From: phasis at gmail.com (Park Heesob) Date: Sun, 13 Jan 2008 12:46:04 +0900 Subject: [Win32utils-devel] win32-taskscheduler andTaskScheduler#account_information References: <478916B4.1090605@gmail.com> Message-ID: <000401c85596$d4812d30$9a7ba8c0@mycom> Hi, ----- Original Message ----- From: "Daniel Berger" To: "win32utils-devel" Sent: Sunday, January 13, 2008 4:36 AM Subject: [Win32utils-devel] win32-taskscheduler andTaskScheduler#account_information > Hi, > > This library has needed some work for a while, so I'm finally getting > around to it. I've made some changes and updates in CVS, so grab the > latest source to test the issue below. > > The first issue I'd like to tackle is why the > TaskScheduler#account_information (GetAccountInformation) method fails > if there's no user associated with a given task. > > The docs say it should return one of four values: > > http://msdn2.microsoft.com/en-us/library/aa381228.aspx > > In practice I would simply expect an empty string. But what I'm seeing > is that it returns some bogus error number. > I think the document is wrong. GetAccountInformation returns SCHED_E_ACCOUNT_INFORMATION_NOT_SET(0x8004130FL) when the account information is not set or not proper name/password. trigger = { "start_year" => 2009, "start_month" => 4, "start_day" => 11, "start_hour" => 7, "start_minute" => 14, "trigger_type" => TaskScheduler::DAILY, "type" => { "days_interval" => 1 } } ts = TaskScheduler.new("foo",trigger) ts.save #Get account information fails with 0x8004130FL: ts = TaskScheduler.new() ts.activate("foo") begin print ts.account_information rescue print "An error occurred: ",$!, "\n" end #After setting account information like this: ts = TaskScheduler.new() ts.activate("foo") ts.set_account_information("account","passwd") ts.save #Get account information works fine: ts = TaskScheduler.new() ts.activate("foo") begin print ts.account_information rescue print "An error occurred: ",$!, "\n" end > Any ideas? > > Thanks, > > Dan > Regards, Park Heesob From djberg96 at gmail.com Sun Jan 13 00:29:50 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Sat, 12 Jan 2008 22:29:50 -0700 Subject: [Win32utils-devel] win32-taskscheduler andTaskScheduler#account_information In-Reply-To: <000401c85596$d4812d30$9a7ba8c0@mycom> References: <478916B4.1090605@gmail.com> <000401c85596$d4812d30$9a7ba8c0@mycom> Message-ID: <4789A1CE.8070502@gmail.com> Park Heesob wrote: > Hi, > ----- Original Message ----- > From: "Daniel Berger" > To: "win32utils-devel" > Sent: Sunday, January 13, 2008 4:36 AM > Subject: [Win32utils-devel] win32-taskscheduler andTaskScheduler#account_information > > >> Hi, >> >> This library has needed some work for a while, so I'm finally getting >> around to it. I've made some changes and updates in CVS, so grab the >> latest source to test the issue below. >> >> The first issue I'd like to tackle is why the >> TaskScheduler#account_information (GetAccountInformation) method fails >> if there's no user associated with a given task. >> >> The docs say it should return one of four values: >> >> http://msdn2.microsoft.com/en-us/library/aa381228.aspx >> >> In practice I would simply expect an empty string. But what I'm seeing >> is that it returns some bogus error number. >> > I think the document is wrong. > GetAccountInformation returns SCHED_E_ACCOUNT_INFORMATION_NOT_SET(0x8004130FL) > when the account information is not set or not proper name/password. Ok, thanks. I've updated the method to return nil if that's the result. Regards, Dan From djberg96 at gmail.com Sun Jan 13 00:37:43 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Sat, 12 Jan 2008 22:37:43 -0700 Subject: [Win32utils-devel] TaskScheduler#active? and TaskScheduler#exists? Message-ID: <4789A3A7.5040009@gmail.com> Hi all, I think I would like to add the TaskScheduler#active? and TaskScheduler#exists? methods. I'm not sure how they should be implemented however. For TaskScheduler#exists? I suppose I could use the IEnumWorkItems and iterated over the list. Is there a better way? The TaskScheduler#active? would just tell me if a given task has been activated or not, but I'm not sure how to implement it. Suggestions? Thanks, Dan From djberg96 at gmail.com Sun Jan 13 00:52:58 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Sat, 12 Jan 2008 22:52:58 -0700 Subject: [Win32utils-devel] Pointer bug in win32-taskscheduler? Message-ID: <4789A73A.20007@gmail.com> Hi all, I thought this was strange: ts = TaskScheduler.new ts.new_work_item('foo', trigger) p ts.status ts.save p ts.status # null pointer (ts_get_status) I noticed that in the ts_save function in taskscheduler.c we're doing this at line 278: ptr->pITask->Release(); ptr->pITask = NULL; At first I thought this was a mistake but it looks like it's required. I think part of what's confusing me is that we're not encapsulating work items separately and that TaskScheduler#status only checks the currently active task. Maybe a separate TaskScheduler::Task class would be a good idea, though it would mean more work. Thoughts? Regards, Dan From phasis at gmail.com Sun Jan 13 01:12:50 2008 From: phasis at gmail.com (Heesob Park) Date: Sun, 13 Jan 2008 15:12:50 +0900 Subject: [Win32utils-devel] Pointer bug in win32-taskscheduler? In-Reply-To: <4789A73A.20007@gmail.com> References: <4789A73A.20007@gmail.com> Message-ID: Hi, 2008/1/13, Daniel Berger : > > Hi all, > > I thought this was strange: > > ts = TaskScheduler.new > ts.new_work_item('foo', trigger) > p ts.status > ts.save > p ts.status # null pointer (ts_get_status) > > I noticed that in the ts_save function in taskscheduler.c we're doing > this at line 278: > > ptr->pITask->Release(); > ptr->pITask = NULL; > > At first I thought this was a mistake but it looks like it's required. The active task can be chchecked with ptr->pITask. I think part of what's confusing me is that we're not encapsulating work > items separately and that TaskScheduler#status only checks the currently > active task. Maybe a separate TaskScheduler::Task class would be a good > idea, though it would mean more work. > > Thoughts? There are two categoris in TaskScheduler. Create a Task and Modify a Task. I think seperating two job is more reasonable. It might be helpful to refer Perl's approach. http://search.cpan.org/~unicolet/Win32-TaskScheduler2.0.3/TaskScheduler.pm Regards, > > Dan > > _______________________________________________ > win32utils-devel mailing list > win32utils-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/win32utils-devel > Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080113/9efd687e/attachment.html From Daniel.Berger at qwest.com Wed Jan 16 11:21:34 2008 From: Daniel.Berger at qwest.com (Berger, Daniel) Date: Wed, 16 Jan 2008 10:21:34 -0600 Subject: [Win32utils-devel] Problem with win32-open3 and net-ping Message-ID: <7524A45A1A5B264FA4809E2156496CFB023D2EA9@ITOMAE2KM01.AD.QINTRA.COM> Hi all, I'm seeing strange behavior with net-ping on Windows, which uses win32-open3 (Open3.popen3) behind the scenes. Download (or checkout) net-ping and run this: ruby -Ilib test\tc_pingexternal.rb It looks like the test suite is running twice. What's happening? Thanks, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. From phasis at gmail.com Wed Jan 16 19:58:03 2008 From: phasis at gmail.com (Heesob Park) Date: Thu, 17 Jan 2008 09:58:03 +0900 Subject: [Win32utils-devel] Problem with win32-open3 and net-ping In-Reply-To: <7524A45A1A5B264FA4809E2156496CFB023D2EA9@ITOMAE2KM01.AD.QINTRA.COM> References: <7524A45A1A5B264FA4809E2156496CFB023D2EA9@ITOMAE2KM01.AD.QINTRA.COM> Message-ID: Hi, 2008/1/17, Berger, Daniel : > Hi all, > > I'm seeing strange behavior with net-ping on Windows, which uses > win32-open3 (Open3.popen3) behind the scenes. > > Download (or checkout) net-ping and run this: > > ruby -Ilib test\tc_pingexternal.rb > > It looks like the test suite is running twice. What's happening? In my test with net-ping 1.2.1, Loaded suite test/tc_pingexternal Started ........... Finished in 7.438 seconds. 11 tests, 31 assertions, 0 failures, 0 errors What's the expected result? > Thanks, > > Dan Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080117/79bb52b5/attachment.html From djberg96 at gmail.com Wed Jan 16 22:06:47 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 16 Jan 2008 20:06:47 -0700 Subject: [Win32utils-devel] Problem with win32-open3 and net-ping In-Reply-To: References: <7524A45A1A5B264FA4809E2156496CFB023D2EA9@ITOMAE2KM01.AD.QINTRA.COM> Message-ID: <478EC647.5080404@gmail.com> Heesob Park wrote: > Hi, > > 2008/1/17, Berger, Daniel >: > > Hi all, > > I'm seeing strange behavior with net-ping on Windows, which uses > win32-open3 (Open3.popen3 ) behind the scenes. > > Download (or checkout) net-ping and run this: > > ruby -Ilib test\tc_pingexternal.rb > > It looks like the test suite is running twice. What's happening? > > > In my test with net-ping 1.2.1, > > > Loaded suite test/tc_pingexternal > Started > ........... > Finished in 7.438 seconds. > > 11 tests, 31 assertions, 0 failures, 0 errors > > What's the expected result? Ok, that's very strange. When I ran it last night it was as if it were running the tests twice. The first result was normal, then it ran the tests again, and a bunch failed. Now it's working fine. Come to think of it, I think this might be an issue with the Rakefile. Thanks, Dan From djberg96 at gmail.com Thu Jan 17 22:05:49 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 17 Jan 2008 20:05:49 -0700 Subject: [Win32utils-devel] Temporarily setting the output language for cmd.exe Message-ID: <4790178D.1030509@gmail.com> Hi all, One of the net-ping users reported that the Net::Ping::External library was returning false positives on Vista. Basically, it does a 'ping -n1 host' and checks for certain error strings. The problem is that the error strings it checks for are in English. The user in question is using a cmd.exe that's entirely in Swedish (I think). Is there any way I can temporarily set the language of the command console so that it emits English only? I tried setlocale() but that didn't work. Perhaps a registry setting somewhere? Or an explicit 'cmd /c' call with some other special option? Thanks, Dan From phasis at gmail.com Thu Jan 17 23:02:31 2008 From: phasis at gmail.com (Heesob Park) Date: Fri, 18 Jan 2008 13:02:31 +0900 Subject: [Win32utils-devel] Temporarily setting the output language for cmd.exe In-Reply-To: <4790178D.1030509@gmail.com> References: <4790178D.1030509@gmail.com> Message-ID: Hi, 2008/1/18, Daniel Berger : > > Hi all, > > One of the net-ping users reported that the Net::Ping::External library > was returning false positives on Vista. Basically, it does a 'ping -n1 > host' and checks for certain error strings. > > The problem is that the error strings it checks for are in English. The > user in question is using a cmd.exe that's entirely in Swedish (I think). > > Is there any way I can temporarily set the language of the command > console so that it emits English only? I tried setlocale() but that > didn't work. Perhaps a registry setting somewhere? Or an explicit 'cmd > /c' call with some other special option? > > Thanks, > > Dan In the cmd.exe console window, Run "chcp 437". Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080118/c7f96a1c/attachment.html From Daniel.Berger at qwest.com Fri Jan 18 10:34:41 2008 From: Daniel.Berger at qwest.com (Berger, Daniel) Date: Fri, 18 Jan 2008 09:34:41 -0600 Subject: [Win32utils-devel] Temporarily setting the output language forcmd.exe In-Reply-To: References: <4790178D.1030509@gmail.com> Message-ID: <7524A45A1A5B264FA4809E2156496CFB023D2EC8@ITOMAE2KM01.AD.QINTRA.COM> > -----Original Message----- > From: win32utils-devel-bounces at rubyforge.org > [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of > Heesob Park > Sent: Thursday, January 17, 2008 9:03 PM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] Temporarily setting the > output language forcmd.exe > > Hi, > > > 2008/1/18, Daniel Berger : > > Hi all, > > One of the net-ping users reported that the > Net::Ping::External library > was returning false positives on Vista. Basically, it > does a 'ping -n1 > host' and checks for certain error strings. > > The problem is that the error strings it checks for are > in English. The > user in question is using a cmd.exe that's entirely in > Swedish (I think). > > Is there any way I can temporarily set the language of > the command > console so that it emits English only? I tried > setlocale() but that > didn't work. Perhaps a registry setting somewhere? Or > an explicit 'cmd > /c' call with some other special option? > > Thanks, > > Dan > > > In the cmd.exe console window, Run "chcp 437". Hm, I've tried playing around with it, but it doesn't seem to change the language output of ping. However, that could very well have to do with the way this machine is configured. Heesob, does it work for you? I mean, do you have your console set to use Korean, but ping emits English for you if you do chcp 437 && ping -n1 www.ruby-lang.org? Thanks, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. From phasis at gmail.com Fri Jan 18 11:00:08 2008 From: phasis at gmail.com (Heesob Park) Date: Sat, 19 Jan 2008 01:00:08 +0900 Subject: [Win32utils-devel] Temporarily setting the output language forcmd.exe In-Reply-To: <7524A45A1A5B264FA4809E2156496CFB023D2EC8@ITOMAE2KM01.AD.QINTRA.COM> References: <4790178D.1030509@gmail.com> <7524A45A1A5B264FA4809E2156496CFB023D2EC8@ITOMAE2KM01.AD.QINTRA.COM> Message-ID: Hi, 2008/1/19, Berger, Daniel : > > > -----Original Message----- > > From: win32utils-devel-bounces at rubyforge.org > > [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of > > Heesob Park > > Sent: Thursday, January 17, 2008 9:03 PM > > To: Development and ideas for win32utils projects > > Subject: Re: [Win32utils-devel] Temporarily setting the > > output language forcmd.exe > > > > Hi, > > > > > > 2008/1/18, Daniel Berger : > > > > Hi all, > > > > One of the net-ping users reported that the > > Net::Ping::External library > > was returning false positives on Vista. Basically, it > > does a 'ping -n1 > > host' and checks for certain error strings. > > > > The problem is that the error strings it checks for are > > in English. The > > user in question is using a cmd.exe that's entirely in > > Swedish (I think). > > > > Is there any way I can temporarily set the language of > > the command > > console so that it emits English only? I tried > > setlocale() but that > > didn't work. Perhaps a registry setting somewhere? Or > > an explicit 'cmd > > /c' call with some other special option? > > > > Thanks, > > > > Dan > > > > > > In the cmd.exe console window, Run "chcp 437". > > Hm, I've tried playing around with it, but it doesn't seem to change the > language output of ping. However, that could very well have to do with > the way this machine is configured. > > Heesob, does it work for you? I mean, do you have your console set to > use Korean, but ping emits English for you if you do chcp 437 && ping > -n1 www.ruby-lang.org? > > Thanks, > > Dan > > > This communication is the property of Qwest and may contain confidential > or > privileged information. Unauthorized use of this communication is strictly > prohibited and may be unlawful. If you have received this communication > in error, please immediately notify the sender by reply e-mail and destroy > > all copies of the communication and any attachments. > _______________________________________________ > win32utils-devel mailing list > win32utils-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/win32utils-devel > In my XP Prof, ping alway emits English whatsoever code page. But in my Vista, ping emit different message for each code page. chcp 437 && ping -n1 www.ruby-lang.org emits: Active code page: 437 Pinging carbon.ruby-lang.org [221.186.184.68] with 32 bytes of data: Reply from 221.186.184.68: bytes=32 time=287ms TTL=39 Ping statistics for 221.186.184.68: Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 287ms, Maximum = 287ms, Average = 287ms Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080119/222a93c7/attachment-0001.html From Daniel.Berger at qwest.com Fri Jan 18 12:49:01 2008 From: Daniel.Berger at qwest.com (Berger, Daniel) Date: Fri, 18 Jan 2008 11:49:01 -0600 Subject: [Win32utils-devel] Temporarily setting the output languageforcmd.exe In-Reply-To: References: <4790178D.1030509@gmail.com><7524A45A1A5B264FA4809E2156496CFB023D2EC8@ITOMAE2KM01.AD.QINTRA.COM> Message-ID: <7524A45A1A5B264FA4809E2156496CFB023D2ED1@ITOMAE2KM01.AD.QINTRA.COM> > In my XP Prof, ping alway emits English whatsoever code page. > But in my Vista, ping emit different message for each code page. > > chcp 437 && ping -n1 www.ruby-lang.org emits: > > Active code page: 437 > > Pinging carbon.ruby-lang.org [221.186.184.68] with 32 bytes of data: > > Reply from 221.186.184.68: bytes=32 time=287ms TTL=39 > > Ping statistics for 221.186.184.68: > Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), > Approximate round trip times in milli-seconds: > Minimum = 287ms, Maximum = 287ms, Average = 287ms Ah, thanks. Here's another question. Why, if I set the code page to 437, does GetACP() return 1252? C:\Documents and Settings\djberge>chcp 437 Active code page: 437 C:\Documents and Settings\djberge>irb irb(main):001:0> require 'windows/national' => true irb(main):002:0> include Windows::National => Object irb(main):003:0> GetACP() => 1252 I realise 1252 is "Latin 1" while 437 is "United States", but I'm curious why they're different here. Am I confusing two different things? Thanks, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. From djberg96 at gmail.com Fri Jan 18 20:27:33 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Fri, 18 Jan 2008 18:27:33 -0700 Subject: [Win32utils-devel] Temporarily setting the output languageforcmd.exe In-Reply-To: <7524A45A1A5B264FA4809E2156496CFB023D2ED1@ITOMAE2KM01.AD.QINTRA.COM> References: <4790178D.1030509@gmail.com><7524A45A1A5B264FA4809E2156496CFB023D2EC8@ITOMAE2KM01.AD.QINTRA.COM> <7524A45A1A5B264FA4809E2156496CFB023D2ED1@ITOMAE2KM01.AD.QINTRA.COM> Message-ID: <47915205.2040502@gmail.com> Berger, Daniel wrote: > > >> In my XP Prof, ping alway emits English whatsoever code page. >> But in my Vista, ping emit different message for each code page. >> >> chcp 437 && ping -n1 www.ruby-lang.org emits: >> >> Active code page: 437 >> >> Pinging carbon.ruby-lang.org [221.186.184.68] with 32 bytes of data: >> >> Reply from 221.186.184.68: bytes=32 time=287ms TTL=39 >> >> Ping statistics for 221.186.184.68: >> Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), >> Approximate round trip times in milli-seconds: >> Minimum = 287ms, Maximum = 287ms, Average = 287ms > > Ah, thanks. > > Here's another question. Why, if I set the code page to 437, does > GetACP() return 1252? > > C:\Documents and Settings\djberge>chcp 437 > Active code page: 437 > > C:\Documents and Settings\djberge>irb > irb(main):001:0> require 'windows/national' > => true > irb(main):002:0> include Windows::National > => Object > irb(main):003:0> GetACP() > => 1252 > > I realise 1252 is "Latin 1" while 437 is "United States", but I'm > curious why they're different here. Am I confusing two different things? Whoops, nvermind. You have to use GetConsoleCP() to get the console code page. GetACP() returns the system code page. Regards, Dan From djberg96 at gmail.com Sun Jan 20 09:05:37 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Sun, 20 Jan 2008 07:05:37 -0700 Subject: [Win32utils-devel] Ctrl handler makes Ruby crash Message-ID: <47935531.4070708@gmail.com> Hi all, Grab the latest windows-pr from CVS and try this program. It works...once. Then the interpreter crashes. Why? And what can we do about it? The code is based on this: http://msdn2.microsoft.com/en-us/library/ms685049(VS.85).aspx require 'windows/console' require 'windows/sound' include Windows::Console include Windows::Sound CtrlHandler = Win32::API::Callback.new('L', 'I'){ |ctrl_type| case ctrl_type when CTRL_C_EVENT puts "Ctrl-C event" Beep(750, 300) return true when CTRL_CLOSE_EVENT Beep(600, 200) puts "Ctrl-Close event" return true when CTRL_BREAK_EVENT Beep(900, 200) puts "Ctrl-Break event" return false when CTRL_LOGOFF_EVENT Beep(1000, 200) puts "Ctrl-Logoff event" return false when CTRL_SHUTDOWN_EVENT Beep(750, 500) puts("Ctrl-Shutdown event") return false else return false end } if SetConsoleCtrlHandler(CtrlHandler, TRUE) printf( "\nThe Control Handler is installed.\n" ) printf( "\n -- Now try pressing Ctrl+C or Ctrl+Break, or" ) printf( "\n try logging off or closing the console...\n" ) printf( "\n(...waiting in a loop for events...)\n\n" ) while true end else printf( "\nERROR: Could not set control handler") end Thanks, Dan From djberg96 at gmail.com Sun Jan 20 14:09:15 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Sun, 20 Jan 2008 12:09:15 -0700 Subject: [Win32utils-devel] win32-api callback causes ruby to application error (crash). In-Reply-To: <5f5fd2840801070815i4a157de9hf0a39561892c98e0@mail.gmail.com> References: <5f5fd2840801040641s7e6200a2p69453ec5b4039938@mail.gmail.com> <477FBF5E.1010409@gmail.com> <5f5fd2840801060516p6a1a2ef2xc27c0358c3cb164e@mail.gmail.com> <4780DA6E.1080004@gmail.com> <5f5fd2840801070815i4a157de9hf0a39561892c98e0@mail.gmail.com> Message-ID: <47939C5B.4030502@gmail.com> nao16t at gmail.com wrote: > Hello all, & Dan-san, > > > It runs in Ruby's main thread. > > > OK. > > Perhaps we should execute callbacks in > their own Ruby thread. Does anyone else have any thoughts on this? It > seems like a reasonable idea on the surface, but I may be missing deeper > issues. > > > Ruby interpreter itself is single-threaded. > But win32 callback is inherently multi-threaded. > So I have no idea how win32-api C extension code should handle the win32 > callback. > In case of WinSNMP, is it better to write another C extension code > somehow the win32 callback thread puts trap data into a queue, then ruby > thread polls the queue ? After today's experiment with SetConsoleCtrlHandler() I'm not so sure this is possible to solve with Ruby 1.8.x. We may have hit a wall here. This is bad. If anyone has any ideas, please help! Thanks, Dan From noreply at rubyforge.org Tue Jan 22 03:53:18 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 22 Jan 2008 03:53:18 -0500 (EST) Subject: [Win32utils-devel] [ win32utils-Bugs-17395 ] Cannot install win32-api gem Message-ID: <20080122085318.E1360185867E@rubyforge.org> Bugs item #17395, was opened at 2008-01-22 03:53 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=17395&group_id=85 Category: win32-api Group: None Status: Open Resolution: None Priority: 3 Submitted By: Nobody (None) Assigned to: Nobody (None) Summary: Cannot install win32-api gem Initial Comment: Hi, I use cygwin (version 1.90) on windows XP professional workstation and ruby (1.8.6 (2007-03-13 patchlevel 0) [i386-cygwin]) When I try to install win32-api-1.0.5, I have the following message error. Any help, please. /usr/lib/ruby/gems/1.8/gems/win32-api-1.0.5/ext/win32/api.c:201: undefined reference to `__tcscmp' collect2: ld returned 1 exit status make: *** [api.so] Error 1 Thankshttp://rubyforge.org/account/login.php?return_to=%2Ftracker%2F%3Ffunc%3Dadd%26group_id%3D85%26atid%3D411 login ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=17395&group_id=85 From Daniel.Berger at qwest.com Wed Jan 23 14:15:19 2008 From: Daniel.Berger at qwest.com (Berger, Daniel) Date: Wed, 23 Jan 2008 13:15:19 -0600 Subject: [Win32utils-devel] JRuby and callbacks? Message-ID: <7524A45A1A5B264FA4809E2156496CFB023D2EFF@ITOMAE2KM01.AD.QINTRA.COM> Hi all, Any Java/JRuby folks on the list? I'd like to see if we can implement api.c for JRuby using JNA and see how it handles the callbacks. I'm not a Java guy, nor do I know JNA, but I'll take a stab at it if no one else on the list does. Here are a couple of useful links: http://www.infoq.com/news/2007/09/jna-jruby https://jna.dev.java.net/ Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. From phasis at gmail.com Wed Jan 23 20:07:07 2008 From: phasis at gmail.com (Heesob Park) Date: Thu, 24 Jan 2008 10:07:07 +0900 Subject: [Win32utils-devel] JRuby and callbacks? In-Reply-To: <7524A45A1A5B264FA4809E2156496CFB023D2EFF@ITOMAE2KM01.AD.QINTRA.COM> References: <7524A45A1A5B264FA4809E2156496CFB023D2EFF@ITOMAE2KM01.AD.QINTRA.COM> Message-ID: Hi, 2008/1/24, Berger, Daniel : > Hi all, > > Any Java/JRuby folks on the list? I'd like to see if we can implement > api.c for JRuby using JNA and see how it handles the callbacks. What's the status of JRuby? Is it stable and fast enough? > I'm not a Java guy, nor do I know JNA, but I'll take a stab at it if no > one else on the list does. I will take another stab at it if no other else on the list does:) > Here are a couple of useful links: > > http://www.infoq.com/news/2007/09/jna-jruby > https://jna.dev.java.net/ > > Regards, > > Dan > > > This communication is the property of Qwest and may contain confidential > or > privileged information. Unauthorized use of this communication is strictly > prohibited and may be unlawful. If you have received this communication > in error, please immediately notify the sender by reply e-mail and destroy > all copies of the communication and any attachments. > _______________________________________________ > win32utils-devel mailing list > win32utils-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/win32utils-devel > Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080124/8188209c/attachment.html From djberg96 at gmail.com Wed Jan 23 20:41:33 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 23 Jan 2008 18:41:33 -0700 Subject: [Win32utils-devel] JRuby and callbacks? In-Reply-To: References: <7524A45A1A5B264FA4809E2156496CFB023D2EFF@ITOMAE2KM01.AD.QINTRA.COM> Message-ID: <4797ECCD.3070806@gmail.com> Heesob Park wrote: > Hi, > > 2008/1/24, Berger, Daniel >: > > Hi all, > > Any Java/JRuby folks on the list? I'd like to see if we can implement > api.c for JRuby using JNA and see how it handles the callbacks. > > > What's the status of JRuby? Is it stable and fast enough? It's coming along, but there are a lot of bugs left. I wouldn't use it in production yet. I also haven't seen any memory profiling. > > I'm not a Java guy, nor do I know JNA, but I'll take a stab at it if no > one else on the list does. > > > I will take another stab at it if no other else on the list does:) If you can get it to work, great. Otherwise, this might be the time to fork Ruby, as I have no love for 1.9. Regards, Dan From phasis at gmail.com Wed Jan 23 21:00:51 2008 From: phasis at gmail.com (Heesob Park) Date: Thu, 24 Jan 2008 11:00:51 +0900 Subject: [Win32utils-devel] JRuby and callbacks? In-Reply-To: <4797ECCD.3070806@gmail.com> References: <7524A45A1A5B264FA4809E2156496CFB023D2EFF@ITOMAE2KM01.AD.QINTRA.COM> <4797ECCD.3070806@gmail.com> Message-ID: 2008/1/24, Daniel Berger : > > Heesob Park wrote: > > Hi, > > > > 2008/1/24, Berger, Daniel > >: > > > > Hi all, > > > > Any Java/JRuby folks on the list? I'd like to see if we can > implement > > api.c for JRuby using JNA and see how it handles the callbacks. > > > > > > What's the status of JRuby? Is it stable and fast enough? > > It's coming along, but there are a lot of bugs left. I wouldn't use it > in production yet. I also haven't seen any memory profiling. > > > > > I'm not a Java guy, nor do I know JNA, but I'll take a stab at it if > no > > one else on the list does. > > > > > > I will take another stab at it if no other else on the list does:) > > If you can get it to work, great. Otherwise, this might be the time to > fork Ruby, as I have no love for 1.9. Then you might be the creater of Ruby++ or Ruby# :) Did you have any idea about native threading, garbage collection and byte code compiler? Regards, > > Dan > _______________________________________________ > win32utils-devel mailing list > win32utils-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/win32utils-devel Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080124/130868b3/attachment-0001.html From djberg96 at gmail.com Wed Jan 23 21:17:15 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 23 Jan 2008 19:17:15 -0700 Subject: [Win32utils-devel] JRuby and callbacks? In-Reply-To: References: <7524A45A1A5B264FA4809E2156496CFB023D2EFF@ITOMAE2KM01.AD.QINTRA.COM> <4797ECCD.3070806@gmail.com> Message-ID: <4797F52B.9000709@gmail.com> Heesob Park wrote: > > > 2008/1/24, Daniel Berger >: > > Heesob Park wrote: > > Hi, > > > > 2008/1/24, Berger, Daniel < Daniel.Berger at qwest.com > > > >>: > > > > Hi all, > > > > Any Java/JRuby folks on the list? I'd like to see if we can > implement > > api.c for JRuby using JNA and see how it handles the callbacks. > > > > > > What's the status of JRuby? Is it stable and fast enough? > > It's coming along, but there are a lot of bugs left. I wouldn't use it > in production yet. I also haven't seen any memory profiling. > > > > > I'm not a Java guy, nor do I know JNA, but I'll take a stab > at it if no > > one else on the list does. > > > > > > I will take another stab at it if no other else on the list does:) > > If you can get it to work, great. Otherwise, this might be the time to > fork Ruby, as I have no love for 1.9. > > > Then you might be the creater of Ruby++ or Ruby# :) > Did you have any idea about native threading, garbage collection and > byte code compiler? Ruby# has a name. It's called "IronRuby". :) I'd use C++. I like Ruby++. :) Native threads - I only know I want them, but I'm not sure how to go about altering the interpreter to make it possible to use native threads. Also, I want both native _and_ green threads. Most of the time green threads are good enough. It's really only for embedding and extending that native threads become necessary. Garbage collection - What little research I've done on it suggests that generational garbage collection is ideal. I don't know how to implement it, though. Byte code compiler - No thoughts on this currently. In all cases, I'm not sure what advantages using C++ over C would provide both in terms of general capabilities (functors, default arguments, etc) and possible use of the STL or 3rd party libraries. I'd like to get venture capital (funding) if I'm going to do this, though. Doing this as a side project will be very hard. Regards, Dan From phasis at gmail.com Wed Jan 23 21:42:04 2008 From: phasis at gmail.com (Heesob Park) Date: Thu, 24 Jan 2008 11:42:04 +0900 Subject: [Win32utils-devel] JRuby and callbacks? In-Reply-To: <4797F52B.9000709@gmail.com> References: <7524A45A1A5B264FA4809E2156496CFB023D2EFF@ITOMAE2KM01.AD.QINTRA.COM> <4797ECCD.3070806@gmail.com> <4797F52B.9000709@gmail.com> Message-ID: 2008/1/24, Daniel Berger : > > Heesob Park wrote: > > > > > > 2008/1/24, Daniel Berger >>: > > > > Heesob Park wrote: > > > Hi, > > > > > > 2008/1/24, Berger, Daniel < Daniel.Berger at qwest.com > > > > > >>>: > > > > > > Hi all, > > > > > > Any Java/JRuby folks on the list? I'd like to see if we can > > implement > > > api.c for JRuby using JNA and see how it handles the > callbacks. > > > > > > > > > What's the status of JRuby? Is it stable and fast enough? > > > > It's coming along, but there are a lot of bugs left. I wouldn't use > it > > in production yet. I also haven't seen any memory profiling. > > > > > > > > I'm not a Java guy, nor do I know JNA, but I'll take a stab > > at it if no > > > one else on the list does. > > > > > > > > > I will take another stab at it if no other else on the list > does:) > > > > If you can get it to work, great. Otherwise, this might be the time > to > > fork Ruby, as I have no love for 1.9. > > > > > > Then you might be the creater of Ruby++ or Ruby# :) > > Did you have any idea about native threading, garbage collection and > > byte code compiler? > > Ruby# has a name. It's called "IronRuby". :) > > I'd use C++. I like Ruby++. :) > > Native threads - I only know I want them, but I'm not sure how to go > about altering the interpreter to make it possible to use native > threads. Also, I want both native _and_ green threads. Most of the time > green threads are good enough. It's really only for embedding and > extending that native threads become necessary. > > Garbage collection - What little research I've done on it suggests that > generational garbage collection is ideal. I don't know how to implement > it, though. > > Byte code compiler - No thoughts on this currently. > > In all cases, I'm not sure what advantages using C++ over C would > provide both in terms of general capabilities (functors, default > arguments, etc) and possible use of the STL or 3rd party libraries. > > I'd like to get venture capital (funding) if I'm going to do this, > though. Doing this as a side project will be very hard. OK, that's good idea. Before going to the serious consideration, I'd like to implement plugin library to support native threads on the current win32 platform Ruby. Regards, > > Dan Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080124/7c0dca02/attachment.html From djberg96 at gmail.com Wed Jan 23 21:51:34 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 23 Jan 2008 19:51:34 -0700 Subject: [Win32utils-devel] JRuby and callbacks? In-Reply-To: References: <7524A45A1A5B264FA4809E2156496CFB023D2EFF@ITOMAE2KM01.AD.QINTRA.COM> <4797ECCD.3070806@gmail.com> <4797F52B.9000709@gmail.com> Message-ID: <4797FD36.4060905@gmail.com> Heesob Park wrote: > I'd like to get venture capital (funding) if I'm going to do this, > though. Doing this as a side project will be very hard. > > > OK, that's good idea. > Before going to the serious consideration, I'd like to implement plugin > library to support native threads > on the current win32 platform Ruby. For 1.8.x? Oh, please do. That would be excellent. Thanks, Dan From djberg96 at gmail.com Thu Jan 24 00:09:00 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 23 Jan 2008 22:09:00 -0700 Subject: [Win32utils-devel] JRuby, JNA, Windows Message-ID: <47981D6C.9030302@gmail.com> Hi all, Here's a short example of how to interface with JRuby and the Windows API I thought I'd share: require 'java' # LoadLibrary() Kernel32 = com.sun.jna.NativeLibrary.getInstance("kernel32") # GetProcAddress() GetCurrentDirectoryA = Kernel32.getFunction('GetCurrentDirectoryA') # You can also do -> buf = java.nio.ByteBuffer.allocate(256) buf = Array.new(256).to_java(:byte) GetCurrentDirectoryA.invokeInt([256, buf].to_java) buf = java.lang.String.new(buf) p buf.to_s.strip It's a little clunkier than MRI at the moment, because Java strings are immutable. We're passing by reference, so we have to pass a ByteBuffer instead, and convert back and forth. Charles tells me that this will be hopefully be more seamless in the future. You could always monkey patch the String class, too. But, on the whole, not bad. I'll probably do a little writeup about it on the O'Reilly blog soon. Regards, Dan From djberg96 at gmail.com Sat Jan 26 12:40:44 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Sat, 26 Jan 2008 10:40:44 -0700 Subject: [Win32utils-devel] JRuby version of win32-api - initial try Message-ID: <479B709C.4010203@gmail.com> Hi all, I've got a preliminary JRuby version of win32-api checked into CVS at the moment under win32-api/lib/win32/api.rb. I've also pasted it below. It doesn't quite work right in that I can't get it to modify the arguments in place in the API#call method. Take a look at the sample code at the very bottom to see what I mean. I haven't even tried adding callback support yet. If anyone is interested in taking a stab at it I would greatly appreciate it! Regards, Dan require 'java' # The Win32 module serves as a namespace only. module Win32 class API class Error < StandardError; end private KERNEL32 = com.sun.jna.NativeLibrary.getInstance('kernel32') LoadLibrary = KERNEL32.getFunction('LoadLibraryA') GetProcAddress = KERNEL32.getFunction('GetProcAddress') FormatMessageA = KERNEL32.getFunction('FormatMessageA') LocalFree = KERNEL32.getFunction('LocalFree') public VERSION = '1.0.6' attr_reader :function_name attr_reader :prototype attr_reader :return_type attr_reader :dll_name def initialize(function, prototype='V', return_type='L', dll='kernel32') # Convert a prototype string to an array of characters if prototype.respond_to?(:split) prototype = prototype.split('') end # Set an arbitrary limit of 16 parameters if prototype.length > 16 raise ArgumentError, "too many parameters: " + prototype.length end dll.downcase! prototype = 'V' if prototype.nil? || prototype.empty? return_type = 'L' if return_type.nil? || return_type.empty? dll = 'kernel32' if dll.nil? || dll.empty? prototype.each do |proto| unless ['I', 'L', 'P','B','K'].include?(proto) raise ArgumentError, "illegal prototype '#{proto}'" end end @function_name = function @prototype = prototype @return_type = return_type @dll_name = dll if dll == 'kernel32' @dll = KERNEL32 else @dll = com.sun.jna.NativeLibrary.getInstance(@dll_name) end @library = LoadLibrary.invokeInt([@dll_name].to_java) if @library.nil? || @library == 0 raise Error, "LoadLibrary() function failed for '#{@dll_name}'" end @func = GetProcAddress.invokeInt([@library, @function_name].to_java) if $KCODE == 'UTF8' first, last = 'W', 'A' else first, last = 'A', 'W' end # Try the original function, then the ANSI version, then Wide version. # Try the Wide version first if $KCODE is set to UTF8. #-- # Unlike the C version we won't be using the FARPROC. This is mostly # for validation because the JNA function can't be rescued directly. if @func == 0 @function_name += first @func = GetProcAddress.invokeInt([@library, @function_name].to_java) if @func == 0 @function_name[-1,1] = last @func = GetProcAddress.invokeInt([@library, @function_name].to_java) if @func == 0 raise Error, 'GetProcAddress failed' end end end # Now, turn @func into a Java::ComSunJna::Function object that we can # call later @func = @dll.getFunction(@function_name) end def call(*args) params = [] # For void prototypes, allow either no args or an explicit nil. # Otherwise, if the prototype length and the argument length don't # match, raise an error. if @prototype.length != args.length if @prototype[0] == 'V' args = [nil] else err = "wrong number of parameters: expected " err += "#{@prototype.length}, got #{args.length}" raise ArgumentError, err end end # Consider any string that starts with a "\0" to be a byte buffer # and convert it automatically. This is necessary because Java # strings are immutable. args.each_with_index do |arg, i| if arg.is_a?(String) && arg[0,1] == "\0" args[i, 1] = java.nio.ByteBuffer.allocate(arg.length) end end args = [*args].to_java # Call the proper JNA invocation based on the return type case @return_type when 'P' rv = @func.invokePointer(args) when 'L' rv = @func.invokeLong(args) when 'I', 'B' rv = @func.invokeInt(args) when 'V' rv = nil else rv = 0 end args = args.map{ |e| if e.respond_to?(:array) e = String.from_java_bytes(e.array) else e end } rv end end end if $0 == __FILE__ include Win32 GetCurrentDirectoryA = API.new('GetCurrentDirectoryA', 'LP', 'L', 'kernel32') buf = 0.chr * 70 p GetCurrentDirectoryA.call(buf.length, buf) puts buf # => NOT WORKING end From djberg96 at gmail.com Sat Jan 26 12:53:42 2008 From: djberg96 at gmail.com (Daniel Berger) Date: Sat, 26 Jan 2008 10:53:42 -0700 Subject: [Win32utils-devel] Rice Message-ID: <479B73A6.1020405@gmail.com> Check this out: http://rice.rubyforge.org/ Regards, Dan From waynev at gmail.com Sat Jan 26 13:52:57 2008 From: waynev at gmail.com (Wayne Vucenic) Date: Sat, 26 Jan 2008 10:52:57 -0800 Subject: [Win32utils-devel] Rice In-Reply-To: <479B73A6.1020405@gmail.com> References: <479B73A6.1020405@gmail.com> Message-ID: <88c9ce410801261052j7b0c620fx61e132b641278388@mail.gmail.com> Hi Dan, Thanks for the pointer. This looks really good. I was puzzled by the many references to the "Ruby VM" on the home page: "This object will later be re-raised as a Ruby exception when control is returned to the Ruby VM.Rice uses a similar class called Jump_Tag to handle symbols thrown by Ruby's throw/catch or other non-local jumps from inside the Ruby VM." I didn't see anywhere which versions of Ruby Rice works with. All the talk of VMs makes me wonder if it only works with 1.9.x??? Wayne On Jan 26, 2008 9:53 AM, Daniel Berger wrote: > Check this out: > > http://rice.rubyforge.org/ > > Regards, > > Dan > _______________________________________________ > win32utils-devel mailing list > win32utils-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/win32utils-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20080126/f3ce6b1b/attachment-0001.html From Daniel.Berger at qwest.com Mon Jan 28 10:03:36 2008 From: Daniel.Berger at qwest.com (Berger, Daniel) Date: Mon, 28 Jan 2008 09:03:36 -0600 Subject: [Win32utils-devel] Rice In-Reply-To: <88c9ce410801261052j7b0c620fx61e132b641278388@mail.gmail.com> References: <479B73A6.1020405@gmail.com> <88c9ce410801261052j7b0c620fx61e132b641278388@mail.gmail.com> Message-ID: <7524A45A1A5B264FA4809E2156496CFB023D2F15@ITOMAE2KM01.AD.QINTRA.COM> Hi Wayne, That's a good question. Unfortunately I realized after I posted that there was no download file. My attempt to build it from source (on my Mac) also failed, so I can't say for sure. I'll have to bug Paul to see what the status is. Dan > -----Original Message----- > From: win32utils-devel-bounces at rubyforge.org > [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of > Wayne Vucenic > Sent: Saturday, January 26, 2008 11:53 AM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] Rice > > Hi Dan, > > Thanks for the pointer. This looks really good. > > I was puzzled by the many references to the "Ruby VM" on the > home page: > > "This object will later be re-raised as a Ruby exception when > control is returned to the Ruby VM.Rice uses a similar class > called Jump_Tag to handle symbols thrown by Ruby's > throw/catch or other non-local jumps from inside the Ruby VM." > > I didn't see anywhere which versions of Ruby Rice works with. > All the talk of VMs makes me wonder if it only works with 1.9.x??? > > Wayne > > > > > > On Jan 26, 2008 9:53 AM, Daniel Berger wrote: > > > Check this out: > > http://rice.rubyforge.org/ > > Regards, > > Dan > _______________________________________________ > win32utils-devel mailing list > win32utils-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/win32utils-devel > > > > This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.