return WERR_OK;
}
+/**********************************************************************
+ convencience wrapper around rpccli_spoolss_GetPrinterDriver
+**********************************************************************/
+
+WERROR rpccli_spoolss_getprinterdriver(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle,
+ const char *architecture,
+ uint32_t level,
+ uint32_t offered,
+ union spoolss_DriverInfo *info)
+{
+ NTSTATUS status;
+ WERROR werror;
+ uint32_t needed;
+ DATA_BLOB buffer;
+
+ if (offered > 0) {
+ buffer = data_blob_talloc_zero(mem_ctx, offered);
+ W_ERROR_HAVE_NO_MEMORY(buffer.data);
+ }
+
+ status = rpccli_spoolss_GetPrinterDriver(cli, mem_ctx,
+ handle,
+ architecture,
+ level,
+ (offered > 0) ? &buffer : NULL,
+ offered,
+ info,
+ &needed,
+ &werror);
+ if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) {
+ offered = needed;
+ buffer = data_blob_talloc_zero(mem_ctx, needed);
+ W_ERROR_HAVE_NO_MEMORY(buffer.data);
+
+ status = rpccli_spoolss_GetPrinterDriver(cli, mem_ctx,
+ handle,
+ architecture,
+ level,
+ &buffer,
+ offered,
+ info,
+ &needed,
+ &werror);
+ }
+
+ return werror;
+}
+
/**********************************************************************
convencience wrapper around rpccli_spoolss_GetPrinterDriver2
**********************************************************************/
return werror;
}
-/*********************************************************************
- Decode various spoolss rpc's and info levels
- ********************************************************************/
-
/**********************************************************************
+ convencience wrapper around rpccli_spoolss_EnumPrinterKey
**********************************************************************/
-WERROR rpccli_spoolss_enumprinterdataex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *hnd, const char *keyname,
- REGVAL_CTR *ctr)
+WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle,
+ const char *key_name,
+ const char ***key_buffer,
+ uint32_t offered)
{
- prs_struct qbuf, rbuf;
- SPOOL_Q_ENUMPRINTERDATAEX in;
- SPOOL_R_ENUMPRINTERDATAEX out;
- int i;
- uint32 offered;
-
- ZERO_STRUCT(in);
- ZERO_STRUCT(out);
-
- offered = 0;
- make_spoolss_q_enumprinterdataex( &in, hnd, keyname, offered );
-
- CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMPRINTERDATAEX,
- in, out,
- qbuf, rbuf,
- spoolss_io_q_enumprinterdataex,
- spoolss_io_r_enumprinterdataex,
- WERR_GENERAL_FAILURE );
-
- if ( W_ERROR_EQUAL( out.status, WERR_MORE_DATA ) ) {
- offered = out.needed;
-
- ZERO_STRUCT(in);
- ZERO_STRUCT(out);
-
- make_spoolss_q_enumprinterdataex( &in, hnd, keyname, offered );
-
- CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMPRINTERDATAEX,
- in, out,
- qbuf, rbuf,
- spoolss_io_q_enumprinterdataex,
- spoolss_io_r_enumprinterdataex,
- WERR_GENERAL_FAILURE );
- }
-
- if (!W_ERROR_IS_OK(out.status))
- return out.status;
+ NTSTATUS status;
+ WERROR werror;
+ uint32_t needed;
- for (i = 0; i < out.returned; i++) {
- PRINTER_ENUM_VALUES *v = &out.ctr.values[i];
- fstring name;
+ status = rpccli_spoolss_EnumPrinterKey(cli, mem_ctx,
+ handle,
+ key_name,
+ key_buffer,
+ offered,
+ &needed,
+ &werror);
- rpcstr_pull(name, v->valuename.buffer, sizeof(name), -1,
- STR_TERMINATE);
- regval_ctr_addvalue(ctr, name, v->type, (const char *)v->data, v->data_len);
+ if (W_ERROR_EQUAL(werror, WERR_MORE_DATA)) {
+ offered = needed;
+
+ status = rpccli_spoolss_EnumPrinterKey(cli, mem_ctx,
+ handle,
+ key_name,
+ key_buffer,
+ offered,
+ &needed,
+ &werror);
}
- return out.status;
+ return werror;
}
/**********************************************************************
+ convencience wrapper around rpccli_spoolss_EnumPrinterDataEx
**********************************************************************/
-WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *hnd, const char *keyname,
- uint16 **keylist, uint32 *len)
+WERROR rpccli_spoolss_enumprinterdataex(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle,
+ const char *key_name,
+ uint32_t offered,
+ uint32_t *count,
+ struct spoolss_PrinterEnumValues **info)
{
- prs_struct qbuf, rbuf;
- SPOOL_Q_ENUMPRINTERKEY in;
- SPOOL_R_ENUMPRINTERKEY out;
- uint32 offered = 0;
-
- ZERO_STRUCT(in);
- ZERO_STRUCT(out);
-
- make_spoolss_q_enumprinterkey( &in, hnd, keyname, offered );
-
- CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMPRINTERKEY,
- in, out,
- qbuf, rbuf,
- spoolss_io_q_enumprinterkey,
- spoolss_io_r_enumprinterkey,
- WERR_GENERAL_FAILURE );
-
- if ( W_ERROR_EQUAL( out.status, WERR_MORE_DATA ) ) {
- offered = out.needed;
-
- ZERO_STRUCT(in);
- ZERO_STRUCT(out);
-
- make_spoolss_q_enumprinterkey( &in, hnd, keyname, offered );
-
- CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMPRINTERKEY,
- in, out,
- qbuf, rbuf,
- spoolss_io_q_enumprinterkey,
- spoolss_io_r_enumprinterkey,
- WERR_GENERAL_FAILURE );
- }
+ NTSTATUS status;
+ WERROR werror;
+ uint32_t needed;
+
+ status = rpccli_spoolss_EnumPrinterDataEx(cli, mem_ctx,
+ handle,
+ key_name,
+ offered,
+ count,
+ info,
+ &needed,
+ &werror);
- if ( !W_ERROR_IS_OK(out.status) )
- return out.status;
-
- if (keylist) {
- *keylist = SMB_MALLOC_ARRAY(uint16, out.keys.buf_len);
- if (!*keylist) {
- return WERR_NOMEM;
- }
- memcpy(*keylist, out.keys.buffer, out.keys.buf_len * 2);
- if (len)
- *len = out.keys.buf_len * 2;
+ if (W_ERROR_EQUAL(werror, WERR_MORE_DATA)) {
+ offered = needed;
+
+ status = rpccli_spoolss_EnumPrinterDataEx(cli, mem_ctx,
+ handle,
+ key_name,
+ offered,
+ count,
+ info,
+ &needed,
+ &werror);
}
- return out.status;
+ return werror;
}
-/** @} **/