peass-ng/PEASS-ng · error · ArgumentNullException
volumeGuid
Error message
volumeGuid
What it means
SetVolumeMountPoint throws ArgumentNullException ("volumeGuid") when the second argument is null/empty/whitespace, and ArgumentException (Resources.Not_A_Valid_Guid) when it is non-empty but lacks the "\\?\Volume{" prefix. The GUID argument must be a full volume GUID path of the form \\?\Volume{...}\.
Source
Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.SetVolumeMountPoint.cs:48
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))
{
// SetVolumeMountPoint()
// 2014-01-29: MSDN does not confirm LongPath usage but a Unicode version of this function exists.
View on GitHub (pinned to 53fb989abc)
Solutions
- Resolve the GUID path via Volume.GetVolumeGuid("E:\") and pass that result
- Validate the argument starts with "\\?\Volume{" before calling
- Catch both ArgumentNullException and ArgumentException and surface a clear config error
Example fix
// before
Volume.SetVolumeMountPoint("C:\Mount", "E:\");
// after
string guid = Volume.GetVolumeGuid("E:\");
Volume.SetVolumeMountPoint("C:\Mount", guid); // \\?\Volume{...}\ Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrWhiteSpace(volumeGuid) || !volumeGuid.StartsWith(@"\\?\Volume{", StringComparison.OrdinalIgnoreCase))
volumeGuid = Volume.GetVolumeGuid(driveLetter); // resolve from a path if needed Type guard
static bool IsVolumeGuidPath(string s) => !string.IsNullOrWhiteSpace(s) && s.StartsWith(@"\\?\Volume{", StringComparison.OrdinalIgnoreCase); Try / catch
try { Volume.SetVolumeMountPoint(mountDir, guid); }
catch (ArgumentException) { Log.Error($"volumeGuid must be \\\\?\\Volume{{...}}\\ format, got: {guid}"); }
catch (ArgumentNullException) { Log.Error("volumeGuid was null/empty"); } Prevention
- Always produce the GUID argument via Volume.GetVolumeGuid, never hand-build it
- Store full \\?\Volume{...}\ paths in config, not bare GUIDs
- Validate both arguments before calling mounting APIs — it has multiple failure modes
When it happens
Trigger: Calling Volume.SetVolumeMountPoint(dir, null); passing a drive letter "E:\" or bare GUID string without the \\?\Volume{ prefix as volumeGuid.
Common situations: Hard-coding a volume GUID that was truncated or reformatted; storing GUIDs without the device prefix in config; passing a drive letter where a volume GUID path is required.
Related errors
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/71704d94636df66d.
Report an issue: GitHub.