cli_spoolss.c

来自「samba-3.0.22.tar.gz 编译smb服务器的源码」· C语言 代码 · 共 1,988 行 · 第 1/4 页

C
1,988
字号
}/********************************************************************************************************************************************/WERROR rpccli_spoolss_deleteprinterdriverex(struct rpc_pipe_client *cli,                                          TALLOC_CTX *mem_ctx, const char *arch,                                         const char *driver, int version){	prs_struct qbuf, rbuf;	SPOOL_Q_DELETEPRINTERDRIVEREX in;	SPOOL_R_DELETEPRINTERDRIVEREX out;	fstring server;	ZERO_STRUCT(in);	ZERO_STRUCT(out);	slprintf(server, sizeof(fstring)-1, "\\\\%s", cli->cli->desthost);	strupper_m(server);	make_spoolss_q_deleteprinterdriverex( mem_ctx, &in, server, arch, driver, version );	CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_DELETEPRINTERDRIVEREX,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_deleteprinterdriverex,	            spoolss_io_r_deleteprinterdriverex, 	            WERR_GENERAL_FAILURE );		    	return out.status;	}/********************************************************************************************************************************************/WERROR rpccli_spoolss_deleteprinterdriver (struct rpc_pipe_client *cli, 					TALLOC_CTX *mem_ctx, const char *arch,					const char *driver){	prs_struct qbuf, rbuf;	SPOOL_Q_DELETEPRINTERDRIVER in;        SPOOL_R_DELETEPRINTERDRIVER out;	fstring server;	ZERO_STRUCT(in);	ZERO_STRUCT(out);        slprintf(server, sizeof(fstring)-1, "\\\\%s", cli->cli->desthost);        strupper_m(server);	make_spoolss_q_deleteprinterdriver( mem_ctx, &in, server, arch, driver );	CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_DELETEPRINTERDRIVER,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_deleteprinterdriver,	            spoolss_io_r_deleteprinterdriver, 	            WERR_GENERAL_FAILURE );		    	return out.status;	}/********************************************************************************************************************************************/WERROR rpccli_spoolss_getprintprocessordirectory(struct rpc_pipe_client *cli,					      TALLOC_CTX *mem_ctx,					      char *name, char *environment,					      fstring procdir){	prs_struct qbuf, rbuf;	SPOOL_Q_GETPRINTPROCESSORDIRECTORY in;	SPOOL_R_GETPRINTPROCESSORDIRECTORY out;	int level = 1;	RPC_BUFFER buffer;	uint32 offered;	ZERO_STRUCT(in);	ZERO_STRUCT(out);	offered = 0;	rpcbuf_init(&buffer, offered, mem_ctx);	make_spoolss_q_getprintprocessordirectory( &in, name, 		environment, level, &buffer, offered );	CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_GETPRINTPROCESSORDIRECTORY,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_getprintprocessordirectory,	            spoolss_io_r_getprintprocessordirectory, 	            WERR_GENERAL_FAILURE );		    	if ( W_ERROR_EQUAL( out.status, WERR_INSUFFICIENT_BUFFER ) ) {		offered = out.needed;				ZERO_STRUCT(in);		ZERO_STRUCT(out);				rpcbuf_init(&buffer, offered, mem_ctx);		make_spoolss_q_getprintprocessordirectory( &in, name, 			environment, level, &buffer, offered );		CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_GETPRINTPROCESSORDIRECTORY,		            in, out, 		            qbuf, rbuf,		            spoolss_io_q_getprintprocessordirectory,		            spoolss_io_r_getprintprocessordirectory, 		            WERR_GENERAL_FAILURE );	}		if ( !W_ERROR_IS_OK(out.status) )		return out.status;		fstrcpy(procdir, "Not implemented!");		return out.status;}/********************************************************************************************************************************************/WERROR rpccli_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,			   POLICY_HND *handle, uint32 level, FORM *form){	prs_struct qbuf, rbuf;	SPOOL_Q_ADDFORM in;	SPOOL_R_ADDFORM out;	ZERO_STRUCT(in);	ZERO_STRUCT(out);        make_spoolss_q_addform( &in, handle, level, form );		CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_ADDFORM,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_addform,	            spoolss_io_r_addform, 	            WERR_GENERAL_FAILURE );	return out.status;}/********************************************************************************************************************************************/WERROR rpccli_spoolss_setform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,			   POLICY_HND *handle, uint32 level, 			   const char *form_name, FORM *form){	prs_struct qbuf, rbuf;	SPOOL_Q_SETFORM in;	SPOOL_R_SETFORM out;	ZERO_STRUCT(in);	ZERO_STRUCT(out);        make_spoolss_q_setform( &in, handle, level, form_name, form );		CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_SETFORM,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_setform,	            spoolss_io_r_setform, 	            WERR_GENERAL_FAILURE );	return out.status;}/********************************************************************************************************************************************/WERROR rpccli_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,			   POLICY_HND *handle, const char *formname, 			   uint32 level, FORM_1 *form){	prs_struct qbuf, rbuf;	SPOOL_Q_GETFORM in;	SPOOL_R_GETFORM out;	RPC_BUFFER buffer;	uint32 offered;	ZERO_STRUCT(in);	ZERO_STRUCT(out);	offered = 0;	rpcbuf_init(&buffer, offered, mem_ctx);	make_spoolss_q_getform( &in, handle, formname, level, &buffer, offered );		CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_GETFORM,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_getform,	            spoolss_io_r_getform, 	            WERR_GENERAL_FAILURE );		    	if ( W_ERROR_EQUAL( out.status, WERR_INSUFFICIENT_BUFFER ) ) {		offered = out.needed;				ZERO_STRUCT(in);		ZERO_STRUCT(out);				rpcbuf_init(&buffer, offered, mem_ctx);		make_spoolss_q_getform( &in, handle, formname, level, &buffer, offered );			CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_GETFORM,		            in, out, 		            qbuf, rbuf,		            spoolss_io_q_getform,		            spoolss_io_r_getform, 		            WERR_GENERAL_FAILURE );	}		if (!W_ERROR_IS_OK(out.status))		return out.status;	if (!smb_io_form_1("", out.buffer, form, 0)) {		return WERR_GENERAL_FAILURE;	}	return out.status;}/********************************************************************************************************************************************/WERROR rpccli_spoolss_deleteform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,			      POLICY_HND *handle, const char *form_name){	prs_struct qbuf, rbuf;	SPOOL_Q_DELETEFORM in;	SPOOL_R_DELETEFORM out;	ZERO_STRUCT(in);	ZERO_STRUCT(out);        make_spoolss_q_deleteform( &in, handle, form_name );		CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_DELETEFORM,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_deleteform,	            spoolss_io_r_deleteform, 	            WERR_GENERAL_FAILURE );		    	return out.status;}/********************************************************************************************************************************************/WERROR rpccli_spoolss_enumforms(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,			     POLICY_HND *handle, int level, uint32 *num_forms,			     FORM_1 **forms){	prs_struct qbuf, rbuf;	SPOOL_Q_ENUMFORMS in;	SPOOL_R_ENUMFORMS out;	RPC_BUFFER buffer;	uint32 offered;	ZERO_STRUCT(in);	ZERO_STRUCT(out);	offered = 0;	rpcbuf_init(&buffer, offered, mem_ctx);	make_spoolss_q_enumforms( &in, handle, level, &buffer, offered );	CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_ENUMFORMS,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_enumforms,	            spoolss_io_r_enumforms, 	            WERR_GENERAL_FAILURE );	if ( W_ERROR_EQUAL( out.status, WERR_INSUFFICIENT_BUFFER ) ) {		offered = out.needed;				ZERO_STRUCT(in);		ZERO_STRUCT(out);		rpcbuf_init(&buffer, offered, mem_ctx);		make_spoolss_q_enumforms( &in, handle, level, &buffer, offered );		CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_ENUMFORMS,		            in, out, 		            qbuf, rbuf,		            spoolss_io_q_enumforms,		            spoolss_io_r_enumforms, 		            WERR_GENERAL_FAILURE );	}	if (!W_ERROR_IS_OK(out.status))		return out.status;	*num_forms = out.numofforms;		if (!decode_forms_1(mem_ctx, out.buffer, *num_forms, forms)) {		return WERR_GENERAL_FAILURE;	}	return out.status;}/********************************************************************************************************************************************/WERROR rpccli_spoolss_enumjobs(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,			    POLICY_HND *hnd, uint32 level, uint32 firstjob, 			    uint32 num_jobs, uint32 *returned, JOB_INFO_CTR *ctr){	prs_struct qbuf, rbuf;	SPOOL_Q_ENUMJOBS in;	SPOOL_R_ENUMJOBS out;	RPC_BUFFER buffer;	uint32 offered;	ZERO_STRUCT(in);	ZERO_STRUCT(out);	offered = 0;	rpcbuf_init(&buffer, offered, mem_ctx);	make_spoolss_q_enumjobs( &in, hnd, firstjob, num_jobs, level, 		&buffer, offered );	CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_ENUMJOBS,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_enumjobs,	            spoolss_io_r_enumjobs, 	            WERR_GENERAL_FAILURE );	if ( W_ERROR_EQUAL( out.status, WERR_INSUFFICIENT_BUFFER ) ) {		offered = out.needed;				ZERO_STRUCT(in);		ZERO_STRUCT(out);		rpcbuf_init(&buffer, offered, mem_ctx);		make_spoolss_q_enumjobs( &in, hnd, firstjob, num_jobs, level, 			&buffer, offered );		CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_ENUMJOBS,		            in, out, 		            qbuf, rbuf,		            spoolss_io_q_enumjobs,		            spoolss_io_r_enumjobs, 		            WERR_GENERAL_FAILURE );	}	if (!W_ERROR_IS_OK(out.status))		return out.status;			switch(level) {	case 1:		if (!decode_jobs_1(mem_ctx, out.buffer, out.returned, &ctr->job.job_info_1)) {			return WERR_GENERAL_FAILURE;		}		break;	case 2:		if (!decode_jobs_2(mem_ctx, out.buffer, out.returned, &ctr->job.job_info_2)) {			return WERR_GENERAL_FAILURE;		}		break;	default:		DEBUG(3, ("unsupported info level %d", level));		return WERR_UNKNOWN_LEVEL;	}		*returned = out.returned;	return out.status;}/********************************************************************************************************************************************/WERROR rpccli_spoolss_setjob(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,			  POLICY_HND *hnd, uint32 jobid, uint32 level, 			  uint32 command){	prs_struct qbuf, rbuf;	SPOOL_Q_SETJOB in;	SPOOL_R_SETJOB out;	ZERO_STRUCT(in);	ZERO_STRUCT(out);        make_spoolss_q_setjob( &in, hnd, jobid, level, command );	CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_SETJOB,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_setjob,	            spoolss_io_r_setjob, 	            WERR_GENERAL_FAILURE );		    	return out.status;}/********************************************************************************************************************************************/WERROR rpccli_spoolss_getjob(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,			  POLICY_HND *hnd, uint32 jobid, uint32 level,			  JOB_INFO_CTR *ctr){	prs_struct qbuf, rbuf;	SPOOL_Q_GETJOB in;	SPOOL_R_GETJOB out;	RPC_BUFFER buffer;	uint32 offered;	ZERO_STRUCT(in);	ZERO_STRUCT(out);	offered = 0;	rpcbuf_init(&buffer, offered, mem_ctx);	make_spoolss_q_getjob( &in, hnd, jobid, level, &buffer, offered );	CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_GETJOB,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_getjob,	            spoolss_io_r_getjob, 	            WERR_GENERAL_FAILURE );	if ( W_ERROR_EQUAL( out.status, WERR_MORE_DATA ) ) {		offered = out.needed;				ZERO_STRUCT(in);		ZERO_STRUCT(out);				rpcbuf_init(&buffer, offered, mem_ctx);		make_spoolss_q_getjob( &in, hnd, jobid, level, &buffer, offered );		CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_GETJOB,		            in, out, 		            qbuf, rbuf,		            spoolss_io_q_getjob,		            spoolss_io_r_getjob, 		            WERR_GENERAL_FAILURE );	}	if (!W_ERROR_IS_OK(out.status))		return out.status;	switch(level) {	case 1:		if (!decode_jobs_1(mem_ctx, out.buffer, 1, &ctr->job.job_info_1)) {			return WERR_GENERAL_FAILURE;		}		break;	case 2:		if (!decode_jobs_2(mem_ctx, out.buffer, 1, &ctr->job.job_info_2)) {			return WERR_GENERAL_FAILURE;		}		break;	default:		return WERR_UNKNOWN_LEVEL;	}	return out.status;}/********************************************************************************************************************************************/WERROR rpccli_spoolss_startpageprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,				    POLICY_HND *hnd){	prs_struct qbuf, rbuf;	SPOOL_Q_STARTPAGEPRINTER in;	SPOOL_R_STARTPAGEPRINTER out;	ZERO_STRUCT(in);	ZERO_STRUCT(out);        make_spoolss_q_startpageprinter( &in, hnd );	CLI_DO_RPC_WERR( cli, mem_ctx, PI_SPOOLSS, SPOOLSS_STARTPAGEPRINTER,	            in, out, 	            qbuf, rbuf,	            spoolss_io_q_startpageprinter,	            spoolss_io_r_startpageprinter, 	            WERR_GENERAL_FAILURE );		    	return out.status;}/********************************************************************************************************************************************/WERROR rpccli_spoolss_endpageprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,				  POLICY_HND *hnd){	prs_struct qbuf, rbuf;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?