Skip to content

Commit 4f0f7f4

Browse files
genioxenu
authored andcommitted
DZil-ify the build. Lots here, but all towards the same goal.
- Move the Daemon.pm file into lib/Win32/Daemon.pm. - Get rid of Dynaloader for XSLoader instead. - Stop using AUTOLOAD to bring in the constants. - Use Exporter's import rather than subclassing Exporter and Dynaloader. - Keep up with prereqs in cpanfile. - Use Dist::Zilla to build the package. Dist::Zilla will maintain version numbers for us now and keep Daemon.pm's version always up to date. - Daemon.pm has moved to lib/Win32/Daemon.pm for current conventions. - Changes was updated to have the latest updates at the top. It was also organized a bit to ensure it reads well for each release. - Have AppVeyor build against Perl 5.28 as well. - We can't support cygwin at this time as compilation failures are abundant. We will happily support PRs to fix this though. - Fix the POD 2 README to use github flavored markdown
1 parent c78ada1 commit 4f0f7f4

File tree

13 files changed

+1272
-307
lines changed

13 files changed

+1272
-307
lines changed

.appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ matrix:
66

77
environment:
88
matrix:
9+
- perl_type: strawberry
10+
perl_version: 5.28.0.1
911
- perl_type: strawberry
1012
perl_version: 5.26.1.1
1113
- perl_type: strawberry

.mm_awesome_header.pl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use Config qw(%Config);
2+
require Win32;
3+
4+
# Sorry, we can't support cygwin right now. We'd love for you to fix the
5+
# compilation problems and submit a PR to get it back, though!!
6+
unless ($^O eq "MSWin32") { # || $^O eq "cygwin") {
7+
die "OS unsupported\n";
8+
}
9+
10+
my %xsbuild = (
11+
XS => { 'Daemon.xs' => 'Daemon.cpp', },
12+
OBJECT => 'CCallbackList$(OBJ_EXT) CCallbackTimer$(OBJ_EXT) constant$(OBJ_EXT) CWinStation$(OBJ_EXT) Daemon$(OBJ_EXT) ServiceThread$(OBJ_EXT)',
13+
);
14+
$xsbuild{NO_META} = 1 if eval { ExtUtils::MakeMaker->VERSION('6.10_03') };
15+
$xsbuild{INC} .= ' -EHsc' if $Config{'cc'} =~ /^cl/i;
16+
17+
sub MY::xs_c {
18+
'
19+
.xs.cpp:
20+
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && $(MV) xstmp.c $*.cpp
21+
';
22+
}

Changes

