From 18609ce1af72802accd1e5e85689db69e8b0c914 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 11 Jul 2005 16:55:10 +0000 Subject: [PATCH] r8322: * get RegSetValue() working for printer subkey values (not immediate values below the key yet. (This used to be commit a872ea5f0e29f7b585574a56b52a5eb44cb92278) --- source3/registry/reg_printing.c | 172 +++++++++++++++++++++++++++- source3/rpc_server/srv_spoolss_nt.c | 2 +- 2 files changed, 170 insertions(+), 4 deletions(-) diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c index 60ae68c6665..9a6d672211a 100644 --- a/source3/registry/reg_printing.c +++ b/source3/registry/reg_printing.c @@ -55,7 +55,6 @@ struct reg_dyn_tree { ********************************************************************* *********************************************************************/ - /********************************************************************** move to next non-delimter character *********************************************************************/ @@ -275,6 +274,7 @@ done: } /********************************************************************** + Take a printer name and call add_printer_hook() if necessary *********************************************************************/ static BOOL add_printers_by_registry( REGSUBKEY_CTR *subkeys ) @@ -497,23 +497,189 @@ done: return regval_ctr_numvals( values ); } +/********************************************************************** + *********************************************************************/ + +#define REG_IDX_ATTRIBUTES 1 +#define REG_IDX_PRIORITY 2 +#define REG_IDX_DEFAULT_PRIORITY 3 +#define REG_IDX_CHANGEID 4 +#define REG_IDX_STATUS 5 +#define REG_IDX_STARTTIME 6 +#define REG_IDX_NAME 7 +#define REG_IDX_LOCATION 8 +#define REG_IDX_DESCRIPTION 9 +#define REG_IDX_PARAMETERS 10 +#define REG_IDX_PORT 12 +#define REG_IDX_SHARENAME 13 +#define REG_IDX_DRIVER 14 +#define REG_IDX_SEP_FILE 15 +#define REG_IDX_PRINTPROC 16 +#define REG_IDX_DATATYPE 17 +#define REG_IDX_DEVMODE 18 +#define REG_IDX_SECDESC 19 +#define REG_IDX_UNTILTIME 20 + +struct { + const char *name; + int index; +} printer_values_map[] = { + { "Attributes", REG_IDX_ATTRIBUTES }, + { "Priority", REG_IDX_PRIORITY }, + { "Default Priority", REG_IDX_DEFAULT_PRIORITY }, + { "ChangeID", REG_IDX_CHANGEID }, + { "Status", REG_IDX_STATUS }, + { "StartTime", REG_IDX_STARTTIME }, + { "UntilTime", REG_IDX_UNTILTIME }, + { "Name", REG_IDX_NAME }, + { "Location", REG_IDX_LOCATION }, + { "Descrioption", REG_IDX_DESCRIPTION }, + { "Parameters", REG_IDX_PARAMETERS }, + { "Port", REG_IDX_PORT }, + { "Share Name", REG_IDX_SHARENAME }, + { "Printer Driver", REG_IDX_DRIVER }, + { "Separator File", REG_IDX_SEP_FILE }, + { "Print Processor", REG_IDX_PRINTPROC }, + { "Datatype", REG_IDX_DATATYPE }, + { "Default Devmode", REG_IDX_DEVMODE }, + { "Security", REG_IDX_SECDESC }, + { NULL, -1 } +}; + + +static int find_valuename_index( const char *valuename ) +{ + int i; + + for ( i=0; printer_values_map[i].name; i++ ) { + if ( strequal( valuename, printer_values_map[i].name ) ) + return printer_values_map[i].index; + } + + return -1; +} + +/********************************************************************** + *********************************************************************/ + +static void convert_values_to_printer_info_2( NT_PRINTER_INFO_LEVEL_2 *printer2, REGVAL_CTR *values ) +{ + int num_values = regval_ctr_numvals( values ); + uint32 value_index; + REGISTRY_VALUE *reg_value; + int i; + + for ( i=0; iinfo_2, values ); + } + else { + int num_values = regval_ctr_numvals( values ); + int i; + REGISTRY_VALUE *val; + + delete_printer_key( &printer->info_2->data, keyname ); + + /* deal with any subkeys */ + for ( i=0; iinfo_2, key, value );