1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

r15776: Don't generate ref pointers in Samba4-generated code. There is no point

in having pointers for outgoing data when you can already modify the top-level
element.

This can be overridden (temporarily) by specifying the new "keepref"
attribute. Once we've removed keepref from all IDL files, I'll remove this
attribute as well.
This commit is contained in:
Jelmer Vernooij 2006-05-21 12:58:39 +00:00 committed by Gerald (Jerry) Carter
parent 4e8c9bbd76
commit bdc6dd3750
30 changed files with 112 additions and 75 deletions

View File

@ -280,7 +280,7 @@ static WERROR rpc_query_key(const struct registry_key *k)
struct rpc_key_data *mykeydata = k->backend_data; struct rpc_key_data *mykeydata = k->backend_data;
TALLOC_CTX *mem_ctx = talloc_init("query_key"); TALLOC_CTX *mem_ctx = talloc_init("query_key");
init_winreg_String(&r.in.class, NULL); init_winreg_String(&r.in.class_in, NULL);
r.in.handle = &mykeydata->pol; r.in.handle = &mykeydata->pol;
status = dcerpc_winreg_QueryInfoKey((struct dcerpc_pipe *)(k->hive->backend_data), mem_ctx, &r); status = dcerpc_winreg_QueryInfoKey((struct dcerpc_pipe *)(k->hive->backend_data), mem_ctx, &r);

View File

