spoolss.idl: align spoolss_PrinterEnumValues 'data' based on the type
authorStefan Metzmacher <metze@samba.org>
Tue, 22 Feb 2011 18:23:33 +0000 (19:23 +0100)
committerKarolin Seeger <kseeger@samba.org>
Sat, 5 Mar 2011 13:34:55 +0000 (14:34 +0100)
metze
(cherry picked from commit 341330600aebcec92fba64ea343888c15a0c3d44)
(cherry picked from commit 757471a5fcd4f95da28402bae6c9ceccff7d6548)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 3cb71012a2cf26037323cded8cfd9ec5d12223c6)

librpc/idl/spoolss.idl
librpc/ndr/ndr_spoolss_buf.c
librpc/ndr/ndr_spoolss_buf.h

index e0d9d2f9549432e044d9852f9a5aa87127d2ef7e..4b277f8707f27b8c2dd457843d8e4b19fc0a5371 100644 (file)
@@ -2550,7 +2550,7 @@ cpp_quote("#define spoolss_security_descriptor security_descriptor")
                [relative] nstring *value_name;
                [value(2*strlen_m_term(value_name))] uint32 value_name_len;
                winreg_Type type;
-               [relative,subcontext(0),subcontext_size(data_length),flag(NDR_REMAINING)] DATA_BLOB *data;
+               [relative,subcontext(0),subcontext_size(data_length),flag(NDR_REMAINING|ndr_spoolss_PrinterEnumValues_align(r->type))] DATA_BLOB *data;
                [value(data ? data->length : 0)] uint32 data_length;
        } spoolss_PrinterEnumValues;
 
index 811a8e2accbca3d854368929922a1ed2613bb88d..e132e701c45764b1683a0bc5937e4f221ab2001c 100644 (file)
@@ -1409,3 +1409,35 @@ _PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, co
        ndr->depth--;
        talloc_free(str);
 }
+
+_PUBLIC_ uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type)
+{
+       switch(type) {
+       case REG_NONE:
+               return 0;
+       case REG_SZ:
+               return LIBNDR_FLAG_ALIGN2;
+       case REG_EXPAND_SZ:
+               return LIBNDR_FLAG_ALIGN2;
+       case REG_BINARY:
+               return 0;
+       case REG_DWORD:
+               return LIBNDR_FLAG_ALIGN4;
+       case REG_DWORD_BIG_ENDIAN:
+               return LIBNDR_FLAG_ALIGN4;
+       case REG_LINK:
+               return 0;
+       case REG_MULTI_SZ:
+               return LIBNDR_FLAG_ALIGN2;
+       case REG_RESOURCE_LIST:
+               return LIBNDR_FLAG_ALIGN2;
+       case REG_FULL_RESOURCE_DESCRIPTOR:
+               return LIBNDR_FLAG_ALIGN4;
+       case REG_RESOURCE_REQUIREMENTS_LIST:
+               return LIBNDR_FLAG_ALIGN2;
+       case REG_QWORD:
+               return LIBNDR_FLAG_ALIGN8;
+       }
+
+       return 0;
+}
index 89dcb4617cbb38352aef56151a267c788753c6be..0b75de0cfd44c8a235aa7460ce963d1fd3a19cc2 100644 (file)
@@ -52,6 +52,7 @@ void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *na
 enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r);
 enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r);
 _PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r);
+_PUBLIC_ uint32_t ndr_spoolss_PrinterEnumValues_align(enum winreg_Type type);
 
 #undef _PRINTF_ATTRIBUTE
 #define _PRINTF_ATTRIBUTE(a1, a2)