registry/reg_util.c

ソースコードを見る。

関数

BOOL reg_split_path (char *path, char **base, char **new_path)
BOOL reg_split_key (char *path, char **base, char **key)
void normalize_reg_path (pstring keyname)
char * reg_remaining_path (const char *key)
int regval_convert_multi_sz (uint16 *multi_string, size_t byte_len, char ***values)
size_t regval_build_multi_sz (char **values, uint16 **buffer)


関数

BOOL reg_split_path ( char *  path,
char **  base,
char **  new_path 
)

reg_util.c36 行で定義されています。

参照元 driver_arch_fetch_values()key_driver_fetch_keys()key_printers_fetch_keys()key_printers_fetch_values()key_printers_store_keys()key_printers_store_values().

00037 {
00038         char *p;
00039         
00040         *new_path = *base = NULL;
00041         
00042         if ( !path)
00043                 return False;
00044         
00045         *base = path;
00046         
00047         p = strchr( path, '\\' );
00048         
00049         if ( p ) {
00050                 *p = '\0';
00051                 *new_path = p+1;
00052         }
00053         
00054         return True;
00055 }

BOOL reg_split_key ( char *  path,
char **  base,
char **  key 
)

reg_util.c66 行で定義されています。

参照元 reg_write_tree().

00067 {
00068         char *p;
00069         
00070         *key = *base = NULL;
00071         
00072         if ( !path)
00073                 return False;
00074         
00075         *base = path;
00076         
00077         p = strrchr( path, '\\' );
00078         
00079         if ( p ) {
00080                 *p = '\0';
00081                 *key = p+1;
00082         }
00083         
00084         return True;
00085 }

void normalize_reg_path ( pstring  keyname  ) 

reg_util.c94 行で定義されています。

参照先 pstring_sub()strupper_m().

参照元 check_dynamic_reg_values()fetch_dynamic_reg_values()match_registry_path()regdb_fetch_values()regdb_store_keys()regdb_store_keys_internal()regdb_store_values()strip_printers_prefix().

00095 {
00096         pstring_sub( keyname, "\\", "/" );
00097         strupper_m( keyname  );
00098 }

char* reg_remaining_path ( const char *  key  ) 

reg_util.c104 行で定義されています。

参照元 key_driver_fetch_keys()key_driver_fetch_values()key_forms_fetch_keys()strip_printers_prefix().

00105 {
00106         static pstring new_path;
00107         char *p;
00108         
00109         if ( !key || !*key )
00110                 return NULL;
00111 
00112         pstrcpy( new_path, key );
00113         /* normalize_reg_path( new_path ); */
00114         
00115         if ( !(p = strchr( new_path, '\\' )) ) 
00116         {
00117                 if ( !(p = strchr( new_path, '/' )) )
00118                         p = new_path;
00119                 else 
00120                         p++;
00121         }
00122         else
00123                 p++;
00124                 
00125         return p;
00126 }

int regval_convert_multi_sz ( uint16 *  multi_string,
size_t  byte_len,
char ***  values 
)

reg_util.c131 行で定義されています。

参照先 rpcstr_pull()talloc_strdup().

参照元 _reg_enum_value()eventlog_add_source().

00132 {
00133         char **sz;
00134         int i;
00135         int num_strings = 0;
00136         fstring buffer;
00137         uint16 *wp;
00138         size_t multi_len = byte_len / 2;
00139         
00140         if ( !multi_string || !values )
00141                 return 0;
00142 
00143         *values = NULL;
00144 
00145         /* just count the NULLs */
00146         
00147         for ( i=0; (i<multi_len-1) && !(multi_string[i]==0x0 && multi_string[i+1]==0x0); i++ ) {
00148                 /* peek ahead */
00149                 if ( multi_string[i+1] == 0x0 )
00150                         num_strings++;
00151         }
00152 
00153         if ( num_strings == 0 )
00154                 return 0;
00155         
00156         if ( !(sz = TALLOC_ARRAY( NULL, char*, num_strings+1 )) ) {
00157                 DEBUG(0,("reg_convert_multi_sz: talloc() failed!\n"));
00158                 return -1;
00159         }
00160 
00161         wp = multi_string;
00162         
00163         for ( i=0; i<num_strings; i++ ) {
00164                 rpcstr_pull( buffer, wp, sizeof(buffer), -1, STR_TERMINATE );
00165                 sz[i] = talloc_strdup( sz, buffer );
00166                 
00167                 /* skip to the next string NULL and then one more */
00168                 while ( *wp )
00169                         wp++;
00170                 wp++;
00171         }
00172         
00173         /* tag the array off with an empty string */
00174         sz[i] = '\0';
00175         
00176         *values = sz;
00177         
00178         return num_strings;
00179 }

size_t regval_build_multi_sz ( char **  values,
uint16 **  buffer 
)

reg_util.c185 行で定義されています。

参照先 bufinit_unistr2()UNI_STR_TERMINATE.

参照元 _reg_enum_value()eventlog_add_source().

00186 {
00187         int i;
00188         size_t buf_size = 0;
00189         uint16 *buf, *b;
00190         UNISTR2 sz;
00191 
00192         if ( !values || !buffer )
00193                 return 0;
00194         
00195         /* go ahead and alloc some space */
00196         
00197         if ( !(buf = TALLOC_ARRAY( NULL, uint16, 2 )) ) {
00198                 DEBUG(0,("regval_build_multi_sz: talloc() failed!\n"));
00199                 return 0;
00200         }
00201         
00202         for ( i=0; values[i]; i++ ) {
00203                 ZERO_STRUCT( sz );
00204                 /* DEBUG(0,("regval_build_multi_sz: building [%s]\n",values[i])); */
00205                 init_unistr2( &sz, values[i], UNI_STR_TERMINATE );
00206                 
00207                 /* Alloc some more memory.  Always add one one to account for the 
00208                    double NULL termination */
00209                    
00210                 b = TALLOC_REALLOC_ARRAY( NULL, buf, uint16, buf_size+sz.uni_str_len+1 );
00211                 if ( !b ) {
00212                         DEBUG(0,("regval_build_multi_sz: talloc() reallocation error!\n"));
00213                         TALLOC_FREE( buffer );
00214                         return 0;
00215                 }
00216                 buf = b;
00217 
00218                 /* copy the unistring2 buffer and increment the size */ 
00219                 /* dump_data(1,sz.buffer,sz.uni_str_len*2); */
00220                 memcpy( buf+buf_size, sz.buffer, sz.uni_str_len*2 );
00221                 buf_size += sz.uni_str_len;
00222                 
00223                 /* cleanup rather than leaving memory hanging around */
00224                 TALLOC_FREE( sz.buffer );
00225         }
00226         
00227         buf[buf_size++] = 0x0;
00228 
00229         *buffer = buf;
00230 
00231         /* return number of bytes */
00232         return buf_size*2;
00233 }


Sambaに対してSat Aug 29 21:24:06 2009に生成されました。  doxygen 1.4.7