You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2019/06/13 10:07:43 UTC
[commons-daemon] 02/05: Remove unused code
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git
commit 3f12f27d5da63daedd4e40dd8ed58c30674bb675
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jun 12 22:46:08 2019 +0100
Remove unused code
---
src/native/windows/include/service.h | 11 +---
src/native/windows/src/service.c | 103 -----------------------------------
2 files changed, 1 insertion(+), 113 deletions(-)
diff --git a/src/native/windows/include/service.h b/src/native/windows/include/service.h
index 826fb1c..5327ffc 100644
--- a/src/native/windows/include/service.h
+++ b/src/native/windows/include/service.h
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#ifndef _SERVICE_H_INCLUDED_
#define _SERVICE_H_INCLUDED_
@@ -59,15 +59,6 @@ LPAPXSERVENTRY apxServiceEntry(APXHANDLE hService, BOOL bRequeryStatus);
*/
BOOL apxServiceDelete(APXHANDLE hService);
-DWORD apxServiceBrowse(APXHANDLE hService,
- LPCWSTR szIncludeNamePattern,
- LPCWSTR szIncludeImagePattern,
- LPCWSTR szExcludeNamePattern,
- LPCWSTR szExcludeImagePattern,
- UINT uMsg,
- LPAPXFNCALLBACK fnDisplayCallback,
- LPVOID lpCbData);
-
DWORD apxGetMaxServiceTimeout(APXHANDLE hPool);
__APXEND_DECLS
diff --git a/src/native/windows/src/service.c b/src/native/windows/src/service.c
index d775253..e154732 100644
--- a/src/native/windows/src/service.c
+++ b/src/native/windows/src/service.c
@@ -621,106 +621,3 @@ apxServiceDelete(APXHANDLE hService)
}
return FALSE;
}
-
-/* Browse the services */
-DWORD
-apxServiceBrowse(APXHANDLE hService,
- LPCWSTR szIncludeNamePattern,
- LPCWSTR szIncludeImagePattern,
- LPCWSTR szExcludeNamePattern,
- LPCWSTR szExcludeImagePattern,
- UINT uMsg,
- LPAPXFNCALLBACK fnDisplayCallback,
- LPVOID lpCbData)
-{
- DWORD nFound = 0;
- APXREGENUM stEnum;
- LPAPXSERVICE lpService;
- SC_LOCK hLock;
- if (hService->dwType != APXHANDLE_TYPE_SERVICE || !fnDisplayCallback)
- return 0;
-
- lpService = APXHANDLE_DATA(hService);
- /* Only the manager mode can browse services */
- if (!lpService->bManagerMode ||
- IS_INVALID_HANDLE(lpService->hManager))
- return 0;
- hLock = LockServiceDatabase(lpService->hManager);
- if (IS_INVALID_HANDLE(hLock)) {
- apxLogWrite(APXLOG_MARK_SYSERR);
-
- return 0;
- }
- AplZeroMemory(&stEnum, sizeof(APXREGENUM));
-
- while (TRUE) {
- APXSERVENTRY stEntry;
- BOOL rv;
- AplZeroMemory(&stEntry, sizeof(APXSERVENTRY));
- rv = apxRegistryEnumServices(&stEnum, &stEntry);
-
- if (rv) {
- INT fm = -1;
- SC_HANDLE hSrv = NULL;
- DWORD dwNeeded = 0;
- hSrv = OpenServiceW(lpService->hManager,
- stEntry.szServiceName,
- GENERIC_READ);
- if (!IS_INVALID_HANDLE(hSrv)) {
- QueryServiceConfigW(hSrv, NULL, 0, &dwNeeded);
- stEntry.lpConfig = (LPQUERY_SERVICE_CONFIGW)apxPoolAlloc(hService->hPool,
- dwNeeded);
- /* Call the QueryServiceConfig again with allocated config */
- if (QueryServiceConfigW(hSrv, stEntry.lpConfig, dwNeeded, &dwNeeded)) {
- /* Make that customizable so that kernel mode drivers can be
- * displayed and maintained. For now skip the
- * filesystem and device drivers.
- * XXX: Do we need that customizable after all?
- */
- if ((stEntry.lpConfig->dwServiceType &
- ~SERVICE_INTERACTIVE_PROCESS) & SERVICE_WIN32)
- fm = 0;
-
- if (!fm && szIncludeNamePattern) {
- fm = apxMultiStrMatchW(stEntry.szServiceName,
- szIncludeNamePattern, L';', TRUE);
- }
- if (!fm && szExcludeNamePattern) {
- fm = !apxMultiStrMatchW(stEntry.szServiceName,
- szExcludeNamePattern, L';', TRUE);
- }
- if (!fm && szIncludeImagePattern) {
- fm = apxMultiStrMatchW(stEntry.lpConfig->lpBinaryPathName,
- szIncludeImagePattern, L';', TRUE);
- }
- if (!fm && szExcludeImagePattern) {
- fm = !apxMultiStrMatchW(stEntry.szServiceName,
- szExcludeImagePattern, L';', TRUE);
- }
- if (!fm) {
- DWORD dwNeed;
- QueryServiceStatus(hSrv, &(stEntry.stServiceStatus));
- QueryServiceStatusEx(hSrv, SC_STATUS_PROCESS_INFO,
- (LPBYTE)(&(stEntry.stStatusProcess)),
- sizeof(SERVICE_STATUS_PROCESS),
- &dwNeed);
- /* finally call the provided callback */
- rv = (*fnDisplayCallback)(lpCbData, uMsg,
- (WPARAM)&stEntry,
- (LPARAM)nFound++);
- }
- }
- /* release the skipped service config */
- if (fm) {
- apxFree(stEntry.lpConfig);
- }
- }
- SAFE_CLOSE_SCH(hSrv);
- }
- if (!rv)
- break;
- }
-
- UnlockServiceDatabase(hLock);
- return nFound;
-}