Skip to content

Commit

Permalink
librpc/wsp: add some helper functions needed to support AQS
Browse files Browse the repository at this point in the history
Signed-off-by: Noel Power <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
  • Loading branch information
noelpower authored and abartlet committed Oct 25, 2023
1 parent ae9d943 commit 46b4a99
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
31 changes: 31 additions & 0 deletions librpc/wsp/wsp_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,3 +489,34 @@ struct wsp_cfullpropspec *get_full_prop(struct wsp_crestriction *restriction)
}
return result;
}

void set_variant_lpwstr(TALLOC_CTX *ctx,
struct wsp_cbasestoragevariant *vvalue,
const char *string_val)
{
vvalue->vtype = VT_LPWSTR;
vvalue->vvalue.vt_lpwstr.value = talloc_strdup(ctx, string_val);
}

static void fill_string_vec(TALLOC_CTX* ctx,
struct wsp_cbasestoragevariant *variant,
const char **strings, uint16_t elems)
{
int i;
variant->vvalue.vt_lpwstr_v.vvector_elements = elems;
variant->vvalue.vt_lpwstr_v.vvector_data = talloc_zero_array(ctx,
struct vt_lpwstr,
elems);

for( i = 0; i < elems; i++ ) {
variant->vvalue.vt_lpwstr_v.vvector_data[ i ].value = talloc_strdup(ctx, strings[ i ]);
}
}

void set_variant_lpwstr_vector(TALLOC_CTX *ctx,
struct wsp_cbasestoragevariant *variant,
const char **string_vals, uint32_t elems)
{
variant->vtype = VT_LPWSTR | VT_VECTOR;
fill_string_vec(ctx, variant, string_vals, elems);
}
7 changes: 7 additions & 0 deletions librpc/wsp/wsp_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

struct safearraybound;
struct wsp_cfullpropspec;
struct wsp_cbasestoragevariant;
struct wsp_crestriction;

struct full_propset_info {
Expand All @@ -51,5 +52,11 @@ const struct full_propset_info *get_propset_info_with_guid(
const char *prop_name,
struct GUID *guid);

void set_variant_lpwstr(TALLOC_CTX *ctx,
struct wsp_cbasestoragevariant *vvalue,
const char *string_val);
void set_variant_lpwstr_vector(TALLOC_CTX *ctx,
struct wsp_cbasestoragevariant *variant,
const char **string_vals, uint32_t elems);
struct wsp_cfullpropspec *get_full_prop(struct wsp_crestriction *restriction);
#endif /* __LIBRPC_WSP_UTIL_H__ */

0 comments on commit 46b4a99

Please sign in to comment.