diff options
author | Steve Huston <shuston@riverace.com> | 1999-03-23 01:03:41 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 1999-03-23 01:03:41 +0000 |
commit | a382e5412e5c3bf0f5be6ed52f1e962ebb830287 (patch) | |
tree | aa6cbb2f4248647aabeddc1b5feba51793ab847a /ace/NT_Service.cpp | |
parent | 25193c65fa3cc5d8824d1b021d0448526ac9eac8 (diff) | |
download | ATCD-a382e5412e5c3bf0f5be6ed52f1e962ebb830287.tar.gz |
Revised state(DWORD *, ACE_Time_Value*) to always return -1 on any error;
Make state(ACE_Time_Value*) now call state (DWORD*, ACE_Time_Value*) to get
a completely accurate answer rather than the other way around. Thanks to
martin Krumpolec for the ideas and changes.
Diffstat (limited to 'ace/NT_Service.cpp')
-rw-r--r-- | ace/NT_Service.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/ace/NT_Service.cpp b/ace/NT_Service.cpp index 7e2551b79d8..385589d5465 100644 --- a/ace/NT_Service.cpp +++ b/ace/NT_Service.cpp @@ -355,17 +355,11 @@ DWORD ACE_NT_Service::state (ACE_Time_Value *wait_hint) { - SC_HANDLE svc = this->svc_sc_handle(); - if (svc == 0) - return 0; +DWORD curr_state; - QueryServiceStatus (svc, &this->svc_status_); - if (wait_hint != 0) - { - wait_hint->msec(this->svc_status_.dwWaitHint); - } - - return this->svc_status_.dwCurrentState; + if (this->state (&curr_state, wait_hint) == -1) + return 0; + return curr_state; } @@ -374,10 +368,21 @@ int ACE_NT_Service::state (DWORD *pstate, ACE_Time_Value *wait_hint) { - DWORD curr_state = state (wait_hint); - if (curr_state > 0) - *pstate = curr_state; - return curr_state == 0 ? -1 : 0; + SC_HANDLE svc = this->svc_sc_handle(); + if (svc == 0) + return -1; + + if (QueryServiceStatus (svc, &this->svc_status_) == 0) + return -1; + + if (wait_hint != 0) + { + wait_hint->msec(this->svc_status_.dwWaitHint); + } + + *pstate = this->svc_status_.dwCurrentState; + + return 0; } |