{"record":{"id":"1a22e5a84fe09a8d","repo":"peass-ng/PEASS-ng","slug":"volumemountpoint","errorCode":null,"errorMessage":"volumeMountPoint","messagePattern":"volumeMountPoint","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"warning","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.GetVolumeGuid.cs","lineNumber":46,"sourceCode":"namespace Alphaleonis.Win32.Filesystem\n{\n   public static partial class Volume\n   {\n      /// <summary>[AlphaFS] \n      ///   Retrieves a volume <see cref=\"Guid\"/> path for the volume that is associated with the specified volume mount point (drive letter,\n      ///   volume GUID path, or mounted folder).\n      /// </summary>\n      /// <exception cref=\"ArgumentNullException\"/>\n      /// <param name=\"volumeMountPoint\">\n      ///   The path of a mounted folder (for example, \"Y:\\MountX\\\") or a drive letter (for example, \"X:\\\").\n      /// </param>\n      /// <returns>The unique volume name of the form: \"\\\\?\\Volume{GUID}\\\".</returns>\n      [SuppressMessage(\"Microsoft.Interoperability\", \"CA1404:CallGetLastErrorImmediatelyAfterPInvoke\", Justification = \"Marshal.GetLastWin32Error() is manipulated.\")]\n      [SecurityCritical]\n      public static string GetVolumeGuid(string volumeMountPoint)\n      {\n         if (Utils.IsNullOrWhiteSpace(volumeMountPoint))\n            throw new ArgumentNullException(\"volumeMountPoint\");\n\n         // The string must end with a trailing backslash ('\\').\n         volumeMountPoint = Path.GetFullPathCore(null, false, volumeMountPoint, GetFullPathOptions.AsLongPath | GetFullPathOptions.AddTrailingDirectorySeparator | GetFullPathOptions.FullCheck);\n\n         var volumeGuid = new StringBuilder(100);\n         var uniqueName = new StringBuilder(100);\n\n         try\n         {\n            using (new NativeMethods.ChangeErrorMode(NativeMethods.ErrorMode.FailCriticalErrors))\n            {\n               // GetVolumeNameForVolumeMountPoint()\n               // 2013-07-18: MSDN does not confirm LongPath usage but a Unicode version of this function exists.\n\n               return NativeMethods.GetVolumeNameForVolumeMountPoint(volumeMountPoint, volumeGuid, (uint)volumeGuid.Capacity)\n\n                  // The string must end with a trailing backslash.\n                  ? NativeMethods.GetVolumeNameForVolumeMountPoint(Path.AddTrailingDirectorySeparator(volumeGuid.ToString(), false), uniqueName, (uint)uniqueName.Capacity)","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.GetVolumeGuid.cs#L28-L64","documentation":"GetVolumeGuid(string volumeMountPoint) throws ArgumentNullException with paramName \"volumeMountPoint\" when the argument is null, empty, or whitespace. The method converts a mount point or path into its \\\\?\\Volume{GUID}\\ unique name and rejects blank input before any native call.","triggerScenarios":"Calling Volume.GetVolumeGuid(null) or \"\"; passing an uninitialized variable that should have held a mount point path; IsVolume forwarding an empty candidate string.","commonSituations":"Enumerating mount points where an entry failed to parse; reading mount points from a config/registry that returned empty; calling GetVolumeGuid on a path variable that was never assigned.","solutions":["Pass a valid path or mount point (e.g. \"C:\\\" or \\\\?\\Volume{GUID}\\)","Guard the call with string.IsNullOrWhiteSpace and treat blank input as \"no volume\"","Catch ArgumentNullException in enumeration loops over untrusted data"],"exampleFix":"// before\nbool mounted = Volume.IsVolume(mountPoint);\n// after\nbool mounted = !string.IsNullOrWhiteSpace(mountPoint) && Volume.IsVolume(mountPoint);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(volumeMountPoint)) return null; // no volume to resolve","typeGuard":"static bool HasMountPointValue(string s) => !string.IsNullOrWhiteSpace(s);","tryCatchPattern":"try { guid = Volume.GetVolumeGuid(mountPoint); }\ncatch (ArgumentNullException ex) { Log.Warn($\"Mount point missing: {ex.ParamName}\"); }","preventionTips":["Null-check mount points parsed from external sources before calling","Use IsVolume/GetVolumeGuid only on non-empty path strings","Track where null mount points originate (failed lookups upstream) and fix there"],"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"}