s3-spoolss: remove old rpccli_spoolss_enumforms.
[ab/samba.git/.git] / source3 / rpc_parse / parse_spoolss.c
index 19738cfd2a40302b8cd4ff07e2173b9bfd6f9186..e3236066a1f695da34551e0f74624b0d60605fee 100644 (file)
@@ -71,4055 +71,2111 @@ bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime)
 }
 
 /*******************************************************************
-reads or writes an NOTIFY OPTION TYPE structure.
-********************************************************************/  
+ * read or write a DEVICEMODE struct.
+ * on reading allocate memory for the private member
+ ********************************************************************/
 
-/* NOTIFY_OPTION_TYPE and NOTIFY_OPTION_TYPE_DATA are really one
-   structure.  The _TYPE structure is really the deferred referrants (i.e
-   the notify fields array) of the _TYPE structure. -tpot */
+#define DM_NUM_OPTIONAL_FIELDS                 8
 
-static bool smb_io_notify_option_type(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth)
+bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode)
 {
-       prs_debug(ps, depth, desc, "smb_io_notify_option_type");
+       int available_space;            /* size of the device mode left to parse */
+                                       /* only important on unmarshalling       */
+       int i = 0;
+       uint16 *unistr_buffer;
+       int j;
+                                       
+       struct optional_fields {
+               fstring         name;
+               uint32*         field;
+       } opt_fields[DM_NUM_OPTIONAL_FIELDS] = {
+               { "icmmethod",          NULL },
+               { "icmintent",          NULL },
+               { "mediatype",          NULL },
+               { "dithertype",         NULL },
+               { "reserved1",          NULL },
+               { "reserved2",          NULL },
+               { "panningwidth",       NULL },
+               { "panningheight",      NULL }
+       };
+
+       /* assign at run time to keep non-gcc compilers happy */
+
+       opt_fields[0].field = &devmode->icmmethod;
+       opt_fields[1].field = &devmode->icmintent;
+       opt_fields[2].field = &devmode->mediatype;
+       opt_fields[3].field = &devmode->dithertype;
+       opt_fields[4].field = &devmode->reserved1;
+       opt_fields[5].field = &devmode->reserved2;
+       opt_fields[6].field = &devmode->panningwidth;
+       opt_fields[7].field = &devmode->panningheight;
+               
+       
+       prs_debug(ps, depth, desc, "spoolss_io_devmode");
        depth++;
-       if (!prs_align(ps))
-               return False;
 
-       if(!prs_uint16("type", ps, depth, &type->type))
+       if (UNMARSHALLING(ps)) {
+               devmode->devicename.buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
+               if (devmode->devicename.buffer == NULL)
+                       return False;
+               unistr_buffer = devmode->devicename.buffer;
+       }
+       else {
+               /* devicename is a static sized string but the buffer we set is not */
+               unistr_buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
+               memset( unistr_buffer, 0x0, MAXDEVICENAME );
+               for ( j=0; devmode->devicename.buffer[j]; j++ )
+                       unistr_buffer[j] = devmode->devicename.buffer[j];
+       }
+               
+       if (!prs_uint16uni(True,"devicename", ps, depth, unistr_buffer, MAXDEVICENAME))
                return False;
-       if(!prs_uint16("reserved0", ps, depth, &type->reserved0))
+       
+       if (!prs_uint16("specversion",      ps, depth, &devmode->specversion))
                return False;
-       if(!prs_uint32("reserved1", ps, depth, &type->reserved1))
+               
+       if (!prs_uint16("driverversion",    ps, depth, &devmode->driverversion))
                return False;
-       if(!prs_uint32("reserved2", ps, depth, &type->reserved2))
+       if (!prs_uint16("size",             ps, depth, &devmode->size))
                return False;
-       if(!prs_uint32("count", ps, depth, &type->count))
+       if (!prs_uint16("driverextra",      ps, depth, &devmode->driverextra))
                return False;
-       if(!prs_uint32("fields_ptr", ps, depth, &type->fields_ptr))
+       if (!prs_uint32("fields",           ps, depth, &devmode->fields))
                return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes an NOTIFY OPTION TYPE DATA.
-********************************************************************/  
-
-static bool smb_io_notify_option_type_data(const char *desc, SPOOL_NOTIFY_OPTION_TYPE *type, prs_struct *ps, int depth)
-{
-       int i;
-
-       prs_debug(ps, depth, desc, "smb_io_notify_option_type_data");
-       depth++;
-       /* if there are no fields just return */
-       if (type->fields_ptr==0)
-               return True;
-
-       if(!prs_align(ps))
+       if (!prs_uint16("orientation",      ps, depth, &devmode->orientation))
+               return False;
+       if (!prs_uint16("papersize",        ps, depth, &devmode->papersize))
+               return False;
+       if (!prs_uint16("paperlength",      ps, depth, &devmode->paperlength))
+               return False;
+       if (!prs_uint16("paperwidth",       ps, depth, &devmode->paperwidth))
+               return False;
+       if (!prs_uint16("scale",            ps, depth, &devmode->scale))
+               return False;
+       if (!prs_uint16("copies",           ps, depth, &devmode->copies))
+               return False;
+       if (!prs_uint16("defaultsource",    ps, depth, &devmode->defaultsource))
+               return False;
+       if (!prs_uint16("printquality",     ps, depth, &devmode->printquality))
+               return False;
+       if (!prs_uint16("color",            ps, depth, &devmode->color))
+               return False;
+       if (!prs_uint16("duplex",           ps, depth, &devmode->duplex))
+               return False;
+       if (!prs_uint16("yresolution",      ps, depth, &devmode->yresolution))
+               return False;
+       if (!prs_uint16("ttoption",         ps, depth, &devmode->ttoption))
+               return False;
+       if (!prs_uint16("collate",          ps, depth, &devmode->collate))
                return False;
 
-       if(!prs_uint32("count2", ps, depth, &type->count2))
+       if (UNMARSHALLING(ps)) {
+               devmode->formname.buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
+               if (devmode->formname.buffer == NULL)
+                       return False;
+               unistr_buffer = devmode->formname.buffer;
+       }
+       else {
+               /* devicename is a static sized string but the buffer we set is not */
+               unistr_buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
+               memset( unistr_buffer, 0x0, MAXDEVICENAME );
+               for ( j=0; devmode->formname.buffer[j]; j++ )
+                       unistr_buffer[j] = devmode->formname.buffer[j];
+       }
+       
+       if (!prs_uint16uni(True, "formname",  ps, depth, unistr_buffer, MAXDEVICENAME))
+               return False;
+       if (!prs_uint16("logpixels",        ps, depth, &devmode->logpixels))
+               return False;
+       if (!prs_uint32("bitsperpel",       ps, depth, &devmode->bitsperpel))
+               return False;
+       if (!prs_uint32("pelswidth",        ps, depth, &devmode->pelswidth))
+               return False;
+       if (!prs_uint32("pelsheight",       ps, depth, &devmode->pelsheight))
+               return False;
+       if (!prs_uint32("displayflags",     ps, depth, &devmode->displayflags))
+               return False;
+       if (!prs_uint32("displayfrequency", ps, depth, &devmode->displayfrequency))
                return False;
+       /* 
+        * every device mode I've ever seen on the wire at least has up 
+        * to the displayfrequency field.   --jerry (05-09-2002)
+        */
+        
+       /* add uint32's + uint16's + two UNICODE strings */
+        
+       available_space = devmode->size - (sizeof(uint32)*6 + sizeof(uint16)*18 + sizeof(uint16)*64);
+       
+       /* Sanity check - we only have uint32's left tp parse */
        
-       if (type->count2 != type->count)
-               DEBUG(4,("What a mess, count was %x now is %x !\n", type->count, type->count2));
+       if ( available_space && ((available_space % sizeof(uint32)) != 0) ) {
+               DEBUG(0,("spoolss_io_devmode: available_space [%d] no in multiple of 4 bytes (size = %d)!\n",
+                       available_space, devmode->size));
+               DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
+               return False;
+       }
 
-       if (type->count2 > MAX_NOTIFY_TYPE_FOR_NOW) {
+       /* 
+        * Conditional parsing.  Assume that the DeviceMode has been 
+        * zero'd by the caller. 
+        */
+       
+       while ((available_space > 0)  && (i < DM_NUM_OPTIONAL_FIELDS))
+       {
+               DEBUG(11, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space));
+               if (!prs_uint32(opt_fields[i].name, ps, depth, opt_fields[i].field))
+                       return False;
+               available_space -= sizeof(uint32);
+               i++;
+       }        
+       
+       /* Sanity Check - we should no available space at this point unless 
+          MS changes the device mode structure */
+               
+       if (available_space) {
+               DEBUG(0,("spoolss_io_devmode: I've parsed all I know and there is still stuff left|\n"));
+               DEBUG(0,("spoolss_io_devmode: available_space = [%d], devmode_size = [%d]!\n",
+                       available_space, devmode->size));
+               DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
                return False;
        }
 
-       /* parse the option type data */
-       for(i=0;i<type->count2;i++)
-               if(!prs_uint16("fields",ps,depth,&type->fields[i]))
+
+       if (devmode->driverextra!=0) {
+               if (UNMARSHALLING(ps)) {
+                       devmode->dev_private=PRS_ALLOC_MEM(ps, uint8, devmode->driverextra);
+                       if(devmode->dev_private == NULL)
+                               return False;
+                       DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for dev_private\n",devmode->driverextra)); 
+               }
+                       
+               DEBUG(7,("spoolss_io_devmode: parsing [%d] bytes of dev_private\n",devmode->driverextra));
+               if (!prs_uint8s(False, "dev_private",  ps, depth,
+                               devmode->dev_private, devmode->driverextra))
                        return False;
+       }
+
        return True;
 }
 
 /*******************************************************************
-reads or writes an NOTIFY OPTION structure.
-********************************************************************/  
+ * make a structure.
+ ********************************************************************/
 
-static bool smb_io_notify_option_type_ctr(const char *desc, SPOOL_NOTIFY_OPTION_TYPE_CTR *ctr , prs_struct *ps, int depth)
-{              
-       int i;
-       
-       prs_debug(ps, depth, desc, "smb_io_notify_option_type_ctr");
-       depth++;
-       if(!prs_uint32("count", ps, depth, &ctr->count))
-               return False;
+bool make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u,
+                                  const POLICY_HND *handle,
+                                  const char *valuename, uint32 size)
+{
+        if (q_u == NULL) return False;
 
-       /* reading */
-       if (UNMARSHALLING(ps) && ctr->count)
-               if((ctr->type=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION_TYPE,ctr->count)) == NULL)
-                       return False;
-               
-       /* the option type struct */
-       for(i=0;i<ctr->count;i++)
-               if(!smb_io_notify_option_type("", &ctr->type[i] , ps, depth))
-                       return False;
+        DEBUG(5,("make_spoolss_q_getprinterdata\n"));
 
-       /* the type associated with the option type struct */
-       for(i=0;i<ctr->count;i++)
-               if(!smb_io_notify_option_type_data("", &ctr->type[i] , ps, depth))
-                       return False;
-       
-       return True;
+        q_u->handle = *handle;
+       init_unistr2(&q_u->valuename, valuename, UNI_STR_TERMINATE);
+        q_u->size = size;
+
+        return True;
 }
 
 /*******************************************************************
-reads or writes an NOTIFY OPTION structure.
-********************************************************************/  
+ * read a structure.
+ * called from spoolss_q_getprinterdata (srv_spoolss.c)
+ ********************************************************************/
 
-static bool smb_io_notify_option(const char *desc, SPOOL_NOTIFY_OPTION *option, prs_struct *ps, int depth)
+bool spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth)
 {
-       prs_debug(ps, depth, desc, "smb_io_notify_option");
+       if (q_u == NULL)
+               return False;
+
+       prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdata");
        depth++;
-       
-       if(!prs_uint32("version", ps, depth, &option->version))
+
+       if (!prs_align(ps))
                return False;
-       if(!prs_uint32("flags", ps, depth, &option->flags))
+       if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
                return False;
-       if(!prs_uint32("count", ps, depth, &option->count))
+       if (!prs_align(ps))
                return False;
-       if(!prs_uint32("option_type_ptr", ps, depth, &option->option_type_ptr))
+       if (!smb_io_unistr2("valuename", &q_u->valuename,True,ps,depth))
                return False;
-       
-       /* marshalling or unmarshalling, that would work */     
-       if (option->option_type_ptr!=0) {
-               if(!smb_io_notify_option_type_ctr("", &option->ctr ,ps, depth))
-                       return False;
-       }
-       else {
-               option->ctr.type=NULL;
-               option->ctr.count=0;
-       }
-       
+       if (!prs_align(ps))
+               return False;
+       if (!prs_uint32("size", ps, depth, &q_u->size))
+               return False;
+
        return True;
 }
 
 /*******************************************************************
-reads or writes an NOTIFY INFO DATA structure.
-********************************************************************/  
+ * write a structure.
+ * called from spoolss_r_getprinterdata (srv_spoolss.c)
+ ********************************************************************/
 
-static bool smb_io_notify_info_data(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth)
+bool spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth)
 {
-       uint32 useless_ptr=0x0FF0ADDE;
+       if (r_u == NULL)
+               return False;
 
-       prs_debug(ps, depth, desc, "smb_io_notify_info_data");
+       prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdata");
        depth++;
 
-       if(!prs_align(ps))
+       if (!prs_align(ps))
                return False;
-       if(!prs_uint16("type",           ps, depth, &data->type))
+       if (!prs_uint32("type", ps, depth, &r_u->type))
                return False;
-       if(!prs_uint16("field",          ps, depth, &data->field))
+       if (!prs_uint32("size", ps, depth, &r_u->size))
                return False;
+       
+       if (UNMARSHALLING(ps) && r_u->size) {
+               r_u->data = PRS_ALLOC_MEM(ps, unsigned char, r_u->size);
+               if(!r_u->data)
+                       return False;
+       }
 
-       if(!prs_uint32("how many words", ps, depth, &data->size))
+       if (!prs_uint8s( False, "data", ps, depth, r_u->data, r_u->size ))
+               return False;
+               
+       if (!prs_align(ps))
                return False;
-       if(!prs_uint32("id",             ps, depth, &data->id))
+       
+       if (!prs_uint32("needed", ps, depth, &r_u->needed))
                return False;
-       if(!prs_uint32("how many words", ps, depth, &data->size))
+       if (!prs_werror("status", ps, depth, &r_u->status))
                return False;
+               
+       return True;
+}
 
-       switch (data->enc_type) {
-
-               /* One and two value data has two uint32 values */
-
-       case NOTIFY_ONE_VALUE:
-       case NOTIFY_TWO_VALUE:
-
-               if(!prs_uint32("value[0]", ps, depth, &data->notify_data.value[0]))
-                       return False;
-               if(!prs_uint32("value[1]", ps, depth, &data->notify_data.value[1]))
-                       return False;
-               break;
-
-               /* Pointers and strings have a string length and a
-                  pointer.  For a string the length is expressed as
-                  the number of uint16 characters plus a trailing
-                  \0\0. */
-
-       case NOTIFY_POINTER:
-
-               if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length ))
-                       return False;
-               if(!prs_uint32("pointer", ps, depth, &useless_ptr))
-                       return False;
-
-               break;
-
-       case NOTIFY_STRING:
-
-               if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length))
-                       return False;
-
-               if(!prs_uint32("pointer", ps, depth, &useless_ptr))
-                       return False;
-
-               break;
-
-       case NOTIFY_SECDESC:
-               if( !prs_uint32( "sd size", ps, depth, &data->notify_data.sd.size ) )
-                       return False;
-               if( !prs_uint32( "pointer", ps, depth, &useless_ptr ) )
-                       return False;
-               
-               break;
-
-       default:
-               DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data\n",
-                         data->enc_type));
-               break;
-       }
+/*******************************************************************
+ * return the length of a uint16 (obvious, but the code is clean)
+ ********************************************************************/
 
-       return True;
+static uint32 size_of_uint16(uint16 *value)
+{
+       return (sizeof(*value));
 }
 
 /*******************************************************************
-reads or writes an NOTIFY INFO DATA structure.
-********************************************************************/  
+ * return the length of a uint32 (obvious, but the code is clean)
+ ********************************************************************/
 
-bool smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *data,
-                                     prs_struct *ps, int depth)
+static uint32 size_of_uint32(uint32 *value)
 {
-       prs_debug(ps, depth, desc, "smb_io_notify_info_data_strings");
-       depth++;
-       
-       if(!prs_align(ps))
-               return False;
+       return (sizeof(*value));
+}
 
-       switch(data->enc_type) {
+/*******************************************************************
+ * return the length of a NTTIME (obvious, but the code is clean)
+ ********************************************************************/
 
-               /* No data for values */
+static uint32 size_of_nttime(NTTIME *value)
+{
+       return (sizeof(*value));
+}
 
-       case NOTIFY_ONE_VALUE:
-       case NOTIFY_TWO_VALUE:
+/*******************************************************************
+ * return the length of a uint32 (obvious, but the code is clean)
+ ********************************************************************/
 
-               break;
+static uint32 size_of_device_mode(DEVICEMODE *devmode)
+{
+       if (devmode==NULL)
+               return (4);
+       else 
+               return (4+devmode->size+devmode->driverextra);
+}
 
-               /* Strings start with a length in uint16s */
+/*******************************************************************
+ * return the length of a uint32 (obvious, but the code is clean)
+ ********************************************************************/
 
-       case NOTIFY_STRING:
+static uint32 size_of_systemtime(SYSTEMTIME *systime)
+{
+       if (systime==NULL)
+               return (4);
+       else 
+               return (sizeof(SYSTEMTIME) +4);
+}
 
-               if (MARSHALLING(ps))
-                       data->notify_data.data.length /= 2;
+/*******************************************************************
+ Parse a DEVMODE structure and its relative pointer.
+********************************************************************/
 
-               if(!prs_uint32("string length", ps, depth, &data->notify_data.data.length))
-                       return False;
+static bool smb_io_reldevmode(const char *desc, RPC_BUFFER *buffer, int depth, DEVICEMODE **devmode)
+{
+       prs_struct *ps=&buffer->prs;
 
-               if (UNMARSHALLING(ps) && data->notify_data.data.length) {
-                       data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16,
-                                                               data->notify_data.data.length);
+       prs_debug(ps, depth, desc, "smb_io_reldevmode");
+       depth++;
 
-                       if (!data->notify_data.data.string) 
+       if (MARSHALLING(ps)) {
+               uint32 struct_offset = prs_offset(ps);
+               uint32 relative_offset;
+               
+               if (*devmode == NULL) {
+                       relative_offset=0;
+                       if (!prs_uint32("offset", ps, depth, &relative_offset))
                                return False;
+                       DEBUG(8, ("boing, the devmode was NULL\n"));
+                       
+                       return True;
                }
+               
+               buffer->string_at_end -= ((*devmode)->size + (*devmode)->driverextra);
 
-               if (!prs_uint16uni(True, "string", ps, depth, data->notify_data.data.string,
-                                  data->notify_data.data.length))
-                       return False;
-
-               if (MARSHALLING(ps))
-                       data->notify_data.data.length *= 2;
-
-               break;
-
-       case NOTIFY_POINTER:
-
-               if (UNMARSHALLING(ps) && data->notify_data.data.length) {
-                       data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16,
-                                                               data->notify_data.data.length);
-
-                       if (!data->notify_data.data.string) 
-                               return False;
+               /* mz:  we have to align the device mode for VISTA */
+               if (buffer->string_at_end % 4) {
+                       buffer->string_at_end += 4 - (buffer->string_at_end % 4);
                }
 
-               if(!prs_uint8s(True,"buffer",ps,depth,(uint8*)data->notify_data.data.string,data->notify_data.data.length))
+               if(!prs_set_offset(ps, buffer->string_at_end))
+                       return False;
+               
+               /* write the DEVMODE */
+               if (!spoolss_io_devmode(desc, ps, depth, *devmode))
                        return False;
 
-               break;
-
-       case NOTIFY_SECDESC:    
-               if( !prs_uint32("secdesc size ", ps, depth, &data->notify_data.sd.size ) )
+               if(!prs_set_offset(ps, struct_offset))
                        return False;
-               if ( !sec_io_desc( "sec_desc", &data->notify_data.sd.desc, ps, depth ) )
+               
+               relative_offset=buffer->string_at_end - buffer->struct_start;
+               /* write its offset */
+               if (!prs_uint32("offset", ps, depth, &relative_offset))
                        return False;
-               break;
-
-       default:
-               DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data_strings\n",
-                         data->enc_type));
-               break;
        }
-
-#if 0
-       if (isvalue==False) {
-
-               /* length of string in unicode include \0 */
-               x=data->notify_data.data.length+1;
-
-               if (data->field != 16)
-               if(!prs_uint32("string length", ps, depth, &x ))
+       else {
+               uint32 old_offset;
+               
+               /* read the offset */
+               if (!prs_uint32("offset", ps, depth, &buffer->string_at_end))
                        return False;
-
-               if (MARSHALLING(ps)) {
-                       /* These are already in little endian format. Don't byte swap. */
-                       if (x == 1) {
-
-                               /* No memory allocated for this string
-                                  therefore following the data.string
-                                  pointer is a bad idea.  Use a pointer to
-                                  the uint32 length union member to
-                                  provide a source for a unicode NULL */
-
-                               if(!prs_uint8s(True,"string",ps,depth, (uint8 *)&data->notify_data.data.length,x*2)) 
-                                       return False;
-                       } else {
-
-                               if (data->field == 16)
-                                       x /= 2;
-
-                               if(!prs_uint16uni(True,"string",ps,depth,data->notify_data.data.string,x))
-                                       return False;
-                       }
-               } else {
-
-                       /* Tallocate memory for string */
-
-                       if (x) {
-                               data->notify_data.data.string = PRS_ALLOC_MEM(ps, uint16, x * 2);
-                               if (!data->notify_data.data.string) 
-                                       return False;
-                       } else {
-                               data->notify_data.data.string = NULL;
-                       }
-
-                       if(!prs_uint16uni(True,"string",ps,depth,data->notify_data.data.string,x))
-                               return False;
+               if (buffer->string_at_end == 0) {
+                       *devmode = NULL;
+                       return True;
                }
-       }
 
-#endif
+               old_offset = prs_offset(ps);
+               if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start))
+                       return False;
 
-#if 0  /* JERRY */
-       /* Win2k does not seem to put this parse align here */
-       if(!prs_align(ps))
-               return False;
-#endif
+               /* read the string */
+               if((*devmode=PRS_ALLOC_MEM(ps,DEVICEMODE,1)) == NULL)
+                       return False;
+               if (!spoolss_io_devmode(desc, ps, depth, *devmode))
+                       return False;
 
+               if(!prs_set_offset(ps, old_offset))
+                       return False;
+       }
        return True;
 }
 
 /*******************************************************************
-reads or writes an NOTIFY INFO structure.
+ Parse a PRINTER_INFO_0 structure.
 ********************************************************************/  
 
