peass-ng/PEASS-ng · error · ArgumentException
Resources.Not_A_Valid_Guid
Error message
Resources.Not_A_Valid_Guid
What it means
EnumerateVolumeMountPoints throws ArgumentException with message Resources.Not_A_Valid_Guid when volumeGuid is non-empty but does not start with the volume prefix "\\?\Volume{" (case-insensitive). The method only accepts a volume GUID path, not a drive letter or arbitrary path.
Source
Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.EnumerateVolumeMountPoints.cs:45
using winPEAS._3rdParty.AlphaFS;
namespace Alphaleonis.Win32.Filesystem
{
public static partial class Volume
{
/// <summary>[AlphaFS] Returns an enumerable collection of <see cref="String"/> of all mounted folders (volume mount points) on the specified volume. </summary>
/// <exception cref="ArgumentNullException"/>
/// <exception cref="ArgumentException"/>
/// <param name="volumeGuid">A <see cref="string"/> containing the volume <see cref="Guid"/>.</param>
/// <returns>An enumerable collection of <see cref="String"/> of all volume mount points on the specified volume.</returns>
[SecurityCritical]
public static IEnumerable<string> EnumerateVolumeMountPoints(string volumeGuid)
{
if (Utils.IsNullOrWhiteSpace(volumeGuid))
throw new ArgumentNullException("volumeGuid");
if (!volumeGuid.StartsWith(Path.VolumePrefix + "{", StringComparison.OrdinalIgnoreCase))
throw new ArgumentException(Resources.Not_A_Valid_Guid, "volumeGuid");
// A trailing backslash is required.
volumeGuid = Path.AddTrailingDirectorySeparator(volumeGuid, false);
var buffer = new StringBuilder(NativeMethods.MaxPathUnicode);
using (new NativeMethods.ChangeErrorMode(NativeMethods.ErrorMode.FailCriticalErrors))
using (var handle = NativeMethods.FindFirstVolumeMountPoint(volumeGuid, buffer, (uint)buffer.Capacity))
{
var lastError = Marshal.GetLastWin32Error();
if (!NativeMethods.IsValidHandle(handle, false))
{
switch ((uint)lastError)
{View on GitHub (pinned to 53fb989abc)
Solutions
- Convert the input to a volume GUID path first via Volume.GetVolumeGuid(path)
- Ensure the string matches \\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\ format before calling
- Catch ArgumentException and fall back to Volume.GetVolumeGuid to normalize the input
Example fix
// before
Volume.EnumerateVolumeMountPoints("C:\");
// after
var guid = Volume.GetVolumeGuid("C:\");
Volume.EnumerateVolumeMountPoints(guid); // \\?\Volume{...}\ Defensive patterns
Strategy: validation
Validate before calling
if (!volumeGuid.StartsWith(@"\\?\Volume{", StringComparison.OrdinalIgnoreCase))
volumeGuid = Volume.GetVolumeGuid(volumeGuid); // normalize drive letter to GUID path Type guard
static bool IsVolumeGuidPath(string s) => !string.IsNullOrWhiteSpace(s) && s.StartsWith(@"\\?\Volume{", StringComparison.OrdinalIgnoreCase); Try / catch
try { Volume.EnumerateVolumeMountPoints(guid); }
catch (ArgumentException ex) { Log.Error($"Not a valid volume GUID path: {ex.Message}"); } Prevention
- Always normalize paths via Volume.GetVolumeGuid before GUID-specific APIs
- Never pass drive letters to methods documented as taking a volume Guid path
- Preserve the full \\?\Volume{...}\ string when persisting volume identifiers
When it happens
Trigger: Passing "C:\", a device path like "\\.\C:", a GUID without the \\?\Volume{ prefix, or a malformed GUID string to Volume.EnumerateVolumeMountPoints.
Common situations: Mixing up drive-letter paths with volume GUID paths; truncating a GUID path when storing it; constructing the GUID string manually with the wrong prefix casing/format.
Related errors
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/5bef70f6459b6b4a.
Report an issue: GitHub.