summaryrefslogtreecommitdiff
path: root/ace/NT_Service.cpp
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>1999-02-23 21:27:36 +0000
committerSteve Huston <shuston@riverace.com>1999-02-23 21:27:36 +0000
commit59cf0d274d8ed19384c7145dc6f7141a636ef4ef (patch)
tree043aba4f8336a17e2044668a16725fac6fb5f618 /ace/NT_Service.cpp
parent61e38a60dd45788b9d0b5558f9947e81d12fee4f (diff)
downloadATCD-59cf0d274d8ed19384c7145dc6f7141a636ef4ef.tar.gz
Added test_access() and state(DWORD *, ACE_Time_Value*)
Diffstat (limited to 'ace/NT_Service.cpp')
-rw-r--r--ace/NT_Service.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/ace/NT_Service.cpp b/ace/NT_Service.cpp
index 79ccb86873a..ed0a7e18c85 100644
--- a/ace/NT_Service.cpp
+++ b/ace/NT_Service.cpp
@@ -342,6 +342,49 @@ ACE_NT_Service::state (ACE_Time_Value *wait_hint)
}
+int
+ACE_NT_Service::state (DWORD *pstate, ACE_Time_Value *wait_hint)
+{
+
+ DWORD state = state (wait_hint);
+ if (state > 0)
+ *pstate = state;
+ return state == 0 ? -1 : 0;
+
+}
+
+
+
+// test_access
+//
+// Open a new handle, ignoring any handle open in svc_sc_handle_. This
+// function's results are returned without leaving the handle open.
+int
+ACE_NT_Service::test_access (DWORD desired_access)
+{
+
+ int status = -1; // Guilty until proven innocent
+
+ SC_HANDLE sc_mgr = OpenSCManager(0, 0, GENERIC_READ);
+ if (sc_mgr != 0)
+ {
+ SC_HANDLE handle = OpenService(sc_mgr,
+ this->name(),
+ desired_access);
+ CloseServiceHandle(sc_mgr);
+ if (handle != 0)
+ {
+ status = 0;
+ CloseServiceHandle (handle);
+ }
+ }
+
+ return status;
+
+}
+
+
+
// report_status
//
// Reports the current status. If new_status is not 0, it sets the