{"record":{"id":"386103de588002aa","repo":"peass-ng/PEASS-ng","slug":"volumemountpoint-386103","errorCode":null,"errorMessage":"volumeMountPoint","messagePattern":"volumeMountPoint","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"warning","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.SetVolumeMountPoint.cs","lineNumber":45,"sourceCode":"\nnamespace Alphaleonis.Win32.Filesystem\n{\n   public static partial class Volume\n   {\n      /// <summary>[AlphaFS] Associates a volume with a Drive letter or a directory on another volume.</summary>\n      /// <exception cref=\"ArgumentException\"/>\n      /// <exception cref=\"ArgumentNullException\"/>\n      /// <param name=\"volumeMountPoint\">\n      ///   The user-mode path to be associated with the volume. This may be a Drive letter (for example, \"X:\\\")\n      ///   or a directory on another volume (for example, \"Y:\\MountX\\\").\n      /// </param>\n      /// <param name=\"volumeGuid\">A <see cref=\"string\"/> containing the volume <see cref=\"Guid\"/>.</param>      \n      [SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"1\", Justification = \"Utils.IsNullOrWhiteSpace validates arguments.\")]\n      [SecurityCritical]\n      public static void SetVolumeMountPoint(string volumeMountPoint, string volumeGuid)\n      {\n         if (Utils.IsNullOrWhiteSpace(volumeMountPoint))\n            throw new ArgumentNullException(\"volumeMountPoint\");\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         volumeMountPoint = Path.GetFullPathCore(null, false, volumeMountPoint, GetFullPathOptions.AsLongPath | GetFullPathOptions.AddTrailingDirectorySeparator | GetFullPathOptions.FullCheck);\n\n\n         // This string must be of the form \"\\\\?\\Volume{GUID}\\\"\n         volumeGuid = Path.AddTrailingDirectorySeparator(volumeGuid, false);\n\n\n         // ChangeErrorMode is for the Win32 SetThreadErrorMode() method, used to suppress possible pop-ups.\n         using (new NativeMethods.ChangeErrorMode(NativeMethods.ErrorMode.FailCriticalErrors))\n         {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.SetVolumeMountPoint.cs#L27-L63","documentation":"SetVolumeMountPoint(string volumeMountPoint, string volumeGuid) throws ArgumentNullException with paramName \"volumeMountPoint\" when the first argument is null, empty, or whitespace. This API creates a mounted-drive link at the given mount point and validates both arguments before any native call.","triggerScenarios":"Calling Volume.SetVolumeMountPoint(null, guid) or passing \"\"/\" \" as the mount point directory while the GUID argument is valid.","commonSituations":"Scripted mount-point creation where the target folder variable was never set; config-driven mounting with a missing mount-path entry.","solutions":["Pass an existing NTFS directory path (e.g. \"C:\\Mount\\Data\") as volumeMountPoint","Validate both arguments with string.IsNullOrWhiteSpace before calling","Catch ArgumentNullException to report a configuration error to the user"],"exampleFix":"// before\nVolume.SetVolumeMountPoint(mountDir, guid);\n// after\nif (string.IsNullOrWhiteSpace(mountDir)) throw new InvalidOperationException(\"Mount dir not configured\");\nVolume.SetVolumeMountPoint(mountDir, guid);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(volumeMountPoint))\n    throw new InvalidOperationException(\"volumeMountPoint must be an existing NTFS directory path.\");","typeGuard":"static bool CanMountAt(string dir) => !string.IsNullOrWhiteSpace(dir) && Directory.Exists(dir);","tryCatchPattern":"try { Volume.SetVolumeMountPoint(mountDir, guid); }\ncatch (ArgumentNullException ex) { Log.Error($\"Mount failed, missing argument: {ex.ParamName}\"); }","preventionTips":["Verify the mount-point directory exists before mounting","Load mount paths from config with explicit required-field checks","Log the failing paramName to distinguish mount-point vs GUID problems"],"tags":["argument-null","alphafs","volume-mount-point","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"}