Skip to content

Commit

Permalink
2.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
LTRData committed Mar 25, 2020
1 parent 8e5aedc commit 3c8a4d1
Show file tree
Hide file tree
Showing 106 changed files with 8,527 additions and 2,530 deletions.
4 changes: 1 addition & 3 deletions 7zSDcfg.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
;!@Install@!UTF-8!
Title="ImDisk Virtual Disk Driver"
BeginPrompt="This will install ImDisk Virtual Disk Driver with the imdisk.exe command line tool and a Control Panel applet. Continue?"
ExecuteFile="runwaitw.exe"
ExecuteParameters="/64 /hide .\install.cmd"
ExecuteParameters="/64 /hide .\install.cmd "
;!@InstallEnd@!
328 changes: 312 additions & 16 deletions ImDisk.sln

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions ImDiskNet/DevioNet/DevioNet.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>..\Debug\</OutputPath>
<DocumentationFile>DevioNet.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>full</DebugType>
Expand All @@ -65,7 +65,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>..\Release\</OutputPath>
<DocumentationFile>DevioNet.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
Expand Down
4 changes: 2 additions & 2 deletions ImDiskNet/DevioNet/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.006.0")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("2.0.010.0")>
26 changes: 10 additions & 16 deletions ImDiskNet/DevioNet/Server/Providers/DevioProviderFromStream.vb
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,16 @@
Public Class DevioProviderFromStream
Inherits DevioProviderManagedBase

Private _BaseStream As Stream

''' <summary>
''' Stream object used by this instance.
''' </summary>
Public ReadOnly Property BaseStream As Stream
Get
Return _BaseStream
End Get
End Property

''' <summary>
''' Indicates whether base stream will be automacially closed when this
''' Indicates whether base stream will be automatically closed when this
''' instance is disposed.
''' </summary>
Public ReadOnly OwnsBaseStream As Boolean
Public ReadOnly Property OwnsBaseStream As Boolean

''' <summary>
''' Creates an object implementing IDevioProvider interface with I/O redirected
Expand All @@ -33,7 +27,7 @@
''' instance is disposed.</param>
Public Sub New(Stream As Stream, ownsStream As Boolean)
_BaseStream = Stream
OwnsBaseStream = ownsStream
_OwnsBaseStream = ownsStream
End Sub

''' <summary>
Expand All @@ -43,7 +37,7 @@
''' <returns>Value of BaseStream.CanWrite.</returns>
Public Overrides ReadOnly Property CanWrite As Boolean
Get
Return BaseStream.CanWrite
Return _BaseStream.CanWrite
End Get
End Property

Expand All @@ -54,7 +48,7 @@
''' <returns>Value of BaseStream.Length.</returns>
Public Overrides ReadOnly Property Length As Long
Get
Return BaseStream.Length
Return _BaseStream.Length
End Get
End Property

Expand All @@ -71,22 +65,22 @@

Public Overloads Overrides Function Read(buffer As Byte(), bufferoffset As Integer, count As Integer, fileoffset As Long) As Integer

BaseStream.Position = fileoffset
Return BaseStream.Read(buffer, bufferoffset, count)
_BaseStream.Position = fileoffset
Return _BaseStream.Read(buffer, bufferoffset, count)

End Function

Public Overloads Overrides Function Write(buffer As Byte(), bufferoffset As Integer, count As Integer, fileoffset As Long) As Integer

BaseStream.Position = fileoffset
BaseStream.Write(buffer, bufferoffset, count)
_BaseStream.Position = fileoffset
_BaseStream.Write(buffer, bufferoffset, count)
Return count

End Function

Protected Overrides Sub Dispose(disposing As Boolean)
If _BaseStream IsNot Nothing Then
If OwnsBaseStream Then
If _OwnsBaseStream Then
_BaseStream.Dispose()
End If
_BaseStream = Nothing
Expand Down
49 changes: 35 additions & 14 deletions ImDiskNet/DevioNet/Server/Services/DevioServiceBase.vb
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,19 @@ Namespace Server.Services
Public Event ServiceUnhandledException As UnhandledExceptionEventHandler
Protected Overridable Sub OnServiceUnhandledException(e As UnhandledExceptionEventArgs)
RaiseEvent ServiceUnhandledException(Me, e)
If HasImDiskDevice AndAlso ForceRemoveImDiskDeviceOnCrash Then
ImDiskAPI.ForceRemoveDevice(ImDiskDeviceNumber)
End If
Try
If HasImDiskDevice AndAlso ForceRemoveImDiskDeviceOnCrash Then
ImDiskAPI.ForceRemoveDevice(ImDiskDeviceNumber)
End If