-static bool smb_io_notify_info(const char *desc, SPOOL_NOTIFY_INFO *info, prs_struct *ps, int depth)
+bool smb_io_printer_info_0(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_0 *info, int depth)
 {
-       int i;
+       prs_struct *ps=&buffer->prs;
 
-       prs_debug(ps, depth, desc, "smb_io_notify_info");
-       depth++;
-       if(!prs_align(ps))
-               return False;
+       prs_debug(ps, depth, desc, "smb_io_printer_info_0");
+       depth++;        
+       
+       buffer->struct_start=prs_offset(ps);
 
-       if(!prs_uint32("count", ps, depth, &info->count))
+       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
                return False;
-       if(!prs_uint32("version", ps, depth, &info->version))
+       if (!smb_io_relstr("servername", buffer, depth, &info->servername))
                return False;
-       if(!prs_uint32("flags", ps, depth, &info->flags))
+       
+       if(!prs_uint32("cjobs", ps, depth, &info->cjobs))
                return False;
-       if(!prs_uint32("count", ps, depth, &info->count))
+       if(!prs_uint32("total_jobs", ps, depth, &info->total_jobs))
                return False;
-
-       for (i=0;i<info->count;i++) {
-               if(!smb_io_notify_info_data(desc, &info->data[i], ps, depth))
-                       return False;
-       }
-
-       /* now do the strings at the end of the stream */       
-       for (i=0;i<info->count;i++) {
-               if(!smb_io_notify_info_data_strings(desc, &info->data[i], ps, depth))
-                       return False;
-       }
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/  
-
-bool spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u )
-{
-       prs_debug(ps, depth, desc, "");
-       depth++;
-
-       if (!prs_align(ps))
+       if(!prs_uint32("total_bytes", ps, depth, &info->total_bytes))
                return False;
 
-       if (!prs_uint32("size", ps, depth, &q_u->size))
+       if(!prs_uint16("year", ps, depth, &info->year))
                return False;
-
-       if (!prs_io_unistr2_p("", ps, depth, &q_u->client_name))
+       if(!prs_uint16("month", ps, depth, &info->month))
                return False;
-       if (!prs_io_unistr2_p("", ps, depth, &q_u->user_name))
+       if(!prs_uint16("dayofweek", ps, depth, &info->dayofweek))
                return False;
-
-       if (!prs_uint32("build", ps, depth, &q_u->build))
+       if(!prs_uint16("day", ps, depth, &info->day))
+               return False;
+       if(!prs_uint16("hour", ps, depth, &info->hour))
                return False;
-       if (!prs_uint32("major", ps, depth, &q_u->major))
+       if(!prs_uint16("minute", ps, depth, &info->minute))
                return False;
-       if (!prs_uint32("minor", ps, depth, &q_u->minor))
+       if(!prs_uint16("second", ps, depth, &info->second))
                return False;
-       if (!prs_uint32("processor", ps, depth, &q_u->processor))
+       if(!prs_uint16("milliseconds", ps, depth, &info->milliseconds))
                return False;
 
-       if (!prs_io_unistr2("", ps, depth, q_u->client_name))
+       if(!prs_uint32("global_counter", ps, depth, &info->global_counter))
                return False;
-       if (!prs_align(ps))
+       if(!prs_uint32("total_pages", ps, depth, &info->total_pages))
                return False;
 
-       if (!prs_io_unistr2("", ps, depth, q_u->user_name))
+       if(!prs_uint16("major_version", ps, depth, &info->major_version))
+               return False;
+       if(!prs_uint16("build_version", ps, depth, &info->build_version))
+               return False;
+       if(!prs_uint32("unknown7", ps, depth, &info->unknown7))
+               return False;
+       if(!prs_uint32("unknown8", ps, depth, &info->unknown8))
+               return False;
+       if(!prs_uint32("unknown9", ps, depth, &info->unknown9))
+               return False;
+       if(!prs_uint32("session_counter", ps, depth, &info->session_counter))
+               return False;
+       if(!prs_uint32("unknown11", ps, depth, &info->unknown11))
+               return False;
+       if(!prs_uint32("printer_errors", ps, depth, &info->printer_errors))
+               return False;
+       if(!prs_uint32("unknown13", ps, depth, &info->unknown13))
+               return False;
+       if(!prs_uint32("unknown14", ps, depth, &info->unknown14))
+               return False;
+       if(!prs_uint32("unknown15", ps, depth, &info->unknown15))
+               return False;
+       if(!prs_uint32("unknown16", ps, depth, &info->unknown16))
+               return False;
+       if(!prs_uint32("change_id", ps, depth, &info->change_id))
+               return False;
+       if(!prs_uint32("unknown18", ps, depth, &info->unknown18))
+               return False;
+       if(!prs_uint32("status"   , ps, depth, &info->status))
+               return False;
+       if(!prs_uint32("unknown20", ps, depth, &info->unknown20))
+               return False;
+       if(!prs_uint32("c_setprinter", ps, depth, &info->c_setprinter))
+               return False;
+       if(!prs_uint16("unknown22", ps, depth, &info->unknown22))
+               return False;
+       if(!prs_uint16("unknown23", ps, depth, &info->unknown23))
+               return False;
+       if(!prs_uint16("unknown24", ps, depth, &info->unknown24))
+               return False;
+       if(!prs_uint16("unknown25", ps, depth, &info->unknown25))
+               return False;
+       if(!prs_uint16("unknown26", ps, depth, &info->unknown26))
+               return False;
+       if(!prs_uint16("unknown27", ps, depth, &info->unknown27))
+               return False;
+       if(!prs_uint16("unknown28", ps, depth, &info->unknown28))
+               return False;
+       if(!prs_uint16("unknown29", ps, depth, &info->unknown29))
                return False;
 
        return True;
 }
 
 /*******************************************************************
+ Parse a PRINTER_INFO_1 structure.
 ********************************************************************/  
 
-static bool spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, int depth)
+bool smb_io_printer_info_1(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_1 *info, int depth)
 {
-       if (q_u==NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "spool_io_user_level");
-       depth++;
+       prs_struct *ps=&buffer->prs;
 
-       if (!prs_align(ps))
-               return False;
+       prs_debug(ps, depth, desc, "smb_io_printer_info_1");
+       depth++;        
+       
+       buffer->struct_start=prs_offset(ps);
 
-       if (!prs_uint32("level", ps, depth, &q_u->level))
+       if (!prs_uint32("flags", ps, depth, &info->flags))
                return False;
-       
-       switch ( q_u->level ) 
-       {       
-               case 1:
-                       if ( !prs_pointer( "" , ps, depth, (void*)&q_u->user.user1, 
-                               sizeof(SPOOL_USER_1), (PRS_POINTER_CAST)spool_io_user_level_1 )) 
-                       {
-                               return False;
-                       }
-                       break;
-               default:
-                       return False;   
-       }       
+       if (!smb_io_relstr("description", buffer, depth, &info->description))
+               return False;
+       if (!smb_io_relstr("name", buffer, depth, &info->name))
+               return False;
+       if (!smb_io_relstr("comment", buffer, depth, &info->comment))
+               return False;   
 
        return True;
 }
 
 /*******************************************************************
- * read or write a DEVICEMODE struct.
- * on reading allocate memory for the private member
- ********************************************************************/
-
-#define DM_NUM_OPTIONAL_FIELDS                 8
+ Parse a PRINTER_INFO_2 structure.
+********************************************************************/  
 
-bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode)
+bool smb_io_printer_info_2(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_2 *info, int depth)
 {
-       int available_space;            /* size of the device mode left to parse */
-                                       /* only important on unmarshalling       */
-       int i = 0;
-       uint16 *unistr_buffer;
-       int j;
-                                       
-       struct optional_fields {
-               fstring         name;
-               uint32*         field;
-       } opt_fields[DM_NUM_OPTIONAL_FIELDS] = {
-               { "icmmethod",          NULL },
-               { "icmintent",          NULL },
-               { "mediatype",          NULL },
-               { "dithertype",         NULL },
-               { "reserved1",          NULL },
-               { "reserved2",          NULL },
-               { "panningwidth",       NULL },
-               { "panningheight",      NULL }
-       };
-
-       /* assign at run time to keep non-gcc compilers happy */
+       prs_struct *ps=&buffer->prs;
+       uint32 dm_offset, sd_offset, current_offset;
+       uint32 dummy_value = 0, has_secdesc = 0;
 
-       opt_fields[0].field = &devmode->icmmethod;
-       opt_fields[1].field = &devmode->icmintent;
-       opt_fields[2].field = &devmode->mediatype;
-       opt_fields[3].field = &devmode->dithertype;
-       opt_fields[4].field = &devmode->reserved1;
-       opt_fields[5].field = &devmode->reserved2;
-       opt_fields[6].field = &devmode->panningwidth;
-       opt_fields[7].field = &devmode->panningheight;
-               
+       prs_debug(ps, depth, desc, "smb_io_printer_info_2");
+       depth++;        
        
-       prs_debug(ps, depth, desc, "spoolss_io_devmode");
-       depth++;
-
-       if (UNMARSHALLING(ps)) {
-               devmode->devicename.buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
-               if (devmode->devicename.buffer == NULL)
-                       return False;
-               unistr_buffer = devmode->devicename.buffer;
-       }
-       else {
-               /* devicename is a static sized string but the buffer we set is not */
-               unistr_buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
-               memset( unistr_buffer, 0x0, MAXDEVICENAME );
-               for ( j=0; devmode->devicename.buffer[j]; j++ )
-                       unistr_buffer[j] = devmode->devicename.buffer[j];
-       }
-               
-       if (!prs_uint16uni(True,"devicename", ps, depth, unistr_buffer, MAXDEVICENAME))
-               return False;
+       buffer->struct_start=prs_offset(ps);
        
-       if (!prs_uint16("specversion",      ps, depth, &devmode->specversion))
-               return False;
-               
-       if (!prs_uint16("driverversion",    ps, depth, &devmode->driverversion))
-               return False;
-       if (!prs_uint16("size",             ps, depth, &devmode->size))
-               return False;
-       if (!prs_uint16("driverextra",      ps, depth, &devmode->driverextra))
+       if (!smb_io_relstr("servername", buffer, depth, &info->servername))
                return False;
-       if (!prs_uint32("fields",           ps, depth, &devmode->fields))
+       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
                return False;
-       if (!prs_uint16("orientation",      ps, depth, &devmode->orientation))
+       if (!smb_io_relstr("sharename", buffer, depth, &info->sharename))
                return False;
-       if (!prs_uint16("papersize",        ps, depth, &devmode->papersize))
+       if (!smb_io_relstr("portname", buffer, depth, &info->portname))
                return False;
-       if (!prs_uint16("paperlength",      ps, depth, &devmode->paperlength))
+       if (!smb_io_relstr("drivername", buffer, depth, &info->drivername))
                return False;
-       if (!prs_uint16("paperwidth",       ps, depth, &devmode->paperwidth))
+       if (!smb_io_relstr("comment", buffer, depth, &info->comment))
                return False;
-       if (!prs_uint16("scale",            ps, depth, &devmode->scale))
+       if (!smb_io_relstr("location", buffer, depth, &info->location))
                return False;
-       if (!prs_uint16("copies",           ps, depth, &devmode->copies))
+
+       /* save current offset and wind forwared by a uint32 */
+       dm_offset = prs_offset(ps);
+       if (!prs_uint32("devmode", ps, depth, &dummy_value))
                return False;
-       if (!prs_uint16("defaultsource",    ps, depth, &devmode->defaultsource))
+       
+       if (!smb_io_relstr("sepfile", buffer, depth, &info->sepfile))
                return False;
-       if (!prs_uint16("printquality",     ps, depth, &devmode->printquality))
+       if (!smb_io_relstr("printprocessor", buffer, depth, &info->printprocessor))
                return False;
-       if (!prs_uint16("color",            ps, depth, &devmode->color))
+       if (!smb_io_relstr("datatype", buffer, depth, &info->datatype))
                return False;
-       if (!prs_uint16("duplex",           ps, depth, &devmode->duplex))
+       if (!smb_io_relstr("parameters", buffer, depth, &info->parameters))
                return False;
-       if (!prs_uint16("yresolution",      ps, depth, &devmode->yresolution))
+
+       /* save current offset for the sec_desc */
+       sd_offset = prs_offset(ps);
+       if (!prs_uint32("sec_desc", ps, depth, &has_secdesc))
                return False;
-       if (!prs_uint16("ttoption",         ps, depth, &devmode->ttoption))
+
+       
+       /* save current location so we can pick back up here */
+       current_offset = prs_offset(ps);
+       
+       /* parse the devmode */
+       if (!prs_set_offset(ps, dm_offset))
                return False;
-       if (!prs_uint16("collate",          ps, depth, &devmode->collate))
+       if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode))
                return False;
-
-       if (UNMARSHALLING(ps)) {
-               devmode->formname.buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
-               if (devmode->formname.buffer == NULL)
+       
+       /* parse the sec_desc */
+       if (info->secdesc) {
+               if (!prs_set_offset(ps, sd_offset))
+                       return False;
+               if (!smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc))
                        return False;
-               unistr_buffer = devmode->formname.buffer;
-       }
-       else {
-               /* devicename is a static sized string but the buffer we set is not */
-               unistr_buffer = PRS_ALLOC_MEM(ps, uint16, MAXDEVICENAME);
-               memset( unistr_buffer, 0x0, MAXDEVICENAME );
-               for ( j=0; devmode->formname.buffer[j]; j++ )
-                       unistr_buffer[j] = devmode->formname.buffer[j];
        }
-       
-       if (!prs_uint16uni(True, "formname",  ps, depth, unistr_buffer, MAXDEVICENAME))
+
+       /* pick up where we left off */
+       if (!prs_set_offset(ps, current_offset))
                return False;
-       if (!prs_uint16("logpixels",        ps, depth, &devmode->logpixels))
+
+       if (!prs_uint32("attributes", ps, depth, &info->attributes))
                return False;
-       if (!prs_uint32("bitsperpel",       ps, depth, &devmode->bitsperpel))
+       if (!prs_uint32("priority", ps, depth, &info->priority))
                return False;
-       if (!prs_uint32("pelswidth",        ps, depth, &devmode->pelswidth))
+       if (!prs_uint32("defpriority", ps, depth, &info->defaultpriority))
                return False;
-       if (!prs_uint32("pelsheight",       ps, depth, &devmode->pelsheight))
+       if (!prs_uint32("starttime", ps, depth, &info->starttime))
                return False;
-       if (!prs_uint32("displayflags",     ps, depth, &devmode->displayflags))
+       if (!prs_uint32("untiltime", ps, depth, &info->untiltime))
                return False;
-       if (!prs_uint32("displayfrequency", ps, depth, &devmode->displayfrequency))
+       if (!prs_uint32("status", ps, depth, &info->status))
                return False;
-       /* 
-        * every device mode I've ever seen on the wire at least has up 
-        * to the displayfrequency field.   --jerry (05-09-2002)
-        */
-        
-       /* add uint32's + uint16's + two UNICODE strings */
-        
-       available_space = devmode->size - (sizeof(uint32)*6 + sizeof(uint16)*18 + sizeof(uint16)*64);
-       
-       /* Sanity check - we only have uint32's left tp parse */
-       
-       if ( available_space && ((available_space % sizeof(uint32)) != 0) ) {
-               DEBUG(0,("spoolss_io_devmode: available_space [%d] no in multiple of 4 bytes (size = %d)!\n",
-                       available_space, devmode->size));
-               DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
+       if (!prs_uint32("jobs", ps, depth, &info->cjobs))
                return False;
-       }
-
-       /* 
-        * Conditional parsing.  Assume that the DeviceMode has been 
-        * zero'd by the caller. 
-        */
-       
-       while ((available_space > 0)  && (i < DM_NUM_OPTIONAL_FIELDS))
-       {
-               DEBUG(11, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space));
-               if (!prs_uint32(opt_fields[i].name, ps, depth, opt_fields[i].field))
-                       return False;
-               available_space -= sizeof(uint32);
-               i++;
-       }        
-       
-       /* Sanity Check - we should no available space at this point unless 
-          MS changes the device mode structure */
-               
-       if (available_space) {
-               DEBUG(0,("spoolss_io_devmode: I've parsed all I know and there is still stuff left|\n"));
-               DEBUG(0,("spoolss_io_devmode: available_space = [%d], devmode_size = [%d]!\n",
-                       available_space, devmode->size));
-               DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
+       if (!prs_uint32("averageppm", ps, depth, &info->averageppm))
                return False;
-       }
-
-
-       if (devmode->driverextra!=0) {
-               if (UNMARSHALLING(ps)) {
-                       devmode->dev_private=PRS_ALLOC_MEM(ps, uint8, devmode->driverextra);
-                       if(devmode->dev_private == NULL)
-                               return False;
-                       DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for dev_private\n",devmode->driverextra)); 
-               }
-                       
-               DEBUG(7,("spoolss_io_devmode: parsing [%d] bytes of dev_private\n",devmode->driverextra));
-               if (!prs_uint8s(False, "dev_private",  ps, depth,
-                               devmode->dev_private, devmode->driverextra))
-                       return False;
-       }
 
        return True;
 }
 
 /*******************************************************************
- Read or write a DEVICEMODE container
+ Parse a PRINTER_INFO_3 structure.
 ********************************************************************/  
 
-static bool spoolss_io_devmode_cont(const char *desc, DEVMODE_CTR *dm_c, prs_struct *ps, int depth)
+bool smb_io_printer_info_3(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_3 *info, int depth)
 {
-       if (dm_c==NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "spoolss_io_devmode_cont");
-       depth++;
+       uint32 offset = 0;
+       prs_struct *ps=&buffer->prs;
 
-       if(!prs_align(ps))
-               return False;
+       prs_debug(ps, depth, desc, "smb_io_printer_info_3");
+       depth++;        
        
-       if (!prs_uint32("size", ps, depth, &dm_c->size))
-               return False;
+       buffer->struct_start=prs_offset(ps);
+       
+       if (MARSHALLING(ps)) {
+               /* Ensure the SD is 8 byte aligned in the buffer. */
+               uint32 start = prs_offset(ps); /* Remember the start position. */
+               uint32 off_val = 0;
 
-       if (!prs_uint32("devmode_ptr", ps, depth, &dm_c->devmode_ptr))
-               return False;
+               /* Write a dummy value. */
+               if (!prs_uint32("offset", ps, depth, &off_val))
+                       return False;
 
-       if (dm_c->size==0 || dm_c->devmode_ptr==0) {
-               if (UNMARSHALLING(ps))
-                       /* if while reading there is no DEVMODE ... */
-                       dm_c->devmode=NULL;
-               return True;
-       }
-       
-       /* so we have a DEVICEMODE to follow */         
-       if (UNMARSHALLING(ps)) {
-               DEBUG(9,("Allocating memory for spoolss_io_devmode\n"));
-               dm_c->devmode=PRS_ALLOC_MEM(ps,DEVICEMODE,1);
-               if(dm_c->devmode == NULL)
+               /* 8 byte align. */
+               if (!prs_align_uint64(ps))
                        return False;
-       }
-       
-       /* this is bad code, shouldn't be there */
-       if (!prs_uint32("size", ps, depth, &dm_c->size))
-               return False;
-               
-       if (!spoolss_io_devmode(desc, ps, depth, dm_c->devmode))
-               return False;
+
+               /* Remember where we must seek back to write the SD. */
+               offset = prs_offset(ps);
+
+               /* Calculate the real offset for the SD. */
+
+               off_val = offset - start;
+
+               /* Seek back to where we store the SD offset & store. */
+               prs_set_offset(ps, start);
+               if (!prs_uint32("offset", ps, depth, &off_val))
+                       return False;
+
+               /* Return to after the 8 byte align. */
+               prs_set_offset(ps, offset);
+
+       } else {
+               if (!prs_uint32("offset", ps, depth, &offset))
+                       return False;
+               /* Seek within the buffer. */
+               if (!prs_set_offset(ps, offset))
+                       return False;
+       }
+       if (!sec_io_desc("sec_desc", &info->secdesc, ps, depth))
+               return False;
 
        return True;
 }
 
 /*******************************************************************
* init a structure.
- ********************************************************************/
Parse a PRINTER_INFO_4 structure.
+********************************************************************/  
 
-bool make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u, 
-       const char *srv_name, const char* clientname, const char* user_name,
-       uint32 level, PRINTER_INFO_CTR *ctr)
+bool smb_io_printer_info_4(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_4 *info, int depth)
 {
-       DEBUG(5,("make_spoolss_q_addprinterex\n"));
+       prs_struct *ps=&buffer->prs;
+
+       prs_debug(ps, depth, desc, "smb_io_printer_info_4");
+       depth++;        
+       
+       buffer->struct_start=prs_offset(ps);
        
-       if (!ctr || !ctr->printers_2) 
+       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
                return False;
-
-       ZERO_STRUCTP(q_u);
-
-       q_u->server_name = TALLOC_P( mem_ctx, UNISTR2 );
-       if (!q_u->server_name) {
+       if (!smb_io_relstr("servername", buffer, depth, &info->servername))
                return False;
-       }
-       init_unistr2(q_u->server_name, srv_name, UNI_FLAGS_NONE);
+       if (!prs_uint32("attributes", ps, depth, &info->attributes))
+               return False;
+       return True;
+}
 
-       q_u->level = level;
-       
-       q_u->info.level = level;
-       q_u->info.info_ptr = (ctr->printers_2!=NULL)?1:0;
-       switch (level) {
-               case 2:
-                       /* init q_u->info.info2 from *info */
-                       if (!make_spoolss_printer_info_2(mem_ctx, &q_u->info.info_2, ctr->printers_2)) {
-                               DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n"));
-                               return False;
-                       }
-                       break;
-               default :
-                       break;
-       }
+/*******************************************************************
+ Parse a PRINTER_INFO_5 structure.
+********************************************************************/  
 
-       q_u->user_switch=1;
+bool smb_io_printer_info_5(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_5 *info, int depth)
+{
+       prs_struct *ps=&buffer->prs;
 
-       q_u->user_ctr.level                 = 1;
-       q_u->user_ctr.user.user1            = TALLOC_P( talloc_tos(), SPOOL_USER_1 );
-       if (!q_u->user_ctr.user.user1) {
+       prs_debug(ps, depth, desc, "smb_io_printer_info_5");
+       depth++;        
+       
+       buffer->struct_start=prs_offset(ps);
+       
+       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
                return False;
-       }
-       q_u->user_ctr.user.user1->build     = 1381;
-       q_u->user_ctr.user.user1->major     = 2; 
-       q_u->user_ctr.user.user1->minor     = 0;
-       q_u->user_ctr.user.user1->processor = 0;
-
-       q_u->user_ctr.user.user1->client_name = TALLOC_P( mem_ctx, UNISTR2 );
-       if (!q_u->user_ctr.user.user1->client_name) {
+       if (!smb_io_relstr("portname", buffer, depth, &info->portname))
                return False;
-       }
-       q_u->user_ctr.user.user1->user_name   = TALLOC_P( mem_ctx, UNISTR2 );
-       if (!q_u->user_ctr.user.user1->user_name) {
+       if (!prs_uint32("attributes", ps, depth, &info->attributes))
+               return False;
+       if (!prs_uint32("device_not_selected_timeout", ps, depth, &info->device_not_selected_timeout))
+               return False;
+       if (!prs_uint32("transmission_retry_timeout", ps, depth, &info->transmission_retry_timeout))
                return False;
-       }
-       init_unistr2(q_u->user_ctr.user.user1->client_name, clientname, UNI_STR_TERMINATE);
-       init_unistr2(q_u->user_ctr.user.user1->user_name, user_name, UNI_STR_TERMINATE);
-
-       q_u->user_ctr.user.user1->size = q_u->user_ctr.user.user1->user_name->uni_str_len +
-                                  q_u->user_ctr.user.user1->client_name->uni_str_len + 2;
-       
        return True;
 }
-       
+
 /*******************************************************************
-create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct
-*******************************************************************/
+ Parse a PRINTER_INFO_6 structure.
+********************************************************************/  
 
