Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#241 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@ElectLive がすでに取り組んでいます。

2026年10月18日 から。

  • #243 @ElectLive による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
83/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp
領域
backend

調査の方向性

TruePath/Kernel32.csを開き、FileShare.DeleteとFileAttributes.PosixSemanticsの宣言を、issueに記載されたWindowsの値と照合してください。これらのメンバーは現在使われていないため、2つの修正を行う前に、プロジェクトに関連するinteropテストや参照があるか確認してください。両方のenum値が指定された定数と一致し、プロジェクトがビルドできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
C#
スター
107
フォーク
22
平均マージ
3日 2時間
マージ済み PR(30日)
13

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ForNeVeR/TruePath のほかの issue

ForNeVeR/TruePath の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。