parse_spoolss.c
来自「samba-3.0.22.tar.gz 编译smb服务器的源码」· C语言 代码 · 共 2,230 行 · 第 1/5 页
C
2,230 行
prs_debug(ps, depth, desc, "spoolss_io_q_startpageprinter"); depth++; if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; return True;}/******************************************************************* * write a structure. * called from spoolss_r_startpageprinter (srv_spoolss.c) ********************************************************************/BOOL spoolss_io_r_startpageprinter(const char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth){ prs_debug(ps, depth, desc, "spoolss_io_r_startpageprinter"); depth++; if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True;}/******************************************************************* * read a structure. * called from spoolss_q_endpageprinter (srv_spoolss.c) ********************************************************************/BOOL spoolss_io_q_endpageprinter(const char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth){ if (q_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_q_endpageprinter"); depth++; if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; return True;}/******************************************************************* * write a structure. * called from spoolss_r_endpageprinter (srv_spoolss.c) ********************************************************************/BOOL spoolss_io_r_endpageprinter(const char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth){ prs_debug(ps, depth, desc, "spoolss_io_r_endpageprinter"); depth++; if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True;}/******************************************************************* * read a structure. * called from spoolss_q_writeprinter (srv_spoolss.c) ********************************************************************/BOOL spoolss_io_q_writeprinter(const char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth){ if (q_u == NULL) return False; prs_debug(ps, depth, desc, "spoolss_io_q_writeprinter"); depth++; if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth)) return False; if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) return False; if (q_u->buffer_size!=0) { if (UNMARSHALLING(ps)) q_u->buffer=PRS_ALLOC_MEM(ps, uint8, q_u->buffer_size); if(q_u->buffer == NULL) return False; if(!prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size)) return False; } if(!prs_align(ps)) return False; if(!prs_uint32("buffer_size2", ps, depth, &q_u->buffer_size2)) return False; return True;}/******************************************************************* * write a structure. * called from spoolss_r_writeprinter (srv_spoolss.c) ********************************************************************/BOOL spoolss_io_r_writeprinter(const char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth){ prs_debug(ps, depth, desc, "spoolss_io_r_writeprinter"); depth++; if(!prs_uint32("buffer_written", ps, depth, &r_u->buffer_written)) return False; if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True;}/******************************************************************* * read a structure. * called from spoolss_q_rffpcnex (srv_spoolss.c) ********************************************************************/BOOL spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth){ prs_debug(ps, depth, desc, "spoolss_io_q_rffpcnex"); depth++; if(!prs_align(ps)) return False; if(!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) return False; if(!prs_uint32("flags", ps, depth, &q_u->flags)) return False; if(!prs_uint32("options", ps, depth, &q_u->options)) return False; if(!prs_uint32("localmachine_ptr", ps, depth, &q_u->localmachine_ptr)) return False; if(!smb_io_unistr2("localmachine", &q_u->localmachine, q_u->localmachine_ptr, ps, depth)) return False; if(!prs_align(ps)) return False; if(!prs_uint32("printerlocal", ps, depth, &q_u->printerlocal)) return False; if(!prs_uint32("option_ptr", ps, depth, &q_u->option_ptr)) 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)) return False; return True;}/******************************************************************* * read a structure. * called from spoolss_q_rfnpcnex (srv_spoolss.c) ********************************************************************/BOOL spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth){ prs_debug(ps, depth, desc, "spoolss_io_q_rfnpcnex"); 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", ps, depth, &q_u->change)) return False; if(!prs_uint32("option_ptr", ps, depth, &q_u->option_ptr)) 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_rfnpcnex (srv_spoolss.c) ********************************************************************/BOOL spoolss_io_r_rfnpcnex(const char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth){ prs_debug(ps, depth, desc, "spoolss_io_r_rfnpcnex"); depth++; if(!prs_align(ps)) return False; if (!prs_uint32("info_ptr", ps, depth, &r_u->info_ptr)) return False; if(!smb_io_notify_info("notify info", &r_u->info ,ps,depth)) return False; if(!prs_align(ps)) return False; if(!prs_werror("status", ps, depth, &r_u->status)) return False; return True;}/******************************************************************* * return the length of a uint16 (obvious, but the code is clean) ********************************************************************/static uint32 size_of_uint16(uint16 *value){ return (sizeof(*value));}/******************************************************************* * return the length of a uint32 (obvious, but the code is clean) ********************************************************************/static uint32 size_of_uint32(uint32 *value){ return (sizeof(*value));}/******************************************************************* * return the length of a NTTIME (obvious, but the code is clean) ********************************************************************/static uint32 size_of_nttime(NTTIME *value){ return (sizeof(*value));}/******************************************************************* * return the length of a uint32 (obvious, but the code is clean) ********************************************************************/static uint32 size_of_device_mode(DEVICEMODE *devmode){ if (devmode==NULL) return (4); else return (4+devmode->size+devmode->driverextra);}/******************************************************************* * return the length of a uint32 (obvious, but the code is clean) ********************************************************************/static uint32 size_of_systemtime(SYSTEMTIME *systime){ if (systime==NULL) return (4); else return (sizeof(SYSTEMTIME) +4);}/******************************************************************* Parse a DEVMODE structure and its relative pointer.********************************************************************/static BOOL smb_io_reldevmode(const char *desc, RPC_BUFFER *buffer, int depth, DEVICEMODE **devmode){ prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "smb_io_reldevmode"); 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); 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; /* 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;}/******************************************************************* Parse a PRINTER_INFO_0 structure.********************************************************************/ BOOL smb_io_printer_info_0(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_0 *info, int depth){ prs_struct *ps=&buffer->prs; prs_debug(ps, depth, desc, "smb_io_printer_info_0"); 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("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)) 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; 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_u
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?