-bool make_spoolss_printer_info_2(TALLOC_CTX *ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, 
-                               PRINTER_INFO_2 *info)
+bool smb_io_printer_info_6(const char *desc, RPC_BUFFER *buffer,
+                          PRINTER_INFO_6 *info, int depth)
 {
+       prs_struct *ps=&buffer->prs;
 
-       SPOOL_PRINTER_INFO_LEVEL_2 *inf;
-
-       /* allocate the necessary memory */
-       if (!(inf=TALLOC_P(ctx, SPOOL_PRINTER_INFO_LEVEL_2))) {
-               DEBUG(0,("make_spoolss_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n"));
+       prs_debug(ps, depth, desc, "smb_io_printer_info_6");
+       depth++;        
+       
+       if (!prs_uint32("status", ps, depth, &info->status))
                return False;
-       }
-
-       inf->servername_ptr     = (info->servername.buffer!=NULL)?1:0;
-       inf->printername_ptr    = (info->printername.buffer!=NULL)?1:0;
-       inf->sharename_ptr      = (info->sharename.buffer!=NULL)?1:0;
-       inf->portname_ptr       = (info->portname.buffer!=NULL)?1:0;
-       inf->drivername_ptr     = (info->drivername.buffer!=NULL)?1:0;
-       inf->comment_ptr        = (info->comment.buffer!=NULL)?1:0;
-       inf->location_ptr       = (info->location.buffer!=NULL)?1:0;
-       inf->devmode_ptr        = (info->devmode!=NULL)?1:0;
-       inf->sepfile_ptr        = (info->sepfile.buffer!=NULL)?1:0;
-       inf->printprocessor_ptr = (info->printprocessor.buffer!=NULL)?1:0;
-       inf->datatype_ptr       = (info->datatype.buffer!=NULL)?1:0;
-       inf->parameters_ptr     = (info->parameters.buffer!=NULL)?1:0;
-       inf->secdesc_ptr        = (info->secdesc!=NULL)?1:0;
-       inf->attributes         = info->attributes;
-       inf->priority           = info->priority;
-       inf->default_priority   = info->defaultpriority;
-       inf->starttime          = info->starttime;
-       inf->untiltime          = info->untiltime;
-       inf->cjobs              = info->cjobs;
-       inf->averageppm = info->averageppm;
-       init_unistr2_from_unistr(inf, &inf->servername, &info->servername);
-       init_unistr2_from_unistr(inf, &inf->printername, &info->printername);
-       init_unistr2_from_unistr(inf, &inf->sharename, &info->sharename);
-       init_unistr2_from_unistr(inf, &inf->portname, &info->portname);
-       init_unistr2_from_unistr(inf, &inf->drivername, &info->drivername);
-       init_unistr2_from_unistr(inf, &inf->comment, &info->comment);
-       init_unistr2_from_unistr(inf, &inf->location, &info->location);
-       init_unistr2_from_unistr(inf, &inf->sepfile, &info->sepfile);
-       init_unistr2_from_unistr(inf, &inf->printprocessor, &info->printprocessor);
-       init_unistr2_from_unistr(inf, &inf->datatype, &info->datatype);
-       init_unistr2_from_unistr(inf, &inf->parameters, &info->parameters);
-       init_unistr2_from_unistr(inf, &inf->datatype, &info->datatype);
-
-       *spool_info2 = inf;
 
        return True;
 }
 
 /*******************************************************************
-create a SPOOL_PRINTER_INFO_3 struct from a PRINTER_INFO_3 struct
-*******************************************************************/
+ Parse a PRINTER_INFO_7 structure.
+********************************************************************/  
 
-bool make_spoolss_printer_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3 **spool_info3, 
-                               PRINTER_INFO_3 *info)
+bool smb_io_printer_info_7(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_7 *info, int depth)
 {
+       prs_struct *ps=&buffer->prs;
 
-       SPOOL_PRINTER_INFO_LEVEL_3 *inf;
-
-       /* allocate the necessary memory */
-       if (!(inf=TALLOC_P(mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3))) {
-               DEBUG(0,("make_spoolss_printer_info_3: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_3 sruct!\n"));
-               return False;
-       }
+       prs_debug(ps, depth, desc, "smb_io_printer_info_7");
+       depth++;        
        
-       inf->secdesc_ptr        = (info->secdesc!=NULL)?1:0;
-
-       *spool_info3 = inf;
-
+       buffer->struct_start=prs_offset(ps);
+       
+       if (!smb_io_relstr("guid", buffer, depth, &info->guid))
+               return False;
+       if (!prs_uint32("action", ps, depth, &info->action))
+               return False;
        return True;
 }
 
 /*******************************************************************
-create a SPOOL_PRINTER_INFO_7 struct from a PRINTER_INFO_7 struct
-*******************************************************************/
+ Parse a PORT_INFO_1 structure.
+********************************************************************/  
 
-bool make_spoolss_printer_info_7(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7 **spool_info7, 
-                               PRINTER_INFO_7 *info)
+bool smb_io_port_info_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth)
 {
+       prs_struct *ps=&buffer->prs;
 
-       SPOOL_PRINTER_INFO_LEVEL_7 *inf;
-
-       /* allocate the necessary memory */
-       if (!(inf=TALLOC_P(mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7))) {
-               DEBUG(0,("make_spoolss_printer_info_7: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_7 struct!\n"));
+       prs_debug(ps, depth, desc, "smb_io_port_info_1");
+       depth++;        
+       
+       buffer->struct_start=prs_offset(ps);
+       
+       if (!smb_io_relstr("port_name", buffer, depth, &info->port_name))
                return False;
-       }
-
-       inf->guid_ptr = (info->guid.buffer!=NULL)?1:0;
-       inf->action = info->action;
-       init_unistr2_from_unistr(inf, &inf->guid, &info->guid);
-
-       *spool_info7 = inf;
 
        return True;
 }
 
 /*******************************************************************
* make a structure.
- ********************************************************************/
Parse a PORT_INFO_2 structure.
+********************************************************************/  
 
-bool make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u,
-                                  const POLICY_HND *handle,
-                                  const char *valuename, uint32 size)
+bool smb_io_port_info_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth)
 {
-        if (q_u == NULL) return False;
-
-        DEBUG(5,("make_spoolss_q_getprinterdata\n"));
+       prs_struct *ps=&buffer->prs;
 
-        q_u->handle = *handle;
-       init_unistr2(&q_u->valuename, valuename, UNI_STR_TERMINATE);
-        q_u->size = size;
+       prs_debug(ps, depth, desc, "smb_io_port_info_2");
+       depth++;        
+       
+       buffer->struct_start=prs_offset(ps);
+       
+       if (!smb_io_relstr("port_name", buffer, depth, &info->port_name))
+               return False;
+       if (!smb_io_relstr("monitor_name", buffer, depth, &info->monitor_name))
+               return False;
+       if (!smb_io_relstr("description", buffer, depth, &info->description))
+               return False;
+       if (!prs_uint32("port_type", ps, depth, &info->port_type))
+               return False;
+       if (!prs_uint32("reserved", ps, depth, &info->reserved))
+               return False;
 
-        return True;
+       return True;
 }
 
 /*******************************************************************
- * read a structure.
- * called from spoolss_q_getprinterdata (srv_spoolss.c)
- ********************************************************************/
+ Parse a DRIVER_INFO_1 structure.
+********************************************************************/
 
-bool spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth)
+bool smb_io_printer_driver_info_1(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) 
 {
-       if (q_u == NULL)
-               return False;
+       prs_struct *ps=&buffer->prs;
 
-       prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdata");
-       depth++;
+       prs_debug(ps, depth, desc, "smb_io_printer_driver_info_1");
+       depth++;        
+       
+       buffer->struct_start=prs_offset(ps);
 
-       if (!prs_align(ps))
-               return False;
-       if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
-               return False;
-       if (!prs_align(ps))
-               return False;
-       if (!smb_io_unistr2("valuename", &q_u->valuename,True,ps,depth))
-               return False;
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("size", ps, depth, &q_u->size))
+       if (!smb_io_relstr("name", buffer, depth, &info->name))
                return False;
 
        return True;
 }
 
 /*******************************************************************
- * write a structure.
- * called from spoolss_r_getprinterdata (srv_spoolss.c)
- ********************************************************************/
+ Parse a DRIVER_INFO_2 structure.
+********************************************************************/
 
-bool spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth)
+bool smb_io_printer_driver_info_2(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) 
 {
-       if (r_u == NULL)
-               return False;
+       prs_struct *ps=&buffer->prs;
 
-       prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdata");
-       depth++;
+       prs_debug(ps, depth, desc, "smb_io_printer_driver_info_2");
+       depth++;        
+       
+       buffer->struct_start=prs_offset(ps);
 
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("type", ps, depth, &r_u->type))
+       if (!prs_uint32("version", ps, depth, &info->version))
                return False;
-       if (!prs_uint32("size", ps, depth, &r_u->size))
+       if (!smb_io_relstr("name", buffer, depth, &info->name))
                return False;
-       
-       if (UNMARSHALLING(ps) && r_u->size) {
-               r_u->data = PRS_ALLOC_MEM(ps, unsigned char, r_u->size);
-               if(!r_u->data)
-                       return False;
-       }
-
-       if (!prs_uint8s( False, "data", ps, depth, r_u->data, r_u->size ))
+       if (!smb_io_relstr("architecture", buffer, depth, &info->architecture))
                return False;
-               
-       if (!prs_align(ps))
+       if (!smb_io_relstr("driverpath", buffer, depth, &info->driverpath))
                return False;
-       
-       if (!prs_uint32("needed", ps, depth, &r_u->needed))
+       if (!smb_io_relstr("datafile", buffer, depth, &info->datafile))
                return False;
-       if (!prs_werror("status", ps, depth, &r_u->status))
+       if (!smb_io_relstr("configfile", buffer, depth, &info->configfile))
                return False;
-               
+
        return True;
 }
 
 /*******************************************************************
- * read a structure.
- * called from spoolss_q_rffpcnex (srv_spoolss.c)
- ********************************************************************/
+ Parse a DRIVER_INFO_3 structure.
+********************************************************************/
 
-bool spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth)
+bool smb_io_printer_driver_info_3(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_3 *info, int depth)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex");
-       depth++;
+       prs_struct *ps=&buffer->prs;
 
-       if(!prs_align(ps))
-               return False;
+       prs_debug(ps, depth, desc, "smb_io_printer_driver_info_3");
+       depth++;        
+       
+       buffer->struct_start=prs_offset(ps);
 
-       if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth))
+       if (!prs_uint32("version", ps, depth, &info->version))
                return False;
-       if(!prs_uint32("flags", ps, depth, &q_u->flags))
+       if (!smb_io_relstr("name", buffer, depth, &info->name))
                return False;
-       if(!prs_uint32("options", ps, depth, &q_u->options))
+       if (!smb_io_relstr("architecture", buffer, depth, &info->architecture))
                return False;
-       if(!prs_uint32("localmachine_ptr", ps, depth, &q_u->localmachine_ptr))
+       if (!smb_io_relstr("driverpath", buffer, depth, &info->driverpath))
                return False;
-       if(!smb_io_unistr2("localmachine", &q_u->localmachine, q_u->localmachine_ptr, ps, depth))
+       if (!smb_io_relstr("datafile", buffer, depth, &info->datafile))
                return False;
-
-       if(!prs_align(ps))
+       if (!smb_io_relstr("configfile", buffer, depth, &info->configfile))
                return False;
-               
-       if(!prs_uint32("printerlocal", ps, depth, &q_u->printerlocal))
+       if (!smb_io_relstr("helpfile", buffer, depth, &info->helpfile))
                return False;
 
-       if(!prs_uint32("option_ptr", ps, depth, &q_u->option_ptr))
+       if (!smb_io_relarraystr("dependentfiles", buffer, depth, &info->dependentfiles))
                return False;
-       
-       if (q_u->option_ptr!=0) {
-       
-               if (UNMARSHALLING(ps))
-                       if((q_u->option=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION,1)) == NULL)
-                               return False;
-       
-               if(!smb_io_notify_option("notify option", q_u->option, ps, depth))
-                       return False;
-       }
-       
-       return True;
-}
 
-/*******************************************************************
- * write a structure.
- * called from spoolss_r_rffpcnex (srv_spoolss.c)
- ********************************************************************/
-
-bool spoolss_io_r_rffpcnex(const char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spoolss_io_r_rffpcnex");
-       depth++;
-
-       if(!prs_werror("status", ps, depth, &r_u->status))
+       if (!smb_io_relstr("monitorname", buffer, depth, &info->monitorname))
+               return False;
+       if (!smb_io_relstr("defaultdatatype", buffer, depth, &info->defaultdatatype))
                return False;
 
        return True;
 }
 
 /*******************************************************************
- * read a structure.
- * called from spoolss_q_rfnpcnex (srv_spoolss.c)
- ********************************************************************/
+ Parse a DRIVER_INFO_6 structure.
+********************************************************************/
 
-bool spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth)
+bool smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_6 *info, int depth)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex");
-       depth++;
+       prs_struct *ps=&buffer->prs;
 
-       if(!prs_align(ps))
+       prs_debug(ps, depth, desc, "smb_io_printer_driver_info_6");
+       depth++;        
+       
+       buffer->struct_start=prs_offset(ps);
+
+       if (!prs_uint32("version", ps, depth, &info->version))
+               return False;
+       if (!smb_io_relstr("name", buffer, depth, &info->name))
+               return False;
+       if (!smb_io_relstr("architecture", buffer, depth, &info->architecture))
+               return False;
+       if (!smb_io_relstr("driverpath", buffer, depth, &info->driverpath))
+               return False;
+       if (!smb_io_relstr("datafile", buffer, depth, &info->datafile))
+               return False;
+       if (!smb_io_relstr("configfile", buffer, depth, &info->configfile))
+               return False;
+       if (!smb_io_relstr("helpfile", buffer, depth, &info->helpfile))
                return False;
 
-       if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
+       if (!smb_io_relarraystr("dependentfiles", buffer, depth, &info->dependentfiles))
                return False;
 
-       if(!prs_uint32("change", ps, depth, &q_u->change))
+       if (!smb_io_relstr("monitorname", buffer, depth, &info->monitorname))
                return False;
-       
-       if(!prs_uint32("option_ptr", ps, depth, &q_u->option_ptr))
+       if (!smb_io_relstr("defaultdatatype", buffer, depth, &info->defaultdatatype))
                return False;
-       
-       if (q_u->option_ptr!=0) {
-       
-               if (UNMARSHALLING(ps))
-                       if((q_u->option=PRS_ALLOC_MEM(ps,SPOOL_NOTIFY_OPTION,1)) == NULL)
-                               return False;
-       
-               if(!smb_io_notify_option("notify option", q_u->option, ps, depth))
-                       return False;
-       }
 
+       if (!smb_io_relarraystr("previousdrivernames", buffer, depth, &info->previousdrivernames))
+               return False;
+
+       if (!prs_uint64("date", ps, depth, &info->driver_date))
+               return False;
+
+       if (!prs_uint32("padding", ps, depth, &info->padding))
+               return False;
+
+       if (!prs_uint32("driver_version_low", ps, depth, &info->driver_version_low))
+               return False;
+
+       if (!prs_uint32("driver_version_high", ps, depth, &info->driver_version_high))
+               return False;
+
+       if (!smb_io_relstr("mfgname", buffer, depth, &info->mfgname))
+               return False;
+       if (!smb_io_relstr("oem_url", buffer, depth, &info->oem_url))
+               return False;
+       if (!smb_io_relstr("hardware_id", buffer, depth, &info->hardware_id))
+               return False;
+       if (!smb_io_relstr("provider", buffer, depth, &info->provider))
+               return False;
+       
        return True;
 }
 
 /*******************************************************************
- * write a structure.
- * called from spoolss_r_rfnpcnex (srv_spoolss.c)
- ********************************************************************/
+ Parse a JOB_INFO_1 structure.
+********************************************************************/  
 
-bool spoolss_io_r_rfnpcnex(const char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth)
+bool smb_io_job_info_1(const char *desc, RPC_BUFFER *buffer, JOB_INFO_1 *info, int depth)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex");
-       depth++;
+       prs_struct *ps=&buffer->prs;
 
-       if(!prs_align(ps))
+       prs_debug(ps, depth, desc, "smb_io_job_info_1");
+       depth++;        
+       
+       buffer->struct_start=prs_offset(ps);
+
+       if (!prs_uint32("jobid", ps, depth, &info->jobid))
                return False;
-               
-       if (!prs_uint32("info_ptr", ps, depth, &r_u->info_ptr))
+       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
                return False;
-
-       if(!smb_io_notify_info("notify info", &r_u->info ,ps,depth))
+       if (!smb_io_relstr("machinename", buffer, depth, &info->machinename))
                return False;
-       
-       if(!prs_align(ps))
+       if (!smb_io_relstr("username", buffer, depth, &info->username))
                return False;
-       if(!prs_werror("status", ps, depth, &r_u->status))
+       if (!smb_io_relstr("document", buffer, depth, &info->document))
+               return False;
+       if (!smb_io_relstr("datatype", buffer, depth, &info->datatype))
+               return False;
+       if (!smb_io_relstr("text_status", buffer, depth, &info->text_status))
+               return False;
+       if (!prs_uint32("status", ps, depth, &info->status))
+               return False;
+       if (!prs_uint32("priority", ps, depth, &info->priority))
+               return False;
+       if (!prs_uint32("position", ps, depth, &info->position))
+               return False;
+       if (!prs_uint32("totalpages", ps, depth, &info->totalpages))
+               return False;
+       if (!prs_uint32("pagesprinted", ps, depth, &info->pagesprinted))
+               return False;
+       if (!spoolss_io_system_time("submitted", ps, depth, &info->submitted))
                return False;
 
        return True;
 }
 
 /*******************************************************************
- * return the length of a uint16 (obvious, but the code is clean)
- ********************************************************************/
+ Parse a JOB_INFO_2 structure.
+********************************************************************/  
 
-static uint32 size_of_uint16(uint16 *value)
-{
-       return (sizeof(*value));
-}
+bool smb_io_job_info_2(const char *desc, RPC_BUFFER *buffer, JOB_INFO_2 *info, int depth)
+{      
+       uint32 pipo=0;
+       prs_struct *ps=&buffer->prs;
+       
+       prs_debug(ps, depth, desc, "smb_io_job_info_2");
+       depth++;        
 
-/*******************************************************************
- * return the length of a uint32 (obvious, but the code is clean)
- ********************************************************************/
+       buffer->struct_start=prs_offset(ps);
+       
+       if (!prs_uint32("jobid",ps, depth, &info->jobid))
+               return False;
+       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
+               return False;
+       if (!smb_io_relstr("machinename", buffer, depth, &info->machinename))
+               return False;
+       if (!smb_io_relstr("username", buffer, depth, &info->username))
+               return False;
+       if (!smb_io_relstr("document", buffer, depth, &info->document))
+               return False;
+       if (!smb_io_relstr("notifyname", buffer, depth, &info->notifyname))
+               return False;
+       if (!smb_io_relstr("datatype", buffer, depth, &info->datatype))
+               return False;
 
-static uint32 size_of_uint32(uint32 *value)
-{
-       return (sizeof(*value));
-}
+       if (!smb_io_relstr("printprocessor", buffer, depth, &info->printprocessor))
+               return False;
+       if (!smb_io_relstr("parameters", buffer, depth, &info->parameters))
+               return False;
+       if (!smb_io_relstr("drivername", buffer, depth, &info->drivername))
+               return False;
+       if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode))
+               return False;
+       if (!smb_io_relstr("text_status", buffer, depth, &info->text_status))
+               return False;
 
-/*******************************************************************
* return the length of a NTTIME (obvious, but the code is clean)
- ********************************************************************/
+/*     SEC_DESC sec_desc;*/
      if (!prs_uint32("Hack! sec desc", ps, depth, &pipo))
+               return False;
 
-static uint32 size_of_nttime(NTTIME *value)
-{
-       return (sizeof(*value));
+       if (!prs_uint32("status",ps, depth, &info->status))
+               return False;
+       if (!prs_uint32("priority",ps, depth, &info->priority))
+               return False;
+       if (!prs_uint32("position",ps, depth, &info->position)) 
+               return False;
+       if (!prs_uint32("starttime",ps, depth, &info->starttime))
+               return False;
+       if (!prs_uint32("untiltime",ps, depth, &info->untiltime))       
+               return False;
+       if (!prs_uint32("totalpages",ps, depth, &info->totalpages))
+               return False;
+       if (!prs_uint32("size",ps, depth, &info->size))
+               return False;
+       if (!spoolss_io_system_time("submitted", ps, depth, &info->submitted) )
+               return False;
+       if (!prs_uint32("timeelapsed",ps, depth, &info->timeelapsed))
+               return False;
+       if (!prs_uint32("pagesprinted",ps, depth, &info->pagesprinted))
+               return False;
+
+       return True;
 }
 
 /*******************************************************************
- * return the length of a uint32 (obvious, but the code is clean)
- ********************************************************************/
+********************************************************************/  
 
-static uint32 size_of_device_mode(DEVICEMODE *devmode)
+bool smb_io_form_1(const char *desc, RPC_BUFFER *buffer, FORM_1 *info, int depth)
 {
-       if (devmode==NULL)
-               return (4);
-       else 
-               return (4+devmode->size+devmode->driverextra);
+       prs_struct *ps=&buffer->prs;
+       
+       prs_debug(ps, depth, desc, "smb_io_form_1");
+       depth++;
+               
+       buffer->struct_start=prs_offset(ps);
+       
+       if (!prs_uint32("flag", ps, depth, &info->flag))
+               return False;
+               
+       if (!smb_io_relstr("name", buffer, depth, &info->name))
+               return False;
+
+       if (!prs_uint32("width", ps, depth, &info->width))
+               return False;
+       if (!prs_uint32("length", ps, depth, &info->length))
+               return False;
+       if (!prs_uint32("left", ps, depth, &info->left))
+               return False;
+       if (!prs_uint32("top", ps, depth, &info->top))
+               return False;
+       if (!prs_uint32("right", ps, depth, &info->right))
+               return False;
+       if (!prs_uint32("bottom", ps, depth, &info->bottom))
+               return False;
+
+       return True;
 }
 
 /*******************************************************************
- * return the length of a uint32 (obvious, but the code is clean)
- ********************************************************************/
+ Parse a PORT_INFO_1 structure.
+********************************************************************/  
 
-static uint32 size_of_systemtime(SYSTEMTIME *systime)
+bool smb_io_port_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth)
 {
-       if (systime==NULL)
-               return (4);
-       else 
-               return (sizeof(SYSTEMTIME) +4);
+       prs_struct *ps=&buffer->prs;
+
+       prs_debug(ps, depth, desc, "smb_io_port_1");
+       depth++;
+
+       buffer->struct_start=prs_offset(ps);
+
+       if(!smb_io_relstr("port_name", buffer, depth, &info->port_name))
+               return False;
+
+       return True;
 }
 
 /*******************************************************************
- Parse a DEVMODE structure and its relative pointer.
-********************************************************************/
+ Parse a PORT_INFO_2 structure.
+********************************************************************/  
 
-static bool smb_io_reldevmode(const char *desc, RPC_BUFFER *buffer, int depth, DEVICEMODE **devmode)
+bool smb_io_port_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth)
 {
        prs_struct *ps=&buffer->prs;
 
-       prs_debug(ps, depth, desc, "smb_io_reldevmode");
+       prs_debug(ps, depth, desc, "smb_io_port_2");
        depth++;
 
-       if (MARSHALLING(ps)) {
-               uint32 struct_offset = prs_offset(ps);
-               uint32 relative_offset;
-               
-               if (*devmode == NULL) {
-                       relative_offset=0;
-                       if (!prs_uint32("offset", ps, depth, &relative_offset))
-                               return False;
-                       DEBUG(8, ("boing, the devmode was NULL\n"));
-                       
-                       return True;
-               }
-               
-               buffer->string_at_end -= ((*devmode)->size + (*devmode)->driverextra);
-
-               /* mz:  we have to align the device mode for VISTA */
-               if (buffer->string_at_end % 4) {
-                       buffer->string_at_end += 4 - (buffer->string_at_end % 4);
-               }
-
-               if(!prs_set_offset(ps, buffer->string_at_end))
-                       return False;
-               
-               /* write the DEVMODE */
-               if (!spoolss_io_devmode(desc, ps, depth, *devmode))
-                       return False;
-
-               if(!prs_set_offset(ps, struct_offset))
-                       return False;
-               
-               relative_offset=buffer->string_at_end - buffer->struct_start;
-               /* write its offset */
-               if (!prs_uint32("offset", ps, depth, &relative_offset))
-                       return False;
-       }
-       else {
-               uint32 old_offset;
-               
-               /* read the offset */
-               if (!prs_uint32("offset", ps, depth, &buffer->string_at_end))
-                       return False;
-               if (buffer->string_at_end == 0) {
-                       *devmode = NULL;
-                       return True;
-               }
-
-               old_offset = prs_offset(ps);
-               if(!prs_set_offset(ps, buffer->string_at_end + buffer->struct_start))
-                       return False;
+       buffer->struct_start=prs_offset(ps);
 
-               /* read the string */
-               if((*devmode=PRS_ALLOC_MEM(ps,DEVICEMODE,1)) == NULL)
-                       return False;
-               if (!spoolss_io_devmode(desc, ps, depth, *devmode))
-                       return False;
+       if(!smb_io_relstr("port_name", buffer, depth, &info->port_name))
+               return False;
+       if(!smb_io_relstr("monitor_name", buffer, depth, &info->monitor_name))
+               return False;
+       if(!smb_io_relstr("description", buffer, depth, &info->description))
+               return False;
+       if(!prs_uint32("port_type", ps, depth, &info->port_type))
+               return False;
+       if(!prs_uint32("reserved", ps, depth, &info->reserved))
+               return False;
 
-               if(!prs_set_offset(ps, old_offset))
-                       return False;
-       }
        return True;
 }
 
 /*******************************************************************
- Parse a PRINTER_INFO_0 structure.
 ********************************************************************/  
 
