You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by mt...@apache.org on 2004/04/07 13:23:46 UTC

cvs commit: jakarta-commons/daemon/src/native/nt/procrun/include service.h rprocess.h registry.h log.h javajni.h handles.h gui.h console.h cmdline.h apxwin.h

mturk       2004/04/07 04:23:46

  Added:       daemon/src/native/nt/procrun/include service.h rprocess.h
                        registry.h log.h javajni.h handles.h gui.h
                        console.h cmdline.h apxwin.h
  Log:
  Initial upload
  
  Revision  Changes    Path
  1.1                  jakarta-commons/daemon/src/native/nt/procrun/include/service.h
  
  Index: service.h
  ===================================================================
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
   
  #ifndef _SERVICE_H_INCLUDED_
  #define _SERVICE_H_INCLUDED_
  
  __APXBEGIN_DECLS
  
  typedef struct APXSERVENTRY {
      WCHAR   szServiceName[SIZ_RESLEN];
      WCHAR   szObjectName[SIZ_RESLEN];
      WCHAR   szServiceDescription[SIZ_DESLEN];
      DWORD   dwStart;
      LPQUERY_SERVICE_CONFIGW lpConfig;
      SERVICE_STATUS          stServiceStatus;
      SERVICE_STATUS_PROCESS  stStatusProcess;
  
  } APXSERVENTRY, *LPAPXSERVENTRY;
  
  
  APXHANDLE   apxCreateService(APXHANDLE hPool, DWORD dwOptions,
                               BOOL bManagerMode);
  
  BOOL        apxServiceOpen(APXHANDLE hService, LPCWSTR szServiceName);
  
  
  BOOL        apxServiceSetNames(APXHANDLE hService, LPCWSTR szImagePath,
                                 LPCWSTR szDisplayName, LPCWSTR szDescription,
                                 LPCWSTR szUsername, LPCWSTR szPassword);
  
  BOOL        apxServiceSetOptions(APXHANDLE hService, DWORD dwServiceType,
                                   DWORD dwStartType, DWORD dwErrorControl);
  
  BOOL        apxServiceControl(APXHANDLE hService, DWORD dwControl, UINT uMsg,
                                LPAPXFNCALLBACK fnControlCallback,
                                LPVOID lpCbData);
  BOOL        apxServiceInstall(APXHANDLE hService, LPCWSTR szServiceName,
                                LPCWSTR szDisplayName, LPCWSTR szImagePath,
                                LPCWSTR lpDependencies, DWORD dwServiceType,
                                DWORD dwStartType);
  
  LPAPXSERVENTRY  apxServiceEntry(APXHANDLE hService, BOOL bRequeryStatus);
  
  /** Delete te service
   * Stops the service if running
   */
  BOOL        apxServiceDelete(APXHANDLE hService);
  
  DWORD       apxServiceBrowse(APXHANDLE hService,
                               LPCWSTR szIncludeNamePattern,
                               LPCWSTR szIncludeImagePattern,
                               LPCWSTR szExcludeNamePattern,
                               LPCWSTR szExcludeImagePattern,
                               UINT uMsg,
                               LPAPXFNCALLBACK fnDisplayCallback,
                               LPVOID lpCbData);
  
  __APXEND_DECLS
  
  #endif /* _SERVICE_H_INCLUDED_ */
  
  
  
  1.1                  jakarta-commons/daemon/src/native/nt/procrun/include/rprocess.h
  
  Index: rprocess.h
  ===================================================================
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
   
  #ifndef _RPROCESS_H_INCLUDED_
  #define _RPROCESS_H_INCLUDED_
  
  __APXBEGIN_DECLS
  
  BOOL        apxProcessExecute(APXHANDLE hProcess);
  
  APXHANDLE   apxCreateProcessA(APXHANDLE hPool, DWORD dwOptions,
                                LPAPXFNCALLBACK fnCallback,
                                LPCSTR szUsername, LPCSTR szPassword,
                                BOOL bLogonAsService);
  APXHANDLE   apxCreateProcessW(APXHANDLE hPool, DWORD dwOptions,
                                LPAPXFNCALLBACK fnCallback,
                                LPCWSTR szUsername, LPCWSTR szPassword,
                                BOOL bLogonAsService);
  
  #ifdef _UNICODE
  #define apxCreateProcess    apxCreateProcessW
  #else
  #define apxCreateProcess    apxCreateProcessA
  #endif
  
  BOOL        apxProcessSetExecutableA(APXHANDLE hProcess, LPCSTR szName);
  BOOL        apxProcessSetExecutableW(APXHANDLE hProcess, LPCWSTR szName);
  
  BOOL        apxProcessSetCommandLineA(APXHANDLE hProcess, LPCSTR szCmdline);
  BOOL        apxProcessSetCommandLineW(APXHANDLE hProcess, LPCWSTR szCmdline);
  BOOL        apxProcessSetCommandArgsW(APXHANDLE hProcess, LPCWSTR szTitle,
                                        DWORD dwArgc, LPCWSTR *lpArgs);
  
  BOOL        apxProcessSetWorkingPathA(APXHANDLE hProcess, LPCSTR szPath);
  BOOL        apxProcessSetWorkingPathW(APXHANDLE hProcess, LPCWSTR szPath);
  
  DWORD       apxProcessPutcA(APXHANDLE hProcess, INT ch);
  DWORD       apxProcessPutcW(APXHANDLE hProcess, INT ch);
  DWORD       apxProcessPutsA(APXHANDLE hProcess, LPCSTR szString);
  DWORD       apxProcessPutsW(APXHANDLE hProcess, LPCWSTR szString);
  
  #ifndef _UNICODE
  #define     apxProcessPutc  apxProcessPutcA
  #define     apxProcessPuts  apxProcessPutsA
  #else
  #define     apxProcessPutc  apxProcessPutcW
  #define     apxProcessPuts  apxProcessPutsW
  #endif
  
  DWORD       apxProcessWrite(APXHANDLE hProcess, LPCVOID lpData, DWORD dwLen);
  
  VOID        apxProcessCloseInputStream(APXHANDLE hProcess);
  BOOL        apxProcessFlushStdin(APXHANDLE hProcess);
  
  DWORD       apxProcessWait(APXHANDLE hProcess, DWORD dwMilliseconds,
                             BOOL bKill);
  
  BOOL        apxProcessRunning(APXHANDLE hProcess);
  
  
  __APXEND_DECLS
  
  #endif /* _RPROCESS_H_INCLUDED_ */
  
  
  
  1.1                  jakarta-commons/daemon/src/native/nt/procrun/include/registry.h
  
  Index: registry.h
  ===================================================================
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
   
  #ifndef _REGISTRY_H_INCLUDED_
  #define _REGISTRY_H_INCLUDED_
  
  __APXBEGIN_DECLS
  
  #define APXREG_SOFTWARE         0x0001
  #define APXREG_SERVICE          0x0002
  #define APXREG_USER             0x0004
  
  #define APXREG_PARAMSOFTWARE    0x0010
  #define APXREG_PARAMSERVICE     0x0020
  #define APXREG_PARAMUSER        0x0040
  
  /** Create or open the process registry keys
   */
  APXHANDLE apxCreateRegistryA(APXHANDLE hPool, REGSAM samDesired,
                               LPCSTR szRoot, LPCSTR szKeyName,
                               DWORD dwOptions);
  APXHANDLE apxCreateRegistryW(APXHANDLE hPool, REGSAM samDesired,
                               LPCWSTR szRoot, LPCWSTR szKeyName,
                               DWORD dwOptions);
  
  #ifdef _UNICODE
  #define apxCreateRegistry   apxCreateRegistryW
  #else
  #define apxCreateRegistry   apxCreateRegistryA
  #endif
  
  /** Delete the process registry keys
   */
  BOOL      apxDeleteRegistryA(LPCSTR szRoot, LPCSTR szKeyName,
                              BOOL bDeleteEmpty);
  
  BOOL      apxDeleteRegistryW(LPCWSTR szRoot, LPCWSTR szKeyName,
                              BOOL bDeleteEmpty);
  
  #ifdef _UNICODE
  #define apxDeleteRegistry   apxDeleteRegistryW
  #else
  #define apxDeleteRegistry   apxDeleteRegistryA
  #endif
  
  /** Get the JavaHome path from registry
   * and set the JAVA_HOME environment variable if not found
   * If bPreferJre is set use the JRE's path as JAVA_HOME
   */
  LPWSTR    apxGetJavaSoftHome(APXHANDLE hPool, BOOL bPreferJre);
  
  /** Get the Java RuntimeLib from registry (jvm.dll)
   */
  LPWSTR    apxGetJavaSoftRuntimeLib(APXHANDLE hPool);
  
  LPSTR     apxRegistryGetStringA(APXHANDLE hRegistry, DWORD dwFrom,
                                  LPCSTR szSubkey, LPCSTR szValueName);
  
  LPWSTR    apxRegistryGetStringW(APXHANDLE hRegistry, DWORD dwFrom,
                                  LPCWSTR szSubkey, LPCWSTR szValueName);
  
  #ifdef _UNICODE
  #define apxRegistryGetString    apxRegistryGetStringW
  #else
  #define apxRegistryGetString    apxRegistryGetStringA
  #endif
  
  LPBYTE    apxRegistryGetBinaryA(APXHANDLE hRegistry, DWORD dwFrom,
                                  LPCSTR szSubkey, LPCSTR szValueName,
                                  LPBYTE lpData, LPDWORD lpdwLength);
  
  LPBYTE    apxRegistryGetBinaryW(APXHANDLE hRegistry, DWORD dwFrom,
                                  LPCWSTR szSubkey, LPCWSTR szValueName,
                                  LPBYTE lpData, LPDWORD lpdwLength);
  
  #ifdef _UNICODE
  #define apxRegistryGetBinary    apxRegistryGetBinaryW
  #else
  #define apxRegistryGetBinary    apxRegistryGetBinaryA
  #endif
  
  BOOL    apxRegistrySetBinaryA(APXHANDLE hRegistry, DWORD dwFrom,
                                LPCSTR szSubkey, LPCSTR szValueName,
                                const LPBYTE lpData, DWORD dwLength);
  
  BOOL    apxRegistrySetBinaryW(APXHANDLE hRegistry, DWORD dwFrom,
                                LPCWSTR szSubkey, LPCWSTR szValueName,
                                const LPBYTE lpData, DWORD dwLength);
  
  LPWSTR  apxRegistryGetMzStrW(APXHANDLE hRegistry, DWORD dwFrom,
                               LPCWSTR szSubkey, LPCWSTR szValueName,
                               LPWSTR lpData, LPDWORD lpdwLength);
  
  BOOL    apxRegistrySetMzStrW(APXHANDLE hRegistry, DWORD dwFrom,
                               LPCWSTR szSubkey, LPCWSTR szValueName,
                               LPCWSTR lpData, DWORD dwLength);
  
  BOOL    apxRegistrySetStrA(APXHANDLE hRegistry, DWORD dwFrom,
                             LPCSTR szSubkey, LPCSTR szValueName,
                             LPCSTR szValue);
  
  BOOL    apxRegistrySetStrW(APXHANDLE hRegistry, DWORD dwFrom,
                             LPCWSTR szSubkey, LPCWSTR szValueName,
                             LPCWSTR szValue);
  
  
  #ifdef _UNICODE
  #define apxRegistrySetStr    apxRegistrySetStrW
  #else
  #define apxRegistrySetStr    apxRegistrySetStrA
  #endif
  
  BOOL    apxRegistrySetNumW(APXHANDLE hRegistry, DWORD dwFrom,
                             LPCWSTR szSubkey, LPCWSTR szValueName,
                             DWORD dwValue);
  
  DWORD   apxRegistryGetNumberW(APXHANDLE hRegistry, DWORD dwFrom,
                                LPCWSTR szSubkey, LPCWSTR szValueName);
  
  
  BOOL    apxRegistryDeleteW(APXHANDLE hRegistry, DWORD dwFrom,
                             LPCWSTR szSubkey, LPCWSTR szValueName);
  
  
  #ifdef _UNICODE
  #define apxRegistryDelete    apxRegistryDeleteW
  #else
  #define apxRegistryDelete    apxRegistryDeleteA
  #endif
  
  __APXEND_DECLS
  
  #endif /* _REGISTRY_H_INCLUDED_ */
  
  
  
  1.1                  jakarta-commons/daemon/src/native/nt/procrun/include/log.h
  
  Index: log.h
  ===================================================================
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
   
  /* Logfile handling 
   * Use Systemdir/Logfiles/Apache as a default path
   */
  
  #ifndef _LOG_H_INCLUDED_
  #define _LOG_H_INCLUDED_
  
  __APXBEGIN_DECLS
  
  #define APX_LOGLOCK(file)                           \
      APXMACRO_BEGIN                                  \
          DWORD _lmax = 0;                            \
          while(!LockFile(file, 0, 0, 512, 0)) {      \
              Sleep(10);                              \
              if (_lmax++ > 1000) break;              \
          }                                           \
          SetFilePointer(file, 0, NULL, FILE_END);    \
      APXMACRO_END
  
  #define APX_LOGUNLOCK(file)                         \
      APXMACRO_BEGIN                                  \
          UnlockFile(file, 0, 0, 512, 0);             \
      APXMACRO_END
  
  #define APXLOG_LEVEL_DEBUG  0
  #define APXLOG_LEVEL_INFO   1
  #define APXLOG_LEVEL_WARN   2
  #define APXLOG_LEVEL_ERROR  3
  
  #define APXLOG_MARK_INFO    NULL, APXLOG_LEVEL_INFO,  TRUE,  NULL, 0, ""
  #define APXLOG_MARK_WARN    NULL, APXLOG_LEVEL_WARN,  TRUE,  NULL, 0, ""
  #define APXLOG_MARK_ERROR   NULL, APXLOG_LEVEL_ERROR, TRUE,  __FILE__, __LINE__, ""
  #define APXLOG_MARK_DEBUG   NULL, APXLOG_LEVEL_DEBUG, TRUE,  __FILE__, __LINE__, ""
  #define APXLOG_MARK_RAW     NULL, APXLOG_LEVEL_INFO,  FALSE, NULL, 0,
  #define APXLOG_MARK_SYSERR  NULL, APXLOG_LEVEL_ERROR, TRUE,  __FILE__, __LINE__, NULL
  
  
  HANDLE apxLogOpen(
      APXHANDLE hPool,
      LPCWSTR szPath,
      LPCWSTR szPrefix
  );
  
  void apxLogClose(
      HANDLE hFile
  );
  
  void apxLogLevelSet(
      HANDLE  hFile,
      DWORD dwLevel
  );
  
  void apxLogLevelSetW(
      HANDLE  hFile,
      LPCWSTR szLevel
  );
  
  int
  apxLogWrite(
      HANDLE  hFile,
      DWORD   dwLevel,
      BOOL    bTimeStamp,
      LPCSTR  szFile,
      DWORD   dwLine,
      LPCSTR  szFormat,
      ...
  );
  
  int
  apxDisplayError(
      BOOL    bDisplay,
      LPCSTR  szFile,
      DWORD   dwLine,
      LPCSTR  szFormat,
      ...
  );
  
  __APXEND_DECLS
  
  #endif /* _LOG_H_INCLUDED_ */
  
  
  
  1.1                  jakarta-commons/daemon/src/native/nt/procrun/include/javajni.h
  
  Index: javajni.h
  ===================================================================
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
   
  #ifndef _JAVAJNI_H_INCLUDED_
  #define _JAVAJNI_H_INCLUDED_
  
  __APXBEGIN_DECLS
  
  APXHANDLE   apxCreateJava(APXHANDLE hPool, LPCWSTR szJvmDllPath);
  
  BOOL        apxJavaInitialize(APXHANDLE hJava, LPCSTR szClassPath,
                                LPCVOID lpOptions, DWORD dwMs, DWORD dwMx,
                                DWORD dwSs);
  
  BOOL        apxJavaLoadMainClass(APXHANDLE hJava, LPCSTR szClassName,
                                   LPCSTR szMethodName,
                                   LPCVOID lpArguments);
  
  BOOL        apxJavaStart(APXHANDLE hJava);
  
  DWORD       apxJavaWait(APXHANDLE hJava, DWORD dwMilliseconds, BOOL bKill);
  
  BOOL        apxJavaSetOut(APXHANDLE hJava, BOOL setErrorOrOut,
                            LPCWSTR szFilename);
  
  
  __APXEND_DECLS
  
  #endif /* _JAVAJNI_H_INCLUDED_ */
  
  
  
  1.1                  jakarta-commons/daemon/src/native/nt/procrun/include/handles.h
  
  Index: handles.h
  ===================================================================
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
   
  #ifndef _HANDLES_H_INCLUDED_
  #define _HANDLES_H_INCLUDED_
  
  __APXBEGIN_DECLS
  
  #define SAFE_CLOSE_HANDLE(h)                            \
      if ((h) != NULL && (h) != INVALID_HANDLE_VALUE) {   \
          CloseHandle((h));                               \
          (h) = NULL;                                     \
      }
  
  typedef struct stAPXHANDLE  stAPXHANDLE;
  typedef stAPXHANDLE*        APXHANDLE;
  
  /**
   * Alignment macros
   */
  
  /* APR_ALIGN() is only to be used to align on a power of 2 boundary */
  #define APX_ALIGN(size, boundary) \
      (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  
  /** Default alignment */
  #define APX_ALIGN_DEFAULT(size) APX_ALIGN(size, 16)
  
   
  /** Handle callback function prototype */
  typedef BOOL (*LPAPXFNCALLBACK)(APXHANDLE hObject, UINT uMsg,
                                  WPARAM wParam, LPARAM lParam);
  
  #define APXHANDLE_INVALID               ((void *)0xdeadbeefLL)
  
  #define APXHANDLE_HOOK_FIRST            0
  #define APXHANDLE_HOOK_LAST             1
  
  /** Flags */
  /** handle has its own heap */
  #define APXHANDLE_HAS_HEAP              0x00000001
  /** handle has CriticalSection */
  #define APXHANDLE_HAS_LOCK              0x00000002
  /** handle owns the CriticalSection */
  #define APXHANDLE_OWNS_LOCK             0x00000006
  /** handle has EventThread */
  #define APXHANDLE_HAS_EVENT             0x00000010
  /** handle has UserData */
  #define APXHANDLE_HAS_USERDATA          0x00000020
  
  /** Types */
  #define APXHANDLE_TYPE_INVALID          0xdeadbeef
  #define APXHANDLE_TYPE_POOL             0x01000000
  #define APXHANDLE_TYPE_WINHANDLE        0x02000000
  #define APXHANDLE_TYPE_SERVICE          0x03000000
  #define APXHANDLE_TYPE_LPTR             0x04000000
  #define APXHANDLE_TYPE_CONSOLE          0x05000000
  #define APXHANDLE_TYPE_PROCESS          0x06000000
  #define APXHANDLE_TYPE_JVM              0x07000000
  #define APXHANDLE_TYPE_REGISTRY         0x08000000
  
  /** Initialize the Handle manager
   *  reference counted
   */
  BOOL        apxHandleManagerInitialize();
  /** Destroys the Handle manager
   *  reference counted
   */
  BOOL        apxHandleManagerDestroy();
  /** Create the memory pool
   * param: hParent   parent pool or NULL to use the system pool
   *        dwOptions OR'd flags: APXHANDLE_HAS_HEAP,
   *                              APXHANDLE_HAS_LOCK
   *                              APXHANDLE_OWNS_LOCK
   */                 
  APXHANDLE   apxPoolCreate(APXHANDLE hParent, DWORD dwOptions);
  /** Create the memory pool
   * param: hPpool    pool to allocate from or NULL for system pool
   *        dwOptions OR'd flags: see APXHANDLE_TYPE_ and APXHANDLE_HAS_
   *                              values
   *        lpData     user supplied Data
   *        dwDataSize extra pool user data size, combined with options
   *                   the lpData is copied to the internal storage;   
   *        fnCallback Optional handle callback function
   */                 
  APXHANDLE   apxHandleCreate(APXHANDLE hPool, DWORD dwOptions,
                              LPVOID lpData, DWORD  dwDataSize,
                              LPAPXFNCALLBACK fnCallback);
  /** Close the handle
   *  Calls the callback function and frees the memory
   */
  BOOL        apxCloseHandle(APXHANDLE hObject);
  /** Get The internal user data
   */
  LPVOID      apxHandleGetUserData(APXHANDLE hObject);
  /** Set The internal user data
   *  params:
   *        lpData     user supplied Data
   *        dwDataSize user data size, combined with create options
   *                   the lpData is either copied to the internal storage
   *                   or assigned.
   */
  LPVOID      apxHandleSetUserData(APXHANDLE hObject, LPVOID lpData,
                                   DWORD dwDataSize);
  /** Send the message to the handle 
   *  Callback function is executed with WM_COMMAND uMsg
   */
  BOOL        apxHandleSendMessage(APXHANDLE hObject, UINT uMsg,
                                   WPARAM wParam, LPARAM lParam);
  
  /** Post the message to the handle 
   *  function returns imediately.
   */
  BOOL        apxHandlePostMessage(APXHANDLE hObject, UINT uMsg,
                                   WPARAM wParam, LPARAM lParam);
  /** Lock or unlock the handle
   * If bLock is true lock the handle, otherwise unlock.
   */
  BOOL        apxHandleLock(APXHANDLE hObject, BOOL bLock);
  
  /** Add the callback to the handles hook chain
   * 
   */
  BOOL        apxHandleAddHook(APXHANDLE hObject, DWORD dwWhere,
                               LPAPXFNCALLBACK fnCallback);
  
  DWORD       apxHandleWait(APXHANDLE hHandle, DWORD dwMilliseconds,
                            BOOL bKill);
  
  /** General pool memory allocation functions
   */
  LPVOID      apxPoolAlloc(APXHANDLE hPool, DWORD dwSize);
  LPVOID      apxPoolCalloc(APXHANDLE hPool, DWORD dwSize);
  LPVOID      apxPoolRealloc(APXHANDLE hPool, LPVOID lpMem, DWORD dwNewSize);
  LPTSTR      apxPoolStrdup(APXHANDLE hPool, LPCTSTR szSource);
  
  /** General system pool memory allocation functions
   */
  
  LPVOID      apxAlloc(DWORD dwSize);
  LPVOID      apxCalloc(DWORD dwSize);
  LPVOID      apxRealloc(LPVOID lpMem, DWORD dwNewSize);
  
  LPSTR       apxStrdupA(LPCSTR szSource);
  LPWSTR      apxStrdupW(LPCWSTR szSource);
  LPSTR       apxPoolStrdupA(APXHANDLE hPool, LPCSTR szSource);
  LPWSTR      apxPoolStrdupW(APXHANDLE hPool, LPCWSTR szSource);
  
  LPWSTR      apxPoolWStrdupA(APXHANDLE hPool, LPCSTR szSource);
  
  #define     apxPoolWStrdupW apxPoolStrdupW
  
  #ifdef _UNICODE
  #define apxStrdup       apxStrdupW
  #define apxPoolStrdup   apxPoolStrdupW
  #else
  #define apxStrdup       apxStrdupA
  #define apxPoolStrdup   apxPoolStrdupW
  #endif
  
  #ifndef _UNICODE
  #define     apxPoolWStrdup  apxPoolWStrdupA
  #define     apxWStrdup      apxWStrdupA
  #else
  #define     apxPoolWStrdup  apxPoolStrdupW
  #define     apxWStrdup      apxStrdupW
  #endif
  /** Free the allocated memory
   * It will call te correct pool if the address is valid
   */
  VOID        apxFree(LPVOID lpMem);
  
  __APXEND_DECLS
  
  #endif /* _HANDLES_H_INCLUDED_ */
  
  
  
  1.1                  jakarta-commons/daemon/src/native/nt/procrun/include/gui.h
  
  Index: gui.h
  ===================================================================
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
   
  #ifndef _GUI_H_INCLUDED_
  #define _GUI_H_INCLUDED_
  
  __APXBEGIN_DECLS
  
  
  #define IDC_STATIC              -1
  #define IDC_APPLICATION         100
  #define IDI_MAINICON            101
  #define IDC_STATBAR             102
  #define IDB_SUSERS              103
  
  #define IDS_APPLICATION         150
  #define IDS_APPDESCRIPTION      151
  #define IDS_APPVERSION          152
  #define IDS_APPCOPYRIGHT        153
  #define IDS_APPFULLNAME         154
  
  #define IDD_ABOUTBOX            250
  #define IDC_LICENSE             251
  #define IDR_LICENSE             252
  #define IAB_SYSINF              253
  #define IDC_ABOUTAPP            254
  
  #define IDD_PROGRESS            260
  #define IDDP_HEAD               261
  #define IDDP_TEXT               262
  #define IDDP_PROGRESS           263
  
  #define IDD_SELUSER             270
  #define IDSU_SELNAME            271
  #define IDSU_SELECTED           272
  #define IDSU_LIST               273
  #define IDSU_COMBO              274
  
  
  #define WM_TRAYMESSAGE          (WM_APP+1) 
  
  #define SNDMSGW SendMessageW
  #define SNDMSGA SendMessageA
  #define ComboBox_AddStringW(hwndCtl, lpsz)       ((int)(DWORD)SNDMSGW((hwndCtl), CB_ADDSTRING, 0L, (LPARAM)(LPCWSTR)(lpsz)))
  
  #define ListView_SetItemTextW(hwndLV, i, iSubItem_, pszText_) \
  { LV_ITEMW _ms_lvi;\
    _ms_lvi.iSubItem = iSubItem_;\
    _ms_lvi.pszText = pszText_;\
    SNDMSG((hwndLV), LVM_SETITEMTEXTW, (WPARAM)(i), (LPARAM)(LV_ITEMW *)&_ms_lvi);\
  } ((void)0)
  
  #define ListView_GetItemTextA(hwndLV, i, iSubItem_, pszText_, cchTextMax_) \
  { LV_ITEMA _ms_lvi;\
    _ms_lvi.iSubItem = iSubItem_;\
    _ms_lvi.cchTextMax = cchTextMax_;\
    _ms_lvi.pszText = pszText_;\
    SNDMSGA((hwndLV), LVM_GETITEMTEXTA, (WPARAM)(i), (LPARAM)(LV_ITEMA *)&_ms_lvi);\
  }  ((void)0)
  
  #define ListView_GetItemTextW(hwndLV, i, iSubItem_, pszText_, cchTextMax_) \
  { LV_ITEMW _ms_lvi;\
    _ms_lvi.iSubItem = iSubItem_;\
    _ms_lvi.cchTextMax = cchTextMax_;\
    _ms_lvi.pszText = pszText_;\
    SNDMSG((hwndLV), LVM_GETITEMTEXTW, (WPARAM)(i), (LPARAM)(LV_ITEMW *)&_ms_lvi);\
  }  ((void)0)
  
  #define ListView_InsertItemW(hwnd, pitem)   \
      (int)SNDMSGW((hwnd), LVM_INSERTITEMW, 0, (LPARAM)(const LV_ITEMW *)(pitem))
  
  typedef struct APXLVITEM {
      INT         iPosition;
      BOOL        bSortable;
      INT         iWidth;
      INT         iDefault;
      INT         iFmt;
      LPTSTR      szLabel;
  } APXLVITEM, *LPAPXLVITEM; 
  
  typedef struct APXGUISTATE {
      DWORD       dwShow;
      RECT        rcPosition;
      COLORREF    bgColor;
      COLORREF    fgColor;
      COLORREF    txColor;
      INT         nColumnWidth[32];
      INT         nUser[8];
  } APXGUISTATE, *LPAPXGUISTATE;
  
  typedef struct APXGUISTORE {
      HANDLE  hInstance;
      HICON   hIcon;
      HICON   hIconSm;
      HICON   hIconHg;
      HWND    hMainWnd;
      HACCEL  hAccel;
      TCHAR   szWndClass[256];
      TCHAR   szWndMutex[256];
      APXGUISTATE stState;
      STARTUPINFO stStartupInfo;
      UINT        nWhellScroll;
  
  } APXGUISTORE, *LPAPXGUISTORE;
  
  LPAPXGUISTORE apxGuiInitialize(WNDPROC lpfnWndProc, LPCTSTR szAppName);
  
  BOOL        apxCenterWindow(HWND hwndChild, HWND hwndParent);
  
  LPSTR       apxLoadResourceA(UINT wID, UINT nBuf);
  LPWSTR      apxLoadResourceW(UINT wID, UINT nBuf);
  
  
  void        apxAppendMenuItem(HMENU hMenu, UINT idMenu, LPCTSTR szName,
                                BOOL bDefault, BOOL bEnabled);
  void        apxAppendMenuItemBmp(HMENU hMenu, UINT idMenu, LPCTSTR szName);
  
  void        apxManageTryIconA(HWND hWnd, DWORD dwMessage, LPCSTR szInfoTitle,
                                LPCSTR szInfo, HICON hIcon);
  void        apxManageTryIconW(HWND hWnd, DWORD dwMessage, LPCWSTR szInfoTitle,
                                LPCWSTR szInfo, HICON hIcon);
  #ifdef _UNICODE
  #define apxLoadResource apxLoadResourceW
  #else
  #define apxLoadResource apxLoadResourceA
  #endif
  
  void        apxAboutBox(HWND hWnd);
  int         apxProgressBox(HWND hWnd, LPCTSTR szHeader,
                             LPCWSTR szText,
                             LPAPXFNCALLBACK fnProgressCallback,
                             LPVOID cbData);
  BOOL        apxYesNoMessage(LPCTSTR szTitle, LPCTSTR szMessage, BOOL bStop);
  
  BOOL        apxCalcStringEllipsis(HDC hDC, LPTSTR  szString, 
                                    int cchMax, UINT uColWidth);
  LPWSTR      apxGetDlgTextW(APXHANDLE hPool, HWND hDlg, int nIDDlgItem);
  LPSTR       apxGetDlgTextA(APXHANDLE hPool, HWND hDlg, int nIDDlgItem);
  
  #ifdef _UNICODE
  #define apxGetDlgText  apxGetDlgTextW
  #else
  #define apxGetDlgText  apxGetDlgTextA
  #endif
  
  LPSTR       apxBrowseForFolderA(HWND hWnd, LPCSTR szTitle, LPCSTR szName);
  LPWSTR      apxBrowseForFolderW(HWND hWnd, LPCWSTR szTitle, LPCWSTR szName);
  
  #ifdef _UNICODE
  #define apxBrowseForFolder  apxBrowseForFolderW
  #else
  #define apxBrowseForFolder  apxBrowseForFolderA
  #endif
  
  LPSTR       apxGetFileNameA(HWND hWnd, LPCSTR szTitle, LPCSTR szFilter,
                              LPCSTR szDefExt, LPCSTR szDefPath, BOOL bOpenOrSave,
                              LPDWORD lpdwFindex);
  
  LPWSTR      apxGetFileNameW(HWND hWnd, LPCWSTR szTitle, LPCWSTR szFilter,
                              LPCWSTR szDefExt, LPCWSTR szDefPath, BOOL bOpenOrSave,
                              LPDWORD lpdwFindex);
  
  #ifdef _UNICODE
  #define apxGetFileName  apxGetFileNameW
  #else
  #define apxGetFileName  apxGetFileNameA
  #endif
  
  LPCWSTR     apxDlgSelectUser(HWND hWnd, LPWSTR szUser);
  
  __APXEND_DECLS
  
  #endif /* _GUI_H_INCLUDED_ */
  
  
  
  1.1                  jakarta-commons/daemon/src/native/nt/procrun/include/console.h
  
  Index: console.h
  ===================================================================
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
   
  #ifndef _CONSOLE_H_INCLUDED_
  #define _CONSOLE_H_INCLUDED_
  
  __APXBEGIN_DECLS
  
  
  
  __APXEND_DECLS
  
  #endif /* _CONSOLE_H_INCLUDED_ */
  
  
  
  1.1                  jakarta-commons/daemon/src/native/nt/procrun/include/cmdline.h
  
  Index: cmdline.h
  ===================================================================
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
   
  #ifndef _CMDLINE_H_INCLUDED_
  #define _CMDLINE_H_INCLUDED_
  
  __APXBEGIN_DECLS
  
  #define APXCMDOPT_NIL   0x00000000  /* Argopt value not needed */
  #define APXCMDOPT_INT   0x00000001  /* Argopt value is unsigned integer */
  #define APXCMDOPT_STR   0x00000002  /* Argopt value is string */
  #define APXCMDOPT_STE   0x00000006  /* Argopt value is expandable string */
  #define APXCMDOPT_MSZ   0x00000010  /* Multiline string '#' separated */
  #define APXCMDOPT_BIN   0x00000020  /* Encrypted binary */
  
  #define APXCMDOPT_REG   0x00000100  /* Save to registry */
  #define APXCMDOPT_SRV   0x00000200  /* Save to service registry */
  #define APXCMDOPT_USR   0x00000400  /* Save to user registry */
  
  #define APXCMDOPT_FOUND 0x00001000  /* The option is present in cmdline */
  #define APXCMDOPT_ADD   0x00002000  /* The option is present in cmdline as ++*/
  
  
  typedef struct APXCMDLINEOPT APXCMDLINEOPT;
  
  struct APXCMDLINEOPT {
      LPWSTR          szName;         /* Long Argument Name */
      LPWSTR          szRegistry;     /* Registry Association */
      LPWSTR          szSubkey;       /* Registry Association */
      DWORD           dwType;         /* Argument type (string, number, multistring */
      LPWSTR          szValue;        /* Return string value  */
      DWORD           dwValue;        /* Return numeric value or present if NIL */
  };
  
  typedef struct APXCMDLINE {
      APXCMDLINEOPT       *lpOptions;
      LPWSTR              szExecutable;   /* Parsed argv0 */
      LPWSTR              szExePath;      /* Parsed argv0 */
      LPWSTR              szApplication;  /* Fist string after //CMD// */
      DWORD               dwCmdIndex;     /* Command index */
      LPWSTR              *lpArgvw;
      DWORD               dwArgc;
      APXHANDLE           hPool;
      
  } APXCMDLINE, *LPAPXCMDLINE;
  
  LPAPXCMDLINE apxCmdlineParse(
      APXHANDLE hPool,
      APXCMDLINEOPT   *lpOptions,
      LPCWSTR         *lpszCommands
  );
  
  void apxCmdlineLoadEnvVars(
      LPAPXCMDLINE lpCmdline
  );
  
  void apxCmdlineFree(
      LPAPXCMDLINE lpCmdline
  );
  
  
  __APXEND_DECLS
  
  #endif /* _CMDLINE_H_INCLUDED_ */
  
  
  
  1.1                  jakarta-commons/daemon/src/native/nt/procrun/include/apxwin.h
  
  Index: apxwin.h
  ===================================================================
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
   
  #ifndef _APXWIN_H_INCLUDED_
  #define _APXWIN_H_INCLUDED_
  
  
  #ifndef WIN32_LEAN_AND_MEAN
  #define WIN32_LEAN_AND_MEAN 
  #endif
  #ifndef WIN32_CE
  #define _WIN32_WINNT 0x0400
  #endif
  
  #include <windows.h>
  #include <windowsx.h>
  #include <commdlg.h>
  #include <commctrl.h>
  #include <objbase.h>
  #include <shlobj.h>
  #include <shlwapi.h>
  #include <shellapi.h>
  #include <zmouse.h>
  #include <richedit.h>
  
  #include <lm.h>
  
  
  #define APXMACRO_BEGIN                  do {
  #define APXMACRO_END                    } while(0)
  
  #ifdef  __cplusplus
  #define __APXBEGIN_DECLS    extern "C" {
  #define __APXEND_DECLS  }
  #else
  #define __APXBEGIN_DECLS
  #define __APXEND_DECLS
  #endif
  
  #define SET_BIT_FLAG(x, b) ((x) |= (1 << b))
  #define CLR_BIT_FLAG(x, b) ((x) &= ~(1 << b))
  #define TST_BIT_FLAG(x, b) ((x) & (1 << b))
  
  #define IS_INVALID_HANDLE(h) (((h) == NULL || (h) == INVALID_HANDLE_VALUE))
  
  #define DYNOLAD_TYPE_DECLARE(fnName, callconv, retType)             \
      typedef retType (callconv *PFN_##fnName)                        \
  
  #define DYNLOAD_FPTR_DECLARE(fnName)                                \
      PFN_##fnName FP_##fnName
  
  #define DYNLOAD_FPTR(fnName)  FP_##fnName
  
  #define DYNLOAD_FPTR_ADDRESS(fnName, dllName)                       \
      FP_##fnName = (PFN_##fnName)GetProcAddress(                     \
                                  GetModuleHandle(TEXT(#dllName)),    \
                                  #fnName)    
  
  #define DYNLOAD_FPTR_LOAD(fnName, dllHandle)                        \
      FP_##fnName = (PFN_##fnName)GetProcAddress(                     \
                                  dllHandle,                          \
                                  #fnName)    
  
  #define DYNLOAD_CALL(fnName)    (*FP_##fnName)
  
  #ifndef ABS
  #define ABS(x)       (((x) > 0) ? (x) : (x) * (-1))
  #endif
  
  #define SIZ_RESLEN         256
  #define SIZ_RESMAX         (SIZ_RESLEN -1)
  #define SIZ_BUFLEN         512
  #define SIZ_BUFMAX         (SIZ_BUFLEN -1)
  #define SIZ_DESLEN         1024
  #define SIZ_DESMAX         (SIZ_DESLEN -1)
  #define SIZ_HUGLEN         8192
  #define SIZ_HUGMAX         (SIZ_HUGLEN -1)
  
  #include "handles.h"
  #include "log.h"
  #include "cmdline.h"
  #include "console.h"
  #include "rprocess.h"
  #include "registry.h"
  #include "service.h"
  #include "javajni.h"
  #include "gui.h"
  
  __APXBEGIN_DECLS
  
  typedef enum {
          APX_WINVER_UNK =       0,
          APX_WINVER_UNSUP =     1,
          APX_WINVER_95 =       10,
          APX_WINVER_95_B =     11,
          APX_WINVER_95_OSR2 =  12,
          APX_WINVER_98 =       14,
          APX_WINVER_98_SE =    16,
          APX_WINVER_ME =       18,
  
          APX_WINVER_UNICODE =  20, /* Prior versions support only narrow chars */
  
          APX_WINVER_CE_3 =     23, /* CE is an odd beast, not supporting */
                                 /* some pre-NT features, such as the    */
          APX_WINVER_NT =       30, /* narrow charset APIs (fooA fns), while  */
          APX_WINVER_NT_3_5 =   35, /* not supporting some NT-family features.  */
          APX_WINVER_NT_3_51 =  36,
  
          APX_WINVER_NT_4 =     40,
          APX_WINVER_NT_4_SP2 = 42,
          APX_WINVER_NT_4_SP3 = 43,
          APX_WINVER_NT_4_SP4 = 44,
          APX_WINVER_NT_4_SP5 = 45,
          APX_WINVER_NT_4_SP6 = 46,
  
          APX_WINVER_2000 =     50,
          APX_WINVER_2000_SP1 = 51,
          APX_WINVER_2000_SP2 = 52,
          APX_WINVER_XP =       60
  } APX_OSLEVEL;
  
  APX_OSLEVEL apxGetOsLevel();
  LPWSTR      AsciiToWide(LPCSTR s, LPWSTR ws);
  LPSTR       WideToAscii(LPCWSTR ws, LPSTR s);
  LPSTR       MzWideToAscii(LPCWSTR ws, LPSTR s);
  
  typedef struct APXMULTISZ APXMULTISZ;
  typedef APXMULTISZ*       LPAPXMULTISZ;
  
  DWORD   apxMultiSzToArrayA(APXHANDLE hPool, LPCSTR lpString, LPSTR **lppArray);
  DWORD   apxMultiSzToArrayW(APXHANDLE hPool, LPCWSTR lpString, LPWSTR **lppArray);
  LPWSTR  apxMultiSzCombine(APXHANDLE hPool, LPCWSTR lpStrA, LPCWSTR lpStrB,
                            LPDWORD lpdwLength);
  
  LPAPXMULTISZ    apxMultiSzStrdup(LPCTSTR szSrc);
  LPTSTR          apxMultiSzStrcat(LPAPXMULTISZ lpmSz, LPCTSTR szSrc);
  LPCTSTR         apxMultiSzGet(LPAPXMULTISZ lpmSz);
  /** Remove the specified character from the string
   * Replacement is done in-place.
   */
  LPTSTR          apxStrCharRemove(LPTSTR szString, TCHAR chSkip);
  DWORD           apxStrUnQuoteInplaceA(LPSTR szString);
  DWORD           apxStrUnQuoteInplaceW(LPWSTR szString);
  
  BOOL            apxUltohex(ULONG n, LPTSTR lpBuff, DWORD dwBuffLength);
  BOOL            apxUptohex(ULONG_PTR n, LPTSTR lpBuff, DWORD dwBuffLength);
  ULONG           apxStrToul(LPCTSTR szNum);
  ULONG           apxStrToulW(LPCWSTR szNum);
  ULONG           apxAtoulW(LPCWSTR szNum);
  
  BOOL            apxMakeResourceName(LPCTSTR szPrefix, LPTSTR lpBuff,
                                      DWORD dwBuffLength);
  
  INT             apxStrMatchA(LPCSTR szString, LPCSTR szPattern, BOOL bIgnoreCase);
  INT             apxStrMatchW(LPCWSTR szString, LPCWSTR szPattern, BOOL bIgnoreCase);
  INT             apxMultiStrMatchW(LPCWSTR szString, LPCWSTR szPattern,
                                    WCHAR chSeparator, BOOL bIgnoreCase);
  LPSTR           apxArrayToMultiSzA(APXHANDLE hPool, DWORD nArgs, LPCSTR *lpArgs);
  void            apxStrQuoteInplaceW(LPWSTR szString);
  LPWSTR          apxMszToCRLFW(APXHANDLE hPool, LPCWSTR szStr);
  LPWSTR          apxCRLFToMszW(APXHANDLE hPool, LPCWSTR szStr, LPDWORD lpdwBytes);
  LPSTR           apxExpandStrA(APXHANDLE hPool, LPCSTR szString);
  LPWSTR          apxExpandStrW(APXHANDLE hPool, LPCWSTR szString);
  void            apxStrCharReplaceA(LPSTR szString, CHAR chReplace, CHAR chReplaceWith);
  void            apxStrCharReplaceW(LPWSTR szString, WCHAR chReplace, WCHAR chReplaceWith);
  
  
  LPVOID  AplFillMemory(PVOID Destination, SIZE_T Length, BYTE Fill);
  void    AplZeroMemory(PVOID Destination, SIZE_T Length);
  LPVOID  AplCopyMemory(PVOID Destination, const VOID* Source, SIZE_T Length);
  /*
   * Find the first occurrence of lpFind in lpMem.
   * dwLen:   The length of lpFind
   * dwSize:  The length of lpMem
   */
  LPBYTE  ApcMemSearch(LPCVOID lpMem, LPCVOID lpFind, SIZE_T dwLen, SIZE_T dwSize);
  LPSTR   AplRindexA(LPCSTR lpStr, int ch);
  
  #define AplMoveMemory   AplCopyMemory
  
  __APXEND_DECLS
  
  #endif /* _APXWIN_H_INCLUDED_ */
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org