mirror of
https://github.com/samba-team/samba.git
synced 2025-02-04 17:47:26 +03:00
s4: use shared registry functions.
Guenther
This commit is contained in:
parent
ee1b8e5ede
commit
a833be0c4e
@ -30,7 +30,8 @@ registry_SOVERSION = 0
|
||||
|
||||
registry_OBJ_FILES = $(addprefix $(libregistrysrcdir)/, interface.o util.o samba.o \
|
||||
patchfile_dotreg.o patchfile_preg.o patchfile.o regf.o \
|
||||
hive.o local.o ldb.o dir.o rpc.o)
|
||||
hive.o local.o ldb.o dir.o rpc.o) \
|
||||
../libcli/registry/util_reg.o
|
||||
|
||||
PUBLIC_HEADERS += $(libregistrysrcdir)/registry.h
|
||||
|
||||
|
@ -453,6 +453,15 @@ WERROR reg_create_key(TALLOC_CTX *mem_ctx,
|
||||
|
||||
/* Utility functions */
|
||||
const char *str_regtype(int type);
|
||||
bool push_reg_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
|
||||
DATA_BLOB *blob, const char *s);
|
||||
bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
|
||||
DATA_BLOB *blob, const char **a);
|
||||
bool pull_reg_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
|
||||
const DATA_BLOB *blob, const char **s);
|
||||
bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
|
||||
const DATA_BLOB *blob, const char ***a);
|
||||
int regtype_by_string(const char *str);
|
||||
char *reg_val_data_string(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t type, const DATA_BLOB data);
|
||||
char *reg_val_description(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const char *name,
|
||||
uint32_t type, const DATA_BLOB data);
|
||||
|
@ -21,43 +21,6 @@
|
||||
#include "lib/registry/registry.h"
|
||||
#include "librpc/gen_ndr/winreg.h"
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Registry utility functions
|
||||
*/
|
||||
|
||||
static const struct {
|
||||
uint32_t id;
|
||||
const char *name;
|
||||
} reg_value_types[] = {
|
||||
{ REG_NONE, "REG_NONE" },
|
||||
{ REG_SZ, "REG_SZ" },
|
||||
{ REG_EXPAND_SZ, "REG_EXPAND_SZ" },
|
||||
{ REG_BINARY, "REG_BINARY" },
|
||||
{ REG_DWORD, "REG_DWORD" },
|
||||
{ REG_DWORD_BIG_ENDIAN, "REG_DWORD_BIG_ENDIAN" },
|
||||
{ REG_LINK, "REG_LINK" },
|
||||
{ REG_MULTI_SZ, "REG_MULTI_SZ" },
|
||||
{ REG_RESOURCE_LIST, "REG_RESOURCE_LIST" },
|
||||
{ REG_FULL_RESOURCE_DESCRIPTOR, "REG_FULL_RESOURCE_DESCRIPTOR" },
|
||||
{ REG_RESOURCE_REQUIREMENTS_LIST, "REG_RESOURCE_REQUIREMENTS_LIST" },
|
||||
{ REG_QWORD, "REG_QWORD" },
|
||||
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/** Return string description of registry value type */
|
||||
_PUBLIC_ const char *str_regtype(int type)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; reg_value_types[i].name; i++) {
|
||||
if (reg_value_types[i].id == type)
|
||||
return reg_value_types[i].name;
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
_PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
|
||||
struct smb_iconv_convenience *iconv_convenience,
|
||||
uint32_t type,
|
||||
@ -126,16 +89,7 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx,
|
||||
const char *data_str, uint32_t *type,
|
||||
DATA_BLOB *data)
|
||||
{
|
||||
unsigned int i;
|
||||
*type = -1;
|
||||
|
||||
/* Find the correct type */
|
||||
for (i = 0; reg_value_types[i].name; i++) {
|
||||
if (!strcmp(reg_value_types[i].name, type_str)) {
|
||||
*type = reg_value_types[i].id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*type = regtype_by_string(type_str);
|
||||
|
||||
if (*type == -1)
|
||||
return false;
|
||||
|
@ -11,7 +11,7 @@ bld.SAMBA_SUBSYSTEM('TDR_REGF',
|
||||
|
||||
|
||||
bld.SAMBA_LIBRARY('registry',
|
||||
source='interface.c util.c samba.c patchfile_dotreg.c patchfile_preg.c patchfile.c regf.c hive.c local.c ldb.c dir.c rpc.c',
|
||||
source='interface.c ../libcli/registry/util_reg.c util.c samba.c patchfile_dotreg.c patchfile_preg.c patchfile.c regf.c hive.c local.c ldb.c dir.c rpc.c',
|
||||
pc_files='registry.pc',
|
||||
public_deps='LIBSAMBA-UTIL CHARSET TDR_REGF ldb RPC_NDR_WINREG LDB_WRAP',
|
||||
public_headers='registry.h',
|
||||
|
Loading…
x
Reference in New Issue
Block a user