Uten Posted June 18, 2007 Share Posted June 18, 2007 (edited) This is just storage space for some functions that might become a sysdiff, system changes utility if I get the time. Lot of hardcoded stuff and small functions so I can put it together manually at the moment. The output is best comapred with winmerge or a similare diff utillity. expandcollapse popupFunc LoadRegFile($file) RunWait(@ComSpec & " /c regedit /S " & $file , @TempDir, @SW_HIDE) EndFunc Func DumpHKU($file) ;NOTE: Read help file RegistryDelete about 64bit windows ;TODO: test filenames with space in them. RunWait(@ComSpec & " /c regedit /E " & $file & " HKEY_USERS", @TempDir, @SW_HIDE) EndFunc Func DumpHKCU($file) ;NOTE: Read help file RegistryDelete about 64bit windows ;TODO: test filenames with space in them. RunWait(@ComSpec & " /c regedit /E " & $file & " HKEY_CURRENT_USER", @TempDir, @SW_HIDE) EndFunc Func DumpHKLM($file) ;NOTE: Read help file RegistryDelete about 64bit windows ;TODO: test filenames with space in them. RunWait(@ComSpec & " /c regedit /E " & $file & " HKEY_LOCAL_MACHINE", @TempDir, @SW_HIDE) EndFunc Func DumpHKCC($file) ;NOTE: Read help file RegistryDelete about 64bit windows ;TODO: test filenames with space in them. RunWait(@ComSpec & " /c regedit /E " & $file & " HKEY_CURRENT_CONFIG", @TempDir, @SW_HIDE) EndFunc Func DumpHKCR($file) ;NOTE: Read help file RegistryDelete about 64bit windows ;TODO: test filenames with space in them. RunWait(@ComSpec & " /c regedit /E " & $file & " HKEY_CLASSES_ROOT", @TempDir, @SW_HIDE) EndFunc Func testDirDat() If FileExists("c:\dir-base.dat") Then DirDatCreate() DirDatCompare() Else DirDatCreate("c:\dir-base.dat") ConsoleWrite("Make changes on the disk and run again" & @CRLF) EndIf EndFunc Func DirDatCompare($pn1 = "c:\dir-base.dat", $pn2 = "c:\dir-diff.dat" ) $a1 = StringRegExp(FileRead($pn1), "(?s)(Directory of .*?bytes)",3) ;dir-temp-20070618010630.dat $a2 = StringRegExp(FileRead($pn2), "(?s)(Directory of .*?bytes)",3) ConsoleWrite(UBound($a1) & "<-->"& UBound($a1) & @CRLF) For $i = 0 to UBound($a1) -1 If $a1[$i] <> $a2[$i] Then ConsoleWrite(">>>" & $a1[$i] & @CRLF & "---" & $a2[$i] & @CRLF) Else ;ConsoleWrite( $a1[$i] & @CRLF) EndIf Next EndFunc Func testDirTimes() FileChangeDir("C:\") IF 1 = 0 Then ;~16s ;32s $t = TimerInit() RunWait(@ComSpec & " /c dir /S /B", @WorkingDir, @SW_HIDE) ConsoleWrite(TimerDiff($t) & @CRLF) ;~27s ;67s $t = TimerInit() RunWait(@ComSpec & " /c dir /S", @WorkingDir, @SW_HIDE) ConsoleWrite(TimerDiff($t) & @CRLF) Exit endIf EndFunc Func DirDatCreate($scandir = "c:\", $datfile="c:\dir-diff.dat") $datfile = "c:\dir-diff.dat" ;& @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & ".dat" ConsoleWrite($datfile & @CRLF) FileChangeDir($scandir) $t = TimerInit() ;$foo = Run(@ComSpec & " /c dir /S >" & $datfile , $scandir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ;Faster than run but no progress feedback $foo = Runwait(@ComSpec & " /c dir /S >" & $datfile, $scandir, @SW_HIDE) ConsoleWrite(TimerDiff($t) & @CRLF) ShellExecute("notepad.exe", $datfile) ;~ MsgBox(0, "Debug", "Exiting...") EndFunc Func DirDatFileInfoDump($scandir="c:\", $datfile="c:\DirDatFileversions.dat") Local $foo Local $fh = FileOpen($datfile, 2) Local $d, $count, $cw FileChangeDir($scandir) $t = TimerInit() $foo = Run(@ComSpec & " /c dir /S /B" , $scandir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($foo) If @error Then ExitLoop $arr = StringSplit($line, @crlf, 1) For $i = 1 to $arr[0] If $arr[$i] <> "" Then $d = $d & $arr[$i] & "|" & FileGetVersion($arr[$i]) & "|" & FileGetAttrib($arr[$i]) & "|" & _ FileGetTime($arr[$i], 0, 1) & "|" & FileGetTime($arr[$i], 1, 1) & "|" & FileGetTime($arr[$i], 2, 1) & "|" & FileGetSize($arr[$i]) & @crlf ;$d = $d & $arr[$i] & @crlf ;& "|" & FileGetTime($arr[$i], 0, 1) & @crlf EndIf Next If $cw > 1000 Then FileWrite($fh, $d) $cw = 0 EndIf $count += $arr[0] $cw += $arr[0] ToolTip("dirdat: " & $count,200, 0) $d = "" Wend if $d <> "" Then FileWrite($fh, $d) While 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) Wend FileClose($fh) ConsoleWrite(TimerDiff($t) & @CRLF) EndFunc FIleVersions() exit Func FIleVersions() FileChangeDir(@SystemDir) $ff = FileFindFirstFile("*.dll") while 1 $f = FileFindNextFile($ff) If @error then ExitLoop ConsoleWrite($f & " : " & FileGetVersion($f) & @CRLF) Wend EndFUnc Edited June 18, 2007 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...
Uten Posted June 18, 2007 Author Share Posted June 18, 2007 Placeholder for a change log 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...
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