{"record":{"id":"5410c3db81ec83e7","repo":"peass-ng/PEASS-ng","slug":"volumeguid","errorCode":null,"errorMessage":"volumeGuid","messagePattern":"volumeGuid","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"warning","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.EnumerateVolumeMountPoints.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\"/> 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))","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.EnumerateVolumeMountPoints.cs#L24-L60","documentation":"EnumerateVolumeMountPoints(string volumeGuid) throws ArgumentNullException with paramName \"volumeGuid\" when the argument is null, empty, or whitespace. AlphaFS validates inputs defensively before making any native Win32 calls, because a null volume GUID path would otherwise cause a native API failure deep in the call stack.","triggerScenarios":"Calling Volume.EnumerateVolumeMountPoints(null), or passing an empty/whitespace-only string (\"\", \" \") instead of a volume GUID path like \"\\\\?\\Volume{...}\\\".","commonSituations":"Enumerating volumes from a list where some entries are null placeholders; passing an uninitialized string variable; a config file or registry lookup returning an empty value.","solutions":["Pass a valid volume GUID path obtained from Volume.EnumerateVolumes (format \\\\?\\Volume{GUID}\\)","Null/whitespace-check the argument before calling and skip or log invalid entries","Wrap the call in try/catch for ArgumentNullException when enumerating untrusted volume data"],"exampleFix":"// before\nforeach (var mnt in Volume.EnumerateVolumeMountPoints(vol)) { ... }\n// after\nif (!string.IsNullOrWhiteSpace(vol))\n    foreach (var mnt in Volume.EnumerateVolumeMountPoints(vol)) { ... }","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(volumeGuid)) throw new ArgumentException(\"A volume GUID path is required.\", nameof(volumeGuid));","typeGuard":"static bool IsValidVolumeGuidPath(string s) => !string.IsNullOrWhiteSpace(s) && s.StartsWith(@\"\\\\?\\Volume{\", StringComparison.OrdinalIgnoreCase);","tryCatchPattern":"try { foreach (var mp in Volume.EnumerateVolumeMountPoints(volumeGuid)) Process(mp); }\ncatch (ArgumentNullException ex) { Log.Warn($\"Skipped volume: {ex.ParamName} was null/empty\"); }","preventionTips":["Source GUIDs from Volume.EnumerateVolumes rather than manual strings","Null-check arguments at boundary points before AlphaFS calls","Skip-and-log null entries when iterating untrusted volume lists"],"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"}