summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-09-29 06:17:09 +0000
committerTim Potter <tpot@samba.org>2003-09-29 06:17:09 +0000
commit5400952f7f74d6e656fcf4ded173868ecec3cb77 (patch)
tree24ac373cfcffe454faaac14ffd7c8f572d7c2c63 /source3/registry
parent64dbd7cbff3fa7a4e560571ec38207a7176e4646 (diff)
downloadsamba-5400952f7f74d6e656fcf4ded173868ecec3cb77.tar.gz
samba-5400952f7f74d6e656fcf4ded173868ecec3cb77.tar.bz2
samba-5400952f7f74d6e656fcf4ded173868ecec3cb77.zip
Merge from 3.0:
>Fix for #480. Change the interface for init_unistr2 to not take a length >but a flags field. We were assuming that 2*strlen(mb_string) == length of ucs2-le string. >This is not the case. Count it after conversion. >Jeremy. (This used to be commit e2ab9e54cd0ec0002175cf18ff364f4aebaf85a0)
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_printing.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c
index 50ac81dcbb..e50a5f4d4f 100644
--- a/source3/registry/reg_printing.c
+++ b/source3/registry/reg_printing.c
@@ -288,34 +288,32 @@ static int print_subpath_values_environments( char *key, REGVAL_CTR *val )
info3 = driver_ctr.info_3;
filename = dos_basename( info3->driverpath );
- init_unistr2( &data, filename, strlen(filename)+1 );
+ init_unistr2( &data, filename, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Driver", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
filename = dos_basename( info3->configfile );
- init_unistr2( &data, filename, strlen(filename)+1 );
+ init_unistr2( &data, filename, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Configuration File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
filename = dos_basename( info3->datafile );
- init_unistr2( &data, filename, strlen(filename)+1 );
+ init_unistr2( &data, filename, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Data File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
filename = dos_basename( info3->helpfile );
- init_unistr2( &data, filename, strlen(filename)+1 );
+ init_unistr2( &data, filename, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Help File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info3->defaultdatatype, strlen(info3->defaultdatatype)+1 );
+ init_unistr2( &data, info3->defaultdatatype, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Data Type", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
regval_ctr_addvalue( val, "Version", REG_DWORD, (char*)&info3->cversion, sizeof(info3->cversion) );
- if ( info3->dependentfiles )
- {
+ if ( info3->dependentfiles ) {
/* place the list of dependent files in a single
character buffer, separating each file name by
a NULL */
- for ( i=0; strcmp(info3->dependentfiles[i], ""); i++ )
- {
+ for ( i=0; strcmp(info3->dependentfiles[i], ""); i++ ) {
/* strip the path to only the file's base name */
filename = dos_basename( info3->dependentfiles[i] );
@@ -327,7 +325,7 @@ static int print_subpath_values_environments( char *key, REGVAL_CTR *val )
break;
buffer = buffer2;
- init_unistr2( &data, filename, length+1 );
+ init_unistr2( &data, filename, UNI_STR_TERMINATE);
memcpy( buffer+buffer_size, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
buffer_size += (length + 1)*sizeof(uint16);
@@ -339,8 +337,7 @@ static int print_subpath_values_environments( char *key, REGVAL_CTR *val )
if ( !buffer2 ) {
SAFE_FREE( buffer );
buffer_size = 0;
- }
- else {
+ } else {
buffer = buffer2;
buffer[buffer_size++] = '\0';
buffer[buffer_size++] = '\0';
@@ -573,25 +570,25 @@ static int print_subpath_values_printers( char *key, REGVAL_CTR *val )
regval_ctr_addvalue( val, "cjobs", REG_DWORD, (char*)&info2->cjobs, sizeof(info2->cjobs) );
regval_ctr_addvalue( val, "AveragePPM", REG_DWORD, (char*)&info2->averageppm, sizeof(info2->averageppm) );
- init_unistr2( &data, info2->printername, strlen(info2->printername)+1 );
+ init_unistr2( &data, info2->printername, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Name", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->location, strlen(info2->location)+1 );
+ init_unistr2( &data, info2->location, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Location", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->comment, strlen(info2->comment)+1 );
+ init_unistr2( &data, info2->comment, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Comment", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->parameters, strlen(info2->parameters)+1 );
+ init_unistr2( &data, info2->parameters, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Parameters", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->portname, strlen(info2->portname)+1 );
+ init_unistr2( &data, info2->portname, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Port", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->servername, strlen(info2->servername)+1 );
+ init_unistr2( &data, info2->servername, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Server", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->sharename, strlen(info2->sharename)+1 );
+ init_unistr2( &data, info2->sharename, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Share", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->drivername, strlen(info2->drivername)+1 );
+ init_unistr2( &data, info2->drivername, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Driver", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, info2->sepfile, strlen(info2->sepfile)+1 );
+ init_unistr2( &data, info2->sepfile, UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Separator File", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
- init_unistr2( &data, "winprint", strlen("winprint")+1 );
+ init_unistr2( &data, "winprint", UNI_STR_TERMINATE);
regval_ctr_addvalue( val, "Print Processor", REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );