2011-06-11 02:20:32 +04:00
/*
* Unix SMB / CIFS implementation .
*
* Registry helper routines
*
* Copyright ( C ) Gregor Beck 2010
2010-09-20 16:46:25 +04:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
/**
* @ brief Some stuff used by reg_parse and reg_format .
2023-07-13 10:27:28 +03:00
* It might be useful elsewehre but need some review of the interfaces .
2010-09-20 16:46:25 +04:00
* @ file reg_parse_internal . h
* @ author Gregor Beck < gb @ sernet . de >
* @ date Sep 2010
*/
# ifndef __REG_PARSE_INTERNAL_H
# define __REG_PARSE_INTERNAL_H
# include "includes.h"
2011-02-25 18:29:14 +03:00
# include "system/iconv.h"
2010-09-20 16:46:25 +04:00
struct cbuf ;
# define USE_NATIVE_ICONV
2010-09-24 13:29:09 +04:00
# if defined USE_NATIVE_ICONV && defined HAVE_NATIVE_ICONV
2010-09-20 16:46:25 +04:00
# define smb_iconv_t iconv_t
# define smb_iconv(CD, IPTR, ILEN, OPTR, OLEN) \
2014-02-26 23:16:26 +04:00
iconv ( CD , discard_const_p ( char * , ( IPTR ) ) , ILEN , OPTR , OLEN )
2010-09-20 16:46:25 +04:00
# define smb_iconv_open iconv_open
# define smb_iconv_close iconv_close
# endif
size_t iconvert_talloc ( const void * ctx ,
smb_iconv_t cd ,
const char * src , size_t srclen ,
char * * pdst ) ;
struct hive_info {
uint32_t handle ;
const char * short_name ;
size_t short_name_len ;
const char * long_name ;
size_t long_name_len ;
} ;
2011-07-12 15:04:37 +04:00
extern const struct hive_info HIVE_INFO_HKLM ;
extern const struct hive_info HIVE_INFO_HKCU ;
extern const struct hive_info HIVE_INFO_HKCR ;
extern const struct hive_info HIVE_INFO_HKU ;
extern const struct hive_info HIVE_INFO_HKCC ;
extern const struct hive_info HIVE_INFO_HKDD ;
extern const struct hive_info HIVE_INFO_HKPD ;
extern const struct hive_info HIVE_INFO_HKPT ;
extern const struct hive_info HIVE_INFO_HKPN ;
extern const struct hive_info * HIVE_INFO [ ] ;
const struct hive_info * hive_info ( const char * name ) ;
bool srprs_hive ( const char * * ptr , const struct hive_info * * result ) ;
2010-09-20 16:46:25 +04:00
2021-01-03 21:02:18 +03:00
const char * smbreg_get_charset ( const char * c ) ;
2010-09-20 16:46:25 +04:00
bool set_iconv ( smb_iconv_t * t , const char * to , const char * from ) ;
/**
* Parse option string
* @ param [ in , out ] ptr parse position
* @ param [ in ] mem_ctx talloc context
* @ param [ out ] name ptr 2 value
* @ param [ out ] value ptr 2 value
* @ return true on success
*/
bool srprs_option ( const char * * ptr , const void * mem_ctx , char * * name , char * * value ) ;
/**
* Write Byte Order Mark for \ p charset to file .
* If \ c charset = = NULL write BOM for \ p ctype .
*
* @ param [ in ] file file to write to
* @ param [ in ] charset
* @ param [ in ] ctype
*
* @ return number of bytes written , - 1 on error
* @ todo write to cbuf
*/
int write_bom ( FILE * file , const char * charset , charset_t ctype ) ;
/**
* Parse Byte Order Mark .
*
* @ param [ in , out ] ptr parse position
* @ param [ out ] name name of characterset
* @ param [ out ] ctype charset_t
*
* @ return true if found
* @ ingroup parse bom
*/
bool srprs_bom ( const char * * ptr , const char * * name , charset_t * ctype ) ;
enum fmt_case {
FMT_CASE_PRESERVE = 0 ,
FMT_CASE_UPPER ,
FMT_CASE_LOWER ,
FMT_CASE_TITLE
} ;
int cbuf_puts_case ( struct cbuf * s , const char * str , size_t len , enum fmt_case fmt ) ;
# endif /* __REG_PARSE_INTERNAL_H */