2003-11-16 14:36:59 +03:00
/*
Unix SMB / CIFS implementation .
routines for marshalling / unmarshalling spoolss subcontext buffer structures
Copyright ( C ) Andrew Tridgell 2003
Copyright ( C ) Tim Potter 2003
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2003-11-16 14:36:59 +03:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2003-11-16 14:36:59 +03:00
*/
# include "includes.h"
2004-11-01 13:30:34 +03:00
# include "librpc/gen_ndr/ndr_spoolss.h"
2003-11-16 14:36:59 +03:00
2005-05-31 02:44:17 +04:00
# define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
2005-06-14 21:01:36 +04:00
if ( ! r - > in . buffer & & r - > in . offered ! = 0 ) { \
return ndr_push_error ( ndr , NDR_ERR_BUFSIZE , \
" SPOOLSS Buffer: r->in.offered[%u] but there's no buffer " , \
2005-07-17 13:20:52 +04:00
( unsigned ) r - > in . offered ) ; \
2005-06-14 21:01:36 +04:00
} else if ( r - > in . buffer & & r - > in . buffer - > length ! = r - > in . offered ) { \
return ndr_push_error ( ndr , NDR_ERR_BUFSIZE , \
" SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u] " , \
2005-07-17 13:20:52 +04:00
( unsigned ) r - > in . offered , ( unsigned ) r - > in . buffer - > length ) ; \
2005-06-14 21:01:36 +04:00
} \
2005-05-31 02:44:17 +04:00
_r . in . level = r - > in . level ; \
_r . in . buffer = r - > in . buffer ; \
2005-06-14 19:52:31 +04:00
_r . in . offered = r - > in . offered ; \
2005-05-31 02:44:17 +04:00
NDR_CHECK ( ndr_push__ # # fn ( ndr , flags , & _r ) ) ; \
2005-02-21 16:54:06 +03:00
} while ( 0 )
2005-05-31 02:44:17 +04:00
# define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
struct ndr_push * _ndr_info ; \
_r . in . level = r - > in . level ; \
_r . in . buffer = r - > in . buffer ; \
2005-06-14 19:52:31 +04:00
_r . in . offered = r - > in . offered ; \
_r . out . info = NULL ; \
_r . out . needed = r - > out . needed ; \
2005-05-31 02:44:17 +04:00
_r . out . count = r - > out . count ; \
_r . out . result = r - > out . result ; \
2005-06-14 21:01:36 +04:00
if ( r - > out . info & & ! r - > in . buffer ) { \
return ndr_push_error ( ndr , NDR_ERR_BUFSIZE , \
" SPOOLSS Buffer: r->out.info but there's no r->in.buffer " ) ; \
} \
if ( r - > in . buffer ) { \
2005-05-31 02:44:17 +04:00
DATA_BLOB _data_blob_info ; \
_ndr_info = ndr_push_init_ctx ( ndr ) ; \
2007-11-09 21:24:10 +03:00
NDR_ERR_HAVE_NO_MEMORY ( _ndr_info ) ; \
2005-06-06 13:52:07 +04:00
_ndr_info - > flags = ndr - > flags ; \
2005-06-14 21:01:36 +04:00
if ( r - > out . info ) { \
struct __ # # fn __r ; \
__r . in . level = r - > in . level ; \
__r . in . count = r - > out . count ; \
__r . out . info = r - > out . info ; \
NDR_CHECK ( ndr_push___ # # fn ( _ndr_info , flags , & __r ) ) ; \
} \
2005-06-14 19:52:31 +04:00
if ( r - > in . offered > _ndr_info - > offset ) { \
uint32_t _padding_len = r - > in . offered - _ndr_info - > offset ; \
2005-06-10 17:42:01 +04:00
NDR_CHECK ( ndr_push_zero ( _ndr_info , _padding_len ) ) ; \
2005-06-14 21:01:36 +04:00
} else if ( r - > in . offered < _ndr_info - > offset ) { \
return ndr_push_error ( ndr , NDR_ERR_BUFSIZE , \
" SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]! " , \
2005-07-17 13:20:52 +04:00
( unsigned ) r - > in . offered , ( unsigned ) _ndr_info - > offset ) ; \
2005-06-10 17:42:01 +04:00
} \
2005-05-31 02:44:17 +04:00
_data_blob_info = ndr_push_blob ( _ndr_info ) ; \
2005-06-14 19:52:31 +04:00
_r . out . info = & _data_blob_info ; \
2005-02-21 16:54:06 +03:00
} \
2005-05-31 02:44:17 +04:00
NDR_CHECK ( ndr_push__ # # fn ( ndr , flags , & _r ) ) ; \
} while ( 0 )
# define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
struct _ # # fn _r ; \
if ( flags & NDR_IN ) { \
in ; \
NDR_SPOOLSS_PUSH_ENUM_IN ( fn ) ; \
2005-02-21 16:54:06 +03:00
} \
2005-05-31 02:44:17 +04:00
if ( flags & NDR_OUT ) { \
out ; \
NDR_SPOOLSS_PUSH_ENUM_OUT ( fn ) ; \
2005-02-21 16:54:06 +03:00
} \
2005-05-31 02:44:17 +04:00
} while ( 0 )
# define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
ZERO_STRUCT ( r - > out ) ; \
NDR_CHECK ( ndr_pull__ # # fn ( ndr , flags , & _r ) ) ; \
r - > in . level = _r . in . level ; \
r - > in . buffer = _r . in . buffer ; \
2005-06-14 19:52:31 +04:00
r - > in . offered = _r . in . offered ; \
r - > out . needed = _r . out . needed ; \
2005-06-14 21:01:36 +04:00
if ( ! r - > in . buffer & & r - > in . offered ! = 0 ) { \
return ndr_pull_error ( ndr , NDR_ERR_BUFSIZE , \
" SPOOLSS Buffer: r->in.offered[%u] but there's no buffer " , \
2006-09-09 14:05:58 +04:00
( unsigned ) r - > in . offered ) ; \
2005-06-14 21:01:36 +04:00
} else if ( r - > in . buffer & & r - > in . buffer - > length ! = r - > in . offered ) { \
return ndr_pull_error ( ndr , NDR_ERR_BUFSIZE , \
" SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u] " , \
2006-09-09 14:05:58 +04:00
( unsigned ) r - > in . offered , ( unsigned ) r - > in . buffer - > length ) ; \
2005-06-14 21:01:36 +04:00
} \
2005-05-31 02:44:17 +04:00
} while ( 0 )
# define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
_r . in . level = r - > in . level ; \
_r . in . buffer = r - > in . buffer ; \
2005-06-14 19:52:31 +04:00
_r . in . offered = r - > in . offered ; \
_r . out . needed = r - > out . needed ; \
2005-05-31 02:44:17 +04:00
NDR_CHECK ( ndr_pull__ # # fn ( ndr , flags , & _r ) ) ; \
r - > out . info = NULL ; \
2005-06-14 19:52:31 +04:00
r - > out . needed = _r . out . needed ; \
2005-05-31 02:44:17 +04:00
r - > out . count = _r . out . count ; \
r - > out . result = _r . out . result ; \
2005-06-14 19:52:31 +04:00
if ( _r . out . info ) { \
struct ndr_pull * _ndr_info = ndr_pull_init_blob ( _r . out . info , ndr ) ; \
2007-11-09 21:24:10 +03:00
NDR_ERR_HAVE_NO_MEMORY ( _ndr_info ) ; \
2005-06-06 13:52:07 +04:00
_ndr_info - > flags = ndr - > flags ; \
2005-06-14 19:52:31 +04:00
if ( r - > in . offered ! = _ndr_info - > data_size ) { \
2005-06-10 17:42:01 +04:00
return ndr_pull_error ( ndr , NDR_ERR_BUFSIZE , \
2005-06-14 19:52:31 +04:00
" SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u] " , \
2006-09-09 14:05:58 +04:00
( unsigned ) r - > in . offered , ( unsigned ) _ndr_info - > data_size ) ; \
2005-06-14 19:52:31 +04:00
} \
if ( r - > out . needed < = _ndr_info - > data_size ) { \
struct __ # # fn __r ; \
__r . in . level = r - > in . level ; \
__r . in . count = r - > out . count ; \
__r . out . info = NULL ; \
NDR_CHECK ( ndr_pull___ # # fn ( _ndr_info , flags , & __r ) ) ; \
r - > out . info = __r . out . info ; \
2005-06-10 17:42:01 +04:00
} \
2005-02-21 16:54:06 +03:00
} \
} while ( 0 )
2005-05-31 02:44:17 +04:00
# define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
struct _ # # fn _r ; \
if ( flags & NDR_IN ) { \
2005-06-02 10:27:40 +04:00
out ; \
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PULL_ENUM_IN ( fn ) ; \
2005-06-02 10:27:40 +04:00
in ; \
2005-05-31 02:44:17 +04:00
} \
if ( flags & NDR_OUT ) { \
out ; \
NDR_SPOOLSS_PULL_ENUM_OUT ( fn ) ; \
2005-02-21 16:54:06 +03:00
} \
} while ( 0 )
2005-06-14 21:01:36 +04:00
# define _NDR_CHECK_UINT32(call) do {\
2007-11-09 21:24:10 +03:00
enum ndr_err_code _ndr_err ; \
_ndr_err = call ; \
if ( ! NDR_ERR_CODE_IS_SUCCESS ( _ndr_err ) ) { \
2005-06-14 21:01:36 +04:00
return 0 ; \
} \
} while ( 0 )
2005-06-02 04:18:06 +04:00
2005-06-06 13:52:07 +04:00
/* TODO: set _ndr_info->flags correct */
2005-06-02 04:18:06 +04:00
# define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
struct __ # # fn __r ; \
DATA_BLOB _data_blob_info ; \
struct ndr_push * _ndr_info = ndr_push_init_ctx ( mem_ctx ) ; \
if ( ! _ndr_info ) return 0 ; \
2005-06-06 13:52:07 +04:00
_ndr_info - > flags | = 0 ; \
2005-06-02 04:18:06 +04:00
__r . in . level = level ; \
__r . in . count = count ; \
__r . out . info = info ; \
_NDR_CHECK_UINT32 ( ndr_push___ # # fn ( _ndr_info , NDR_OUT , & __r ) ) ; \
_data_blob_info = ndr_push_blob ( _ndr_info ) ; \
return _data_blob_info . length ; \
} while ( 0 )
2005-02-21 16:54:06 +03:00
/*
spoolss_EnumPrinters
*/
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_push_spoolss_EnumPrinters ( struct ndr_push * ndr , int flags , const struct spoolss_EnumPrinters * r )
2005-02-21 16:54:06 +03:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PUSH_ENUM ( spoolss_EnumPrinters , {
_r . in . flags = r - > in . flags ;
_r . in . server = r - > in . server ;
} , {
_r . in . flags = r - > in . flags ;
_r . in . server = r - > in . server ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-02-21 16:54:06 +03:00
}
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_pull_spoolss_EnumPrinters ( struct ndr_pull * ndr , int flags , struct spoolss_EnumPrinters * r )
2005-02-21 16:54:06 +03:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PULL_ENUM ( spoolss_EnumPrinters , {
r - > in . flags = _r . in . flags ;
r - > in . server = _r . in . server ;
} , {
_r . in . flags = r - > in . flags ;
_r . in . server = r - > in . server ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-02-21 16:54:06 +03:00
}
2005-06-02 04:18:06 +04:00
uint32_t ndr_size_spoolss_EnumPrinters_info ( TALLOC_CTX * mem_ctx , uint32_t level , uint32_t count , union spoolss_PrinterInfo * info )
{
NDR_SPOOLSS_SIZE_ENUM ( spoolss_EnumPrinters ) ;
}
2005-02-21 16:54:06 +03:00
/*
spoolss_EnumJobs
*/
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_push_spoolss_EnumJobs ( struct ndr_push * ndr , int flags , const struct spoolss_EnumJobs * r )
2005-02-21 16:54:06 +03:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PUSH_ENUM ( spoolss_EnumJobs , {
_r . in . handle = r - > in . handle ;
_r . in . firstjob = r - > in . firstjob ;
_r . in . numjobs = r - > in . numjobs ;
} , {
_r . in . handle = r - > in . handle ;
_r . in . firstjob = r - > in . firstjob ;
_r . in . numjobs = r - > in . numjobs ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-02-21 16:54:06 +03:00
}
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_pull_spoolss_EnumJobs ( struct ndr_pull * ndr , int flags , struct spoolss_EnumJobs * r )
2005-02-21 16:54:06 +03:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PULL_ENUM ( spoolss_EnumJobs , {
r - > in . handle = _r . in . handle ;
r - > in . firstjob = _r . in . firstjob ;
r - > in . numjobs = _r . in . numjobs ;
} , {
_r . in . handle = r - > in . handle ;
_r . in . firstjob = r - > in . firstjob ;
_r . in . numjobs = r - > in . numjobs ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-02-21 16:54:06 +03:00
}
2005-06-02 04:18:06 +04:00
uint32_t ndr_size_spoolss_EnumJobss_info ( TALLOC_CTX * mem_ctx , uint32_t level , uint32_t count , union spoolss_JobInfo * info )
{
NDR_SPOOLSS_SIZE_ENUM ( spoolss_EnumJobs ) ;
}
2005-02-21 16:54:06 +03:00
/*
spoolss_EnumPrinterDrivers
*/
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers ( struct ndr_push * ndr , int flags , const struct spoolss_EnumPrinterDrivers * r )
2005-02-21 16:54:06 +03:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PUSH_ENUM ( spoolss_EnumPrinterDrivers , {
_r . in . server = r - > in . server ;
_r . in . environment = r - > in . environment ;
} , {
_r . in . server = r - > in . server ;
_r . in . environment = r - > in . environment ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-02-21 16:54:06 +03:00
}
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers ( struct ndr_pull * ndr , int flags , struct spoolss_EnumPrinterDrivers * r )
2003-11-16 14:36:59 +03:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PULL_ENUM ( spoolss_EnumPrinterDrivers , {
r - > in . server = _r . in . server ;
r - > in . environment = _r . in . environment ;
} , {
_r . in . server = r - > in . server ;
_r . in . environment = r - > in . environment ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2003-11-16 14:36:59 +03:00
}
2003-11-26 09:26:18 +03:00
2005-06-02 04:18:06 +04:00
uint32_t ndr_size_spoolss_EnumPrinterDrivers_info ( TALLOC_CTX * mem_ctx , uint32_t level , uint32_t count , union spoolss_DriverInfo * info )
{
NDR_SPOOLSS_SIZE_ENUM ( spoolss_EnumPrinterDrivers ) ;
}
2005-02-21 16:54:06 +03:00
/*
spoolss_EnumForms
*/
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_push_spoolss_EnumForms ( struct ndr_push * ndr , int flags , const struct spoolss_EnumForms * r )
2005-02-21 16:54:06 +03:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PUSH_ENUM ( spoolss_EnumForms , {
_r . in . handle = r - > in . handle ;
} , {
_r . in . handle = r - > in . handle ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2003-11-26 09:26:18 +03:00
}
2003-11-28 08:02:32 +03:00
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_pull_spoolss_EnumForms ( struct ndr_pull * ndr , int flags , struct spoolss_EnumForms * r )
2003-11-28 08:02:32 +03:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PULL_ENUM ( spoolss_EnumForms , {
r - > in . handle = _r . in . handle ;
} , {
_r . in . handle = r - > in . handle ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2003-11-28 08:02:32 +03:00
}
2003-11-30 14:57:40 +03:00
2005-06-02 04:18:06 +04:00
uint32_t ndr_size_spoolss_EnumForms_info ( TALLOC_CTX * mem_ctx , uint32_t level , uint32_t count , union spoolss_FormInfo * info )
{
NDR_SPOOLSS_SIZE_ENUM ( spoolss_EnumForms ) ;
}
2005-02-21 16:54:06 +03:00
/*
spoolss_EnumPorts
*/
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_push_spoolss_EnumPorts ( struct ndr_push * ndr , int flags , const struct spoolss_EnumPorts * r )
2005-02-21 16:54:06 +03:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PUSH_ENUM ( spoolss_EnumPorts , {
_r . in . servername = r - > in . servername ;
} , {
_r . in . servername = r - > in . servername ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2003-11-30 14:57:40 +03:00
}
2004-09-03 17:36:58 +04:00
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_pull_spoolss_EnumPorts ( struct ndr_pull * ndr , int flags , struct spoolss_EnumPorts * r )
2004-09-03 17:36:58 +04:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PULL_ENUM ( spoolss_EnumPorts , {
r - > in . servername = _r . in . servername ;
} , {
_r . in . servername = r - > in . servername ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2004-09-03 17:36:58 +04:00
}
2005-02-21 16:54:06 +03:00
2005-06-02 04:18:06 +04:00
uint32_t ndr_size_spoolss_EnumPorts_info ( TALLOC_CTX * mem_ctx , uint32_t level , uint32_t count , union spoolss_PortInfo * info )
{
NDR_SPOOLSS_SIZE_ENUM ( spoolss_EnumPorts ) ;
}
2005-04-02 10:51:54 +04:00
/*
spoolss_EnumMonitors
*/
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_push_spoolss_EnumMonitors ( struct ndr_push * ndr , int flags , const struct spoolss_EnumMonitors * r )
2005-04-02 10:51:54 +04:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PUSH_ENUM ( spoolss_EnumMonitors , {
_r . in . servername = r - > in . servername ;
} , {
_r . in . servername = r - > in . servername ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-04-02 10:51:54 +04:00
}
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_pull_spoolss_EnumMonitors ( struct ndr_pull * ndr , int flags , struct spoolss_EnumMonitors * r )
2005-04-02 10:51:54 +04:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PULL_ENUM ( spoolss_EnumMonitors , {
r - > in . servername = _r . in . servername ;
} , {
_r . in . servername = r - > in . servername ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-04-02 10:51:54 +04:00
}
2005-06-02 04:18:06 +04:00
uint32_t ndr_size_spoolss_EnumMonitors_info ( TALLOC_CTX * mem_ctx , uint32_t level , uint32_t count , union spoolss_MonitorInfo * info )
{
NDR_SPOOLSS_SIZE_ENUM ( spoolss_EnumMonitors ) ;
}
2005-04-02 10:51:54 +04:00
/*
spoolss_EnumPrintProcessors
*/
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors ( struct ndr_push * ndr , int flags , const struct spoolss_EnumPrintProcessors * r )
2005-04-02 10:51:54 +04:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PUSH_ENUM ( spoolss_EnumPrintProcessors , {
_r . in . servername = r - > in . servername ;
_r . in . environment = r - > in . environment ;
} , {
_r . in . servername = r - > in . servername ;
_r . in . environment = r - > in . environment ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-04-02 10:51:54 +04:00
}
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors ( struct ndr_pull * ndr , int flags , struct spoolss_EnumPrintProcessors * r )
2005-04-02 10:51:54 +04:00
{
2005-05-31 02:44:17 +04:00
NDR_SPOOLSS_PULL_ENUM ( spoolss_EnumPrintProcessors , {
2005-06-02 19:11:06 +04:00
r - > in . servername = _r . in . servername ;
r - > in . environment = _r . in . environment ;
2005-05-31 02:44:17 +04:00
} , {
_r . in . servername = r - > in . servername ;
_r . in . environment = r - > in . environment ;
} ) ;
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-04-02 10:51:54 +04:00
}
2005-06-02 04:18:06 +04:00
uint32_t ndr_size_spoolss_EnumPrinterProcessors_info ( TALLOC_CTX * mem_ctx , uint32_t level , uint32_t count , union spoolss_PrintProcessorInfo * info )
{
NDR_SPOOLSS_SIZE_ENUM ( spoolss_EnumPrintProcessors ) ;
}
2005-06-06 13:59:43 +04:00
/*
spoolss_GetPrinterData
*/
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_push_spoolss_GetPrinterData ( struct ndr_push * ndr , int flags , const struct spoolss_GetPrinterData * r )
2005-06-14 21:01:36 +04:00
{
struct _spoolss_GetPrinterData _r ;
if ( flags & NDR_IN ) {
_r . in . handle = r - > in . handle ;
_r . in . value_name = r - > in . value_name ;
_r . in . offered = r - > in . offered ;
NDR_CHECK ( ndr_push__spoolss_GetPrinterData ( ndr , flags , & _r ) ) ;
}
if ( flags & NDR_OUT ) {
2007-11-03 10:31:10 +03:00
struct ndr_push * _ndr_info ;
2005-06-14 21:01:36 +04:00
_r . in . handle = r - > in . handle ;
_r . in . value_name = r - > in . value_name ;
_r . in . offered = r - > in . offered ;
_r . out . type = r - > out . type ;
_r . out . data = data_blob ( NULL , 0 ) ;
_r . out . needed = r - > out . needed ;
_r . out . result = r - > out . result ;
{
struct __spoolss_GetPrinterData __r ;
_ndr_info = ndr_push_init_ctx ( ndr ) ;
2007-11-09 21:24:10 +03:00
NDR_ERR_HAVE_NO_MEMORY ( _ndr_info ) ;
2005-06-14 21:01:36 +04:00
_ndr_info - > flags = ndr - > flags ;
__r . in . type = r - > out . type ;
__r . out . data = r - > out . data ;
NDR_CHECK ( ndr_push___spoolss_GetPrinterData ( _ndr_info , flags , & __r ) ) ;
if ( r - > in . offered > _ndr_info - > offset ) {
uint32_t _padding_len = r - > in . offered - _ndr_info - > offset ;
NDR_CHECK ( ndr_push_zero ( _ndr_info , _padding_len ) ) ;
}
_r . out . data = ndr_push_blob ( _ndr_info ) ;
}
NDR_CHECK ( ndr_push__spoolss_GetPrinterData ( ndr , flags , & _r ) ) ;
}
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-06-14 21:01:36 +04:00
}
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_pull_spoolss_GetPrinterData ( struct ndr_pull * ndr , int flags , struct spoolss_GetPrinterData * r )
2005-06-06 13:59:43 +04:00
{
struct _spoolss_GetPrinterData _r ;
if ( flags & NDR_IN ) {
ZERO_STRUCT ( r - > out ) ;
_r . in . handle = r - > in . handle ;
_r . in . value_name = r - > in . value_name ;
2005-06-14 19:52:31 +04:00
_r . in . offered = r - > in . offered ;
2005-06-06 13:59:43 +04:00
_r . out . type = r - > out . type ;
_r . out . data = data_blob ( NULL , 0 ) ,
2005-06-14 19:52:31 +04:00
_r . out . needed = r - > out . needed ;
2005-06-06 13:59:43 +04:00
NDR_CHECK ( ndr_pull__spoolss_GetPrinterData ( ndr , flags , & _r ) ) ;
r - > in . handle = _r . in . handle ;
r - > in . value_name = _r . in . value_name ;
2005-06-14 19:52:31 +04:00
r - > in . offered = _r . in . offered ;
r - > out . needed = _r . out . needed ;
2005-06-06 13:59:43 +04:00
}
if ( flags & NDR_OUT ) {
_r . in . handle = r - > in . handle ;
_r . in . value_name = r - > in . value_name ;
2005-06-14 19:52:31 +04:00
_r . in . offered = r - > in . offered ;
2005-06-06 13:59:43 +04:00
_r . out . type = r - > out . type ;
_r . out . data = data_blob ( NULL , 0 ) ,
2005-06-14 19:52:31 +04:00
_r . out . needed = r - > out . needed ;
2005-06-06 13:59:43 +04:00
_r . out . result = r - > out . result ;
NDR_CHECK ( ndr_pull__spoolss_GetPrinterData ( ndr , flags , & _r ) ) ;
r - > out . type = _r . out . type ;
ZERO_STRUCT ( r - > out . data ) ;
2005-06-14 19:52:31 +04:00
r - > out . needed = _r . out . needed ;
2005-06-06 13:59:43 +04:00
r - > out . result = _r . out . result ;
2005-06-14 19:52:31 +04:00
if ( _r . out . data . length ! = r - > in . offered ) {
2007-11-03 10:31:10 +03:00
return ndr_pull_error ( ndr , NDR_ERR_BUFSIZE ,
" SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u] " ,
( unsigned ) r - > in . offered , ( unsigned ) _r . out . data . length ) ;
2005-06-14 19:52:31 +04:00
}
if ( _r . out . data . length > 0 & & r - > out . needed < = _r . out . data . length ) {
2005-06-06 13:59:43 +04:00
struct __spoolss_GetPrinterData __r ;
2005-06-07 17:26:49 +04:00
struct ndr_pull * _ndr_data = ndr_pull_init_blob ( & _r . out . data , ndr ) ;
2007-11-09 21:24:10 +03:00
NDR_ERR_HAVE_NO_MEMORY ( _ndr_data ) ;
2005-06-07 17:26:49 +04:00
_ndr_data - > flags = ndr - > flags ;
2005-06-06 13:59:43 +04:00
__r . in . type = r - > out . type ;
__r . out . data = r - > out . data ;
NDR_CHECK ( ndr_pull___spoolss_GetPrinterData ( _ndr_data , flags , & __r ) ) ;
r - > out . data = __r . out . data ;
} else {
r - > out . type = SPOOLSS_PRINTER_DATA_TYPE_NULL ;
}
}
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-06-06 13:59:43 +04:00
}
/*
spoolss_SetPrinterData
*/
2007-11-09 21:24:10 +03:00
enum ndr_err_code ndr_push_spoolss_SetPrinterData ( struct ndr_push * ndr , int flags , const struct spoolss_SetPrinterData * r )
2005-06-06 13:59:43 +04:00
{
struct _spoolss_SetPrinterData _r ;
if ( flags & NDR_IN ) {
struct ndr_push * _ndr_data ;
struct __spoolss_SetPrinterData __r ;
DATA_BLOB _data_blob_data ;
2007-11-03 10:31:10 +03:00
_ndr_data = ndr_push_init_ctx ( ndr ) ;
2007-11-09 21:24:10 +03:00
NDR_ERR_HAVE_NO_MEMORY ( _ndr_data ) ;
2007-11-03 10:31:10 +03:00
_ndr_data - > flags = ndr - > flags ;
2005-06-06 13:59:43 +04:00
__r . in . type = r - > in . type ;
__r . out . data = r - > in . data ;
NDR_CHECK ( ndr_push___spoolss_SetPrinterData ( _ndr_data , NDR_OUT , & __r ) ) ;
_data_blob_data = ndr_push_blob ( _ndr_data ) ;
_r . in . handle = r - > in . handle ;
_r . in . value_name = r - > in . value_name ;
_r . in . type = r - > in . type ;
_r . in . data = _data_blob_data ;
2005-06-24 05:18:56 +04:00
_r . in . _offered = _data_blob_data . length ;
2005-06-06 13:59:43 +04:00
_r . out . result = r - > out . result ;
NDR_CHECK ( ndr_push__spoolss_SetPrinterData ( ndr , flags , & _r ) ) ;
}
if ( flags & NDR_OUT ) {
_r . in . handle = r - > in . handle ;
_r . in . value_name = r - > in . value_name ;
_r . in . type = r - > in . type ;
_r . in . data = data_blob ( NULL , 0 ) ,
2005-06-14 19:52:31 +04:00
_r . in . _offered = r - > in . _offered ;
2005-06-06 13:59:43 +04:00
_r . out . result = r - > out . result ;
NDR_CHECK ( ndr_push__spoolss_SetPrinterData ( ndr , flags , & _r ) ) ;
}
2007-11-09 21:24:10 +03:00
return NDR_ERR_SUCCESS ;
2005-06-06 13:59:43 +04:00
}
2005-07-01 15:04:33 +04:00
uint32_t _ndr_size_spoolss_DeviceMode ( struct spoolss_DeviceMode * devmode , uint32_t flags )
{
if ( ! devmode ) return 0 ;
return ndr_size_spoolss_DeviceMode ( devmode , flags ) ;
}