svn commit: samba r6435 - in trunk/source: registry utils
jerry at samba.org
jerry at samba.org
Fri Apr 22 19:15:08 GMT 2005
Author: jerry
Date: 2005-04-22 19:15:07 +0000 (Fri, 22 Apr 2005)
New Revision: 6435
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6435
Log:
fix one small bug when corss hbin blocks. I now get
the following when parsing an NT4 system policy file:
bin/net rpc registry dump ~/zipdisk/src/regfio/ntconfig.pol
Opening /home/onterose/jerry/zipdisk/src/regfio/ntconfig.pol....ok
processed key [AdminConfigData]
processed key [AdminConfigData\Computers]
processed key [AdminConfigData\Computers\.default]
processed key [AdminConfigData\Computers\.default\Software]
processed key [AdminConfigData\Computers\.default\Software\Microsoft]
processed key [AdminConfigData\Computers\.default\Software\Microsoft\Windows]
processed key [AdminConfigData\Computers\.default\Software\Microsoft\Windows\CurrentVersion]
processed key [AdminConfigData\Computers\.default\Software\Microsoft\Windows\CurrentVersion\Run]
processed key [AdminConfigData\Computers\.default\Software\Microsoft\Windows NT]
processed key [AdminConfigData\Computers\.default\Software\Microsoft\Windows NT\CurrentVersion]
processed key [AdminConfigData\Computers\.default\Software\Microsoft\Windows NT\CurrentVersion\Winlogon]
processed key [AdminConfigData\Computers\.default\System]
processed key [AdminConfigData\Computers\.default\System\CurrentControlSet]
processed key [AdminConfigData\Computers\.default\System\CurrentControlSet\Services]
processed key [AdminConfigData\Computers\.default\System\CurrentControlSet\Services\SNMP]
processed key [AdminConfigData\Computers\.default\System\CurrentControlSet\Services\SNMP\Parameters]
processed key [AdminConfigData\Computers\.default\System\CurrentControlSet\Services\SNMP\Parameters\PermittedManagers]
processed key [AdminConfigData\Computers\.default\System\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration]
processed key [AdminConfigData\Computers\.default\System\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration\Public]
processed key [AdminConfigData\Computers\.default\System\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities]
processed key [AdminConfigData\GroupData]
processed key [AdminConfigData\GroupData\UserGroups]
processed key [AdminConfigData\GroupData\UserGroups\Priority]
processed key [AdminConfigData\UserGroups]
processed key [AdminConfigData\Users]
processed key [AdminConfigData\Users\.default]
processed key [AdminConfigData\Users\.default\Software]
processed key [AdminConfigData\Users\.default\Software\Microsoft]
processed key [AdminConfigData\Users\.default\Software\Microsoft\Windows]
processed key [AdminConfigData\Users\.default\Software\Microsoft\Windows\CurrentVersion]
processed key [AdminConfigData\Users\.default\Software\Microsoft\Windows\CurrentVersion\Policies]
processed key [AdminConfigData\Users\.default\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
processed key [AdminConfigData\Users\.default\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\RestrictRun]
processed key [AdminConfigData\Users\.default\Software\Policies]
processed key [AdminConfigData\Users\.default\Software\Policies\Microsoft]
processed key [AdminConfigData\Users\.default\Software\Policies\Microsoft\Windows]
processed key [AdminConfigData\Users\.default\Software\Policies\Microsoft\Windows\System]
Closing registry...ok
Modified:
trunk/source/registry/regfio.c
trunk/source/utils/net_rpc_registry.c
Changeset:
Modified: trunk/source/registry/regfio.c
===================================================================
--- trunk/source/registry/regfio.c 2005-04-22 18:53:42 UTC (rev 6434)
+++ trunk/source/registry/regfio.c 2005-04-22 19:15:07 UTC (rev 6435)
@@ -436,7 +436,7 @@
in the prs_struct *ps.
*******************************************************************/
-static BOOL hbin_prs_vk_records( const char *desc, REGF_HBIN *hbin, int depth, REGF_NK_REC *nk )
+static BOOL hbin_prs_vk_records( const char *desc, REGF_HBIN *hbin, int depth, REGF_NK_REC *nk, REGF_FILE *file )
{
int i;
@@ -462,9 +462,17 @@
}
for ( i=0; i<nk->num_values; i++ ) {
- if ( !prs_set_offset( &hbin->ps, nk->values[i].hbin_off+HBIN_HDR_SIZE-hbin->first_hbin_off ) )
+ REGF_HBIN *sub_hbin = hbin;
+ uint32 hbin_offset = find_hbin_container( nk->values[i].hbin_off );
+ uint32 new_offset;
+
+ if ( hbin_offset != hbin->file_offset )
+ sub_hbin = read_hbin_block( file, hbin_offset );
+
+ new_offset = nk->values[i].hbin_off + HBIN_HDR_SIZE - sub_hbin->first_hbin_off;
+ if ( !prs_set_offset( &sub_hbin->ps, new_offset ) )
return False;
- if ( !prs_vk_rec( "vk_rec", &hbin->ps, depth, &nk->values[i] ) )
+ if ( !prs_vk_rec( "vk_rec", &sub_hbin->ps, depth, &nk->values[i] ) )
return False;
}
@@ -496,7 +504,7 @@
if ( hbin_offset != hbin->file_offset )
sub_hbin = read_hbin_block( file, hbin_offset );
- if ( !hbin_prs_vk_records( "vk_rec", sub_hbin, depth, nk ))
+ if ( !hbin_prs_vk_records( "vk_rec", sub_hbin, depth, nk, file ))
return False;
/* now get subkeys */
Modified: trunk/source/utils/net_rpc_registry.c
===================================================================
--- trunk/source/utils/net_rpc_registry.c 2005-04-22 18:53:42 UTC (rev 6434)
+++ trunk/source/utils/net_rpc_registry.c 2005-04-22 19:15:07 UTC (rev 6435)
@@ -254,13 +254,33 @@
rpc_registry_backup_internal, argc, argv );
}
+
/********************************************************************
********************************************************************/
+static BOOL dump_registry_tree( REGF_FILE *file, REGF_NK_REC *nk, const char *parent )
+{
+ REGF_NK_REC *key;
+ pstring regpath;
+
+ /* depth first dump of the registry tree */
+
+ while ( (key = regfio_fetch_subkey( file, nk )) ) {
+ pstr_sprintf( regpath, "%s\\%s", parent, key->keyname );
+ d_printf("processed key [%s]\n", regpath );
+ dump_registry_tree( file, key, regpath );
+ }
+
+ return True;
+}
+
+/********************************************************************
+********************************************************************/
+
static int rpc_registry_dump( int argc, const char **argv )
{
REGF_FILE *registry;
- REGF_NK_REC *nk, *subkey;
+ REGF_NK_REC *nk;
if (argc != 1 ) {
d_printf("Usage: net rpc dump <file> \n");
@@ -278,15 +298,9 @@
nk = regfio_rootkey( registry );
d_printf("processed key [%s]\n", nk->keyname);
+
+ dump_registry_tree( registry, nk, nk->keyname );
- /* no do a breadth first search of the tree */
-
- while ( (subkey = regfio_fetch_subkey( registry, nk )) ) {
- d_printf("processed key [%s]\n", subkey->keyname);
- }
-
-
-
d_printf("Closing registry...");
regfio_close( registry );
d_printf("ok\n");
More information about the samba-cvs
mailing list