开发者

What type of file deletes itself as soon as the handle is closed?

开发者 https://www.devze.com 2022-12-10 04:31 出处:网络
Let\'s say I have a Windows application that creates a file and writes data to it. The application has opened the file exclusively so no other processes can read the data in the file.

Let's say I have a Windows application that creates a file and writes data to it. The application has opened the file exclusively so no other processes can read the data in the file.

If the process is killed, the file is deleted.

If the process is suspended and the handle to the file is closed (using Process Explorer), the file is deleted.

It must be a feature of Wi开发者_Python百科ndows that causes this, as no more code in the process is run because it's killed or suspended.

How can this be? What type of file exhibits this behaviour?


It's ok, I just found out.

It's FILE_FLAG_DELETE_ON_CLOSE in dwFlagsAndAttributes on the CreateFile function.

Should have looked harder before asking the question :)


A "delete on close" filehandle.

0

精彩评论

暂无评论...
验证码 换一张
取 消