{"record":{"id":"5bef70f6459b6b4a","repo":"peass-ng/PEASS-ng","slug":"resources-not-a-valid-guid","errorCode":null,"errorMessage":"Resources.Not_A_Valid_Guid","messagePattern":"Resources\\.Not_A_Valid_Guid","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.EnumerateVolumeMountPoints.cs","lineNumber":45,"sourceCode":"using winPEAS._3rdParty.AlphaFS;\n\nnamespace Alphaleonis.Win32.Filesystem\n{\n   public static partial class Volume\n   {\n      /// <summary>[AlphaFS] Returns an enumerable collection of <see cref=\"String\"/> of all mounted folders (volume mount points) on the specified volume. </summary>\n      /// <exception cref=\"ArgumentNullException\"/>\n      /// <exception cref=\"ArgumentException\"/>\n      /// <param name=\"volumeGuid\">A <see cref=\"string\"/> containing the volume <see cref=\"Guid\"/>.</param>\n      /// <returns>An enumerable collection of <see cref=\"String\"/> of all volume mount points on the specified volume.</returns>\n      [SecurityCritical]\n      public static IEnumerable<string> EnumerateVolumeMountPoints(string volumeGuid)\n      {\n         if (Utils.IsNullOrWhiteSpace(volumeGuid))\n            throw new ArgumentNullException(\"volumeGuid\");\n\n         if (!volumeGuid.StartsWith(Path.VolumePrefix + \"{\", StringComparison.OrdinalIgnoreCase))\n            throw new ArgumentException(Resources.Not_A_Valid_Guid, \"volumeGuid\");\n\n\n         // A trailing backslash is required.\n         volumeGuid = Path.AddTrailingDirectorySeparator(volumeGuid, false);\n\n\n         var buffer = new StringBuilder(NativeMethods.MaxPathUnicode);\n\n\n         using (new NativeMethods.ChangeErrorMode(NativeMethods.ErrorMode.FailCriticalErrors))\n         using (var handle = NativeMethods.FindFirstVolumeMountPoint(volumeGuid, buffer, (uint)buffer.Capacity))\n         {\n            var lastError = Marshal.GetLastWin32Error();\n\n            if (!NativeMethods.IsValidHandle(handle, false))\n            {\n               switch ((uint)lastError)\n               {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.EnumerateVolumeMountPoints.cs#L27-L63","documentation":"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.","triggerScenarios":"Passing \"C:\\\", a device path like \"\\\\.\\C:\", a GUID without the \\\\?\\Volume{ prefix, or a malformed GUID string to Volume.EnumerateVolumeMountPoints.","commonSituations":"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.","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"],"exampleFix":"// before\nVolume.EnumerateVolumeMountPoints(\"C:\\\");\n// after\nvar guid = Volume.GetVolumeGuid(\"C:\\\");\nVolume.EnumerateVolumeMountPoints(guid); // \\\\?\\Volume{...}\\","handlingStrategy":"validation","validationCode":"if (!volumeGuid.StartsWith(@\"\\\\?\\Volume{\", StringComparison.OrdinalIgnoreCase))\n    volumeGuid = Volume.GetVolumeGuid(volumeGuid); // normalize drive letter to GUID path","typeGuard":"static bool IsVolumeGuidPath(string s) => !string.IsNullOrWhiteSpace(s) && s.StartsWith(@\"\\\\?\\Volume{\", StringComparison.OrdinalIgnoreCase);","tryCatchPattern":"try { Volume.EnumerateVolumeMountPoints(guid); }\ncatch (ArgumentException ex) { Log.Error($\"Not a valid volume GUID path: {ex.Message}\"); }","preventionTips":["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"],"tags":["argument-format","alphafs","volume-guid","windows"],"backgroundTag":"invalid-volume-guid-format","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}