-bool smb_io_printer_info_0(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_0 *info, int depth)
+bool smb_io_printprocessor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth)
 {
        prs_struct *ps=&buffer->prs;
 
-       prs_debug(ps, depth, desc, "smb_io_printer_info_0");
+       prs_debug(ps, depth, desc, "smb_io_printprocessor_info_1");
        depth++;        
-       
-       buffer->struct_start=prs_offset(ps);
 
-       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
-               return False;
-       if (!smb_io_relstr("servername", buffer, depth, &info->servername))
-               return False;
+       buffer->struct_start=prs_offset(ps);
        
-       if(!prs_uint32("cjobs", ps, depth, &info->cjobs))
-               return False;
-       if(!prs_uint32("total_jobs", ps, depth, &info->total_jobs))
-               return False;
-       if(!prs_uint32("total_bytes", ps, depth, &info->total_bytes))
+       if (smb_io_relstr("name", buffer, depth, &info->name))
                return False;
 
-       if(!prs_uint16("year", ps, depth, &info->year))
-               return False;
-       if(!prs_uint16("month", ps, depth, &info->month))
-               return False;
-       if(!prs_uint16("dayofweek", ps, depth, &info->dayofweek))
-               return False;
-       if(!prs_uint16("day", ps, depth, &info->day))
-               return False;
-       if(!prs_uint16("hour", ps, depth, &info->hour))
-               return False;
-       if(!prs_uint16("minute", ps, depth, &info->minute))
-               return False;
-       if(!prs_uint16("second", ps, depth, &info->second))
-               return False;
-       if(!prs_uint16("milliseconds", ps, depth, &info->milliseconds))
-               return False;
+       return True;
+}
 
-       if(!prs_uint32("global_counter", ps, depth, &info->global_counter))
-               return False;
-       if(!prs_uint32("total_pages", ps, depth, &info->total_pages))
-               return False;
+/*******************************************************************
+********************************************************************/  
 
-       if(!prs_uint16("major_version", ps, depth, &info->major_version))
-               return False;
-       if(!prs_uint16("build_version", ps, depth, &info->build_version))
-               return False;
-       if(!prs_uint32("unknown7", ps, depth, &info->unknown7))
-               return False;
-       if(!prs_uint32("unknown8", ps, depth, &info->unknown8))
-               return False;
-       if(!prs_uint32("unknown9", ps, depth, &info->unknown9))
-               return False;
-       if(!prs_uint32("session_counter", ps, depth, &info->session_counter))
-               return False;
-       if(!prs_uint32("unknown11", ps, depth, &info->unknown11))
-               return False;
-       if(!prs_uint32("printer_errors", ps, depth, &info->printer_errors))
-               return False;
-       if(!prs_uint32("unknown13", ps, depth, &info->unknown13))
-               return False;
-       if(!prs_uint32("unknown14", ps, depth, &info->unknown14))
-               return False;
-       if(!prs_uint32("unknown15", ps, depth, &info->unknown15))
-               return False;
-       if(!prs_uint32("unknown16", ps, depth, &info->unknown16))
-               return False;
-       if(!prs_uint32("change_id", ps, depth, &info->change_id))
-               return False;
-       if(!prs_uint32("unknown18", ps, depth, &info->unknown18))
-               return False;
-       if(!prs_uint32("status"   , ps, depth, &info->status))
-               return False;
-       if(!prs_uint32("unknown20", ps, depth, &info->unknown20))
-               return False;
-       if(!prs_uint32("c_setprinter", ps, depth, &info->c_setprinter))
-               return False;
-       if(!prs_uint16("unknown22", ps, depth, &info->unknown22))
-               return False;
-       if(!prs_uint16("unknown23", ps, depth, &info->unknown23))
-               return False;
-       if(!prs_uint16("unknown24", ps, depth, &info->unknown24))
-               return False;
-       if(!prs_uint16("unknown25", ps, depth, &info->unknown25))
-               return False;
-       if(!prs_uint16("unknown26", ps, depth, &info->unknown26))
-               return False;
-       if(!prs_uint16("unknown27", ps, depth, &info->unknown27))
-               return False;
-       if(!prs_uint16("unknown28", ps, depth, &info->unknown28))
-               return False;
-       if(!prs_uint16("unknown29", ps, depth, &info->unknown29))
+bool smb_io_printprocdatatype_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth)
+{
+       prs_struct *ps=&buffer->prs;
+
+       prs_debug(ps, depth, desc, "smb_io_printprocdatatype_info_1");
+       depth++;        
+
+       buffer->struct_start=prs_offset(ps);
+       
+       if (smb_io_relstr("name", buffer, depth, &info->name))
                return False;
 
        return True;
 }
 
 /*******************************************************************
- Parse a PRINTER_INFO_1 structure.
 ********************************************************************/  
 
-bool smb_io_printer_info_1(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_1 *info, int depth)
+bool smb_io_printmonitor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_1 *info, int depth)
 {
        prs_struct *ps=&buffer->prs;
 
-       prs_debug(ps, depth, desc, "smb_io_printer_info_1");
+       prs_debug(ps, depth, desc, "smb_io_printmonitor_info_1");
        depth++;        
-       
+
        buffer->struct_start=prs_offset(ps);
 
-       if (!prs_uint32("flags", ps, depth, &info->flags))
-               return False;
-       if (!smb_io_relstr("description", buffer, depth, &info->description))
-               return False;
        if (!smb_io_relstr("name", buffer, depth, &info->name))
                return False;
-       if (!smb_io_relstr("comment", buffer, depth, &info->comment))
-               return False;   
 
        return True;
 }
 
 /*******************************************************************
- Parse a PRINTER_INFO_2 structure.
 ********************************************************************/  
 
-bool smb_io_printer_info_2(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_2 *info, int depth)
+bool smb_io_printmonitor_info_2(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_2 *info, int depth)
 {
        prs_struct *ps=&buffer->prs;
-       uint32 dm_offset, sd_offset, current_offset;
-       uint32 dummy_value = 0, has_secdesc = 0;
 
-       prs_debug(ps, depth, desc, "smb_io_printer_info_2");
+       prs_debug(ps, depth, desc, "smb_io_printmonitor_info_2");
        depth++;        
-       
+
        buffer->struct_start=prs_offset(ps);
-       
-       if (!smb_io_relstr("servername", buffer, depth, &info->servername))
-               return False;
-       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
-               return False;
-       if (!smb_io_relstr("sharename", buffer, depth, &info->sharename))
-               return False;
-       if (!smb_io_relstr("portname", buffer, depth, &info->portname))
-               return False;
-       if (!smb_io_relstr("drivername", buffer, depth, &info->drivername))
-               return False;
-       if (!smb_io_relstr("comment", buffer, depth, &info->comment))
-               return False;
-       if (!smb_io_relstr("location", buffer, depth, &info->location))
-               return False;
 
-       /* save current offset and wind forwared by a uint32 */
-       dm_offset = prs_offset(ps);
-       if (!prs_uint32("devmode", ps, depth, &dummy_value))
-               return False;
-       
-       if (!smb_io_relstr("sepfile", buffer, depth, &info->sepfile))
-               return False;
-       if (!smb_io_relstr("printprocessor", buffer, depth, &info->printprocessor))
+       if (!smb_io_relstr("name", buffer, depth, &info->name))
                return False;
-       if (!smb_io_relstr("datatype", buffer, depth, &info->datatype))
+       if (!smb_io_relstr("environment", buffer, depth, &info->environment))
                return False;
-       if (!smb_io_relstr("parameters", buffer, depth, &info->parameters))
+       if (!smb_io_relstr("dll_name", buffer, depth, &info->dll_name))
                return False;
 
-       /* save current offset for the sec_desc */
-       sd_offset = prs_offset(ps);
-       if (!prs_uint32("sec_desc", ps, depth, &has_secdesc))
-               return False;
+       return True;
+}
 
+/*******************************************************************
+return the size required by a struct in the stream
+********************************************************************/  
+
+uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info)
+{
+       int size=0;
        
-       /* save current location so we can pick back up here */
-       current_offset = prs_offset(ps);
-       
-       /* parse the devmode */
-       if (!prs_set_offset(ps, dm_offset))
-               return False;
-       if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode))
-               return False;
-       
-       /* parse the sec_desc */
-       if (info->secdesc) {
-               if (!prs_set_offset(ps, sd_offset))
-                       return False;
-               if (!smb_io_relsecdesc("secdesc", buffer, depth, &info->secdesc))
-                       return False;
-       }
+       size+=size_of_relative_string( &info->printername );
+       size+=size_of_relative_string( &info->servername );
 
-       /* pick up where we left off */
-       if (!prs_set_offset(ps, current_offset))
-               return False;
+       size+=size_of_uint32( &info->cjobs);
+       size+=size_of_uint32( &info->total_jobs);
+       size+=size_of_uint32( &info->total_bytes);
 
-       if (!prs_uint32("attributes", ps, depth, &info->attributes))
-               return False;
-       if (!prs_uint32("priority", ps, depth, &info->priority))
-               return False;
-       if (!prs_uint32("defpriority", ps, depth, &info->defaultpriority))
-               return False;
-       if (!prs_uint32("starttime", ps, depth, &info->starttime))
-               return False;
-       if (!prs_uint32("untiltime", ps, depth, &info->untiltime))
-               return False;
-       if (!prs_uint32("status", ps, depth, &info->status))
-               return False;
-       if (!prs_uint32("jobs", ps, depth, &info->cjobs))
-               return False;
-       if (!prs_uint32("averageppm", ps, depth, &info->averageppm))
-               return False;
-
-       return True;
-}
+       size+=size_of_uint16( &info->year);
+       size+=size_of_uint16( &info->month);
+       size+=size_of_uint16( &info->dayofweek);
+       size+=size_of_uint16( &info->day);
+       size+=size_of_uint16( &info->hour);
+       size+=size_of_uint16( &info->minute);
+       size+=size_of_uint16( &info->second);
+       size+=size_of_uint16( &info->milliseconds);
 
-/*******************************************************************
- Parse a PRINTER_INFO_3 structure.
-********************************************************************/  
+       size+=size_of_uint32( &info->global_counter);
+       size+=size_of_uint32( &info->total_pages);
 
-bool smb_io_printer_info_3(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_3 *info, int depth)
-{
-       uint32 offset = 0;
-       prs_struct *ps=&buffer->prs;
+       size+=size_of_uint16( &info->major_version);
+       size+=size_of_uint16( &info->build_version);
 
-       prs_debug(ps, depth, desc, "smb_io_printer_info_3");
-       depth++;        
+       size+=size_of_uint32( &info->unknown7);
+       size+=size_of_uint32( &info->unknown8);
+       size+=size_of_uint32( &info->unknown9);
+       size+=size_of_uint32( &info->session_counter);
+       size+=size_of_uint32( &info->unknown11);
+       size+=size_of_uint32( &info->printer_errors);
+       size+=size_of_uint32( &info->unknown13);
+       size+=size_of_uint32( &info->unknown14);
+       size+=size_of_uint32( &info->unknown15);
+       size+=size_of_uint32( &info->unknown16);
+       size+=size_of_uint32( &info->change_id);
+       size+=size_of_uint32( &info->unknown18);
+       size+=size_of_uint32( &info->status);
+       size+=size_of_uint32( &info->unknown20);
+       size+=size_of_uint32( &info->c_setprinter);
        
-       buffer->struct_start=prs_offset(ps);
+       size+=size_of_uint16( &info->unknown22);
+       size+=size_of_uint16( &info->unknown23);
+       size+=size_of_uint16( &info->unknown24);
+       size+=size_of_uint16( &info->unknown25);
+       size+=size_of_uint16( &info->unknown26);
+       size+=size_of_uint16( &info->unknown27);
+       size+=size_of_uint16( &info->unknown28);
+       size+=size_of_uint16( &info->unknown29);
        
-       if (MARSHALLING(ps)) {
-               /* Ensure the SD is 8 byte aligned in the buffer. */
-               uint32 start = prs_offset(ps); /* Remember the start position. */
-               uint32 off_val = 0;
-
-               /* Write a dummy value. */
-               if (!prs_uint32("offset", ps, depth, &off_val))
-                       return False;
-
-               /* 8 byte align. */
-               if (!prs_align_uint64(ps))
-                       return False;
-
-               /* Remember where we must seek back to write the SD. */
-               offset = prs_offset(ps);
-
-               /* Calculate the real offset for the SD. */
-
-               off_val = offset - start;
-
-               /* Seek back to where we store the SD offset & store. */
-               prs_set_offset(ps, start);
-               if (!prs_uint32("offset", ps, depth, &off_val))
-                       return False;
-
-               /* Return to after the 8 byte align. */
-               prs_set_offset(ps, offset);
-
-       } else {
-               if (!prs_uint32("offset", ps, depth, &offset))
-                       return False;
-               /* Seek within the buffer. */
-               if (!prs_set_offset(ps, offset))
-                       return False;
-       }
-       if (!sec_io_desc("sec_desc", &info->secdesc, ps, depth))
-               return False;
-
-       return True;
+       return size;
 }
 
 /*******************************************************************
- Parse a PRINTER_INFO_4 structure.
+return the size required by a struct in the stream
 ********************************************************************/  
 
-bool smb_io_printer_info_4(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_4 *info, int depth)
+uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info)
 {
-       prs_struct *ps=&buffer->prs;
+       int size=0;
+               
+       size+=size_of_uint32( &info->flags );   
+       size+=size_of_relative_string( &info->description );
+       size+=size_of_relative_string( &info->name );
+       size+=size_of_relative_string( &info->comment );
 
-       prs_debug(ps, depth, desc, "smb_io_printer_info_4");
-       depth++;        
-       
-       buffer->struct_start=prs_offset(ps);
-       
-       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
-               return False;
-       if (!smb_io_relstr("servername", buffer, depth, &info->servername))
-               return False;
-       if (!prs_uint32("attributes", ps, depth, &info->attributes))
-               return False;
-       return True;
+       return size;
 }
 
 /*******************************************************************
- Parse a PRINTER_INFO_5 structure.
-********************************************************************/  
+return the size required by a struct in the stream
+********************************************************************/
 
-bool smb_io_printer_info_5(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_5 *info, int depth)
+uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info)
 {
-       prs_struct *ps=&buffer->prs;
+       uint32 size=0;
+               
+       size += 4;
+       
+       size += ndr_size_security_descriptor( info->secdesc, NULL, 0 );
 
-       prs_debug(ps, depth, desc, "smb_io_printer_info_5");
-       depth++;        
+       size+=size_of_device_mode( info->devmode );
        
-       buffer->struct_start=prs_offset(ps);
+       size+=size_of_relative_string( &info->servername );
+       size+=size_of_relative_string( &info->printername );
+       size+=size_of_relative_string( &info->sharename );
+       size+=size_of_relative_string( &info->portname );
+       size+=size_of_relative_string( &info->drivername );
+       size+=size_of_relative_string( &info->comment );
+       size+=size_of_relative_string( &info->location );
        
-       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
-               return False;
-       if (!smb_io_relstr("portname", buffer, depth, &info->portname))
-               return False;
-       if (!prs_uint32("attributes", ps, depth, &info->attributes))
-               return False;
-       if (!prs_uint32("device_not_selected_timeout", ps, depth, &info->device_not_selected_timeout))
-               return False;
-       if (!prs_uint32("transmission_retry_timeout", ps, depth, &info->transmission_retry_timeout))
-               return False;
-       return True;
+       size+=size_of_relative_string( &info->sepfile );
+       size+=size_of_relative_string( &info->printprocessor );
+       size+=size_of_relative_string( &info->datatype );
+       size+=size_of_relative_string( &info->parameters );
+
+       size+=size_of_uint32( &info->attributes );
+       size+=size_of_uint32( &info->priority );
+       size+=size_of_uint32( &info->defaultpriority );
+       size+=size_of_uint32( &info->starttime );
+       size+=size_of_uint32( &info->untiltime );
+       size+=size_of_uint32( &info->status );
+       size+=size_of_uint32( &info->cjobs );
+       size+=size_of_uint32( &info->averageppm );      
+               
+       /* 
+        * add any adjustments for alignment.  This is
+        * not optimal since we could be calling this
+        * function from a loop (e.g. enumprinters), but 
+        * it is easier to maintain the calculation here and
+        * not place the burden on the caller to remember.   --jerry
+        */
+       if ((size % 4) != 0)
+               size += 4 - (size % 4);
+       
+       return size;
 }
 
 /*******************************************************************
- Parse a PRINTER_INFO_6 structure.
-********************************************************************/  
+return the size required by a struct in the stream
+********************************************************************/
 
-bool smb_io_printer_info_6(const char *desc, RPC_BUFFER *buffer,
-                          PRINTER_INFO_6 *info, int depth)
+uint32 spoolss_size_printer_info_4(PRINTER_INFO_4 *info)
 {
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_printer_info_6");
-       depth++;        
-       
-       if (!prs_uint32("status", ps, depth, &info->status))
-               return False;
+       uint32 size=0;
+               
+       size+=size_of_relative_string( &info->printername );
+       size+=size_of_relative_string( &info->servername );
 
-       return True;
+       size+=size_of_uint32( &info->attributes );
+       return size;
 }
 
 /*******************************************************************
- Parse a PRINTER_INFO_7 structure.
-********************************************************************/  
+return the size required by a struct in the stream
+********************************************************************/
 
-bool smb_io_printer_info_7(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_7 *info, int depth)
+uint32 spoolss_size_printer_info_5(PRINTER_INFO_5 *info)
 {
-       prs_struct *ps=&buffer->prs;
+       uint32 size=0;
+               
+       size+=size_of_relative_string( &info->printername );
+       size+=size_of_relative_string( &info->portname );
 
-       prs_debug(ps, depth, desc, "smb_io_printer_info_7");
-       depth++;        
-       
-       buffer->struct_start=prs_offset(ps);
-       
-       if (!smb_io_relstr("guid", buffer, depth, &info->guid))
-               return False;
-       if (!prs_uint32("action", ps, depth, &info->action))
-               return False;
-       return True;
+       size+=size_of_uint32( &info->attributes );
+       size+=size_of_uint32( &info->device_not_selected_timeout );
+       size+=size_of_uint32( &info->transmission_retry_timeout );
+       return size;
 }
 
 /*******************************************************************
- Parse a PORT_INFO_1 structure.
-********************************************************************/  
+return the size required by a struct in the stream
+********************************************************************/
 
-bool smb_io_port_info_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth)
+uint32 spoolss_size_printer_info_6(PRINTER_INFO_6 *info)
 {
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_port_info_1");
-       depth++;        
-       
-       buffer->struct_start=prs_offset(ps);
-       
-       if (!smb_io_relstr("port_name", buffer, depth, &info->port_name))
-               return False;
-
-       return True;
+       return sizeof(uint32);
 }
 
 /*******************************************************************
- Parse a PORT_INFO_2 structure.
-********************************************************************/  
+return the size required by a struct in the stream
+********************************************************************/
 
-bool smb_io_port_info_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth)
+uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info)
 {
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_port_info_2");
-       depth++;        
-       
-       buffer->struct_start=prs_offset(ps);
-       
-       if (!smb_io_relstr("port_name", buffer, depth, &info->port_name))
-               return False;
-       if (!smb_io_relstr("monitor_name", buffer, depth, &info->monitor_name))
-               return False;
-       if (!smb_io_relstr("description", buffer, depth, &info->description))
-               return False;
-       if (!prs_uint32("port_type", ps, depth, &info->port_type))
-               return False;
-       if (!prs_uint32("reserved", ps, depth, &info->reserved))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Parse a DRIVER_INFO_1 structure.
-********************************************************************/
-
-bool smb_io_printer_driver_info_1(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) 
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_printer_driver_info_1");
-       depth++;        
-       
-       buffer->struct_start=prs_offset(ps);
-
-       if (!smb_io_relstr("name", buffer, depth, &info->name))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Parse a DRIVER_INFO_2 structure.
-********************************************************************/
-
-bool smb_io_printer_driver_info_2(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) 
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_printer_driver_info_2");
-       depth++;        
-       
-       buffer->struct_start=prs_offset(ps);
-
-       if (!prs_uint32("version", ps, depth, &info->version))
-               return False;
-       if (!smb_io_relstr("name", buffer, depth, &info->name))
-               return False;
-       if (!smb_io_relstr("architecture", buffer, depth, &info->architecture))
-               return False;
-       if (!smb_io_relstr("driverpath", buffer, depth, &info->driverpath))
-               return False;
-       if (!smb_io_relstr("datafile", buffer, depth, &info->datafile))
-               return False;
-       if (!smb_io_relstr("configfile", buffer, depth, &info->configfile))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Parse a DRIVER_INFO_3 structure.
-********************************************************************/
-
-bool smb_io_printer_driver_info_3(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_3 *info, int depth)
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_printer_driver_info_3");
-       depth++;        
-       
-       buffer->struct_start=prs_offset(ps);
-
-       if (!prs_uint32("version", ps, depth, &info->version))
-               return False;
-       if (!smb_io_relstr("name", buffer, depth, &info->name))
-               return False;
-       if (!smb_io_relstr("architecture", buffer, depth, &info->architecture))
-               return False;
-       if (!smb_io_relstr("driverpath", buffer, depth, &info->driverpath))
-               return False;
-       if (!smb_io_relstr("datafile", buffer, depth, &info->datafile))
-               return False;
-       if (!smb_io_relstr("configfile", buffer, depth, &info->configfile))
-               return False;
-       if (!smb_io_relstr("helpfile", buffer, depth, &info->helpfile))
-               return False;
-
-       if (!smb_io_relarraystr("dependentfiles", buffer, depth, &info->dependentfiles))
-               return False;
-
-       if (!smb_io_relstr("monitorname", buffer, depth, &info->monitorname))
-               return False;
-       if (!smb_io_relstr("defaultdatatype", buffer, depth, &info->defaultdatatype))
-               return False;
-
-       return True;
+       /* The 8 is for the self relative pointer - 8 byte aligned.. */
+       return 8 + (uint32)ndr_size_security_descriptor( info->secdesc, NULL, 0 );
 }
 
 /*******************************************************************
- Parse a DRIVER_INFO_6 structure.
+return the size required by a struct in the stream
 ********************************************************************/
 
