From djberg96 at gmail.com Sun Aug 21 19:07:55 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Sun, 21 Aug 2011 17:07:55 -0600 Subject: [Win32utils-devel] Demo daemon failure with mingw Message-ID: <001e01cc6057$2afdd040$80f970c0$@com> Hi, I'm having some trouble with mingw and win32-service. Ruby 1.8.7 p330 (mingw) Windows Vista >ruby demo_daemon.rb install >ruby demo_daemon.rb start Result: c:\>tail -f win32_daemon_test.log 1 2 3 4 5 6 7 8 9 Daemon failure: Service_Main thread exited abnormally Using a version compile with VC9 works as expected, however. Any ideas? I'm not using seh.h btw. Regards, Dan From djberg96 at gmail.com Mon Aug 22 13:30:05 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Mon, 22 Aug 2011 11:30:05 -0600 Subject: [Win32utils-devel] Building win32-service with seh Message-ID: <003101cc60f1$2392a660$6ab7f320$@com> Hm, getting this when I try to build with seh.h: c:\Users\djberge\Repositories\win32-service\ext>make gcc -I. -I. -IC:/Ruby187/lib/ruby/1.8/i386-mingw32 -I. -DHAVE_REGISTERSERVICECTRLHANDLEREX -DHAVE_SE H_H -Ic:\usr\libseh -g -O2 -DFD_SETSIZE=256 -c win32/daemon.c win32/daemon.c: In function 'Ruby_Service_Ctrl': win32/daemon.c:203:1: error: expected 'while' before 'void' win32/daemon.c:612:1: error: expected declaration or statement at end of input win32/daemon.c:612:1: error: expected declaration or statement at end of input make: *** [daemon.o] Error 1 Dan From djberg96 at gmail.com Mon Aug 22 14:16:25 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Mon, 22 Aug 2011 12:16:25 -0600 Subject: [Win32utils-devel] Pure Ruby TCP Daemon Message-ID: <003201cc60f7$9c9ceba0$d5d6c2e0$@com> Hi all, I created a "pure" branch on github that uses the code Heesob posted a while back: http://rubyforge.org/pipermail/win32utils-devel/2008-November/001274.html However, I couldn't make it work on my Vista laptop. c:\Users\djberge\Repositories\win32-service\examples>ruby demo_daemon_ctl.rb start VERSION: 0.8.0 C:/Ruby187/lib/ruby/gems/1.8/gems/win32-service-0.8.0/lib/win32/service.rb:7 53:in `start': The servi ce did not respond to the start or control request in a timely fashion. (Win32::Service::Error) from demo_daemon_ctl.rb:68 I also tried with Ruby 1.9/mingw. Same result. Details from the event log: - System - Provider [ Name] Service Control Manager [ Guid] {555908D1-A6D7-4695-8E1E-26931D2012F4} [ EventSourceName] Service Control Manager - EventID 7000 [ Qualifiers] 49152 Version 0 Level 2 Task 0 Opcode 0 Keywords 0x80000000000000 - TimeCreated [ SystemTime] 2011-08-22T18:11:33.000Z EventRecordID 154734 Correlation - Execution [ ProcessID] 0 [ ThreadID] 0 Channel System Computer imperator Security - EventData param1 Demo param2 %%1053 Only thing that looks odd is "param2", though I don't know if that's significant anyway. Any ideas? Regards, Dan From djberg96 at gmail.com Mon Aug 22 16:34:22 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Mon, 22 Aug 2011 14:34:22 -0600 Subject: [Win32utils-devel] Pure Ruby TCP Daemon In-Reply-To: <003201cc60f7$9c9ceba0$d5d6c2e0$@com> References: <003201cc60f7$9c9ceba0$d5d6c2e0$@com> Message-ID: On Mon, Aug 22, 2011 at 12:16 PM, Daniel Berger wrote: > Hi all, > > I created a "pure" branch on github that uses the code Heesob posted a while > back: > > http://rubyforge.org/pipermail/win32utils-devel/2008-November/001274.html > > However, I couldn't make it work on my Vista laptop. > > c:\Users\djberge\Repositories\win32-service\examples>ruby demo_daemon_ctl.rb > start > VERSION: 0.8.0 > C:/Ruby187/lib/ruby/gems/1.8/gems/win32-service-0.8.0/lib/win32/service.rb:7 > 53:in `start': The servi > ce did not respond to the start or control request in a timely fashion. > (Win32::Service::Error) > ? ? ? ?from demo_daemon_ctl.rb:68 Same result with this code: http://rubyforge.org/pipermail/win32utils-devel/2008-November/001266.html Any ideas? Regards, Dan From djberg96 at gmail.com Mon Aug 22 23:05:27 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Mon, 22 Aug 2011 21:05:27 -0600 Subject: [Win32utils-devel] Pure Ruby TCP Daemon In-Reply-To: References: <003201cc60f7$9c9ceba0$d5d6c2e0$@com> Message-ID: On Mon, Aug 22, 2011 at 2:34 PM, Daniel Berger wrote: > On Mon, Aug 22, 2011 at 12:16 PM, Daniel Berger wrote: >> Hi all, >> >> I created a "pure" branch on github that uses the code Heesob posted a while >> back: >> >> http://rubyforge.org/pipermail/win32utils-devel/2008-November/001274.html >> >> However, I couldn't make it work on my Vista laptop. >> >> c:\Users\djberge\Repositories\win32-service\examples>ruby demo_daemon_ctl.rb >> start >> VERSION: 0.8.0 >> C:/Ruby187/lib/ruby/gems/1.8/gems/win32-service-0.8.0/lib/win32/service.rb:7 >> 53:in `start': The servi >> ce did not respond to the start or control request in a timely fashion. >> (Win32::Service::Error) >> ? ? ? ?from demo_daemon_ctl.rb:68 > > Same result with this code: > http://rubyforge.org/pipermail/win32utils-devel/2008-November/001266.html Some debugging indicates that it's hanging on this line: WaitForSingleObject(@arg_event, INFINITE) I haven't figured out why yet, though. Regards, Dan From djberg96 at gmail.com Wed Aug 24 22:52:09 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 24 Aug 2011 20:52:09 -0600 Subject: [Win32utils-devel] strcpy declaration Message-ID: <005d01cc62d1$fdba3e70$f92ebb50$@com> In windows-pr strcpy is declared with a prototype of "PL". However, I can't make that work: require 'win32/api' include Win32 Strcpy_p = Win32::API.new('strcpy', 'PP', 'L', 'msvcrt') Strcpy_l = Win32::API.new('strcpy', 'PL', 'L', 'msvcrt') buf = 0.chr * 4 str = "hello" Strcpy_p.call(buf, str) # works p buf buf = 0.chr * 4 str = "hello" Strcpy_l.call(buf, str.unpack('L').first) # fails, segfault p buf I would think either declaration would work but apparently not. Have we simply not been using this function all this time? Regards, Dan From phasis at gmail.com Thu Aug 25 09:28:10 2011 From: phasis at gmail.com (Heesob Park) Date: Thu, 25 Aug 2011 22:28:10 +0900 Subject: [Win32utils-devel] strcpy declaration In-Reply-To: <005d01cc62d1$fdba3e70$f92ebb50$@com> References: <005d01cc62d1$fdba3e70$f92ebb50$@com> Message-ID: Hi, 2011/8/25 Daniel Berger > In windows-pr strcpy is declared with a prototype of "PL". However, I can't > make that work: > > require 'win32/api' > include Win32 > > Strcpy_p = Win32::API.new('strcpy', 'PP', 'L', 'msvcrt') > Strcpy_l = Win32::API.new('strcpy', 'PL', 'L', 'msvcrt') > > buf = 0.chr * 4 > str = "hello" > > Strcpy_p.call(buf, str) # works > p buf > > buf = 0.chr * 4 > str = "hello" > > Strcpy_l.call(buf, str.unpack('L').first) # fails, segfault > p buf > > I would think either declaration would work but apparently not. > > Have we simply not been using this function all this time? > > > This works: buf = 0.chr * 5 str = "hello" Strcpy_l.call(buf, [str].pack('p').unpack('L').first) p buf Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: From djberg96 at gmail.com Thu Aug 25 11:24:12 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 25 Aug 2011 09:24:12 -0600 Subject: [Win32utils-devel] strcpy declaration In-Reply-To: References: <005d01cc62d1$fdba3e70$f92ebb50$@com> Message-ID: <006801cc633b$0cc43fb0$264cbf10$@com> > -----Original Message----- > From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel- > bounces at rubyforge.org] On Behalf Of Heesob Park > Sent: Thursday, August 25, 2011 7:28 AM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] strcpy declaration > > Hi, > > > 2011/8/25 Daniel Berger > > > In windows-pr strcpy is declared with a prototype of "PL". > However, I can't > make that work: > > require 'win32/api' > include Win32 > > Strcpy_p = Win32::API.new('strcpy', 'PP', 'L', 'msvcrt') > Strcpy_l = Win32::API.new('strcpy', 'PL', 'L', 'msvcrt') > > buf = 0.chr * 4 > str = "hello" > > Strcpy_p.call(buf, str) # works > p buf > > buf = 0.chr * 4 > str = "hello" > > Strcpy_l.call(buf, str.unpack('L').first) # fails, segfault > p buf > > I would think either declaration would work but apparently not. > > Have we simply not been using this function all this time? > > > > > > This works: > > buf = 0.chr * 5 > str = "hello" > Strcpy_l.call(buf, [str].pack('p').unpack('L').first) > p buf Thanks! Regards, Dan From djberg96 at gmail.com Mon Aug 29 05:56:51 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Mon, 29 Aug 2011 03:56:51 -0600 Subject: [Win32utils-devel] Fwd: [win32-service] win32 daemon error - Service_Main thread exited abnormally (#4) In-Reply-To: References: Message-ID: Any suggestions? ---------- Forwarded message ---------- From: 2potatocakes Date: Mon, Aug 29, 2011 at 12:40 AM Subject: Re: [win32-service] win32 daemon error - Service_Main thread exited abnormally (#4) To: djberg96 at gmail.com Thanks for looking at this guys. Have updated the strcpy line.. I'm still having problems though.. I'm pretty sure it's coming from the 2 lines: dispatch_table = [""].pack('p') + [svc_main.address].pack('L') + "\0"*8 if(!StartServiceCtrlDispatcher(dispatch_table)) .... I could be mistaken, but StartServiceCtrlDispatcher should fire the svc_main win32 callback which never happens on my machine. I've spent the past few days trying to see if I could fix it myself but I'm a little stuck.. Am I right in understanding that the dispatch_table variable is just trying to imitate a pointer to a service_table_entry struct? Does this work for you guys doing it this way? It just hangs for me at this point for about 5 seconds and then exits. Was about to start playing with the gem ffi to see if I could create an array of structs that way and just pass the actual pointer from that? A bit unsure of how to tackle it at the moment, any suggestions? -- Reply to this email directly or view it on GitHub: https://github.com/djberg96/win32-service/issues/4#issuecomment-1927762