github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/apache_2_2_34/include/ap_regkey.h (about)

     1  /* Licensed to the Apache Software Foundation (ASF) under one or more
     2   * contributor license agreements.  See the NOTICE file distributed with
     3   * this work for additional information regarding copyright ownership.
     4   * The ASF licenses this file to You under the Apache License, Version 2.0
     5   * (the "License"); you may not use this file except in compliance with
     6   * the License.  You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  /**
    18   * @file ap_regkey.h
    19   * @brief APR-style Win32 Registry Manipulation
    20   */
    21  
    22  #ifndef AP_REGKEY_H
    23  #define AP_REGKEY_H
    24  
    25  #if defined(WIN32) || defined(DOXYGEN)
    26  
    27  #include "apr.h"
    28  #include "apr_pools.h"
    29  #include "ap_config.h"      /* Just for AP_DECLARE */
    30  
    31  #ifdef __cplusplus
    32  extern "C" {
    33  #endif
    34  
    35  typedef struct ap_regkey_t ap_regkey_t;
    36  
    37  /* Used to recover AP_REGKEY_* constants 
    38   */
    39  AP_DECLARE(const ap_regkey_t *) ap_regkey_const(int i);
    40  
    41  /**
    42   * Win32 Only: Constants for ap_regkey_open()
    43   */
    44  #define AP_REGKEY_CLASSES_ROOT         ap_regkey_const(0)
    45  #define AP_REGKEY_CURRENT_CONFIG       ap_regkey_const(1)
    46  #define AP_REGKEY_CURRENT_USER         ap_regkey_const(2)
    47  #define AP_REGKEY_LOCAL_MACHINE        ap_regkey_const(3)
    48  #define AP_REGKEY_USERS                ap_regkey_const(4)
    49  #define AP_REGKEY_PERFORMANCE_DATA     ap_regkey_const(5)
    50  #define AP_REGKEY_DYN_DATA             ap_regkey_const(6)
    51  
    52  /**
    53   * Win32 Only: Flags for ap_regkey_value_set()
    54   */
    55  #define AP_REGKEY_EXPAND               0x0001
    56  
    57  /**
    58   * Win32 Only: Open the specified registry key.
    59   * @param newkey The opened registry key
    60   * @param parentkey The open registry key of the parent, or one of
    61   * <PRE>
    62   *           AP_REGKEY_CLASSES_ROOT
    63   *           AP_REGKEY_CURRENT_CONFIG
    64   *           AP_REGKEY_CURRENT_USER
    65   *           AP_REGKEY_LOCAL_MACHINE
    66   *           AP_REGKEY_USERS
    67   *           AP_REGKEY_PERFORMANCE_DATA 
    68   *           AP_REGKEY_DYN_DATA 
    69   * </PRE>
    70   * @param keyname The path of the key relative to the parent key
    71   * @param flags Or'ed value of:
    72   * <PRE>
    73   *           APR_READ             open key for reading
    74   *           APR_WRITE            open key for writing
    75   *           APR_CREATE           create the key if it doesn't exist
    76   *           APR_EXCL             return error if APR_CREATE and key exists
    77   * </PRE>
    78   * @param pool The pool in which newkey is allocated
    79   */
    80  AP_DECLARE(apr_status_t) ap_regkey_open(ap_regkey_t **newkey, 
    81                                          const ap_regkey_t *parentkey,
    82                                          const char *keyname,
    83                                          apr_int32_t flags, 
    84                                          apr_pool_t *pool);
    85  
    86  /**
    87   * Win32 Only: Close the registry key opened or created by ap_regkey_open().
    88   * @param key The registry key to close
    89   */
    90  AP_DECLARE(apr_status_t) ap_regkey_close(ap_regkey_t *key);
    91  
    92  /**
    93   * Win32 Only: Remove the given registry key.
    94   * @param parentkey The open registry key of the parent, or one of
    95   * <PRE>
    96   *           AP_REGKEY_CLASSES_ROOT
    97   *           AP_REGKEY_CURRENT_CONFIG
    98   *           AP_REGKEY_CURRENT_USER
    99   *           AP_REGKEY_LOCAL_MACHINE
   100   *           AP_REGKEY_USERS
   101   *           AP_REGKEY_PERFORMANCE_DATA 
   102   *           AP_REGKEY_DYN_DATA 
   103   * </PRE>
   104   * @param keyname The path of the key relative to the parent key
   105   * @param pool The pool used for temp allocations
   106   * @remark ap_regkey_remove() is not recursive, although it removes
   107   * all values within the given keyname, it will not remove a key 
   108   * containing subkeys.
   109   */
   110  AP_DECLARE(apr_status_t) ap_regkey_remove(const ap_regkey_t *parent, 
   111                                            const char *keyname,
   112                                            apr_pool_t *pool);
   113  
   114  /**
   115   * Win32 Only: Retrieve a registry value string from an open key.
   116   * @param result The string value retrieved 
   117   * @param key The registry key to retrieve the value from
   118   * @param valuename The named value to retrieve (pass "" for the default)
   119   * @param pool The pool used to store the result
   120   * @remark There is no toggle to prevent environment variable expansion
   121   * if the registry value is set with AP_REG_EXPAND (REG_EXPAND_SZ), such
   122   * expansions are always performed.
   123   */
   124  AP_DECLARE(apr_status_t) ap_regkey_value_get(char **result, 
   125                                               ap_regkey_t *key, 
   126                                               const char *valuename, 
   127                                               apr_pool_t *pool);
   128  
   129  /**
   130   * Win32 Only: Store a registry value string into an open key.
   131   * @param key The registry key to store the value into
   132   * @param valuename The named value to store (pass "" for the default)
   133   * @param value The string to store for the named value
   134   * @param flags The option AP_REGKEY_EXPAND or 0, where AP_REGKEY_EXPAND
   135   * values will find all %foo% variables expanded from the environment.
   136   * @param pool The pool used for temp allocations
   137   */
   138  AP_DECLARE(apr_status_t) ap_regkey_value_set(ap_regkey_t *key, 
   139                                               const char *valuename, 
   140                                               const char *value, 
   141                                               apr_int32_t flags,
   142                                               apr_pool_t *pool);
   143  
   144  /**
   145   * Win32 Only: Retrieve a raw byte value from an open key.
   146   * @param result The raw bytes value retrieved 
   147   * @param resultsize Pointer to a variable to store the number raw bytes retrieved 
   148   * @param key The registry key to retrieve the value from
   149   * @param valuename The named value to retrieve (pass "" for the default)
   150   * @param pool The pool used to store the result
   151   */
   152  AP_DECLARE(apr_status_t) ap_regkey_value_raw_get(void **result, 
   153                                                   apr_size_t *resultsize,
   154                                                   apr_int32_t *resulttype,
   155                                                   ap_regkey_t *key, 
   156                                                   const char *valuename, 
   157                                                   apr_pool_t *pool);
   158  
   159  /**
   160   * Win32 Only: Store a raw bytes value into an open key.
   161   * @param key The registry key to store the value into
   162   * @param valuename The named value to store (pass "" for the default)
   163   * @param value The bytes to store for the named value
   164   * @param valuesize The number of bytes for value
   165   * @param valuetype The 
   166   * values will find all %foo% variables expanded from the environment.
   167   * @param pool The pool used for temp allocations
   168   */
   169  AP_DECLARE(apr_status_t) ap_regkey_value_raw_set(ap_regkey_t *key, 
   170                                                   const char *valuename, 
   171                                                   const void *value, 
   172                                                   apr_size_t  valuesize,
   173                                                   apr_int32_t valuetype,
   174                                                   apr_pool_t *pool);
   175  
   176  /**
   177   * Win32 Only: Retrieve a registry value string from an open key.
   178   * @param result The string elements retrieved from a REG_MULTI_SZ string array
   179   * @param key The registry key to retrieve the value from
   180   * @param valuename The named value to retrieve (pass "" for the default)
   181   * @param pool The pool used to store the result
   182   */
   183  AP_DECLARE(apr_status_t) ap_regkey_value_array_get(apr_array_header_t **result, 
   184                                                     ap_regkey_t *key,
   185                                                     const char *valuename, 
   186                                                     apr_pool_t *pool);
   187  
   188  /**
   189   * Win32 Only: Store a registry value string array into an open key.
   190   * @param key The registry key to store the value into
   191   * @param valuename The named value to store (pass "" for the default)
   192   * @param nelts The string elements to store in a REG_MULTI_SZ string array
   193   * @param elts The number of elements in the elts string array
   194   * @param pool The pool used for temp allocations
   195   */
   196  AP_DECLARE(apr_status_t) ap_regkey_value_array_set(ap_regkey_t *key, 
   197                                                     const char *valuename, 
   198                                                     int nelts, 
   199                                                     const char * const * elts,
   200                                                     apr_pool_t *pool);
   201  
   202  /**
   203   * Win32 Only: Remove a registry value from an open key.
   204   * @param key The registry key to remove the value from
   205   * @param valuename The named value to remove (pass "" for the default)
   206   * @param pool The pool used for temp allocations
   207   */
   208  AP_DECLARE(apr_status_t) ap_regkey_value_remove(const ap_regkey_t *key, 
   209                                                  const char *valuename,
   210                                                  apr_pool_t *pool);
   211  
   212  #ifdef __cplusplus
   213  }
   214  #endif
   215  
   216  #endif /* def WIN32 || def DOXYGEN */
   217  
   218  #endif /* AP_REGKEY_H */