{"record":{"id":"71704d94636df66d","repo":"peass-ng/PEASS-ng","slug":"volumeguid-71704d","errorCode":null,"errorMessage":"volumeGuid","messagePattern":"volumeGuid","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.SetVolumeMountPoint.cs","lineNumber":48,"sourceCode":"   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         {\n            // SetVolumeMountPoint()\n            // 2014-01-29: MSDN does not confirm LongPath usage but a Unicode version of this function exists.\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Device/Volume/Volume.SetVolumeMountPoint.cs#L30-L66","documentation":"SetVolumeMountPoint throws ArgumentNullException (\"volumeGuid\") when the second argument is null/empty/whitespace, and ArgumentException (Resources.Not_A_Valid_Guid) when it is non-empty but lacks the \"\\\\?\\Volume{\" prefix. The GUID argument must be a full volume GUID path of the form \\\\?\\Volume{...}\\.","triggerScenarios":"Calling Volume.SetVolumeMountPoint(dir, null); passing a drive letter \"E:\\\" or bare GUID string without the \\\\?\\Volume{ prefix as volumeGuid.","commonSituations":"Hard-coding a volume GUID that was truncated or reformatted; storing GUIDs without the device prefix in config; passing a drive letter where a volume GUID path is required.","solutions":["Resolve the GUID path via Volume.GetVolumeGuid(\"E:\\\") and pass that result","Validate the argument starts with \"\\\\?\\Volume{\" before calling","Catch both ArgumentNullException and ArgumentException and surface a clear config error"],"exampleFix":"// before\nVolume.SetVolumeMountPoint(\"C:\\Mount\", \"E:\\\");\n// after\nstring guid = Volume.GetVolumeGuid(\"E:\\\");\nVolume.SetVolumeMountPoint(\"C:\\Mount\", guid); // \\\\?\\Volume{...}\\","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(volumeGuid) || !volumeGuid.StartsWith(@\"\\\\?\\Volume{\", StringComparison.OrdinalIgnoreCase))\n    volumeGuid = Volume.GetVolumeGuid(driveLetter); // resolve from a path if needed","typeGuard":"static bool IsVolumeGuidPath(string s) => !string.IsNullOrWhiteSpace(s) && s.StartsWith(@\"\\\\?\\Volume{\", StringComparison.OrdinalIgnoreCase);","tryCatchPattern":"try { Volume.SetVolumeMountPoint(mountDir, guid); }\ncatch (ArgumentException) { Log.Error($\"volumeGuid must be \\\\\\\\?\\\\Volume{{...}}\\\\ format, got: {guid}\"); }\ncatch (ArgumentNullException) { Log.Error(\"volumeGuid was null/empty\"); }","preventionTips":["Always produce the GUID argument via Volume.GetVolumeGuid, never hand-build it","Store full \\\\?\\Volume{...}\\ paths in config, not bare GUIDs","Validate both arguments before calling mounting APIs — it has multiple failure modes"],"tags":["argument-null","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"}