{"record":{"id":"4367bf81c31b1cae","repo":"peass-ng/PEASS-ng","slug":"volumeguid-4367bf","errorCode":null,"errorMessage":"volumeGuid","messagePattern":"volumeGuid","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"warning","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.EnumerateVolumePathNames.cs","lineNumber":42,"sourceCode":"using System.Runtime.InteropServices;\nusing System.Security;\nusing System.Text;\nusing 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)","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.EnumerateVolumePathNames.cs#L24-L60","documentation":"EnumerateVolumePathNames(string volumeGuid) throws ArgumentNullException with paramName \"volumeGuid\" when the argument is null, empty, or whitespace. Like all AlphaFS Volume APIs, it validates arguments before invoking native QueryDosDevice/FindFirstVolumeMountPoint machinery.","triggerScenarios":"Calling Volume.EnumerateVolumePathNames(null) or with \"\"/whitespace instead of a \\\\?\\Volume{GUID}\\ path; GetVolumeDisplayName passing through a null volume name.","commonSituations":"Building volume-info lists where GUID lookup failed earlier and produced null; deserializing volume paths from JSON/config with missing values.","solutions":["Obtain the GUID from Volume.EnumerateVolumes or Volume.GetVolumeGuid before calling","Guard with string.IsNullOrWhiteSpace and skip null entries","Catch ArgumentNullException when processing untrusted volume data"],"exampleFix":"// before\nnames = Volume.EnumerateVolumePathNames(volGuid).ToList();\n// after\nif (!string.IsNullOrWhiteSpace(volGuid))\n    names = Volume.EnumerateVolumePathNames(volGuid).ToList();","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(volumeGuid)) return Enumerable.Empty<string>(); // or throw with context","typeGuard":"static bool IsValidVolumeGuidPath(string s) => !string.IsNullOrWhiteSpace(s) && s.StartsWith(@\"\\\\?\\Volume{\", StringComparison.OrdinalIgnoreCase);","tryCatchPattern":"try { names = Volume.EnumerateVolumePathNames(volumeGuid).ToList(); }\ncatch (ArgumentNullException ex) { names = new List<string>(); Log.Warn($\"Null volumeGuid: {ex.ParamName}\"); }","preventionTips":["Check GetVolumeGuid results for null before feeding them into EnumerateVolumePathNames","Validate config/registry-derived volume strings before use","Use string.IsNullOrWhiteSpace (not just null) — whitespace also throws"],"tags":["argument-null","alphafs","volume","windows"],"backgroundTag":"null-or-empty-argument","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}