summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-09-23 20:41:44 +0200
committerGünther Deschner <gd@samba.org>2009-09-29 23:38:47 +0200
commit4365b7b408b2c328e983d96794eec4df1cc31926 (patch)
tree1b7ead1e310849b7de340901d1cf7ca185031e21 /librpc
parent21794b0dd28a80b149342b3218d7ebb4c8791e09 (diff)
downloadsamba-4365b7b408b2c328e983d96794eec4df1cc31926.tar.gz
samba-4365b7b408b2c328e983d96794eec4df1cc31926.tar.bz2
samba-4365b7b408b2c328e983d96794eec4df1cc31926.zip
winreg: add winreg_Data union to IDL.
Guenther
Diffstat (limited to 'librpc')
-rw-r--r--librpc/gen_ndr/misc.h41
-rw-r--r--librpc/gen_ndr/ndr_misc.c219
-rw-r--r--librpc/gen_ndr/ndr_misc.h6
-rw-r--r--librpc/gen_ndr/ndr_winreg.c36
-rw-r--r--librpc/gen_ndr/ndr_winreg.h3
-rw-r--r--librpc/gen_ndr/winreg.h34
-rw-r--r--librpc/idl/misc.idl26
-rw-r--r--librpc/idl/winreg.idl17
8 files changed, 295 insertions, 87 deletions
diff --git a/librpc/gen_ndr/misc.h b/librpc/gen_ndr/misc.h
index aa24a0fe17..29ea19296a 100644
--- a/librpc/gen_ndr/misc.h
+++ b/librpc/gen_ndr/misc.h
@@ -50,4 +50,45 @@ struct KRB5_EDATA_NTSTATUS {
uint32_t unknown2;
}/* [public] */;
+enum winreg_Type
+#ifndef USE_UINT_ENUMS
+ {
+ REG_NONE=(int)(0),
+ REG_SZ=(int)(1),
+ REG_EXPAND_SZ=(int)(2),
+ REG_BINARY=(int)(3),
+ REG_DWORD=(int)(4),
+ REG_DWORD_BIG_ENDIAN=(int)(5),
+ REG_LINK=(int)(6),
+ REG_MULTI_SZ=(int)(7),
+ REG_RESOURCE_LIST=(int)(8),
+ REG_FULL_RESOURCE_DESCRIPTOR=(int)(9),
+ REG_RESOURCE_REQUIREMENTS_LIST=(int)(10),
+ REG_QWORD=(int)(11)
+}
+#else
+ { __donnot_use_enum_winreg_Type=0x7FFFFFFF}
+#define REG_NONE ( 0 )
+#define REG_SZ ( 1 )
+#define REG_EXPAND_SZ ( 2 )
+#define REG_BINARY ( 3 )
+#define REG_DWORD ( 4 )
+#define REG_DWORD_BIG_ENDIAN ( 5 )
+#define REG_LINK ( 6 )
+#define REG_MULTI_SZ ( 7 )
+#define REG_RESOURCE_LIST ( 8 )
+#define REG_FULL_RESOURCE_DESCRIPTOR ( 9 )
+#define REG_RESOURCE_REQUIREMENTS_LIST ( 10 )
+#define REG_QWORD ( 11 )
+#endif
+;
+
+union winreg_Data {
+ const char * string;/* [flag(LIBNDR_FLAG_STR_NULLTERM),case(REG_SZ)] */
+ DATA_BLOB binary;/* [flag(LIBNDR_FLAG_REMAINING),case(REG_BINARY)] */
+ uint32_t value;/* [case(REG_DWORD)] */
+ const char ** string_array;/* [flag(LIBNDR_FLAG_STR_NULLTERM),case(REG_MULTI_SZ)] */
+ DATA_BLOB data;/* [flag(LIBNDR_FLAG_REMAINING),default] */
+}/* [nodiscriminant,public] */;
+
#endif /* _HEADER_misc */
diff --git a/librpc/gen_ndr/ndr_misc.c b/librpc/gen_ndr/ndr_misc.c
index fbef5094a5..784475e603 100644
--- a/librpc/gen_ndr/ndr_misc.c
+++ b/librpc/gen_ndr/ndr_misc.c
@@ -168,3 +168,222 @@ _PUBLIC_ void ndr_print_KRB5_EDATA_NTSTATUS(struct ndr_print *ndr, const char *n
ndr->depth--;
}
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_Type(struct ndr_push *ndr, int ndr_flags, enum winreg_Type r)
+{
+ NDR_CHECK(ndr_push_enum_uint32(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_Type(struct ndr_pull *ndr, int ndr_flags, enum winreg_Type *r)
+{
+ uint32_t v;
+ NDR_CHECK(ndr_pull_enum_uint32(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_winreg_Type(struct ndr_print *ndr, const char *name, enum winreg_Type r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case REG_NONE: val = "REG_NONE"; break;
+ case REG_SZ: val = "REG_SZ"; break;
+ case REG_EXPAND_SZ: val = "REG_EXPAND_SZ"; break;
+ case REG_BINARY: val = "REG_BINARY"; break;
+ case REG_DWORD: val = "REG_DWORD"; break;
+ case REG_DWORD_BIG_ENDIAN: val = "REG_DWORD_BIG_ENDIAN"; break;
+ case REG_LINK: val = "REG_LINK"; break;
+ case REG_MULTI_SZ: val = "REG_MULTI_SZ"; break;
+ case REG_RESOURCE_LIST: val = "REG_RESOURCE_LIST"; break;
+ case REG_FULL_RESOURCE_DESCRIPTOR: val = "REG_FULL_RESOURCE_DESCRIPTOR"; break;
+ case REG_RESOURCE_REQUIREMENTS_LIST: val = "REG_RESOURCE_REQUIREMENTS_LIST"; break;
+ case REG_QWORD: val = "REG_QWORD"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_Data(struct ndr_push *ndr, int ndr_flags, const union winreg_Data *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case REG_NONE: {
+ break; }
+
+ case REG_SZ: {
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->string));
+ ndr->flags = _flags_save_string;
+ }
+ break; }
+
+ case REG_BINARY: {
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->binary));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ break; }
+
+ case REG_DWORD: {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->value));
+ break; }
+
+ case REG_MULTI_SZ: {
+ {
+ uint32_t _flags_save_string_array = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->string_array));
+ ndr->flags = _flags_save_string_array;
+ }
+ break; }
+
+ default: {
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->data));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ break; }
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case REG_NONE:
+ break;
+
+ case REG_SZ:
+ break;
+
+ case REG_BINARY:
+ break;
+
+ case REG_DWORD:
+ break;
+
+ case REG_MULTI_SZ:
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_Data(struct ndr_pull *ndr, int ndr_flags, union winreg_Data *r)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case REG_NONE: {
+ break; }
+
+ case REG_SZ: {
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->string));
+ ndr->flags = _flags_save_string;
+ }
+ break; }
+
+ case REG_BINARY: {
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->binary));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ break; }
+
+ case REG_DWORD: {
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->value));
+ break; }
+
+ case REG_MULTI_SZ: {
+ {
+ uint32_t _flags_save_string_array = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->string_array));
+ ndr->flags = _flags_save_string_array;
+ }
+ break; }
+
+ default: {
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->data));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ break; }
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case REG_NONE:
+ break;
+
+ case REG_SZ:
+ break;
+
+ case REG_BINARY:
+ break;
+
+ case REG_DWORD:
+ break;
+
+ case REG_MULTI_SZ:
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_winreg_Data(struct ndr_print *ndr, const char *name, const union winreg_Data *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "winreg_Data");
+ switch (level) {
+ case REG_NONE:
+ break;
+
+ case REG_SZ:
+ ndr_print_string(ndr, "string", r->string);
+ break;
+
+ case REG_BINARY:
+ ndr_print_DATA_BLOB(ndr, "binary", r->binary);
+ break;
+
+ case REG_DWORD:
+ ndr_print_uint32(ndr, "value", r->value);
+ break;
+
+ case REG_MULTI_SZ:
+ ndr_print_string_array(ndr, "string_array", r->string_array);
+ break;
+
+ default:
+ ndr_print_DATA_BLOB(ndr, "data", r->data);
+ break;
+
+ }
+}
+
diff --git a/librpc/gen_ndr/ndr_misc.h b/librpc/gen_ndr/ndr_misc.h
index 938c946b73..99f975208a 100644
--- a/librpc/gen_ndr/ndr_misc.h
+++ b/librpc/gen_ndr/ndr_misc.h
@@ -23,4 +23,10 @@ void ndr_print_netr_SchannelType(struct ndr_print *ndr, const char *name, enum n
enum ndr_err_code ndr_push_KRB5_EDATA_NTSTATUS(struct ndr_push *ndr, int ndr_flags, const struct KRB5_EDATA_NTSTATUS *r);
enum ndr_err_code ndr_pull_KRB5_EDATA_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, struct KRB5_EDATA_NTSTATUS *r);
void ndr_print_KRB5_EDATA_NTSTATUS(struct ndr_print *ndr, const char *name, const struct KRB5_EDATA_NTSTATUS *r);
+enum ndr_err_code ndr_push_winreg_Type(struct ndr_push *ndr, int ndr_flags, enum winreg_Type r);
+enum ndr_err_code ndr_pull_winreg_Type(struct ndr_pull *ndr, int ndr_flags, enum winreg_Type *r);
+void ndr_print_winreg_Type(struct ndr_print *ndr, const char *name, enum winreg_Type r);
+enum ndr_err_code ndr_push_winreg_Data(struct ndr_push *ndr, int ndr_flags, const union winreg_Data *r);
+enum ndr_err_code ndr_pull_winreg_Data(struct ndr_pull *ndr, int ndr_flags, union winreg_Data *r);
+void ndr_print_winreg_Data(struct ndr_print *ndr, const char *name, const union winreg_Data *r);
#endif /* _HEADER_NDR_misc */
diff --git a/librpc/gen_ndr/ndr_winreg.c b/librpc/gen_ndr/ndr_winreg.c
index e28e9ac7f0..858cb08108 100644
--- a/librpc/gen_ndr/ndr_winreg.c
+++ b/librpc/gen_ndr/ndr_winreg.c
@@ -5,6 +5,7 @@
#include "librpc/gen_ndr/ndr_lsa.h"
#include "librpc/gen_ndr/ndr_security.h"
+#include "librpc/gen_ndr/ndr_misc.h"
static enum ndr_err_code ndr_push_winreg_AccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
{
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
@@ -34,41 +35,6 @@ _PUBLIC_ void ndr_print_winreg_AccessMask(struct ndr_print *ndr, const char *nam
ndr->depth--;
}
-_PUBLIC_ enum ndr_err_code ndr_push_winreg_Type(struct ndr_push *ndr, int ndr_flags, enum winreg_Type r)
-{
- NDR_CHECK(ndr_push_enum_uint32(ndr, NDR_SCALARS, r));
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_winreg_Type(struct ndr_pull *ndr, int ndr_flags, enum winreg_Type *r)
-{
- uint32_t v;
- NDR_CHECK(ndr_pull_enum_uint32(ndr, NDR_SCALARS, &v));
- *r = v;
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_winreg_Type(struct ndr_print *ndr, const char *name, enum winreg_Type r)
-{
- const char *val = NULL;
-
- switch (r) {
- case REG_NONE: val = "REG_NONE"; break;
- case REG_SZ: val = "REG_SZ"; break;
- case REG_EXPAND_SZ: val = "REG_EXPAND_SZ"; break;
- case REG_BINARY: val = "REG_BINARY"; break;
- case REG_DWORD: val = "REG_DWORD"; break;
- case REG_DWORD_BIG_ENDIAN: val = "REG_DWORD_BIG_ENDIAN"; break;
- case REG_LINK: val = "REG_LINK"; break;
- case REG_MULTI_SZ: val = "REG_MULTI_SZ"; break;
- case REG_RESOURCE_LIST: val = "REG_RESOURCE_LIST"; break;
- case REG_FULL_RESOURCE_DESCRIPTOR: val = "REG_FULL_RESOURCE_DESCRIPTOR"; break;
- case REG_RESOURCE_REQUIREMENTS_LIST: val = "REG_RESOURCE_REQUIREMENTS_LIST"; break;
- case REG_QWORD: val = "REG_QWORD"; break;
- }
- ndr_print_enum(ndr, name, "ENUM", val, r);
-}
-
_PUBLIC_ enum ndr_err_code ndr_push_winreg_String(struct ndr_push *ndr, int ndr_flags, const struct winreg_String *r)
{
if (ndr_flags & NDR_SCALARS) {
diff --git a/librpc/gen_ndr/ndr_winreg.h b/librpc/gen_ndr/ndr_winreg.h
index a8766f4cca..a496d4ccc6 100644
--- a/librpc/gen_ndr/ndr_winreg.h
+++ b/librpc/gen_ndr/ndr_winreg.h
@@ -83,9 +83,6 @@ extern const struct ndr_interface_table ndr_table_winreg;
#define NDR_WINREG_CALL_COUNT (35)
void ndr_print_winreg_AccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
-enum ndr_err_code ndr_push_winreg_Type(struct ndr_push *ndr, int ndr_flags, enum winreg_Type r);
-enum ndr_err_code ndr_pull_winreg_Type(struct ndr_pull *ndr, int ndr_flags, enum winreg_Type *r);
-void ndr_print_winreg_Type(struct ndr_print *ndr, const char *name, enum winreg_Type r);
enum ndr_err_code ndr_push_winreg_String(struct ndr_push *ndr, int ndr_flags, const struct winreg_String *r);
enum ndr_err_code ndr_pull_winreg_String(struct ndr_pull *ndr, int ndr_flags, struct winreg_String *r);
void ndr_print_winreg_String(struct ndr_print *ndr, const char *name, const struct winreg_String *r);
diff --git a/librpc/gen_ndr/winreg.h b/librpc/gen_ndr/winreg.h
index 9962927008..7116810708 100644
--- a/librpc/gen_ndr/winreg.h
+++ b/librpc/gen_ndr/winreg.h
@@ -6,6 +6,7 @@
#include "librpc/gen_ndr/lsa.h"
#include "librpc/gen_ndr/security.h"
+#include "librpc/gen_ndr/misc.h"
#ifndef _HEADER_winreg
#define _HEADER_winreg
@@ -23,39 +24,6 @@
#define KEY_WOW64_64KEY ( 0x00100 )
#define KEY_WOW64_32KEY ( 0x00200 )
-enum winreg_Type
-#ifndef USE_UINT_ENUMS
- {
- REG_NONE=(int)(0),
- REG_SZ=(int)(1),
- REG_EXPAND_SZ=(int)(2),
- REG_BINARY=(int)(3),
- REG_DWORD=(int)(4),
- REG_DWORD_BIG_ENDIAN=(int)(5),
- REG_LINK=(int)(6),
- REG_MULTI_SZ=(int)(7),
- REG_RESOURCE_LIST=(int)(8),
- REG_FULL_RESOURCE_DESCRIPTOR=(int)(9),
- REG_RESOURCE_REQUIREMENTS_LIST=(int)(10),
- REG_QWORD=(int)(11)
-}
-#else
- { __donnot_use_enum_winreg_Type=0x7FFFFFFF}
-#define REG_NONE ( 0 )
-#define REG_SZ ( 1 )
-#define REG_EXPAND_SZ ( 2 )
-#define REG_BINARY ( 3 )
-#define REG_DWORD ( 4 )
-#define REG_DWORD_BIG_ENDIAN ( 5 )
-#define REG_LINK ( 6 )
-#define REG_MULTI_SZ ( 7 )
-#define REG_RESOURCE_LIST ( 8 )
-#define REG_FULL_RESOURCE_DESCRIPTOR ( 9 )
-#define REG_RESOURCE_REQUIREMENTS_LIST ( 10 )
-#define REG_QWORD ( 11 )
-#endif
-;
-
struct winreg_String {
uint16_t name_len;/* [value(strlen_m_term(name)*2)] */
uint16_t name_size;/* [value(strlen_m_term(name)*2)] */
diff --git a/librpc/idl/misc.idl b/librpc/idl/misc.idl
index 5bc3c9f976..5a2bf75a74 100644
--- a/librpc/idl/misc.idl
+++ b/librpc/idl/misc.idl
@@ -1,3 +1,5 @@
+#include "idl_types.h"
+
/*
miscellaneous IDL structures
*/
@@ -43,4 +45,28 @@ interface misc
uint32 unknown1;
uint32 unknown2; /* 0x00000001 */
} KRB5_EDATA_NTSTATUS;
+
+ typedef [public,v1_enum] enum {
+ REG_NONE = 0,
+ REG_SZ = 1,
+ REG_EXPAND_SZ = 2,
+ REG_BINARY = 3,
+ REG_DWORD = 4,
+ REG_DWORD_BIG_ENDIAN = 5,
+ REG_LINK = 6,
+ REG_MULTI_SZ = 7,
+ REG_RESOURCE_LIST = 8,
+ REG_FULL_RESOURCE_DESCRIPTOR = 9,
+ REG_RESOURCE_REQUIREMENTS_LIST = 10,
+ REG_QWORD = 11
+ } winreg_Type;
+
+ typedef [nodiscriminant,public] union {
+ [case(REG_NONE)];
+ [case(REG_SZ)] nstring string;
+ [case(REG_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
+ [case(REG_DWORD)] uint32 value;
+ [case(REG_MULTI_SZ)] nstring_array string_array;
+ [default,flag(NDR_REMAINING)] DATA_BLOB data;
+ } winreg_Data;
}
diff --git a/librpc/idl/winreg.idl b/librpc/idl/winreg.idl
index 18b5edcb5d..f1f4dfb719 100644
--- a/librpc/idl/winreg.idl
+++ b/librpc/idl/winreg.idl
@@ -2,7 +2,7 @@
winreg interface definition
*/
-import "lsa.idl", "security.idl";
+import "lsa.idl", "security.idl", "misc.idl";
[
uuid("338cd001-2244-31f1-aaaa-900038001003"),
@@ -45,21 +45,6 @@ import "lsa.idl", "security.idl";
REG_KEY_WRITE |
KEY_CREATE_LINK);
- typedef [public,v1_enum] enum {
- REG_NONE = 0,
- REG_SZ = 1,
- REG_EXPAND_SZ = 2,
- REG_BINARY = 3,
- REG_DWORD = 4,
- REG_DWORD_BIG_ENDIAN = 5,
- REG_LINK = 6,
- REG_MULTI_SZ = 7,
- REG_RESOURCE_LIST = 8,
- REG_FULL_RESOURCE_DESCRIPTOR = 9,
- REG_RESOURCE_REQUIREMENTS_LIST = 10,
- REG_QWORD = 11
- } winreg_Type;
-
typedef [public] struct {
[value(strlen_m_term(name)*2)] uint16 name_len;
[value(strlen_m_term(name)*2)] uint16 name_size;