-bool smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_6 *info, int depth)
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_printer_driver_info_6");
-       depth++;        
-       
-       buffer->struct_start=prs_offset(ps);
-
-       if (!prs_uint32("version", ps, depth, &info->version))
-               return False;
-       if (!smb_io_relstr("name", buffer, depth, &info->name))
-               return False;
-       if (!smb_io_relstr("architecture", buffer, depth, &info->architecture))
-               return False;
-       if (!smb_io_relstr("driverpath", buffer, depth, &info->driverpath))
-               return False;
-       if (!smb_io_relstr("datafile", buffer, depth, &info->datafile))
-               return False;
-       if (!smb_io_relstr("configfile", buffer, depth, &info->configfile))
-               return False;
-       if (!smb_io_relstr("helpfile", buffer, depth, &info->helpfile))
-               return False;
-
-       if (!smb_io_relarraystr("dependentfiles", buffer, depth, &info->dependentfiles))
-               return False;
-
-       if (!smb_io_relstr("monitorname", buffer, depth, &info->monitorname))
-               return False;
-       if (!smb_io_relstr("defaultdatatype", buffer, depth, &info->defaultdatatype))
-               return False;
-
-       if (!smb_io_relarraystr("previousdrivernames", buffer, depth, &info->previousdrivernames))
-               return False;
-
-       if (!prs_uint64("date", ps, depth, &info->driver_date))
-               return False;
-
-       if (!prs_uint32("padding", ps, depth, &info->padding))
-               return False;
-
-       if (!prs_uint32("driver_version_low", ps, depth, &info->driver_version_low))
-               return False;
-
-       if (!prs_uint32("driver_version_high", ps, depth, &info->driver_version_high))
-               return False;
-
-       if (!smb_io_relstr("mfgname", buffer, depth, &info->mfgname))
-               return False;
-       if (!smb_io_relstr("oem_url", buffer, depth, &info->oem_url))
-               return False;
-       if (!smb_io_relstr("hardware_id", buffer, depth, &info->hardware_id))
-               return False;
-       if (!smb_io_relstr("provider", buffer, depth, &info->provider))
-               return False;
-       
-       return True;
-}
-
-/*******************************************************************
- Parse a JOB_INFO_1 structure.
-********************************************************************/  
-
-bool smb_io_job_info_1(const char *desc, RPC_BUFFER *buffer, JOB_INFO_1 *info, int depth)
+uint32 spoolss_size_printer_info_7(PRINTER_INFO_7 *info)
 {
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_job_info_1");
-       depth++;        
-       
-       buffer->struct_start=prs_offset(ps);
-
-       if (!prs_uint32("jobid", ps, depth, &info->jobid))
-               return False;
-       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
-               return False;
-       if (!smb_io_relstr("machinename", buffer, depth, &info->machinename))
-               return False;
-       if (!smb_io_relstr("username", buffer, depth, &info->username))
-               return False;
-       if (!smb_io_relstr("document", buffer, depth, &info->document))
-               return False;
-       if (!smb_io_relstr("datatype", buffer, depth, &info->datatype))
-               return False;
-       if (!smb_io_relstr("text_status", buffer, depth, &info->text_status))
-               return False;
-       if (!prs_uint32("status", ps, depth, &info->status))
-               return False;
-       if (!prs_uint32("priority", ps, depth, &info->priority))
-               return False;
-       if (!prs_uint32("position", ps, depth, &info->position))
-               return False;
-       if (!prs_uint32("totalpages", ps, depth, &info->totalpages))
-               return False;
-       if (!prs_uint32("pagesprinted", ps, depth, &info->pagesprinted))
-               return False;
-       if (!spoolss_io_system_time("submitted", ps, depth, &info->submitted))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Parse a JOB_INFO_2 structure.
-********************************************************************/  
-
-bool smb_io_job_info_2(const char *desc, RPC_BUFFER *buffer, JOB_INFO_2 *info, int depth)
-{      
-       uint32 pipo=0;
-       prs_struct *ps=&buffer->prs;
-       
-       prs_debug(ps, depth, desc, "smb_io_job_info_2");
-       depth++;        
-
-       buffer->struct_start=prs_offset(ps);
-       
-       if (!prs_uint32("jobid",ps, depth, &info->jobid))
-               return False;
-       if (!smb_io_relstr("printername", buffer, depth, &info->printername))
-               return False;
-       if (!smb_io_relstr("machinename", buffer, depth, &info->machinename))
-               return False;
-       if (!smb_io_relstr("username", buffer, depth, &info->username))
-               return False;
-       if (!smb_io_relstr("document", buffer, depth, &info->document))
-               return False;
-       if (!smb_io_relstr("notifyname", buffer, depth, &info->notifyname))
-               return False;
-       if (!smb_io_relstr("datatype", buffer, depth, &info->datatype))
-               return False;
-
-       if (!smb_io_relstr("printprocessor", buffer, depth, &info->printprocessor))
-               return False;
-       if (!smb_io_relstr("parameters", buffer, depth, &info->parameters))
-               return False;
-       if (!smb_io_relstr("drivername", buffer, depth, &info->drivername))
-               return False;
-       if (!smb_io_reldevmode("devmode", buffer, depth, &info->devmode))
-               return False;
-       if (!smb_io_relstr("text_status", buffer, depth, &info->text_status))
-               return False;
-
-/*     SEC_DESC sec_desc;*/
-       if (!prs_uint32("Hack! sec desc", ps, depth, &pipo))
-               return False;
-
-       if (!prs_uint32("status",ps, depth, &info->status))
-               return False;
-       if (!prs_uint32("priority",ps, depth, &info->priority))
-               return False;
-       if (!prs_uint32("position",ps, depth, &info->position)) 
-               return False;
-       if (!prs_uint32("starttime",ps, depth, &info->starttime))
-               return False;
-       if (!prs_uint32("untiltime",ps, depth, &info->untiltime))       
-               return False;
-       if (!prs_uint32("totalpages",ps, depth, &info->totalpages))
-               return False;
-       if (!prs_uint32("size",ps, depth, &info->size))
-               return False;
-       if (!spoolss_io_system_time("submitted", ps, depth, &info->submitted) )
-               return False;
-       if (!prs_uint32("timeelapsed",ps, depth, &info->timeelapsed))
-               return False;
-       if (!prs_uint32("pagesprinted",ps, depth, &info->pagesprinted))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/  
-
-bool smb_io_form_1(const char *desc, RPC_BUFFER *buffer, FORM_1 *info, int depth)
-{
-       prs_struct *ps=&buffer->prs;
-       
-       prs_debug(ps, depth, desc, "smb_io_form_1");
-       depth++;
-               
-       buffer->struct_start=prs_offset(ps);
-       
-       if (!prs_uint32("flag", ps, depth, &info->flag))
-               return False;
-               
-       if (!smb_io_relstr("name", buffer, depth, &info->name))
-               return False;
-
-       if (!prs_uint32("width", ps, depth, &info->width))
-               return False;
-       if (!prs_uint32("length", ps, depth, &info->length))
-               return False;
-       if (!prs_uint32("left", ps, depth, &info->left))
-               return False;
-       if (!prs_uint32("top", ps, depth, &info->top))
-               return False;
-       if (!prs_uint32("right", ps, depth, &info->right))
-               return False;
-       if (!prs_uint32("bottom", ps, depth, &info->bottom))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Parse a PORT_INFO_1 structure.
-********************************************************************/  
-
-bool smb_io_port_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth)
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_port_1");
-       depth++;
-
-       buffer->struct_start=prs_offset(ps);
-
-       if(!smb_io_relstr("port_name", buffer, depth, &info->port_name))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Parse a PORT_INFO_2 structure.
-********************************************************************/  
-
-bool smb_io_port_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth)
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_port_2");
-       depth++;
-
-       buffer->struct_start=prs_offset(ps);
-
-       if(!smb_io_relstr("port_name", buffer, depth, &info->port_name))
-               return False;
-       if(!smb_io_relstr("monitor_name", buffer, depth, &info->monitor_name))
-               return False;
-       if(!smb_io_relstr("description", buffer, depth, &info->description))
-               return False;
-       if(!prs_uint32("port_type", ps, depth, &info->port_type))
-               return False;
-       if(!prs_uint32("reserved", ps, depth, &info->reserved))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/  
-
-bool smb_io_printprocessor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth)
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_printprocessor_info_1");
-       depth++;        
-
-       buffer->struct_start=prs_offset(ps);
-       
-       if (smb_io_relstr("name", buffer, depth, &info->name))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/  
-
-bool smb_io_printprocdatatype_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth)
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_printprocdatatype_info_1");
-       depth++;        
-
-       buffer->struct_start=prs_offset(ps);
-       
-       if (smb_io_relstr("name", buffer, depth, &info->name))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/  
-
-bool smb_io_printmonitor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_1 *info, int depth)
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_printmonitor_info_1");
-       depth++;        
-
-       buffer->struct_start=prs_offset(ps);
-
-       if (!smb_io_relstr("name", buffer, depth, &info->name))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/  
-
-bool smb_io_printmonitor_info_2(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_2 *info, int depth)
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_printmonitor_info_2");
-       depth++;        
-
-       buffer->struct_start=prs_offset(ps);
-
-       if (!smb_io_relstr("name", buffer, depth, &info->name))
-               return False;
-       if (!smb_io_relstr("environment", buffer, depth, &info->environment))
-               return False;
-       if (!smb_io_relstr("dll_name", buffer, depth, &info->dll_name))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-
-uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info)
-{
-       int size=0;
-       
-       size+=size_of_relative_string( &info->printername );
-       size+=size_of_relative_string( &info->servername );
-
-       size+=size_of_uint32( &info->cjobs);
-       size+=size_of_uint32( &info->total_jobs);
-       size+=size_of_uint32( &info->total_bytes);
-
-       size+=size_of_uint16( &info->year);
-       size+=size_of_uint16( &info->month);
-       size+=size_of_uint16( &info->dayofweek);
-       size+=size_of_uint16( &info->day);
-       size+=size_of_uint16( &info->hour);
-       size+=size_of_uint16( &info->minute);
-       size+=size_of_uint16( &info->second);
-       size+=size_of_uint16( &info->milliseconds);
-
-       size+=size_of_uint32( &info->global_counter);
-       size+=size_of_uint32( &info->total_pages);
-
-       size+=size_of_uint16( &info->major_version);
-       size+=size_of_uint16( &info->build_version);
-
-       size+=size_of_uint32( &info->unknown7);
-       size+=size_of_uint32( &info->unknown8);
-       size+=size_of_uint32( &info->unknown9);
-       size+=size_of_uint32( &info->session_counter);
-       size+=size_of_uint32( &info->unknown11);
-       size+=size_of_uint32( &info->printer_errors);
-       size+=size_of_uint32( &info->unknown13);
-       size+=size_of_uint32( &info->unknown14);
-       size+=size_of_uint32( &info->unknown15);
-       size+=size_of_uint32( &info->unknown16);
-       size+=size_of_uint32( &info->change_id);
-       size+=size_of_uint32( &info->unknown18);
-       size+=size_of_uint32( &info->status);
-       size+=size_of_uint32( &info->unknown20);
-       size+=size_of_uint32( &info->c_setprinter);
-       
-       size+=size_of_uint16( &info->unknown22);
-       size+=size_of_uint16( &info->unknown23);
-       size+=size_of_uint16( &info->unknown24);
-       size+=size_of_uint16( &info->unknown25);
-       size+=size_of_uint16( &info->unknown26);
-       size+=size_of_uint16( &info->unknown27);
-       size+=size_of_uint16( &info->unknown28);
-       size+=size_of_uint16( &info->unknown29);
-       
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-
-uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info)
-{
-       int size=0;
-               
-       size+=size_of_uint32( &info->flags );   
-       size+=size_of_relative_string( &info->description );
-       size+=size_of_relative_string( &info->name );
-       size+=size_of_relative_string( &info->comment );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/
-
-uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info)
-{
-       uint32 size=0;
-               
-       size += 4;
-       
-       size += ndr_size_security_descriptor( info->secdesc, NULL, 0 );
-
-       size+=size_of_device_mode( info->devmode );
-       
-       size+=size_of_relative_string( &info->servername );
-       size+=size_of_relative_string( &info->printername );
-       size+=size_of_relative_string( &info->sharename );
-       size+=size_of_relative_string( &info->portname );
-       size+=size_of_relative_string( &info->drivername );
-       size+=size_of_relative_string( &info->comment );
-       size+=size_of_relative_string( &info->location );
-       
-       size+=size_of_relative_string( &info->sepfile );
-       size+=size_of_relative_string( &info->printprocessor );
-       size+=size_of_relative_string( &info->datatype );
-       size+=size_of_relative_string( &info->parameters );
-
-       size+=size_of_uint32( &info->attributes );
-       size+=size_of_uint32( &info->priority );
-       size+=size_of_uint32( &info->defaultpriority );
-       size+=size_of_uint32( &info->starttime );
-       size+=size_of_uint32( &info->untiltime );
-       size+=size_of_uint32( &info->status );
-       size+=size_of_uint32( &info->cjobs );
-       size+=size_of_uint32( &info->averageppm );      
-               
-       /* 
-        * add any adjustments for alignment.  This is
-        * not optimal since we could be calling this
-        * function from a loop (e.g. enumprinters), but 
-        * it is easier to maintain the calculation here and
-        * not place the burden on the caller to remember.   --jerry
-        */
-       if ((size % 4) != 0)
-               size += 4 - (size % 4);
-       
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/
-
-uint32 spoolss_size_printer_info_4(PRINTER_INFO_4 *info)
-{
-       uint32 size=0;
-               
-       size+=size_of_relative_string( &info->printername );
-       size+=size_of_relative_string( &info->servername );
-
-       size+=size_of_uint32( &info->attributes );
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/
-
-uint32 spoolss_size_printer_info_5(PRINTER_INFO_5 *info)
-{
-       uint32 size=0;
-               
-       size+=size_of_relative_string( &info->printername );
-       size+=size_of_relative_string( &info->portname );
-
-       size+=size_of_uint32( &info->attributes );
-       size+=size_of_uint32( &info->device_not_selected_timeout );
-       size+=size_of_uint32( &info->transmission_retry_timeout );
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/
-
-uint32 spoolss_size_printer_info_6(PRINTER_INFO_6 *info)
-{
-       return sizeof(uint32);
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/
-
-uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info)
-{
-       /* The 8 is for the self relative pointer - 8 byte aligned.. */
-       return 8 + (uint32)ndr_size_security_descriptor( info->secdesc, NULL, 0 );
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/
-
-uint32 spoolss_size_printer_info_7(PRINTER_INFO_7 *info)
-{
-       uint32 size=0;
-               
-       size+=size_of_relative_string( &info->guid );
-       size+=size_of_uint32( &info->action );
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/
-
-uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info)
-{
-       int size=0;
-       size+=size_of_relative_string( &info->name );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/
-
-uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info)
-{
-       int size=0;
-       size+=size_of_uint32( &info->version ); 
-       size+=size_of_relative_string( &info->name );
-       size+=size_of_relative_string( &info->architecture );
-       size+=size_of_relative_string( &info->driverpath );
-       size+=size_of_relative_string( &info->datafile );
-       size+=size_of_relative_string( &info->configfile );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a string array.
-********************************************************************/
-
-uint32 spoolss_size_string_array(uint16 *string)
-{
-       uint32 i = 0;
-
-       if (string) {
-               for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++);
-       }
-       i=i+2; /* to count all chars including the leading zero */
-       i=2*i; /* because we need the value in bytes */
-       i=i+4; /* the offset pointer size */
-
-       return i;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/
-
-uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info)
-{
-       int size=0;
-
-       size+=size_of_uint32( &info->version ); 
-       size+=size_of_relative_string( &info->name );
-       size+=size_of_relative_string( &info->architecture );
-       size+=size_of_relative_string( &info->driverpath );
-       size+=size_of_relative_string( &info->datafile );
-       size+=size_of_relative_string( &info->configfile );
-       size+=size_of_relative_string( &info->helpfile );
-       size+=size_of_relative_string( &info->monitorname );
-       size+=size_of_relative_string( &info->defaultdatatype );
-       
-       size+=spoolss_size_string_array(info->dependentfiles);
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/
-
-uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info)
-{
-       uint32 size=0;
-
-       size+=size_of_uint32( &info->version ); 
-       size+=size_of_relative_string( &info->name );
-       size+=size_of_relative_string( &info->architecture );
-       size+=size_of_relative_string( &info->driverpath );
-       size+=size_of_relative_string( &info->datafile );
-       size+=size_of_relative_string( &info->configfile );
-       size+=size_of_relative_string( &info->helpfile );
-
-       size+=spoolss_size_string_array(info->dependentfiles);
-
-       size+=size_of_relative_string( &info->monitorname );
-       size+=size_of_relative_string( &info->defaultdatatype );
-       
-       size+=spoolss_size_string_array(info->previousdrivernames);
-
-       size+=size_of_nttime(&info->driver_date);
-       size+=size_of_uint32( &info->padding ); 
-       size+=size_of_uint32( &info->driver_version_low );      
-       size+=size_of_uint32( &info->driver_version_high );     
-       size+=size_of_relative_string( &info->mfgname );
-       size+=size_of_relative_string( &info->oem_url );
-       size+=size_of_relative_string( &info->hardware_id );
-       size+=size_of_relative_string( &info->provider );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-
-uint32 spoolss_size_job_info_1(JOB_INFO_1 *info)
-{
-       int size=0;
-       size+=size_of_uint32( &info->jobid );
-       size+=size_of_relative_string( &info->printername );
-       size+=size_of_relative_string( &info->machinename );
-       size+=size_of_relative_string( &info->username );
-       size+=size_of_relative_string( &info->document );
-       size+=size_of_relative_string( &info->datatype );
-       size+=size_of_relative_string( &info->text_status );
-       size+=size_of_uint32( &info->status );
-       size+=size_of_uint32( &info->priority );
-       size+=size_of_uint32( &info->position );
-       size+=size_of_uint32( &info->totalpages );
-       size+=size_of_uint32( &info->pagesprinted );
-       size+=size_of_systemtime( &info->submitted );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-
-uint32 spoolss_size_job_info_2(JOB_INFO_2 *info)
-{
-       int size=0;
-
-       size+=4; /* size of sec desc ptr */
-
-       size+=size_of_uint32( &info->jobid );
-       size+=size_of_relative_string( &info->printername );
-       size+=size_of_relative_string( &info->machinename );
-       size+=size_of_relative_string( &info->username );
-       size+=size_of_relative_string( &info->document );
-       size+=size_of_relative_string( &info->notifyname );
-       size+=size_of_relative_string( &info->datatype );
-       size+=size_of_relative_string( &info->printprocessor );
-       size+=size_of_relative_string( &info->parameters );
-       size+=size_of_relative_string( &info->drivername );
-       size+=size_of_device_mode( info->devmode );
-       size+=size_of_relative_string( &info->text_status );
-/*     SEC_DESC sec_desc;*/
-       size+=size_of_uint32( &info->status );
-       size+=size_of_uint32( &info->priority );
-       size+=size_of_uint32( &info->position );
-       size+=size_of_uint32( &info->starttime );
-       size+=size_of_uint32( &info->untiltime );
-       size+=size_of_uint32( &info->totalpages );
-       size+=size_of_uint32( &info->size );
-       size+=size_of_systemtime( &info->submitted );
-       size+=size_of_uint32( &info->timeelapsed );
-       size+=size_of_uint32( &info->pagesprinted );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/
-
-uint32 spoolss_size_form_1(FORM_1 *info)
-{
-       int size=0;
-
-       size+=size_of_uint32( &info->flag );
-       size+=size_of_relative_string( &info->name );
-       size+=size_of_uint32( &info->width );
-       size+=size_of_uint32( &info->length );
-       size+=size_of_uint32( &info->left );
-       size+=size_of_uint32( &info->top );
-       size+=size_of_uint32( &info->right );
-       size+=size_of_uint32( &info->bottom );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-
-uint32 spoolss_size_port_info_1(PORT_INFO_1 *info)
-{
-       int size=0;
-
-       size+=size_of_relative_string( &info->port_name );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-
-uint32 spoolss_size_printprocessordirectory_info_1(PRINTPROCESSOR_DIRECTORY_1 *info)
-{
-       int size=0;
-
-       size=str_len_uni(&info->name);  /* the string length       */
-       size=size+1;                    /* add the leading zero    */
-       size=size*2;                    /* convert in char         */
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-
-uint32 spoolss_size_port_info_2(PORT_INFO_2 *info)
-{
-       int size=0;
-
-       size+=size_of_relative_string( &info->port_name );
-       size+=size_of_relative_string( &info->monitor_name );
-       size+=size_of_relative_string( &info->description );
-
-       size+=size_of_uint32( &info->port_type );
-       size+=size_of_uint32( &info->reserved );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-
-uint32 spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1 *info)
-{
-       int size=0;
-       size+=size_of_relative_string( &info->name );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-
-uint32 spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1 *info)
-{
-       int size=0;
-       size+=size_of_relative_string( &info->name );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p)
-{
-       uint32  size = 0; 
-       
-       if (!p)
-               return 0;
-       
-       /* uint32(offset) + uint32(length) + length) */
-       size += (size_of_uint32(&p->value_len)*2) + p->value_len;
-       size += (size_of_uint32(&p->data_len)*2) + p->data_len + (p->data_len%2) ;
-       
-       size += size_of_uint32(&p->type);
-                      
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-
-uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info)
-{
-       int size=0;
-       size+=size_of_relative_string( &info->name );
-
-       return size;
-}
-
-/*******************************************************************
-return the size required by a struct in the stream
-********************************************************************/  
-
-uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info)
-{
-       int size=0;
-       size+=size_of_relative_string( &info->name);
-       size+=size_of_relative_string( &info->environment);
-       size+=size_of_relative_string( &info->dll_name);
-
-       return size;
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, 
-                              const POLICY_HND *hnd,
-                              const fstring architecture,
-                              uint32 level, uint32 clientmajor, uint32 clientminor,
-                              RPC_BUFFER *buffer, uint32 offered)
-{      
-       if (q_u == NULL)
-               return False;
-
-       memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
-
-       init_buf_unistr2(&q_u->architecture, &q_u->architecture_ptr, architecture);
-
-       q_u->level=level;
-       q_u->clientmajorversion=clientmajor;
-       q_u->clientminorversion=clientminor;
-
-       q_u->buffer=buffer;
-       q_u->offered=offered;
-
-       return True;
-}
-
-/*******************************************************************
- * read a structure.
- * called from spoolss_getprinterdriver2 (srv_spoolss.c)
- ********************************************************************/
-
-bool spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriver2");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-       
-       if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth))
-               return False;
-       if(!prs_uint32("architecture_ptr", ps, depth, &q_u->architecture_ptr))
-               return False;
-       if(!smb_io_unistr2("architecture", &q_u->architecture, q_u->architecture_ptr, ps, depth))
-               return False;
-       
-       if(!prs_align(ps))
-               return False;
-       if(!prs_uint32("level", ps, depth, &q_u->level))
-               return False;
-               
-       if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
-               return False;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("offered", ps, depth, &q_u->offered))
-               return False;
-               
-       if(!prs_uint32("clientmajorversion", ps, depth, &q_u->clientmajorversion))
-               return False;
-       if(!prs_uint32("clientminorversion", ps, depth, &q_u->clientminorversion))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- * read a structure.
- * called from spoolss_getprinterdriver2 (srv_spoolss.c)
- ********************************************************************/
-
-bool spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriver2");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("needed", ps, depth, &r_u->needed))
-               return False;
-       if (!prs_uint32("servermajorversion", ps, depth, &r_u->servermajorversion))
-               return False;
-       if (!prs_uint32("serverminorversion", ps, depth, &r_u->serverminorversion))
-               return False;           
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;            
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_enumprinters(
-       SPOOL_Q_ENUMPRINTERS *q_u, 
-       uint32 flags, 
-       char *servername, 
-       uint32 level, 
-       RPC_BUFFER *buffer, 
-       uint32 offered
-)
-{
-       q_u->flags=flags;
-       
-       q_u->servername_ptr = (servername != NULL) ? 1 : 0;
-       init_buf_unistr2(&q_u->servername, &q_u->servername_ptr, servername);
-
-       q_u->level=level;
-       q_u->buffer=buffer;
-       q_u->offered=offered;
-
-       return True;
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, 
-                               fstring servername, uint32 level, 
-                               RPC_BUFFER *buffer, uint32 offered)
-{
-       q_u->name_ptr = (servername != NULL) ? 1 : 0;
-       init_buf_unistr2(&q_u->name, &q_u->name_ptr, servername);
-
-       q_u->level=level;
-       q_u->buffer=buffer;
-       q_u->offered=offered;
-
-       return True;
-}
-
-/*******************************************************************
- * read a structure.
- * called from spoolss_enumprinters (srv_spoolss.c)
- ********************************************************************/
-
-bool spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("flags", ps, depth, &q_u->flags))
-               return False;
-       if (!prs_uint32("servername_ptr", ps, depth, &q_u->servername_ptr))
-               return False;
-
-       if (!smb_io_unistr2("", &q_u->servername, q_u->servername_ptr, ps, depth))
-               return False;
-               
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("level", ps, depth, &q_u->level))
-               return False;
-
-       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("offered", ps, depth, &q_u->offered))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Parse a SPOOL_R_ENUMPRINTERS structure.
- ********************************************************************/
-
-bool spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spoolss_io_r_enumprinters");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_uint32("needed", ps, depth, &r_u->needed))
-               return False;
-               
-       if (!prs_uint32("returned", ps, depth, &r_u->returned))
-               return False;
-               
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;            
-}
-
-/*******************************************************************
- * write a structure.
- * called from spoolss_r_enum_printers (srv_spoolss.c)
- *
- ********************************************************************/
-
-bool spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth)
-{      
-       prs_debug(ps, depth, desc, "spoolss_io_r_getprinter");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("needed", ps, depth, &r_u->needed))
-               return False;
-               
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;            
-}
-
-/*******************************************************************
- * read a structure.
- * called from spoolss_getprinter (srv_spoolss.c)
- ********************************************************************/
-
-bool spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spoolss_io_q_getprinter");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth))
-               return False;
-       if (!prs_uint32("level", ps, depth, &q_u->level))
-               return False;
-
-       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("offered", ps, depth, &q_u->offered))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_getprinter(
-       TALLOC_CTX *mem_ctx,
-       SPOOL_Q_GETPRINTER *q_u, 
-       const POLICY_HND *hnd, 
-       uint32 level, 
-       RPC_BUFFER *buffer, 
-       uint32 offered
-)
-{
-       if (q_u == NULL)
-       {
-               return False;
-       }
-       memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
-
-       q_u->level=level;
-       q_u->buffer=buffer;
-       q_u->offered=offered;
-
-       return True;
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-bool make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, 
-                               const POLICY_HND *hnd, uint32 level, PRINTER_INFO_CTR *info, 
-                               uint32 command)
-{
-       SEC_DESC *secdesc;
-       DEVICEMODE *devmode;
-
-       if (!q_u || !info)
-               return False;
-       
-       memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
-
-       q_u->level = level;
-       q_u->info.level = level;
-       q_u->info.info_ptr = 1; /* Info is != NULL, see above */
-       switch (level) {
-
-         /* There's no such thing as a setprinter level 1 */
-
-       case 2:
-               secdesc = info->printers_2->secdesc;
-               devmode = info->printers_2->devmode;
-               
-               make_spoolss_printer_info_2 (mem_ctx, &q_u->info.info_2, info->printers_2);
-#if 1  /* JERRY TEST */
-               q_u->secdesc_ctr = SMB_MALLOC_P(SEC_DESC_BUF);
-               if (!q_u->secdesc_ctr)
-                       return False;
-               q_u->secdesc_ctr->sd = secdesc;
-               q_u->secdesc_ctr->sd_size = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0;
-
-               q_u->devmode_ctr.devmode_ptr = (devmode != NULL) ? 1 : 0;
-               q_u->devmode_ctr.size = (devmode != NULL) ? sizeof(DEVICEMODE) + (3*sizeof(uint32)) : 0;
-               q_u->devmode_ctr.devmode = devmode;
-#else
-               q_u->secdesc_ctr = NULL;
-       
-               q_u->devmode_ctr.devmode_ptr = 0;
-               q_u->devmode_ctr.size = 0;
-               q_u->devmode_ctr.devmode = NULL;
-#endif
-               break;
-       case 3:
-               secdesc = info->printers_3->secdesc;
-               
-               make_spoolss_printer_info_3 (mem_ctx, &q_u->info.info_3, info->printers_3);
-               
-               q_u->secdesc_ctr = SMB_MALLOC_P(SEC_DESC_BUF);
-               if (!q_u->secdesc_ctr)
-                       return False;
-               q_u->secdesc_ctr->sd_size = (secdesc) ? sizeof(SEC_DESC) + (2*sizeof(uint32)) : 0;
-               q_u->secdesc_ctr->sd = secdesc;
-
-               break;
-       case 7:
-               make_spoolss_printer_info_7 (mem_ctx, &q_u->info.info_7, info->printers_7);
-               break;
-
-       default: 
-               DEBUG(0,("make_spoolss_q_setprinter: Unknown info level [%d]\n", level));
-                       break;
-       }
-
-       
-       q_u->command = command;
-
-       return True;
-}
-
-
-/*******************************************************************
-********************************************************************/  
-
-bool spoolss_io_r_setprinter(const char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth)
-{              
-       prs_debug(ps, depth, desc, "spoolss_io_r_setprinter");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-       
-       if(!prs_werror("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- Marshall/unmarshall a SPOOL_Q_SETPRINTER struct.
-********************************************************************/  
-
-bool spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth)
-{
-       uint32 ptr_sec_desc = 0;
-
-       prs_debug(ps, depth, desc, "spoolss_io_q_setprinter");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("printer handle", &q_u->handle ,ps, depth))
-               return False;
-       if(!prs_uint32("level", ps, depth, &q_u->level))
-               return False;
-       
-       /* check for supported levels and structures we know about */
-               
-       switch ( q_u->level ) {
-               case 0:
-               case 2:
-               case 3:
-               case 7:
-                       /* supported levels */
-                       break;
-               default:
-                       DEBUG(0,("spoolss_io_q_setprinter: unsupported printer info level [%d]\n", 
-                               q_u->level));
-                       return True;
-       }
-                       
-
-       if(!spool_io_printer_info_level("", &q_u->info, ps, depth))
-               return False;
-
-       if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth))
-               return False;
-       
-       if(!prs_align(ps))
-               return False;
-
-       switch (q_u->level)
-       {
-               case 2:
-               {
-                       ptr_sec_desc = q_u->info.info_2->secdesc_ptr;
-                       break;
-               }
-               case 3:
-               {
-                       /* FIXME ! Our parsing here is wrong I think,
-                        * but for a level3 it makes no sense for
-                        * ptr_sec_desc to be NULL. JRA. Based on
-                        * a Vista sniff from Martin Zielinski <mz@seh.de>.
-                        */
-                       if (UNMARSHALLING(ps)) {
-                               ptr_sec_desc = 1;
-                       } else {
-                               ptr_sec_desc = q_u->info.info_3->secdesc_ptr;
-                       }
-                       break;
-               }
-       }
-       if (ptr_sec_desc)
-       {
-               if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth))
-                       return False;
-       } else {
-               uint32 dummy = 0;
-
-               /* Parse a NULL security descriptor.  This should really
-                  happen inside the sec_io_desc_buf() function. */
-
-               prs_debug(ps, depth, "", "sec_io_desc_buf");
-               if (!prs_uint32("size", ps, depth + 1, &dummy))
-                       return False;
-               if (!prs_uint32("ptr", ps, depth + 1, &dummy))
-                       return False;
-       }
-       
-       if(!prs_uint32("command", ps, depth, &q_u->command))
-               return False;
-
-       return True;
+       uint32 size=0;
+               
+       size+=size_of_relative_string( &info->guid );
+       size+=size_of_uint32( &info->action );
+       return size;
 }
 
 /*******************************************************************
-********************************************************************/  
-
-bool spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth)
-{              
-       prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
-               return False;
+return the size required by a struct in the stream
+********************************************************************/
 
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_uint32("needed", ps, depth, &r_u->needed))
-               return False;
-               
-       if (!prs_uint32("returned", ps, depth, &r_u->returned))
-               return False;
-               
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
+uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info)
+{
+       int size=0;
+       size+=size_of_relative_string( &info->name );
 
-       return True;            
+       return size;
 }
 
 /*******************************************************************
-********************************************************************/  
+return the size required by a struct in the stream
+********************************************************************/
 
