{"record":{"id":"55bab4bf57706be0","repo":"peass-ng/PEASS-ng","slug":"the-operation-is-not-supported-on-this-version-of-55bab4","errorCode":null,"errorMessage":"The operation is not supported on this version of Windows.","messagePattern":"The operation is not supported on this version of Windows\\.","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/File Class/File Core Methods/File.EnumerateHardLinksCore.cs","lineNumber":41,"sourceCode":"using System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace Alphaleonis.Win32.Filesystem\n{\n   public static partial class File\n   {\n      /// <summary>[AlphaFS] Creates an enumeration of all the hard links to the specified <paramref name=\"path\"/>.</summary>\n      /// <returns>An enumerable collection of <see cref=\"string\"/> of all the hard links to the specified <paramref name=\"path\"/></returns>\n      /// <exception cref=\"PlatformNotSupportedException\">The operating system is older than Windows Vista.</exception>\n      /// <param name=\"transaction\">The transaction.</param>\n      /// <param name=\"path\">The name of the file.</param>\n      /// <param name=\"pathFormat\">Indicates the format of the path parameter(s).</param>\n      internal static IEnumerable<string> EnumerateHardLinksCore(KernelTransaction transaction, string path, PathFormat pathFormat)\n      {\n         if (!NativeMethods.IsAtLeastWindowsVista)\n            throw new PlatformNotSupportedException(new Win32Exception((int) Win32Errors.ERROR_OLD_WIN_VERSION).Message);\n\n         var pathLp = Path.GetExtendedLengthPathCore(transaction, path, pathFormat, GetFullPathOptions.RemoveTrailingDirectorySeparator | GetFullPathOptions.FullCheck);\n\n         // Default buffer length, will be extended if needed, although this should not happen.\n         uint length = NativeMethods.MaxPathUnicode;\n         var builder = new StringBuilder((int) length);\n\n\n      getFindFirstFileName:\n\n         using (var safeHandle = null == transaction\n\n            // FindFirstFileNameW() / FindFirstFileNameTransactedW() / FindNextFileNameW()\n            // 2013-01-13: MSDN does not confirm LongPath usage but a Unicode version of this function exists.\n            // 2017-05-30: FindFirstFileNameW() MSDN confirms LongPath usage: Starting with Windows 10, version 1607\n\n            ? NativeMethods.FindFirstFileNameW(pathLp, 0, out length, builder)\n","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/File Class/File Core Methods/File.EnumerateHardLinksCore.cs#L23-L59","documentation":"EnumerateHardLinksCore throws PlatformNotSupportedException when the OS is below Windows Vista (ERROR_OLD_WIN_VERSION). Hard link enumeration relies on FindFirstFileNameW APIs introduced in Vista, so AlphaFS refuses to run on older systems. Like error 70, this is a capability gate at method entry.","triggerScenarios":"Calling File.EnumerateHardLinks / EnumerateHardlinks / their Transacted variants on Windows XP/Server 2003 or an environment reporting an old OS version.","commonSituations":"Forensic/inventory tooling (winPEAS) run on legacy Windows images; deprecated XP-based POS or kiosk machines; shimmed OS version strings under compatibility mode.","solutions":["Run on Windows Vista or later","Check NativeMethods.IsAtLeastWindowsVista before enumerating and skip gracefully on legacy OS","Catch PlatformNotSupportedException and fall back to fsutil hardlink list or skip link analysis"],"exampleFix":"// before\nvar links = File.EnumerateHardLinks(path);\n// after\nif (NativeMethods.IsAtLeastWindowsVista)\n    var links = File.EnumerateHardLinks(path);\nelse\n    LogSkip(\"hard link enumeration unsupported on this OS\");","handlingStrategy":"validation","validationCode":"if (!NativeMethods.IsAtLeastWindowsVista) return; // hard link enumeration unsupported","typeGuard":"bool SupportsHardLinkEnumeration => Environment.OSVersion.Version.Major >= 6;","tryCatchPattern":"try { foreach (var l in File.EnumerateHardLinks(path)) { ... } }\ncatch (PlatformNotSupportedException ex) { Log(ex.Message); SkipLinkAnalysis(); }","preventionTips":["Gate hard link features on OS version checks","Provide degraded-mode behavior on legacy systems","Cache capability detection at process start"],"tags":["platform","windows","hardlink","version-compatibility"],"backgroundTag":"os-version-not-supported","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}