Jump to content

Recommended Posts

Posted

I am trying to export registry key to a text file using VB.NET code but what I get is what I would get in a .reg file but with .txt extension - I use regedit.exe with switches as a process.

What I want is to export it to a .text file the same way as when using regedit.exe in gui mode.

What is the most importatnt here is last accessed times for registry keys. I want to analyze differences between 2 states of registry and having last accessed times would be much easier thatn to compare 2 whole registries.

I looked at various forums for some time and so far nothing.

Any help much appreciated!

Many thanks


Posted

allen2 thanks for your help but I need the VB code as a part of a bigger app so a tool will not do. What I have so far is simple app where you can import text files exported from registry via gui before and after installation of a given application, the code chcecks the modification times and then exports silently only the relevant keys and stores them as the application's keys. The perfect thing here would be for the code to export the text files itself so there is no "manual labor" necessary :)

  • 2 weeks later...
Posted (edited)

jaclaz, thanks for the links - yeah not really what I was looking for but still regtime is very usefull :) I had to change the method anyway as .txt files exported from registry thru GUI show also parent keys as modified even if a single subkey was modified (which is logical of course but does not halp me). What the code does now is basically comparing 2 registry exports and putting results into output file - still some optimisation to do but works ok. Next step would be creating an installation package - btw this is the point of this whole app - get modified registry keys and files and build my own installation package for my custom OS installation. The problem I have now is that I am trying to use SevenZipSharp.dll with 7z.dll and obviusly would like to create a sfx installation package but cannot... From what I have read on CodePlex and other sites I should be able to use SevenZipSfx class but it seems like it is not there! I use SevenZipCompressor and Extractor just fine but can't use Sfx. This is what I got so far for the test extract/compress app which should provide sfx functionality:


Imports SevenZip

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim zip As String = "D:\Instalki\Zip_DLLs\7z.dll"
SevenZipExtractor.SetLibraryPath(zip)
SevenZipCompressor.SetLibraryPath(zip)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button2.Enabled = False
BackgroundWorker1.RunWorkerAsync()
End Sub

Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
ExtractFile()
End Sub

Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
Button2.Enabled = True
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Button4.Enabled = False
BackgroundWorker2.RunWorkerAsync()
End Sub

Private Sub BackgroundWorker2_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker2.DoWork
ArchiveFile()
End Sub

Private Sub BackgroundWorker2_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker2.RunWorkerCompleted
Button4.Enabled = True
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
OpenFileDialog2.ShowDialog()
TextBox2.Text = OpenFileDialog2.FileName
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Button6.Enabled = False
BackgroundWorker3.RunWorkerAsync()
End Sub

Private Sub BackgroundWorker3_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker3.DoWork
ArchiveFolder()
End Sub

Private Sub BackgroundWorker3_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker3.RunWorkerCompleted
Button6.Enabled = True
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
FolderBrowserDialog1.ShowDialog()
TextBox3.Text = FolderBrowserDialog1.SelectedPath
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
FolderBrowserDialog1.ShowDialog()
TextBox1.Text = FolderBrowserDialog1.SelectedPath
End Sub

'PROCEDURES===========================================================================================================

Sub ExtractFile()
Dim ext As New SevenZipExtractor(TextBox1.Text)
ext.ExtractArchive(TextBox1.Text.Remove(TextBox1.Text.LastIndexOf("\"), TextBox1.Text.Substring(TextBox1.Text.LastIndexOf("\")).Length))
End Sub

Sub ArchiveFile()
Dim sZipFile As String = TextBox2.Text
sZipFile = sZipFile.Remove(sZipFile.LastIndexOf("."), sZipFile.Substring(sZipFile.LastIndexOf(".")).Length)
sZipFile = sZipFile & ".7z"
Dim arch As New SevenZipCompressor()
arch.CompressFiles(sZipFile, TextBox2.Text)
End Sub

Sub ArchiveFolder()
Dim sZipFile As String = TextBox3.Text & ".7z"
Dim arch As New SevenZipCompressor()
arch.IncludeEmptyDirectories = True
arch.DirectoryStructure = True
arch.EncryptHeaders = True
arch.PreserveDirectoryRoot = True
arch.CompressDirectory(TextBox3.Text, sZipFile)
End Sub
End Class

If I try using 7zsd.dll and copy /b command I get .exe file but when double-clicking it gives me "non 7z archive" error.

Any help, please? :)

mrugson

Edited by Mrugson

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...