-bool make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd,
-                               uint32 firstjob,
-                               uint32 numofjobs,
-                               uint32 level,
-                               RPC_BUFFER *buffer,
-                               uint32 offered)
+uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info)
 {
-       if (q_u == NULL)
-       {
-               return False;
-       }
-       memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
-       q_u->firstjob = firstjob;
-       q_u->numofjobs = numofjobs;
-       q_u->level = level;
-       q_u->buffer= buffer;
-       q_u->offered = offered;
-       return True;
+       int size=0;
+       size+=size_of_uint32( &info->version ); 
+       size+=size_of_relative_string( &info->name );
+       size+=size_of_relative_string( &info->architecture );
+       size+=size_of_relative_string( &info->driverpath );
+       size+=size_of_relative_string( &info->datafile );
+       size+=size_of_relative_string( &info->configfile );
+
+       return size;
 }
 
 /*******************************************************************
-********************************************************************/  
+return the size required by a string array.
+********************************************************************/
 
-bool spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth)
+uint32 spoolss_size_string_array(uint16 *string)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_q_enumjobs");
-       depth++;
+       uint32 i = 0;
 
-       if (!prs_align(ps))
-               return False;
+       if (string) {
+               for (i=0; (string[i]!=0x0000) || (string[i+1]!=0x0000); i++);
+       }
+       i=i+2; /* to count all chars including the leading zero */
+       i=2*i; /* because we need the value in bytes */
+       i=i+4; /* the offset pointer size */
 
-       if (!smb_io_pol_hnd("printer handle",&q_u->handle, ps, depth))
-               return False;
-               
-       if (!prs_uint32("firstjob", ps, depth, &q_u->firstjob))
-               return False;
-       if (!prs_uint32("numofjobs", ps, depth, &q_u->numofjobs))
-               return False;
-       if (!prs_uint32("level", ps, depth, &q_u->level))
-               return False;
+       return i;
+}
 
-       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
-               return False;   
+/*******************************************************************
+return the size required by a struct in the stream
+********************************************************************/
 
-       if(!prs_align(ps))
-               return False;
+uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info)
+{
+       int size=0;
 
-       if (!prs_uint32("offered", ps, depth, &q_u->offered))
-               return False;
+       size+=size_of_uint32( &info->version ); 
+       size+=size_of_relative_string( &info->name );
+       size+=size_of_relative_string( &info->architecture );
+       size+=size_of_relative_string( &info->driverpath );
+       size+=size_of_relative_string( &info->datafile );
+       size+=size_of_relative_string( &info->configfile );
+       size+=size_of_relative_string( &info->helpfile );
+       size+=size_of_relative_string( &info->monitorname );
+       size+=size_of_relative_string( &info->defaultdatatype );
+       
+       size+=spoolss_size_string_array(info->dependentfiles);
 
-       return True;
+       return size;
 }
 
 /*******************************************************************
- Parse a SPOOL_R_ENUMPRINTERDRIVERS structure.
-********************************************************************/  
+return the size required by a struct in the stream
+********************************************************************/
 
-bool spoolss_io_r_enumprinterdrivers(const char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth)
+uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdrivers");
-       depth++;
+       uint32 size=0;
 
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
-               return False;
+       size+=size_of_uint32( &info->version ); 
+       size+=size_of_relative_string( &info->name );
+       size+=size_of_relative_string( &info->architecture );
+       size+=size_of_relative_string( &info->driverpath );
+       size+=size_of_relative_string( &info->datafile );
+       size+=size_of_relative_string( &info->configfile );
+       size+=size_of_relative_string( &info->helpfile );
 
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_uint32("needed", ps, depth, &r_u->needed))
-               return False;
-               
-       if (!prs_uint32("returned", ps, depth, &r_u->returned))
-               return False;
-               
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
+       size+=spoolss_size_string_array(info->dependentfiles);
 
-       return True;            
+       size+=size_of_relative_string( &info->monitorname );
+       size+=size_of_relative_string( &info->defaultdatatype );
+       
+       size+=spoolss_size_string_array(info->previousdrivernames);
+
+       size+=size_of_nttime(&info->driver_date);
+       size+=size_of_uint32( &info->padding ); 
+       size+=size_of_uint32( &info->driver_version_low );      
+       size+=size_of_uint32( &info->driver_version_high );     
+       size+=size_of_relative_string( &info->mfgname );
+       size+=size_of_relative_string( &info->oem_url );
+       size+=size_of_relative_string( &info->hardware_id );
+       size+=size_of_relative_string( &info->provider );
+
+       return size;
 }
 
 /*******************************************************************
- * init a structure.
- ********************************************************************/
+return the size required by a struct in the stream
+********************************************************************/  
 
-bool make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u,
-                                const char *name,
-                                const char *environment,
-                                uint32 level,
-                                RPC_BUFFER *buffer, uint32 offered)
+uint32 spoolss_size_job_info_1(JOB_INFO_1 *info)
 {
-        init_buf_unistr2(&q_u->name, &q_u->name_ptr, name);
-        init_buf_unistr2(&q_u->environment, &q_u->environment_ptr, environment);
-
-        q_u->level=level;
-        q_u->buffer=buffer;
-        q_u->offered=offered;
+       int size=0;
+       size+=size_of_uint32( &info->jobid );
+       size+=size_of_relative_string( &info->printername );
+       size+=size_of_relative_string( &info->machinename );
+       size+=size_of_relative_string( &info->username );
+       size+=size_of_relative_string( &info->document );
+       size+=size_of_relative_string( &info->datatype );
+       size+=size_of_relative_string( &info->text_status );
+       size+=size_of_uint32( &info->status );
+       size+=size_of_uint32( &info->priority );
+       size+=size_of_uint32( &info->position );
+       size+=size_of_uint32( &info->totalpages );
+       size+=size_of_uint32( &info->pagesprinted );
+       size+=size_of_systemtime( &info->submitted );
 
-        return True;
+       return size;
 }
 
 /*******************************************************************
- Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure.
+return the size required by a struct in the stream
 ********************************************************************/  
 
-bool spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth)
+uint32 spoolss_size_job_info_2(JOB_INFO_2 *info)
 {
+       int size=0;
 
-       prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdrivers");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_uint32("name_ptr", ps, depth, &q_u->name_ptr))
-               return False;
-       if (!smb_io_unistr2("", &q_u->name, q_u->name_ptr,ps, depth))
-               return False;
-               
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("environment_ptr", ps, depth, &q_u->environment_ptr))
-               return False;
-       if (!smb_io_unistr2("", &q_u->environment, q_u->environment_ptr, ps, depth))
-               return False;
-               
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("level", ps, depth, &q_u->level))
-               return False;
-               
-       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
-               return False;
+       size+=4; /* size of sec desc ptr */
 
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_uint32("offered", ps, depth, &q_u->offered))
-               return False;
+       size+=size_of_uint32( &info->jobid );
+       size+=size_of_relative_string( &info->printername );
+       size+=size_of_relative_string( &info->machinename );
+       size+=size_of_relative_string( &info->username );
+       size+=size_of_relative_string( &info->document );
+       size+=size_of_relative_string( &info->notifyname );
+       size+=size_of_relative_string( &info->datatype );
+       size+=size_of_relative_string( &info->printprocessor );
+       size+=size_of_relative_string( &info->parameters );
+       size+=size_of_relative_string( &info->drivername );
+       size+=size_of_device_mode( info->devmode );
+       size+=size_of_relative_string( &info->text_status );
+/*     SEC_DESC sec_desc;*/
+       size+=size_of_uint32( &info->status );
+       size+=size_of_uint32( &info->priority );
+       size+=size_of_uint32( &info->position );
+       size+=size_of_uint32( &info->starttime );
+       size+=size_of_uint32( &info->untiltime );
+       size+=size_of_uint32( &info->totalpages );
+       size+=size_of_uint32( &info->size );
+       size+=size_of_systemtime( &info->submitted );
+       size+=size_of_uint32( &info->timeelapsed );
+       size+=size_of_uint32( &info->pagesprinted );
 
-       return True;
+       return size;
 }
 
 /*******************************************************************
-********************************************************************/  
+return the size required by a struct in the stream
+********************************************************************/
 
-bool spoolss_io_q_enumforms(const char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth)
+uint32 spoolss_size_form_1(FORM_1 *info)
 {
+       int size=0;
 
-       prs_debug(ps, depth, desc, "spoolss_io_q_enumforms");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;                   
-       if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
-               return False;           
-       if (!prs_uint32("level", ps, depth, &q_u->level))
-               return False;   
-       
-       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("offered", ps, depth, &q_u->offered))
-               return False;
+       size+=size_of_uint32( &info->flag );
+       size+=size_of_relative_string( &info->name );
+       size+=size_of_uint32( &info->width );
+       size+=size_of_uint32( &info->length );
+       size+=size_of_uint32( &info->left );
+       size+=size_of_uint32( &info->top );
+       size+=size_of_uint32( &info->right );
+       size+=size_of_uint32( &info->bottom );
 
-       return True;
+       return size;
 }
 
 /*******************************************************************
+return the size required by a struct in the stream
 ********************************************************************/  
 
-bool spoolss_io_r_enumforms(const char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth)
+uint32 spoolss_size_port_info_1(PORT_INFO_1 *info)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_r_enumforms");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
-               return False;
+       int size=0;
 
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_uint32("size of buffer needed", ps, depth, &r_u->needed))
-               return False;
-               
-       if (!prs_uint32("numofforms", ps, depth, &r_u->numofforms))
-               return False;
-               
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
+       size+=size_of_relative_string( &info->port_name );
 
-       return True;
+       return size;
 }
 
 /*******************************************************************
- Parse a SPOOL_R_ENUMPORTS structure.
+return the size required by a struct in the stream
 ********************************************************************/  
 
-bool spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth)
+uint32 spoolss_size_port_info_2(PORT_INFO_2 *info)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_r_enumports");
-       depth++;
+       int size=0;
 
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
-               return False;
+       size+=size_of_relative_string( &info->port_name );
+       size+=size_of_relative_string( &info->monitor_name );
+       size+=size_of_relative_string( &info->description );
 
-       if (!prs_align(ps))
-               return False;
-               
-       if (!prs_uint32("needed", ps, depth, &r_u->needed))
-               return False;
-               
-       if (!prs_uint32("returned", ps, depth, &r_u->returned))
-               return False;
-               
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
+       size+=size_of_uint32( &info->port_type );
+       size+=size_of_uint32( &info->reserved );
 
-       return True;            
+       return size;
 }
 
 /*******************************************************************
+return the size required by a struct in the stream
 ********************************************************************/  
 
-bool spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth)
+uint32 spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1 *info)
 {
-       prs_debug(ps, depth, desc, "");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("", ps, depth, &q_u->name_ptr))
-               return False;
-       if (!smb_io_unistr2("", &q_u->name,True,ps,depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("level", ps, depth, &q_u->level))
-               return False;
-               
-       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-       if (!prs_uint32("offered", ps, depth, &q_u->offered))
-               return False;
+       int size=0;
+       size+=size_of_relative_string( &info->name );
 
-       return True;
+       return size;
 }
 
 /*******************************************************************
- Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure.
+return the size required by a struct in the stream
 ********************************************************************/  
 
-bool spool_io_printer_info_level_1(const char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth)
-{      
-       prs_debug(ps, depth, desc, "spool_io_printer_info_level_1");
-       depth++;
-               
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("flags", ps, depth, &il->flags))
-               return False;
-       if(!prs_uint32("description_ptr", ps, depth, &il->description_ptr))
-               return False;
-       if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr))
-               return False;
-       if(!prs_uint32("comment_ptr", ps, depth, &il->comment_ptr))
-               return False;
-               
-       if(!smb_io_unistr2("description", &il->description, il->description_ptr, ps, depth))
-               return False;
-       if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth))
-               return False;
-       if(!smb_io_unistr2("comment", &il->comment, il->comment_ptr, ps, depth))
-               return False;
+uint32 spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1 *info)
+{
+       int size=0;
+       size+=size_of_relative_string( &info->name );
 
-       return True;
+       return size;
 }
 
 /*******************************************************************
- Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure.
+return the size required by a struct in the stream
 ********************************************************************/  
+uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p)
+{
+       uint32  size = 0; 
+       
+       if (!p)
+               return 0;
+       
+       /* uint32(offset) + uint32(length) + length) */
+       size += (size_of_uint32(&p->value_len)*2) + p->value_len;
+       size += (size_of_uint32(&p->data_len)*2) + p->data_len + (p->data_len%2) ;
+       
+       size += size_of_uint32(&p->type);
+                      
+       return size;
+}
 
-bool spool_io_printer_info_level_3(const char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth)
-{      
-       prs_debug(ps, depth, desc, "spool_io_printer_info_level_3");
-       depth++;
-               
-       if(!prs_align(ps))
-               return False;
+/*******************************************************************
+return the size required by a struct in the stream
+********************************************************************/  
 
-       if(!prs_uint32("secdesc_ptr", ps, depth, &il->secdesc_ptr))
-               return False;
+uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info)
+{
+       int size=0;
+       size+=size_of_relative_string( &info->name );
 
-       return True;
+       return size;
 }
 
 /*******************************************************************
- Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure.
+return the size required by a struct in the stream
 ********************************************************************/  
 
-bool spool_io_printer_info_level_2(const char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth)
-{      
-       prs_debug(ps, depth, desc, "spool_io_printer_info_level_2");
-       depth++;
-               
-       if(!prs_align(ps))
-               return False;
+uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info)
+{
+       int size=0;
+       size+=size_of_relative_string( &info->name);
+       size+=size_of_relative_string( &info->environment);
+       size+=size_of_relative_string( &info->dll_name);
 
-       if(!prs_uint32("servername_ptr", ps, depth, &il->servername_ptr))
-               return False;
-       if(!prs_uint32("printername_ptr", ps, depth, &il->printername_ptr))
-               return False;
-       if(!prs_uint32("sharename_ptr", ps, depth, &il->sharename_ptr))
-               return False;
-       if(!prs_uint32("portname_ptr", ps, depth, &il->portname_ptr))
-               return False;
+       return size;
+}
 
-       if(!prs_uint32("drivername_ptr", ps, depth, &il->drivername_ptr))
-               return False;
-       if(!prs_uint32("comment_ptr", ps, depth, &il->comment_ptr))
-               return False;
-       if(!prs_uint32("location_ptr", ps, depth, &il->location_ptr))
-               return False;
-       if(!prs_uint32("devmode_ptr", ps, depth, &il->devmode_ptr))
-               return False;
-       if(!prs_uint32("sepfile_ptr", ps, depth, &il->sepfile_ptr))
-               return False;
-       if(!prs_uint32("printprocessor_ptr", ps, depth, &il->printprocessor_ptr))
-               return False;
-       if(!prs_uint32("datatype_ptr", ps, depth, &il->datatype_ptr))
-               return False;
-       if(!prs_uint32("parameters_ptr", ps, depth, &il->parameters_ptr))
-               return False;
-       if(!prs_uint32("secdesc_ptr", ps, depth, &il->secdesc_ptr))
-               return False;
+/*******************************************************************
+ * read a structure.
+ * called from spoolss_getprinterdriver2 (srv_spoolss.c)
+ ********************************************************************/
 
-       if(!prs_uint32("attributes", ps, depth, &il->attributes))
-               return False;
-       if(!prs_uint32("priority", ps, depth, &il->priority))
-               return False;
-       if(!prs_uint32("default_priority", ps, depth, &il->default_priority))
-               return False;
-       if(!prs_uint32("starttime", ps, depth, &il->starttime))
-               return False;
-       if(!prs_uint32("untiltime", ps, depth, &il->untiltime))
-               return False;
-       if(!prs_uint32("status", ps, depth, &il->status))
-               return False;
-       if(!prs_uint32("cjobs", ps, depth, &il->cjobs))
-               return False;
-       if(!prs_uint32("averageppm", ps, depth, &il->averageppm))
-               return False;
+bool spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth)
+{
+       prs_debug(ps, depth, desc, "spoolss_io_q_getprinterdriver2");
+       depth++;
 
-       if(!smb_io_unistr2("servername", &il->servername, il->servername_ptr, ps, depth))
-               return False;
-       if(!smb_io_unistr2("printername", &il->printername, il->printername_ptr, ps, depth))
-               return False;
-       if(!smb_io_unistr2("sharename", &il->sharename, il->sharename_ptr, ps, depth))
-               return False;
-       if(!smb_io_unistr2("portname", &il->portname, il->portname_ptr, ps, depth))
-               return False;
-       if(!smb_io_unistr2("drivername", &il->drivername, il->drivername_ptr, ps, depth))
-               return False;
-       if(!smb_io_unistr2("comment", &il->comment, il->comment_ptr, ps, depth))
-               return False;
-       if(!smb_io_unistr2("location", &il->location, il->location_ptr, ps, depth))
-               return False;
-       if(!smb_io_unistr2("sepfile", &il->sepfile, il->sepfile_ptr, ps, depth))
+       if(!prs_align(ps))
                return False;
-       if(!smb_io_unistr2("printprocessor", &il->printprocessor, il->printprocessor_ptr, ps, depth))
+       
+       if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth))
                return False;
