Some comments about the format of the on-disk reg file, as well as
[Samba/gebeck_regimport.git] / source3 / registry / reg_printing.c
blob50ac81dcbb2042a0222a6bc5c9456e842c1119c1
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Gerald Carter 2002.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 /* Implementation of registry virtual views for printing information */
23 #include "includes.h"
25 #undef DBGC_CLASS
26 #define DBGC_CLASS DBGC_RPC_SRV
28 #define MAX_TOP_LEVEL_KEYS 3
30 /* some symbolic indexes into the top_level_keys */
32 #define KEY_INDEX_ENVIR 0
33 #define KEY_INDEX_FORMS 1
34 #define KEY_INDEX_PRINTER 2
36 static const char *top_level_keys[MAX_TOP_LEVEL_KEYS] = {
37 "Environments",
38 "Forms",
39 "Printers"
43 /**********************************************************************
44 It is safe to assume that every registry path passed into on of
45 the exported functions here begins with KEY_PRINTING else
46 these functions would have never been called. This is a small utility
47 function to strip the beginning of the path and make a copy that the
48 caller can modify. Note that the caller is responsible for releasing
49 the memory allocated here.
50 **********************************************************************/
52 static char* trim_reg_path( char *path )
54 char *p;
55 uint16 key_len = strlen(KEY_PRINTING);
57 /*
58 * sanity check...this really should never be True.
59 * It is only here to prevent us from accessing outside
60 * the path buffer in the extreme case.
63 if ( strlen(path) < key_len ) {
64 DEBUG(0,("trim_reg_path: Registry path too short! [%s]\n", path));
65 DEBUG(0,("trim_reg_path: KEY_PRINTING => [%s]!\n", KEY_PRINTING));
66 return NULL;
70 p = path + strlen( KEY_PRINTING );
72 if ( *p == '\\' )
73 p++;
75 if ( *p )
76 return strdup(p);
77 else
78 return NULL;
81 /**********************************************************************
82 handle enumeration of subkeys below KEY_PRINTING\Environments
83 *********************************************************************/
85 static int print_subpath_environments( char *key, REGSUBKEY_CTR *subkeys )
87 const char *environments[] = {
88 "Windows 4.0",
89 "Windows NT x86",
90 "Windows NT R4000",
91 "Windows NT Alpha_AXP",
92 "Windows NT PowerPC",
93 NULL };
94 fstring *drivers = NULL;
95 int i, env_index, num_drivers;
96 BOOL valid_env = False;
97 char *base, *new_path;
98 char *keystr;
99 char *key2 = NULL;
100 int num_subkeys = -1;
102 DEBUG(10,("print_subpath_environments: key=>[%s]\n", key ? key : "NULL" ));
104 /* listed architectures of installed drivers */
106 if ( !key )
108 /* Windows 9x drivers */
110 if ( get_ntdrivers( &drivers, environments[0], 0 ) )
111 regsubkey_ctr_addkey( subkeys, environments[0] );
112 SAFE_FREE( drivers );
114 /* Windows NT/2k intel drivers */
116 if ( get_ntdrivers( &drivers, environments[1], 2 )
117 || get_ntdrivers( &drivers, environments[1], 3 ) )
119 regsubkey_ctr_addkey( subkeys, environments[1] );
121 SAFE_FREE( drivers );
123 /* Windows NT 4.0; non-intel drivers */
124 for ( i=2; environments[i]; i++ ) {
125 if ( get_ntdrivers( &drivers, environments[i], 2 ) )
126 regsubkey_ctr_addkey( subkeys, environments[i] );
129 SAFE_FREE( drivers );
131 num_subkeys = regsubkey_ctr_numkeys( subkeys );
132 goto done;
135 /* we are dealing with a subkey of "Environments */
137 key2 = strdup( key );
138 keystr = key2;
139 reg_split_path( keystr, &base, &new_path );
141 /* sanity check */
143 for ( env_index=0; environments[env_index]; env_index++ ) {
144 if ( StrCaseCmp( environments[env_index], base ) == 0 ) {
145 valid_env = True;
146 break;
150 if ( !valid_env )
151 return -1;
153 /* enumerate driver versions; environment is environments[env_index] */
155 if ( !new_path ) {
156 switch ( env_index ) {
157 case 0: /* Win9x */
158 if ( get_ntdrivers( &drivers, environments[0], 0 ) ) {
159 regsubkey_ctr_addkey( subkeys, "0" );
160 SAFE_FREE( drivers );
162 break;
163 case 1: /* Windows NT/2k - intel */
164 if ( get_ntdrivers( &drivers, environments[1], 2 ) ) {
165 regsubkey_ctr_addkey( subkeys, "2" );
166 SAFE_FREE( drivers );
168 if ( get_ntdrivers( &drivers, environments[1], 3 ) ) {
169 regsubkey_ctr_addkey( subkeys, "3" );
170 SAFE_FREE( drivers );
172 break;
173 default: /* Windows NT - nonintel */
174 if ( get_ntdrivers( &drivers, environments[env_index], 2 ) ) {
175 regsubkey_ctr_addkey( subkeys, "2" );
176 SAFE_FREE( drivers );
181 num_subkeys = regsubkey_ctr_numkeys( subkeys );
182 goto done;
185 /* we finally get to enumerate the drivers */
187 keystr = new_path;
188 reg_split_path( keystr, &base, &new_path );
190 if ( !new_path ) {
191 num_drivers = get_ntdrivers( &drivers, environments[env_index], atoi(base) );
192 for ( i=0; i<num_drivers; i++ )
193 regsubkey_ctr_addkey( subkeys, drivers[i] );
195 num_subkeys = regsubkey_ctr_numkeys( subkeys );
196 goto done;
199 done:
200 SAFE_FREE( key2 );
202 return num_subkeys;
205 /***********************************************************************
206 simple function to prune a pathname down to the basename of a file
207 **********************************************************************/
209 static char* dos_basename ( char *path )
211 char *p;
213 p = strrchr( path, '\\' );
214 if ( p )
215 p++;
216 else
217 p = path;
219 return p;
222 /**********************************************************************
223 handle enumeration of values below
224 KEY_PRINTING\Environments\<arch>\<version>\<drivername>
225 *********************************************************************/
227 static int print_subpath_values_environments( char *key, REGVAL_CTR *val )
229 char *keystr;
230 char *key2 = NULL;
231 char *base, *new_path;
232 fstring env;
233 fstring driver;
234 int version;
235 NT_PRINTER_DRIVER_INFO_LEVEL driver_ctr;
236 NT_PRINTER_DRIVER_INFO_LEVEL_3 *info3;
237 WERROR w_result;
238 char *buffer = NULL;
239 char *buffer2 = NULL;
240 int buffer_size = 0;
241 int i, length;
242 char *filename;
243 UNISTR2 data;;
245 DEBUG(8,("print_subpath_values_environments: Enter key => [%s]\n", key ? key : "NULL"));
247 if ( !key )
248 return 0;
251 * The only key below KEY_PRINTING\Environments that
252 * posseses values is each specific printer driver
253 * First get the arch, version, & driver name
256 /* env */
258 key2 = strdup( key );
259 keystr = key2;
260 reg_split_path( keystr, &base, &new_path );
261 if ( !base || !new_path )
262 return 0;
263 fstrcpy( env, base );
265 /* version */
267 keystr = new_path;
268 reg_split_path( keystr, &base, &new_path );
269 if ( !base || !new_path )
270 return 0;
271 version = atoi( base );
273 /* printer driver name */
275 keystr = new_path;
276 reg_split_path( keystr, &base, &new_path );
277 /* new_path should be NULL here since this must be the last key */
278 if ( !base || new_path )
279 return 0;
280 fstrcpy( driver, base );
282 w_result = get_a_printer_driver( &driver_ctr, 3, driver, env, version );
284 if ( !W_ERROR_IS_OK(w_result) )
285 return -1;
287 /* build the values out of the driver information */
288 info3 = driver_ctr.info_3;
290 filename = dos_basename( info3->driverpath );
291 init_unistr2( &data, filename, strlen(filename)+1 );
292 regval_ctr_addvalue( val, "Driver", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
294 filename = dos_basename( info3->configfile );
295 init_unistr2( &data, filename, strlen(filename)+1 );
296 regval_ctr_addvalue( val, "Configuration File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
298 filename = dos_basename( info3->datafile );
299 init_unistr2( &data, filename, strlen(filename)+1 );
300 regval_ctr_addvalue( val, "Data File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
302 filename = dos_basename( info3->helpfile );
303 init_unistr2( &data, filename, strlen(filename)+1 );
304 regval_ctr_addvalue( val, "Help File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
306 init_unistr2( &data, info3->defaultdatatype, strlen(info3->defaultdatatype)+1 );
307 regval_ctr_addvalue( val, "Data Type", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
309 regval_ctr_addvalue( val, "Version", REG_DWORD, (char*)&info3->cversion, sizeof(info3->cversion) );
311 if ( info3->dependentfiles )
313 /* place the list of dependent files in a single
314 character buffer, separating each file name by
315 a NULL */
317 for ( i=0; strcmp(info3->dependentfiles[i], ""); i++ )
319 /* strip the path to only the file's base name */
321 filename = dos_basename( info3->dependentfiles[i] );
323 length = strlen(filename);
325 buffer2 = Realloc( buffer, buffer_size + (length + 1)*sizeof(uint16) );
326 if ( !buffer2 )
327 break;
328 buffer = buffer2;
330 init_unistr2( &data, filename, length+1 );
331 memcpy( buffer+buffer_size, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
333 buffer_size += (length + 1)*sizeof(uint16);
336 /* terminated by double NULL. Add the final one here */
338 buffer2 = Realloc( buffer, buffer_size + 2 );
339 if ( !buffer2 ) {
340 SAFE_FREE( buffer );
341 buffer_size = 0;
343 else {
344 buffer = buffer2;
345 buffer[buffer_size++] = '\0';
346 buffer[buffer_size++] = '\0';
350 regval_ctr_addvalue( val, "Dependent Files", REG_MULTI_SZ, buffer, buffer_size );
352 free_a_printer_driver( driver_ctr, 3 );
354 SAFE_FREE( key2 );
355 SAFE_FREE( buffer );
357 DEBUG(8,("print_subpath_values_environments: Exit\n"));
359 return regval_ctr_numvals( val );
363 /**********************************************************************
364 handle enumeration of subkeys below KEY_PRINTING\Forms
365 Really just a stub function, but left here in case it needs to
366 be expanded later on
367 *********************************************************************/
369 static int print_subpath_forms( char *key, REGSUBKEY_CTR *subkeys )
371 DEBUG(10,("print_subpath_forms: key=>[%s]\n", key ? key : "NULL" ));
373 /* there are no subkeys */
375 if ( key )
376 return -1;
378 return 0;
381 /**********************************************************************
382 handle enumeration of values below KEY_PRINTING\Forms
383 *********************************************************************/
385 static int print_subpath_values_forms( char *key, REGVAL_CTR *val )
387 int num_values = 0;
388 uint32 data[8];
389 int form_index = 1;
391 DEBUG(10,("print_values_forms: key=>[%s]\n", key ? key : "NULL" ));
393 /* handle ..\Forms\ */
395 if ( !key )
397 nt_forms_struct *forms_list = NULL;
398 nt_forms_struct *form = NULL;
399 int i;
401 if ( (num_values = get_ntforms( &forms_list )) == 0 )
402 return 0;
404 DEBUG(10,("print_subpath_values_forms: [%d] user defined forms returned\n",
405 num_values));
407 /* handle user defined forms */
409 for ( i=0; i<num_values; i++ )
411 form = &forms_list[i];
413 data[0] = form->width;
414 data[1] = form->length;
415 data[2] = form->left;
416 data[3] = form->top;
417 data[4] = form->right;
418 data[5] = form->bottom;
419 data[6] = form_index++;
420 data[7] = form->flag;
422 regval_ctr_addvalue( val, form->name, REG_BINARY, (char*)data, sizeof(data) );
426 SAFE_FREE( forms_list );
427 forms_list = NULL;
429 /* handle built-on forms */
431 if ( (num_values = get_builtin_ntforms( &forms_list )) == 0 )
432 return 0;
434 DEBUG(10,("print_subpath_values_forms: [%d] built-in forms returned\n",
435 num_values));
437 for ( i=0; i<num_values; i++ )
439 form = &forms_list[i];
441 data[0] = form->width;
442 data[1] = form->length;
443 data[2] = form->left;
444 data[3] = form->top;
445 data[4] = form->right;
446 data[5] = form->bottom;
447 data[6] = form_index++;
448 data[7] = form->flag;
450 regval_ctr_addvalue( val, form->name, REG_BINARY, (char*)data, sizeof(data) );
453 SAFE_FREE( forms_list );
456 return num_values;
459 /**********************************************************************
460 handle enumeration of subkeys below KEY_PRINTING\Printers
461 *********************************************************************/
463 static int print_subpath_printers( char *key, REGSUBKEY_CTR *subkeys )
465 int n_services = lp_numservices();
466 int snum;
467 fstring sname;
468 int i;
469 int num_subkeys = 0;
470 char *keystr, *key2 = NULL;
471 char *base, *new_path;
472 NT_PRINTER_INFO_LEVEL *printer = NULL;
473 fstring *subkey_names = NULL;
475 DEBUG(10,("print_subpath_printers: key=>[%s]\n", key ? key : "NULL" ));
477 if ( !key )
479 /* enumerate all printers */
481 for (snum=0; snum<n_services; snum++) {
482 if ( !(lp_snum_ok(snum) && lp_print_ok(snum) ) )
483 continue;
485 fstrcpy( sname, lp_servicename(snum) );
487 regsubkey_ctr_addkey( subkeys, sname );
490 num_subkeys = regsubkey_ctr_numkeys( subkeys );
491 goto done;
494 /* get information for a specific printer */
496 key2 = strdup( key );
497 keystr = key2;
498 reg_split_path( keystr, &base, &new_path );
500 if ( !W_ERROR_IS_OK( get_a_printer(NULL, &printer, 2, base) ) )
501 goto done;
503 num_subkeys = get_printer_subkeys( &printer->info_2->data, new_path?new_path:"", &subkey_names );
505 for ( i=0; i<num_subkeys; i++ )
506 regsubkey_ctr_addkey( subkeys, subkey_names[i] );
508 free_a_printer( &printer, 2 );
510 /* no other subkeys below here */
512 done:
513 SAFE_FREE( key2 );
514 SAFE_FREE( subkey_names );
516 return num_subkeys;
519 /**********************************************************************
520 handle enumeration of values below KEY_PRINTING\Printers
521 *********************************************************************/
523 static int print_subpath_values_printers( char *key, REGVAL_CTR *val )
525 int num_values = 0;
526 char *keystr, *key2 = NULL;
527 char *base, *new_path;
528 NT_PRINTER_INFO_LEVEL *printer = NULL;
529 NT_PRINTER_INFO_LEVEL_2 *info2;
530 DEVICEMODE *devmode;
531 prs_struct prs;
532 uint32 offset;
533 int snum;
534 fstring printername;
535 NT_PRINTER_DATA *p_data;
536 int i, key_index;
537 UNISTR2 data;
540 * Theres are tw cases to deal with here
541 * (1) enumeration of printer_info_2 values
542 * (2) enumeration of the PrinterDriverData subney
545 if ( !key ) {
546 /* top level key has no values */
547 goto done;
550 key2 = strdup( key );
551 keystr = key2;
552 reg_split_path( keystr, &base, &new_path );
554 fstrcpy( printername, base );
556 if ( !new_path )
558 /* we are dealing with the printer itself */
560 if ( !W_ERROR_IS_OK( get_a_printer(NULL, &printer, 2, printername) ) )
561 goto done;
563 info2 = printer->info_2;
566 regval_ctr_addvalue( val, "Attributes", REG_DWORD, (char*)&info2->attributes, sizeof(info2->attributes) );
567 regval_ctr_addvalue( val, "Priority", REG_DWORD, (char*)&info2->priority, sizeof(info2->attributes) );
568 regval_ctr_addvalue( val, "ChangeID", REG_DWORD, (char*)&info2->changeid, sizeof(info2->changeid) );
569 regval_ctr_addvalue( val, "Default Priority", REG_DWORD, (char*)&info2->default_priority, sizeof(info2->default_priority) );
570 regval_ctr_addvalue( val, "Status", REG_DWORD, (char*)&info2->status, sizeof(info2->status) );
571 regval_ctr_addvalue( val, "StartTime", REG_DWORD, (char*)&info2->starttime, sizeof(info2->starttime) );
572 regval_ctr_addvalue( val, "UntilTime", REG_DWORD, (char*)&info2->untiltime, sizeof(info2->untiltime) );
573 regval_ctr_addvalue( val, "cjobs", REG_DWORD, (char*)&info2->cjobs, sizeof(info2->cjobs) );
574 regval_ctr_addvalue( val, "AveragePPM", REG_DWORD, (char*)&info2->averageppm, sizeof(info2->averageppm) );
576 init_unistr2( &data, info2->printername, strlen(info2->printername)+1 );
577 regval_ctr_addvalue( val, "Name", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
578 init_unistr2( &data, info2->location, strlen(info2->location)+1 );
579 regval_ctr_addvalue( val, "Location", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
580 init_unistr2( &data, info2->comment, strlen(info2->comment)+1 );
581 regval_ctr_addvalue( val, "Comment", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
582 init_unistr2( &data, info2->parameters, strlen(info2->parameters)+1 );
583 regval_ctr_addvalue( val, "Parameters", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
584 init_unistr2( &data, info2->portname, strlen(info2->portname)+1 );
585 regval_ctr_addvalue( val, "Port", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
586 init_unistr2( &data, info2->servername, strlen(info2->servername)+1 );
587 regval_ctr_addvalue( val, "Server", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
588 init_unistr2( &data, info2->sharename, strlen(info2->sharename)+1 );
589 regval_ctr_addvalue( val, "Share", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
590 init_unistr2( &data, info2->drivername, strlen(info2->drivername)+1 );
591 regval_ctr_addvalue( val, "Driver", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
592 init_unistr2( &data, info2->sepfile, strlen(info2->sepfile)+1 );
593 regval_ctr_addvalue( val, "Separator File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
594 init_unistr2( &data, "winprint", strlen("winprint")+1 );
595 regval_ctr_addvalue( val, "Print Processor", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
598 /* use a prs_struct for converting the devmode and security
599 descriptor to REG_BIARY */
601 prs_init( &prs, MAX_PDU_FRAG_LEN, regval_ctr_getctx(val), MARSHALL);
603 /* stream the device mode */
605 snum = lp_servicenumber(info2->sharename);
606 if ( (devmode = construct_dev_mode( snum )) != NULL )
608 if ( spoolss_io_devmode( "devmode", &prs, 0, devmode ) ) {
610 offset = prs_offset( &prs );
612 regval_ctr_addvalue( val, "Default Devmode", REG_BINARY, prs_data_p(&prs), offset );
618 prs_mem_clear( &prs );
619 prs_set_offset( &prs, 0 );
621 if ( info2->secdesc_buf && info2->secdesc_buf->len )
623 if ( sec_io_desc("sec_desc", &info2->secdesc_buf->sec, &prs, 0 ) ) {
625 offset = prs_offset( &prs );
627 regval_ctr_addvalue( val, "Security", REG_BINARY, prs_data_p(&prs), offset );
631 prs_mem_free( &prs );
633 num_values = regval_ctr_numvals( val );
635 goto done;
639 /* now enumerate the key */
641 if ( !W_ERROR_IS_OK( get_a_printer(NULL, &printer, 2, printername) ) )
642 goto done;
644 /* iterate over all printer data and fill the regval container */
646 p_data = &printer->info_2->data;
647 if ( (key_index = lookup_printerkey( p_data, new_path )) == -1 ) {
648 DEBUG(10,("print_subpath_values_printer: Unknown keyname [%s]\n", new_path));
649 goto done;
652 num_values = regval_ctr_numvals( &p_data->keys[key_index].values );
654 for ( i=0; i<num_values; i++ )
655 regval_ctr_copyvalue( val, regval_ctr_specific_value(&p_data->keys[key_index].values, i) );
658 done:
659 if ( printer )
660 free_a_printer( &printer, 2 );
662 SAFE_FREE( key2 );
664 return num_values;
667 /**********************************************************************
668 Routine to handle enumeration of subkeys and values
669 below KEY_PRINTING (depending on whether or not subkeys/val are
670 valid pointers.
671 *********************************************************************/
673 static int handle_printing_subpath( char *key, REGSUBKEY_CTR *subkeys, REGVAL_CTR *val )
675 int result = 0;
676 char *p, *base;
677 int i;
679 DEBUG(10,("handle_printing_subpath: key=>[%s]\n", key ));
682 * break off the first part of the path
683 * topmost base **must** be one of the strings
684 * in top_level_keys[]
687 reg_split_path( key, &base, &p);
689 for ( i=0; i<MAX_TOP_LEVEL_KEYS; i++ ) {
690 if ( StrCaseCmp( top_level_keys[i], base ) == 0 )
691 break;
694 DEBUG(10,("handle_printing_subpath: base=>[%s], i==[%d]\n", base, i));
696 if ( !(i < MAX_TOP_LEVEL_KEYS) )
697 return -1;
699 /* Call routine to handle each top level key */
700 switch ( i )
702 case KEY_INDEX_ENVIR:
703 if ( subkeys )
704 print_subpath_environments( p, subkeys );
705 if ( val )
706 print_subpath_values_environments( p, val );
707 break;
709 case KEY_INDEX_FORMS:
710 if ( subkeys )
711 print_subpath_forms( p, subkeys );
712 if ( val )
713 print_subpath_values_forms( p, val );
714 break;
716 case KEY_INDEX_PRINTER:
717 if ( subkeys )
718 print_subpath_printers( p, subkeys );
719 if ( val )
720 print_subpath_values_printers( p, val );
721 break;
723 /* default case for top level key that has no handler */
725 default:
726 break;
731 return result;
734 /**********************************************************************
735 Enumerate registry subkey names given a registry path.
736 Caller is responsible for freeing memory to **subkeys
737 *********************************************************************/
739 int printing_subkey_info( char *key, REGSUBKEY_CTR *subkey_ctr )
741 char *path;
742 BOOL top_level = False;
743 int num_subkeys = 0;
745 DEBUG(10,("printing_subkey_info: key=>[%s]\n", key));
747 path = trim_reg_path( key );
749 /* check to see if we are dealing with the top level key */
751 if ( !path )
752 top_level = True;
754 if ( top_level ) {
755 for ( num_subkeys=0; num_subkeys<MAX_TOP_LEVEL_KEYS; num_subkeys++ )
756 regsubkey_ctr_addkey( subkey_ctr, top_level_keys[num_subkeys] );
758 else
759 num_subkeys = handle_printing_subpath( path, subkey_ctr, NULL );
761 SAFE_FREE( path );
763 return num_subkeys;
766 /**********************************************************************
767 Enumerate registry values given a registry path.
768 Caller is responsible for freeing memory
769 *********************************************************************/
771 int printing_value_info( char *key, REGVAL_CTR *val )
773 char *path;
774 BOOL top_level = False;
775 int num_values = 0;
777 DEBUG(10,("printing_value_info: key=>[%s]\n", key));
779 path = trim_reg_path( key );
781 /* check to see if we are dealing with the top level key */
783 if ( !path )
784 top_level = True;
786 /* fill in values from the getprinterdata_printer_server() */
787 if ( top_level )
788 num_values = 0;
789 else
790 num_values = handle_printing_subpath( path, NULL, val );
793 return num_values;
796 /**********************************************************************
797 Stub function which always returns failure since we don't want
798 people storing printing information directly via regostry calls
799 (for now at least)
800 *********************************************************************/
802 BOOL printing_store_subkey( char *key, REGSUBKEY_CTR *subkeys )
804 return False;
807 /**********************************************************************
808 Stub function which always returns failure since we don't want
809 people storing printing information directly via regostry calls
810 (for now at least)
811 *********************************************************************/
813 BOOL printing_store_value( char *key, REGVAL_CTR *val )
815 return False;
819 * Table of function pointers for accessing printing data
822 REGISTRY_OPS printing_ops = {
823 printing_subkey_info,
824 printing_value_info,
825 printing_store_subkey,
826 printing_store_value