From f3319f7963e04a9642d604e706a10df3cd96dd73 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Thu, 24 Feb 2000 16:27:06 +0000 Subject: converted a couple of bzero() to memset() rewrote the printer notify code, so now it's compatible with SP5 and fully dynamic. No more limits on printers and job lists. removed the make_xxx() functions as they are not used and broken fixed a bug in the open handle function. J.F. (This used to be commit aa9054d14bc940f251639ab897d9f356814f5fc0) --- source3/include/proto.h | 46 +++++---------------- source3/include/rpc_spoolss.h | 96 +++++++++++++++++++++++++++++++++---------- 2 files changed, 85 insertions(+), 57 deletions(-) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 837eb27eda..934ec5a4c8 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -2301,11 +2301,6 @@ BOOL sec_io_desc_buf(char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth BOOL make_systemtime(SYSTEMTIME *systime, struct tm *unixtime); BOOL smb_io_notify_info_data_strings(char *desc,SPOOL_NOTIFY_INFO_DATA *data, prs_struct *ps, int depth); -BOOL make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, - const char *printername, - uint32 cbbuf, uint32 devmod, uint32 des_access, - const char *station, - const char *username); BOOL spoolss_io_q_open_printer_ex(char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth); BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth); BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, @@ -2327,15 +2322,10 @@ BOOL spoolss_io_q_endpageprinter(char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_st BOOL spoolss_io_r_endpageprinter(char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth); BOOL spoolss_io_q_writeprinter(char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth); BOOL spoolss_io_r_writeprinter(char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth); -BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, - prs_struct *ps, int depth); -BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, - prs_struct *ps, int depth); -BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, - prs_struct *ps, int depth); -BOOL spoolss_io_r_rfnpcnex(char *desc, - SPOOL_R_RFNPCNEX *r_u, - prs_struct *ps, int depth); +BOOL spoolss_io_q_rffpcnex(char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth); +BOOL spoolss_io_r_rffpcnex(char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth); +BOOL spoolss_io_q_rfnpcnex(char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth); +BOOL spoolss_io_r_rfnpcnex(char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth); BOOL new_smb_io_printer_info_0(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_0 *info, int depth); BOOL new_smb_io_printer_info_1(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_1 *info, int depth); BOOL new_smb_io_printer_info_2(char *desc, NEW_BUFFER *buffer, PRINTER_INFO_2 *info, int depth); @@ -2372,18 +2362,9 @@ uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info); uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info); BOOL spoolss_io_q_getprinterdriver2(char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth); BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth); -BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, - uint32 flags, - const char* servername, - uint32 level, - uint32 size); BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth); BOOL new_spoolss_io_r_enumprinters(char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth); BOOL spoolss_io_r_getprinter(char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth); -BOOL make_spoolss_q_getprinter(SPOOL_Q_GETPRINTER *q_u, - POLICY_HND *hnd, - uint32 level, - uint32 buf_size); BOOL spoolss_io_q_getprinter(char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth); BOOL spoolss_io_r_setprinter(char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth); BOOL spoolss_io_q_setprinter(char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth); @@ -2621,16 +2602,11 @@ uint32 _spoolss_getprinterdata(const POLICY_HND *handle, UNISTR2 *valuename, uint32 *out_size, uint8 **data, uint32 *needed); -uint32 _spoolss_rffpcnex(const POLICY_HND *handle, - uint32 flags, uint32 options, - const UNISTR2 *localmachine, - uint32 printerlocal, - SPOOL_NOTIFY_OPTION *option); -uint32 _spoolss_rfnpcnex( const POLICY_HND *handle, - uint32 change, - const SPOOL_NOTIFY_OPTION *option, - uint32 *count, - SPOOL_NOTIFY_INFO *info); +uint32 _spoolss_rffpcnex(const POLICY_HND *handle, uint32 flags, uint32 options, + const UNISTR2 *localmachine, uint32 printerlocal, + SPOOL_NOTIFY_OPTION *option); +uint32 _spoolss_rfnpcnex( const POLICY_HND *handle, uint32 change, + SPOOL_NOTIFY_OPTION *option, SPOOL_NOTIFY_INFO *info); uint32 _spoolss_enumprinters( uint32 flags, const UNISTR2 *servername, uint32 level, NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned); @@ -2655,8 +2631,8 @@ uint32 _spoolss_setprinter( const POLICY_HND *handle, uint32 sec_buf_size, const char *sec_buf, uint32 command); -uint32 _spoolss_fcpn( const POLICY_HND *handle); -uint32 _spoolss_addjob( const POLICY_HND *handle, uint32 level, +uint32 _spoolss_fcpn(const POLICY_HND *handle); +uint32 _spoolss_addjob(const POLICY_HND *handle, uint32 level, NEW_BUFFER *buffer, uint32 offered); uint32 _spoolss_enumjobs( POLICY_HND *handle, uint32 firstjob, uint32 numofjobs, uint32 level, NEW_BUFFER *buffer, uint32 offered, diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 1556c56686..19b6c2845c 100755 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -185,6 +185,9 @@ #define JOB_NOTIFY_TYPE 0x01 #define MAX_PRINTER_NOTIFY 26 +#define MAX_JOB_NOTIFY 24 + +#define MAX_NOTIFY_TYPE_FOR_NOW 26 #define PRINTER_NOTIFY_SERVER_NAME 0x00 #define PRINTER_NOTIFY_PRINTER_NAME 0x01 @@ -213,8 +216,6 @@ #define PRINTER_NOTIFY_TOTAL_BYTES 0x18 #define PRINTER_NOTIFY_BYTES_PRINTED 0x19 -#define MAX_JOB_NOTIFY 24 - #define JOB_NOTIFY_PRINTER_NAME 0x00 #define JOB_NOTIFY_MACHINE_NAME 0x01 #define JOB_NOTIFY_PORT_NAME 0x02 @@ -240,6 +241,57 @@ #define JOB_NOTIFY_TOTAL_BYTES 0x16 #define JOB_NOTIFY_BYTES_PRINTED 0x17 +#define PRINTER_CHANGE_ADD_PRINTER 0x00000001 +#define PRINTER_CHANGE_SET_PRINTER 0x00000002 +#define PRINTER_CHANGE_DELETE_PRINTER 0x00000004 +#define PRINTER_CHANGE_FAILED_CONNECTION_PRINTER 0x00000008 +#define PRINTER_CHANGE_PRINTER (PRINTER_CHANGE_ADD_PRINTER | \ + PRINTER_CHANGE_SET_PRINTER | \ + PRINTER_CHANGE_DELETE_PRINTER | \ + PRINTER_CHANGE_FAILED_CONNECTION_PRINTER ) + +#define PRINTER_CHANGE_ADD_JOB 0x00000100 +#define PRINTER_CHANGE_SET_JOB 0x00000200 +#define PRINTER_CHANGE_DELETE_JOB 0x00000400 +#define PRINTER_CHANGE_WRITE_JOB 0x00000800 +#define PRINTER_CHANGE_JOB (PRINTER_CHANGE_ADD_JOB | \ + PRINTER_CHANGE_SET_JOB | \ + PRINTER_CHANGE_DELETE_JOB | \ + PRINTER_CHANGE_WRITE_JOB ) + +#define PRINTER_CHANGE_ADD_FORM 0x00010000 +#define PRINTER_CHANGE_SET_FORM 0x00020000 +#define PRINTER_CHANGE_DELETE_FORM 0x00040000 +#define PRINTER_CHANGE_FORM (PRINTER_CHANGE_ADD_FORM | \ + PRINTER_CHANGE_SET_FORM | \ + PRINTER_CHANGE_DELETE_FORM ) + +#define PRINTER_CHANGE_ADD_PORT 0x00100000 +#define PRINTER_CHANGE_CONFIGURE_PORT 0x00200000 +#define PRINTER_CHANGE_DELETE_PORT 0x00400000 +#define PRINTER_CHANGE_PORT (PRINTER_CHANGE_ADD_PORT | \ + PRINTER_CHANGE_CONFIGURE_PORT | \ + PRINTER_CHANGE_DELETE_PORT ) + +#define PRINTER_CHANGE_ADD_PRINT_PROCESSOR 0x01000000 +#define PRINTER_CHANGE_DELETE_PRINT_PROCESSOR 0x04000000 +#define PRINTER_CHANGE_PRINT_PROCESSOR (PRINTER_CHANGE_ADD_PRINT_PROCESSOR | \ + PRINTER_CHANGE_DELETE_PRINT_PROCESSOR ) + +#define PRINTER_CHANGE_ADD_PRINTER_DRIVER 0x10000000 +#define PRINTER_CHANGE_SET_PRINTER_DRIVER 0x20000000 +#define PRINTER_CHANGE_DELETE_PRINTER_DRIVER 0x40000000 +#define PRINTER_CHANGE_PRINTER_DRIVER (PRINTER_CHANGE_ADD_PRINTER_DRIVER | \ + PRINTER_CHANGE_SET_PRINTER_DRIVER | \ + PRINTER_CHANGE_DELETE_PRINTER_DRIVER ) + +#define PRINTER_CHANGE_TIMEOUT 0x80000000 +#define PRINTER_CHANGE_ALL (PRINTER_CHANGE_JOB | \ + PRINTER_CHANGE_FORM | \ + PRINTER_CHANGE_PORT | \ + PRINTER_CHANGE_PRINT_PROCESSOR | \ + PRINTER_CHANGE_PRINTER_DRIVER ) + /* * The printer attributes. * I #defined all of them (grabbed form MSDN) @@ -396,9 +448,18 @@ typedef struct spool_notify_option_type uint32 reserved1; uint32 reserved2; uint32 count; - uint16 fields[16]; + uint32 fields_ptr; + uint32 count2; + uint16 fields[MAX_NOTIFY_TYPE_FOR_NOW]; } SPOOL_NOTIFY_OPTION_TYPE; +typedef struct spool_notify_option_type_ctr +{ + uint32 count; + SPOOL_NOTIFY_OPTION_TYPE *type; +} SPOOL_NOTIFY_OPTION_TYPE_CTR; + + typedef struct s_header_type { @@ -410,15 +471,6 @@ typedef struct s_header_type } data; } HEADER_TYPE; -/*typedef struct s_buffer -{ - uint32 ptr; - uint32 size; - uint32 count; - uint8 *data; - HEADER_TYPE *header; -} BUFFER; -*/ typedef struct new_buffer { uint32 ptr; @@ -536,9 +588,10 @@ typedef struct spool_r_writeprinter typedef struct spool_notify_option { uint32 version; - uint32 reserved; + uint32 flags; uint32 count; - SPOOL_NOTIFY_OPTION_TYPE type[16]; /* totally arbitrary !!! */ + uint32 option_type_ptr; + SPOOL_NOTIFY_OPTION_TYPE_CTR ctr; } SPOOL_NOTIFY_OPTION; typedef struct spool_notify_info_data @@ -565,10 +618,7 @@ typedef struct spool_notify_info uint32 version; uint32 flags; uint32 count; - SPOOL_NOTIFY_INFO_DATA data[26*16]; - /* 26 differents data types */ - /* so size it for 16 printers at max */ - /* jfmxxxx: Have to make it dynamic !!!*/ + SPOOL_NOTIFY_INFO_DATA *data; } SPOOL_NOTIFY_INFO; /* If the struct name looks obscure, yes it is ! */ @@ -578,9 +628,11 @@ typedef struct spoolss_q_rffpcnex POLICY_HND handle; uint32 flags; uint32 options; + uint32 localmachine_ptr; UNISTR2 localmachine; uint32 printerlocal; - SPOOL_NOTIFY_OPTION option; + uint32 option_ptr; + SPOOL_NOTIFY_OPTION *option; } SPOOL_Q_RFFPCNEX; typedef struct spool_r_rffpcnex @@ -593,15 +645,15 @@ typedef struct spool_q_rfnpcnex { POLICY_HND handle; uint32 change; - SPOOL_NOTIFY_OPTION option; + uint32 option_ptr; + SPOOL_NOTIFY_OPTION *option; } SPOOL_Q_RFNPCNEX; typedef struct spool_r_rfnpcnex { - uint32 count; + uint32 info_ptr; SPOOL_NOTIFY_INFO info; uint32 status; - } SPOOL_R_RFNPCNEX; /* Find Close Printer Notify */ -- cgit