Lines changed: 141 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,141 @@
1-
Win32::Daemon
2-
HISTORY:
3-
4-
20000618
5-
-Added:
6-
-ConfigureService
7-
-QueryServiceConfig
8-
9-
10-
- Fixed bug where service doesn't work properly with Windows NT 4. We were
11-
defaulting by acccepting the SERVICE_ACCEPT_PARAMCHANGE and
12-
SERVICE_ACCEPT_NETBINDCHANGE controls. However, they were introduced in
13-
Win2k so NT 4 coughed up blood with them.
14-
15-
20010224
16-
-Added:
17-
-RegisterCallbacks() (and callback support)
18-
19-
20011205
20-
-Added:
21-
-AcceptedControls()
22-
23-
20011205 rothd
24-
-Fixed bug where "invalid service state 80" is reported in the Win32 event log.
25-
-Added initial support for SCM request callbacks (this is not implemented fully and
26-
is not supported yet).
27-
-Added SERVICE_CONTROL_NONE constant
28-
-Fixed State() so it only returns states, not commands.
29-
-Modified QueryLastMessage(). It now allows you to reset the last message to SERVICE_CONTROL_NONE.
30-
-Added SERVICE_NOT_READY state
31-
-Cleaned up some states.
32-
-Added AcceptedControls() function.
33-
34-
20011217 rothd
35-
- Added support for .Net Server accept control contants:
36-
SERVICE_ACCEPT_HARDWAREPROFILECHANGE
37-
SERVICE_ACCEPT_POWEREVENT
38-
SERVICE_ACCEPT_SESSIONCHANGE
39-
40-
41-
- Fixed bug where service doesn't work properly with Windows NT 4. We were
42-
defaulting by acccepting the SERVICE_ACCEPT_PARAMCHANGE and
43-
SERVICE_ACCEPT_NETBINDCHANGE controls. However, they were introduced in
44-
Win2k so NT 4 coughed up blood with them.
45-
46-
47-
- Fixed another bug wwhere servie wouldn't work on Win2k machines. We
48-
were treating Win2k (version 5.0) the same as WinXP (version 5.1) and
49-
adding WinXP specific controls. This rendered the service unable to
50-
start, pause or stop. Fix was only in the Daemon.pm file.
51-
52-
53-
- Fixed another bug where service wouldn't work on WinXP machines. Variable
54-
recognized_controls was wrongly initialized for WinXP systems. This
55-
rendered the service unable to start, pause or stop. Fix was only in
56-
the Daemon.pm file.
57-
58-
59-
- Added support for reporting service errors. You can now pass in a
60-
hash reference into State(). More details in the POD docs.
61-
- Modified: UpdateServiceStatus() function to accept a 3rd parameter (dwError). This allows the calling code to report a service error.
62-
63-
64-
- Added support for reporting service errors. You can now pass in a
65-
hash reference into State(). More details in the POD docs.
66-
67-
68-
- Added support for querying and setting service security. This includes
69-
DACL and SACL support. Due to complexity and failures you can not set
70-
owner or group. But in most cases (99%) this is not needed.
71-
- GetSecurity()
72-
- SetSecurity()
73-
- Finished incorporating callback routines.
74-
- Added a few more events.
75-
76-
77-
78-
- Converted to XS file.
79-
- Fixed callback heartbeat: now properly calls back with SERVICE_RUNNING (not SERVICE_CONTROL_RUNNING)
80-
- StopService() will post WM_QUIT message to the ServiceMain() thread to shut down the service thread.
81-
- Calling into StopService() will auto change the state to STOPPING/STOPPED so you do not need to
82-
explicitly do so (calling State() or a callback returning STOPPING/STOPPED).
83-
84-
20070102 rothd
85-
- Cleaned up a bit.
86-
- Added WM_QUIT message to the ServiceMain function. Now the Perl StopService() will
87-
post this message to shut down the service thread.
88-
- Fixed bug where messages were posted to wrong thread.
89-
90-
20080321 rothd
91-
- Added support for SERVICE_CONTROL_PRESHUTDOWN.
92-
- Callbacks can now return a state value. This is the functional equivilent of calling
93-
Win32::Daemon::State( $NewState ) before returning:
94-
// sub EventCallback
95-
// {
96-
// my( $Event, $Context ) = @_;
97-
// # Process the event
98-
// Win32::Daemon::State( $NewState );
99-
// return;
100-
// }
101-
// =================== SAME AS ====================
102-
// sub EventCallback
103-
// {
104-
// my( $Event, $Context ) = @_;
105-
// # Process the event
106-
// return( $NewState );
107-
// }
108-
109-
- Callback timer works correctly!
110-
- CALLBACK_RUNNING has been depreciated and replaced with CALLBACK_TIMER. It is only called
111-
when the timer (set by CallbackTimer()) has expired. Use this as a heartbeat. You only need
112-
to set it once either with CallbackTimer() or passing in the timer value when calling into
113-
StartService().
114-
Set the callback using "timer" as the callback name. Using "running" will also work but it
115-
is mapped to "timer". If you specify both, only "timer" will be registered.
116-
- Created TestFramework.pm to help with testing services.
117-
- Pruned out unnecessary stuff from Daemon.pm file.
118-
119-
20091028 Olivier Mengué
120-
- Disabled END {} in non-main threads to fix bug RT#50020
121-
122-
20101014 Jan Dubois
123-
- minimal POD cleanup
124-
- avoid CPAN indexing of the packages under test/
125-
- QueryLastMessage() had been renamed to LastControlMessage().
126-
Rename it back to preserve backwards compatibility.
127-
128-
20110117 Jan Dubois
129-
- make sure DllMain() has "C" linkage when compiled with MinGW
130-
(Haiko Strotbek). [rt#64575]
131-
- change StartService() and GetServiceHandle() to return proper
132-
64-bit value on Win64 (Haiko Strotbek). [rt#64577]
133-
134-
XXXXXXXX Olivier Mengué
135-
- POD cleanup
136-
- Doc fix from Brian Wightman (github #1, #2): wait hint in service
137-
service status is in ms
138-
- Fix the build by fixing the case sensitive Constant to constant
139-
(RT #126272 and RT #75506)
1+
Revision history for Perl extension {{$dist->name}}
2+
3+
{{$NEXT}}
4+
- POD cleanup
5+
- Doc fix from Brian Wightman (github #1, #2): wait hint in service
6+
service status is in ms
7+
- Fix the build by fixing the case sensitive Constant to constant
8+
(RT #126272 and RT #75506)
9+
- Cleaned up and organized this change log
10+
- Use Dist::Zilla to prepare the releases
11+
- Maintain dependencies in cpanfile
12+
- Test with appveyor
13+
- Move Daemon.pm to its proper spot in the lib/Win32 directory
14+
- Take Cygwin out of the supported OSes as there are many compilation errors
15+
at the moment. Please submit a PR if you are capable of fixing this!
16+
17+
20110117 2011-10-17
18+
- make sure DllMain() has "C" linkage when compiled with MinGW
19+
(Haiko Strotbek). [rt#64575]
20+
- change StartService() and GetServiceHandle() to return proper
21+
64-bit value on Win64 (Haiko Strotbek). [rt#64577]
22+
23+
20101014 2010-10-14
24+
- minimal POD cleanup
25+
- avoid CPAN indexing of the packages under test/
26+
- QueryLastMessage() had been renamed to LastControlMessage().
27+
Rename it back to preserve backwards compatibility.
28+
29+
20091028 2009-10-28
30+
- Disabled END {} in non-main threads to fix bug RT#50020 (Olivier Mengué)
31+
32+
20080321 2008-03-21
33+
- Added support for SERVICE_CONTROL_PRESHUTDOWN.
34+
- Callbacks can now return a state value. This is the functional equivalent
35+
of calling Win32::Daemon::State( $NewState ) before returning:
36+
// sub EventCallback
37+
// {
38+
// my( $Event, $Context ) = @_;
39+
// # Process the event
40+
// Win32::Daemon::State( $NewState );
41+
// return;
42+
// }
43+
// =================== SAME AS ====================
44+
// sub EventCallback
45+
// {
46+
// my( $Event, $Context ) = @_;
47+
// # Process the event
48+
// return( $NewState );
49+
// }
50+
- Callback timer works correctly!
51+
- CALLBACK_RUNNING has been depreciated and replaced with CALLBACK_TIMER.
52+
It is only called when the timer (set by CallbackTimer()) has expired.
53+
Use this as a heartbeat. You only need to set it once either with
54+
CallbackTimer() or passing in the timer value when calling into
55+
StartService(). Set the callback using "timer" as the callback name.
56+
Using "running" will also work but it is mapped to "timer". If you
57+
specify both, only "timer" will be registered.
58+
- Created TestFramework.pm to help with testing services.
59+
- Pruned out unnecessary stuff from Daemon.pm file.
60+
61+
20070102 2007-01-02
62+
- Cleaned up a bit.
63+
- Added WM_QUIT message to the ServiceMain function. Now the Perl StopService() will
64+
post this message to shut down the service thread.
65+
- Fixed bug where messages were posted to wrong thread.
66+
67+
20061222 2006-12-22
68+
- Converted to XS file.
69+
- Fixed callback heartbeat: now properly calls back with SERVICE_RUNNING
70+
(not SERVICE_CONTROL_RUNNING)
71+
- StopService() will post WM_QUIT message to the ServiceMain() thread to
72+
shut down the service thread.
73+
- Calling into StopService() will auto change the state to STOPPING/STOPPED
74+
so you do not need to explicitly do so (calling State() or a callback
75+
returning STOPPING/STOPPED).
76+
77+
20030617 2003-06-17
78+
- Added support for querying and setting service security. This includes
79+
DACL and SACL support. Due to complexity and failures you can not set
80+
owner or group. But in most cases (99%) this is not needed.
81+
- GetSecurity()
82+
- SetSecurity()
83+
- Finished incorporating callback routines.
84+
- Added a few more events.
85+
86+
20020605 2002-06-05
87+
- Added support for reporting service errors. You can now pass in a
88+
hash reference into State(). More details in the POD docs.
89+
- Modified: UpdateServiceStatus() function to accept a 3rd parameter
90+
(dwError). This allows the calling code to report a service error.
91+
92+
20020114 2002-01-14
93+
- Fixed another bug where service wouldn't work on WinXP machines. Variable
94+
recognized_controls was wrongly initialized for WinXP systems. This
95+
rendered the service unable to start, pause or stop. Fix was only in
96+
the Daemon.pm file. ([email protected])
97+
98+
20020108 2002-01-08
99+
- Fixed another bug wwhere servie wouldn't work on Win2k machines. We
100+
were treating Win2k (version 5.0) the same as WinXP (version 5.1) and
101+
adding WinXP specific controls. This rendered the service unable to
102+
start, pause or stop. Fix was only in the Daemon.pm file.
103+
104+
20011230 2001-12-30
105+
- Fixed bug where service doesn't work properly with Windows NT 4. We were
106+
defaulting by acccepting the SERVICE_ACCEPT_PARAMCHANGE and
107+
SERVICE_ACCEPT_NETBINDCHANGE controls. However, they were introduced in
108+
Win2k so NT 4 coughed up blood with them. ([email protected])
109+
110+
20011221 2001-12-21
111+
- Fixed bug where service doesn't work properly with Windows NT 4. We were
112+
defaulting by acccepting the SERVICE_ACCEPT_PARAMCHANGE and
113+
SERVICE_ACCEPT_NETBINDCHANGE controls. However, they were introduced in
114+
Win2k so NT 4 coughed up blood with them.
115+
116+
20011217 2001-12-17
117+
- Added support for .Net Server accept control contants:
118+
SERVICE_ACCEPT_HARDWAREPROFILECHANGE
119+
SERVICE_ACCEPT_POWEREVENT
120+
SERVICE_ACCEPT_SESSIONCHANGE
121+
122+
20011205 2001-12-05
123+
- AcceptedControls()
124+
- Fixed bug where "invalid service state 80" is reported in the Win32 event
125+
log.
126+
- Added initial support for SCM request callbacks (this is not implemented
127+
fully and is not supported yet).
128+
- Added SERVICE_CONTROL_NONE constant
129+
- Fixed State() so it only returns states, not commands.
130+
- Modified QueryLastMessage(). It now allows you to reset the last message
131+
to SERVICE_CONTROL_NONE.
132+
- Added SERVICE_NOT_READY state
133+
- Cleaned up some states.
134+
- Added AcceptedControls() function.
135+
136+
20010224 2001-02-24
137+
- RegisterCallbacks() (and callback support)
138+
139+
20000618 2000-06-18
140+
- ConfigureService
141+
- QueryServiceConfig

LICENSE

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ That's all there is to it!
272272

273273
--- The Artistic License 1.0 ---
274274

275-
This software is Copyright (c) 1998 by Dave Roth.
275+
This software is Copyright (c) 2000 by Dave Roth.
276276

277277
This is free software, licensed under:
278278

@@ -292,21 +292,21 @@ Definitions:
292292

293293
- "Package" refers to the collection of files distributed by the Copyright
294294
Holder, and derivatives of that collection of files created through
295-
textual modification.
295+
textual modification.
296296
- "Standard Version" refers to such a Package if it has not been modified,
297297
or has been modified in accordance with the wishes of the Copyright
298-
Holder.
298+
Holder.
299299
- "Copyright Holder" is whoever is named in the copyright or copyrights for
300-
the package.
300+
the package.
301301
- "You" is you, if you're thinking about copying or distributing this Package.
302302
- "Reasonable copying fee" is whatever you can justify on the basis of media
303303
cost, duplication charges, time of people involved, and so on. (You will
304304
not be required to justify it to the Copyright Holder, but only to the
305-
computing community at large as a market that must bear the fee.)
305+
computing community at large as a market that must bear the fee.)
306306
- "Freely Available" means that no fee is charged for the item itself, though
307307
there may be fees involved in handling the item. It also means that
308308
recipients of the item may redistribute it under the same conditions they
309-
received it.
309+
received it.
310310

311311
1. You may make and give away verbatim copies of the source form of the
312312
Standard Version of this Package without restriction, provided that you
@@ -376,3 +376,4 @@ WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
376376
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
377377

378378
The End
379+

0 commit comments

Comments
 (0)