-       if(!smb_io_unistr2("datatype", &il->datatype, il->datatype_ptr, ps, depth))
+       if(!prs_uint32("architecture_ptr", ps, depth, &q_u->architecture_ptr))
                return False;
-       if(!smb_io_unistr2("parameters", &il->parameters, il->parameters_ptr, ps, depth))
+       if(!smb_io_unistr2("architecture", &q_u->architecture, q_u->architecture_ptr, ps, depth))
                return False;
-
-       return True;
-}
-
-bool spool_io_printer_info_level_7(const char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth)
-{      
-       prs_debug(ps, depth, desc, "spool_io_printer_info_level_7");
-       depth++;
-               
+       
        if(!prs_align(ps))
                return False;
-
-       if(!prs_uint32("guid_ptr", ps, depth, &il->guid_ptr))
+       if(!prs_uint32("level", ps, depth, &q_u->level))
                return False;
-       if(!prs_uint32("action", ps, depth, &il->action))
+               
+       if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
                return False;
 
-       if(!smb_io_unistr2("servername", &il->guid, il->guid_ptr, ps, depth))
+       if(!prs_align(ps))
                return False;
-       return True;
-}
-
-/*******************************************************************
-********************************************************************/  
 
-bool spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spool_io_printer_info_level");
-       depth++;
-
-       if(!prs_align(ps))
+       if(!prs_uint32("offered", ps, depth, &q_u->offered))
                return False;
-       if(!prs_uint32("level", ps, depth, &il->level))
+               
+       if(!prs_uint32("clientmajorversion", ps, depth, &q_u->clientmajorversion))
                return False;
-       if(!prs_uint32("info_ptr", ps, depth, &il->info_ptr))
+       if(!prs_uint32("clientminorversion", ps, depth, &q_u->clientminorversion))
                return False;
-       
-       /* if no struct inside just return */
-       if (il->info_ptr==0) {
-               if (UNMARSHALLING(ps)) {
-                       il->info_1=NULL;
-                       il->info_2=NULL;
-               }
-               return True;
-       }
-                       
-       switch (il->level) {
-               /*
-                * level 0 is used by setprinter when managing the queue
-                * (hold, stop, start a queue)
-                */
-               case 0:
-                       break;
-               /* DOCUMENT ME!!! What is level 1 used for? */
-               case 1:
-               {
-                       if (UNMARSHALLING(ps)) {
-                               if ((il->info_1=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_1,1)) == NULL)
-                                       return False;
-                       }
-                       if (!spool_io_printer_info_level_1("", il->info_1, ps, depth))
-                               return False;
-                       break;          
-               }
-               /* 
-                * level 2 is used by addprinter
-                * and by setprinter when updating printer's info
-                */     
-               case 2:
-                       if (UNMARSHALLING(ps)) {
-                               if ((il->info_2=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_2,1)) == NULL)
-                                       return False;
-                       }
-                       if (!spool_io_printer_info_level_2("", il->info_2, ps, depth))
-                               return False;
-                       break;          
-               /* DOCUMENT ME!!! What is level 3 used for? */
-               case 3:
-               {
-                       if (UNMARSHALLING(ps)) {
-                               if ((il->info_3=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_3,1)) == NULL)
-                                       return False;
-                       }
-                       if (!spool_io_printer_info_level_3("", il->info_3, ps, depth))
-                               return False;
-                       break;          
-               }
-               case 7:
-                       if (UNMARSHALLING(ps))
-                               if ((il->info_7=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_INFO_LEVEL_7,1)) == NULL)
-                                       return False;
-                       if (!spool_io_printer_info_level_7("", il->info_7, ps, depth))
-                               return False;
-                       break;
-       }
 
        return True;
 }
 
 /*******************************************************************
-********************************************************************/  
+ * read a structure.
+ * called from spoolss_getprinterdriver2 (srv_spoolss.c)
+ ********************************************************************/
 
-bool spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth)
+bool spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth)
 {
-       uint32 ptr_sec_desc = 0;
-
-       prs_debug(ps, depth, desc, "spoolss_io_q_addprinterex");
+       prs_debug(ps, depth, desc, "spoolss_io_r_getprinterdriver2");
        depth++;
 
-       if(!prs_align(ps))
-               return False;
-
-       if (!prs_io_unistr2_p("ptr", ps, depth, &q_u->server_name))
-               return False;
-       if (!prs_io_unistr2("servername", ps, depth, q_u->server_name))
+       if (!prs_align(ps))
                return False;
-
-       if(!prs_align(ps))
+               
+       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
                return False;
 
-       if(!prs_uint32("info_level", ps, depth, &q_u->level))
+       if (!prs_align(ps))
                return False;
-       
-       if(!spool_io_printer_info_level("", &q_u->info, ps, depth))
+       if (!prs_uint32("needed", ps, depth, &r_u->needed))
                return False;
-       
-       if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth))
+       if (!prs_uint32("servermajorversion", ps, depth, &r_u->servermajorversion))
                return False;
-
-       if(!prs_align(ps))
+       if (!prs_uint32("serverminorversion", ps, depth, &r_u->serverminorversion))
+               return False;           
+       if (!prs_werror("status", ps, depth, &r_u->status))
                return False;
 
-       switch (q_u->level) {
-               case 2:
-                       ptr_sec_desc = q_u->info.info_2->secdesc_ptr;
-                       break;
-               case 3:
-                       ptr_sec_desc = q_u->info.info_3->secdesc_ptr;
-                       break;
-       }
-       if (ptr_sec_desc) {
-               if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth))
-                       return False;
-       } else {
-               uint32 dummy = 0;
+       return True;            
+}
 
-               /* Parse a NULL security descriptor.  This should really
-                       happen inside the sec_io_desc_buf() function. */
+/*******************************************************************
+ * init a structure.
+ ********************************************************************/
 
-               prs_debug(ps, depth, "", "sec_io_desc_buf");
-               if (!prs_uint32("size", ps, depth + 1, &dummy))
-                       return False;
-               if (!prs_uint32("ptr", ps, depth + 1, &dummy))
-                       return False;
-       }
+bool make_spoolss_q_enumprinters(
+       SPOOL_Q_ENUMPRINTERS *q_u, 
+       uint32 flags, 
+       char *servername, 
+       uint32 level, 
+       RPC_BUFFER *buffer, 
+       uint32 offered
+)
+{
+       q_u->flags=flags;
+       
+       q_u->servername_ptr = (servername != NULL) ? 1 : 0;
+       init_buf_unistr2(&q_u->servername, &q_u->servername_ptr, servername);
 
-       if(!prs_uint32("user_switch", ps, depth, &q_u->user_switch))
-               return False;
-       if(!spool_io_user_level("", &q_u->user_ctr, ps, depth))
-               return False;
+       q_u->level=level;
+       q_u->buffer=buffer;
+       q_u->offered=offered;
 
        return True;
 }
 
 /*******************************************************************
-********************************************************************/  
+ * init a structure.
+ ********************************************************************/
 
-bool spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u, 
-                              prs_struct *ps, int depth)
+bool make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, 
+                               fstring servername, uint32 level, 
+                               RPC_BUFFER *buffer, uint32 offered)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex");
-       depth++;
-       
-       if(!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth))
-               return False;
+       q_u->name_ptr = (servername != NULL) ? 1 : 0;
+       init_buf_unistr2(&q_u->name, &q_u->name_ptr, servername);
 
-       if(!prs_werror("status", ps, depth, &r_u->status))
-               return False;
+       q_u->level=level;
+       q_u->buffer=buffer;
+       q_u->offered=offered;
 
        return True;
 }
 
 /*******************************************************************
-********************************************************************/  
+ * read a structure.
+ * called from spoolss_enumprinters (srv_spoolss.c)
+ ********************************************************************/
 
-bool spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, 
-                                          prs_struct *ps, int depth)
-{      
-       SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *il;
-       
-       prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level_3");
+bool spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth)
+{
+       prs_debug(ps, depth, desc, "spoolss_io_q_enumprinters");
        depth++;
-               
-       /* reading */
-       if (UNMARSHALLING(ps)) {
-               il=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_DRIVER_INFO_LEVEL_3,1);
-               if(il == NULL)
-                       return False;
-               *q_u=il;
-       }
-       else {
-               il=*q_u;
-       }
-       
-       if(!prs_align(ps))
-               return False;
 
-       if(!prs_uint32("cversion", ps, depth, &il->cversion))
-               return False;
-       if(!prs_uint32("name", ps, depth, &il->name_ptr))
-               return False;
-       if(!prs_uint32("environment", ps, depth, &il->environment_ptr))
-               return False;
-       if(!prs_uint32("driverpath", ps, depth, &il->driverpath_ptr))
-               return False;
-       if(!prs_uint32("datafile", ps, depth, &il->datafile_ptr))
-               return False;
-       if(!prs_uint32("configfile", ps, depth, &il->configfile_ptr))
-               return False;
-       if(!prs_uint32("helpfile", ps, depth, &il->helpfile_ptr))
-               return False;
-       if(!prs_uint32("monitorname", ps, depth, &il->monitorname_ptr))
-               return False;
-       if(!prs_uint32("defaultdatatype", ps, depth, &il->defaultdatatype_ptr))
-               return False;
-       if(!prs_uint32("dependentfilessize", ps, depth, &il->dependentfilessize))
-               return False;
-       if(!prs_uint32("dependentfiles", ps, depth, &il->dependentfiles_ptr))
+       if (!prs_align(ps))
                return False;
 
-       if(!prs_align(ps))
-               return False;
-       
-       if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth))
-               return False;
-       if(!smb_io_unistr2("environment", &il->environment, il->environment_ptr, ps, depth))
-               return False;
-       if(!smb_io_unistr2("driverpath", &il->driverpath, il->driverpath_ptr, ps, depth))
+       if (!prs_uint32("flags", ps, depth, &q_u->flags))
                return False;
-       if(!smb_io_unistr2("datafile", &il->datafile, il->datafile_ptr, ps, depth))
+       if (!prs_uint32("servername_ptr", ps, depth, &q_u->servername_ptr))
                return False;
-       if(!smb_io_unistr2("configfile", &il->configfile, il->configfile_ptr, ps, depth))
+
+       if (!smb_io_unistr2("", &q_u->servername, q_u->servername_ptr, ps, depth))
                return False;
-       if(!smb_io_unistr2("helpfile", &il->helpfile, il->helpfile_ptr, ps, depth))
+               
+       if (!prs_align(ps))
                return False;
-       if(!smb_io_unistr2("monitorname", &il->monitorname, il->monitorname_ptr, ps, depth))
+       if (!prs_uint32("level", ps, depth, &q_u->level))
                return False;
-       if(!smb_io_unistr2("defaultdatatype", &il->defaultdatatype, il->defaultdatatype_ptr, ps, depth))
+
+       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
                return False;
 
-       if(!prs_align(ps))
+       if (!prs_align(ps))
+               return False;
+       if (!prs_uint32("offered", ps, depth, &q_u->offered))
                return False;
-               
-       if (il->dependentfiles_ptr)
-               smb_io_buffer5("", &il->dependentfiles, ps, depth);
 
        return True;
 }
 
 /*******************************************************************
-parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure
-********************************************************************/  
+ Parse a SPOOL_R_ENUMPRINTERS structure.
+ ********************************************************************/
 
-bool spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, 
-                                          prs_struct *ps, int depth)
-{      
-       SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *il;
-       
-       prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level_6");
+bool spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth)
+{
+       prs_debug(ps, depth, desc, "spoolss_io_r_enumprinters");
        depth++;
-               
-       /* reading */
-       if (UNMARSHALLING(ps)) {
-               il=PRS_ALLOC_MEM(ps,SPOOL_PRINTER_DRIVER_INFO_LEVEL_6,1);
-               if(il == NULL)
-                       return False;
-               *q_u=il;
-       }
-       else {
-               il=*q_u;
-       }
-       
-       if(!prs_align(ps))
-               return False;
-
-       /* 
-        * I know this seems weird, but I have no other explanation.
-        * This is observed behavior on both NT4 and 2K servers.
-        * --jerry
-        */
-        
-       if (!prs_align_uint64(ps))
-               return False;
 
-       /* parse the main elements the packet */
-
-       if(!prs_uint32("cversion       ", ps, depth, &il->version))
-               return False;
-       if(!prs_uint32("name           ", ps, depth, &il->name_ptr))
-               return False;
-       if(!prs_uint32("environment    ", ps, depth, &il->environment_ptr))
-               return False;
-       if(!prs_uint32("driverpath     ", ps, depth, &il->driverpath_ptr))
-               return False;
-       if(!prs_uint32("datafile       ", ps, depth, &il->datafile_ptr))
-               return False;
-       if(!prs_uint32("configfile     ", ps, depth, &il->configfile_ptr))
-               return False;
-       if(!prs_uint32("helpfile       ", ps, depth, &il->helpfile_ptr))
-               return False;
-       if(!prs_uint32("monitorname    ", ps, depth, &il->monitorname_ptr))
-               return False;
-       if(!prs_uint32("defaultdatatype", ps, depth, &il->defaultdatatype_ptr))
-               return False;
-       if(!prs_uint32("dependentfiles ", ps, depth, &il->dependentfiles_len))
-               return False;
-       if(!prs_uint32("dependentfiles ", ps, depth, &il->dependentfiles_ptr))
-               return False;
-       if(!prs_uint32("previousnames  ", ps, depth, &il->previousnames_len))
-               return False;
-       if(!prs_uint32("previousnames  ", ps, depth, &il->previousnames_ptr))
-               return False;
-       if(!smb_io_time("driverdate    ", &il->driverdate, ps, depth))
-               return False;
-       if(!prs_uint32("dummy4         ", ps, depth, &il->dummy4))
+       if (!prs_align(ps))
                return False;
-       if(!prs_uint64("driverversion  ", ps, depth, &il->driverversion))
+               
+       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
                return False;
-       if(!prs_uint32("mfgname        ", ps, depth, &il->mfgname_ptr))
+
+       if (!prs_align(ps))
                return False;
-       if(!prs_uint32("oemurl         ", ps, depth, &il->oemurl_ptr))
+               
+       if (!prs_uint32("needed", ps, depth, &r_u->needed))
                return False;
-       if(!prs_uint32("hardwareid     ", ps, depth, &il->hardwareid_ptr))
+               
+       if (!prs_uint32("returned", ps, depth, &r_u->returned))
                return False;
-       if(!prs_uint32("provider       ", ps, depth, &il->provider_ptr))
+               
+       if (!prs_werror("status", ps, depth, &r_u->status))
                return False;
 
-       /* parse the structures in the packet */
+       return True;            
+}
+
+/*******************************************************************
+ * write a structure.
+ * called from spoolss_r_enum_printers (srv_spoolss.c)
+ *
+ ********************************************************************/
 
-       if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth))
-               return False;
-       if(!prs_align(ps))
-               return False;
+bool spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth)
+{      
+       prs_debug(ps, depth, desc, "spoolss_io_r_getprinter");
+       depth++;
 
-       if(!smb_io_unistr2("environment", &il->environment, il->environment_ptr, ps, depth))
+       if (!prs_align(ps))
                return False;
-       if(!prs_align(ps))
+               
+       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
                return False;
 
-       if(!smb_io_unistr2("driverpath", &il->driverpath, il->driverpath_ptr, ps, depth))
-               return False;
-       if(!prs_align(ps))
+       if (!prs_align(ps))
                return False;
 
-       if(!smb_io_unistr2("datafile", &il->datafile, il->datafile_ptr, ps, depth))
+       if (!prs_uint32("needed", ps, depth, &r_u->needed))
                return False;
-       if(!prs_align(ps))
+               
+       if (!prs_werror("status", ps, depth, &r_u->status))
                return False;
 
-       if(!smb_io_unistr2("configfile", &il->configfile, il->configfile_ptr, ps, depth))
-               return False;
-       if(!prs_align(ps))
-               return False;
+       return True;            
+}
 
-       if(!smb_io_unistr2("helpfile", &il->helpfile, il->helpfile_ptr, ps, depth))
-               return False;
      if(!prs_align(ps))
-               return False;
+/*******************************************************************
+ * read a structure.
* called from spoolss_getprinter (srv_spoolss.c)
+ ********************************************************************/
 
-       if(!smb_io_unistr2("monitorname", &il->monitorname, il->monitorname_ptr, ps, depth))
-               return False;
-       if(!prs_align(ps))
-               return False;
+bool spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth)
+{
+       prs_debug(ps, depth, desc, "spoolss_io_q_getprinter");
+       depth++;
 
-       if(!smb_io_unistr2("defaultdatatype", &il->defaultdatatype, il->defaultdatatype_ptr, ps, depth))
-               return False;
-       if(!prs_align(ps))
-               return False;
-       if (il->dependentfiles_ptr) {
-               if(!smb_io_buffer5("dependentfiles", &il->dependentfiles, ps, depth))
-                       return False;
-               if(!prs_align(ps))
-                       return False;
-       }
-       if (il->previousnames_ptr) {
-               if(!smb_io_buffer5("previousnames", &il->previousnames, ps, depth))
-                       return False;
-               if(!prs_align(ps))
-                       return False;
-       }
-       if(!smb_io_unistr2("mfgname", &il->mfgname, il->mfgname_ptr, ps, depth))
-               return False;
-       if(!prs_align(ps))
+       if (!prs_align(ps))
                return False;
-       if(!smb_io_unistr2("oemurl", &il->oemurl, il->oemurl_ptr, ps, depth))
+
+       if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth))
                return False;
-       if(!prs_align(ps))
+       if (!prs_uint32("level", ps, depth, &q_u->level))
                return False;
-       if(!smb_io_unistr2("hardwareid", &il->hardwareid, il->hardwareid_ptr, ps, depth))
+
+       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
                return False;
-       if(!prs_align(ps))
+
+       if (!prs_align(ps))
                return False;
-       if(!smb_io_unistr2("provider", &il->provider, il->provider_ptr, ps, depth))
+       if (!prs_uint32("offered", ps, depth, &q_u->offered))
                return False;
 
        return True;
 }
 
 /*******************************************************************
- convert a buffer of UNICODE strings null terminated
- the buffer is terminated by a NULL
- convert to an dos codepage array (null terminated)
- dynamically allocate memory
 ********************************************************************/  
 
-static bool uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar)
-{
-       fstring f;
-       int n = 0;
-       char *src;
+bool spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth)
+{              
+       prs_debug(ps, depth, desc, "spoolss_io_r_enumjobs");
+       depth++;
 
-       if (buf5==NULL)
+       if (!prs_align(ps))
                return False;
-
-       src = (char *)buf5->buffer;
-       *ar = SMB_MALLOC_ARRAY(fstring, 1);
-       if (!*ar) {
+               
+       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
                return False;
-       }
 
-       while (src < ((char *)buf5->buffer) + buf5->buf_len*2) {
-               rpcstr_pull(f, src, sizeof(f)-1, -1, STR_TERMINATE);
-               src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer));
-               *ar = SMB_REALLOC_ARRAY(*ar, fstring, n+2);
-               if (!*ar) {
-                       return False;
-               }
-               fstrcpy((*ar)[n], f);
-               n++;
-       }
+       if (!prs_align(ps))
+               return False;
+               
+       if (!prs_uint32("needed", ps, depth, &r_u->needed))
+               return False;
+               
+       if (!prs_uint32("returned", ps, depth, &r_u->returned))
+               return False;
+               
+       if (!prs_werror("status", ps, depth, &r_u->status))
+               return False;
 
-       fstrcpy((*ar)[n], "");
-       return True;
+       return True;            
 }
 
 /*******************************************************************
- read a UNICODE array with null terminated strings 
- and null terminated array 
- and size of array at beginning
 ********************************************************************/  
 
-bool smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int depth)
+bool make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd,
+                               uint32 firstjob,
+                               uint32 numofjobs,
+                               uint32 level,
+                               RPC_BUFFER *buffer,
+                               uint32 offered)
 {
-       if (buffer==NULL) return False;
-
-       buffer->offset=0;
-       buffer->uni_str_len=buffer->uni_max_len;
-       
-       if(!prs_uint32("buffer_size", ps, depth, &buffer->uni_max_len))
-               return False;
-
-       if(!prs_unistr2(True, "buffer     ", ps, depth, buffer))
+       if (q_u == NULL)
+       {
                return False;
-
+       }
+       memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
+       q_u->firstjob = firstjob;
+       q_u->numofjobs = numofjobs;
+       q_u->level = level;
+       q_u->buffer= buffer;
+       q_u->offered = offered;
        return True;
 }
 
 /*******************************************************************
 ********************************************************************/  
 
-bool spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth)
+bool spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth)
 {
-       prs_debug(ps, depth, desc, "spool_io_printer_driver_info_level");
+       prs_debug(ps, depth, desc, "spoolss_io_q_enumjobs");
        depth++;
 
-       if(!prs_align(ps))
+       if (!prs_align(ps))
+               return False;
+
+       if (!smb_io_pol_hnd("printer handle",&q_u->handle, ps, depth))
+               return False;
+               
+       if (!prs_uint32("firstjob", ps, depth, &q_u->firstjob))
                return False;
-       if(!prs_uint32("level", ps, depth, &il->level))
+       if (!prs_uint32("numofjobs", ps, depth, &q_u->numofjobs))
                return False;
-       if(!prs_uint32("ptr", ps, depth, &il->ptr))
+       if (!prs_uint32("level", ps, depth, &q_u->level))
                return False;
 
-       if (il->ptr==0)
-               return True;
-               
-       switch (il->level) {
-               case 3:
-                       if(!spool_io_printer_driver_info_level_3("", &il->info_3, ps, depth))
-                               return False;
-                       break;          
-               case 6:
-                       if(!spool_io_printer_driver_info_level_6("", &il->info_6, ps, depth))
-                               return False;
-                       break;          
-       default:
+       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
+               return False;   
+
+       if(!prs_align(ps))
+               return False;
+
+       if (!prs_uint32("offered", ps, depth, &q_u->offered))
                return False;
-       }
 
        return True;
 }
 
 /*******************************************************************
- init a SPOOL_Q_ADDPRINTERDRIVER struct
- ******************************************************************/
+ Parse a SPOOL_R_ENUMPRINTERDRIVERS structure.
+********************************************************************/  
 
