/* The following definitions come from lib/util_reg.c */
const char *reg_type_lookup(enum winreg_Type type);
-bool push_reg_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *s);
-bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char **a);
-bool pull_reg_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char **s);
-bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char ***a);
+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);
/* The following definitions come from lib/util_reg_api.c */
push a string in unix charset into a REG_SZ UCS2 null terminated blob
********************************************************************/
-bool push_reg_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *s)
+bool push_reg_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
+ DATA_BLOB *blob, const char *s)
{
union winreg_Data data;
enum ndr_err_code ndr_err;
data.string = s;
- ndr_err = ndr_push_union_blob(blob, mem_ctx, NULL, &data, REG_SZ,
+ ndr_err = ndr_push_union_blob(blob, mem_ctx, ic, &data, REG_SZ,
(ndr_push_flags_fn_t)ndr_push_winreg_Data);
return NDR_ERR_CODE_IS_SUCCESS(ndr_err);
}
terminated blob
********************************************************************/
-bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char **a)
+bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
+ DATA_BLOB *blob, const char **a)
{
union winreg_Data data;
enum ndr_err_code ndr_err;
data.string_array = a;
- ndr_err = ndr_push_union_blob(blob, mem_ctx, NULL, &data, REG_MULTI_SZ,
+ ndr_err = ndr_push_union_blob(blob, mem_ctx, ic, &data, REG_MULTI_SZ,
(ndr_push_flags_fn_t)ndr_push_winreg_Data);
return NDR_ERR_CODE_IS_SUCCESS(ndr_err);
}
pull a string in unix charset out of a REG_SZ UCS2 null terminated blob
********************************************************************/
-bool pull_reg_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char **s)
+bool pull_reg_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
+ const DATA_BLOB *blob, const char **s)
{
union winreg_Data data;
enum ndr_err_code ndr_err;
- ndr_err = ndr_pull_union_blob(blob, mem_ctx, NULL, &data, REG_SZ,
+ ndr_err = ndr_pull_union_blob(blob, mem_ctx, ic, &data, REG_SZ,
(ndr_pull_flags_fn_t)ndr_pull_winreg_Data);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
terminated blob
********************************************************************/
-bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char ***a)
+bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
+ const DATA_BLOB *blob, const char ***a)
{
union winreg_Data data;
enum ndr_err_code ndr_err;
- ndr_err = ndr_pull_union_blob(blob, mem_ctx, NULL, &data, REG_MULTI_SZ,
+ ndr_err = ndr_pull_union_blob(blob, mem_ctx, ic, &data, REG_MULTI_SZ,
(ndr_pull_flags_fn_t)ndr_pull_winreg_Data);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
blob = data_blob_const(data, length);
- if (!pull_reg_multi_sz(mem_ctx, &blob, &vals)) {
+ if (!pull_reg_multi_sz(mem_ctx, NULL, &blob, &vals)) {
err = WERR_NOMEM;
goto error;
}
}
case REG_SZ:
case REG_EXPAND_SZ: {
- if (!push_reg_sz(mem_ctx, presult, value->v.sz.str))
+ if (!push_reg_sz(mem_ctx, NULL, presult, value->v.sz.str))
{
return WERR_NOMEM;
}
}
array[i] = NULL;
- if (!push_reg_multi_sz(mem_ctx, presult, array)) {
+ if (!push_reg_multi_sz(mem_ctx, NULL, presult, array)) {
talloc_free(array);
return WERR_NOMEM;
}
case REG_SZ:
blob = data_blob_const(regval_data_p(guid_val),
regval_size(guid_val));
- pull_reg_sz(talloc_tos(), &blob, (const char **)&guid_str);
+ pull_reg_sz(talloc_tos(), NULL, &blob, (const char **)&guid_str);
ret = NT_STATUS_IS_OK(GUID_from_string( guid_str, guid ));
talloc_free(guid_str);
break;
static void pull_reg_sz_fstring(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, fstring s)
{
const char *str;
- pull_reg_sz(mem_ctx, blob, &str);
+ pull_reg_sz(mem_ctx, NULL, blob, &str);
fstrcpy(s, str);
}
break;
}
- push_reg_sz(talloc_tos(), &data, filename);
+ push_reg_sz(talloc_tos(), NULL, &data, filename);
memcpy( buffer+buffer_size, (char*)data.data, data.length);
buffer_size += (length + 1)*sizeof(uint16);
sizeof(uint32));
regval_ctr_addvalue_sz(values, "PrimaryModule", *elogs);
- push_reg_sz(talloc_tos(), &data, *elogs);
+ push_reg_sz(talloc_tos(), NULL, &data, *elogs);
regval_ctr_addvalue(values, "Sources", REG_MULTI_SZ,
(char *)data.data,
if (!evtfilepath) {
TALLOC_FREE(values);
}
- push_reg_sz(talloc_tos(), &data, evtfilepath);
+ push_reg_sz(talloc_tos(), NULL, &data, evtfilepath);
regval_ctr_addvalue(values, "File", REG_EXPAND_SZ, (char *)data.data,
data.length);
regdb_store_values(evtlogpath, values);
REG_DWORD,
( char * ) &uiCategoryCount,
sizeof( uint32 ) );
- push_reg_sz(talloc_tos(), &data,
+ push_reg_sz(talloc_tos(), NULL, &data,
"%SystemRoot%\\system32\\eventlog.dll");
regval_ctr_addvalue( values, "CategoryMessageFile",
dump_data( 1, rval->data_p, rval->size );
blob = data_blob_const(rval->data_p, rval->size);
- if (!pull_reg_multi_sz(talloc_tos(), &blob, &wrklist)) {
+ if (!pull_reg_multi_sz(talloc_tos(), NULL, &blob, &wrklist)) {
return false;
}
memcpy( wp, wrklist, sizeof( char * ) * numsources );
*( wp + numsources ) = ( char * ) sourcename;
*( wp + numsources + 1 ) = NULL;
- if (!push_reg_multi_sz(ctx, &blob, wp)) {
+ if (!push_reg_multi_sz(ctx, NULL, &blob, wp)) {
return false;
}
dump_data( 1, blob.data, blob.length);
{
DATA_BLOB blob;
- if (!push_reg_sz(ctr, &blob, data)) {
+ if (!push_reg_sz(ctr, NULL, &blob, data)) {
return -1;
}
{
DATA_BLOB blob;
- if (!push_reg_multi_sz(ctr, &blob, data)) {
+ if (!push_reg_multi_sz(ctr, NULL, &blob, data)) {
return -1;
}
const char *data = NULL;
DATA_BLOB blob = data_blob_const(regval_data_p(val), regval_size(val));
- pull_reg_sz(talloc_tos(), &blob, &data);
+ pull_reg_sz(talloc_tos(), NULL, &blob, &data);
return data;
}
buffer_size = 0;
return buffer_size;
}
- push_reg_sz(talloc_tos(), &name_index, (const char *)kbuf.dptr);
+ push_reg_sz(talloc_tos(), NULL, &name_index, (const char *)kbuf.dptr);
memcpy(buf1+buffer_size, (char *)name_index.data, working_size);
buffer_size += working_size;
/* Now encode the actual name */
memset(temp, 0, sizeof(temp));
memcpy(temp, dbuf.dptr, dbuf.dsize);
SAFE_FREE(dbuf.dptr);
- push_reg_sz(talloc_tos(), &name, temp);
+ push_reg_sz(talloc_tos(), NULL, &name, temp);
memcpy(buf1+buffer_size, (char *)name.data, working_size);
buffer_size += working_size;
}
}
- if (!push_reg_multi_sz(trusted_domains, &blob, trusted_domains)) {
+ if (!push_reg_multi_sz(trusted_domains, NULL, &blob, trusted_domains)) {
TALLOC_FREE(trusted_domains);
return WERR_NOMEM;
}
multi_sz[0] = devicepath;
- if (!push_reg_multi_sz(multi_sz, &blob, multi_sz)) {
+ if (!push_reg_multi_sz(multi_sz, NULL, &blob, multi_sz)) {
return WERR_NOMEM;
}
*/
if (!strequal(printer->info_2->comment, old_printer->info_2->comment)) {
- push_reg_sz(talloc_tos(), &buffer, printer->info_2->comment);
+ push_reg_sz(talloc_tos(), NULL, &buffer, printer->info_2->comment);
set_printer_dataex( printer, SPOOL_DSSPOOLER_KEY, "description",
REG_SZ, buffer.data, buffer.length);
}
if (!strequal(printer->info_2->sharename, old_printer->info_2->sharename)) {
- push_reg_sz(talloc_tos(), &buffer, printer->info_2->sharename);
+ push_reg_sz(talloc_tos(), NULL, &buffer, printer->info_2->sharename);
set_printer_dataex( printer, SPOOL_DSSPOOLER_KEY, "shareName",
REG_SZ, buffer.data, buffer.length);
pname = printer->info_2->printername;
- push_reg_sz(talloc_tos(), &buffer, pname);
+ push_reg_sz(talloc_tos(), NULL, &buffer, pname);
set_printer_dataex( printer, SPOOL_DSSPOOLER_KEY, "printerName",
REG_SZ, buffer.data, buffer.length);
}
if (!strequal(printer->info_2->portname, old_printer->info_2->portname)) {
- push_reg_sz(talloc_tos(), &buffer, printer->info_2->portname);
+ push_reg_sz(talloc_tos(), NULL, &buffer, printer->info_2->portname);
set_printer_dataex( printer, SPOOL_DSSPOOLER_KEY, "portName",
REG_SZ, buffer.data, buffer.length);
}
if (!strequal(printer->info_2->location, old_printer->info_2->location)) {
- push_reg_sz(talloc_tos(), &buffer, printer->info_2->location);
+ push_reg_sz(talloc_tos(), NULL, &buffer, printer->info_2->location);
set_printer_dataex( printer, SPOOL_DSSPOOLER_KEY, "location",
REG_SZ, buffer.data, buffer.length);
/* here we need to update some more DsSpooler keys */
/* uNCName, serverName, shortServerName */
- push_reg_sz(talloc_tos(), &buffer, global_myname());
+ push_reg_sz(talloc_tos(), NULL, &buffer, global_myname());
set_printer_dataex( printer, SPOOL_DSSPOOLER_KEY, "serverName",
REG_SZ, buffer.data, buffer.length);
set_printer_dataex( printer, SPOOL_DSSPOOLER_KEY, "shortServerName",
slprintf( asc_buffer, sizeof(asc_buffer)-1, "\\\\%s\\%s",
global_myname(), printer->info_2->sharename );
- push_reg_sz(talloc_tos(), &buffer, asc_buffer);
+ push_reg_sz(talloc_tos(), NULL, &buffer, asc_buffer);
set_printer_dataex( printer, SPOOL_DSSPOOLER_KEY, "uNCName",
REG_SZ, buffer.data, buffer.length);
}
}
- if (!push_reg_multi_sz(p->mem_ctx, &blob, array)) {
+ if (!push_reg_multi_sz(p->mem_ctx, NULL, &blob, array)) {
result = WERR_NOMEM;
goto done;
}
break;
case REG_SZ:
blob = data_blob_const(value.data_p, value.size);
- pull_reg_sz(talloc_tos(), &blob, &text);
+ pull_reg_sz(talloc_tos(), NULL, &blob, &text);
printf("%s: REG_SZ: %s\n", value.valuename, text ? text : "");
break;
case REG_BINARY: {
const char **values;
blob = data_blob_const(value.data_p, value.size);
- if (!pull_reg_multi_sz(NULL, &blob, &values)) {
+ if (!pull_reg_multi_sz(NULL, NULL, &blob, &values)) {
d_printf("pull_reg_multi_sz failed\n");
break;
}
goto fail;
blob = data_blob_const(regval_data_p(val), regval_size(val));
- pull_reg_sz(ctx, &blob, &display_name);
+ pull_reg_sz(ctx, NULL, &blob, &display_name);
TALLOC_FREE( key );
}
blob = data_blob_const(regval_data_p(val), regval_size(val));
- pull_reg_sz(ctx, &blob, &description);
+ pull_reg_sz(ctx, NULL, &blob, &description);
TALLOC_FREE(key);
case REG_SZ:
blob = data_blob_const(value.data_p, value.size);
- pull_reg_sz(talloc_tos(), &blob, &text);
+ pull_reg_sz(talloc_tos(), NULL, &blob, &text);
if (!text) {
break;
}
const char **values;
blob = data_blob_const(value.data_p, value.size);
- if (!pull_reg_multi_sz(NULL, &blob, &values)) {
+ if (!pull_reg_multi_sz(NULL, NULL, &blob, &values)) {
d_printf("pull_reg_multi_sz failed\n");
break;
}
if (strequal(info[j].value_name, SPOOL_REG_PORTNAME)) {
/* although windows uses a multi-sz, we use a sz */
- push_reg_sz(mem_ctx, &blob, SAMBA_PRINTER_PORT_NAME);
+ push_reg_sz(mem_ctx, NULL, &blob, SAMBA_PRINTER_PORT_NAME);
fstrcpy(value.valuename, SPOOL_REG_PORTNAME);
}
nt_status = NT_STATUS_NO_MEMORY;
goto done;
}
- push_reg_sz(mem_ctx, &blob, unc_name);
+ push_reg_sz(mem_ctx, NULL, &blob, unc_name);
fstrcpy(value.valuename, SPOOL_REG_UNCNAME);
}
nt_status = NT_STATUS_NO_MEMORY;
goto done;
}
- push_reg_sz(mem_ctx, &blob, url);
+ push_reg_sz(mem_ctx, NULL, &blob, url);
fstrcpy(value.valuename, SPOOL_REG_URL);
#endif
}
if (strequal(info[j].value_name, SPOOL_REG_SERVERNAME)) {
- push_reg_sz(mem_ctx, &blob, longname);
+ push_reg_sz(mem_ctx, NULL, &blob, longname);
fstrcpy(value.valuename, SPOOL_REG_SERVERNAME);
}
if (strequal(info[j].value_name, SPOOL_REG_SHORTSERVERNAME)) {
- push_reg_sz(mem_ctx, &blob, global_myname());
+ push_reg_sz(mem_ctx, NULL, &blob, global_myname());
fstrcpy(value.valuename, SPOOL_REG_SHORTSERVERNAME);
}
switch ( nk->values[i].type ) {
case REG_SZ:
blob = data_blob_const(nk->values[i].data, data_size);
- pull_reg_sz(talloc_tos(), &blob, &data_str);
+ pull_reg_sz(talloc_tos(), NULL, &blob, &data_str);
if (!data_str) {
break;
}