{
my $e = shift;
- return 0 if (util::has_property($e, "ref"));
+ return 0 if (util::has_property($e, "ref") && $e->{PARENT}->{TYPE} eq "FUNCTION");
return 1 if ($e->{POINTERS} || util::array_size($e));
return 0;
}
my $e = shift;
my $var_prefix = shift;
- if (util::has_property($e, "relative")) {
+ if (util::has_property($e, "ref")) {
+ pidl "NDR_CHECK(ndr_push_ref_ptr(ndr, $var_prefix$e->{NAME}));";
+ } elsif (util::has_property($e, "relative")) {
pidl "NDR_CHECK(ndr_push_relative_ptr1(ndr, $var_prefix$e->{NAME}));";
} else {
pidl "NDR_CHECK(ndr_push_unique_ptr(ndr, $var_prefix$e->{NAME}));";
my($e) = shift;
my($var_prefix) = shift;
- pidl "NDR_CHECK(ndr_pull_unique_ptr(ndr, &_ptr_$e->{NAME}));";
+ if (util::has_property($e, "ref")) {
+ pidl "NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_$e->{NAME}));";
+ } else {
+ pidl "NDR_CHECK(ndr_pull_unique_ptr(ndr, &_ptr_$e->{NAME}));";
+ }
pidl "if (_ptr_$e->{NAME}) {";
indent;
pidl "NDR_ALLOC(ndr, $var_prefix$e->{NAME});";
if (util::array_size($e)) {
if (need_wire_pointer($e)) {
- pidl "NDR_CHECK(ndr_push_unique_ptr(ndr, r->$inout.$e->{NAME}));";
+ ParsePtrPush($e, "r->$inout.");
pidl "if (r->$inout.$e->{NAME}) {";
indent;
ParseArrayPush($e, "ndr", "r->$inout.", "NDR_SCALARS|NDR_BUFFERS");
return status;
}
+/*
+ parse a ref pointer referent identifier
+*/
+NTSTATUS ndr_pull_ref_ptr(struct ndr_pull *ndr, uint32_t *v)
+{
+ NTSTATUS status;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, v));
+ /* ref pointers always point to data */
+ *v = 1;
+ return status;
+}
+
/*
parse a udlong
*/
}
/*
- push a 1 if a pointer is non-NULL, otherwise 0
+ push a unique non-zero value if a pointer is non-NULL, otherwise 0
*/
NTSTATUS ndr_push_unique_ptr(struct ndr_push *ndr, const void *p)
{
return ndr_push_uint32(ndr, NDR_SCALARS, ptr);
}
+/*
+ push always a 0, if a pointer is NULL it's a fatal error
+*/
+NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr, const void *p)
+{
+ uint32_t ptr = 0;
+ if (p == NULL) {
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+ return ndr_push_uint32(ndr, NDR_SCALARS, 0);
+}
/*
pull a general string from the wire