Catch ex As Exception
Trace.WriteLine("Error removing device: " & ex.ToString())

End Try
End Sub

''' <summary>
''' Event raised to stop service thread. Service thread handle this event by preparing commnunication for
''' Event raised to stop service thread. Service thread handle this event by preparing communication for
''' disconnection.
''' </summary>
Protected Event StopServiceThread As Action
Expand Down Expand Up @@ -227,7 +233,7 @@ Namespace Server.Services
''' </summary>
''' <param name="timeout">Timeout value, or Timeout.Infinite to wait infinitely.</param>
''' <returns>Returns True if service thread has exit or no service thread has been
''' created, or False if timeout occured.</returns>
''' created, or False if timeout occurred.</returns>
Public Overridable Function WaitForServiceThreadExit(timeout As TimeSpan) As Boolean

If ServiceThread IsNot Nothing AndAlso ServiceThread.IsAlive Then
Expand Down Expand Up @@ -301,6 +307,14 @@ Namespace Server.Services
Do
Try
ImDiskAPI.RemoveDevice(_ImDiskDeviceNumber)
_ImDiskDeviceNumber = UInteger.MaxValue
Exit Do

Catch ex As Win32Exception When (
ex.NativeErrorCode = NativeFileIO.Win32API.ERROR_DEVICE_REMOVED OrElse
ex.NativeErrorCode = NativeFileIO.Win32API.ERROR_DEV_NOT_EXIST)

_ImDiskDeviceNumber = UInteger.MaxValue
Exit Do

