summaryrefslogtreecommitdiffstats
path: root/source3/printing
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-07-03 02:05:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:58:10 -0500
commit22ea1952c8d74a1a54af5e507d124c1e30da067f (patch)
tree26d6c29acbd753240e6e28d967213bb39b4b3f64 /source3/printing
parent4d138157507a6ac6e80fb0d6b5742a6e2ceaaf12 (diff)
downloadsamba-22ea1952c8d74a1a54af5e507d124c1e30da067f.tar.gz
samba-22ea1952c8d74a1a54af5e507d124c1e30da067f.tar.xz
samba-22ea1952c8d74a1a54af5e507d124c1e30da067f.zip
r8089: successfully delete printer subkeys via the registry....now for values
(This used to be commit d3427960b0676c506c639b582a2544dc58990c9e)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 47e0af96334..b3a2ca5893b 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -2563,6 +2563,38 @@ int add_new_printer_key( NT_PRINTER_DATA *data, const char *name )
/****************************************************************************
search for a registry key name in the existing printer data
***************************************************************************/
+
+int delete_printer_key( NT_PRINTER_DATA *data, const char *name )
+{
+ int i;
+ NT_PRINTER_KEY *printer_key;
+
+ for ( i=0; i<data->num_keys; i++ ) {
+ if ( strequal( data->keys[i].name, name ) ) {
+
+ /* cleanup memory */
+
+ printer_key = &data->keys[i];
+ SAFE_FREE( printer_key->name );
+ regval_ctr_destroy( &printer_key->values );
+
+ /* if not the end of the array, move remaining elements down one slot */
+
+ data->num_keys--;
+ if ( data->num_keys && (i < data->num_keys) )
+ memmove( &data->keys[i], &data->keys[i+1], sizeof(NT_PRINTER_KEY)*(data->num_keys-i) );
+
+ break;
+ }
+ }
+
+
+ return data->num_keys;
+}
+
+/****************************************************************************
+ search for a registry key name in the existing printer data
+ ***************************************************************************/
int lookup_printerkey( NT_PRINTER_DATA *data, const char *name )
{