Belmonts has asked for the wisdom of the Perl Monks concerning the following question:
Upon completion of the script the hive is unloaded automatically. How do I keep TieRegistry from unloading the hive? Thanks! -Belmontuse strict; use Win32::TieRegistry; my $newSubKey='TEMPHIVE'; my $thefile = 'C://Documents and Settings//DefaultUser//ntuser.dat'; # Specify Hive my $key= $Registry->{ 'HKEY_USERS' }; # Allow access to load hives my $optValue = 'true'; my $oldOpts= $key->SetOptions( AllowLoad=>$optValue ); # Load the hive my $newKey = $key->Load( $thefile, $newSubKey ); print $^E; #prints error description, if any. # GetValues in TEMPHIVE my $key = $Registry->{ 'HKEY_USERS\TEMPHIVE\SOFTWARE\Microsoft\Windows +\CurrentVersion\Run' }; my $sValueName ='TEST'; my $ValueData = $key->GetValue( $sValueName ); print "\n $ValueData \n"; #prints value of TEST from loaded hive
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::TieRegistry and Load() (hack)
by tye (Sage) on Mar 11, 2004 at 18:34 UTC | |
by Belmonts (Acolyte) on Mar 11, 2004 at 22:40 UTC |