Olish Posted July 30, 2006 Share Posted July 30, 2006 (edited) Hi everybody ! I made a script that explores the registry and saves to a file. But this doesn't run very good. Somebody could help to debug this please ? Thanks a lot ! expandcollapse popup#include <Array.au3> _ScanRegistry("HKLM", "myreg.ini") ; Scans the registry and stores it in an INI file Func _ScanRegistry($HKStart, $file) Global $pLen ; This var is the number of registry subkeys opened in $pIns Global $pTab[2] ; This var is the explored registry keys list Global $pIns[2] ; This var is the explored registry keys' instances (according to Reg Functions) list $pLen = 1 $pTab[0] = $HKStart $pIns[0] = 0 $pIns[1] = 1 $handle = FileOpen($file, 2) Do ; Checking if the current instance of the subkey explored exists $path = _ArrayToString($pTab, "\") $key = RegEnumKey($path, $pIns[$pLen]) If Not @error Then _ArrayAdd($pTab, $key) ; Is there any value to store in this subkey ? $n = 1 $value = RegEnumVal($path, $n) While Not @error $data = RegRead($path, $value) $type = @extended ;~ IniWrite($file, $path, "value", $value) ;~ IniWrite($file, $path, "data", $data) ;~ IniWrite($file, $path, "type", $type) FileWriteLine($handle, "[" & $path & "]") FileWriteLine($handle, "value=" & $value) FileWriteLine($handle, "data=" & $data) FileWriteLine($handle, "type=" & $type) $n = $n + 1 $value = RegEnumVal($path, $n) WEnd ; Is there any subkey to explore in the current subkey ? $path = _ArrayToString($pTab, "\") $key = RegEnumKey($path, 1) If @error Then _ArrayDelete($pTab, $pLen) $pIns[$pLen] = $pIns[$pLen] + 1 Else _ArrayAdd($pIns, 1) $pLen = $pLen + 1 EndIf Else ; Deleting the last instance and going in the parent subkey _ArrayDelete($pIns, $pLen) $pLen = $pLen - 1 EndIf Until $pLen = -1 FileClose($handle) EndFunc; => _ScanRegistry() Edited July 30, 2006 by Olish Olivier, from France.Free Wake On LAN script Link to comment Share on other sites More sharing options...
Uten Posted July 30, 2006 Share Posted July 30, 2006 Try to explain why it is not running very good? Bad performance? Does not read the registry at all? Does not read a specific key/value? I'm not on a MS OS at the moment so I can't test anything. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Olish Posted July 30, 2006 Author Share Posted July 30, 2006 In fact, there is a problem when the script goes up in the parent subkey, an element of $pIns is deleted but, no element of $pTab is deleted. I'm searching for correcting this... Olivier, from France.Free Wake On LAN script Link to comment Share on other sites More sharing options...
Confuzzled Posted July 30, 2006 Share Posted July 30, 2006 REGEDIT /e filename.reg HKEY_LOCAL_MACHINE wont work? Link to comment Share on other sites More sharing options...
Olish Posted July 30, 2006 Author Share Posted July 30, 2006 My aim is to scan registry before an installation, and after, to compare the differences. But reading a .REG file is difficult using INI functions... Olivier, from France.Free Wake On LAN script Link to comment Share on other sites More sharing options...
Uten Posted July 31, 2006 Share Posted July 31, 2006 (edited) I know it's not a AutoIt script ore open source but InstallRite would probably cover your need?Dumping the hive to a file before and after and then compare with a diff (script or tool) is not such a bad ide either.EDIT: Why would you use the ini functions to read a reg file? Edited July 31, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
BPBNA Posted July 31, 2006 Share Posted July 31, 2006 So .reg files are hard to read? Not last time I checked... Just export it like Confuzzled said. Link to comment Share on other sites More sharing options...
Olish Posted August 1, 2006 Author Share Posted August 1, 2006 So .reg files are hard to read? Not last time I checked... Just export it like Confuzzled said.It's not so difficult, but reading very long hexadecimal values writen on few lines is not possible with IniRead function. Olivier, from France.Free Wake On LAN script Link to comment Share on other sites More sharing options...
/dev/null Posted August 1, 2006 Share Posted August 1, 2006 Hi everybody ! I made a script that explores the registry and saves to a file. But this doesn't run very good. Somebody could help to debug this please ? Thanks a lot !take a look at this: http://www.autoitscript.com/forum/index.ph...egistry++exportIt might help you...CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now