-bool make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx,
-                               SPOOL_Q_ADDPRINTERDRIVER *q_u, const char* srv_name, 
-                               uint32 level, PRINTER_DRIVER_CTR *info)
+bool spoolss_io_r_enumprinterdrivers(const char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth)
 {
-       DEBUG(5,("make_spoolss_q_addprinterdriver\n"));
-       
-       if (!srv_name || !info) {
-               return False;
-       }
+       prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdrivers");
+       depth++;
 
-       q_u->server_name_ptr = 1; /* srv_name is != NULL, see above */
-       init_unistr2(&q_u->server_name, srv_name, UNI_STR_TERMINATE);
-       
-       q_u->level = level;
-       
-       q_u->info.level = level;
-       q_u->info.ptr = 1;      /* Info is != NULL, see above */
-       switch (level)
-       {
-       /* info level 3 is supported by Windows 95/98, WinNT and Win2k */
-       case 3 :
-               make_spoolss_driver_info_3(mem_ctx, &q_u->info.info_3, info->info3);
-               break;
+       if (!prs_align(ps))
+               return False;
                
-       default:
-               DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level));
-               break;
-       }
-       
-       return True;
-}
-
-bool make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx,
-       SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info,
-                               DRIVER_INFO_3 *info3)
-{
-       uint32          len = 0;
-       SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *inf;
-
-       if (!(inf=TALLOC_ZERO_P(mem_ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3)))
-               return False;
-
-       inf->cversion   = info3->version;
-       inf->name_ptr   = (info3->name.buffer!=NULL)?1:0;
-       inf->environment_ptr    = (info3->architecture.buffer!=NULL)?1:0;
-       inf->driverpath_ptr     = (info3->driverpath.buffer!=NULL)?1:0;
-       inf->datafile_ptr       = (info3->datafile.buffer!=NULL)?1:0;
-       inf->configfile_ptr     = (info3->configfile.buffer!=NULL)?1:0;
-       inf->helpfile_ptr       = (info3->helpfile.buffer!=NULL)?1:0;
-       inf->monitorname_ptr    = (info3->monitorname.buffer!=NULL)?1:0;
-       inf->defaultdatatype_ptr        = (info3->defaultdatatype.buffer!=NULL)?1:0;
-
-       init_unistr2_from_unistr(inf, &inf->name, &info3->name);
-       init_unistr2_from_unistr(inf, &inf->environment, &info3->architecture);
-       init_unistr2_from_unistr(inf, &inf->driverpath, &info3->driverpath);
-       init_unistr2_from_unistr(inf, &inf->datafile, &info3->datafile);
-       init_unistr2_from_unistr(inf, &inf->configfile, &info3->configfile);
-       init_unistr2_from_unistr(inf, &inf->helpfile, &info3->helpfile);
-       init_unistr2_from_unistr(inf, &inf->monitorname, &info3->monitorname);
-       init_unistr2_from_unistr(inf, &inf->defaultdatatype, &info3->defaultdatatype);
-
-       if (info3->dependentfiles) {
-               bool done = False;
-               bool null_char = False;
-               uint16 *ptr = info3->dependentfiles;
-
-               while (!done) {
-                       switch (*ptr) {
-                               case 0:
-                                       /* the null_char bool is used to help locate
-                                          two '\0's back to back */
-                                       if (null_char) {
-                                               done = True;
-                                       } else {
-                                               null_char = True;
-                                       }
-                                       break;
-                                       
-                               default:
-                                       null_char = False;
-                                       break;                          
-                       }
-                       len++;
-                       ptr++;
-               }
-       }
+       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
+               return False;
 
-       inf->dependentfiles_ptr = (info3->dependentfiles != NULL) ? 1 : 0;
-       inf->dependentfilessize = (info3->dependentfiles != NULL) ? len : 0;
-       if(!make_spoolss_buffer5(mem_ctx, &inf->dependentfiles, len, info3->dependentfiles)) {
-               SAFE_FREE(inf);
+       if (!prs_align(ps))
                return False;
-       }
-       
-       *spool_drv_info = inf;
-       
-       return True;
+               
+       if (!prs_uint32("needed", ps, depth, &r_u->needed))
+               return False;
+               
+       if (!prs_uint32("returned", ps, depth, &r_u->returned))
+               return False;
+               
+       if (!prs_werror("status", ps, depth, &r_u->status))
+               return False;
+
+       return True;            
 }
 
 /*******************************************************************
- make a BUFFER5 struct from a uint16*
- ******************************************************************/
+ * init a structure.
+ ********************************************************************/
 
-bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src)
+bool make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u,
+                                const char *name,
+                                const char *environment,
+                                uint32 level,
+                                RPC_BUFFER *buffer, uint32 offered)
 {
+        init_buf_unistr2(&q_u->name, &q_u->name_ptr, name);
+        init_buf_unistr2(&q_u->environment, &q_u->environment_ptr, environment);
 
-       buf5->buf_len = len;
-       if (src) {
-               if (len) {
-                       if((buf5->buffer=(uint16*)TALLOC_MEMDUP(mem_ctx, src, sizeof(uint16)*len)) == NULL) {
-                               DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n"));
-                               return False;
-                       }
-               } else {
-                       buf5->buffer = NULL;
-               }
-       } else {
-               buf5->buffer=NULL;
-       }
-       
-       return True;
+        q_u->level=level;
+        q_u->buffer=buffer;
+        q_u->offered=offered;
+
+        return True;
 }
 
 /*******************************************************************
- fill in the prs_struct for a ADDPRINTERDRIVER request PDU
- ********************************************************************/  
+ Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure.
+********************************************************************/  
 
-bool spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth)
+bool spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriver");
+
+       prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdrivers");
        depth++;
 
-       if(!prs_align(ps))
+       if (!prs_align(ps))
                return False;
-
-       if(!prs_uint32("server_name_ptr", ps, depth, &q_u->server_name_ptr))
+               
+       if (!prs_uint32("name_ptr", ps, depth, &q_u->name_ptr))
                return False;
-       if(!smb_io_unistr2("server_name", &q_u->server_name, q_u->server_name_ptr, ps, depth))
+       if (!smb_io_unistr2("", &q_u->name, q_u->name_ptr,ps, depth))
                return False;
                
-       if(!prs_align(ps))
+       if (!prs_align(ps))
+               return False;
+       if (!prs_uint32("environment_ptr", ps, depth, &q_u->environment_ptr))
+               return False;
+       if (!smb_io_unistr2("", &q_u->environment, q_u->environment_ptr, ps, depth))
+               return False;
+               
+       if (!prs_align(ps))
+               return False;
+       if (!prs_uint32("level", ps, depth, &q_u->level))
                return False;
-       if(!prs_uint32("info_level", ps, depth, &q_u->level))
+               
+       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
                return False;
 
-       if(!spool_io_printer_driver_info_level("", &q_u->info, ps, depth))
+       if (!prs_align(ps))
+               return False;
+               
+       if (!prs_uint32("offered", ps, depth, &q_u->offered))
                return False;
 
        return True;
@@ -4128,189 +2184,142 @@ bool spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q
 /*******************************************************************
 ********************************************************************/  
 
-bool spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth)
+bool spoolss_io_q_enumforms(const char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriver");
+
+       prs_debug(ps, depth, desc, "spoolss_io_q_enumforms");
        depth++;
 
-       if(!prs_werror("status", ps, depth, &q_u->status))
+       if (!prs_align(ps))
+               return False;                   
+       if (!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
+               return False;           
+       if (!prs_uint32("level", ps, depth, &q_u->level))
+               return False;   
+       
+       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
+               return False;
+
+       if (!prs_align(ps))
+               return False;
+       if (!prs_uint32("offered", ps, depth, &q_u->offered))
                return False;
 
        return True;
 }
 
 /*******************************************************************
- fill in the prs_struct for a ADDPRINTERDRIVER request PDU
- ********************************************************************/  
+********************************************************************/  
 
-bool spoolss_io_q_addprinterdriverex(const char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth)
+bool spoolss_io_r_enumforms(const char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_q_addprinterdriverex");
+       prs_debug(ps, depth, desc, "spoolss_io_r_enumforms");
        depth++;
 
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("server_name_ptr", ps, depth, &q_u->server_name_ptr))
-               return False;
-       if(!smb_io_unistr2("server_name", &q_u->server_name, q_u->server_name_ptr, ps, depth))
+       if (!prs_align(ps))
                return False;
                
-       if(!prs_align(ps))
-               return False;
-       if(!prs_uint32("info_level", ps, depth, &q_u->level))
+       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
                return False;
 
-       if(!spool_io_printer_driver_info_level("", &q_u->info, ps, depth))
+       if (!prs_align(ps))
                return False;
-
-       if(!prs_align(ps))
+               
+       if (!prs_uint32("size of buffer needed", ps, depth, &r_u->needed))
                return False;
-       if(!prs_uint32("copy flags", ps, depth, &q_u->copy_flags))
+               
+       if (!prs_uint32("numofforms", ps, depth, &r_u->numofforms))
                return False;
                
+       if (!prs_werror("status", ps, depth, &r_u->status))
+               return False;
+
        return True;
 }
 
 /*******************************************************************
+ Parse a SPOOL_R_ENUMPORTS structure.
 ********************************************************************/  
 
-bool spoolss_io_r_addprinterdriverex(const char *desc, SPOOL_R_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth)
+bool spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth)
 {
-       prs_debug(ps, depth, desc, "spoolss_io_r_addprinterdriverex");
+       prs_debug(ps, depth, desc, "spoolss_io_r_enumports");
        depth++;
 
-       if(!prs_werror("status", ps, depth, &q_u->status))
+       if (!prs_align(ps))
+               return False;
+               
+       if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
                return False;
 
-       return True;
+       if (!prs_align(ps))
+               return False;
+               
+       if (!prs_uint32("needed", ps, depth, &r_u->needed))
+               return False;
+               
+       if (!prs_uint32("returned", ps, depth, &r_u->returned))
+               return False;
+               
+       if (!prs_werror("status", ps, depth, &r_u->status))
+               return False;
+
+       return True;            
 }
 
 /*******************************************************************
 ********************************************************************/  
 
-bool uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni,
-                                NT_PRINTER_DRIVER_INFO_LEVEL_3 **asc)
+bool spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth)
 {
-       NT_PRINTER_DRIVER_INFO_LEVEL_3 *d;
-       
-       DEBUG(7,("uni_2_asc_printer_driver_3: Converting from UNICODE to ASCII\n"));
-       
-       if (*asc==NULL)
-       {
-               *asc=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_3);
-               if(*asc == NULL)
-                       return False;
-               ZERO_STRUCTP(*asc);
-       }       
+       prs_debug(ps, depth, desc, "");
+       depth++;
 
-       d=*asc;
-
-       d->cversion=uni->cversion;
-
-       unistr2_to_ascii(d->name,            &uni->name,            sizeof(d->name));
-       unistr2_to_ascii(d->environment,     &uni->environment,     sizeof(d->environment));
-       unistr2_to_ascii(d->driverpath,      &uni->driverpath,      sizeof(d->driverpath));
-       unistr2_to_ascii(d->datafile,        &uni->datafile,        sizeof(d->datafile));
-       unistr2_to_ascii(d->configfile,      &uni->configfile,      sizeof(d->configfile));
-       unistr2_to_ascii(d->helpfile,        &uni->helpfile,        sizeof(d->helpfile));
-       unistr2_to_ascii(d->monitorname,     &uni->monitorname,     sizeof(d->monitorname));
-       unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype));
-
-       DEBUGADD(8,( "version:         %d\n", d->cversion));
-       DEBUGADD(8,( "name:            %s\n", d->name));
-       DEBUGADD(8,( "environment:     %s\n", d->environment));
-       DEBUGADD(8,( "driverpath:      %s\n", d->driverpath));
-       DEBUGADD(8,( "datafile:        %s\n", d->datafile));
-       DEBUGADD(8,( "configfile:      %s\n", d->configfile));
-       DEBUGADD(8,( "helpfile:        %s\n", d->helpfile));
-       DEBUGADD(8,( "monitorname:     %s\n", d->monitorname));
-       DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype));
-
-       if (uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles ))
-               return True;
-       
-       SAFE_FREE(*asc);
-       return False;
-}
+       if (!prs_align(ps))
+               return False;
+
+       if (!prs_uint32("", ps, depth, &q_u->name_ptr))
+               return False;
+       if (!smb_io_unistr2("", &q_u->name,True,ps,depth))
+               return False;
+
+       if (!prs_align(ps))
+               return False;
+       if (!prs_uint32("level", ps, depth, &q_u->level))
+               return False;
+               
+       if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
+               return False;
 
-/*******************************************************************
-********************************************************************/  
-bool uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni,
-                                NT_PRINTER_DRIVER_INFO_LEVEL_6 **asc)
-{
-       NT_PRINTER_DRIVER_INFO_LEVEL_6 *d;
-       
-       DEBUG(7,("uni_2_asc_printer_driver_6: Converting from UNICODE to ASCII\n"));
-       
-       if (*asc==NULL)
-       {
-               *asc=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_6);
-               if(*asc == NULL)
-                       return False;
-               ZERO_STRUCTP(*asc);
-       }       
+       if (!prs_align(ps))
+               return False;
+       if (!prs_uint32("offered", ps, depth, &q_u->offered))
+               return False;
 
-       d=*asc;
-
-       d->version=uni->version;
-
-       unistr2_to_ascii(d->name,            &uni->name,            sizeof(d->name));
-       unistr2_to_ascii(d->environment,     &uni->environment,     sizeof(d->environment));
-       unistr2_to_ascii(d->driverpath,      &uni->driverpath,      sizeof(d->driverpath));
-       unistr2_to_ascii(d->datafile,        &uni->datafile,        sizeof(d->datafile));
-       unistr2_to_ascii(d->configfile,      &uni->configfile,      sizeof(d->configfile));
-       unistr2_to_ascii(d->helpfile,        &uni->helpfile,        sizeof(d->helpfile));
-       unistr2_to_ascii(d->monitorname,     &uni->monitorname,     sizeof(d->monitorname));
-       unistr2_to_ascii(d->defaultdatatype, &uni->defaultdatatype, sizeof(d->defaultdatatype));
-
-       DEBUGADD(8,( "version:         %d\n", d->version));
-       DEBUGADD(8,( "name:            %s\n", d->name));
-       DEBUGADD(8,( "environment:     %s\n", d->environment));
-       DEBUGADD(8,( "driverpath:      %s\n", d->driverpath));
-       DEBUGADD(8,( "datafile:        %s\n", d->datafile));
-       DEBUGADD(8,( "configfile:      %s\n", d->configfile));
-       DEBUGADD(8,( "helpfile:        %s\n", d->helpfile));
-       DEBUGADD(8,( "monitorname:     %s\n", d->monitorname));
-       DEBUGADD(8,( "defaultdatatype: %s\n", d->defaultdatatype));
-
-       if (!uniarray_2_dosarray(&uni->dependentfiles, &d->dependentfiles ))
-               goto error;
-       if (!uniarray_2_dosarray(&uni->previousnames, &d->previousnames ))
-               goto error;
-       
        return True;
-       
-error:
-       SAFE_FREE(*asc);
-       return False;
 }
 
-bool uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni,
-                              NT_PRINTER_INFO_LEVEL_2  *d)
+/*******************************************************************
+ make a BUFFER5 struct from a uint16*
+ ******************************************************************/
+
+bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src)
 {
-       DEBUG(7,("Converting from UNICODE to ASCII\n"));
-       
-       d->attributes=uni->attributes;
-       d->priority=uni->priority;
-       d->default_priority=uni->default_priority;
-       d->starttime=uni->starttime;
-       d->untiltime=uni->untiltime;
-       d->status=uni->status;
-       d->cjobs=uni->cjobs;
-       
-       unistr2_to_ascii(d->servername, &uni->servername, sizeof(d->servername));
-       unistr2_to_ascii(d->printername, &uni->printername, sizeof(d->printername));
-       unistr2_to_ascii(d->sharename, &uni->sharename, sizeof(d->sharename));
-       unistr2_to_ascii(d->portname, &uni->portname, sizeof(d->portname));
-       unistr2_to_ascii(d->drivername, &uni->drivername, sizeof(d->drivername));
-       unistr2_to_ascii(d->comment, &uni->comment, sizeof(d->comment));
-       unistr2_to_ascii(d->location, &uni->location, sizeof(d->location));
-       unistr2_to_ascii(d->sepfile, &uni->sepfile, sizeof(d->sepfile));
-       unistr2_to_ascii(d->printprocessor, &uni->printprocessor, sizeof(d->printprocessor));
-       unistr2_to_ascii(d->datatype, &uni->datatype, sizeof(d->datatype));
-       unistr2_to_ascii(d->parameters, &uni->parameters, sizeof(d->parameters));
 
+       buf5->buf_len = len;
+       if (src) {
+               if (len) {
+                       if((buf5->buffer=(uint16*)TALLOC_MEMDUP(mem_ctx, src, sizeof(uint16)*len)) == NULL) {
+                               DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n"));
+                               return False;
+                       }
+               } else {
+                       buf5->buffer = NULL;
+               }
+       } else {
+               buf5->buffer=NULL;
+       }
+       
        return True;
 }
 
@@ -4819,170 +2828,6 @@ void free_job_info_2(JOB_INFO_2 *job)
         free_devmode(job->devmode);
 }
 
-#if 0  /* JERRY - not currently used but could be :-) */
-
-/*******************************************************************
- Deep copy a SPOOL_NOTIFY_INFO_DATA structure
- ******************************************************************/
-static bool copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA *dst, 
-                               SPOOL_NOTIFY_INFO_DATA *src, int n)
-{
-       int i;
-
-       memcpy(dst, src, sizeof(SPOOL_NOTIFY_INFO_DATA)*n);
-       
-       for (i=0; i<n; i++) {
-               int len;
-               uint16 *s = NULL;
-               
-               if (src->size != POINTER) 
-                       continue;
-               len = src->notify_data.data.length;
-               s = SMB_MALLOC_ARRAY(uint16, len);
-               if (s == NULL) {
-                       DEBUG(0,("copy_spool_notify_info_data: malloc() failed!\n"));
-                       return False;
-               }
-               
-               memcpy(s, src->notify_data.data.string, len*2);
-               dst->notify_data.data.string = s;
-       }
-       
-       return True;
-}
-
-/*******************************************************************
- Deep copy a SPOOL_NOTIFY_INFO structure
- ******************************************************************/
-static bool copy_spool_notify_info(SPOOL_NOTIFY_INFO *dst, SPOOL_NOTIFY_INFO *src)
-{
-       if (!dst) {
-               DEBUG(0,("copy_spool_notify_info: NULL destination pointer!\n"));
-               return False;
-       }
-               
-       dst->version = src->version;
-       dst->flags   = src->flags;
-       dst->count   = src->count;
-       
-       if (dst->count) 
-       {
-               dst->data = SMB_MALLOC_ARRAY(SPOOL_NOTIFY_INFO_DATA, dst->count);
-               
-               DEBUG(10,("copy_spool_notify_info: allocating space for [%d] PRINTER_NOTIFY_INFO_DATA entries\n",
-                       dst->count));
-
-               if (dst->data == NULL) {
-                       DEBUG(0,("copy_spool_notify_info: malloc() failed for [%d] entries!\n", 
-                               dst->count));
-                       return False;
-               }
-               
-               return (copy_spool_notify_info_data(dst->data, src->data, src->count));
-       }
-       
-       return True;
-}
-#endif /* JERRY */
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd,
-                               uint32 change_low, uint32 change_high,
-                               SPOOL_NOTIFY_INFO *info)
-{      
-       if (q_u == NULL)
-               return False;
-
-       memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
-
-       q_u->change_low=change_low;
-       q_u->change_high=change_high;
-
-       q_u->unknown0=0x0;
-       q_u->unknown1=0x0;
-
-       q_u->info_ptr=0x0FF0ADDE;
-
-       q_u->info.version=2;
-       
-       if (info->count) {
-               DEBUG(10,("make_spoolss_q_reply_rrpcn: [%d] PRINTER_NOTIFY_INFO_DATA\n",
-                       info->count));
-               q_u->info.version = info->version;
-               q_u->info.flags   = info->flags;
-               q_u->info.count   = info->count;
-               /* pointer field - be careful! */
-               q_u->info.data    = info->data;
-       }
-       else  {
-       q_u->info.flags=PRINTER_NOTIFY_INFO_DISCARDED;
-       q_u->info.count=0;
-       }
-
-       return True;
-}
-
-/*******************************************************************
- Parse a SPOOL_Q_REPLY_RRPCN structure.
-********************************************************************/  
-
-bool spoolss_io_q_reply_rrpcn(const char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spoolss_io_q_reply_rrpcn");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
-               return False;
-
-       if (!prs_uint32("change_low", ps, depth, &q_u->change_low))
-               return False;
-
-       if (!prs_uint32("change_high", ps, depth, &q_u->change_high))
-               return False;
-
-       if (!prs_uint32("unknown0", ps, depth, &q_u->unknown0))
-               return False;
-
-       if (!prs_uint32("unknown1", ps, depth, &q_u->unknown1))
-               return False;
-
-       if (!prs_uint32("info_ptr", ps, depth, &q_u->info_ptr))
-               return False;
-
-       if(q_u->info_ptr!=0)
-               if(!smb_io_notify_info(desc, &q_u->info, ps, depth))
-                       return False;
-               
-       return True;
-}
-
-/*******************************************************************
- Parse a SPOOL_R_REPLY_RRPCN structure.
-********************************************************************/  
-
-bool spoolss_io_r_reply_rrpcn(const char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth)
-{              
-       prs_debug(ps, depth, desc, "spoolss_io_r_reply_rrpcn");
-       depth++;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("unknown0", ps, depth, &r_u->unknown0))
-               return False;
-
-       if (!prs_werror("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;            
-}
-
 /*******************************************************************
  * read a structure.
  ********************************************************************/  
@@ -5238,185 +3083,3 @@ bool spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX
                return False;
        return True;
 }
-
-/*******************************************************************
- * write a structure.
- ********************************************************************/  
-
-/* 
-   uint32 GetPrintProcessorDirectory(
-       [in] unistr2 *name,
-       [in] unistr2 *environment,
-       [in] uint32 level,
-       [in,out] RPC_BUFFER buffer,
-       [in] uint32 offered,
-       [out] uint32 needed,
-       [out] uint32 returned
-   );
-
-*/
-
-bool make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, const char *name, char *environment, int level, RPC_BUFFER *buffer, uint32 offered)
-{
-       DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n"));
-
-       init_unistr2(&q_u->name, name, UNI_STR_TERMINATE);
-       init_unistr2(&q_u->environment, environment, UNI_STR_TERMINATE);
-
-       q_u->level = level;
-
-       q_u->buffer = buffer;
-       q_u->offered = offered;
-
-       return True;
-}
-
-bool spoolss_io_q_getprintprocessordirectory(const char *desc, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, prs_struct *ps, int depth)
-{
-       uint32 ptr = 0;
-
-       prs_debug(ps, depth, desc, "spoolss_io_q_getprintprocessordirectory");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;   
-
-       if (!prs_uint32("ptr", ps, depth, &ptr)) 
-               return False;
-
-       if (ptr) {
-               if(!smb_io_unistr2("name", &q_u->name, True, ps, depth))
-                       return False;
-       }
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("ptr", ps, depth, &ptr))
-               return False;
-
-       if (ptr) {
-               if(!smb_io_unistr2("environment", &q_u->environment, True, 
-                                  ps, depth))
-                       return False;
-       }
-
-       if (!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("level",   ps, depth, &q_u->level))
-               return False;
-
-       if(!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
-               return False;
-       
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("offered", ps, depth, &q_u->offered))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- * write a structure.
- ********************************************************************/  
-
-bool spoolss_io_r_getprintprocessordirectory(const char *desc, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u, prs_struct *ps, int depth)
-{
-       prs_debug(ps, depth, desc, "spoolss_io_r_getprintprocessordirectory");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
-               return False;
-       
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("needed",     ps, depth, &r_u->needed))
-               return False;
-               
-       if(!prs_werror("status",     ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
-bool smb_io_printprocessordirectory_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth)
-{
-       prs_struct *ps=&buffer->prs;
-
-       prs_debug(ps, depth, desc, "smb_io_printprocessordirectory_1");
-       depth++;
-
-       buffer->struct_start=prs_offset(ps);
-
-       if (!smb_io_unistr(desc, &info->name, ps, depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle, 
-                             uint32 level, RPC_BUFFER *buffer,
-                             uint32 offered)
-{
-        memcpy(&q_u->handle, handle, sizeof(POLICY_HND));
-        q_u->level = level;
-        q_u->buffer=buffer;
-        q_u->offered=offered;
-
-       return True;
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle, 
-                          uint32 jobid, uint32 level, RPC_BUFFER *buffer,
-                          uint32 offered)
-{
-        memcpy(&q_u->handle, handle, sizeof(POLICY_HND));
-        q_u->jobid = jobid;
-        q_u->level = level;
-        q_u->buffer = buffer;
-        q_u->offered = offered;
-
-       return True;
-}
-
-/*******************************************************************
- * init a structure.
- ********************************************************************/
-
-bool make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle,
-                            uint32 flags, uint32 options, const char *localmachine,
-                            uint32 printerlocal, SPOOL_NOTIFY_OPTION *option)
-{
-        memcpy(&q_u->handle, handle, sizeof(POLICY_HND));
-
-       q_u->flags = flags;
-       q_u->options = options;
-
-       q_u->localmachine_ptr = 1;
-
-       init_unistr2(&q_u->localmachine, localmachine, UNI_STR_TERMINATE);
-
-       q_u->printerlocal = printerlocal;
-
-       if (option)
-               q_u->option_ptr = 1;
-
-       q_u->option = option;
-
-       return True;
-}