Skip to content

Commit

Permalink
Put the version 0.1.0 from SVN tag win32service-0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
macintoshplus committed Jun 3, 2016
0 parents commit 947fd06
Show file tree
Hide file tree
Showing 6 changed files with 938 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
win32 Service API
Wez Furlong, Richard Quadling
9 changes: 9 additions & 0 deletions config.w32
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// $Id: config.w32 309260 2011-03-15 17:03:59Z rquadling $
// vim:ft=javascript

ARG_ENABLE("win32service", "Win32 Service", "no");

if (PHP_WIN32SERVICE != "no") {
EXTENSION("win32service", "win32service.c");
}

39 changes: 39 additions & 0 deletions php_win32service.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Wez Furlong <wez@php.net> |
+----------------------------------------------------------------------+
*/

/* $Id: php_win32service.h 309260 2011-03-15 17:03:59Z rquadling $ */

#ifndef PHP_WIN32SERVICE_H
#define PHP_WIN32SERVICE_H

extern zend_module_entry win32service_module_entry;
#define phpext_win32service_ptr &win32service_module_entry

#define PHP_WIN32SERVICE_VERSION "0.1.0-dev"

#ifndef PHP_WIN32
# error This extension is for win32 only
#endif

#ifndef SERVICE_WIN32_OWN_PROCESS_INTERACTIVE
#define SERVICE_WIN32_OWN_PROCESS_INTERACTIVE SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS
#endif

#endif


49 changes: 49 additions & 0 deletions php_win32service_int.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Wez Furlong <wez@php.net> |
+----------------------------------------------------------------------+
*/

/* $Id: php_win32service_int.h 309260 2011-03-15 17:03:59Z rquadling $ */

#ifndef PHP_WIN32SERVICE_INT_H
#define PHP_WIN32SERVICE_INT_H

#ifdef ZTS
# include "TSRM.h"
# define SVCG(v) TSRMG(win32service_globals_id, zend_win32service_globals *, v)
#else
# define SVCG(v) (win32service_globals.v)
#endif

ZEND_BEGIN_MODULE_GLOBALS(win32service)
HANDLE svc_thread; /* MUST be first in struct */
DWORD svc_thread_id;
HANDLE event;
DWORD code;
SERVICE_STATUS st;
SERVICE_STATUS_HANDLE sh;
SERVICE_TABLE_ENTRY te[2];
char *service_name;
/* args for the control handler */
struct {
DWORD dwControl, dwEventType;
LPVOID lpEventData;
} args;
ZEND_END_MODULE_GLOBALS(win32service)

ZEND_DECLARE_MODULE_GLOBALS(win32service);
#endif

34 changes: 34 additions & 0 deletions sample.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/* A sample service:
*
* php sample.php install
* net start dummyphp
* net stop dummyphp
* php sample.php uninstall
*/

if ($argv[1] == 'install') {
$x = win32_create_service(array(
'service' => 'dummyphp',
'display' => 'sample dummy PHP service',
'params' => __FILE__ . ' run',
));
debug_zval_dump($x);
exit;
} else if ($argv[1] == 'uninstall') {
$x = win32_delete_service('dummyphp');
debug_zval_dump($x);
exit;
} else if ($argv[1] != 'run') {
die("bogus args");
}

$x = win32_start_service_ctrl_dispatcher('dummyphp');

win32_set_service_status(WIN32_SERVICE_RUNNING);

while (WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message()) {
usleep(250000);
}

?>
Loading

0 comments on commit 947fd06

Please sign in to comment.