@ -6,7 +6,8 @@
version(1.0), version(1.0),
pointer_default(unique), pointer_default(unique),
helpstring("Microsoft AT-Scheduler Service"), helpstring("Microsoft AT-Scheduler Service"),
endpoint("ncacn_np:[\\pipe\\atsvc]", "ncalrpc:") endpoint("ncacn_np:[\\pipe\\atsvc]", "ncalrpc:"),
keepref
] interface atsvc ] interface atsvc
{ {
typedef [bitmap32bit] bitmap { typedef [bitmap32bit] bitmap {
@ -73,7 +74,7 @@
/* Function: 0x00 */ /* Function: 0x00 */
NTSTATUS atsvc_JobAdd( NTSTATUS atsvc_JobAdd(
[in,unique,string,charset(UTF16)] uint16 *servername, [in,unique,string,charset(UTF16)] uint16 *servername,
[in] atsvc_JobInfo *job_info, [in,keepref] atsvc_JobInfo *job_info,
[out] uint32 job_id [out] uint32 job_id
); );

View File

@ -18,7 +18,8 @@
object, object,
uuid("00000000-0000-0000-C000-000000000046"), uuid("00000000-0000-0000-C000-000000000046"),
pointer_default(unique), pointer_default(unique),
helpstring("Base interface for all COM interfaces") helpstring("Base interface for all COM interfaces"),
keepref
] ]
interface IUnknown interface IUnknown
{ {
@ -42,7 +43,8 @@ interface IUnknown
[ [
object, object,
uuid("00000001-0000-0000-C000-000000000046"), uuid("00000001-0000-0000-C000-000000000046"),
pointer_default(unique) pointer_default(unique),
keepref
] interface IClassFactory : IUnknown ] interface IClassFactory : IUnknown
{ {
[local] WERROR CreateInstance([in,unique] MInterfacePointer *pUnknown, [local] WERROR CreateInstance([in,unique] MInterfacePointer *pUnknown,
@ -69,7 +71,8 @@ interface IUnknown
uuid("00000131-0000-0000-C000-000000000046"), uuid("00000131-0000-0000-C000-000000000046"),
object, object,
pointer_default(unique), pointer_default(unique),
helpstring("Remote version of IUnknown") helpstring("Remote version of IUnknown"),
keepref
] ]
interface IRemUnknown : IUnknown interface IRemUnknown : IUnknown
{ {
@ -169,7 +172,8 @@ interface IRemUnknown : IUnknown
[ [
object, object,
pointer_default(unique), pointer_default(unique),
uuid("00000143-0000-0000-C000-000000000046") uuid("00000143-0000-0000-C000-000000000046"),
keepref
] ]
interface IRemUnknown2 : IRemUnknown interface IRemUnknown2 : IRemUnknown
@ -186,8 +190,9 @@ interface IRemUnknown2 : IRemUnknown
[ [
object, object,
pointer_default(unique), pointer_default(unique),
uuid("00020400-0000-0000-C000-000000000046") uuid("00020400-0000-0000-C000-000000000046"),
] interface IDispatch : IUnknown keepref
] interface IDispatch : IUnknown
{ {
/*****************/ /*****************/
/* Function 0x03 */ /* Function 0x03 */
@ -254,7 +259,8 @@ interface IRemUnknown2 : IRemUnknown
uuid(DA23F6DB-6F45-466C-9EED-0B65286F2D78), uuid(DA23F6DB-6F45-466C-9EED-0B65286F2D78),
helpstring("ICoffeeMachine Interface"), helpstring("ICoffeeMachine Interface"),
pointer_default(unique), pointer_default(unique),
object object,
keepref
] interface ICoffeeMachine : IUnknown ] interface ICoffeeMachine : IUnknown
{ {
WERROR MakeCoffee([in,string,charset(UTF16)] uint16 *flavor); WERROR MakeCoffee([in,string,charset(UTF16)] uint16 *flavor);
@ -272,7 +278,8 @@ interface IRemUnknown2 : IRemUnknown
object, object,
pointer_default(unique), pointer_default(unique),
uuid("0000000C-0000-0000-C000-000000000046"), uuid("0000000C-0000-0000-C000-000000000046"),
helpstring("Stream") helpstring("Stream"),
keepref
] ]
interface IStream : IUnknown interface IStream : IUnknown
{ {

View File

@ -5,7 +5,8 @@
[ uuid("4fc742e0-4a10-11cf-8273-00aa004ae673"), [ uuid("4fc742e0-4a10-11cf-8273-00aa004ae673"),
version(3.0), version(3.0),
pointer_default(unique), pointer_default(unique),
helpstring("Settings for Microsoft Distributed File System") helpstring("Settings for Microsoft Distributed File System"),
keepref
] interface netdfs ] interface netdfs
{ {
/******************/ /******************/

View File

@ -7,7 +7,8 @@
authservice("ldap"), authservice("ldap"),
helpstring("Active Directory Replication"), helpstring("Active Directory Replication"),
pointer_default(unique), pointer_default(unique),
depends(security,misc) depends(security,misc),
keepref
] ]
interface drsuapi interface drsuapi
{ {

View File

@ -4,7 +4,8 @@
endpoint("ncacn_np:[\\pipe\\rpcecho]", "ncacn_ip_tcp:", "ncalrpc:"), endpoint("ncacn_np:[\\pipe\\rpcecho]", "ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique), pointer_default(unique),
version(1.0), version(1.0),
helpstring("Simple echo pipe") helpstring("Simple echo pipe"),
keepref
] ]
interface rpcecho interface rpcecho
{ {

View File

@ -7,7 +7,8 @@
uuid("c681d488-d850-11d0-8c52-00c04fd90f7e"), uuid("c681d488-d850-11d0-8c52-00c04fd90f7e"),
version(1.0), version(1.0),
depends(security), depends(security),
pointer_default(unique) pointer_default(unique),
keepref
] interface efs ] interface efs
{ {

View File

@ -15,7 +15,8 @@ http://www.opengroup.org/onlinepubs/9629399/chap6.htm#tagcjh_11_02_03_01: bindin
"ncalrpc:[EPMAPPER]"), "ncalrpc:[EPMAPPER]"),
helpstring("EndPoint Mapper"), helpstring("EndPoint Mapper"),
pointer_default_top(sptr), pointer_default_top(sptr),
pointer_default(sptr) pointer_default(sptr),
keepref
] ]
interface epmapper interface epmapper
{ {

View File

@ -7,7 +7,8 @@
version(0.0), version(0.0),
depends(lsa,security), depends(lsa,security),
pointer_default(unique), pointer_default(unique),
helpstring("Event Logger") helpstring("Event Logger"),
keepref
] interface eventlog ] interface eventlog
{ {
typedef bitmap { typedef bitmap {

View File

@ -9,7 +9,8 @@
version(1.0), version(1.0),
endpoint("ncacn_np:[\\pipe\\InitShutdown]"), endpoint("ncacn_np:[\\pipe\\InitShutdown]"),
pointer_default(unique), pointer_default(unique),
helpstring("Init shutdown service") helpstring("Init shutdown service"),
keepref
] interface initshutdown ] interface initshutdown
{ {
typedef struct { typedef struct {

View File

@ -6,7 +6,8 @@
[ uuid("e770c620-0b06-4b5e-8d87-a26e20f28340"), [ uuid("e770c620-0b06-4b5e-8d87-a26e20f28340"),
version(1.0), version(1.0),
pointer_default(unique), pointer_default(unique),
depends(security,nbt) depends(security,nbt),
keepref
] interface irpc ] interface irpc
{ {
typedef bitmap { typedef bitmap {

View File

@ -9,7 +9,8 @@
endpoint("ncacn_np:[\\pipe\\lsarpc]","ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"), endpoint("ncacn_np:[\\pipe\\lsarpc]","ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique), pointer_default(unique),
helpstring("Local Security Authority"), helpstring("Local Security Authority"),
depends(security) depends(security),
keepref
] interface lsarpc ] interface lsarpc
{ {
declare bitmap security_secinfo; declare bitmap security_secinfo;

View File

@ -12,7 +12,8 @@
endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"), endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"),
pointer_default(unique), pointer_default(unique),
pointer_default_top(unique), pointer_default_top(unique),
depends(lsa,samr,security) depends(lsa,samr,security),
keepref
] ]
interface netlogon interface netlogon

View File

@ -6,7 +6,8 @@
*/ */
[ [
pointer_default(unique) pointer_default(unique),
keepref
] ]
interface ObjectRpcBaseTypes interface ObjectRpcBaseTypes
{ {

View File

@ -16,7 +16,8 @@
endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", "ncalrpc:"), endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", "ncalrpc:"),
pointer_default(unique), pointer_default(unique),
pointer_default_top(unique), pointer_default_top(unique),
depends(dcom, orpc) depends(dcom, orpc),
keepref
] ]
interface IOXIDResolver interface IOXIDResolver
{ {

View File

@ -8,7 +8,8 @@
pointer_default(unique), pointer_default(unique),
pointer_default_top(unique), pointer_default_top(unique),
endpoint("ncalrpc:", "ncacn_ip_tcp:[135]", "ncacn_np:[\\pipe\\epmapper]"), endpoint("ncalrpc:", "ncacn_ip_tcp:[135]", "ncacn_np:[\\pipe\\epmapper]"),
depends(dcom,orpc) depends(dcom,orpc),
keepref
] ]
interface IRemoteActivation interface IRemoteActivation
{ {

View File

@ -5,7 +5,8 @@
pointer_default_top(unique), pointer_default_top(unique),
depends(orpc), depends(orpc),
endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]",
"ncalrpc:[EPMAPPER]") "ncalrpc:[EPMAPPER]"),
keepref
] interface rot ] interface rot
{ {
WERROR rot_add ( WERROR rot_add (

View File

@ -13,7 +13,8 @@
endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"), endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique), pointer_default(unique),
pointer_default_top(unique), pointer_default_top(unique),
depends(misc,lsa,security) depends(misc,lsa,security),
keepref
] interface samr ] interface samr
{ {
declare bitmap security_secinfo; declare bitmap security_secinfo;

View File

@ -11,7 +11,8 @@
pointer_default_top(unique), pointer_default_top(unique),
helpstring("Spooler SubSystem"), helpstring("Spooler SubSystem"),
depends(security), depends(security),
helper("librpc/ndr/ndr_spoolss_buf.h") helper("librpc/ndr/ndr_spoolss_buf.h"),
keepref
] interface spoolss ] interface spoolss
{ {
typedef struct { typedef struct {

View File

@ -10,7 +10,8 @@
pointer_default(unique), pointer_default(unique),
pointer_default_top(unique), pointer_default_top(unique),
helpstring("Server Service"), helpstring("Server Service"),
depends(security,svcctl) depends(security,svcctl),
keepref
] interface srvsvc ] interface srvsvc
{ {
declare bitmap svcctl_ServerType; declare bitmap svcctl_ServerType;

View File

@ -9,7 +9,8 @@
pointer_default(unique), pointer_default(unique),
pointer_default_top(unique), pointer_default_top(unique),
endpoint("ncacn_np:[\\pipe\\svcctl]", "ncalrpc:"), endpoint("ncacn_np:[\\pipe\\svcctl]", "ncalrpc:"),
helpstring("Service Control") helpstring("Service Control"),
keepref
] interface svcctl ] interface svcctl
{ {
typedef struct { typedef struct {

View File

@ -7,7 +7,8 @@
endpoint("ncacn_np:[\\pipe\\unixinfo]", "ncacn_ip_tcp:", "ncalrpc:"), endpoint("ncacn_np:[\\pipe\\unixinfo]", "ncacn_ip_tcp:", "ncalrpc:"),
pointer_default(unique), pointer_default(unique),
helpstring("Unixinfo specific stuff"), helpstring("Unixinfo specific stuff"),
depends(security) depends(security),
keepref
] interface unixinfo ] interface unixinfo
{ {
/******************/ /******************/

View File

@ -9,7 +9,8 @@
pointer_default(unique), pointer_default(unique),
pointer_default_top(unique), pointer_default_top(unique),
helpstring("Remote Registry Service"), helpstring("Remote Registry Service"),
depends(lsa,initshutdown,security) depends(lsa,initshutdown,security),
keepref
] interface winreg ] interface winreg
{ {
declare bitmap security_secinfo; declare bitmap security_secinfo;
@ -205,8 +206,8 @@
/* Function: 0x10 */ /* Function: 0x10 */
WERROR winreg_QueryInfoKey( WERROR winreg_QueryInfoKey(
[in,ref] policy_handle *handle, [in,ref] policy_handle *handle,
[in] winreg_String class, [in] winreg_String class_in,
[out] winreg_String class, [out] winreg_String *class_out,
[out] uint32 num_subkeys, [out] uint32 num_subkeys,
[out] uint32 max_subkeylen, [out] uint32 max_subkeylen,
[out] uint32 max_subkeysize, [out] uint32 max_subkeysize,

View File

@ -7,7 +7,8 @@
pointer_default(unique), pointer_default(unique),
pointer_default_top(unique), pointer_default_top(unique),
helpstring("Workstation Service"), helpstring("Workstation Service"),
depends(srvsvc) depends(srvsvc),
keepref
] interface wkssvc ] interface wkssvc
{ {
declare [v1_enum] enum srvsvc_PlatformId; declare [v1_enum] enum srvsvc_PlatformId;

View File

@ -494,11 +494,8 @@ _PUBLIC_ NTSTATUS ndr_push_sptr_ptr(struct ndr_push *ndr, const void *p)
/* /*
push always a 0, if a pointer is NULL it's a fatal error push always a 0, if a pointer is NULL it's a fatal error
*/ */
_PUBLIC_ NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr, const void *p) _PUBLIC_ NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr)
{ {
if (p == NULL) {
return NT_STATUS_INVALID_PARAMETER_MIX;
}
return ndr_push_uint32(ndr, NDR_SCALARS, 0xAEF1AEF1); return ndr_push_uint32(ndr, NDR_SCALARS, 0xAEF1AEF1);
} }

View File

@ -571,8 +571,7 @@ sub ParseFunction($$$)
sub CheckPointerTypes($$) sub CheckPointerTypes($$)
{ {
my $s = shift; my ($s,$default) = @_;
my $default = shift;
foreach my $e (@{$s->{ELEMENTS}}) { foreach my $e (@{$s->{ELEMENTS}}) {
if ($e->{POINTERS} and not defined(pointer_type($e))) { if ($e->{POINTERS} and not defined(pointer_type($e))) {
@ -581,6 +580,23 @@ sub CheckPointerTypes($$)
} }
} }
#FIXME: Remove when ref handling in Samba4 is fixed
sub AddKeepRef($)
{
my $d = shift;
if ($d->{TYPE} eq "FUNCTION") {
foreach (@{$d->{ELEMENTS}}) {
$_->{PROPERTIES}->{keepref} = 1;
}
} elsif ($d->{TYPE} eq "TYPEDEF" and ($d->{DATA}->{TYPE} eq "STRUCT"
or $d->{DATA}->{TYPE} eq "UNION")) {
foreach (@{$d->{DATA}->{ELEMENTS}}) {
$_->{PROPERTIES}->{keepref} = 1;
}
}
}
sub ParseInterface($) sub ParseInterface($)
{ {
my $idl = shift; my $idl = shift;
@ -606,10 +622,12 @@ sub ParseInterface($)
if ($d->{TYPE} eq "DECLARE") { if ($d->{TYPE} eq "DECLARE") {
push (@declares, $d); push (@declares, $d);
} elsif ($d->{TYPE} eq "FUNCTION") { } elsif ($d->{TYPE} eq "FUNCTION") {
AddKeepRef($d) if (has_property($idl, "keepref"));
push (@functions, ParseFunction($idl, $d, \$opnum)); push (@functions, ParseFunction($idl, $d, \$opnum));
} elsif ($d->{TYPE} eq "CONST") { } elsif ($d->{TYPE} eq "CONST") {
push (@consts, ParseConst($idl, $d)); push (@consts, ParseConst($idl, $d));
} else { } else {
AddKeepRef($d) if (has_property($idl, "keepref"));
push (@types, ParseType($idl, $d)); push (@types, ParseType($idl, $d));
} }
} }
@ -831,6 +849,10 @@ my %property_list = (
"noheader" => ["ELEMENT"], "noheader" => ["ELEMENT"],
"charset" => ["ELEMENT"], "charset" => ["ELEMENT"],
"length_is" => ["ELEMENT"], "length_is" => ["ELEMENT"],
# temporary (should be removed once we've migrated away from
# relying on ref pointers being there in Samba4's code)
"keepref" => ["ELEMENT","INTERFACE"],
); );
##################################################################### #####################################################################

View File

@ -60,7 +60,11 @@ sub HeaderElement($)
} else { } else {
HeaderType($element, $element->{TYPE}, ""); HeaderType($element, $element->{TYPE}, "");
pidl " "; pidl " ";
my $numstar = $element->{POINTERS}; my $numstar = 0;
if (!has_property($element, "ref") or
has_property($element, "keepref")) {
$numstar += $element->{POINTERS};
}
if ($numstar >= 1) { if ($numstar >= 1) {
$numstar-- if Parse::Pidl::Typelist::scalar_is_reference($element->{TYPE}); $numstar-- if Parse::Pidl::Typelist::scalar_is_reference($element->{TYPE});
} }

View File

@ -582,7 +582,9 @@ sub ParseElementPushLevel
pidl "NDR_CHECK(ndr_push_relative_ptr2(ndr, $var_name));"; pidl "NDR_CHECK(ndr_push_relative_ptr2(ndr, $var_name));";
} }
} }
$var_name = get_value_of($var_name); if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) {
$var_name = get_value_of($var_name);
}
ParseElementPushLevel($e, GetNextLevel($e, $l), $ndr, $var_name, $env, 1, 1); ParseElementPushLevel($e, GetNextLevel($e, $l), $ndr, $var_name, $env, 1, 1);
if ($l->{POINTER_TYPE} ne "ref") { if ($l->{POINTER_TYPE} ne "ref") {
@ -662,11 +664,12 @@ sub ParsePtrPush($$$)
my ($e,$l,$var_name) = @_; my ($e,$l,$var_name) = @_;
if ($l->{POINTER_TYPE} eq "ref") { if ($l->{POINTER_TYPE} eq "ref") {
if ($l->{LEVEL} eq "EMBEDDED") { if (has_property($e, "keepref")) {
pidl "NDR_CHECK(ndr_push_ref_ptr(ndr, $var_name));";
} else {
check_null_pointer(get_value_of($var_name)); check_null_pointer(get_value_of($var_name));
} }
if ($l->{LEVEL} eq "EMBEDDED") {
pidl "NDR_CHECK(ndr_push_ref_ptr(ndr));";
}
} elsif ($l->{POINTER_TYPE} eq "relative") { } elsif ($l->{POINTER_TYPE} eq "relative") {
pidl "NDR_CHECK(ndr_push_relative_ptr1(ndr, $var_name));"; pidl "NDR_CHECK(ndr_push_relative_ptr1(ndr, $var_name));";
} elsif ($l->{POINTER_TYPE} eq "unique") { } elsif ($l->{POINTER_TYPE} eq "unique") {
@ -872,7 +875,7 @@ sub ParseMemCtxPullStart($$$)
my $next_is_array = ($nl->{TYPE} eq "ARRAY"); my $next_is_array = ($nl->{TYPE} eq "ARRAY");
my $next_is_string = (($nl->{TYPE} eq "DATA") and my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string")); ($nl->{DATA_TYPE} eq "string"));
if ($next_is_array or $next_is_string) { if ($next_is_array or $next_is_string or not has_property($e, "keepref")) {
return; return;
} else { } else {
$mem_c_flags = "LIBNDR_FLAG_REF_ALLOC"; $mem_c_flags = "LIBNDR_FLAG_REF_ALLOC";
@ -898,7 +901,7 @@ sub ParseMemCtxPullEnd($$)
my $next_is_array = ($nl->{TYPE} eq "ARRAY"); my $next_is_array = ($nl->{TYPE} eq "ARRAY");
my $next_is_string = (($nl->{TYPE} eq "DATA") and my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string")); ($nl->{DATA_TYPE} eq "string"));
if ($next_is_array or $next_is_string) { if ($next_is_array or $next_is_string or not has_property($e, "keepref")) {
return; return;
} else { } else {
$mem_r_flags = "LIBNDR_FLAG_REF_ALLOC"; $mem_r_flags = "LIBNDR_FLAG_REF_ALLOC";
@ -975,7 +978,9 @@ sub ParseElementPullLevel
ParseMemCtxPullStart($e,$l, $var_name); ParseMemCtxPullStart($e,$l, $var_name);
$var_name = get_value_of($var_name); if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) {
$var_name = get_value_of($var_name);
}
ParseElementPullLevel($e,GetNextLevel($e,$l), $ndr, $var_name, $env, 1, 1); ParseElementPullLevel($e,GetNextLevel($e,$l), $ndr, $var_name, $env, 1, 1);
ParseMemCtxPullEnd($e,$l); ParseMemCtxPullEnd($e,$l);
@ -1075,11 +1080,12 @@ sub ParsePtrPull($$$$)
($nl->{DATA_TYPE} eq "string")); ($nl->{DATA_TYPE} eq "string"));
if ($l->{POINTER_TYPE} eq "ref") { if ($l->{POINTER_TYPE} eq "ref") {
unless ($l->{LEVEL} eq "TOP") { if ($l->{LEVEL} eq "EMBEDDED") {
pidl "NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));"; pidl "NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));";
} }
unless ($next_is_array or $next_is_string) { if (!$next_is_array and !$next_is_string and
has_property($e, "keepref")) {
pidl "if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {"; pidl "if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {";
pidl "\tNDR_PULL_ALLOC($ndr, $var_name);"; pidl "\tNDR_PULL_ALLOC($ndr, $var_name);";
pidl "}"; pidl "}";
@ -1413,8 +1419,7 @@ sub DeclareArrayVariables($)
sub need_decl_mem_ctx($$) sub need_decl_mem_ctx($$)
{ {
my $e = shift; my ($e,$l) = @_;
my $l = shift;
return 0 if has_fast_array($e,$l); return 0 if has_fast_array($e,$l);
return 0 if is_charset_array($e,$l); return 0 if is_charset_array($e,$l);
@ -1425,7 +1430,7 @@ sub need_decl_mem_ctx($$)
my $next_is_array = ($nl->{TYPE} eq "ARRAY"); my $next_is_array = ($nl->{TYPE} eq "ARRAY");
my $next_is_string = (($nl->{TYPE} eq "DATA") and my $next_is_string = (($nl->{TYPE} eq "DATA") and
($nl->{DATA_TYPE} eq "string")); ($nl->{DATA_TYPE} eq "string"));
return 0 if ($next_is_array or $next_is_string); return 0 if ($next_is_array or $next_is_string or not has_property($e, "keepref"));
} }
return 1 if ($l->{TYPE} eq "POINTER"); return 1 if ($l->{TYPE} eq "POINTER");
@ -2091,6 +2096,7 @@ sub ParseFunctionPull($)
next unless (grep(/out/, @{$e->{DIRECTION}})); next unless (grep(/out/, @{$e->{DIRECTION}}));
next unless ($e->{LEVELS}[0]->{TYPE} eq "POINTER" and next unless ($e->{LEVELS}[0]->{TYPE} eq "POINTER" and
$e->{LEVELS}[0]->{POINTER_TYPE} eq "ref"); $e->{LEVELS}[0]->{POINTER_TYPE} eq "ref");
next unless has_property($e, "keepref");
next if (($e->{LEVELS}[1]->{TYPE} eq "DATA") and next if (($e->{LEVELS}[1]->{TYPE} eq "DATA") and
($e->{LEVELS}[1]->{DATA_TYPE} eq "string")); ($e->{LEVELS}[1]->{DATA_TYPE} eq "string"));
next if (($e->{LEVELS}[1]->{TYPE} eq "ARRAY") next if (($e->{LEVELS}[1]->{TYPE} eq "ARRAY")

View File

@ -23,50 +23,29 @@ my @reference_scalars = (
# a list of known scalar types # a list of known scalar types
my %scalars = ( my %scalars = (
# 0 byte types
"void" => "void", "void" => "void",
# 1 byte types
"char" => "char", "char" => "char",
"int8" => "int8_t", "int8" => "int8_t",
"uint8" => "uint8_t", "uint8" => "uint8_t",
# 2 byte types
"int16" => "int16_t", "int16" => "int16_t",
"uint16" => "uint16_t", "uint16" => "uint16_t",
# 4 byte types
"int32" => "int32_t", "int32" => "int32_t",
"uint32" => "uint32_t", "uint32" => "uint32_t",
# 8 byte types
"hyper" => "uint64_t", "hyper" => "uint64_t",
"dlong" => "int64_t", "dlong" => "int64_t",
"udlong" => "uint64_t", "udlong" => "uint64_t",
"udlongr" => "uint64_t", "udlongr" => "uint64_t",
# assume its a 8 byte type, but cope with either
"pointer" => "void*", "pointer" => "void*",
# DATA_BLOB types
"DATA_BLOB" => "DATA_BLOB", "DATA_BLOB" => "DATA_BLOB",
# string types
"string" => "const char *", "string" => "const char *",
"string_array" => "const char **", "string_array" => "const char **",
# time types
"time_t" => "time_t", "time_t" => "time_t",
"NTTIME" => "NTTIME", "NTTIME" => "NTTIME",
"NTTIME_1sec" => "NTTIME", "NTTIME_1sec" => "NTTIME",
"NTTIME_hyper" => "NTTIME", "NTTIME_hyper" => "NTTIME",
# error code types
"WERROR" => "WERROR", "WERROR" => "WERROR",
"NTSTATUS" => "NTSTATUS", "NTSTATUS" => "NTSTATUS",
"COMRESULT" => "COMRESULT", "COMRESULT" => "COMRESULT",
# special types
"nbt_string" => "const char *", "nbt_string" => "const char *",
"wrepl_nbt_name"=> "struct nbt_name *", "wrepl_nbt_name"=> "struct nbt_name *",
"ipv4address" => "const char *", "ipv4address" => "const char *",

View File

@ -376,7 +376,7 @@ static BOOL test_QueryInfoKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("\ntesting QueryInfoKey\n"); printf("\ntesting QueryInfoKey\n");
r.in.handle = handle; r.in.handle = handle;
init_winreg_String(&r.in.class, class); init_winreg_String(&r.in.class_in, class);
status = dcerpc_winreg_QueryInfoKey(p, mem_ctx, &r); status = dcerpc_winreg_QueryInfoKey(p, mem_ctx, &r);