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:44 UTC

[commons-daemon] 03/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 acfefa3114d5e2adb881a83a9c505873c58d4d05
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jun 12 22:48:14 2019 +0100

    Remove unused code
---
 src/native/windows/src/private.h  | 43 +++++++++-----------------
 src/native/windows/src/registry.c | 65 ---------------------------------------
 2 files changed, 15 insertions(+), 93 deletions(-)

diff --git a/src/native/windows/src/private.h b/src/native/windows/src/private.h
index 7c0db81..175df9f 100644
--- a/src/native/windows/src/private.h
+++ b/src/native/windows/src/private.h
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
+
 #ifndef _PRIVATE_H_INCLUDED_
 #define _PRIVATE_H_INCLUDED_
 
@@ -139,7 +139,7 @@ struct {                                                                \
         }                                                               \
         *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);              \
 } while (0)
-  
+
 /** Some usefull macros */
 
 #define APXHANDLE_SPINLOCK(h)               \
@@ -169,7 +169,7 @@ struct {                                                                \
 /*
  * Define a union with types which are likely to have the longest
  * *relevant* CPU-specific memory word alignment restrictions...
- */ 
+ */
 typedef union APXMEMWORD {
     void  *vp;
     void (*fp)(void);
@@ -187,36 +187,36 @@ struct APXCALLHOOK {
 };
 
 struct stAPXHANDLE {
-    /** The type of the handle */ 
-    DWORD               dwType;         
-    /** Handle Flags */ 
+    /** The type of the handle */
+    DWORD               dwType;
+    /** Handle Flags */
     DWORD               dwFlags;
-    /** Handle user data size */ 
+    /** Handle user data size */
     DWORD               dwSize;
-    /** parameters for event callback */ 
+    /** parameters for event callback */
     WPARAM              wParam;
     LPARAM              lParam;
     UINT                uMsg;
-    /** main callback function (using default if not specified) */ 
+    /** main callback function (using default if not specified) */
     LPAPXFNCALLBACK     fnCallback;
     /** callback functions hook list */
     TAILQ_HEAD(_lCallbacks, APXCALLHOOK) lCallbacks;
     /** allocation pool  */
     APXHANDLE           hPool;
-    /** interlocking value */ 
+    /** interlocking value */
     LONG volatile       lvSpin;
 
-    /** message event handle  */ 
+    /** message event handle  */
     HANDLE              hEventHandle;
-    /** message event thread  */ 
+    /** message event thread  */
     HANDLE              hEventThread;
-    /** message event thread id  */ 
+    /** message event thread id  */
     DWORD               hEventThreadId;
     /** private local heap */
     HANDLE              hHeap;
-    /** list enty for pool  */ 
+    /** list enty for pool  */
     TAILQ_ENTRY(stAPXHANDLE)  queue;
-    /** small userdata pointer  */ 
+    /** small userdata pointer  */
     union   {
         LPVOID          lpPtr;
         HANDLE          hWinHandle;
@@ -236,19 +236,6 @@ struct APXMULTISZ {
     DWORD   dwInsert;     /* next insert position */
 };
 
-typedef struct APXREGENUM {
-    HKEY     hServicesKey;
-    DWORD    dwIndex;                   /* current enum index           */
-    DWORD    cSubKeys;                  /* number of subkeys            */
-    DWORD    cbMaxSubKey;               /* longest subkey size          */
-    DWORD    cchMaxClass;               /* longest class string         */
-    DWORD    cValues;                   /* number of values for key     */
-    DWORD    cchMaxValue;               /* longest value name           */
-    DWORD    cbMaxValueData;            /* longest value data           */
-
-} APXREGENUM, *LPAPXREGENUM;
-
-BOOL    apxRegistryEnumServices(LPAPXREGENUM lpEnum, LPAPXSERVENTRY lpEntry);
 BOOL    apxGetServiceDescriptionW(LPCWSTR szServiceName, LPWSTR szDescription,
                                   DWORD dwDescriptionLength);
 BOOL    apxGetServiceUserW(LPCWSTR szServiceName, LPWSTR szUser,
diff --git a/src/native/windows/src/registry.c b/src/native/windows/src/registry.c
index eb4ed46..d5f1958 100644
--- a/src/native/windows/src/registry.c
+++ b/src/native/windows/src/registry.c
@@ -848,71 +848,6 @@ LPWSTR apxGetJavaSoftRuntimeLib(APXHANDLE hPool)
     return NULL;
 }
 
-/* Service Registry helper functions */
-
-BOOL apxRegistryEnumServices(LPAPXREGENUM lpEnum, LPAPXSERVENTRY lpEntry)
-{
-    DWORD rc, dwLength = SIZ_RESLEN;
-
-    if (IS_INVALID_HANDLE(lpEnum->hServicesKey)) {
-        rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE, REGSERVICE_ROOT, 0,
-                       KEY_READ, &(lpEnum->hServicesKey));
-        if (rc != ERROR_SUCCESS) {
-            return FALSE;
-        }
-        rc = RegQueryInfoKeyW(lpEnum->hServicesKey,
-                              NULL,
-                              NULL,
-                              NULL,
-                              &lpEnum->cSubKeys,
-                              &lpEnum->cbMaxSubKey,
-                              &lpEnum->cchMaxClass,
-                              &lpEnum->cValues,
-                              &lpEnum->cchMaxValue,
-                              &lpEnum->cbMaxValueData,
-                              NULL,
-                              NULL);
-        /* TODO: add dynamic maxsubkey length */
-        if (rc != ERROR_SUCCESS || lpEnum->cbMaxSubKey > SIZ_RESLEN) {
-            SAFE_CLOSE_KEY(lpEnum->hServicesKey);
-            return FALSE;
-        }
-    }
-    if (lpEnum->dwIndex >= lpEnum->cSubKeys) {
-        SAFE_CLOSE_KEY(lpEnum->hServicesKey);
-        return FALSE;
-    }
-    rc = RegEnumKeyExW(lpEnum->hServicesKey,
-                       lpEnum->dwIndex++,
-                       lpEntry->szServiceName,
-                       &dwLength,
-                       NULL,
-                       NULL,
-                       NULL,
-                       NULL);
-    if (rc != ERROR_SUCCESS) {
-        SAFE_CLOSE_KEY(lpEnum->hServicesKey);
-        return FALSE;
-    }
-    else {
-        HKEY hKey;
-        rc = RegOpenKeyExW(lpEnum->hServicesKey, lpEntry->szServiceName,
-                           0, KEY_READ, &hKey);
-        if (rc != ERROR_SUCCESS) {
-            SAFE_CLOSE_KEY(lpEnum->hServicesKey);
-            return FALSE;
-        }
-        __apxGetRegistryStrW(NULL, hKey, REGDESCRIPTION,
-                            lpEntry->szServiceDescription, SIZ_DESLEN);
-        __apxGetRegistryStrW(NULL, hKey, REGSERVICE_USER,
-                            lpEntry->szObjectName, SIZ_RESLEN);
-        lpEntry->dwStart = __apxGetRegistryDwordW(NULL, hKey, REGSERVICE_START);
-        RegCloseKey(hKey);
-
-    }
-    return TRUE;
-}
-
 BOOL apxGetServiceDescriptionW(LPCWSTR szServiceName, LPWSTR szDescription,
                                DWORD dwDescriptionLength)
 {