if (value->type != REG_SZ)
return False;
- if (value->size && *((smb_ucs2_t *) value->data_p)) {
- pull_ucs2_talloc(ctx, &str_value, (const smb_ucs2_t *) value->data_p);
+ if (value->size && SVAL(value->data_p, 0)) {
+ pull_ucs2_talloc(ctx, &str_value, value->data_p);
status = ads_mod_str(ctx, mods, value->valuename, str_value);
return ADS_ERR_OK(status);
}
if (value->type != REG_DWORD)
return False;
- str_value = talloc_asprintf(ctx, "%d", *((uint32 *) value->data_p));
+ str_value = talloc_asprintf(ctx, "%d", *((uint32_t *) value->data_p));
status = ads_mod_str(ctx, mods, value->valuename, str_value);
return ADS_ERR_OK(status);
}
const REGISTRY_VALUE *value)
{
char **str_values = NULL;
- smb_ucs2_t *cur_str = (smb_ucs2_t *) value->data_p;
- uint32 size = 0, num_vals = 0, i=0;
+ char *cur_str = value->data_p;
+ uint32_t size = 0, num_vals = 0, i=0;
ADS_STATUS status;
if (value->type != REG_MULTI_SZ)
return False;
- while(cur_str && *cur_str && (size < value->size)) {
- size += 2 * (strlen_w(cur_str) + 1);
- cur_str += strlen_w(cur_str) + 1;
+ while (cur_str && *cur_str && (size < value->size)) {
+ size_t this_size = utf16_len(cur_str);
+ cur_str += this_size;
+ size += this_size;
num_vals++;
};
if (num_vals) {
- str_values = talloc(ctx,
- (num_vals + 1) * sizeof(smb_ucs2_t *));
- memset(str_values, '\0',
- (num_vals + 1) * sizeof(smb_ucs2_t *));
-
- cur_str = (smb_ucs2_t *) value->data_p;
- for (i=0; i < num_vals; i++)
- cur_str += pull_ucs2_talloc(ctx, &str_values[i],
- cur_str);
+ str_values = talloc_array(ctx, char *, num_vals + 1);
+ cur_str = value->data_p;
+ for (i=0; i < num_vals; i++) {
+ pull_ucs2_talloc(ctx, &str_values[i], cur_str);
+ cur_str += utf16_len(cur_str);
+ }
+ str_values[i] = NULL;
status = ads_mod_strlist(ctx, mods, value->valuename,
(const char **) str_values);
}
-WERROR get_remote_printer_publishing_data(struct cli_state *cli,
+WERROR get_remote_printer_publishing_data(struct smbcli_state *cli,
TALLOC_CTX *mem_ctx,
ADS_MODLIST *mods,
const char *printer)
char *printername, *servername;
REGVAL_CTR dsdriver_ctr, dsspooler_ctr;
BOOL got_dsdriver = False, got_dsspooler = False;
- uint32 needed, i;
+ uint32_t needed, i;
POLICY_HND pol;
asprintf(&servername, "\\\\%s", cli->desthost);
return WERR_NOMEM;
}
- result = cli_spoolss_open_printer_ex(cli, mem_ctx, printername,
+ result = smbcli_spoolss_open_printer_ex(cli, mem_ctx, printername,
"", MAXIMUM_ALLOWED_ACCESS,
servername, cli->user_name, &pol);
if (!W_ERROR_IS_OK(result)) {
return result;
}
- result = cli_spoolss_enumprinterdataex(cli, mem_ctx, 0, &needed,
+ result = smbcli_spoolss_enumprinterdataex(cli, mem_ctx, 0, &needed,
&pol, SPOOL_DSDRIVER_KEY, NULL);
if (W_ERROR_V(result) == ERRmoredata)
- result = cli_spoolss_enumprinterdataex(cli, mem_ctx, needed,
+ result = smbcli_spoolss_enumprinterdataex(cli, mem_ctx, needed,
NULL, &pol,
SPOOL_DSDRIVER_KEY,
&dsdriver_ctr);
dsdriver_ctr.values[i]);
}
- result = cli_spoolss_enumprinterdataex(cli, mem_ctx, 0, &needed,
+ result = smbcli_spoolss_enumprinterdataex(cli, mem_ctx, 0, &needed,
&pol, SPOOL_DSSPOOLER_KEY,
NULL);
if (W_ERROR_V(result) == ERRmoredata)
- result = cli_spoolss_enumprinterdataex(cli, mem_ctx, needed,
+ result = smbcli_spoolss_enumprinterdataex(cli, mem_ctx, needed,
NULL, &pol,
SPOOL_DSSPOOLER_KEY,
&dsspooler_ctr);
if (got_dsdriver) regval_ctr_destroy(&dsdriver_ctr);
if (got_dsspooler) regval_ctr_destroy(&dsspooler_ctr);
- cli_spoolss_close_printer(cli, mem_ctx, &pol);
+ smbcli_spoolss_close_printer(cli, mem_ctx, &pol);
return result;
}
ADS_MODLIST *mods,
NT_PRINTER_DATA *data)
{
- uint32 key,val;
+ uint32_t key,val;
for (key=0; key < data->num_keys; key++) {
REGVAL_CTR ctr = data->keys[key].values;