Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Wrong values of Kernel32.FileShare.Delete and Kernel32.FileAttributes.PosixSemantics

Open Beginner friendly
#241 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@ElectLive is already working on this.

Since Oct 18, 2026.

  • #243 by @ElectLive — open

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
83/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
backend

Research direction

Open TruePath/Kernel32.cs and check the FileShare.Delete and FileAttributes.PosixSemantics declarations against the Windows values given in the issue. These members are currently unused, so confirm whether the project has relevant interop tests or references before making the two corrections. Done means both enum values match the stated constants and the project builds.

Written by the indexing model from the issue text.

Description

bug good first issue help wanted

Two members of the Win32 interop enums in Kernel32.cs have values that don't match the Windows headers:

Member Current value Correct value
FileShare.Delete 0x03 (that is Read | Write) 0x04 (FILE_SHARE_DELETE)
FileAttributes.PosixSemantics 0x0100000 (seven digits, 0x100000) 0x01000000 (FILE_FLAG_POSIX_SEMANTICS)

As written, PosixSemantics has the same value as OpenNoRecall (0x00100000, line 96).

Neither member is used anywhere right now (only FileShare.Read is), so nothing is broken today. But passing either one to CreateFile would silently request different behavior from the one intended: FileShare.Delete would grant read and write sharing instead of delete sharing, and PosixSemantics would request FILE_FLAG_OPEN_NO_RECALL instead.

Repro (the enums are internal, hence the reflection):

var k32 = typeof(AbsolutePath).Assembly.GetType("TruePath.Kernel32")!;
uint Get(string type, string name) =>
    Convert.ToUInt32(Enum.Parse(k32.GetNestedType(type, BindingFlags.NonPublic)!, name));

Console.WriteLine($"0x{Get("FileShare", "Delete"):X}");                  // 3, expected 4
Console.WriteLine($"0x{Get("FileAttributes", "PosixSemantics"):X}");     // 100000, expected 1000000

All the other constants in the file (FileAttributes, FileAccess, FileShare, the FSCTL_*/IOCTL_* codes, the reparse tags) match the Windows headers.

Recommendations

  • Fix the two values.
  • Prefer not to hand-roll these declarations at all: either delete the unused members, or generate the interop with CsWin32, which takes the values from the official metadata.
Dominant language
C#
Stars
107
Forks
22
Avg merge
3d 2h
Merged PRs (30d)
13

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ForNeVeR/TruePath

All issues in ForNeVeR/TruePath

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.