{"record":{"id":"8a674c59cdc32e1a","repo":"peass-ng/PEASS-ng","slug":"resources-not-a-valid-guid-8a674c","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.EnumerateVolumePathNames.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\"/> drive letters and mounted folder paths for the specified volume.</summary>\n      /// <returns>An enumerable collection of <see cref=\"string\"/> containing the path names for the specified volume.</returns>\n      /// <exception cref=\"ArgumentNullException\"/>\n      /// <exception cref=\"ArgumentException\"/>\n      /// <param name=\"volumeGuid\">A volume <see cref=\"Guid\"/> path: \\\\?\\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\\.</param>\n      [SecurityCritical]\n      public static IEnumerable<string> EnumerateVolumePathNames(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         var volName = Path.AddTrailingDirectorySeparator(volumeGuid, false);\n\n\n         uint requiredLength = 10;\n         var cBuffer = new char[requiredLength];\n\n\n         using (new NativeMethods.ChangeErrorMode(NativeMethods.ErrorMode.FailCriticalErrors))\n            while (!NativeMethods.GetVolumePathNamesForVolumeName(volName, cBuffer, (uint)cBuffer.Length, out requiredLength))\n            {\n               var lastError = Marshal.GetLastWin32Error();\n\n               switch ((uint)lastError)\n               {\n                  case Win32Errors.ERROR_MORE_DATA:\n                  case Win32Errors.ERROR_INSUFFICIENT_BUFFER:","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.EnumerateVolumePathNames.cs#L27-L63","documentation":"EnumerateVolumePathNames throws ArgumentException (Resources.Not_A_Valid_Guid) when volumeGuid is non-empty but lacks the required \"\\\\?\\Volume{\" prefix. Only a volume GUID path is accepted; drive letters and DOS paths are rejected.","triggerScenarios":"Passing \"D:\\\" or \"\\\\?\\C:\\\" to Volume.EnumerateVolumePathNames; passing a GUID with wrong casing of the prefix or missing opening brace; GetVolumeDisplayName forwarding a malformed volume name.","commonSituations":"Persisted volume identifiers from another tool in a different format; string manipulation that stripped the \\\\?\\Volume{ prefix; assuming drive letters are valid input.","solutions":["Normalize input with Volume.GetVolumeGuid(path) before calling","Validate the input starts with \"\\\\?\\Volume{\" and ends with \"}\\\" before calling","Catch ArgumentException and log/skip the malformed volume entry"],"exampleFix":"// before\nVolume.EnumerateVolumePathNames(driveLetter);\n// after\nvar guid = Volume.GetVolumeGuid(driveLetter);\nVolume.EnumerateVolumePathNames(guid);","handlingStrategy":"validation","validationCode":"if (!volumeGuid.StartsWith(@\"\\\\?\\Volume{\", StringComparison.OrdinalIgnoreCase))\n    volumeGuid = Volume.GetVolumeGuid(volumeGuid);","typeGuard":"static bool IsVolumeGuidPath(string s) => !string.IsNullOrWhiteSpace(s) && s.StartsWith(@\"\\\\?\\Volume{\", StringComparison.OrdinalIgnoreCase);","tryCatchPattern":"try { Volume.EnumerateVolumePathNames(volumeGuid); }\ncatch (ArgumentException) { Log.Error($\"Malformed volume GUID: {volumeGuid}\"); }","preventionTips":["Normalize with Volume.GetVolumeGuid when input format is uncertain","Keep the \\\\?\\Volume{ prefix intact in stored volume identifiers","Unit-test volume parsing against drive letters and malformed GUIDs"],"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"}