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

winreg: add winreg_Data union to IDL.

Guenther
This commit is contained in:
Günther Deschner 2009-09-23 20:41:44 +02:00
parent 21794b0dd2
commit 4365b7b408
8 changed files with 295 additions and 87 deletions

View File

@ -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 */

View File

@ -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;
}
}

View File

@ -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 */

View File

@ -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) {

View File

@ -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);

View File

@ -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)] */

View File

@ -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;
}

View File

@ -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;