2011-03-09 20:00 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbnetio/utils/hbnetio/hbnetio.hbp
* contrib/hbnetio/utils/hbnetio/netiosrv.prg
+ contrib/hbnetio/utils/hbnetio/netiosvc.prg
+ hbnetio will act as a service on Windows platform.
To run it interactively from console, use: 'hbnetio -a'
; TOFIX: I'm getting 'error 1067' when starting up the
service. It get resolved when I build hbnetio in
-st mode. (I use mingw and did a full rebuild)
* contrib/rddads/rddads.hbp
! Suppressing annoying mingw warning in ace.h.
; TOFIX: hbmk2 overrides this ATM.
This commit is contained in:
@@ -16,6 +16,20 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2011-03-09 20:00 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbnetio/utils/hbnetio/hbnetio.hbp
|
||||
* contrib/hbnetio/utils/hbnetio/netiosrv.prg
|
||||
+ contrib/hbnetio/utils/hbnetio/netiosvc.prg
|
||||
+ hbnetio will act as a service on Windows platform.
|
||||
To run it interactively from console, use: 'hbnetio -a'
|
||||
; TOFIX: I'm getting 'error 1067' when starting up the
|
||||
service. It get resolved when I build hbnetio in
|
||||
-st mode. (I use mingw and did a full rebuild)
|
||||
|
||||
* contrib/rddads/rddads.hbp
|
||||
! Suppressing annoying mingw warning in ace.h.
|
||||
; TOFIX: hbmk2 overrides this ATM.
|
||||
|
||||
2011-03-09 18:30 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbwin/win_svc.c
|
||||
* contrib/hbwin/tests/testsvc.prg
|
||||
|
||||
@@ -12,5 +12,8 @@
|
||||
netiosrv.prg
|
||||
netiocon.prg
|
||||
netiomgm.prg
|
||||
netiosvc.prg{win}
|
||||
-main=WinMain{win}
|
||||
hbwin.hbc{win}
|
||||
|
||||
#-prgflag=-DHB_EXTERN
|
||||
|
||||
@@ -86,6 +86,10 @@ REQUEST HB_MT
|
||||
#define _NETIOSRV_CONN_MAX_ 4
|
||||
|
||||
PROCEDURE Main( ... )
|
||||
netiosrv_Main( .T., ... )
|
||||
RETURN
|
||||
|
||||
PROCEDURE netiosrv_Main( lUI, ... )
|
||||
LOCAL netiosrv[ _NETIOSRV_MAX_ ]
|
||||
LOCAL netiomgm[ _NETIOSRV_MAX_ ]
|
||||
|
||||
@@ -96,8 +100,6 @@ PROCEDURE Main( ... )
|
||||
LOCAL cExt
|
||||
LOCAL cFile
|
||||
|
||||
LOCAL lUI := .T.
|
||||
|
||||
Set( _SET_DATEFORMAT, "yyyy.mm.dd" )
|
||||
Set( _SET_TIMEFORMAT, "HH:MM:SS.FFF" )
|
||||
|
||||
@@ -142,6 +144,8 @@ PROCEDURE Main( ... )
|
||||
|
||||
FOR EACH cParam IN { ... }
|
||||
DO CASE
|
||||
CASE Lower( cParam ) == "-a"
|
||||
/* Ignore */
|
||||
CASE Lower( Left( cParam, 5 ) ) == "-noui"
|
||||
lUI := .F.
|
||||
CASE Lower( Left( cParam, 6 ) ) == "-port="
|
||||
|
||||
61
harbour/contrib/hbnetio/utils/hbnetio/netiosvc.prg
Normal file
61
harbour/contrib/hbnetio/utils/hbnetio/netiosvc.prg
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
#include "hbwin.ch"
|
||||
|
||||
#define _SERVICE_NAME "Harbour_NetIO_Service"
|
||||
|
||||
PROCEDURE WinMain( ... )
|
||||
LOCAL cMode := hb_PValue( 1 )
|
||||
|
||||
IF cMode == NIL
|
||||
cMode := "-s" /* NOTE: Must be the default action */
|
||||
ENDIF
|
||||
|
||||
SWITCH Lower( cMode )
|
||||
CASE "-i"
|
||||
CASE "-install"
|
||||
|
||||
IF win_serviceInstall( _SERVICE_NAME, "Harbour NetIO Service" )
|
||||
OutStd( "Service has been successfully installed" + hb_eol() )
|
||||
ELSE
|
||||
OutStd( "Error installing service: " + hb_ntos( wapi_GetLastError() ) + hb_eol() )
|
||||
ENDIf
|
||||
EXIT
|
||||
|
||||
CASE "-u"
|
||||
CASE "-uninstall"
|
||||
|
||||
IF win_serviceDelete( _SERVICE_NAME )
|
||||
OutStd( "Service has been deleted" + hb_eol() )
|
||||
ELSE
|
||||
OutStd( "Error deleting service: " + hb_ntos( wapi_GetLastError() ) + hb_eol() )
|
||||
ENDIf
|
||||
EXIT
|
||||
|
||||
CASE "-a"
|
||||
|
||||
netiosrv_Main( .T., ... ) /* Interactive */
|
||||
EXIT
|
||||
|
||||
CASE "-s"
|
||||
CASE "-service"
|
||||
|
||||
IF win_serviceStart( _SERVICE_NAME, @hbnetio_WinServiceEntry() )
|
||||
OutStd( "Service has started OK" + hb_eol() )
|
||||
ELSE
|
||||
OutStd( "Service has had some problems: " + hb_ntos( wapi_GetLastError() ) + hb_eol() )
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
ENDSWITCH
|
||||
|
||||
RETURN
|
||||
|
||||
PROCEDURE hbnetio_WinServiceEntry( ... )
|
||||
// LOCAL bSignal := {|| win_serviceGetStatus() != WIN_SERVICE_RUNNING }
|
||||
|
||||
netiosrv_Main( .F., ... ) /* Non-interactive */
|
||||
|
||||
win_serviceSetExitCode( 0 )
|
||||
win_serviceStop()
|
||||
|
||||
RETURN
|
||||
@@ -24,6 +24,9 @@
|
||||
-instfile=inc:adsextrn.ch
|
||||
-instfile=inc:rddads.hbx
|
||||
|
||||
# To avoid a warning in ACE header
|
||||
-cflag=-Wno-pragmas{allmingw}
|
||||
|
||||
rddads.hbx
|
||||
|
||||
ads1.c
|
||||
|
||||
Reference in New Issue
Block a user