-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put the version 0.1.0 from SVN tag win32service-0.1.0
- Loading branch information
0 parents
commit 947fd06
Showing
6 changed files
with
938 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
win32 Service API | ||
Wez Furlong, Richard Quadling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
?> |
Oops, something went wrong.