Skip to content

Commit

Permalink
[Mounted images] Fixed sync issues and #169
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingWonders committed Sep 20, 2024
1 parent 18655df commit d7cdfe3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 4 additions & 4 deletions MainForm.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions MainForm.vb
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ Public Class MainForm

' Refactored listings for 0.6
Public MountedImages As New List(Of MountedImage)
Public ImageDetectionComplete As Boolean

Public MountedImageImgFiles(65535) As String
Public MountedImageMountDirs(65535) As String
Expand Down Expand Up @@ -862,8 +863,13 @@ Public Class MainForm
imageStatus = ImageWatcher.Status.Invalid
End Select
Dim imageVersion As New Version()
imageVersion = New Version(FileVersionInfo.GetVersionInfo(imageInfo.MountPath & "\Windows\system32\ntoskrnl.exe").ProductVersion)
MountedImages.Add(New MountedImage(imageInfo.ImageFilePath, imageInfo.ImageIndex, imageInfo.MountPath, imageStatus, (imageInfo.MountMode = DismMountMode.ReadWrite), imageVersion))
If File.Exists(imageInfo.MountPath & "\Windows\system32\ntoskrnl.exe") Then
imageVersion = New Version(FileVersionInfo.GetVersionInfo(imageInfo.MountPath & "\Windows\system32\ntoskrnl.exe").ProductVersion)
MountedImages.Add(New MountedImage(imageInfo.ImageFilePath, imageInfo.ImageIndex, imageInfo.MountPath, imageStatus, (imageInfo.MountMode = DismMountMode.ReadWrite), imageVersion))
Else
' Could not get image version. Skip mounted image
Continue For
End If
Next
MountedImageImgFiles = MountedImageImgFileList.ToArray()
MountedImageImgIndexes = MountedImageImgIndexList.ToArray()
Expand Down Expand Up @@ -14820,13 +14826,18 @@ Public Class MainForm

Private Sub MountedImageDetectorBW_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles MountedImageDetectorBW.DoWork
Do
ImageDetectionComplete = False
If MountedImageDetectorBW.CancellationPending Or ImgBW.IsBusy Then Exit Do
DetectMountedImages(False)
ImageDetectionComplete = True
Thread.Sleep(1000)
Loop
End Sub

Private Sub MountedImageDetectorBW_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles MountedImageDetectorBW.RunWorkerCompleted
If e.Error IsNot Nothing Then
Throw New Exception("The mounted image detector has stopped unexpectedly. Check the error information below:" & CrLf & CrLf, e.Error)
End If
Select Case Language
Case 0
Select Case My.Computer.Info.InstalledUICulture.ThreeLetterWindowsLanguageName
Expand Down
1 change: 1 addition & 0 deletions Panels/Img_Ops/MountedImgMgr.vb
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ Public Class MountedImgMgr

Private Sub DetectorBW_ProgressChanged(sender As Object, e As System.ComponentModel.ProgressChangedEventArgs) Handles DetectorBW.ProgressChanged
If DetectorBW.CancellationPending Then Exit Sub
If Not MainForm.ImageDetectionComplete Then Exit Sub
If MainForm.MountedImages.Count <= 0 Then
ListView1.Items.Clear()
Exit Sub
Expand Down

0 comments on commit d7cdfe3

Please sign in to comment.