Catch ex As Win32Exception When (
Expand Down Expand Up @@ -400,22 +414,29 @@ Namespace Server.Services
Protected Overridable Sub Dispose(disposing As Boolean)
If Not Me.disposedValue Then

If ServiceThread.ManagedThreadId <> Thread.CurrentThread.ManagedThreadId Then
If HasImDiskDevice Then
DismountImDiskAndStopServiceThread()
Else
OnStopServiceThread()
WaitForServiceThreadExit()
End If
End If

If disposing Then
' TODO: dispose managed state (managed objects).

If _DevioProvider IsNot Nothing Then
If OwnsProvider Then
_DevioProvider.Dispose()
End If
End If
End If

' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
' TODO: set large fields to null.

If _DevioProvider IsNot Nothing Then
If OwnsProvider Then
_DevioProvider.Dispose()
End If
_DevioProvider = Nothing
End If

OnStopServiceThread()
' TODO: set large fields to null.
_DevioProvider = Nothing

End If
Me.disposedValue = True
Expand Down
34 changes: 17 additions & 17 deletions ImDiskNet/DevioNet/Server/Services/DevioShmService.vb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ Namespace Server.Services
''' <summary>
''' Object name of shared memory file mapping object created by this instance.
''' </summary>
Public ReadOnly ObjectName As String
Public ReadOnly Property ObjectName As String

''' <summary>
''' Buffer size used by this instance.
''' </summary>
Public ReadOnly BufferSize As Long
Public ReadOnly Property BufferSize As Long

''' <summary>
''' Buffer size that will be automatically selected on this platform when
Expand Down Expand Up @@ -54,8 +54,8 @@ Namespace Server.Services
Public Sub New(ObjectName As String, DevioProvider As IDevioProvider, OwnsProvider As Boolean, BufferSize As Long)
MyBase.New(DevioProvider, OwnsProvider)

Me.ObjectName = ObjectName
Me.BufferSize = BufferSize
_ObjectName = ObjectName
_BufferSize = BufferSize

End Sub

Expand Down Expand Up @@ -115,15 +115,15 @@ Namespace Server.Services
Dim ServerMutex As Mutex

Try
Trace.WriteLine("Creating objects for shared memory communication '" & ObjectName & "'.")
Trace.WriteLine("Creating objects for shared memory communication '" & _ObjectName & "'.")

RequestEvent = New EventWaitHandle(initialState:=False, mode:=EventResetMode.AutoReset, name:="Global\" & ObjectName & "_Request")
RequestEvent = New EventWaitHandle(initialState:=False, mode:=EventResetMode.AutoReset, name:="Global\" & _ObjectName & "_Request")
DisposableObjects.Add(RequestEvent)

ResponseEvent = New EventWaitHandle(initialState:=False, mode:=EventResetMode.AutoReset, name:="Global\" & ObjectName & "_Response")
ResponseEvent = New EventWaitHandle(initialState:=False, mode:=EventResetMode.AutoReset, name:="Global\" & _ObjectName & "_Response")
DisposableObjects.Add(ResponseEvent)

ServerMutex = New Mutex(initiallyOwned:=False, name:="Global\" & ObjectName & "_Server")
ServerMutex = New Mutex(initiallyOwned:=False, name:="Global\" & _ObjectName & "_Server")
DisposableObjects.Add(ServerMutex)

If ServerMutex.WaitOne(0) = False Then
Expand All @@ -132,8 +132,8 @@ Namespace Server.Services
Return
End If

Mapping = MemoryMappedFile.CreateNew("Global\" & ObjectName,
BufferSize,
Mapping = MemoryMappedFile.CreateNew("Global\" & _ObjectName,
_BufferSize,
MemoryMappedFileAccess.ReadWrite,
MemoryMappedFileOptions.None,
Nothing,
Expand Down Expand Up @@ -255,7 +255,7 @@ Namespace Server.Services
Static largest_request As Integer
If ReadLength > largest_request Then
largest_request = ReadLength
Trace.WriteLine("Largest requested read size is now: " & largest_request & " bytes")
'Trace.WriteLine("Largest requested read size is now: " & largest_request & " bytes")
End If

Dim Response As IMDPROXY_READ_RESP
Expand Down Expand Up @@ -290,7 +290,7 @@ Namespace Server.Services
Static largest_request As Integer
If Length > largest_request Then
largest_request = Length
Trace.WriteLine("Largest requested write size is now: " & largest_request & " bytes")
'Trace.WriteLine("Largest requested write size is now: " & largest_request & " bytes")
End If

Dim Response As IMDPROXY_WRITE_RESP
Expand All @@ -317,7 +317,7 @@ Namespace Server.Services

Protected Overrides ReadOnly Property ImDiskProxyObjectName As String
Get
Return ObjectName
Return _ObjectName
End Get
End Property

Expand Down Expand Up @@ -345,16 +345,16 @@ Namespace Server.Services
If Not Me.disposedValue Then
If disposing Then
' TODO: free managed resources when explicitly called
For Each obj In Me
obj.Dispose()
Next
End If
End If
Me.disposedValue = True

' TODO: free shared unmanaged resources
For Each obj In Me
obj.Dispose()
Next

Clear()

End Sub

' This code added by Visual Basic to correctly implement the disposable pattern.
Expand Down
4 changes: 2 additions & 2 deletions ImDiskNet/DiscUtilsDevio/DiscUtilsDevio.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>..\Debug\</OutputPath>
<DocumentationFile>DiscUtilsDevio.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>full</DebugType>
Expand All @@ -64,7 +64,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>..\Release\</OutputPath>
<DocumentationFile>DiscUtilsDevio.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
Expand Down
6 changes: 3 additions & 3 deletions ImDiskNet/DiscUtilsDevio/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Imports System.Runtime.InteropServices
<Assembly: ComVisible(False)>

'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("30bf089b-e503-44c0-95df-a8518bb606bf")>
<Assembly: Guid("30bf089b-e503-44c0-95df-a8518bb606bf")>

' Version information for an assembly consists of the following four values:
'
Expand All @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.0.008.0")>
<Assembly: AssemblyFileVersion("1.0.008.0")>
<Assembly: AssemblyVersion("1.0.009.0")>
<Assembly: AssemblyFileVersion("2.0.010.0")>
Loading

0 comments on commit 3c8a4d1

Please sign in to comment.