├── .editorconfig ├── .gitignore ├── API ├── Public-API-reference.txt └── aimapi.zip ├── Command line applications ├── README.md ├── aim_cli.exe └── aim_ll.zip ├── Directory_structure.md ├── DriverSetup ├── DriverFiles.zip └── DriverSetup.7z ├── Graphical applications └── Graphical application moved.txt ├── How-to-build.md ├── LICENSE.md ├── Managed Source ├── Arsenal.ImageMounter.Forms │ ├── Arsenal.ImageMounter.Forms.csproj │ ├── AsyncMessageBox.Designer.cs │ ├── AsyncMessageBox.cs │ ├── DriverSetup.cs │ ├── FormsExtensions.cs │ ├── NativeWindowHandle.cs │ ├── RAMDiskForm.cs │ └── README.md ├── Arsenal.ImageMounter.PowerShell │ ├── Arsenal.ImageMounter.PowerShell.csproj │ ├── Arsenal.ImageMounter.psd1 │ ├── GetAimDiskDevice.cs │ ├── GetAimDiskVolumes.cs │ ├── GetAimVolumeMountPoints.cs │ ├── ModuleInitializer.cs │ ├── NewAimVirtualDisk.cs │ └── RemoveAimVirtualDisk.cs ├── Arsenal.ImageMounter.snk ├── Arsenal.ImageMounter │ ├── API.cs │ ├── Arsenal.ImageMounter.csproj │ ├── Collections │ │ ├── DisposableDictionary.cs │ │ ├── DisposableList.cs │ │ └── NullSafeDictionary.cs │ ├── Data │ │ ├── CachedIniFile.cs │ │ └── CsvReader.cs │ ├── DeviceProperties.cs │ ├── Devio │ │ ├── Client │ │ │ ├── DevioDirectStream.cs │ │ │ ├── DevioShmStream.cs │ │ │ ├── DevioStream.cs │ │ │ ├── DevioTcpStream.cs │ │ │ └── ProxyClientService.cs │ │ ├── Enums.cs │ │ └── Server │ │ │ ├── GenericProviders │ │ │ ├── DevioProviderDLLWrapperBase.cs │ │ │ ├── DevioProviderFromStream.cs │ │ │ ├── DevioProviderManagedBase.cs │ │ │ ├── DevioProviderSpanBase.cs │ │ │ ├── DevioProviderUnmanagedBase.cs │ │ │ ├── DevioProviderWIthFakeMBR.cs │ │ │ ├── DevioProviderWithOffset.cs │ │ │ ├── DummyProvider.cs │ │ │ ├── IDevioProvider.cs │ │ │ └── ProviderSupport.cs │ │ │ ├── Interaction │ │ │ └── DevioServiceFactory.cs │ │ │ ├── Services │ │ │ ├── DevioDrvService.cs │ │ │ ├── DevioNoneService.cs │ │ │ ├── DevioServiceBase.cs │ │ │ ├── DevioShmService.cs │ │ │ ├── DevioTcpService.cs │ │ │ ├── IVirtualDiskService.cs │ │ │ └── RAMDiskService.cs │ │ │ └── SpecializedProviders │ │ │ ├── DebugProvider.cs │ │ │ ├── DevioProviderLibAFF4.cs │ │ │ ├── DevioProviderLibEwf.cs │ │ │ ├── DevioProviderLibQcow.cs │ │ │ └── MultiPartFileStream.cs │ ├── DiscUtilsInteraction.cs │ ├── Extensions │ │ ├── CollectionExtensions.cs │ │ ├── ExtensionMethods.cs │ │ ├── UnmanagedMemoryManager.cs │ │ └── WaitAsyncExtensions.cs │ ├── Flags.cs │ ├── GlobalCriticalMutex.cs │ ├── IO │ │ ├── ConsoleIO │ │ │ ├── ConsoleProgressBar.cs │ │ │ └── ConsoleSpinProgress.cs │ │ ├── Devices │ │ │ ├── DeviceObject.cs │ │ │ ├── DiskDevice.cs │ │ │ ├── FileStreamsEnumerator.cs │ │ │ ├── SystemNeeded.cs │ │ │ ├── SystemNotificationEvent.cs │ │ │ ├── VolumeEnumerator.cs │ │ │ ├── VolumeMountPointEnumerator.cs │ │ │ └── WriteFilterStatistics.cs │ │ ├── Native │ │ │ ├── NativeCalls.cs │ │ │ ├── NativeConstants.cs │ │ │ ├── NativeFileIO.cs │ │ │ ├── NativeFileVersion.cs │ │ │ ├── NativePE.cs │ │ │ ├── NativeStruct.cs │ │ │ ├── NativeStructWrapper.cs │ │ │ ├── NativeStructs.cs │ │ │ ├── NativeUnixIO.cs │ │ │ ├── NtDirectoryObject.cs │ │ │ └── PinnedBuffer.cs │ │ └── Streams │ │ │ ├── AligningStream.cs │ │ │ ├── BufferedBinaryWriter.cs │ │ │ ├── CombinedMemoryStream.cs │ │ │ ├── CombinedSeekStream.cs │ │ │ ├── CompletionPosition.cs │ │ │ ├── DiskStream.cs │ │ │ ├── SeekableBufferedStream.cs │ │ │ └── SubStream.cs │ ├── Internal │ │ ├── Compat.cs │ │ └── Internal.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── README.md │ ├── Reflection │ │ ├── EquatableBox.cs │ │ ├── ExpressionSupport.cs │ │ ├── MembersStringSetter.cs │ │ └── SequenceComparer.cs │ ├── ScsiAdapter.cs │ └── Views │ │ ├── DiskStateParser.cs │ │ └── DiskStateView.cs ├── ArsenalImageMounter.sln ├── ArsenalImageMounterAnalyze │ ├── ArsenalImageMounterAnalyze.csproj │ ├── Module1.cs │ ├── README.md │ └── app.manifest ├── ArsenalImageMounterCLISetup │ ├── App.config │ ├── ArsenalImageMounterCLISetup.csproj │ ├── MainModule.cs │ └── README.md ├── ArsenalImageMounterGUISetup │ ├── ArsenalImageMounterGUISetup.vbproj │ ├── GlobalSuppressions.vb │ ├── MainForm.Designer.vb │ ├── MainForm.resx │ ├── MainForm.vb │ ├── README.md │ ├── app.config │ └── app.manifest ├── ArsenalImageMounterHelpBuilder │ └── ArsenalImageMounterHelpBuilder.shfbproj ├── ArsenalImageMounterMountTool │ ├── App.config │ ├── ArsenalImageMounterMountTool.vbproj │ ├── AsyncMessageBox.Designer.vb │ ├── AsyncMessageBox.resx │ ├── AsyncMessageBox.vb │ ├── EULA.txt │ ├── FormMountOptions.Designer.vb │ ├── FormMountOptions.resx │ ├── FormMountOptions.vb │ ├── LibewfVerify.vb │ ├── LibqcowVerify.vb │ ├── MainForm.Designer.vb │ ├── MainForm.resx │ ├── MainForm.vb │ ├── MainModule.vb │ ├── My Project │ │ └── DataSources │ │ │ └── DiskStateView.datasource │ ├── README.md │ └── app.manifest ├── ArsenalImageMounterService │ ├── ArsenalImageMounterService.csproj │ ├── ConsoleApp.cs │ ├── ConsoleAppImplementation.cs │ ├── ImageConversions.cs │ ├── README.md │ ├── aim_cli │ └── app.config ├── Command-line-usage-examples.md ├── Directory.build.props ├── README.md ├── TestProject │ ├── Streams.cs │ ├── Tcp.cs │ ├── TestProject.csproj │ ├── Version.cs │ ├── Waitable.cs │ └── Win32API.cs └── publishps.cmd ├── MountTool ├── ArsenalImageMounterMountTool.exe ├── README.md ├── Screenshot_Windows_8.png ├── Screenshot_signature_conflict.png └── Thumbs.db ├── News.md ├── README.md ├── Third-Party-Licenses ├── DiscUtils.txt ├── DotNetZip.txt ├── bzip2.txt ├── dokan.txt ├── gpl-3.0.txt ├── lgpl-3.0.txt ├── libaff4.txt ├── libewf.txt ├── libqcow.txt └── zlib.txt ├── Third-party-dependencies.txt ├── Unmanaged Source ├── ArsenalImageMounter.sln ├── CoreBuild.props ├── README.md ├── aim_ll │ ├── aim_ll.vcxproj │ ├── aim_ll.vcxproj.filters │ ├── aimcmd.cpp │ ├── aimcmd.h │ ├── aimcmd.rc │ └── drvsetup.cpp ├── aim_um.props ├── aimapi │ ├── aimapi.cpp │ ├── aimapi.h │ ├── aimapi.rc │ ├── aimapi.vcxproj │ ├── aimapi.vcxproj.filters │ ├── debugmsg.cpp │ ├── dllmain.cpp │ ├── drvsetup.cpp │ ├── pecompat.props │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── winstrct.hpp │ └── wscm.h ├── aimwrfltr │ ├── aimwrfltr.h │ ├── aimwrfltr.props │ ├── aimwrfltr.rc │ ├── aimwrfltr.vcxproj │ ├── aimwrfltr.vcxproj.filters │ ├── autobld.cmd │ ├── bld.cmd │ ├── bldchk.cmd │ ├── bldfre.cmd │ ├── inc │ │ └── fltstats.h │ ├── ioctl.cpp │ ├── ioctldbg.cpp │ ├── mainwdm.cpp │ ├── makefile │ ├── partialirp.cpp │ ├── read.cpp │ ├── sources │ ├── workerthread.cpp │ └── write.cpp ├── awealloc │ ├── MAKEFILE │ ├── autobld.cmd │ ├── awealloc.c │ ├── awealloc.inf │ ├── awealloc.props │ ├── awealloc.rc │ ├── awealloc.vcxproj │ ├── bld.cmd │ ├── bldchk.cmd │ ├── bldfre.cmd │ ├── sources │ └── sources.props ├── deviodrv │ ├── MAKEFILE │ ├── autobld.cmd │ ├── bld.cmd │ ├── bldchk.cmd │ ├── bldfre.cmd │ ├── deviodrv.cpp │ ├── deviodrv.h │ ├── deviodrv.inf │ ├── deviodrv.rc │ ├── deviodrv.vcxproj │ ├── deviodrv.vcxproj.filters │ ├── dispatch.cpp │ ├── filetable.cpp │ ├── irpfwd.cpp │ └── sources ├── deviosvc │ ├── Makefile │ ├── autobld.cmd │ ├── bld.cmd │ ├── bldchk.cmd │ ├── bldfre.cmd │ ├── deviosvc.cpp │ ├── deviosvc.rc │ ├── deviosvc.vcxproj │ ├── sources │ └── sources.props ├── imdisk.props ├── msbld.cmd ├── phdskmnt │ ├── ARMGS.props │ ├── autobld.cmd │ ├── bld.cmd │ ├── bldchk.cmd │ ├── bldfre.cmd │ ├── build.cmd │ ├── buildcat.cmd │ ├── catchk.cmd │ ├── catfre.cmd │ ├── cd.h │ ├── ctlunit.inf │ ├── debug.cpp │ ├── imscsi.mof │ ├── inc │ │ ├── common.h │ │ ├── imdproxy.h │ │ ├── imscsiwmi.h │ │ ├── legacycompat.h │ │ ├── ntkmapi.h │ │ ├── ntumapi.h │ │ ├── phdskmnt.h │ │ ├── phdskmntver.h │ │ ├── trace.h │ │ ├── trcphdskmnt.ini │ │ ├── wio.hpp │ │ ├── wkmem.hpp │ │ └── wmem.hpp │ ├── iodisp.cpp │ ├── legacy.inf │ ├── makefile │ ├── makefile.inc │ ├── makefile.inc.props │ ├── phdskmnt.cpp │ ├── phdskmnt.inf │ ├── phdskmnt.props │ ├── phdskmnt.rc │ ├── phdskmnt.vcxproj │ ├── phdskmnt2003.inf │ ├── phdskmntVista.inf │ ├── phdskmntWin7.inf │ ├── phdskmnt_scsiport.props │ ├── proxy.cpp │ ├── pubcmd.cmd │ ├── readme.txt │ ├── scsi.cpp │ ├── sources │ ├── sources.props │ ├── srbioctl.cpp │ ├── utils.cpp │ ├── wmi.c │ └── workerthread.cpp ├── vs2013_sse.props ├── wdk7.props ├── wdk7_secondary.props ├── wdk7_w2k_x86.props └── wdk7_wnet_x64.props ├── agpl-3.0.html └── libewf ├── LICENSE.md ├── readme.txt ├── x64.zip └── x86.zip /API/Public-API-reference.txt: -------------------------------------------------------------------------------- 1 | 2 | API reference for .NET libraries Arsenal.ImageMounter.dll and Arsenal.ImageMounter.Devio.dll is available online here: 3 | 4 | http://static.ltr-data.se/library/ArsenalImageMounter/ 5 | 6 | It is also possible to download the API reference as a .chm help file: 7 | 8 | http://static.ltr-data.se/library/ArsenalImageMounter/Arsenal%20Image%20Mounter%20API.chm 9 | 10 | -------------------------------------------------------------------------------- /API/aimapi.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/API/aimapi.zip -------------------------------------------------------------------------------- /Command line applications/aim_cli.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/Command line applications/aim_cli.exe -------------------------------------------------------------------------------- /Command line applications/aim_ll.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/Command line applications/aim_ll.zip -------------------------------------------------------------------------------- /DriverSetup/DriverFiles.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/DriverSetup/DriverFiles.zip -------------------------------------------------------------------------------- /DriverSetup/DriverSetup.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/DriverSetup/DriverSetup.7z -------------------------------------------------------------------------------- /Graphical applications/Graphical application moved.txt: -------------------------------------------------------------------------------- 1 | * Arsenal Image Mounter 2 | 3 | The graphical user interface application can be found here: 4 | https://arsenalrecon.com/weapons/image-mounter/ 5 | -------------------------------------------------------------------------------- /How-to-build.md: -------------------------------------------------------------------------------- 1 | How to build unmanaged source, including drivers and native libraries 2 | --------------------------------------------------------------------- 3 | 4 | * It is possible to build driver, native API DLL and native command line 5 | tools with Windows Driver Kit 7.0. 6 | https://msdn.microsoft.com/en-us/library/windows/hardware/ff557573.aspx 7 | If you don't need to build the driver project, you can simply build each 8 | of the directories with user mode components instead. 9 | 10 | * There is also a Visual Studio solution where you can build these components 11 | in Visual Studio 2017-2022 with WDK extensions and toolchains installed. 12 | 13 | How to build managed source, including graphical and command line tools for 14 | mounting images, installing driver, converting between image formats etc 15 | --------------------------------------------------------------------------- 16 | 17 | * It is possible to build all of this with .NET 6.0 or 7.0 SDK. 18 | https://dotnet.microsoft.com/en-us/download/dotnet/ 19 | 20 | 21 | * It is also possible to build all of this with Visual Studio 2022. 22 | 23 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Dual Licensing 2 | -------------- 3 | 4 | Arsenal Image Mounter is available under a dual licensing [1] scheme whereby use of Arsenal Image Mounter in projects that are licensed so as to be compatible with terms of Affero General Public License v3 (http://www.fsf.org/licensing/licenses/agpl-3.0.html) may use Arsenal Image Mounter under the terms of the compatible license. 5 | 6 | However, if AGPL v3 terms are incompatible with your use of Arsenal Image Mounter, alternative license terms are available -- please direct inquiries about Arsenal Image Mounter licensing to http://ArsenalRecon.com/contact/. 7 | 8 | Which License Should I Choose? 9 | ------------------------------ 10 | 11 | If your software is licensed under a recognized open source license [2], you can use Arsenal Image Mounter under its open source license terms without further consideration. 12 | 13 | However, if your software is not licensed under an open source compatible license, such as a proprietary license, then you should contact Arsenal Consulting, Inc. (d/b/a Arsenal Recon) in order to arrange alternative license terms to cover your use of Arsenal Image Mounter. 14 | 15 | In short, 16 | 17 | * If you derive a commercial advantage by using Arsenal Image Mounter with a closed source solution, you must arrange alternative license terms for your use of Arsenal Image Mounter which will, at a minimum, remove the need to publish your source code. 18 | 19 | * If you wish to use Arsenal Image Mounter under its open source terms, you must contribute back to the community the source code for the solution you use Arsenal Image Mounter with, so that others may benefit from it as you benefit from Arsenal Image Mounter. 20 | 21 | License Inquiries 22 | ----------------- 23 | 24 | For more about Arsenal Image Mounter's dual license terms, or to arrange alternative licensing terms, please direct inquires to: 25 | 26 | http://ArsenalRecon.com/contact/ 27 | 28 | [1] http://en.wikipedia.org/wiki/Dual_license 29 | [2] http://www.opensource.org/licenses 30 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.Forms/Arsenal.ImageMounter.Forms.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net48;net8.0-windows;net9.0-windows 5 | true 6 | Arsenal Image Mounter Windows Forms Library 7 | true 8 | 9 | 10 | 11 | ArsenalRecon.ImageMounter.Forms 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.Forms/AsyncMessageBox.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using System.Diagnostics; 12 | 13 | 14 | 15 | namespace Arsenal.ImageMounter.Dialogs; 16 | 17 | public partial class AsyncMessageBox 18 | { 19 | 20 | // Form overrides dispose to clean up the component list. 21 | [DebuggerNonUserCode()] 22 | protected override void Dispose(bool disposing) 23 | { 24 | try 25 | { 26 | if (disposing && components is not null) 27 | { 28 | components.Dispose(); 29 | } 30 | } 31 | finally 32 | { 33 | base.Dispose(disposing); 34 | } 35 | } 36 | 37 | // Required by the Windows Form Designer 38 | private System.ComponentModel.IContainer components = null; 39 | 40 | // NOTE: The following procedure is required by the Windows Form Designer 41 | // It can be modified using the Windows Form Designer. 42 | // Do not modify it using the code editor. 43 | [DebuggerStepThrough()] 44 | private void InitializeComponent() 45 | { 46 | SuspendLayout(); 47 | // 48 | // AsyncMessageBox 49 | // 50 | components = new System.ComponentModel.Container(); 51 | AutoScaleDimensions = new System.Drawing.SizeF(6.0f, 13.0f); 52 | AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 53 | ClientSize = new System.Drawing.Size(448, 171); 54 | ControlBox = false; 55 | FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 56 | MaximizeBox = false; 57 | MinimizeBox = false; 58 | Name = "AsyncMessageBox"; 59 | ShowIcon = false; 60 | ShowInTaskbar = false; 61 | StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 62 | ResumeLayout(false); 63 | 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.Forms/NativeWindowHandle.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using System.Windows.Forms; 12 | 13 | namespace Arsenal.ImageMounter.Dialogs; 14 | 15 | /// 16 | /// Implements using a native window handle 17 | /// 18 | /// Native window handle to use 19 | public readonly struct NativeWindowHandle(nint handle) : IWin32Window 20 | { 21 | /// 22 | /// Native window handle 23 | /// 24 | public nint Handle => handle; 25 | 26 | /// 27 | /// Converts the numeric value of the current native window handle to its equivalent string representation. 28 | /// 29 | /// The string representation of the value of this instance. 30 | public override string ToString() => handle.ToString(); 31 | } 32 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.Forms/RAMDiskForm.cs: -------------------------------------------------------------------------------- 1 | using Arsenal.ImageMounter.Devio.Server.Services; 2 | using Arsenal.ImageMounter.IO.Native; 3 | using LTRData.Extensions.Formatting; 4 | using System; 5 | using System.Windows.Forms; 6 | 7 | namespace Arsenal.ImageMounter.Dialogs; 8 | 9 | /// 10 | /// Provides interactive GUI for RAM disk creation 11 | /// 12 | public static class RAMDiskForm 13 | { 14 | /// 15 | /// Create RAM disk interactively by showing dialog that asks for size etc. 16 | /// 17 | /// 18 | /// 19 | /// 20 | public static RAMDiskService? InteractiveCreate(IWin32Window? _, ScsiAdapter adapter) 21 | { 22 | var strsize = Microsoft.VisualBasic.Interaction.InputBox("Enter size in MB", "RAM disk"); 23 | 24 | if (strsize is null || string.IsNullOrWhiteSpace(strsize)) 25 | { 26 | return null; 27 | } 28 | 29 | if (!long.TryParse(strsize, out var size_mb) || size_mb <= 0) 30 | { 31 | return null; 32 | } 33 | 34 | var ramdisk = RAMDiskService.Create(adapter, size_mb << 20, InitializeFileSystem.NTFS); 35 | 36 | if (ramdisk.MountPoint is not null) 37 | { 38 | try 39 | { 40 | NativeFileIO.BrowseTo(ramdisk.MountPoint); 41 | } 42 | catch (Exception ex) 43 | { 44 | MessageBox.Show($"Failed to open Explorer window for created RAM disk: {ex.JoinMessages()}"); 45 | } 46 | } 47 | 48 | return ramdisk; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.Forms/README.md: -------------------------------------------------------------------------------- 1 | Arsenal-Image-Mounter 2 | ===================== 3 | 4 | Arsenal Image Mounter mounts the contents of disk images as complete disks in Microsoft Windows. Arsenal Image Mounter includes a virtual SCSI adapter (via a unique Storport miniport driver) which allows users to benefit from disk-specific features in Windows like integration with Disk Manager, access to Volume Shadow Copies, and more. As far as Windows is concerned, the contents of disk images mounted by Arsenal Image Mounter are “real” SCSI disks. 5 | 6 | For developers, Arsenal Image Mounter source code and APIs are available for royalty-free use by open source projects. Commercial projects (and other projects not licensed under an AGPL v3 compatible license - see http://www.fsf.org/licensing/licenses/agpl-3.0.html) that would like to use Arsenal Image Mounter source code and/or APIs must contact us (https://ArsenalRecon.com/contact/) to obtain alternative licensing. 7 | 8 | For end users, Arsenal Image Mounter’s full functionality (along with all our other tools) is available as part of an affordable monthly subscription. If Arsenal Image Mounter is licensed, it runs in "Professional Mode.” If Arsenal Image Mounter is run without a license, it will run in "Free Mode" and provide core functionality. 9 | 10 | Please see Arsenal Image Mounter’s product page: https://ArsenalRecon.com/weapons/image-mounter for more details. 11 | 12 | Supporting Arsenal Image Mounter 13 | -------------------------------- 14 | 15 | We appreciate your help making commercial projects aware of Arsenal Image Mounter’s capabilities, because commercial licensing of our source code and APIs supports ongoing development. On a related note, we know that some commercial projects are using Arsenal Image Mounter’s source code and APIs without being properly licensed… we also appreciate being alerted to these situations so we can nudge those projects appropriately. 16 | 17 | More Details on Licensing and Contributions 18 | ------------------------------------------- 19 | 20 | We chose a dual-license for Arsenal Image Mounter (more specifically, Arsenal Image Mounter’s source code and APIs) to allow its royalty-free use by open source projects, but require financial support from commercial projects. 21 | 22 | Arsenal Consulting, Inc. (d/b/a Arsenal Recon) retains the copyright to Arsenal Image Mounter, including the Arsenal Image Mounter source code and APIs, being made available under terms of the Affero General Public License v3. Arsenal Image Mounter source code and APIs may be used in projects that are licensed so as to be compatible with AGPL v3. If your project is not licensed under an AGPL v3 compatible license and you would like to use Arsenal Image Mounter source code and/or APIs, contact us to obtain alternative licensing. 23 | 24 | Contributors to Arsenal Image Mounter must sign the Arsenal Contributor Agreement ("ACA"). The ACA gives Arsenal and the contributor joint copyright interests in the source code. 25 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.PowerShell/Arsenal.ImageMounter.PowerShell.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net48;net8.0;net9.0 5 | enable 6 | Arsenal.ImageMounter.PowerShell 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | PreserveNewest 23 | 24 | 25 | \ 26 | true 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.PowerShell/GetAimDiskDevice.cs: -------------------------------------------------------------------------------- 1 | using Arsenal.ImageMounter.Devio.Server.Services; 2 | using Arsenal.ImageMounter.IO.Devices; 3 | using System.Diagnostics; 4 | using System.Management.Automation; 5 | using System.Runtime.Versioning; 6 | 7 | namespace Arsenal.ImageMounter.PowerShell; 8 | 9 | [Cmdlet(VerbsCommon.Get, "AimDiskDevice")] 10 | #if NET5_0_OR_GREATER 11 | [SupportedOSPlatform("windows")] 12 | #endif 13 | public class GetAimDiskDevice : Cmdlet 14 | { 15 | [Parameter(Position = 0, ValueFromPipeline = true, HelpMessage = "Mounted virtual disk to open.")] 16 | public DevioServiceBase? VirtualDisk { get; set; } 17 | 18 | [Parameter(HelpMessage = @"Path to disk device to open, such as \\?\PhysicalDrive1")] 19 | public string? DevicePath { get; set; } 20 | 21 | [Parameter(HelpMessage = "Open virtual disk for both reading and writing. Without this parameter, disk is opened in read-only mode.")] 22 | public SwitchParameter Writable { get; set; } 23 | 24 | protected override void ProcessRecord() 25 | { 26 | if (!(VirtualDisk is not null ^ DevicePath is not null)) 27 | { 28 | throw new PSArgumentException("Needs either of VirtualDisk or DevicePath parameters, but not both."); 29 | } 30 | 31 | var accessMode = FileAccess.Read; 32 | 33 | if (Writable) 34 | { 35 | accessMode |= FileAccess.Write; 36 | } 37 | 38 | var disk = VirtualDisk is not null 39 | ? VirtualDisk.OpenDiskDevice(accessMode) 40 | : DevicePath is not null 41 | ? new DiskDevice(DevicePath, accessMode) 42 | #if NET7_0_OR_GREATER 43 | : throw new UnreachableException(); 44 | #else 45 | : throw new InvalidOperationException(); 46 | #endif 47 | 48 | try 49 | { 50 | WriteObject(disk); 51 | } 52 | catch 53 | { 54 | disk?.Dispose(); 55 | throw; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.PowerShell/GetAimDiskVolumes.cs: -------------------------------------------------------------------------------- 1 | using Arsenal.ImageMounter.Devio.Server.Services; 2 | using Arsenal.ImageMounter.IO.Native; 3 | using System.Management.Automation; 4 | using System.Runtime.Versioning; 5 | 6 | namespace Arsenal.ImageMounter.PowerShell; 7 | 8 | [Cmdlet(VerbsCommon.Get, "AimDiskVolumes")] 9 | #if NET5_0_OR_GREATER 10 | [SupportedOSPlatform("windows")] 11 | #endif 12 | public class GetAimDiskVolumes : Cmdlet 13 | { 14 | [Parameter(Position = 0, ValueFromPipeline = true, HelpMessage = "Mounted virtual disk to open.")] 15 | public DevioServiceBase? VirtualDisk { get; set; } 16 | 17 | [Parameter(HelpMessage = @"Path to disk device to open, such as \\?\PhysicalDrive1")] 18 | public string? DevicePath { get; set; } 19 | 20 | [Parameter(HelpMessage = "Open virtual disk for both reading and writing. Without this parameter, disk is opened in read-only mode.")] 21 | public SwitchParameter Writable { get; set; } 22 | 23 | protected override void ProcessRecord() 24 | { 25 | if (!(VirtualDisk is not null ^ DevicePath is not null)) 26 | { 27 | throw new PSArgumentException("Needs either of VirtualDisk or DevicePath parameters, but not both."); 28 | } 29 | 30 | if (VirtualDisk is not null) 31 | { 32 | var deviceName = VirtualDisk.GetDiskDeviceName(); 33 | 34 | if (deviceName is null) 35 | { 36 | return; 37 | } 38 | 39 | DevicePath = $@"\\?\{deviceName}"; 40 | } 41 | 42 | var volumes = NativeFileIO.EnumerateDiskVolumes(DevicePath).ToArray(); 43 | 44 | WriteObject(volumes); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.PowerShell/GetAimVolumeMountPoints.cs: -------------------------------------------------------------------------------- 1 | using Arsenal.ImageMounter.IO.Native; 2 | using System.Management.Automation; 3 | using System.Runtime.Versioning; 4 | 5 | namespace Arsenal.ImageMounter.PowerShell; 6 | 7 | [Cmdlet(VerbsCommon.Get, "AimVolumeMountPoints")] 8 | #if NET5_0_OR_GREATER 9 | [SupportedOSPlatform("windows")] 10 | #endif 11 | public class GetAimVolumeMountPoints : Cmdlet 12 | { 13 | [Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true, HelpMessage = "Volume path")] 14 | public string[] VolumePath { get; set; } = null!; 15 | 16 | protected override void ProcessRecord() 17 | { 18 | if (VolumePath is null) 19 | { 20 | throw new PSArgumentException("Needs VolumePath parameter"); 21 | } 22 | 23 | var mountPoints = VolumePath.SelectMany(NativeFileIO.EnumerateVolumeMountPoints).ToArray(); 24 | 25 | WriteObject(mountPoints); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.PowerShell/ModuleInitializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Management.Automation; 5 | using System.Reflection; 6 | using System.Runtime.InteropServices; 7 | #if NETCOREAPP 8 | using System.Runtime.Loader; 9 | #endif 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | 13 | namespace Arsenal.ImageMounter.PowerShell; 14 | 15 | public class AlcModuleResolveEventHandler : IModuleAssemblyInitializer, IModuleAssemblyCleanup 16 | { 17 | public void OnImport() 18 | { 19 | #if NETFRAMEWORK 20 | AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve; 21 | #elif NETCOREAPP 22 | AssemblyLoadContext.Default.Resolving += AssemblyResolve; 23 | #endif 24 | 25 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) 26 | { 27 | API.AddNativeLibDirectory(); 28 | } 29 | } 30 | 31 | public void OnRemove(PSModuleInfo psModuleInfo) 32 | { 33 | #if NETFRAMEWORK 34 | AppDomain.CurrentDomain.AssemblyResolve -= AssemblyResolve; 35 | #elif NETCOREAPP 36 | AssemblyLoadContext.Default.Resolving -= AssemblyResolve; 37 | #endif 38 | } 39 | 40 | private static readonly string? asmpath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 41 | 42 | #if NETFRAMEWORK 43 | private static Assembly? AssemblyResolve(object? sender, ResolveEventArgs args) 44 | { 45 | if (asmpath is null) 46 | { 47 | return null; 48 | } 49 | 50 | var asmname = new AssemblyName(args.Name); 51 | 52 | var filename = $"{asmname.Name}.dll"; 53 | 54 | var testname = Path.Combine(asmpath, filename); 55 | 56 | if (File.Exists(testname)) 57 | { 58 | var asm = Assembly.LoadFrom(testname); 59 | 60 | return asm; 61 | } 62 | 63 | return null; 64 | } 65 | #elif NETCOREAPP 66 | private static Assembly? AssemblyResolve(AssemblyLoadContext alc, AssemblyName asmname) 67 | { 68 | if (asmpath is null) 69 | { 70 | return null; 71 | } 72 | 73 | var filename = $"{asmname.Name}.dll"; 74 | 75 | var testname = Path.Combine(asmpath, filename); 76 | 77 | if (File.Exists(testname)) 78 | { 79 | var asm = alc.LoadFromAssemblyPath(testname); 80 | 81 | return asm; 82 | } 83 | 84 | return null; 85 | } 86 | #endif 87 | } 88 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.PowerShell/RemoveAimVirtualDisk.cs: -------------------------------------------------------------------------------- 1 | using Arsenal.ImageMounter.Devio.Server.Services; 2 | using System.Management.Automation; 3 | 4 | namespace Arsenal.ImageMounter.PowerShell; 5 | 6 | [Cmdlet(VerbsCommon.Remove, "AimVirtualDisk")] 7 | public class RemoveAimVirtualDisk : Cmdlet 8 | { 9 | [Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true, HelpMessage = "Mounted virtual disk to open.")] 10 | public DevioServiceBase VirtualDisk { get; set; } = null!; 11 | 12 | protected override void ProcessRecord() 13 | { 14 | if (VirtualDisk is null) 15 | { 16 | throw new PSArgumentException("Needs VirtualDisk parameter"); 17 | } 18 | 19 | VirtualDisk.Dispose(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/Managed Source/Arsenal.ImageMounter.snk -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Collections/DisposableList.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Runtime.InteropServices; 14 | 15 | 16 | 17 | namespace Arsenal.ImageMounter.Collections; 18 | 19 | /// 20 | /// A System.Collections.Generic.List(Of T) extended with IDisposable implementation that disposes each 21 | /// object in the list when the list is disposed. 22 | /// 23 | [ComVisible(false)] 24 | public class DisposableList : DisposableList 25 | { 26 | 27 | public DisposableList() 28 | : base() 29 | { 30 | 31 | } 32 | 33 | public DisposableList(int capacity) 34 | : base(capacity) 35 | { 36 | 37 | } 38 | 39 | public DisposableList(IEnumerable collection) 40 | : base(collection) 41 | { 42 | 43 | } 44 | } 45 | 46 | /// 47 | /// A System.Collections.Generic.List(Of T) extended with IDisposable implementation that disposes each 48 | /// object in the list when the list is disposed. 49 | /// 50 | /// Type of elements in list. Type needs to implement IDisposable interface. 51 | [ComVisible(false)] 52 | 53 | public class DisposableList : List, IDisposable where T : IDisposable 54 | { 55 | 56 | // IDisposable 57 | protected virtual void Dispose(bool disposing) 58 | { 59 | 60 | if (disposing) 61 | { 62 | // Dispose each object in list 63 | foreach (var obj in this) 64 | { 65 | obj?.Dispose(); 66 | } 67 | } 68 | 69 | // Clear list 70 | Clear(); 71 | 72 | } 73 | 74 | // This code added by Visual Basic to correctly implement the disposable pattern. 75 | public void Dispose() 76 | { 77 | // Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. 78 | Dispose(true); 79 | GC.SuppressFinalize(this); 80 | } 81 | 82 | public DisposableList() 83 | : base() 84 | { 85 | 86 | } 87 | 88 | public DisposableList(int capacity) 89 | : base(capacity) 90 | { 91 | 92 | } 93 | 94 | public DisposableList(IEnumerable collection) 95 | : base(collection) 96 | { 97 | 98 | } 99 | } -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/DeviceProperties.cs: -------------------------------------------------------------------------------- 1 | // ScsiAdapter.vb 2 | // Class for controlling Arsenal Image Mounter Devices. 3 | // 4 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 5 | // This source code and API are available under the terms of the Affero General Public 6 | // License v3. 7 | // 8 | // Please see LICENSE.txt for full license terms, including the availability of 9 | // proprietary exceptions. 10 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 11 | // 12 | 13 | using Arsenal.ImageMounter.IO.Native; 14 | using System.Runtime.Versioning; 15 | 16 | 17 | 18 | namespace Arsenal.ImageMounter; 19 | 20 | /// 21 | /// Object storing properties for a virtual disk device. Returned by 22 | /// QueryDevice() method. 23 | /// 24 | public sealed class DeviceProperties 25 | { 26 | [SupportedOSPlatform(NativeConstants.SUPPORTED_WINDOWS_PLATFORM)] 27 | public DeviceProperties(ScsiAdapter adapter, uint deviceNumber) 28 | { 29 | adapter.QueryDevice(deviceNumber, 30 | out var diskSize, 31 | out var bytesPerSector, 32 | out var imageOffset, 33 | out var flags, 34 | out var filename, 35 | out var writeOverlayImageFile); 36 | 37 | DeviceNumber = deviceNumber; 38 | DiskSize = diskSize; 39 | BytesPerSector = bytesPerSector; 40 | ImageOffset = imageOffset; 41 | Flags = flags; 42 | Filename = filename; 43 | WriteOverlayImageFile = writeOverlayImageFile; 44 | } 45 | 46 | /// Device number of virtual disk. 47 | public uint DeviceNumber { get; } 48 | 49 | /// Size of virtual disk. 50 | public long DiskSize { get; } 51 | /// Number of bytes per sector for virtual disk geometry. 52 | public uint BytesPerSector { get; } 53 | /// A skip offset if virtual disk data does not begin immediately at start of disk image file. 54 | /// Frequently used with image formats like Nero NRG which start with a file header not used by Arsenal Image Mounter 55 | /// or Windows filesystem drivers. 56 | public long ImageOffset { get; } 57 | /// Flags specifying properties for virtual disk. See comments for each flag value. 58 | public DeviceFlags Flags { get; } 59 | /// Name of disk image file holding storage for file type virtual disk or used to create a 60 | /// virtual memory type virtual disk. 61 | public string? Filename { get; set; } 62 | 63 | /// Path to differencing file used in write-temporary mode. 64 | public string? WriteOverlayImageFile { get; } 65 | 66 | /// 67 | /// Checks whether flags indicate a writable device, either write-overlay or write original. 68 | /// 69 | public bool IsWritable => Flags.HasFlag(DeviceFlags.WriteOverlay) || !Flags.HasFlag(DeviceFlags.ReadOnly); 70 | } 71 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Devio/Client/ProxyClientService.cs: -------------------------------------------------------------------------------- 1 | using Arsenal.ImageMounter.Devio.Server.Services; 2 | using System.IO; 3 | 4 | namespace Arsenal.ImageMounter.Devio.Client; 5 | 6 | /// 7 | /// Client class used to instruct driver to connect to a proxy service, for example across network. 8 | /// 9 | /// Proxy service to connect to. For proxy, this is the host name or ip address and port to connect to. 10 | /// One of the "ProxyType" flags of specifying which kind of proxy service to connect to. 11 | /// Description of connection to display in user interfaces and similar. 12 | /// Size of virtual disk when mounted, or specify zero to automatically get this information from proxy service. 13 | public class ProxyClientService(string remote, DeviceFlags proxyMode, string description, long diskSize) 14 | : DevioNoneService(remote, diskSize, FileAccess.Read) 15 | { 16 | public override string? ProxyObjectName { get; } = remote; 17 | 18 | public override DeviceFlags ProxyModeFlags { get; } = proxyMode; 19 | 20 | public override string? Description { get; set; } = description; 21 | } 22 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Devio/Server/GenericProviders/DummyProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using System; 12 | using System.Threading; 13 | using System.Threading.Tasks; 14 | 15 | namespace Arsenal.ImageMounter.Devio.Server.GenericProviders; 16 | 17 | public sealed class DummyProvider(long Length) : IDevioProvider 18 | { 19 | /// 20 | /// Event when object is about to be disposed 21 | /// 22 | public event EventHandler? Disposing; 23 | 24 | /// 25 | /// Event when object has been disposed 26 | /// 27 | public event EventHandler? Disposed; 28 | 29 | public long Length { get; } = Length; 30 | 31 | public uint SectorSize => 512U; 32 | 33 | public bool CanWrite => true; 34 | 35 | public bool SupportsParallel => true; 36 | 37 | bool IDevioProvider.SupportsShared => false; 38 | 39 | bool IDevioProvider.ForceSingleThread { get; set; } 40 | 41 | void IDevioProvider.SharedKeys(IMDPROXY_SHARED_REQ Request, out IMDPROXY_SHARED_RESP Response, out ulong[] Keys) => throw new NotImplementedException(); 42 | 43 | int IDevioProvider.Read(nint buffer, int bufferoffset, int count, long fileoffset) => throw new NotImplementedException(); 44 | 45 | int IDevioProvider.Read(byte[] buffer, int bufferoffset, int count, long fileoffset) => throw new NotImplementedException(); 46 | 47 | int IDevioProvider.Read(Span buffer, long fileoffset) => throw new NotImplementedException(); 48 | 49 | ValueTask IDevioProvider.ReadAsync(Memory buffer, long fileoffset, CancellationToken cancellationToken) => throw new NotImplementedException(); 50 | 51 | int IDevioProvider.Write(nint buffer, int bufferoffset, int count, long fileoffset) => throw new NotImplementedException(); 52 | 53 | int IDevioProvider.Write(byte[] buffer, int bufferoffset, int count, long fileoffset) => throw new NotImplementedException(); 54 | 55 | int IDevioProvider.Write(ReadOnlySpan buffer, long fileoffset) => throw new NotImplementedException(); 56 | 57 | ValueTask IDevioProvider.WriteAsync(ReadOnlyMemory buffer, long fileoffset, CancellationToken cancellationToken) => throw new NotImplementedException(); 58 | 59 | public void Dispose() 60 | { 61 | Disposing?.Invoke(this, EventArgs.Empty); 62 | Disposed?.Invoke(this, EventArgs.Empty); 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Devio/Server/Services/IVirtualDiskService.cs: -------------------------------------------------------------------------------- 1 | // DevioServiceBase.vb 2 | // 3 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 4 | // This source code and API are available under the terms of the Affero General Public 5 | // License v3. 6 | // 7 | // Please see LICENSE.txt for full license terms, including the availability of 8 | // proprietary exceptions. 9 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 10 | // 11 | 12 | using Arsenal.ImageMounter.IO.Devices; 13 | using System; 14 | using System.IO; 15 | using System.Threading; 16 | using System.Threading.Tasks; 17 | 18 | namespace Arsenal.ImageMounter.Devio.Server.Services; 19 | 20 | public interface IVirtualDiskService : IDisposable 21 | { 22 | event EventHandler? ServiceShutdown; 23 | 24 | event EventHandler? ServiceStopping; 25 | 26 | event ThreadExceptionEventHandler? ServiceUnhandledException; 27 | 28 | event EventHandler? DiffDeviceFailed; 29 | 30 | bool IsDisposed { get; } 31 | 32 | bool HasDiskDevice { get; } 33 | 34 | uint SectorSize { get; } 35 | 36 | long DiskSize { get; } 37 | 38 | string? Description { get; } 39 | 40 | DiskDevice? OpenDiskDevice(FileAccess access); 41 | 42 | Stream? OpenDiskStream(FileAccess access); 43 | 44 | Stream? OpenVolumeStream(string volumeName, FileAccess access); 45 | 46 | string? GetDiskDeviceName(); 47 | 48 | void RemoveDevice(); 49 | 50 | void RemoveDeviceSafe(); 51 | 52 | bool WaitForExit(TimeSpan millisecondsTimeout); 53 | 54 | ValueTask WaitForExitAsync(TimeSpan millisecondsTimeout); 55 | } 56 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Devio/Server/SpecializedProviders/MultiPartFileStream.cs: -------------------------------------------------------------------------------- 1 | // MultiPartFileStream.vb 2 | // 3 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 4 | // This source code and API are available under the terms of the Affero General Public 5 | // License v3. 6 | // 7 | // Please see LICENSE.txt for full license terms, including the availability of 8 | // proprietary exceptions. 9 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 10 | // 11 | 12 | using Arsenal.ImageMounter.Devio.Server.GenericProviders; 13 | using Arsenal.ImageMounter.IO.Streams; 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Diagnostics; 17 | using System.IO; 18 | using System.Linq; 19 | 20 | 21 | 22 | namespace Arsenal.ImageMounter.Devio.Server.SpecializedProviders; 23 | 24 | public class MultiPartFileStream(IEnumerable Imagefiles, FileAccess DiskAccess, FileShare ShareMode) : CombinedSeekStream(DiskAccess.HasFlag(FileAccess.Write), OpenImagefiles(Imagefiles, DiskAccess, ShareMode)) 25 | { 26 | 27 | public MultiPartFileStream(IEnumerable Imagefiles, FileAccess DiskAccess) 28 | : this(Imagefiles, DiskAccess, FileShare.Read | FileShare.Delete) 29 | { 30 | } 31 | 32 | private static IReadOnlyCollection OpenImagefiles(IEnumerable Imagefiles, FileAccess DiskAccess, FileShare ShareMode) 33 | { 34 | if (Imagefiles is null) 35 | { 36 | throw new ArgumentNullException(nameof(Imagefiles)); 37 | } 38 | 39 | var imagestreams = new List(); 40 | 41 | try 42 | { 43 | foreach (var Imagefile in Imagefiles) 44 | { 45 | Trace.WriteLine($"Opening image {Imagefile}"); 46 | imagestreams.Add(new FileStream(Imagefile, FileMode.Open, DiskAccess, ShareMode)); 47 | } 48 | 49 | if (imagestreams.Count == 0) 50 | { 51 | throw new ArgumentException("No image file names provided.", nameof(Imagefiles)); 52 | } 53 | 54 | return imagestreams; 55 | } 56 | catch (Exception ex) 57 | { 58 | imagestreams.ForEach(imagestream => imagestream.Close()); 59 | 60 | throw new IOException($"Error opening image files '{Imagefiles.FirstOrDefault()}'", ex); 61 | } 62 | } 63 | 64 | public MultiPartFileStream(string FirstImagefile, FileAccess DiskAccess) 65 | : this(ProviderSupport.EnumerateMultiSegmentFiles(FirstImagefile), DiskAccess) 66 | { 67 | } 68 | 69 | public MultiPartFileStream(string FirstImagefile, FileAccess DiskAccess, FileShare ShareMode) 70 | : this(ProviderSupport.EnumerateMultiSegmentFiles(FirstImagefile), DiskAccess, ShareMode) 71 | { 72 | } 73 | } -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Extensions/CollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using LTRData.Extensions.Formatting; 12 | using System; 13 | using System.Collections.Generic; 14 | using System.IO; 15 | using System.Runtime.CompilerServices; 16 | using System.Security.Cryptography; 17 | 18 | #pragma warning disable IDE0079 // Remove unnecessary suppression 19 | 20 | #pragma warning disable IDE0057 // Use range operator 21 | 22 | namespace Arsenal.ImageMounter.Extensions; 23 | 24 | public static class CollectionExtensions 25 | { 26 | private static class StaticHashAlgs where THashAlgorithm : HashAlgorithm, new() 27 | { 28 | [ThreadStatic] 29 | private static THashAlgorithm? instance; 30 | 31 | public static THashAlgorithm Instance => instance ??= new(); 32 | } 33 | 34 | public static string CalculateChecksum(string file) where THashAlgorithm : HashAlgorithm, new() 35 | { 36 | using var stream = File.OpenRead(file); 37 | 38 | var hash = StaticHashAlgs.Instance.ComputeHash(stream); 39 | 40 | return hash.ToHexString(); 41 | } 42 | 43 | public static string CalculateChecksum(Stream stream) where THashAlgorithm : HashAlgorithm, new() 44 | { 45 | var hash = StaticHashAlgs.Instance.ComputeHash(stream); 46 | 47 | return hash.ToHexString(); 48 | } 49 | 50 | #if NET5_0_OR_GREATER 51 | [Obsolete("Use HashData on static HashAlgorithm implementation instead")] 52 | #endif 53 | public static string CalculateChecksum(this byte[] data) where THashAlgorithm : HashAlgorithm, new() 54 | { 55 | var hash = StaticHashAlgs.Instance.ComputeHash(data); 56 | 57 | return hash.ToHexString(); 58 | } 59 | 60 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 61 | public static void AddRange(this List list, params T[] collection) => list.AddRange(collection); 62 | 63 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 64 | public static unsafe Span AsSpan(this nint ptr, int length) => 65 | new((void*)ptr, length); 66 | 67 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 68 | public static unsafe ReadOnlySpan AsReadOnlySpan(this nint ptr, int length) => 69 | new((void*)ptr, length); 70 | } 71 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Extensions/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using DiscUtils.Streams; 12 | using DiscUtils.Streams.Compatibility; 13 | using System; 14 | using System.Diagnostics; 15 | using System.IO; 16 | using System.Reflection; 17 | using System.Runtime.InteropServices; 18 | using System.Threading; 19 | 20 | namespace Arsenal.ImageMounter.Extensions; 21 | 22 | public static class ExtensionMethods 23 | { 24 | public static T Read(this Stream stream) where T : unmanaged 25 | { 26 | Span buffer = stackalloc T[1]; 27 | var bytes = MemoryMarshal.AsBytes(buffer); 28 | stream.ReadExactly(bytes); 29 | return buffer[0]; 30 | } 31 | 32 | #if NET8_0_OR_GREATER 33 | public static void Write(this Stream stream, in T data) where T : unmanaged 34 | { 35 | ReadOnlySpan buffer = MemoryMarshal.CreateReadOnlySpan(in data, 1); 36 | 37 | var bytes = MemoryMarshal.AsBytes(buffer); 38 | 39 | stream.Write(bytes); 40 | } 41 | #else 42 | public static unsafe void Write(this Stream stream, in T data) where T : unmanaged 43 | { 44 | fixed (void* buffer = &data) 45 | { 46 | var bytes = new ReadOnlySpan((byte*)buffer, sizeof(T)); 47 | 48 | stream.Write(bytes); 49 | } 50 | } 51 | #endif 52 | 53 | /// 54 | /// Queues dispose on a worker thread to avoid blocking calling thread. 55 | /// 56 | /// Instance to dispose 57 | public static void QueueDispose(this IDisposable instance) 58 | => ThreadPool.QueueUserWorkItem(_ => 59 | { 60 | if (instance is IAsyncDisposable asyncDisposable) 61 | { 62 | asyncDisposable.QueueDispose(); 63 | return; 64 | } 65 | 66 | try 67 | { 68 | instance.Dispose(); 69 | } 70 | catch (Exception ex) 71 | { 72 | Trace.WriteLine($"Exception in {instance.GetType().FullName}.QueueDispose: {ex}"); 73 | } 74 | }); 75 | 76 | /// 77 | /// Queues dispose on a worker thread to avoid blocking calling thread. 78 | /// 79 | /// Instance to dispose 80 | public static void QueueDispose(this IAsyncDisposable instance) 81 | => ThreadPool.QueueUserWorkItem(async _ => 82 | { 83 | try 84 | { 85 | await instance.DisposeAsync().ConfigureAwait(false); 86 | } 87 | catch (Exception ex) 88 | { 89 | Trace.WriteLine($"Exception in {instance.GetType().FullName}.QueueDispose: {ex}"); 90 | } 91 | }); 92 | } 93 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Extensions/UnmanagedMemoryManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Buffers; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace Arsenal.ImageMounter.Extensions; 6 | 7 | /// 8 | /// 9 | public static class UnmanagedMemoryExtensions 10 | { 11 | /// 12 | /// Gets a disposable for an unmanaged memory block. 13 | /// This can be used to get a that can be sent to asynchronous 14 | /// API or delegates. Remember though, that the memory is invalid after 15 | /// has been unallocated or disposed. 16 | /// 17 | public static MemoryManager GetMemoryManager(this SafeBuffer safeBuffer) 18 | => new UnmanagedMemoryManager(safeBuffer.DangerousGetHandle(), (int)safeBuffer.ByteLength); 19 | } 20 | 21 | internal sealed class UnmanagedMemoryManager(nint address, int count) : MemoryManager where T : unmanaged 22 | { 23 | private bool _disposed; 24 | 25 | public override unsafe Span GetSpan() 26 | { 27 | if (_disposed) 28 | { 29 | throw new ObjectDisposedException(nameof(UnmanagedMemoryManager)); 30 | } 31 | 32 | return new((T*)address, count); 33 | } 34 | 35 | public override unsafe MemoryHandle Pin(int elementIndex = 0) 36 | { 37 | if (_disposed) 38 | { 39 | throw new ObjectDisposedException(nameof(UnmanagedMemoryManager)); 40 | } 41 | 42 | if (elementIndex < 0 || elementIndex >= count) 43 | { 44 | throw new ArgumentOutOfRangeException(nameof(elementIndex)); 45 | } 46 | 47 | var pointer = address + elementIndex; 48 | return new MemoryHandle((T*)pointer, default, this); 49 | } 50 | 51 | public override void Unpin() 52 | { 53 | // No need to do anything, since we're dealing with unmanaged memory. 54 | } 55 | 56 | protected override void Dispose(bool disposing) 57 | { 58 | if (!_disposed) 59 | { 60 | address = 0; 61 | count = 0; 62 | _disposed = true; 63 | } 64 | } 65 | 66 | public override unsafe string ToString() 67 | => $"{typeof(T).Name} 0x{address:x}[{count}]"; 68 | } 69 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/GlobalCriticalMutex.cs: -------------------------------------------------------------------------------- 1 | // API.vb 2 | // API for manipulating flag values, issuing SCSI bus rescans and similar 3 | // tasks. 4 | // 5 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 6 | // This source code and API are available under the terms of the Affero General Public 7 | // License v3. 8 | // 9 | // Please see LICENSE.txt for full license terms, including the availability of 10 | // proprietary exceptions. 11 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 12 | // 13 | 14 | using System; 15 | using System.Threading; 16 | 17 | 18 | 19 | namespace Arsenal.ImageMounter; 20 | 21 | public sealed class GlobalCriticalMutex : IDisposable 22 | { 23 | 24 | private const string GlobalCriticalSectionMutexName = @"Global\AIMCriticalOperation"; 25 | 26 | private Mutex mutex; 27 | 28 | public bool WasAbandoned { get; } 29 | 30 | public GlobalCriticalMutex() 31 | { 32 | 33 | mutex = new Mutex(initiallyOwned: true, name: GlobalCriticalSectionMutexName, createdNew: out var createdNew); 34 | 35 | try 36 | { 37 | if (!createdNew) 38 | { 39 | mutex.WaitOne(); 40 | } 41 | } 42 | 43 | catch (AbandonedMutexException) 44 | { 45 | WasAbandoned = true; 46 | } 47 | 48 | catch (Exception ex) 49 | { 50 | mutex.Dispose(); 51 | 52 | throw new Exception("Error entering global critical section for Arsenal Image Mounter driver", ex); 53 | 54 | } 55 | } 56 | 57 | private bool disposedValue; // To detect redundant calls 58 | 59 | // IDisposable 60 | private void Dispose(bool disposing) 61 | { 62 | if (!disposedValue) 63 | { 64 | if (disposing) 65 | { 66 | mutex.ReleaseMutex(); 67 | mutex.Dispose(); 68 | } 69 | 70 | // TODO: free unmanaged resources (unmanaged objects) and override Finalize() below. 71 | 72 | // TODO: set large fields to null. 73 | mutex = null!; 74 | } 75 | 76 | disposedValue = true; 77 | } 78 | 79 | // TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources. 80 | // Protected Overrides Sub Finalize() 81 | // Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. 82 | // Dispose(False) 83 | // MyBase.Finalize() 84 | // End Sub 85 | 86 | // This code added by Visual Basic to correctly implement the disposable pattern. 87 | public void Dispose() => 88 | // Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. 89 | Dispose(true);// TODO: uncomment the following line if Finalize() is overridden above.// GC.SuppressFinalize(Me) 90 | 91 | } -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/IO/ConsoleIO/ConsoleSpinProgress.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using LTRData.Extensions.IO; 12 | using System; 13 | using System.Threading; 14 | 15 | 16 | 17 | namespace Arsenal.ImageMounter.IO.ConsoleIO; 18 | 19 | public class ConsoleSpinProgress : IDisposable 20 | { 21 | 22 | public Timer Timer { get; } 23 | 24 | private char CurrentChar; 25 | 26 | public ConsoleSpinProgress(int dueTime, int period) 27 | { 28 | Timer = new Timer(Tick); 29 | Timer.Change(dueTime, period); 30 | } 31 | 32 | public ConsoleSpinProgress(TimeSpan dueTime, TimeSpan period) 33 | { 34 | Timer = new Timer(Tick); 35 | Timer.Change(dueTime, period); 36 | } 37 | 38 | private void Tick(object? o) => UpdateConsoleSpinProgress(ref CurrentChar); 39 | 40 | public static void UpdateConsoleSpinProgress(ref char chr) 41 | { 42 | chr = chr switch 43 | { 44 | '\\' => '|', 45 | '|' => '/', 46 | '/' => '-', 47 | _ => '\\', 48 | }; 49 | 50 | lock (ConsoleSupport.ConsoleSync) 51 | { 52 | Console.ForegroundColor = ConsoleProgressBar.ConsoleProgressBarColor; 53 | 54 | Console.Write(chr); 55 | Console.Write('\b'); 56 | 57 | Console.ResetColor(); 58 | } 59 | } 60 | 61 | private bool disposedValue; // To detect redundant calls 62 | 63 | // IDisposable 64 | protected virtual void Dispose(bool disposing) 65 | { 66 | if (!disposedValue) 67 | { 68 | if (disposing) 69 | { 70 | // TODO: dispose managed state (managed objects). 71 | Timer.Dispose(); 72 | Console.WriteLine(" "); 73 | 74 | } 75 | 76 | // TODO: free unmanaged resources (unmanaged objects) and override Finalize() below. 77 | 78 | // TODO: set large fields to null. 79 | } 80 | 81 | disposedValue = true; 82 | } 83 | 84 | // TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources. 85 | ~ConsoleSpinProgress() 86 | { 87 | // Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. 88 | Dispose(false); 89 | } 90 | 91 | // This code added by Visual Basic to correctly implement the disposable pattern. 92 | public void Dispose() 93 | { 94 | // Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above. 95 | Dispose(true); 96 | // TODO: uncomment the following line if Finalize() is overridden above. 97 | GC.SuppressFinalize(this); 98 | } 99 | } -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/IO/Native/NativeStructWrapper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using System.Diagnostics.CodeAnalysis; 12 | using System.Runtime.InteropServices; 13 | 14 | namespace Arsenal.ImageMounter.IO.Native; 15 | 16 | /// 17 | /// This class allocates unmanaged memory for a native structure and initializes 18 | /// that memory by marshalling a managed object. It gurantees that the managed 19 | /// object stays alive and the unmanaged memory block is valid for at least the 20 | /// lifetime of this object and that the unmanaged memory is released when this 21 | /// object is disposed. 22 | /// 23 | /// Since this class derives form SafeBuffer there are many instance methods 24 | /// available to read and modify the unmanaged buffer in a safe way and when 25 | /// marshalled to native code in for example a P/Invoke call, it gets automatically 26 | /// translated to the address of the unmanaged memory block. It also uses reference 27 | /// counting and is guaranteed to stay alive during such calls. 28 | /// 29 | /// 30 | /// Type of managed object 31 | [SuppressMessage("Interoperability", "CA1421:This method uses runtime marshalling even when the 'DisableRuntimeMarshallingAttribute' is applied", Justification = "Explicit runtime marshalling")] 32 | public class NativeStructWrapper : SafeBuffer where T : class 33 | { 34 | /// 35 | /// Initializes a new instance by allocating unmanaged memory and marshalling 36 | /// the supplied managed object to that memory. 37 | /// 38 | /// Managed object to marshal to unmanaged memory 39 | public NativeStructWrapper(T obj) 40 | : base(ownsHandle: true) 41 | { 42 | var size = Marshal.SizeOf(obj); 43 | SetHandle(Marshal.AllocHGlobal(size)); 44 | Initialize((ulong)size); 45 | Object = obj; 46 | Marshal.StructureToPtr(obj, handle, false); 47 | } 48 | 49 | /// 50 | /// Initializes an empty instance. Used internally by native marshaller and 51 | /// not intended to be used directly from user code. 52 | /// 53 | public NativeStructWrapper() 54 | : base(ownsHandle: true) 55 | { 56 | } 57 | 58 | /// 59 | /// Managed object that was originally marshalled to unmanaged memory. 60 | /// 61 | public T? Object { get; } 62 | 63 | /// 64 | /// Releases unmanaged memory used by this instance. 65 | /// 66 | /// Always returns true 67 | protected override bool ReleaseHandle() 68 | { 69 | Marshal.FreeHGlobal(handle); 70 | return true; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/IO/Streams/CompletionPosition.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | 12 | 13 | using System; 14 | using System.Diagnostics; 15 | using System.Threading; 16 | 17 | namespace Arsenal.ImageMounter.IO.Streams; 18 | 19 | public class CompletionPosition(long totalLength) 20 | { 21 | private readonly Stopwatch stopwatch = Stopwatch.StartNew(); 22 | 23 | private long lengthComplete; 24 | 25 | public virtual long LengthComplete 26 | { 27 | get => lengthComplete; 28 | set => lengthComplete = value; 29 | } 30 | 31 | public bool UnreliablePosition { get; set; } 32 | 33 | public virtual long LengthTotal { get; set; } = totalLength; 34 | 35 | public virtual double PercentComplete => 100d * LengthComplete / LengthTotal; 36 | 37 | public virtual TimeSpan ElapsedTime => stopwatch.Elapsed; 38 | 39 | public virtual TimeSpan? EstimatedTimeRemaining 40 | { 41 | get 42 | { 43 | if (UnreliablePosition) 44 | { 45 | return null; 46 | } 47 | 48 | if (LengthComplete >= LengthTotal) 49 | { 50 | return TimeSpan.Zero; 51 | } 52 | 53 | var elapsedTicks = stopwatch.ElapsedMilliseconds; 54 | 55 | var totalTicks = elapsedTicks / ((double)LengthComplete / LengthTotal); 56 | 57 | var ticksLeft = totalTicks - elapsedTicks; 58 | 59 | if (double.IsInfinity(ticksLeft) || double.IsNaN(ticksLeft)) 60 | { 61 | return null; 62 | } 63 | 64 | return TimeSpan.FromMilliseconds(ticksLeft); 65 | } 66 | } 67 | 68 | public virtual void Reset() 69 | { 70 | LengthComplete = 0; 71 | 72 | stopwatch.Reset(); 73 | stopwatch.Start(); 74 | } 75 | 76 | public void InterlockedIncrement() 77 | => Interlocked.Increment(ref lengthComplete); 78 | } -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/IO/Streams/SeekableBufferedStream.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using DiscUtils.Streams; 12 | using System.IO; 13 | 14 | 15 | 16 | namespace Arsenal.ImageMounter.IO.Streams; 17 | 18 | public static class SeekableBufferedStream 19 | { 20 | public static int FileDatabufferChunkSize { get; set; } = 32 * 1024 * 1024; 21 | 22 | public static Stream BufferIfNotSeekable(Stream SourceStream, string StreamName) 23 | { 24 | if (SourceStream is null) 25 | { 26 | return Stream.Null; 27 | } 28 | else if (SourceStream.CanSeek) 29 | { 30 | return SourceStream; 31 | } 32 | 33 | using (SourceStream) 34 | { 35 | if (SourceStream.Length >= FileDatabufferChunkSize) 36 | { 37 | var data = new SparseMemoryBuffer(FileDatabufferChunkSize); 38 | 39 | return data.WriteFromStream(0, SourceStream, SourceStream.Length) < SourceStream.Length 40 | ? throw new EndOfStreamException($"Unexpected end of stream '{StreamName}'") 41 | : (Stream)new SparseMemoryStream(data, FileAccess.Read); 42 | } 43 | else 44 | { 45 | var data = new byte[SourceStream.Length]; 46 | 47 | return SourceStream.Read(data, 0, data.Length) < SourceStream.Length 48 | ? throw new EndOfStreamException($"Unexpected end of stream '{StreamName}'") 49 | : (Stream)new MemoryStream(data, writable: false); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Internal/Compat.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using System.Runtime.CompilerServices; 12 | 13 | [assembly: InternalsVisibleTo("Arsenal.ImageMounter")] 14 | [assembly: InternalsVisibleTo("Arsenal.ImageMounter.Devio")] 15 | [assembly: InternalsVisibleTo("Arsenal.ImageMounter.Devio.Interop")] 16 | [assembly: InternalsVisibleTo("aim_cli")] 17 | 18 | #pragma warning disable IDE0079 // Remove unnecessary suppression 19 | 20 | 21 | #if !NET5_0_OR_GREATER 22 | 23 | namespace System.Runtime.CompilerServices 24 | { 25 | /// 26 | /// Reserved to be used by the compiler for tracking metadata. This class should not be used by developers in source code. 27 | /// 28 | internal static class IsExternalInit 29 | { 30 | } 31 | } 32 | 33 | namespace System.Runtime.Versioning 34 | { 35 | // 36 | // Summary: 37 | // Base type for all platform-specific API attributes. 38 | internal abstract class OSPlatformAttribute : Attribute 39 | { 40 | // 41 | // Summary: 42 | // Gets the name and optional version of the platform that the attribute applies 43 | // to. 44 | // 45 | // Returns: 46 | // The applicable platform name and optional version. 47 | public string PlatformName 48 | { 49 | get; 50 | } 51 | 52 | private protected OSPlatformAttribute(string platformName) 53 | { 54 | PlatformName = platformName; 55 | } 56 | } 57 | 58 | // 59 | // Summary: 60 | // Indicates that an API is supported for a specified platform or operating system. 61 | // If a version is specified, the API cannot be called from an earlier version. 62 | // Multiple attributes can be applied to indicate support on multiple operating 63 | // systems. 64 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)] 65 | internal sealed class SupportedOSPlatformAttribute(string platformName) : OSPlatformAttribute(platformName) 66 | { 67 | } 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using System.Runtime.CompilerServices; 12 | using System.Runtime.InteropServices; 13 | 14 | // General Information about an assembly is controlled through the following 15 | // set of attributes. Change these attribute values to modify the information 16 | // associated with an assembly. 17 | 18 | [assembly: ComVisible(true)] 19 | 20 | #if NET7_0_OR_GREATER 21 | [assembly: DisableRuntimeMarshalling] 22 | #endif 23 | 24 | [assembly: DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)] 25 | 26 | [assembly: InternalsVisibleTo("Arsenal.ImageMounter.Forms")] 27 | [assembly: InternalsVisibleTo("ArsenalImageMounterAnalyze")] 28 | 29 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/README.md: -------------------------------------------------------------------------------- 1 | Arsenal-Image-Mounter 2 | ===================== 3 | 4 | Arsenal Image Mounter mounts the contents of disk images as complete disks in Microsoft Windows. Arsenal Image Mounter includes a virtual SCSI adapter (via a unique Storport miniport driver) which allows users to benefit from disk-specific features in Windows like integration with Disk Manager, access to Volume Shadow Copies, and more. As far as Windows is concerned, the contents of disk images mounted by Arsenal Image Mounter are “real” SCSI disks. 5 | 6 | For developers, Arsenal Image Mounter source code and APIs are available for royalty-free use by open source projects. Commercial projects (and other projects not licensed under an AGPL v3 compatible license - see http://www.fsf.org/licensing/licenses/agpl-3.0.html) that would like to use Arsenal Image Mounter source code and/or APIs must contact us (https://ArsenalRecon.com/contact/) to obtain alternative licensing. 7 | 8 | For end users, Arsenal Image Mounter’s full functionality (along with all our other tools) is available as part of an affordable monthly subscription. If Arsenal Image Mounter is licensed, it runs in "Professional Mode.” If Arsenal Image Mounter is run without a license, it will run in "Free Mode" and provide core functionality. 9 | 10 | Please see Arsenal Image Mounter’s product page: https://ArsenalRecon.com/weapons/image-mounter for more details. 11 | 12 | Supporting Arsenal Image Mounter 13 | -------------------------------- 14 | 15 | We appreciate your help making commercial projects aware of Arsenal Image Mounter’s capabilities, because commercial licensing of our source code and APIs supports ongoing development. On a related note, we know that some commercial projects are using Arsenal Image Mounter’s source code and APIs without being properly licensed… we also appreciate being alerted to these situations so we can nudge those projects appropriately. 16 | 17 | More Details on Licensing and Contributions 18 | ------------------------------------------- 19 | 20 | We chose a dual-license for Arsenal Image Mounter (more specifically, Arsenal Image Mounter’s source code and APIs) to allow its royalty-free use by open source projects, but require financial support from commercial projects. 21 | 22 | Arsenal Consulting, Inc. (d/b/a Arsenal Recon) retains the copyright to Arsenal Image Mounter, including the Arsenal Image Mounter source code and APIs, being made available under terms of the Affero General Public License v3. Arsenal Image Mounter source code and APIs may be used in projects that are licensed so as to be compatible with AGPL v3. If your project is not licensed under an AGPL v3 compatible license and you would like to use Arsenal Image Mounter source code and/or APIs, contact us to obtain alternative licensing. 23 | 24 | Contributors to Arsenal Image Mounter must sign the Arsenal Contributor Agreement ("ACA"). The ACA gives Arsenal and the contributor joint copyright interests in the source code. 25 | -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Reflection/EquatableBox.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using System; 12 | 13 | 14 | 15 | namespace Arsenal.ImageMounter.Reflection; 16 | 17 | public sealed class EquatableBox : IEquatable, IEquatable> where T : struct, IEquatable 18 | { 19 | public T Value { get; set; } 20 | 21 | public EquatableBox() 22 | { 23 | } 24 | 25 | public EquatableBox(T value) 26 | { 27 | Value = value; 28 | } 29 | 30 | public bool HasDefaultValue => Value.Equals(default); 31 | 32 | public void ClearValue() => Value = new T(); 33 | 34 | public static implicit operator EquatableBox(T value) => new(value); 35 | 36 | public static implicit operator T(EquatableBox box) => box.Value; 37 | 38 | public override string? ToString() => Value.ToString(); 39 | 40 | public override int GetHashCode() => Value.GetHashCode(); 41 | 42 | public bool Equals(EquatableBox? other) => Value.Equals(other?.Value); 43 | 44 | public bool Equals(T other) => Value.Equals(other); 45 | 46 | public override bool Equals(object? obj) 47 | { 48 | if (obj is EquatableBox box) 49 | { 50 | return Value.Equals(box.Value); 51 | } 52 | else 53 | { 54 | return obj is T value 55 | ? Value.Equals(value) 56 | : base.Equals(obj); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Managed Source/Arsenal.ImageMounter/Reflection/SequenceComparer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Linq; 14 | using System.Runtime.InteropServices; 15 | 16 | 17 | 18 | namespace Arsenal.ImageMounter.Reflection; 19 | 20 | [ComVisible(false)] 21 | public sealed class SequenceEqualityComparer : IEqualityComparer> 22 | { 23 | 24 | public IEqualityComparer ItemComparer { get; set; } 25 | 26 | public SequenceEqualityComparer(IEqualityComparer comparer) 27 | { 28 | ItemComparer = comparer; 29 | } 30 | 31 | public SequenceEqualityComparer() 32 | { 33 | ItemComparer = EqualityComparer.Default; 34 | } 35 | 36 | public bool Equals(IEnumerable? x, IEnumerable? y) 37 | => ReferenceEquals(x, y) 38 | || (x is not null && y is not null && x.SequenceEqual(y, ItemComparer)); 39 | 40 | public int GetHashCode(IEnumerable obj) 41 | { 42 | var result = new HashCode(); 43 | foreach (var item in obj) 44 | { 45 | result.Add(item, ItemComparer); 46 | } 47 | 48 | return result.ToHashCode(); 49 | } 50 | } 51 | 52 | [ComVisible(false)] 53 | public sealed class SequenceComparer : IComparer> 54 | { 55 | 56 | public IComparer ItemComparer { get; set; } 57 | 58 | public SequenceComparer(IComparer comparer) 59 | { 60 | ItemComparer = comparer; 61 | } 62 | 63 | public SequenceComparer() 64 | { 65 | ItemComparer = Comparer.Default; 66 | } 67 | 68 | public int Compare(IEnumerable? x, IEnumerable? y) 69 | { 70 | if (ReferenceEquals(x, y)) 71 | { 72 | return 0; 73 | } 74 | 75 | if (x is null) 76 | { 77 | return 1; 78 | } 79 | 80 | if (y is null) 81 | { 82 | return -1; 83 | } 84 | 85 | var value = 0; 86 | using var enumx = x.GetEnumerator(); 87 | using var enumy = y.GetEnumerator(); 88 | while (enumx.MoveNext() && enumy.MoveNext()) 89 | { 90 | value = ItemComparer.Compare(enumx.Current, enumy.Current); 91 | if (value != 0) 92 | { 93 | break; 94 | } 95 | } 96 | 97 | return value; 98 | } 99 | } -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterAnalyze/ArsenalImageMounterAnalyze.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Exe 7 | Arsenal Image Mounter Debug-Analyze Tool 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterAnalyze/README.md: -------------------------------------------------------------------------------- 1 | Arsenal-Image-Mounter 2 | ===================== 3 | 4 | Arsenal Image Mounter mounts the contents of disk images as complete disks in Microsoft Windows. Arsenal Image Mounter includes a virtual SCSI adapter (via a unique Storport miniport driver) which allows users to benefit from disk-specific features in Windows like integration with Disk Manager, access to Volume Shadow Copies, and more. As far as Windows is concerned, the contents of disk images mounted by Arsenal Image Mounter are “real” SCSI disks. 5 | 6 | For developers, Arsenal Image Mounter source code and APIs are available for royalty-free use by open source projects. Commercial projects (and other projects not licensed under an AGPL v3 compatible license - see http://www.fsf.org/licensing/licenses/agpl-3.0.html) that would like to use Arsenal Image Mounter source code and/or APIs must contact us (https://ArsenalRecon.com/contact/) to obtain alternative licensing. 7 | 8 | For end users, Arsenal Image Mounter’s full functionality (along with all our other tools) is available as part of an affordable monthly subscription. If Arsenal Image Mounter is licensed, it runs in "Professional Mode.” If Arsenal Image Mounter is run without a license, it will run in "Free Mode" and provide core functionality. 9 | 10 | Please see Arsenal Image Mounter’s product page: https://ArsenalRecon.com/weapons/image-mounter for more details. 11 | 12 | Supporting Arsenal Image Mounter 13 | -------------------------------- 14 | 15 | We appreciate your help making commercial projects aware of Arsenal Image Mounter’s capabilities, because commercial licensing of our source code and APIs supports ongoing development. On a related note, we know that some commercial projects are using Arsenal Image Mounter’s source code and APIs without being properly licensed… we also appreciate being alerted to these situations so we can nudge those projects appropriately. 16 | 17 | More Details on Licensing and Contributions 18 | ------------------------------------------- 19 | 20 | We chose a dual-license for Arsenal Image Mounter (more specifically, Arsenal Image Mounter’s source code and APIs) to allow its royalty-free use by open source projects, but require financial support from commercial projects. 21 | 22 | Arsenal Consulting, Inc. (d/b/a Arsenal Recon) retains the copyright to Arsenal Image Mounter, including the Arsenal Image Mounter source code and APIs, being made available under terms of the Affero General Public License v3. Arsenal Image Mounter source code and APIs may be used in projects that are licensed so as to be compatible with AGPL v3. If your project is not licensed under an AGPL v3 compatible license and you would like to use Arsenal Image Mounter source code and/or APIs, contact us to obtain alternative licensing. 23 | 24 | Contributors to Arsenal Image Mounter must sign the Arsenal Contributor Agreement ("ACA"). The ACA gives Arsenal and the contributor joint copyright interests in the source code. 25 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterAnalyze/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterCLISetup/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterCLISetup/ArsenalImageMounterCLISetup.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Exe 7 | true 8 | Arsenal Image Mounter Command Line Setup 9 | net48;net8.0-windows;net9.0-windows 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterCLISetup/README.md: -------------------------------------------------------------------------------- 1 | Arsenal-Image-Mounter 2 | ===================== 3 | 4 | Arsenal Image Mounter mounts the contents of disk images as complete disks in Microsoft Windows. Arsenal Image Mounter includes a virtual SCSI adapter (via a unique Storport miniport driver) which allows users to benefit from disk-specific features in Windows like integration with Disk Manager, access to Volume Shadow Copies, and more. As far as Windows is concerned, the contents of disk images mounted by Arsenal Image Mounter are “real” SCSI disks. 5 | 6 | For developers, Arsenal Image Mounter source code and APIs are available for royalty-free use by open source projects. Commercial projects (and other projects not licensed under an AGPL v3 compatible license - see http://www.fsf.org/licensing/licenses/agpl-3.0.html) that would like to use Arsenal Image Mounter source code and/or APIs must contact us (https://ArsenalRecon.com/contact/) to obtain alternative licensing. 7 | 8 | For end users, Arsenal Image Mounter’s full functionality (along with all our other tools) is available as part of an affordable monthly subscription. If Arsenal Image Mounter is licensed, it runs in "Professional Mode.” If Arsenal Image Mounter is run without a license, it will run in "Free Mode" and provide core functionality. 9 | 10 | Please see Arsenal Image Mounter’s product page: https://ArsenalRecon.com/weapons/image-mounter for more details. 11 | 12 | Supporting Arsenal Image Mounter 13 | -------------------------------- 14 | 15 | We appreciate your help making commercial projects aware of Arsenal Image Mounter’s capabilities, because commercial licensing of our source code and APIs supports ongoing development. On a related note, we know that some commercial projects are using Arsenal Image Mounter’s source code and APIs without being properly licensed… we also appreciate being alerted to these situations so we can nudge those projects appropriately. 16 | 17 | More Details on Licensing and Contributions 18 | ------------------------------------------- 19 | 20 | We chose a dual-license for Arsenal Image Mounter (more specifically, Arsenal Image Mounter’s source code and APIs) to allow its royalty-free use by open source projects, but require financial support from commercial projects. 21 | 22 | Arsenal Consulting, Inc. (d/b/a Arsenal Recon) retains the copyright to Arsenal Image Mounter, including the Arsenal Image Mounter source code and APIs, being made available under terms of the Affero General Public License v3. Arsenal Image Mounter source code and APIs may be used in projects that are licensed so as to be compatible with AGPL v3. If your project is not licensed under an AGPL v3 compatible license and you would like to use Arsenal Image Mounter source code and/or APIs, contact us to obtain alternative licensing. 23 | 24 | Contributors to Arsenal Image Mounter must sign the Arsenal Contributor Agreement ("ACA"). The ACA gives Arsenal and the contributor joint copyright interests in the source code. 25 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterGUISetup/ArsenalImageMounterGUISetup.vbproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | WinExe 7 | true 8 | Arsenal Image Mounter Setup 9 | Arsenal.ImageMounter.MainForm 10 | net48;net8.0-windows;net9.0-windows 11 | app.manifest 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterGUISetup/GlobalSuppressions.vb: -------------------------------------------------------------------------------- 1 | ' This file is used by Code Analysis to maintain SuppressMessage 2 | ' attributes that are applied to this project. 3 | ' Project-level suppressions either have no target or are given 4 | ' a specific target and scoped to a namespace, type, member, etc. 5 | 6 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterGUISetup/README.md: -------------------------------------------------------------------------------- 1 | Arsenal-Image-Mounter 2 | ===================== 3 | 4 | Arsenal Image Mounter mounts the contents of disk images as complete disks in Microsoft Windows. Arsenal Image Mounter includes a virtual SCSI adapter (via a unique Storport miniport driver) which allows users to benefit from disk-specific features in Windows like integration with Disk Manager, access to Volume Shadow Copies, and more. As far as Windows is concerned, the contents of disk images mounted by Arsenal Image Mounter are “real” SCSI disks. 5 | 6 | For developers, Arsenal Image Mounter source code and APIs are available for royalty-free use by open source projects. Commercial projects (and other projects not licensed under an AGPL v3 compatible license - see http://www.fsf.org/licensing/licenses/agpl-3.0.html) that would like to use Arsenal Image Mounter source code and/or APIs must contact us (https://ArsenalRecon.com/contact/) to obtain alternative licensing. 7 | 8 | For end users, Arsenal Image Mounter’s full functionality (along with all our other tools) is available as part of an affordable monthly subscription. If Arsenal Image Mounter is licensed, it runs in "Professional Mode.” If Arsenal Image Mounter is run without a license, it will run in "Free Mode" and provide core functionality. 9 | 10 | Please see Arsenal Image Mounter’s product page: https://ArsenalRecon.com/weapons/image-mounter for more details. 11 | 12 | Supporting Arsenal Image Mounter 13 | -------------------------------- 14 | 15 | We appreciate your help making commercial projects aware of Arsenal Image Mounter’s capabilities, because commercial licensing of our source code and APIs supports ongoing development. On a related note, we know that some commercial projects are using Arsenal Image Mounter’s source code and APIs without being properly licensed… we also appreciate being alerted to these situations so we can nudge those projects appropriately. 16 | 17 | More Details on Licensing and Contributions 18 | ------------------------------------------- 19 | 20 | We chose a dual-license for Arsenal Image Mounter (more specifically, Arsenal Image Mounter’s source code and APIs) to allow its royalty-free use by open source projects, but require financial support from commercial projects. 21 | 22 | Arsenal Consulting, Inc. (d/b/a Arsenal Recon) retains the copyright to Arsenal Image Mounter, including the Arsenal Image Mounter source code and APIs, being made available under terms of the Affero General Public License v3. Arsenal Image Mounter source code and APIs may be used in projects that are licensed so as to be compatible with AGPL v3. If your project is not licensed under an AGPL v3 compatible license and you would like to use Arsenal Image Mounter source code and/or APIs, contact us to obtain alternative licensing. 23 | 24 | Contributors to Arsenal Image Mounter must sign the Arsenal Contributor Agreement ("ACA"). The ACA gives Arsenal and the contributor joint copyright interests in the source code. 25 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterGUISetup/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 20 | 21 | 23 | 24 | 34 | 35 | 37 | 38 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | False 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterGUISetup/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterMountTool/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterMountTool/ArsenalImageMounterMountTool.vbproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | WinExe 7 | true 8 | Arsenal Image Mounter Mount Tool 9 | net48;net8.0-windows;net9.0-windows 10 | app.manifest 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterMountTool/AsyncMessageBox.Designer.vb: -------------------------------------------------------------------------------- 1 |  _ 2 | Partial Class AsyncMessageBox 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form overrides dispose to clean up the component list. 6 | _ 7 | Protected Overrides Sub Dispose(disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Required by the Windows Form Designer 18 | Private components As System.ComponentModel.IContainer 19 | 20 | 'NOTE: The following procedure is required by the Windows Form Designer 21 | 'It can be modified using the Windows Form Designer. 22 | 'Do not modify it using the code editor. 23 | _ 24 | Private Sub InitializeComponent() 25 | Me.SuspendLayout() 26 | ' 27 | 'AsyncMessageBox 28 | ' 29 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) 30 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 31 | Me.ClientSize = New System.Drawing.Size(448, 171) 32 | Me.ControlBox = False 33 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle 34 | Me.MaximizeBox = False 35 | Me.MinimizeBox = False 36 | Me.Name = "AsyncMessageBox" 37 | Me.ShowIcon = False 38 | Me.ShowInTaskbar = False 39 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen 40 | Me.ResumeLayout(False) 41 | 42 | End Sub 43 | 44 | Public Sub New() 45 | 46 | ' This call is required by the designer. 47 | InitializeComponent() 48 | 49 | ' Add any initialization after the InitializeComponent() call. 50 | 51 | End Sub 52 | 53 | End Class 54 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterMountTool/EULA.txt: -------------------------------------------------------------------------------- 1 | Arsenal Image Mounter including its MountTool ("the Software") 2 | are provided "AS IS" and "WITH ALL FAULTS," without warranty 3 | of any kind, including without limitation the warranties of 4 | merchantability, fitness for a particular purpose and 5 | non-infringement. Arsenal makes no warranty that the Software 6 | is free of defects or is suitable for any particular purpose. 7 | In no event shall Arsenal be responsible for loss or damages 8 | arising from the installation or use of the Software, including 9 | but not limited to any indirect, punitive, special, incidental 10 | or consequential damages of any character including, without 11 | limitation, damages for loss of goodwill, work stoppage, 12 | computer failure or malfunction, or any and all other 13 | commercial damages or losses. The entire risk as to the 14 | quality and performance of the Software is borne by you. Should 15 | the Software prove defective, you and not Arsenal assume the 16 | entire cost of any service and repair. 17 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterMountTool/LibewfVerify.vb: -------------------------------------------------------------------------------- 1 | Imports System.Windows.Forms 2 | Imports Arsenal.ImageMounter.IO.Native 3 | 4 | Public MustInherit Class LibewfVerify 5 | 6 | Private Sub New() 7 | 8 | End Sub 9 | 10 | Public Shared Function VerifyLibewf(owner As IWin32Window) As Boolean 11 | 12 | '' Just a test to trig cctor call in DevioProviderLibEwf and thereby loading libewf.dll 13 | '' This will throw an exception if libewf.dll is not found or for wrong architecture 14 | Try 15 | Dim test = Devio.Server.SpecializedProviders.DevioProviderLibEwf.AccessFlagsRead 16 | 17 | Catch ex As TypeInitializationException When TypeOf ex.GetBaseException() Is BadImageFormatException 18 | MessageBox.Show(owner, 19 | $"Incompatible architecture versions of libewf.dll or dependencies. 20 | 21 | Please copy {NativeFileIO.ProcessArchitecture} versions of these files to {API.DllPath} directory and try again.", 22 | ex.GetBaseException().GetType().Name, 23 | MessageBoxButtons.OK, 24 | MessageBoxIcon.Error) 25 | 26 | Return False 27 | 28 | Catch ex As Exception 29 | MessageBox.Show(owner, 30 | $"{ex.GetBaseException().Message}. 31 | 32 | Please copy {NativeFileIO.ProcessArchitecture} versions of these files to {API.DllPath} directory and try again.", 33 | ex.GetBaseException().GetType().Name, 34 | MessageBoxButtons.OK, 35 | MessageBoxIcon.Error) 36 | 37 | Return False 38 | 39 | End Try 40 | 41 | Return True 42 | 43 | End Function 44 | 45 | End Class 46 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterMountTool/LibqcowVerify.vb: -------------------------------------------------------------------------------- 1 | Imports System.Windows.Forms 2 | Imports Arsenal.ImageMounter.IO.Native 3 | 4 | Public MustInherit Class LibqcowVerify 5 | 6 | Private Sub New() 7 | 8 | End Sub 9 | 10 | Public Shared Function VerifyLibqcow(owner As IWin32Window) As Boolean 11 | 12 | '' Just a test to trig cctor call in DevioProviderLibEwf and thereby loading libewf.dll 13 | '' This will throw an exception if libewf.dll is not found or for wrong architecture 14 | Try 15 | Dim test = Devio.Server.SpecializedProviders.DevioProviderLibQcow.AccessFlagsRead 16 | 17 | Catch ex As TypeInitializationException When TypeOf ex.GetBaseException() Is BadImageFormatException 18 | MessageBox.Show(owner, 19 | $"Incompatible architecture versions of libqcow.dll or dependencies detected. Please copy {NativeFileIO.ProcessArchitecture} versions of these files to same directory as this exe file.", 20 | ex.GetBaseException().GetType().Name, 21 | MessageBoxButtons.OK, 22 | MessageBoxIcon.Error) 23 | 24 | Return False 25 | 26 | Catch ex As Exception 27 | MessageBox.Show(owner, 28 | $"Cannot find or load libqcow.dll or dependencies. Please copy {NativeFileIO.ProcessArchitecture} versions of these files to same directory as this exe file.", 29 | ex.GetBaseException().GetType().Name, 30 | MessageBoxButtons.OK, 31 | MessageBoxIcon.Error) 32 | 33 | Return False 34 | 35 | End Try 36 | 37 | Return True 38 | 39 | End Function 40 | 41 | End Class 42 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterMountTool/My Project/DataSources/DiskStateView.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | Arsenal.ImageMounter.DiskStateView, ArsenalImageMounterMountTool, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterMountTool/README.md: -------------------------------------------------------------------------------- 1 | Arsenal-Image-Mounter 2 | ===================== 3 | 4 | Arsenal Image Mounter mounts the contents of disk images as complete disks in Microsoft Windows. Arsenal Image Mounter includes a virtual SCSI adapter (via a unique Storport miniport driver) which allows users to benefit from disk-specific features in Windows like integration with Disk Manager, access to Volume Shadow Copies, and more. As far as Windows is concerned, the contents of disk images mounted by Arsenal Image Mounter are “real” SCSI disks. 5 | 6 | For developers, Arsenal Image Mounter source code and APIs are available for royalty-free use by open source projects. Commercial projects (and other projects not licensed under an AGPL v3 compatible license - see http://www.fsf.org/licensing/licenses/agpl-3.0.html) that would like to use Arsenal Image Mounter source code and/or APIs must contact us (https://ArsenalRecon.com/contact/) to obtain alternative licensing. 7 | 8 | For end users, Arsenal Image Mounter’s full functionality (along with all our other tools) is available as part of an affordable monthly subscription. If Arsenal Image Mounter is licensed, it runs in "Professional Mode.” If Arsenal Image Mounter is run without a license, it will run in "Free Mode" and provide core functionality. 9 | 10 | Please see Arsenal Image Mounter’s product page: https://ArsenalRecon.com/weapons/image-mounter for more details. 11 | 12 | Supporting Arsenal Image Mounter 13 | -------------------------------- 14 | 15 | We appreciate your help making commercial projects aware of Arsenal Image Mounter’s capabilities, because commercial licensing of our source code and APIs supports ongoing development. On a related note, we know that some commercial projects are using Arsenal Image Mounter’s source code and APIs without being properly licensed… we also appreciate being alerted to these situations so we can nudge those projects appropriately. 16 | 17 | More Details on Licensing and Contributions 18 | ------------------------------------------- 19 | 20 | We chose a dual-license for Arsenal Image Mounter (more specifically, Arsenal Image Mounter’s source code and APIs) to allow its royalty-free use by open source projects, but require financial support from commercial projects. 21 | 22 | Arsenal Consulting, Inc. (d/b/a Arsenal Recon) retains the copyright to Arsenal Image Mounter, including the Arsenal Image Mounter source code and APIs, being made available under terms of the Affero General Public License v3. Arsenal Image Mounter source code and APIs may be used in projects that are licensed so as to be compatible with AGPL v3. If your project is not licensed under an AGPL v3 compatible license and you would like to use Arsenal Image Mounter source code and/or APIs, contact us to obtain alternative licensing. 23 | 24 | Contributors to Arsenal Image Mounter must sign the Arsenal Contributor Agreement ("ACA"). The ACA gives Arsenal and the contributor joint copyright interests in the source code. 25 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterMountTool/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterService/ArsenalImageMounterService.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Arsenal Image Mounter Command Line application 7 | true 8 | Exe 9 | aim_cli 10 | false 11 | 12 | 13 | 14 | ArsenalRecon.ImageMounter.Cli 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | PreserveNewest 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterService/ConsoleApp.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 3 | // This source code and API are available under the terms of the Affero General Public 4 | // License v3. 5 | // 6 | // Please see LICENSE.txt for full license terms, including the availability of 7 | // proprietary exceptions. 8 | // Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 9 | // 10 | 11 | using Arsenal.ImageMounter.IO.Native; 12 | using LTRData.Extensions.CommandLine; 13 | using LTRData.Extensions.Formatting; 14 | using System; 15 | using System.Diagnostics; 16 | using System.Reflection; 17 | using System.Runtime.InteropServices; 18 | using System.Threading; 19 | 20 | namespace Arsenal.ImageMounter; 21 | 22 | /// 23 | /// Provides command line interface to Arsenal Image Mounter driver and features. 24 | /// 25 | public static class ConsoleApp 26 | { 27 | internal static event EventHandler? RanToEnd; 28 | 29 | /// 30 | /// Gets path to assembly DLL file containing this class 31 | /// 32 | public static readonly string AssemblyLocation = Assembly.GetExecutingAssembly().Location; 33 | 34 | /// 35 | /// Gets version number of assembly DLL file containing this class 36 | /// 37 | public static readonly Version? AssemblyFileVersion = 38 | string.IsNullOrWhiteSpace(AssemblyLocation) 39 | ? null 40 | : NativePE.GetFixedFileVerInfo(AssemblyLocation).FileVersion; 41 | 42 | static ConsoleApp() 43 | { 44 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) 45 | { 46 | API.AddNativeLibDirectory(); 47 | } 48 | } 49 | 50 | /// 51 | /// aim_cli command line interface 52 | /// 53 | /// Command line arguments 54 | /// Status value 55 | public static int Main(params string[] args) 56 | { 57 | try 58 | { 59 | var commands = CommandLineParser.ParseCommandLine(args, StringComparer.OrdinalIgnoreCase); 60 | 61 | if (commands.ContainsKey("background")) 62 | { 63 | return ConsoleAppImplementation.StartBackgroundProcess(); 64 | } 65 | 66 | return ConsoleAppImplementation.UnsafeMain(commands); 67 | } 68 | catch (AbandonedMutexException ex) 69 | { 70 | Trace.WriteLine(ex.ToString()); 71 | Console.ForegroundColor = ConsoleColor.Red; 72 | Console.Error.WriteLine("Unexpected client exit."); 73 | Console.ResetColor(); 74 | return Marshal.GetHRForException(ex); 75 | } 76 | catch (Exception ex) 77 | { 78 | Trace.WriteLine(ex.ToString()); 79 | Console.ForegroundColor = ConsoleColor.Red; 80 | Console.Error.WriteLine(ex.JoinMessages()); 81 | Console.ResetColor(); 82 | return Marshal.GetHRForException(ex); 83 | } 84 | finally 85 | { 86 | RanToEnd?.Invoke(null, EventArgs.Empty); 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterService/README.md: -------------------------------------------------------------------------------- 1 | Arsenal-Image-Mounter 2 | ===================== 3 | 4 | Arsenal Image Mounter mounts the contents of disk images as complete disks in Microsoft Windows. Arsenal Image Mounter includes a virtual SCSI adapter (via a unique Storport miniport driver) which allows users to benefit from disk-specific features in Windows like integration with Disk Manager, access to Volume Shadow Copies, and more. As far as Windows is concerned, the contents of disk images mounted by Arsenal Image Mounter are “real” SCSI disks. 5 | 6 | For developers, Arsenal Image Mounter source code and APIs are available for royalty-free use by open source projects. Commercial projects (and other projects not licensed under an AGPL v3 compatible license - see http://www.fsf.org/licensing/licenses/agpl-3.0.html) that would like to use Arsenal Image Mounter source code and/or APIs must contact us (https://ArsenalRecon.com/contact/) to obtain alternative licensing. 7 | 8 | For end users, Arsenal Image Mounter’s full functionality (along with all our other tools) is available as part of an affordable monthly subscription. If Arsenal Image Mounter is licensed, it runs in "Professional Mode.” If Arsenal Image Mounter is run without a license, it will run in "Free Mode" and provide core functionality. 9 | 10 | Please see Arsenal Image Mounter’s product page: https://ArsenalRecon.com/weapons/image-mounter for more details. 11 | 12 | Supporting Arsenal Image Mounter 13 | -------------------------------- 14 | 15 | We appreciate your help making commercial projects aware of Arsenal Image Mounter’s capabilities, because commercial licensing of our source code and APIs supports ongoing development. On a related note, we know that some commercial projects are using Arsenal Image Mounter’s source code and APIs without being properly licensed… we also appreciate being alerted to these situations so we can nudge those projects appropriately. 16 | 17 | More Details on Licensing and Contributions 18 | ------------------------------------------- 19 | 20 | We chose a dual-license for Arsenal Image Mounter (more specifically, Arsenal Image Mounter’s source code and APIs) to allow its royalty-free use by open source projects, but require financial support from commercial projects. 21 | 22 | Arsenal Consulting, Inc. (d/b/a Arsenal Recon) retains the copyright to Arsenal Image Mounter, including the Arsenal Image Mounter source code and APIs, being made available under terms of the Affero General Public License v3. Arsenal Image Mounter source code and APIs may be used in projects that are licensed so as to be compatible with AGPL v3. If your project is not licensed under an AGPL v3 compatible license and you would like to use Arsenal Image Mounter source code and/or APIs, contact us to obtain alternative licensing. 23 | 24 | Contributors to Arsenal Image Mounter must sign the Arsenal Contributor Agreement ("ACA"). The ACA gives Arsenal and the contributor joint copyright interests in the source code. 25 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterService/aim_cli: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | exec -a "$0" dotnet "$(dirname "$(readlink -f -- "$0")")/aim_cli.dll" "$@" 3 | -------------------------------------------------------------------------------- /Managed Source/ArsenalImageMounterService/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Managed Source/Directory.build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | net48;netstandard2.1;net8.0;net9.0 6 | Arsenal.ImageMounter 7 | ..\bin\$(Configuration)\ 8 | true 9 | 1591 10 | true 11 | false 12 | true 13 | Latest 14 | false 15 | On 16 | On 17 | On 18 | portable 19 | false 20 | true 21 | enable 22 | en 23 | 24 | Arsenal Image Mounter 25 | Arsenal Recon 26 | Arsenal Image Mounter 27 | Copyright © Arsenal Recon, 2015 - 2025 28 | 29 | 3.11.307.0 30 | $(FileVersion) 31 | 1.0.0.0 32 | Arsenal Recon 33 | README.md 34 | 35 | Arsenal Recon 36 | $(FileVersion) 37 | $(LocalNuGetPath) 38 | true 39 | true 40 | snupkg 41 | 42 | 43 | 44 | 45 | 46 | false 47 | false 48 | ..\Arsenal.ImageMounter.snk 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Managed Source/README.md: -------------------------------------------------------------------------------- 1 | Arsenal-Image-Mounter 2 | ===================== 3 | 4 | Arsenal Image Mounter mounts the contents of disk images as complete disks in Microsoft Windows. Arsenal Image Mounter includes a virtual SCSI adapter (via a unique Storport miniport driver) which allows users to benefit from disk-specific features in Windows like integration with Disk Manager, access to Volume Shadow Copies, and more. As far as Windows is concerned, the contents of disk images mounted by Arsenal Image Mounter are “real” SCSI disks. 5 | 6 | For developers, Arsenal Image Mounter source code and APIs are available for royalty-free use by open source projects. Commercial projects (and other projects not licensed under an AGPL v3 compatible license - see http://www.fsf.org/licensing/licenses/agpl-3.0.html) that would like to use Arsenal Image Mounter source code and/or APIs must contact us (https://ArsenalRecon.com/contact/) to obtain alternative licensing. 7 | 8 | For end users, Arsenal Image Mounter’s full functionality (along with all our other tools) is available as part of an affordable monthly subscription. If Arsenal Image Mounter is licensed, it runs in "Professional Mode.” If Arsenal Image Mounter is run without a license, it will run in "Free Mode" and provide core functionality. 9 | 10 | Please see Arsenal Image Mounter’s product page: https://ArsenalRecon.com/weapons/image-mounter for more details. 11 | 12 | Supporting Arsenal Image Mounter 13 | -------------------------------- 14 | 15 | We appreciate your help making commercial projects aware of Arsenal Image Mounter’s capabilities, because commercial licensing of our source code and APIs supports ongoing development. On a related note, we know that some commercial projects are using Arsenal Image Mounter’s source code and APIs without being properly licensed… we also appreciate being alerted to these situations so we can nudge those projects appropriately. 16 | 17 | More Details on Licensing and Contributions 18 | ------------------------------------------- 19 | 20 | We chose a dual-license for Arsenal Image Mounter (more specifically, Arsenal Image Mounter’s source code and APIs) to allow its royalty-free use by open source projects, but require financial support from commercial projects. 21 | 22 | Arsenal Consulting, Inc. (d/b/a Arsenal Recon) retains the copyright to Arsenal Image Mounter, including the Arsenal Image Mounter source code and APIs, being made available under terms of the Affero General Public License v3. Arsenal Image Mounter source code and APIs may be used in projects that are licensed so as to be compatible with AGPL v3. If your project is not licensed under an AGPL v3 compatible license and you would like to use Arsenal Image Mounter source code and/or APIs, contact us to obtain alternative licensing. 23 | 24 | Contributors to Arsenal Image Mounter must sign the Arsenal Contributor Agreement ("ACA"). The ACA gives Arsenal and the contributor joint copyright interests in the source code. 25 | -------------------------------------------------------------------------------- /Managed Source/TestProject/Tcp.cs: -------------------------------------------------------------------------------- 1 | using Arsenal.ImageMounter.Devio.Client; 2 | using Arsenal.ImageMounter.Devio.Server.GenericProviders; 3 | using Arsenal.ImageMounter.Devio.Server.Services; 4 | using DiscUtils.Streams; 5 | using DiscUtils.Streams.Compatibility; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.IO; 9 | using System.Linq; 10 | using System.Text; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | using Xunit; 14 | 15 | namespace Arsenal.ImageMounter.Tests; 16 | 17 | public class Tcp 18 | { 19 | [Fact] 20 | public async Task TestTcpStream() 21 | { 22 | using var storage = new MemoryStream(new byte[200 << 20]); 23 | 24 | using var provider = new DevioProviderFromStream(storage, ownsStream: true); 25 | 26 | using var server = new DevioTcpService(9000, provider, ownsProvider: true); 27 | 28 | server.StartServiceThread(); 29 | 30 | using var client = await DevioTcpStream.ConnectAsync("localhost", 9000, read_only: false, CancellationToken.None); 31 | 32 | var testdata1 = "TESTDATA1"u8.ToArray(); 33 | 34 | client.Position = 512; 35 | client.Write(testdata1); 36 | 37 | storage.Position = 512; 38 | var buffer = storage.ReadExactly(testdata1.Length); 39 | Assert.Equal(testdata1, buffer); 40 | 41 | var testdata2 = "TESTDATA2"u8.ToArray(); 42 | 43 | storage.Position = 1024; 44 | storage.Write(testdata2); 45 | 46 | client.Position = 1024; 47 | buffer = client.ReadExactly(testdata2.Length); 48 | Assert.Equal(testdata2, buffer); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Managed Source/TestProject/TestProject.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0-windows;net9.0-windows;net48 5 | false 6 | false 7 | 1591 8 | Arsenal.ImageMounter.Tests 9 | 10 | 11 | 12 | 13 | 14 | 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | all 17 | 18 | 19 | runtime; build; native; contentfiles; analyzers; buildtransitive 20 | all 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Managed Source/TestProject/Version.cs: -------------------------------------------------------------------------------- 1 | using Arsenal.ImageMounter.IO.Native; 2 | using System.IO; 3 | using Xunit; 4 | 5 | namespace Arsenal.ImageMounter.Tests; 6 | 7 | public class Version 8 | { 9 | [Fact] 10 | public void CheckVersion() 11 | { 12 | var ver = new NativeFileVersion(File.ReadAllBytes(@"C:\Windows\system32\ntdll.dll")); 13 | Assert.Equal("Microsoft Corporation", ver.Fields["CompanyName"]); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Managed Source/TestProject/Waitable.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Threading.Tasks; 3 | using Xunit; 4 | using System.Threading; 5 | using Arsenal.ImageMounter.Extensions; 6 | 7 | namespace Arsenal.ImageMounter.Tests; 8 | 9 | public class Waitable 10 | { 11 | [Fact] 12 | public async Task RunProcess() 13 | { 14 | using var process = new Process 15 | { 16 | EnableRaisingEvents = true 17 | }; 18 | 19 | process.StartInfo.UseShellExecute = false; 20 | process.StartInfo.FileName = "cmd.exe"; 21 | process.StartInfo.Arguments = "/c exit 20"; 22 | 23 | process.Start(); 24 | 25 | var result = await process.WaitForResultAsync(); 26 | 27 | Assert.Equal(20, result); 28 | } 29 | 30 | [Fact] 31 | public async Task Event() 32 | { 33 | using var evt = new ManualResetEvent(initialState: false); 34 | 35 | var result = await evt.WaitAsync(1000); 36 | 37 | Assert.False(result); 38 | 39 | evt.Set(); 40 | 41 | result = await evt.WaitAsync(); 42 | 43 | Assert.True(result); 44 | 45 | evt.Reset(); 46 | 47 | ThreadPool.QueueUserWorkItem(_ => { evt.Set(); }); 48 | 49 | result = await evt.WaitAsync(); 50 | 51 | Assert.True(result); 52 | } 53 | 54 | [Fact] 55 | public async Task EventSlim() 56 | { 57 | using var evt = new ManualResetEventSlim(); 58 | 59 | var result = await evt.WaitHandle.WaitAsync(1000); 60 | 61 | Assert.False(result); 62 | 63 | evt.Set(); 64 | 65 | result = await evt.WaitHandle.WaitAsync(); 66 | 67 | Assert.True(result); 68 | 69 | evt.Reset(); 70 | 71 | ThreadPool.QueueUserWorkItem(_ => { evt.Set(); }); 72 | 73 | result = await evt.WaitHandle.WaitAsync(); 74 | 75 | Assert.True(result); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Managed Source/TestProject/Win32API.cs: -------------------------------------------------------------------------------- 1 | using Arsenal.ImageMounter.IO.Devices; 2 | using Arsenal.ImageMounter.IO.Native; 3 | using System.Linq; 4 | using Xunit; 5 | 6 | namespace Arsenal.ImageMounter.Tests; 7 | 8 | public class Win32API 9 | { 10 | [Fact] 11 | public void QueryDosDevice() 12 | { 13 | var deviceLinks = NativeFileIO.QueryDosDevice(); 14 | 15 | Assert.True(deviceLinks.Any()); 16 | 17 | var target = NativeFileIO.QueryDosDevice("C:"); 18 | 19 | Assert.NotNull(target); 20 | } 21 | 22 | [Fact] 23 | public void EnumeratePhysicalDisks() 24 | { 25 | var rc = NativeFileIO.EnumerateDeviceInstancesForSetupClass(NativeConstants.DiskDriveGuid, out var disks, out var errorCode); 26 | 27 | Assert.True(rc, $"CR error code: {errorCode}"); 28 | Assert.NotNull(disks); 29 | 30 | var array = disks.ToArray(); 31 | 32 | Assert.NotEmpty(array); 33 | } 34 | 35 | [Fact] 36 | public void CheckVerifyDisk() 37 | { 38 | using var disk = new DiskDevice(@"\\?\PhysicalDrive0", 0); 39 | 40 | var result = disk.CheckVerify; 41 | 42 | Assert.True(result); 43 | } 44 | 45 | [Fact] 46 | public void QueryDefaultReparsePoints() 47 | { 48 | var (TargetPath, DisplayName, Flags) = NativeFileIO.QueryDirectoryJunction(@"C:\Users\All Users"); 49 | 50 | Assert.Equal(@"\??\C:\ProgramData", TargetPath); 51 | Assert.Equal(@"C:\ProgramData", DisplayName); 52 | Assert.Equal(SymlinkFlags.FullPath, Flags); 53 | 54 | (TargetPath, DisplayName, Flags) = NativeFileIO.QueryDirectoryJunction(@"C:\Users\Default User"); 55 | 56 | Assert.Equal(@"\??\C:\Users\Default", TargetPath); 57 | Assert.Equal(@"C:\Users\Default", DisplayName); 58 | Assert.Equal(SymlinkFlags.FullPath, Flags); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Managed Source/publishps.cmd: -------------------------------------------------------------------------------- 1 | dotnet restore 2 | 3 | rd /s /q publish\PowerShell 4 | 5 | for %%a in (net48 net8.0 net9.0) do ( 6 | dotnet publish --no-restore -c Release -f %%a -o publish\PowerShell\%%a Arsenal.ImageMounter.PowerShell 7 | robocopy /MIR ..\lib publish\PowerShell\%%a\lib 8 | ) 9 | 10 | pushd publish 11 | 12 | del /s *.pdb *.xml 13 | 14 | 7z a -r AIM_PowerShell.7z PowerShell 15 | 16 | popd 17 | -------------------------------------------------------------------------------- /MountTool/ArsenalImageMounterMountTool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/MountTool/ArsenalImageMounterMountTool.exe -------------------------------------------------------------------------------- /MountTool/Screenshot_Windows_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/MountTool/Screenshot_Windows_8.png -------------------------------------------------------------------------------- /MountTool/Screenshot_signature_conflict.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/MountTool/Screenshot_signature_conflict.png -------------------------------------------------------------------------------- /MountTool/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/MountTool/Thumbs.db -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Arsenal-Image-Mounter 2 | ===================== 3 | 4 | Arsenal Image Mounter mounts the contents of disk images as complete disks in Microsoft Windows. Arsenal Image Mounter includes a virtual SCSI adapter (via a unique Storport miniport driver) which allows users to benefit from disk-specific features in Windows like integration with Disk Manager, access to Volume Shadow Copies, and more. As far as Windows is concerned, the contents of disk images mounted by Arsenal Image Mounter are “real” SCSI disks. 5 | 6 | For developers, Arsenal Image Mounter source code and APIs are available for royalty-free use by open source projects. Commercial projects (and other projects not licensed under an AGPL v3 compatible license - see https://www.gnu.org/licenses/agpl-3.0.html) that would like to use Arsenal Image Mounter source code and/or APIs must contact us (https://ArsenalRecon.com/contact/) to obtain alternative licensing. 7 | 8 | For end users, Arsenal Image Mounter’s full functionality (along with all our other tools) is available as part of an affordable monthly subscription. If Arsenal Image Mounter is licensed, it runs in "Professional Mode.” If Arsenal Image Mounter is run without a license, it will run in "Free Mode" and provide core functionality. 9 | 10 | Please see Arsenal Image Mounter’s product page: https://ArsenalRecon.com/weapons/image-mounter for more details. 11 | 12 | Supporting Arsenal Image Mounter 13 | -------------------------------- 14 | 15 | We appreciate your help making commercial projects aware of Arsenal Image Mounter’s capabilities, because commercial licensing of our source code and APIs supports ongoing development. On a related note, we know that some commercial projects are using Arsenal Image Mounter’s source code and APIs without being properly licensed… we also appreciate being alerted to these situations so we can nudge those projects appropriately. 16 | 17 | More Details on Licensing and Contributions 18 | ------------------------------------------- 19 | 20 | We chose a dual-license for Arsenal Image Mounter (more specifically, Arsenal Image Mounter’s source code and APIs) to allow its royalty-free use by open source projects, but require financial support from commercial projects. 21 | 22 | Arsenal Consulting, Inc. (d/b/a Arsenal Recon) retains the copyright to Arsenal Image Mounter, including the Arsenal Image Mounter source code and APIs, being made available under terms of the Affero General Public License v3. Arsenal Image Mounter source code and APIs may be used in projects that are licensed so as to be compatible with AGPL v3. If your project is not licensed under an AGPL v3 compatible license and you would like to use Arsenal Image Mounter source code and/or APIs, contact us to obtain alternative licensing. 23 | 24 | Contributors to Arsenal Image Mounter must sign the Arsenal Contributor Agreement ("ACA"). The ACA gives Arsenal and the contributor joint copyright interests in the source code. 25 | -------------------------------------------------------------------------------- /Third-Party-Licenses/DiscUtils.txt: -------------------------------------------------------------------------------- 1 | -- Included library from this fork: 2 | https://github.com/LTRData/DiscUtils/tree/LTRData.DiscUtils-initial 3 | 4 | Copyright (c) 2008-2011, Kenneth Bell 5 | Copyright (c) 2014, Quamotion 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a 8 | copy of this software and associated documentation files (the "Software"), 9 | to deal in the Software without restriction, including without limitation 10 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | and/or sell copies of the Software, and to permit persons to whom the 12 | Software is furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /Third-Party-Licenses/bzip2.txt: -------------------------------------------------------------------------------- 1 | This program, "bzip2", the associated library "libbzip2", and all 2 | documentation, are copyright (C) 1996-2010 Julian R Seward. All 3 | rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | 2. The origin of this software must not be misrepresented; you must 13 | not claim that you wrote the original software. If you use this 14 | software in a product, an acknowledgment in the product 15 | documentation would be appreciated but is not required. 16 | 17 | 3. Altered source versions must be plainly marked as such, and must 18 | not be misrepresented as being the original software. 19 | 20 | 4. The name of the author may not be used to endorse or promote 21 | products derived from this software without specific prior written 22 | permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 25 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 30 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 33 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 34 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | 36 | Julian Seward, jseward@bzip.org 37 | bzip2/libbzip2 version 1.0.6 of 6 September 2010 38 | -------------------------------------------------------------------------------- /Third-Party-Licenses/dokan.txt: -------------------------------------------------------------------------------- 1 | -- Driver and user mode unmanaged API DLL from this location: 2 | https://github.com/dokan-dev/dokany/releases 3 | 4 | -- .NET library from this fork: 5 | https://github.com/LTRData/dokan-dotnet/tree/LTRData.DokanNet-initial 6 | 7 | -- Recent "dokany" and "dokan-dotnet" license 8 | 9 | Copyright (C) 2015 - 2020 Adrien J. and Maxime C. 10 | Copyright (C) 2007 - 2011 Hiroki Asakawa 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining a copy 13 | of this software and associated documentation files (the "Software"), to deal 14 | in the Software without restriction, including without limitation the rights 15 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the Software is 17 | furnished to do so, subject to the following conditions: 18 | 19 | The above copyright notice and this permission notice shall be included in 20 | all copies or substantial portions of the Software. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | THE SOFTWARE. 29 | 30 | -- Original "dokan" project license 31 | 32 | GNU LESSER GENERAL PUBLIC LICENSE 33 | Version 3, 29 June 2007 34 | 35 | lgpl-3.0.txt 36 | -------------------------------------------------------------------------------- /Third-Party-Licenses/libaff4.txt: -------------------------------------------------------------------------------- 1 | -- From forked repository built with VS 2019 with VS 2013 toolchain and libraries 2 | https://github.com/LTRData/aff4-cpp-lite/tree/LTRData.aff4-cpp-lite-initial 3 | 4 | aff4/aff4-cpp-lite is licensed under the GNU Lesser General Public License v3.0 5 | 6 | lgpl-3.0.txt 7 | -------------------------------------------------------------------------------- /Third-Party-Licenses/libewf.txt: -------------------------------------------------------------------------------- 1 | -- From forked repository built with VS 2019 with WDK7/msvcrt.dll compatible toolchain and libraries 2 | https://github.com/LTRData/libewf/tree/msvcrt-compat 3 | 4 | libewf is licensed under the GNU Lesser General Public License v3.0 5 | 6 | lgpl-3.0.txt 7 | -------------------------------------------------------------------------------- /Third-Party-Licenses/libqcow.txt: -------------------------------------------------------------------------------- 1 | -- From forked repository built with VS 2019 with WDK7/msvcrt.dll compatible toolchain and libraries 2 | https://github.com/LTRData/libqcow/tree/msvcrt-compat 3 | 4 | libqcow is licensed under the GNU Lesser General Public License v3.0 5 | 6 | lgpl-3.0.txt 7 | -------------------------------------------------------------------------------- /Third-Party-Licenses/zlib.txt: -------------------------------------------------------------------------------- 1 | zlib.h -- interface of the 'zlib' general purpose compression library 2 | version 1.2.11, January 15th, 2017 3 | 4 | Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler 5 | 6 | This software is provided 'as-is', without any express or implied 7 | warranty. In no event will the authors be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; you must not 15 | claim that you wrote the original software. If you use this software 16 | in a product, an acknowledgment in the product documentation would be 17 | appreciated but is not required. 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 3. This notice may not be removed or altered from any source distribution. 21 | 22 | Jean-loup Gailly Mark Adler 23 | jloup@gzip.org madler@alumni.caltech.edu 24 | 25 | -------------------------------------------------------------------------------- /Third-party-dependencies.txt: -------------------------------------------------------------------------------- 1 | 2 | User mode components need DiscUtils.dll and libewf.dll in order to mount 3 | certain disk image file formats. 4 | 5 | DiscUtils.dll 6 | ------------- 7 | DiscUtils.dll is a .NET managed DLL that is used to access several kinds of 8 | virtual disk image files, such as VHD, VDI, VMDK. DiscUtils.dll is included in 9 | Arsenal Image Mounter and does not need to be installed separately. 10 | 11 | Sources for DiscUtils are based on the repository at 12 | https://github.com/DiscUtils/DiscUtils and forked into a version with added 13 | features for analyzing NTFS internal structures, several modernizations and 14 | optimizations of the code etc. The forked version is maintained here: 15 | https://github.com/LTRData/DiscUtils/tree/LTRData.DiscUtils-initial 16 | 17 | libewf.dll 18 | ---------- 19 | libewf.dll is a native, unmanaged, DLL that is dynamically linked by Arsenal 20 | Image Mounter when needed. It is primarily needed to mount EnCase style 21 | forensic image files. Arsenal Image Mounter works without this DLL file, but 22 | then without possibility to mount such image files. Because this is an 23 | unmanaged DLL file, it needs to be located in either the same directory as the 24 | EXE file or in any other directory referenced in the system PATH environment 25 | variable. It also needs to be built for the correct machine architecture, for 26 | example x86 or x64. 27 | 28 | libewf.dll sources can be downloaded from libewf project website: 29 | https://github.com/libyal/libewf 30 | 31 | There is also a 7-zip archive with DLL binaries for each of the x86 and x64 32 | architectures in the libewf subdirectory. 33 | -------------------------------------------------------------------------------- /Unmanaged Source/CoreBuild.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | CORE_BUILD=1;%(PreprocessorDefinitions) 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Unmanaged Source/README.md: -------------------------------------------------------------------------------- 1 | Arsenal-Image-Mounter 2 | ===================== 3 | 4 | Arsenal Image Mounter mounts the contents of disk images as complete disks in Microsoft Windows. Arsenal Image Mounter includes a virtual SCSI adapter (via a unique Storport miniport driver) which allows users to benefit from disk-specific features in Windows like integration with Disk Manager, access to Volume Shadow Copies, and more. As far as Windows is concerned, the contents of disk images mounted by Arsenal Image Mounter are “real” SCSI disks. 5 | 6 | For developers, Arsenal Image Mounter source code and APIs are available for royalty-free use by open source projects. Commercial projects (and other projects not licensed under an AGPL v3 compatible license - see http://www.fsf.org/licensing/licenses/agpl-3.0.html) that would like to use Arsenal Image Mounter source code and/or APIs must contact us (https://ArsenalRecon.com/contact/) to obtain alternative licensing. 7 | 8 | For end users, Arsenal Image Mounter’s full functionality (along with all our other tools) is available as part of an affordable monthly subscription. If Arsenal Image Mounter is licensed, it runs in "Professional Mode.” If Arsenal Image Mounter is run without a license, it will run in "Free Mode" and provide core functionality. 9 | 10 | Please see Arsenal Image Mounter’s product page: https://ArsenalRecon.com/weapons/image-mounter for more details. 11 | 12 | Supporting Arsenal Image Mounter 13 | -------------------------------- 14 | 15 | We appreciate your help making commercial projects aware of Arsenal Image Mounter’s capabilities, because commercial licensing of our source code and APIs supports ongoing development. On a related note, we know that some commercial projects are using Arsenal Image Mounter’s source code and APIs without being properly licensed… we also appreciate being alerted to these situations so we can nudge those projects appropriately. 16 | 17 | More Details on Licensing and Contributions 18 | ------------------------------------------- 19 | 20 | We chose a dual-license for Arsenal Image Mounter (more specifically, Arsenal Image Mounter’s source code and APIs) to allow its royalty-free use by open source projects, but require financial support from commercial projects. 21 | 22 | Arsenal Consulting, Inc. (d/b/a Arsenal Recon) retains the copyright to Arsenal Image Mounter, including the Arsenal Image Mounter source code and APIs, being made available under terms of the Affero General Public License v3. Arsenal Image Mounter source code and APIs may be used in projects that are licensed so as to be compatible with AGPL v3. If your project is not licensed under an AGPL v3 compatible license and you would like to use Arsenal Image Mounter source code and/or APIs, contact us to obtain alternative licensing. 23 | 24 | Contributors to Arsenal Image Mounter must sign the Arsenal Contributor Agreement ("ACA"). The ACA gives Arsenal and the contributor joint copyright interests in the source code. 25 | -------------------------------------------------------------------------------- /Unmanaged Source/aim_ll/aim_ll.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | 46 | 47 | Resource Files 48 | 49 | 50 | -------------------------------------------------------------------------------- /Unmanaged Source/aim_ll/aimcmd.h: -------------------------------------------------------------------------------- 1 | 2 | /// aimcmd.h 3 | /// Common declarations for files in aim_ll.exe project. 4 | /// 5 | /// Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 6 | /// This source code and API are available under the terms of the Affero General Public 7 | /// License v3. 8 | /// 9 | /// Please see LICENSE.txt for full license terms, including the availability of 10 | /// proprietary exceptions. 11 | /// Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 12 | /// 13 | 14 | // Prints out a FormatMessage style parameterized message to specified stream. 15 | BOOL 16 | ImScsiOemPrintF(FILE *Stream, LPCSTR Message, ...); 17 | 18 | // Writes out to console a message followed by system error message 19 | // corresponding to current "last error" code from Win32 API. 20 | void 21 | PrintLastError(LPCWSTR Prefix = NULL); 22 | 23 | LPVOID 24 | ImScsiCliAssertNotNull(LPVOID Ptr); 25 | 26 | int 27 | wmainSetup(int, wchar_t **argv); 28 | -------------------------------------------------------------------------------- /Unmanaged Source/aim_ll/aimcmd.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | //#include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #define APSTUDIO_HIDDEN_SYMBOLS 11 | #include "windows.h" 12 | #undef APSTUDIO_HIDDEN_SYMBOLS 13 | #include "ntverp.h" 14 | 15 | #include "..\phdskmnt\inc\phdskmntver.h" 16 | 17 | ///////////////////////////////////////////////////////////////////////////// 18 | #undef APSTUDIO_READONLY_SYMBOLS 19 | 20 | ///////////////////////////////////////////////////////////////////////////// 21 | // English (U.S.) resources 22 | 23 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 24 | #ifdef _WIN32 25 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 26 | #pragma code_page(1252) 27 | #endif //_WIN32 28 | 29 | #ifdef APSTUDIO_INVOKED 30 | ///////////////////////////////////////////////////////////////////////////// 31 | // 32 | // TEXTINCLUDE 33 | // 34 | 35 | 1 TEXTINCLUDE DISCARDABLE 36 | BEGIN 37 | "resource.h\0" 38 | END 39 | 40 | 2 TEXTINCLUDE DISCARDABLE 41 | BEGIN 42 | "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" 43 | "#include ""windows.h""\r\n" 44 | "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" 45 | "#include ""ntverp.h""\r\n" 46 | "\0" 47 | END 48 | 49 | 3 TEXTINCLUDE DISCARDABLE 50 | BEGIN 51 | "\r\n" 52 | "\0" 53 | END 54 | 55 | #endif // APSTUDIO_INVOKED 56 | 57 | #endif // English (U.S.) resources 58 | ///////////////////////////////////////////////////////////////////////////// 59 | 60 | ///////////////////////////////////////////////////////////////////////////// 61 | // 62 | // Version 63 | // 64 | 65 | VS_VERSION_INFO VERSIONINFO 66 | FILEVERSION PHDSKMNT_RC_VERSION_FLD 67 | PRODUCTVERSION PHDSKMNT_RC_VERSION_FLD 68 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 69 | #ifndef DEBUG 70 | FILEFLAGS 0 71 | #else 72 | FILEFLAGS VS_FF_DEBUG | VS_FF_PRERELEASE 73 | #endif 74 | FILEOS VOS_NT 75 | FILETYPE VFT_DRV 76 | FILESUBTYPE VFT2_DRV_INSTALLABLE 77 | BEGIN 78 | BLOCK "StringFileInfo" 79 | BEGIN 80 | BLOCK "040904b0" 81 | BEGIN 82 | VALUE "CompanyName", "Arsenal Recon\0" 83 | VALUE "FileDescription", "Arsenal Image Mounter Command Line Interface\0" 84 | VALUE "FileVersion", PHDSKMNT_RC_VERSION_STR "\0" 85 | VALUE "InternalName", "aim_ll\0" 86 | VALUE "LegalCopyright", "Copyright (c) Arsenal Recon. All Rights Reserved.\0" 87 | VALUE "OriginalFilename", "aim_ll.exe\0" 88 | VALUE "ProductName", "Arsenal Image Mounter\0" 89 | VALUE "ProductVersion", PHDSKMNT_RC_VERSION_STR "\0" 90 | END 91 | END 92 | BLOCK "VarFileInfo" 93 | BEGIN 94 | VALUE "Translation", 0x409, 1200 95 | END 96 | END 97 | 98 | 99 | #ifndef APSTUDIO_INVOKED 100 | ///////////////////////////////////////////////////////////////////////////// 101 | // 102 | // Generated from the TEXTINCLUDE 3 resource. 103 | // 104 | 105 | 106 | ///////////////////////////////////////////////////////////////////////////// 107 | #endif // not APSTUDIO_INVOKED 108 | 109 | -------------------------------------------------------------------------------- /Unmanaged Source/aim_um.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ..\aimapi\lib\$(PlatformTarget);$(LibraryPath) 7 | 8 | 9 | 10 | 11 | Level4 12 | 13 | 14 | 15 | 16 | true 17 | true 18 | 4996;%(DisableSpecificWarnings) 19 | _MSC_PLATFORM_TOOLSET=$(PlatformToolsetVersion);%(PreprocessorDefinitions) 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Unmanaged Source/aimapi/aimapi.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | //#include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #define APSTUDIO_HIDDEN_SYMBOLS 11 | #include "windows.h" 12 | #undef APSTUDIO_HIDDEN_SYMBOLS 13 | #include "ntverp.h" 14 | 15 | #include "..\phdskmnt\inc\phdskmntver.h" 16 | 17 | ///////////////////////////////////////////////////////////////////////////// 18 | #undef APSTUDIO_READONLY_SYMBOLS 19 | 20 | ///////////////////////////////////////////////////////////////////////////// 21 | // English (U.S.) resources 22 | 23 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 24 | #ifdef _WIN32 25 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 26 | #pragma code_page(1252) 27 | #endif //_WIN32 28 | 29 | #ifdef APSTUDIO_INVOKED 30 | ///////////////////////////////////////////////////////////////////////////// 31 | // 32 | // TEXTINCLUDE 33 | // 34 | 35 | 1 TEXTINCLUDE DISCARDABLE 36 | BEGIN 37 | "resource.h\0" 38 | END 39 | 40 | 2 TEXTINCLUDE DISCARDABLE 41 | BEGIN 42 | "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" 43 | "#include ""windows.h""\r\n" 44 | "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" 45 | "#include ""ntverp.h""\r\n" 46 | "\0" 47 | END 48 | 49 | 3 TEXTINCLUDE DISCARDABLE 50 | BEGIN 51 | "\r\n" 52 | "\0" 53 | END 54 | 55 | #endif // APSTUDIO_INVOKED 56 | 57 | #endif // English (U.S.) resources 58 | ///////////////////////////////////////////////////////////////////////////// 59 | 60 | ///////////////////////////////////////////////////////////////////////////// 61 | // 62 | // Version 63 | // 64 | 65 | VS_VERSION_INFO VERSIONINFO 66 | FILEVERSION PHDSKMNT_RC_VERSION_FLD 67 | PRODUCTVERSION PHDSKMNT_RC_VERSION_FLD 68 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 69 | #ifndef DEBUG 70 | FILEFLAGS 0 71 | #else 72 | FILEFLAGS VS_FF_DEBUG | VS_FF_PRERELEASE 73 | #endif 74 | FILEOS VOS_NT 75 | FILETYPE VFT_DRV 76 | FILESUBTYPE VFT2_DRV_INSTALLABLE 77 | BEGIN 78 | BLOCK "StringFileInfo" 79 | BEGIN 80 | BLOCK "040904b0" 81 | BEGIN 82 | VALUE "CompanyName", "Arsenal Recon\0" 83 | VALUE "FileDescription", "Arsenal Image Mounter API DLL\0" 84 | VALUE "FileVersion", PHDSKMNT_RC_VERSION_STR "\0" 85 | VALUE "InternalName", "aimapi\0" 86 | VALUE "LegalCopyright", "Copyright (c) Arsenal Recon. All Rights Reserved.\0" 87 | VALUE "OriginalFilename", "aimapi.dll\0" 88 | VALUE "ProductName", "Arsenal Image Mounter\0" 89 | VALUE "ProductVersion", PHDSKMNT_RC_VERSION_STR "\0" 90 | END 91 | END 92 | BLOCK "VarFileInfo" 93 | BEGIN 94 | VALUE "Translation", 0x409, 1200 95 | END 96 | END 97 | 98 | 99 | #ifndef APSTUDIO_INVOKED 100 | ///////////////////////////////////////////////////////////////////////////// 101 | // 102 | // Generated from the TEXTINCLUDE 3 resource. 103 | // 104 | 105 | 106 | ///////////////////////////////////////////////////////////////////////////// 107 | #endif // not APSTUDIO_INVOKED 108 | 109 | -------------------------------------------------------------------------------- /Unmanaged Source/aimapi/aimapi.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | 64 | 65 | Resource Files 66 | 67 | 68 | -------------------------------------------------------------------------------- /Unmanaged Source/aimapi/debugmsg.cpp: -------------------------------------------------------------------------------- 1 | 2 | /// debugmg.cpp 3 | /// Handles debug messages sent from library routines, by sending to attached debugger 4 | /// or to application registered callback. 5 | /// 6 | /// Copyright (c) 2012-2025, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 7 | /// This source code and API are available under the terms of the Affero General Public 8 | /// License v3. 9 | /// 10 | /// Please see LICENSE.txt for full license terms, including the availability of 11 | /// proprietary exceptions. 12 | /// Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 13 | /// 14 | 15 | 16 | #include "stdafx.h" 17 | 18 | #include "aimapi.h" 19 | 20 | pfImScsiDebugMessageCallback DebugMessageCallback = NULL; 21 | LPVOID DebugMessageCallbackContext = NULL; 22 | 23 | AIMAPI_API 24 | VOID 25 | WINAPI 26 | ImScsiSetDebugMessageCallback(LPVOID Context, 27 | pfImScsiDebugMessageCallback Callback) 28 | { 29 | DebugMessageCallback = Callback; 30 | DebugMessageCallbackContext = Context; 31 | } 32 | 33 | VOID 34 | CDECL 35 | ImScsiDebugMessage(LPCWSTR FormatString, ...) 36 | { 37 | va_list param_list; 38 | LPWSTR lpBuf = NULL; 39 | 40 | va_start(param_list, FormatString); 41 | 42 | if (!FormatMessage( 43 | FORMAT_MESSAGE_ALLOCATE_BUFFER | 44 | FORMAT_MESSAGE_FROM_STRING, FormatString, 0, 0, 45 | (LPWSTR)&lpBuf, 0, ¶m_list)) 46 | { 47 | return; 48 | } 49 | 50 | OutputDebugString(lpBuf); 51 | OutputDebugStringA("\n"); 52 | 53 | if (DebugMessageCallback != NULL) 54 | { 55 | DebugMessageCallback(DebugMessageCallbackContext, lpBuf); 56 | } 57 | 58 | LocalFree(lpBuf); 59 | 60 | return; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Unmanaged Source/aimapi/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | 4 | extern "C" 5 | BOOL APIENTRY DllMain( HMODULE /*hModule*/, 6 | DWORD ul_reason_for_call, 7 | LPVOID /*lpReserved*/ 8 | ) 9 | { 10 | switch (ul_reason_for_call) 11 | { 12 | case DLL_PROCESS_ATTACH: 13 | case DLL_THREAD_ATTACH: 14 | case DLL_THREAD_DETACH: 15 | case DLL_PROCESS_DETACH: 16 | break; 17 | } 18 | return TRUE; 19 | } 20 | -------------------------------------------------------------------------------- /Unmanaged Source/aimapi/pecompat.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | newdev.dll;setupapi.dll 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Unmanaged Source/aimapi/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // aimapi.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /Unmanaged Source/aimapi/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | 12 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 13 | #define WIN32_NO_STATUS 14 | #define _CRT_SECURE_NO_WARNINGS 15 | // Windows Header Files: 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "..\phdskmnt\inc\common.h" 26 | #include "..\phdskmnt\inc\phdskmntver.h" 27 | 28 | #ifdef CORE_BUILD 29 | #define MsgWaitForMultipleObjects(n,h,a,t,w) WaitForMultipleObjects(n,h,a,t) 30 | #endif 31 | 32 | VOID 33 | WINAPI 34 | ImScsiMsgBoxLastError(HWND hWnd, LPCWSTR Prefix); 35 | 36 | int 37 | CDECL 38 | ImScsiMsgBoxPrintF(HWND hWnd, UINT uStyle, LPCWSTR lpTitle, 39 | LPCWSTR lpMessage, ...); 40 | -------------------------------------------------------------------------------- /Unmanaged Source/aimapi/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /Unmanaged Source/aimapi/wscm.h: -------------------------------------------------------------------------------- 1 | #ifndef _WSCM_H_ 2 | #define _WSCM_H_ 3 | 4 | class WSCObject 5 | { 6 | SC_HANDLE handle; 7 | 8 | public: 9 | SC_HANDLE Handle() 10 | { 11 | return handle; 12 | } 13 | 14 | operator bool() 15 | { 16 | return handle != NULL; 17 | } 18 | 19 | bool operator !() 20 | { 21 | return handle == NULL; 22 | } 23 | 24 | void Close() 25 | { 26 | if (handle != NULL) 27 | { 28 | CloseServiceHandle(handle); 29 | handle = NULL; 30 | } 31 | } 32 | 33 | void Swap(WSCObject &Other) 34 | { 35 | auto h = handle; 36 | handle = Other.handle; 37 | Other.handle = h; 38 | } 39 | 40 | WSCObject(SC_HANDLE ExistingHandle) 41 | : handle(ExistingHandle) {} 42 | 43 | ~WSCObject() 44 | { 45 | Close(); 46 | } 47 | }; 48 | 49 | class WSCManager : public WSCObject 50 | { 51 | public: 52 | WSCManager(LPCTSTR ComputerName = NULL, 53 | LPCTSTR DatabaseName = NULL, 54 | DWORD Access = SC_MANAGER_ALL_ACCESS) 55 | : WSCObject(OpenSCManager(ComputerName, 56 | DatabaseName, Access)) {} 57 | }; 58 | 59 | class WSCService : public WSCObject 60 | { 61 | public: 62 | /// Open an existing service 63 | WSCService(SC_HANDLE ServiceHandle, 64 | LPCTSTR ServiceName, 65 | DWORD Access = SC_MANAGER_ALL_ACCESS) 66 | : WSCObject(OpenService(ServiceHandle, 67 | ServiceName, Access)) {} 68 | 69 | /// Create a new existing service 70 | WSCService( 71 | IN SC_HANDLE hSCManager, 72 | IN LPCTSTR lpServiceName, 73 | IN OPTIONAL LPCTSTR lpDisplayName, 74 | IN DWORD dwDesiredAccess, 75 | IN DWORD dwServiceType, 76 | IN DWORD dwStartType, 77 | IN DWORD dwErrorControl, 78 | IN OPTIONAL LPCTSTR lpBinaryPathName = NULL, 79 | IN OPTIONAL LPCTSTR lpLoadOrderGroup = NULL, 80 | OUT OPTIONAL LPDWORD lpdwTagId = NULL, 81 | IN OPTIONAL LPCTSTR lpDependencies = NULL, 82 | IN OPTIONAL LPCTSTR lpServiceStartName = NULL, 83 | IN OPTIONAL LPCTSTR lpPassword = NULL 84 | ) 85 | : WSCObject(CreateService( 86 | hSCManager, lpServiceName, lpDisplayName, 87 | dwDesiredAccess, dwServiceType, dwStartType, 88 | dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, 89 | lpdwTagId, lpDependencies, lpServiceStartName, lpPassword)) {} 90 | }; 91 | 92 | #endif // _WSCM_H_ -------------------------------------------------------------------------------- /Unmanaged Source/aimwrfltr/aimwrfltr.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(ProjectDir)..\phdskmnt\inc;$(ProjectDir)..\..\..\imdisk\inc;$(IncludePath) 7 | 8 | 9 | 10 | _NT_TARGET_VERSION=$(WIN32_WINNT_VERSION);_MSC_PLATFORM_TOOLSET=$(PlatformToolsetVersion);%(PreprocessorDefinitions) 11 | true 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Unmanaged Source/aimwrfltr/aimwrfltr.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {8E41214B-6785-4CFE-B992-037D68949A14} 18 | inf;inv;inx;mof;mc; 19 | 20 | 21 | 22 | 23 | Source Files 24 | 25 | 26 | Source Files 27 | 28 | 29 | Source Files 30 | 31 | 32 | Source Files 33 | 34 | 35 | Source Files 36 | 37 | 38 | Source Files 39 | 40 | 41 | Source Files 42 | 43 | 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | Header Files 53 | 54 | 55 | 56 | 57 | Source Files 58 | 59 | 60 | -------------------------------------------------------------------------------- /Unmanaged Source/aimwrfltr/autobld.cmd: -------------------------------------------------------------------------------- 1 | set STARTDIR=%CD% 2 | call %1bin\setenv.bat %* 3 | 4 | set SIGNTOOL="C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe" sign /a /n "Arsenal Consulting, Inc." /d "Arsenal Image Mounter Miniport" /du "http://arsenalrecon.com" /ac "..\GlobalSign Root CA.crt" /fd SHA256 /td sha256 /tr "http://rfc3161timestamp.globalsign.com/advanced" 5 | 6 | echo on 7 | cd /d %STARTDIR% 8 | build.exe %BUILD_DEFAULT% -cwZg || goto :eof 9 | for /f %%b in ('dir /s/b obj%BUILD_ALT_DIR%\*.sys') do ( 10 | %SIGNTOOL% "%%b" || goto :eof 11 | xcopy /d /y %%b "..\dist\%DDKBUILDENV%\%DDK_TARGET_OS%\%3\" || goto :eof 12 | xcopy /d /y %%~dpnb.pdb "..\dist\%DDKBUILDENV%\%DDK_TARGET_OS%\%3\" || goto :eof 13 | ) 14 | 15 | exit -------------------------------------------------------------------------------- /Unmanaged Source/aimwrfltr/bld.cmd: -------------------------------------------------------------------------------- 1 | for %%v in (WLH) do for %%a in (x86 x64 64) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 2 | for %%v in (Win7) do for %%a in (64) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 3 | @ 4 | for %%v in (Win7 Win8 Win8.1) do for %%a in (x86 x64) do @call :copy %1 %2 %%v %%a 5 | for %%v in (Win8 Win8.1) do for %%a in (arm) do @call :copy %1 %2 %%v %%a 6 | for %%v in (Win8.1) do for %%a in (arm64) do @call :copy %1 %2 %%v %%a 7 | @ 8 | @goto :eof 9 | 10 | :copy 11 | xcopy /d /y %3%2\%4\aimwrfltr.sys ..\dist\%1\%3\%4\ 12 | xcopy /d /y %3%2\%4\aimwrfltr.pdb ..\dist\%1\%3\%4\ 13 | @ -------------------------------------------------------------------------------- /Unmanaged Source/aimwrfltr/bldchk.cmd: -------------------------------------------------------------------------------- 1 | @bld.cmd chk Debug 2 | -------------------------------------------------------------------------------- /Unmanaged Source/aimwrfltr/bldfre.cmd: -------------------------------------------------------------------------------- 1 | @bld.cmd fre Release 2 | -------------------------------------------------------------------------------- /Unmanaged Source/aimwrfltr/makefile: -------------------------------------------------------------------------------- 1 | # 2 | # DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source 3 | # file to this component. This file merely indirects to the real make file 4 | # that is shared by all the components of Windows NT 5 | # 6 | !INCLUDE $(NTMAKEENV)\makefile.def 7 | 8 | -------------------------------------------------------------------------------- /Unmanaged Source/aimwrfltr/sources: -------------------------------------------------------------------------------- 1 | 2 | ### sources 3 | ### Definitions for use with WINDDK build.exe. 4 | ### 5 | ### Copyright (c) 2012-2019, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 6 | ### This source code is available under the terms of the Affero General Public 7 | ### License v3. 8 | ### 9 | ### Please see LICENSE.txt for full license terms, including the availability of 10 | ### proprietary exceptions. 11 | ### Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 12 | ### 13 | 14 | 15 | TARGETNAME=aimwrfltr 16 | TARGETTYPE=DRIVER 17 | 18 | # Set warning level. 19 | MSC_WARNING_LEVEL=/W4 /WX /wd4995 20 | # /wd4214 /wd4201 21 | 22 | MSC_OPTIMIZATION=$(MSC_OPTIMIZATION) /Oi 23 | 24 | # no optimization, to ease debugging. 25 | ##MSC_OPTIMIZATION=$(MSC_OPTIMIZATION) /Odi 26 | 27 | ##Propagate _NT_TARGET_VERSION macro to compiler 28 | C_DEFINES=$(C_DEFINES) -D_NT_TARGET_VERSION=$(_NT_TARGET_VERSION) 29 | 30 | ##!if !defined(_NT_TARGET_VERSION_LONGHORN) 31 | ##_NT_TARGET_VERSION_LONGHORN =0x600 32 | ##!endif 33 | 34 | ##!if !defined(_NT_TARGET_VERSION_WIN7) 35 | ##_NT_TARGET_VERSION_WIN7 =0x601 36 | ##!endif 37 | 38 | TARGETLIBS=$(TARGETLIBS) \ 39 | $(DDK_LIB_PATH)\hal.lib \ 40 | $(DDK_LIB_PATH)\ntoskrnl.lib \ 41 | $(DDK_LIB_PATH)\wdm.lib 42 | 43 | INCLUDES=.\inc; \ 44 | $(PUBLIC_ROOT)\ddk\inc; \ 45 | ..\inc; \ 46 | ..\phdskmnt\inc 47 | 48 | 49 | DRIVERTYPE=WDM 50 | 51 | SOURCES = mainwdm.cpp \ 52 | ioctl.cpp \ 53 | ioctldbg.cpp \ 54 | partialirp.cpp \ 55 | aimwrfltr.rc \ 56 | read.cpp \ 57 | write.cpp \ 58 | workerthread.cpp 59 | 60 | !IF "$(NTDEBUG)" == "ntsd" 61 | #SOURCES = $(SOURCES) debug.cpp 62 | !ENDIF 63 | 64 | -------------------------------------------------------------------------------- /Unmanaged Source/awealloc/MAKEFILE: -------------------------------------------------------------------------------- 1 | # 2 | # DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source 3 | # file to this component. This file merely indirects to the real make file 4 | # that is shared by all the driver components of the Windows NT DDK 5 | # 6 | 7 | !INCLUDE $(NTMAKEENV)\makefile.def 8 | -------------------------------------------------------------------------------- /Unmanaged Source/awealloc/autobld.cmd: -------------------------------------------------------------------------------- 1 | set STARTDIR=%CD% 2 | call %1bin\setenv.bat %* 3 | 4 | set SIGNTOOL="C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe" sign /a /n "Arsenal Consulting, Inc." /d "Arsenal Image Mounter Miniport" /du "http://arsenalrecon.com" /ac "..\GlobalSign Root CA.crt" /fd SHA256 /td sha256 /tr "http://rfc3161timestamp.globalsign.com/advanced" 5 | 6 | echo on 7 | cd /d %STARTDIR% 8 | build.exe %BUILD_DEFAULT% -cwZg || goto :eof 9 | for /f %%b in ('dir /s/b obj%BUILD_ALT_DIR%\*.sys') do ( 10 | %SIGNTOOL% "%%b" || goto :eof 11 | xcopy /d /y %%b "..\dist\%DDKBUILDENV%\%DDK_TARGET_OS%\%3\" || goto :eof 12 | xcopy /d /y %%~dpnb.pdb "..\dist\%DDKBUILDENV%\%DDK_TARGET_OS%\%3\" || goto :eof 13 | ) 14 | 15 | exit -------------------------------------------------------------------------------- /Unmanaged Source/awealloc/awealloc.inf: -------------------------------------------------------------------------------- 1 | 2 | ; DUMMY.INF 3 | ; Dummy inf file. 4 | 5 | [Version] 6 | signature = "$Windows NT$" 7 | Class = SCSIAdapter 8 | ClassGUID = {4D36E97B-E325-11CE-BFC1-08002BE10318} 9 | Provider = "LTR Data" 10 | DriverVer = 10/23/2023,2.1.2.00073 11 | CatalogFile = awealloc.cat 12 | 13 | 14 | [SourceDisksNames] 15 | 1 = "AWE Allocation Driver" 16 | 17 | 18 | [SourceDisksFiles.x86] 19 | awealloc.sys = 1, i386 20 | 21 | [SourceDisksFiles.ia64] 22 | awealloc.sys = 1, ia64 23 | 24 | [SourceDisksFiles.amd64] 25 | awealloc.sys = 1, amd64 26 | 27 | [SourceDisksFiles.arm] 28 | awealloc.sys = 1, arm 29 | 30 | [SourceDisksFiles.arm64] 31 | awealloc.sys = 1, arm64 32 | 33 | [DestinationDirs] 34 | AWEAllocSysFiles = 12 35 | 36 | 37 | [DefaultInstall.ntx86] 38 | CopyFiles = AWEAllocSysFiles 39 | 40 | 41 | [AWEAllocSysFiles] 42 | awealloc.sys 43 | 44 | 45 | [DefaultInstall.ntx86.Services] 46 | AddService = AWEAlloc, , AWEAllocDrv 47 | 48 | 49 | [AWEAllocDrv] 50 | DisplayName = "AWE Allocation Driver" 51 | StartType = 2 52 | ServiceType = 1 53 | ErrorControl = 0 54 | ServiceBinary = %12%\AWEAlloc.sys 55 | -------------------------------------------------------------------------------- /Unmanaged Source/awealloc/awealloc.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Unmanaged Source/awealloc/awealloc.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/Unmanaged Source/awealloc/awealloc.rc -------------------------------------------------------------------------------- /Unmanaged Source/awealloc/bld.cmd: -------------------------------------------------------------------------------- 1 | for %%v in (W2K) do for %%a in (x86) do start autobld.cmd C:\WinDDK\6000\ %1 %%a %%v 2 | for %%v in (WXP) do for %%a in (x86) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 3 | for %%v in (WNet WLH) do for %%a in (x86 x64 64) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 4 | for %%v in (Win7) do for %%a in (64) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 5 | @ 6 | for %%v in (Win7 Win8 Win8.1) do for %%a in (x86 x64) do @call :copy %1 %2 %%v %%a 7 | for %%v in (Win8 Win8.1) do for %%a in (arm) do @call :copy %1 %2 %%v %%a 8 | for %%v in (Win8.1) do for %%a in (arm64) do @call :copy %1 %2 %%v %%a 9 | @ 10 | @goto :eof 11 | 12 | :copy 13 | xcopy /d /y %3%2\%4\awealloc.sys ..\dist\%1\%3\%4\ 14 | xcopy /d /y %3%2\%4\awealloc.pdb ..\dist\%1\%3\%4\ 15 | @ 16 | -------------------------------------------------------------------------------- /Unmanaged Source/awealloc/bldchk.cmd: -------------------------------------------------------------------------------- 1 | @bld.cmd chk Debug 2 | -------------------------------------------------------------------------------- /Unmanaged Source/awealloc/bldfre.cmd: -------------------------------------------------------------------------------- 1 | @bld.cmd fre Release 2 | -------------------------------------------------------------------------------- /Unmanaged Source/awealloc/sources: -------------------------------------------------------------------------------- 1 | TARGETNAME=awealloc 2 | TARGETTYPE=DRIVER 3 | SOURCES=awealloc.c awealloc.rc 4 | INCLUDES=..\phdskmnt\inc 5 | MSC_WARNING_LEVEL=/W4 /WX /wd4100 6 | !IF "$(NTDEBUG)" != "ntsd" 7 | MSC_OPTIMIZATION=/Ox /GF 8 | !ENDIF 9 | -------------------------------------------------------------------------------- /Unmanaged Source/awealloc/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | awealloc 5 | DRIVER 6 | awealloc.c awealloc.rc 7 | /W4 /WX /wd4100 8 | /Ox /GF 9 | 10 | -------------------------------------------------------------------------------- /Unmanaged Source/deviodrv/MAKEFILE: -------------------------------------------------------------------------------- 1 | # 2 | # DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source 3 | # file to this component. This file merely indirects to the real make file 4 | # that is shared by all the driver components of the Windows NT DDK 5 | # 6 | 7 | !INCLUDE $(NTMAKEENV)\makefile.def 8 | -------------------------------------------------------------------------------- /Unmanaged Source/deviodrv/autobld.cmd: -------------------------------------------------------------------------------- 1 | set STARTDIR=%CD% 2 | call %1bin\setenv.bat %* 3 | 4 | set SIGNTOOL="C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe" sign /a /n "Arsenal Consulting, Inc." /d "Arsenal Image Mounter Miniport" /du "http://arsenalrecon.com" /ac "..\GlobalSign Root CA.crt" /fd SHA256 /td sha256 /tr "http://rfc3161timestamp.globalsign.com/advanced" 5 | 6 | echo on 7 | cd /d %STARTDIR% 8 | build.exe %BUILD_DEFAULT% -cwZg || goto :eof 9 | for /f %%b in ('dir /s/b obj%BUILD_ALT_DIR%\*.sys') do ( 10 | %SIGNTOOL% "%%b" || goto :eof 11 | xcopy /d /y %%b "..\dist\%DDKBUILDENV%\%DDK_TARGET_OS%\%3\" || goto :eof 12 | xcopy /d /y %%~dpnb.pdb "..\dist\%DDKBUILDENV%\%DDK_TARGET_OS%\%3\" || goto :eof 13 | ) 14 | 15 | exit -------------------------------------------------------------------------------- /Unmanaged Source/deviodrv/bld.cmd: -------------------------------------------------------------------------------- 1 | for %%v in (W2K) do for %%a in (x86) do start autobld.cmd C:\WinDDK\6000\ %1 %%a %%v 2 | for %%v in (WXP) do for %%a in (x86) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 3 | for %%v in (WNET WLH Win7) do for %%a in (x86 x64 64) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 4 | @ 5 | for %%v in (Win8 Win8.1) do for %%a in (x86 x64 arm) do @call :copy %1 %2 %%v %%a 6 | for %%v in (Win8.1) do for %%a in (arm64) do @call :copy %1 %2 %%v %%a 7 | @ 8 | @goto :eof 9 | 10 | :copy 11 | xcopy /d /y %2\%4\deviodrv.sys ..\dist\%1\%3\%4\ 12 | xcopy /d /y %2\%4\deviodrv.pdb ..\dist\%1\%3\%4\ 13 | @ 14 | -------------------------------------------------------------------------------- /Unmanaged Source/deviodrv/bldchk.cmd: -------------------------------------------------------------------------------- 1 | @bld.cmd chk Debug 2 | -------------------------------------------------------------------------------- /Unmanaged Source/deviodrv/bldfre.cmd: -------------------------------------------------------------------------------- 1 | @bld.cmd fre Release 2 | -------------------------------------------------------------------------------- /Unmanaged Source/deviodrv/deviodrv.inf: -------------------------------------------------------------------------------- 1 | 2 | ; DUMMY.INF 3 | ; Dummy inf file. 4 | 5 | [Version] 6 | signature = "$Windows NT$" 7 | Class = SCSIAdapter 8 | ClassGUID = {4D36E97B-E325-11CE-BFC1-08002BE10318} 9 | Provider = "LTR Data" 10 | DriverVer = 10/23/2023,2.1.2.00073 11 | CatalogFile = deviodrv.cat 12 | 13 | 14 | [SourceDisksNames] 15 | 1 = "DevIO Client Driver" 16 | 17 | 18 | [SourceDisksFiles.x86] 19 | deviodrv.sys = 1, i386 20 | 21 | [SourceDisksFiles.ia64] 22 | deviodrv.sys = 1, ia64 23 | 24 | [SourceDisksFiles.amd64] 25 | deviodrv.sys = 1, amd64 26 | 27 | [SourceDisksFiles.arm] 28 | deviodrv.sys = 1, arm 29 | 30 | [SourceDisksFiles.arm64] 31 | deviodrv.sys = 1, arm64 32 | 33 | [DestinationDirs] 34 | DevIoDrvSysFiles = 12 35 | 36 | 37 | [DefaultInstall.ntx86] 38 | CopyFiles = DevIoDrvSysFiles 39 | 40 | 41 | [DevIoDrvSysFiles] 42 | deviodrv.sys 43 | 44 | 45 | [DefaultInstall.ntx86.Services] 46 | AddService = DevIoDrv, , DevIoDrvDrv 47 | 48 | 49 | [DevIoDrvDrv] 50 | DisplayName = "DevIO Client Driver" 51 | StartType = 2 52 | ServiceType = 1 53 | ErrorControl = 0 54 | ServiceBinary = %12%\DevIoDrv.sys 55 | -------------------------------------------------------------------------------- /Unmanaged Source/deviodrv/deviodrv.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/Unmanaged Source/deviodrv/deviodrv.rc -------------------------------------------------------------------------------- /Unmanaged Source/deviodrv/deviodrv.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {8E41214B-6785-4CFE-B992-037D68949A14} 18 | inf;inv;inx;mof;mc; 19 | 20 | 21 | 22 | 23 | Source Files 24 | 25 | 26 | Source Files 27 | 28 | 29 | Source Files 30 | 31 | 32 | Source Files 33 | 34 | 35 | 36 | 37 | Source Files 38 | 39 | 40 | 41 | 42 | Source Files 43 | 44 | 45 | -------------------------------------------------------------------------------- /Unmanaged Source/deviodrv/sources: -------------------------------------------------------------------------------- 1 | TARGETNAME=deviodrv 2 | TARGETTYPE=DRIVER 3 | 4 | C_DEFINES=$(C_DEFINES) -D_NT_TARGET_VERSION=$(_NT_TARGET_VERSION) 5 | 6 | SOURCES=deviodrv.cpp dispatch.cpp filetable.cpp irpfwd.cpp deviodrv.rc 7 | 8 | INCLUDES=.\inc; \ 9 | $(PUBLIC_ROOT)\ddk\inc; \ 10 | ..\inc; \ 11 | ..\phdskmnt\inc 12 | 13 | MSC_WARNING_LEVEL=/W4 /WX /wd4100 /wd4201 14 | 15 | !IF "$(NTDEBUG)" != "ntsd" 16 | MSC_OPTIMIZATION=/Ox /GF 17 | !ENDIF 18 | -------------------------------------------------------------------------------- /Unmanaged Source/deviosvc/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source 3 | # file to this component. This file merely indirects to the real make file 4 | # that is shared by all the driver components of the Windows NT DDK 5 | # 6 | 7 | !INCLUDE $(NTMAKEENV)\makefile.def 8 | -------------------------------------------------------------------------------- /Unmanaged Source/deviosvc/autobld.cmd: -------------------------------------------------------------------------------- 1 | set STARTDIR=%CD% 2 | call %1bin\setenv.bat %* 3 | 4 | set SIGNTOOL="C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe" sign /a /n "Arsenal Consulting, Inc." /d "Arsenal Image Mounter Miniport" /du "http://arsenalrecon.com" /ac "..\GlobalSign Root CA.crt" /fd SHA256 /td sha256 /tr "http://rfc3161timestamp.globalsign.com/advanced" 5 | 6 | echo on 7 | cd /d %STARTDIR% 8 | build.exe %BUILD_DEFAULT% -cwZg || goto :eof 9 | for /f %%b in ('dir /s/b obj%BUILD_ALT_DIR%\*.exe') do ( 10 | %SIGNTOOL% "%%b" || goto :eof 11 | xcopy /d /y %%b "..\dist\%DDKBUILDENV%\%DDK_TARGET_OS%\%3\" || goto :eof 12 | xcopy /d /y %%~dpnb.pdb "..\dist\%DDKBUILDENV%\%DDK_TARGET_OS%\%3\" || goto :eof 13 | ) 14 | 15 | exit -------------------------------------------------------------------------------- /Unmanaged Source/deviosvc/bld.cmd: -------------------------------------------------------------------------------- 1 | for %%v in (W2K) do for %%a in (x86) do start autobld.cmd C:\WinDDK\6000\ %1 %%a %%v 2 | for %%v in (WXP) do for %%a in (x86) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 3 | for %%v in (WNet WLH) do for %%a in (x86 x64 64) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 4 | for %%v in (Win7) do for %%a in (64) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 5 | @ 6 | for %%v in (Win7 Win8 Win8.1) do for %%a in (x86 x64) do @call :copy %1 %2 %%v %%a 7 | for %%v in (Win8 Win8.1) do for %%a in (arm) do @call :copy %1 %2 %%v %%a 8 | for %%v in (Win8.1) do for %%a in (arm64) do @call :copy %1 %2 %%v %%a 9 | @ 10 | @goto :eof 11 | 12 | :copy 13 | xcopy /d /y %2\%4\deviosvc.exe ..\dist\%1\%3\%4\ 14 | xcopy /d /y %2\%4\deviosvc.pdb ..\dist\%1\%3\%4\ 15 | @ 16 | -------------------------------------------------------------------------------- /Unmanaged Source/deviosvc/bldchk.cmd: -------------------------------------------------------------------------------- 1 | @bld.cmd chk Debug 2 | -------------------------------------------------------------------------------- /Unmanaged Source/deviosvc/bldfre.cmd: -------------------------------------------------------------------------------- 1 | @bld.cmd fre Release 2 | -------------------------------------------------------------------------------- /Unmanaged Source/deviosvc/deviosvc.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "..\phdskmnt\inc\phdskmntver.h" 4 | 5 | ///////////////////////////////////////////////////////////////////////////// 6 | // 7 | // Version 8 | // 9 | 10 | VS_VERSION_INFO VERSIONINFO 11 | FILEVERSION PHDSKMNT_RC_VERSION_FLD 12 | PRODUCTVERSION PHDSKMNT_RC_VERSION_FLD 13 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 14 | #ifndef DEBUG 15 | FILEFLAGS 0 16 | #else 17 | FILEFLAGS VS_FF_DEBUG | VS_FF_PRERELEASE 18 | #endif 19 | FILEOS VOS_NT 20 | FILETYPE VFT_APP 21 | FILESUBTYPE 0 22 | BEGIN 23 | BLOCK "StringFileInfo" 24 | BEGIN 25 | BLOCK "040904b0" 26 | BEGIN 27 | VALUE "CompanyName", "Arsenal Recon\0" 28 | VALUE "FileDescription", "DevIO Server service\0" 29 | VALUE "FileVersion", PHDSKMNT_RC_VERSION_STR "\0" 30 | VALUE "InternalName", "deviosvc\0" 31 | VALUE "LegalCopyright", "Copyright � 2005-2025 Olof Lagerkvist, Arsenal Recon.\0" 32 | VALUE "OriginalFilename", "deviosvc.exe\0" 33 | VALUE "ProductName", "deviosvc\0" 34 | VALUE "ProductVersion", PHDSKMNT_RC_VERSION_STR "\0" 35 | END 36 | END 37 | BLOCK "VarFileInfo" 38 | BEGIN 39 | VALUE "Translation", 0x409, 1200 40 | END 41 | END 42 | -------------------------------------------------------------------------------- /Unmanaged Source/deviosvc/sources: -------------------------------------------------------------------------------- 1 | TARGETNAME=deviosvc 2 | TARGETTYPE=PROGRAM 3 | SOURCES=deviosvc.cpp deviosvc.rc 4 | 5 | MSC_WARNING_LEVEL=/W4 /WX /wd4201 6 | UMTYPE=windows 7 | USE_MSVCRT=1 8 | MSC_OPTIMIZATION=/Ox /GF 9 | 10 | C_DEFINES = $(C_DEFINES) /DUNICODE /D_UNICODE 11 | 12 | INCLUDES=.\inc; \ 13 | $(PUBLIC_ROOT)\ddk\inc; \ 14 | ..\inc; \ 15 | ..\phdskmnt\inc 16 | 17 | !IF "$(_BUILDARCH)" == "x86" 18 | 19 | LINKER_FLAGS=/LARGEADDRESSAWARE 20 | BUFFER_OVERFLOW_CHECKS=0 21 | UMENTRYABS=wWinMainCRTStartup 22 | 23 | !ELSE 24 | 25 | UMENTRYABS=wWinMainCRTStartup /subsystem:windows,5.02 26 | 27 | !ENDIF 28 | 29 | TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \ 30 | $(SDK_LIB_PATH)\advapi32.lib \ 31 | $(SDK_LIB_PATH)\user32.lib \ 32 | $(SDK_LIB_PATH)\wsock32.lib 33 | -------------------------------------------------------------------------------- /Unmanaged Source/deviosvc/sources.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | deviosvc 5 | PROGRAM 6 | deviosvc.cpp deviosvc.rc 7 | /W4 /WX /wd4201 8 | windows 9 | 1 10 | /Ox /GF 11 | $(C_DEFINES) /DUNICODE /D_UNICODE 12 | 13 | 14 | 15 | 16 | /osversion:4.00 /LARGEADDRESSAWARE 17 | Entry /subsystem:console,4.00 18 | 0 19 | 20 | 21 | 22 | 23 | Entry /subsystem:console 24 | 25 | 26 | 27 | 28 | $(SDK_LIB_PATH)\kernel32.lib $(SDK_LIB_PATH)\advapi32.lib $(SDK_LIB_PATH)\user32.lib $(SDK_LIB_PATH)\wsock32.lib 29 | 30 | -------------------------------------------------------------------------------- /Unmanaged Source/imdisk.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | $(ProjectDir);$(IncludePath);$(SolutionDir)phdskmnt\inc 7 | 8 | 9 | 10 | _UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_WCSTOK;_NT_TARGET_VERSION=$(WIN32_WINNT_VERSION);NT4_COMPATIBLE;INCLUDE_GPL_ORIGIN;WIN32_LEAN_AND_MEAN;_MSC_PLATFORM_TOOLSET=$(PlatformToolsetVersion);%(PreprocessorDefinitions) 11 | 4996;4201;4306;4127;28159;%(DisableSpecificWarnings) 12 | Level4 13 | true 14 | true 15 | Speed 16 | 17 | 18 | true 19 | $(OutDir)$(TargetName)_$(ProjectName).pdb 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Unmanaged Source/msbld.cmd: -------------------------------------------------------------------------------- 1 | set MSBUILD_EXE="C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\MSBuild.exe" 2 | for %%c in (Debug Release) do ( 3 | for %%v in (Win7 Win8 Win8.1) do for %%a in (Win32 x64) do ( %MSBUILD_EXE% /m /p:configuration="%%v %%c" /p:platform=%%a || goto :eof ) 4 | for %%v in (Win8 Win8.1) do for %%a in (ARM) do ( %MSBUILD_EXE% /m /p:configuration="%%v %%c" /p:platform=%%a || goto :eof ) 5 | for %%v in (Win8.1) do for %%a in (ARM64) do ( %MSBUILD_EXE% /m /p:configuration="%%v %%c" /p:platform=%%a || goto :eof ) 6 | ) 7 | @ -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/ARMGS.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | %(AdditionalDependencies);bufferoverflowfastfailk.lib 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/autobld.cmd: -------------------------------------------------------------------------------- 1 | set STARTDIR=%CD% 2 | call %1bin\setenv.bat %* 3 | 4 | set SIGNTOOL="C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe" sign /a /n "Arsenal Consulting, Inc." /d "Arsenal Image Mounter Miniport" /du "http://arsenalrecon.com" /ac "..\GlobalSign Root CA.crt" /fd SHA256 /td sha256 /tr "http://rfc3161timestamp.globalsign.com/advanced" 5 | 6 | echo on 7 | cd /d %STARTDIR% 8 | build.exe %BUILD_DEFAULT% -cwZg || goto :eof 9 | for /f %%b in ('dir /s/b obj%BUILD_ALT_DIR%\*.sys') do ( 10 | %SIGNTOOL% "%%b" || goto :eof 11 | xcopy /d /y %%b "..\dist\%DDKBUILDENV%\%DDK_TARGET_OS%\%3\" || goto :eof 12 | xcopy /d /y %%~dpnb.pdb "..\dist\%DDKBUILDENV%\%DDK_TARGET_OS%\%3\" || goto :eof 13 | ) 14 | 15 | exit -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/bld.cmd: -------------------------------------------------------------------------------- 1 | for %%v in (W2K) do for %%a in (x86) do start autobld.cmd C:\WinDDK\6000\ %1 %%a %%v 2 | for %%v in (WXP) do for %%a in (x86) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 3 | for %%v in (WNet WLH) do for %%a in (x86 x64 64) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 4 | for %%v in (Win7) do for %%a in (64) do start autobld.cmd C:\WINDDK\7600.16385.1\ %1 %%a %%v no_oacr 5 | @ 6 | for %%v in (Win7 Win8 Win8.1) do for %%a in (x86 x64) do @call :copy %1 %2 %%v %%a 7 | for %%v in (Win8 Win8.1) do for %%a in (arm) do @call :copy %1 %2 %%v %%a 8 | for %%v in (Win8.1) do for %%a in (arm64) do @call :copy %1 %2 %%v %%a 9 | @ 10 | @goto :eof 11 | 12 | :copy 13 | xcopy /d /y %3%2\%4\phdskmnt.sys ..\dist\%1\%3\%4\ 14 | xcopy /d /y %3%2\%4\phdskmnt.pdb ..\dist\%1\%3\%4\ 15 | @ -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/bldchk.cmd: -------------------------------------------------------------------------------- 1 | @bld.cmd chk Debug 2 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/bldfre.cmd: -------------------------------------------------------------------------------- 1 | @bld.cmd fre Release 2 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/build.cmd: -------------------------------------------------------------------------------- 1 | if "%DDKBUILDENV%" == "" call C:\WinDDK\7600.16385.1\bin\setenv.bat C:\WinDDK\7600.16385.1\ chk x86 WXP 2 | echo on 3 | cd /d %~dp0 4 | @echo Invoking: build.exe -cegiw -nmake -i %* 5 | build.exe -cegiw -nmake -i %* 6 | exit /b %ERRORLEVEL% -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/buildcat.cmd: -------------------------------------------------------------------------------- 1 | setlocal 2 | 3 | @echo on 4 | 5 | set WORKDIR=%CD% 6 | 7 | set SIGNTOOL="C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe" sign /a /n "Arsenal Consulting, Inc." /d "Arsenal Image Mounter Miniport" /du "http://arsenalrecon.com" /ac "..\GlobalSign Root CA.crt" /fd SHA256 /td sha256 /tr "http://rfc3161timestamp.globalsign.com/advanced" 8 | 9 | set INF2CAT="C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\Inf2Cat.exe" 10 | 11 | if "%STAMPINF_DATE%" == "" set STAMPINF_DATE=* 12 | if "%STAMPINF_VERSION%" == "" set STAMPINF_VERSION=* 13 | set STAMPINF=stampinf -d %STAMPINF_DATE% -v %STAMPINF_VERSION% 14 | 15 | where stampinf || goto :eof 16 | :where inf2cat || goto :eof 17 | :where signtool || goto :eof 18 | 19 | cd /d %WORKDIR% 20 | 21 | for %%d in (Win2K WinXP) do if exist "..\dist\%1\%%d" ( 22 | copy /y legacy.inf "..\dist\%1\%%d\phdskmnt.inf" 23 | %STAMPINF% -f "..\dist\%1\%%d\phdskmnt.inf" -a NTx86 24 | ) 25 | 26 | for %%d in (CtlUnit) do ( 27 | xcopy /y ctlunit.inf ..\dist\%1\%%d\ 28 | %STAMPINF% -f "..\dist\%1\%%d\ctlunit.inf" -a NTx86 29 | %INF2CAT% /driver:"..\dist\%1\%%d" /os:XP_X86,2000 || goto :eof 30 | %SIGNTOOL% "..\dist\%1\%%d\ctlunit.cat" || goto :eof 31 | ) 32 | 33 | for %%d in (WinNET) do if exist "..\dist\%1\%%d" ( 34 | copy /y phdskmnt2003.inf "..\dist\%1\%%d\phdskmnt.inf" 35 | %STAMPINF% -f "..\dist\%1\%%d\phdskmnt.inf" -a NTx86,NTia64,NTamd64 36 | %INF2CAT% /driver:"..\dist\%1\%%d" /os:XP_X64,Server2003_X86,Server2003_X64,Server2003_IA64 || goto :eof 37 | %SIGNTOOL% "..\dist\%1\%%d\phdskmnt.cat" || goto :eof 38 | ) 39 | 40 | for %%d in (WinLH) do if exist "..\dist\%1\%%d" ( 41 | copy /y phdskmntVista.inf "..\dist\%1\%%d\phdskmnt.inf" 42 | %STAMPINF% -f "..\dist\%1\%%d\phdskmnt.inf" -a NTx86,NTia64,NTamd64 43 | %INF2CAT% /driver:"..\dist\%1\%%d" /os:Vista_X86,Vista_X64,7_X86,7_X64,Server2008_X86,Server2008_X64,Server2008_IA64,Server2008R2_X64,Server2008R2_IA64 || goto :eof 44 | %SIGNTOOL% "..\dist\%1\%%d\phdskmnt.cat" || goto :eof 45 | ) 46 | 47 | for %%d in (Win7) do if exist "..\dist\%1\%%d" ( 48 | copy /y phdskmntWin7.inf "..\dist\%1\%%d\phdskmnt.inf" 49 | %STAMPINF% -f "..\dist\%1\%%d\phdskmnt.inf" -a NTx86,NTia64,NTamd64 50 | %INF2CAT% /driver:"..\dist\%1\%%d" /os:Vista_X86,Vista_X64,7_X86,7_X64,Server2008_X86,Server2008_X64,Server2008_IA64,Server2008R2_X64,Server2008R2_IA64 || goto :eof 51 | %SIGNTOOL% "..\dist\%1\%%d\phdskmnt.cat" || goto :eof 52 | ) 53 | 54 | for %%d in (Win8) do if exist "..\dist\%1\%%d" ( 55 | copy /y phdskmnt.inf "..\dist\%1\%%d\phdskmnt.inf" 56 | %STAMPINF% -f "..\dist\%1\%%d\phdskmnt.inf" -a NTx86,NTamd64,NTARM 57 | %INF2CAT% /driver:"..\dist\%1\%%d" /os:8_X86,8_X64,8_ARM,Server8_X64 || goto :eof 58 | %SIGNTOOL% "..\dist\%1\%%d\phdskmnt.cat" || goto :eof 59 | ) 60 | 61 | for %%d in (Win8.1) do if exist "..\dist\%1\%%d" ( 62 | copy /y phdskmnt.inf "..\dist\%1\%%d\phdskmnt.inf" 63 | %STAMPINF% -f "..\dist\%1\%%d\phdskmnt.inf" -a NTx86,NTamd64,NTARM,NTARM64 64 | %INF2CAT% /driver:"..\dist\%1\%%d" /os:6_3_X86,6_3_X64,6_3_ARM,Server6_3_X64,10_VB_X86,10_VB_X64,10_VB_ARM64,10_NI_X64,10_NI_ARM64,ServerFE_X64,ServerFE_ARM64 || goto :eof 65 | %SIGNTOOL% "..\dist\%1\%%d\phdskmnt.cat" || goto :eof 66 | ) 67 | 68 | endlocal 69 | 70 | pushd ..\dist\%1 -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/catchk.cmd: -------------------------------------------------------------------------------- 1 | buildcat chk -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/catfre.cmd: -------------------------------------------------------------------------------- 1 | @buildcat fre -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/ctlunit.inf: -------------------------------------------------------------------------------- 1 | 2 | ; CTLUNIT.INF 3 | ; Installs NULL device driver for Arsenal Image Mounter Control Unit. 4 | ; 5 | ; Copyright (c) 2012-2018, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 6 | ; This source code and API are available under the terms of the Affero General Public 7 | ; License v3. 8 | ; 9 | ; Please see LICENSE.txt for full license terms, including the availability of 10 | ; proprietary exceptions. 11 | ; Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 12 | 13 | [Version] 14 | Signature="$WINDOWS NT$" 15 | Class=System 16 | ClassGuid={4D36E97D-E325-11CE-BFC1-08002BE10318} 17 | Provider=%ARSENALRECON% 18 | CatalogFile=ctlunit.cat 19 | DriverVer = 04/25/2018,1.10.0027.00027 20 | 21 | [ControlFlags] 22 | ExcludeFromSelect = * 23 | 24 | [SourceDisksNames] 25 | 26 | [SourceDisksFiles] 27 | 28 | [Manufacturer] 29 | %ARSENALRECON%=ARSENALRECON 30 | 31 | [ARSENALRECON] 32 | %NULL.DeviceDesc% = NODRV, ScsiArray 33 | 34 | [NODRV] 35 | 36 | [NODRV.Services] 37 | ; 38 | ; this is blank to just allow the install to succeed 39 | ; this is the important bit 40 | ; you will wind up with a device string in device manager 41 | ; and no banged out devnode 42 | ; Null service of course does nothing. 43 | ; You can use your device by opening the FDO via the port \\.\ScsiN 44 | ; and passthrough commands then set the bus/target/LUN 45 | ; 46 | AddService = , %SPSVCINST_ASSOCSERVICE% ; null service install 47 | 48 | [strings] 49 | ARSENALRECON = "Arsenal Recon" 50 | NULL.DeviceDesc = "Arsenal Image Mounter Control Unit" 51 | ;******************************************* 52 | ;Handy macro substitutions (non-localizable) 53 | SPSVCINST_ASSOCSERVICE = 0x00000002 54 | 55 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/inc/phdskmntver.h: -------------------------------------------------------------------------------- 1 | #define PHDSKMNT_MAJOR_VERSION 1 2 | #define PHDSKMNT_MINOR_VERSION 2 3 | #define PHDSKMNT_MINOR_LOW_VERSION 22 4 | #define PHDSKMNT_BUILD_VERSION 83 5 | 6 | #ifndef STR 7 | #define STR_EXPAND(tok) #tok 8 | #define STR(tok) STR_EXPAND(tok) 9 | #endif 10 | 11 | #define PHDSKMNT_VERSION_ULONG (((ULONG)PHDSKMNT_MAJOR_VERSION << 24) + ((ULONG)PHDSKMNT_MINOR_VERSION << 16) + ((ULONG)PHDSKMNT_MINOR_LOW_VERSION << 8) + PHDSKMNT_BUILD_VERSION) 12 | #define PHDSKMNT_RC_VERSION_STR STR(PHDSKMNT_MAJOR_VERSION) "." STR(PHDSKMNT_MINOR_VERSION) "." STR(PHDSKMNT_MINOR_LOW_VERSION) "." STR(PHDSKMNT_BUILD_VERSION) 13 | #define PHDSKMNT_RC_VERSION_FLD PHDSKMNT_MAJOR_VERSION,PHDSKMNT_MINOR_VERSION,PHDSKMNT_MINOR_LOW_VERSION,PHDSKMNT_BUILD_VERSION 14 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/inc/trcphdskmnt.ini: -------------------------------------------------------------------------------- 1 | DEFINE_CPLX_TYPE(SRB, WPP_LOGSRB, PSCSI_REQUEST_BLOCK, ItemSRB, "s", _SRB_, 0, 2); 2 | DEFINE_CPLX_TYPE(SENSE, WPP_LOGSENSE, PSENSE_DATA, ItemSenseData, "s", _SENSE_, 0, 2); 3 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/legacy.inf: -------------------------------------------------------------------------------- 1 | 2 | ; LEGACY.INF 3 | ; Installs "legacy", scsiport based, non-pnp version of Arsenal Image Mounter 4 | ; miniport driver. 5 | ; Intended for use on 32 bit editions of Windows XP, which lacks support for 6 | ; storport based virtual miniports. 7 | ; 8 | ; Copyright (c) 2012-2018, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 9 | ; This source code and API are available under the terms of the Affero General Public 10 | ; License v3. 11 | ; 12 | ; Please see LICENSE.txt for full license terms, including the availability of 13 | ; proprietary exceptions. 14 | ; Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 15 | 16 | [Version] 17 | signature = "$Windows NT$" 18 | Provider = "ARSENALRECON" 19 | DriverVer = 04/25/2018,1.10.0027.00027 20 | 21 | 22 | [SourceDisksNames] 23 | 1 = "Arsenal Image Mounter Setup disk" 24 | 25 | 26 | [SourceDisksFiles.x86] 27 | phdskmnt.sys = 1, x86 28 | vhdaccess.sys = 1, x86 29 | awealloc.sys = 1, x86 30 | deviodrv.sys = 1, x86 31 | 32 | 33 | [DestinationDirs] 34 | PhDskMntSysFiles = 12 35 | 36 | 37 | [DefaultInstall.ntx86] 38 | CopyFiles = PhDskMntSysFiles 39 | 40 | 41 | [DefaultUninstall.ntx86] 42 | DelFiles = PhDskMntSysFiles 43 | 44 | 45 | [PhDskMntSysFiles] 46 | phdskmnt.sys 47 | vhdaccess.sys 48 | awealloc.sys 49 | deviodrv.sys 50 | 51 | 52 | [DefaultInstall.ntx86.Services] 53 | AddService = PhDskMnt, , PhDskMntDrv 54 | AddService = VhdAccess, , VhdAccessDrv 55 | AddService = AWEAlloc, , AWEAllocDrv 56 | AddService = DevIoDrv, , DevIoDrvDrv 57 | 58 | 59 | [DefaultUninstall.ntx86.Services] 60 | DelService = PhDskMnt 61 | DelService = VhdAccess 62 | DelService = AWEAlloc 63 | 64 | 65 | [PhDskMntDrv] 66 | DisplayName = "Arsenal Image Mounter Miniport" 67 | Description = "SCSI emulation miniport" 68 | ServiceType = 1 69 | StartType = 2 70 | ErrorControl = 0 71 | ServiceBinary = %12%\phdskmnt.sys 72 | LoadOrderGroup = SCSI Miniport 73 | AddReg = legacy_addreg 74 | 75 | [VhdAccessDrv] 76 | DisplayName = "VHD Access driver" 77 | Description = "VHD image file access driver" 78 | ServiceType = 1 79 | StartType = 2 80 | ErrorControl = 0 81 | ServiceBinary = %12%\vhdaccess.sys 82 | 83 | [AWEAllocDrv] 84 | DisplayName = "AWE Allocation driver" 85 | Description = "AWE memory allocation driver" 86 | ServiceType = 1 87 | StartType = 2 88 | ErrorControl = 0 89 | ServiceBinary = %12%\awealloc.sys 90 | 91 | [DevIoDrvDrv] 92 | DisplayName = "DevIO client driver" 93 | Description = "DevIO protocol client-side driver" 94 | ServiceType = 1 95 | StartType = 2 96 | ErrorControl = 0 97 | ServiceBinary = %12%\deviodrv.sys 98 | 99 | [legacy_addreg] 100 | HKR, "Parameters", "NumberOfBuses", 0x00010001, 0x00000001 101 | HKR, "Parameters\Device", "NumberOfRequests", 0x00010001, 0xFF 102 | HKR, "Parameters\Device", "MaximumSGList", 0x00010001, 0xFF 103 | 104 | 105 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/makefile: -------------------------------------------------------------------------------- 1 | # 2 | # DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source 3 | # file to this component. This file merely indirects to the real make file 4 | # that is shared by all the components of Windows NT 5 | # 6 | !INCLUDE $(NTMAKEENV)\makefile.def 7 | 8 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/makefile.inc: -------------------------------------------------------------------------------- 1 | 2 | ### sources 3 | ### Definitions for use with WINDDK build.exe. 4 | ### 5 | ### Copyright (c) 2012-2015, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 6 | ### This source code is available under the terms of the Affero General Public 7 | ### License v3. 8 | ### 9 | ### Please see LICENSE.txt for full license terms, including the availability of 10 | ### proprietary exceptions. 11 | ### Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 12 | ### 13 | 14 | 15 | LNG=$(LANGUAGE) 16 | _INX=. 17 | STAMP=stampinf -n -f $@ -a $(_BUILDARCH) 18 | 19 | !IF $(_NT_TARGET_VERSION) >= 0x0502 20 | 21 | $(OBJ_PATH)\$(O)\$(INF_NAME).inf: $(_INX)\$(INF_NAME).inx 22 | copy $(_INX)\$(@B).inx $@ 23 | $(STAMP) 24 | 25 | !ELSE 26 | 27 | $(OBJ_PATH)\$(O)\$(INF_NAME).inf: $(_INX)\legacy.inf 28 | copy $(_INX)\legacy.inf $@ 29 | copy $(_INX)\inst.cmd $(OBJ_PATH)\$(O) 30 | copy $(_INX)\uninst.cmd $(OBJ_PATH)\$(O) 31 | 32 | !ENDIF 33 | 34 | $(OBJ_PATH)\$O\hbaapi.mof $(OBJ_PATH)\$O\hbaapi.mfl: hbaapi.mof 35 | ## Pre-process .mof file. 36 | $(C_PREPROCESSOR_NAME) $(C_PREPROCESSOR_FLAGS) hbaapi.mof > $(OBJ_PATH)\$(O)\hbaapi.tmp 37 | 38 | ## Make a copy, for the mof-compilation step below 39 | copy $(OBJ_PATH)\$(O)\hbaapi.tmp .\hbaapi.mof 40 | 41 | ## Compile the base .mof file, which will include the new .mof file. 42 | mofcomp -WMI -B:$(OBJ_PATH)\$(O)\\phdskmnt.bmf phdskmnt.mof 43 | 44 | ## Build phdskmntwmi.h 45 | wmimofck -h.\inc\phdskmntwmi.h -m -u -w.\html $(OBJ_PATH)\$(O)\phdskmnt.bmf 46 | 47 | clean: 48 | del phdskmntdt.h $(O)\phdskmnt.bmf 49 | 50 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/makefile.inc.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(LANGUAGE) 5 | <_INX Condition="'$(OVERRIDE__INX)'!='true'">. 6 | stampinf -n -f %24%40 -a $(_BUILDARCH) 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/phdskmnt.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | USE_STORPORT=1;_NT_TARGET_VERSION=$(WIN32_WINNT_VERSION);_MSC_PLATFORM_TOOLSET=$(PlatformToolsetVersion);%(PreprocessorDefinitions) 9 | true 10 | 11 | 12 | %(AdditionalDependencies);storport.lib 13 | 14 | 15 | 16 | 17 | 18 | 19 | * 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/phdskmnt.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | //#include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #define APSTUDIO_HIDDEN_SYMBOLS 11 | #include "windows.h" 12 | #undef APSTUDIO_HIDDEN_SYMBOLS 13 | #include "ntverp.h" 14 | 15 | #include "inc\phdskmntver.h" 16 | 17 | ///////////////////////////////////////////////////////////////////////////// 18 | #undef APSTUDIO_READONLY_SYMBOLS 19 | 20 | ///////////////////////////////////////////////////////////////////////////// 21 | // English (U.S.) resources 22 | 23 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 24 | #ifdef _WIN32 25 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 26 | #pragma code_page(1252) 27 | #endif //_WIN32 28 | 29 | #ifdef APSTUDIO_INVOKED 30 | ///////////////////////////////////////////////////////////////////////////// 31 | // 32 | // TEXTINCLUDE 33 | // 34 | 35 | 1 TEXTINCLUDE DISCARDABLE 36 | BEGIN 37 | "resource.h\0" 38 | END 39 | 40 | 2 TEXTINCLUDE DISCARDABLE 41 | BEGIN 42 | "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" 43 | "#include ""windows.h""\r\n" 44 | "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" 45 | "#include ""ntverp.h""\r\n" 46 | "\0" 47 | END 48 | 49 | 3 TEXTINCLUDE DISCARDABLE 50 | BEGIN 51 | "\r\n" 52 | "\0" 53 | END 54 | 55 | #endif // APSTUDIO_INVOKED 56 | 57 | #endif // English (U.S.) resources 58 | ///////////////////////////////////////////////////////////////////////////// 59 | 60 | ///////////////////////////////////////////////////////////////////////////// 61 | // 62 | // Version 63 | // 64 | 65 | VS_VERSION_INFO VERSIONINFO 66 | FILEVERSION PHDSKMNT_RC_VERSION_FLD 67 | PRODUCTVERSION PHDSKMNT_RC_VERSION_FLD 68 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 69 | #ifndef DEBUG 70 | FILEFLAGS 0 71 | #else 72 | FILEFLAGS VS_FF_DEBUG | VS_FF_PRERELEASE 73 | #endif 74 | FILEOS VOS_NT 75 | FILETYPE VFT_DRV 76 | FILESUBTYPE VFT2_DRV_INSTALLABLE 77 | BEGIN 78 | BLOCK "StringFileInfo" 79 | BEGIN 80 | BLOCK "040904b0" 81 | BEGIN 82 | VALUE "CompanyName", "Arsenal Recon\0" 83 | VALUE "FileDescription", "Arsenal Image Mounter\0" 84 | VALUE "FileVersion", PHDSKMNT_RC_VERSION_STR "\0" 85 | VALUE "InternalName", "phdskmnt\0" 86 | VALUE "LegalCopyright", "Copyright (c) Arsenal Recon. All Rights Reserved.\0" 87 | VALUE "OriginalFilename", "phdskmnt.sys\0" 88 | VALUE "ProductName", "Arsenal Image Mounter\0" 89 | VALUE "ProductVersion", PHDSKMNT_RC_VERSION_STR "\0" 90 | END 91 | END 92 | BLOCK "VarFileInfo" 93 | BEGIN 94 | VALUE "Translation", 0x409, 1200 95 | END 96 | END 97 | 98 | 99 | #ifndef APSTUDIO_INVOKED 100 | ///////////////////////////////////////////////////////////////////////////// 101 | // 102 | // Generated from the TEXTINCLUDE 3 resource. 103 | // 104 | 105 | 106 | ///////////////////////////////////////////////////////////////////////////// 107 | #endif // not APSTUDIO_INVOKED 108 | 109 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/phdskmnt_scsiport.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | USE_SCSIPORT=1;%(PreprocessorDefinitions) 9 | 10 | 11 | %(AdditionalDependencies);scsiport.lib 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/readme.txt: -------------------------------------------------------------------------------- 1 | How to build everything for distribution 2 | ---------------------------------------- 3 | 4 | 0. Update version numbers in phdskmntver.h and batch build all in VS solution, or run msbld in solution dir 5 | 6 | 1. In aimwrfltr, awealloc, deviodrv, deviosvc and phdskmnt, run bldchk and bldfre in "neutral" command line window, to build and sign driver for each architecture 7 | 8 | 2. Run pubcmd.cmd to copy cli and api files to dist directories. 9 | 10 | 3. Run catchk or catfre in "DDK" or "neutral" command line window, to build and sign cat for each architecture 11 | 12 | 4. In ..\dist\fre, run mkcab.cmd to build and sign ..\dist\fre\cab\phdskmnt.cab file. Upload it to Microsoft for signing. 13 | 14 | 5. Download results file and extract Win8.1 subfolder over existing Win10 folder in ..\dist\fre, and api and cli folders 15 | over existing folders respectivley. 16 | 17 | 6. In ..\dist\chk or ..\dist\fre, run upd7z to freshen files in archives 18 | 19 | 7. Run syncaimsource to freshen GitHub directory 20 | 21 | 8. Build .NET solution to freshen integrated setup packages 22 | 23 | 9. Check in to GitHub! 24 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/sources: -------------------------------------------------------------------------------- 1 | 2 | ### sources 3 | ### Definitions for use with WINDDK build.exe. 4 | ### 5 | ### Copyright (c) 2012-2015, Arsenal Consulting, Inc. (d/b/a Arsenal Recon) 6 | ### This source code is available under the terms of the Affero General Public 7 | ### License v3. 8 | ### 9 | ### Please see LICENSE.txt for full license terms, including the availability of 10 | ### proprietary exceptions. 11 | ### Questions, comments, or requests for clarification: http://ArsenalRecon.com/contact/ 12 | ### 13 | 14 | 15 | TARGETNAME=phdskmnt 16 | TARGETTYPE=DRIVER 17 | 18 | # Set warning level. 19 | MSC_WARNING_LEVEL=/W4 /WX 20 | # /wd4214 /wd4201 21 | 22 | # no optimization, to ease debugging. 23 | ##MSC_OPTIMIZATION=$(MSC_OPTIMIZATION) /Odi 24 | 25 | ##The next causes verbose trace logging 26 | #C_DEFINES=$(C_DEFINES) -DVERBOSE_DEBUG_TRACE=1 27 | 28 | ##The next causes DriverEntry to use an inline copy of the driver global stucture. 29 | C_DEFINES=$(C_DEFINES) -DMP_DrvInfo_Inline 30 | 31 | ##Propagate _NT_TARGET_VERSION macro to compiler 32 | C_DEFINES=$(C_DEFINES) -D_NT_TARGET_VERSION=$(_NT_TARGET_VERSION) 33 | 34 | !IF $(_NT_TARGET_VERSION) >= 0x0502 35 | 36 | TARGETLIBS=$(DDK_LIB_PATH)\storport.lib 37 | C_DEFINES=$(C_DEFINES) -DUSE_STORPORT=1 38 | 39 | !ELSE 40 | 41 | TARGETLIBS=$(DDK_LIB_PATH)\scsiport.lib 42 | C_DEFINES=$(C_DEFINES) -DUSE_SCSIPORT=1 43 | 44 | !IF $(_NT_TARGET_VERSION) <= 0x0500 45 | 46 | C_DEFINES=$(C_DEFINES) -DRtlRandomEx=RtlRandom -wd4214 -wd4201 47 | 48 | !ENDIF 49 | 50 | !ENDIF 51 | 52 | ##!if !defined(_NT_TARGET_VERSION_LONGHORN) 53 | ##_NT_TARGET_VERSION_LONGHORN =0x600 54 | ##!endif 55 | 56 | ##!if !defined(_NT_TARGET_VERSION_WIN7) 57 | ##_NT_TARGET_VERSION_WIN7 =0x601 58 | ##!endif 59 | 60 | TARGETLIBS=$(TARGETLIBS) \ 61 | $(DDK_LIB_PATH)\hal.lib \ 62 | $(DDK_LIB_PATH)\ntoskrnl.lib \ 63 | $(DDK_LIB_PATH)\wdm.lib 64 | 65 | INCLUDES=.\inc; \ 66 | $(PUBLIC_ROOT)\ddk\inc; 67 | 68 | 69 | DRIVERTYPE=WDM 70 | 71 | SOURCES = phdskmnt.cpp \ 72 | scsi.cpp \ 73 | utils.cpp \ 74 | phdskmnt.rc \ 75 | iodisp.cpp \ 76 | workerthread.cpp \ 77 | srbioctl.cpp \ 78 | proxy.cpp 79 | 80 | !IF "$(NTDEBUG)" == "ntsd" 81 | SOURCES = $(SOURCES) debug.cpp 82 | !ENDIF 83 | 84 | #RUN_WPP=$(SOURCES) \ 85 | # -km \ 86 | # -gen:{km-w2k.tpl}*.tmh \ 87 | # -scan:inc\trace.h \ 88 | # -ini:.\inc\trcphdskmnt.ini 89 | 90 | #INF_NAME=phdskmnt 91 | 92 | #NTTARGETFILE1=$(OBJ_PATH)\$(O)\$(INF_NAME).inf 93 | 94 | #PASS1_BINPLACE=$(NTTARGETFILE1) 95 | 96 | # Ensure a .bmf is built and a resulting header file as well as HTML to test paths. 97 | #NTTARGETFILE0=$(OBJ_PATH)\$(O)\hbaapi.mof 98 | -------------------------------------------------------------------------------- /Unmanaged Source/phdskmnt/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | phdskmnt 5 | DRIVER 6 | /W4 /WX 7 | $(C_DEFINES) -DMP_DrvInfo_Inline 8 | 9 | 10 | $(TARGETLIBS) $(DDK_LIB_PATH)\hal.lib $(DDK_LIB_PATH)\ntoskrnl.lib $(DDK_LIB_PATH)\wdm.lib 11 | .\inc; $(PUBLIC_ROOT)\ddk\inc; 12 | WDM 13 | phdskmnt.c scsi.c utils.c phdskmnt.rc iodisp.c workerthread.c srbioctl.c proxy.c 14 | 15 | -------------------------------------------------------------------------------- /Unmanaged Source/vs2013_sse.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | NoExtensions 9 | Default 10 | false 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Unmanaged Source/wdk7.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | <_PropertySheetDisplayName>wdk7 7 | C:\WINDDK\7600.16385.1\lib\Crt\$(PlatformTarget);C:\WINDDK\7600.16385.1\lib\Win7\$(PlatformTarget);$(VCInstallDir)lib\$(PlatformTarget);$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib\$(PlatformTarget);$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib\$(PlatformTarget);$(FrameworkSDKDir)\lib;$(LibraryPath) 8 | C:\WINDDK\7600.16385.1\inc\api\crt\stl60;C:\WINDDK\7600.16385.1\inc\api;C:\WINDDK\7600.16385.1\inc\ddk;C:\WINDDK\7600.16385.1\inc\crt;$(IncludePath) 9 | 10 | 11 | 12 | vsnprintf=_vsnprintf;snwprintf=_snwprintf;open=_open;read=_read;close=_close;write=_write;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions) 13 | false 14 | 15 | 16 | 17 | 5.02 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Unmanaged Source/wdk7_secondary.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | <_PropertySheetDisplayName>wdk7_secondary 7 | C:\WINDDK\7600.16385.1\inc\api\crt\stl60;C:\WINDDK\7600.16385.1\inc\api;C:\WINDDK\7600.16385.1\inc\ddk;C:\WINDDK\7600.16385.1\inc\crt;$(IncludePath) 8 | $(LibraryPath);C:\WINDDK\7600.16385.1\lib\Win7\$(PlatformTarget) 9 | 10 | 11 | 12 | vsnprintf=_vsnprintf;snwprintf=_snwprintf;open=_open;read=_read;close=_close;write=_write;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions) 13 | false 14 | 15 | 16 | 17 | 5.02 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Unmanaged Source/wdk7_w2k_x86.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | false 7 | 8 | 9 | 10 | C:\WINDDK\7600.16385.1\lib\wnet\i386\msvcrt_win2000.obj;%(AdditionalDependencies) 11 | 12 | 13 | 14 | 15 | false 16 | Default 17 | 18 | 19 | %(Command) 20 | editbin "$(TargetPath)" /nologo /subsystem:console,4.00 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Unmanaged Source/wdk7_wnet_x64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | C:\WINDDK\7600.16385.1\lib\wnet\amd64\msvcrt_win2003.obj;%(AdditionalDependencies) 9 | 10 | 11 | false 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /libewf/readme.txt: -------------------------------------------------------------------------------- 1 | Use the correct one for your Windows machine architecture (32 or 64 bits) and put the dll files from the .zip file in the same directory as ArsenalImageMounter.exe. 2 | 3 | -------------------------------------------------------------------------------- /libewf/x64.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/libewf/x64.zip -------------------------------------------------------------------------------- /libewf/x86.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArsenalRecon/Arsenal-Image-Mounter/0300bda8f67c81c9bd85ee071fb25be141e97aac/libewf/x86.zip --------------------------------------------------------------------------------