Hello,
I am developing a Windows 11 application that requires a durable, create-only marker to prevent an operation from being executed more than once.
Before the protected operation begins, the application must establish a marker file on NTFS. If the marker already exists, including an empty or partially written marker, the application refuses to execute again.
The proposed sequence is:
- Open and validate the parent directory, retaining its handle.
Create IDENTITIES.json relative to that directory using NtCreateFile, OBJECT_ATTRIBUTES.RootDirectory, and FILE_CREATE.
Write a consumption record through the newly created file handle.
Flush the file.
Read back and verify the record using the same handle.
Start the protected operation only if the required durability guarantee has been established.
I have reviewed the Microsoft documentation for NtCreateFile, FlushFileBuffers, NtFlushBuffersFileEx, NTFS, and Transactional NTFS.
I understand that exclusive creation, file flushing, and NTFS crash recovery do not necessarily establish the same guarantee.
My questions are:
Does a successful create-and-flush sequence provide a documented guarantee that both the newly created filename (parent directory entry) and the consumption record will survive an unexpected OS crash or sudden power loss?
References to official Microsoft documentation would be greatly appreciated.
Thank you.
<モデレーター注>
重複した質問内容を整理させて頂きました。
質問は、第三者を含めて混乱しない様に、一問一答形式にしてください。
1つのスレッド内に複数の質問を投稿しない
回答内容が発散してしまうことを回避する為に、質問内容2~5は 削除させて頂きました。
これらの質問については、必要に応じて新規に質問する様にしてください。