peass-ng/PEASS-ng · warning · ArgumentNullException
volumeMountPoint
Error message
volumeMountPoint
What it means
SetVolumeMountPoint(string volumeMountPoint, string volumeGuid) throws ArgumentNullException with paramName "volumeMountPoint" when the first argument is null, empty, or whitespace. This API creates a mounted-drive link at the given mount point and validates both arguments before any native call.
Source
Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.SetVolumeMountPoint.cs:45
namespace Alphaleonis.Win32.Filesystem
{
public static partial class Volume
{
/// <summary>[AlphaFS] Associates a volume with a Drive letter or a directory on another volume.</summary>
/// <exception cref="ArgumentException"/>
/// <exception cref="ArgumentNullException"/>
/// <param name="volumeMountPoint">
/// The user-mode path to be associated with the volume. This may be a Drive letter (for example, "X:\")
/// or a directory on another volume (for example, "Y:\MountX\").
/// </param>
/// <param name="volumeGuid">A <see cref="string"/> containing the volume <see cref="Guid"/>.</param>
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Justification = "Utils.IsNullOrWhiteSpace validates arguments.")]
[SecurityCritical]
public static void SetVolumeMountPoint(string volumeMountPoint, string volumeGuid)
{
if (Utils.IsNullOrWhiteSpace(volumeMountPoint))
throw new ArgumentNullException("volumeMountPoint");
if (Utils.IsNullOrWhiteSpace(volumeGuid))
throw new ArgumentNullException("volumeGuid");
if (!volumeGuid.StartsWith(Path.VolumePrefix + "{", StringComparison.OrdinalIgnoreCase))
throw new ArgumentException(Resources.Not_A_Valid_Guid, "volumeGuid");
volumeMountPoint = Path.GetFullPathCore(null, false, volumeMountPoint, GetFullPathOptions.AsLongPath | GetFullPathOptions.AddTrailingDirectorySeparator | GetFullPathOptions.FullCheck);
// This string must be of the form "\\?\Volume{GUID}\"
volumeGuid = Path.AddTrailingDirectorySeparator(volumeGuid, false);
// ChangeErrorMode is for the Win32 SetThreadErrorMode() method, used to suppress possible pop-ups.
using (new NativeMethods.ChangeErrorMode(NativeMethods.ErrorMode.FailCriticalErrors))
{View on GitHub (pinned to 53fb989abc)
Solutions
- Pass an existing NTFS directory path (e.g. "C:\Mount\Data") as volumeMountPoint
- Validate both arguments with string.IsNullOrWhiteSpace before calling
- Catch ArgumentNullException to report a configuration error to the user
Example fix
// before
Volume.SetVolumeMountPoint(mountDir, guid);
// after
if (string.IsNullOrWhiteSpace(mountDir)) throw new InvalidOperationException("Mount dir not configured");
Volume.SetVolumeMountPoint(mountDir, guid); Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrWhiteSpace(volumeMountPoint))
throw new InvalidOperationException("volumeMountPoint must be an existing NTFS directory path."); Type guard
static bool CanMountAt(string dir) => !string.IsNullOrWhiteSpace(dir) && Directory.Exists(dir);
Try / catch
try { Volume.SetVolumeMountPoint(mountDir, guid); }
catch (ArgumentNullException ex) { Log.Error($"Mount failed, missing argument: {ex.ParamName}"); } Prevention
- Verify the mount-point directory exists before mounting
- Load mount paths from config with explicit required-field checks
- Log the failing paramName to distinguish mount-point vs GUID problems
When it happens
Trigger: Calling Volume.SetVolumeMountPoint(null, guid) or passing ""/" " as the mount point directory while the GUID argument is valid.
Common situations: Scripted mount-point creation where the target folder variable was never set; config-driven mounting with a missing mount-path entry.
Related errors
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/386103de588002aa.
Report an issue: GitHub.