You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: The FILE_DISPOSITION_INFORMATION_EX structure is used as an argument to the ZwSetInformationFile routine and indicates how the operating system should delete a file.
The <b>FILE_DISPOSITION_INFORMATION_EX</b> structure is used as an argument to the <ahref="/windows-hardware/drivers/ddi/wdm/nf-wdm-zwsetinformationfile">ZwSetInformationFile</a> routine and indicates how the operating system should delete a file.
53
+
The **FILE_DISPOSITION_INFORMATION_EX** structure is used as an argument to the [ZwSetInformationFile](/windows-hardware/drivers/ddi/wdm/nf-wdm-zwsetinformationfile) routine and indicates how the operating system should delete a file.
55
54
56
55
## -struct-fields
57
56
58
57
### -field Flags
59
58
60
-
Specifies what action(s) the system should take with a specific file while deleting.
59
+
Specifies what actions the system should take with a specific file while deleting.
61
60
62
-
<table>
63
-
<tr>
64
-
<th>Flag Name</th>
65
-
<th>
66
-
Value</th>
67
-
<th>Meaning</th>
68
-
</tr>
69
-
<tr>
70
-
<td>FILE_DISPOSITION_DO_NOT_DELETE</td>
71
-
<td>
72
-
0x00000000
73
-
</td>
74
-
<td>Specifies the system should not delete a file.</td>
75
-
</tr>
76
-
<tr>
77
-
<td>FILE_DISPOSITION_DELETE</td>
78
-
<td>0x00000001</td>
79
-
<td>Specifies the system should delete a file.</td>
80
-
</tr>
81
-
<tr>
82
-
<td>FILE_DISPOSITION_POSIX_SEMANTICS</td>
83
-
<td>0x00000002</td>
84
-
<td>Specifies the system should perform a POSIX-style delete. See more info in Remarks.</td>
<td>Allows read-only files to be deleted. See more info in Remarks.</td>
100
-
</tr>
101
-
</table>
61
+
| Flag Name | Value | Meaning |
62
+
|--|--|--|
63
+
| FILE_DISPOSITION_DO_NOT_DELETE | 0x00000000 | Specifies the system should not delete a file. |
64
+
| FILE_DISPOSITION_DELETE | 0x00000001 | Specifies the system should delete a file. |
65
+
| FILE_DISPOSITION_POSIX_SEMANTICS | 0x00000002 | Specifies the system should perform a POSIX-style delete. See more info in Remarks. |
66
+
| FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK | 0x00000004 | Specifies the system should force an image section check. |
67
+
| FILE_DISPOSITION_ON_CLOSE | 0x00000008 | Specifies if the system sets or clears the on-close state. |
68
+
| FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE | 0x00000010 | Allows read-only files to be deleted. For more information, see the Remarks section below. |
102
69
103
70
## -remarks
104
71
105
-
The caller must have DELETE access to a given file to call ZwSetInformationFile with <b>FILE_DISPOSITION_DELETE</b>.
106
-
72
+
The caller must have DELETE access to a given file to call ZwSetInformationFile with **FILE_DISPOSITION_DELETE**.
107
73
108
-
When <b>FILE_DISPOSITION_POSIX_SEMANTICS</b> is not set, a file marked for deletion is not actually deleted until all open handles for the file have been closed and the link count for the file is zero. When <b>FILE_DISPOSITION_POSIX_SEMANTICS</b> is set, the link is removed from the visible namespace as soon as the POSIX delete handle has been closed, but the file’s data streams remain accessible by other existing handles until the last handle has been closed. That is, applications that already had the file open can still use their handle to read/write even though the name they used to open it is gone and the file's link count may have reached zero.
74
+
When **FILE_DISPOSITION_POSIX_SEMANTICS** is not set, a file marked for deletion is not actually deleted until all open handles for the file have been closed and the link count for the file is zero. When **FILE_DISPOSITION_POSIX_SEMANTICS** is set, the link is removed from the visible namespace as soon as the POSIX delete handle has been closed, but the file's data streams remain accessible by other existing handles until the last handle has been closed. That is, applications that already had the file open can still use their handle to read/write even though the name they used to open it is gone and the file's link count may have reached zero.
109
75
110
76
If the file is being deleted at user request, using POSIX semantics allows the system to delete the file as requested, but also allows any process with an open handle to continue to access the file's data as long as the handle is open.
111
77
112
-
A return value of STATUS_CANNOT_DELETE indicates that either the file is read-only, or there's an existing mapped view to the file. Specifying <b>FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE</b> avoids this return value due to the file being read-only, provided the caller has FILE_WRITE_ATTRIBUTES access to the file (the access that would be required to clear the read-only attribute).
78
+
A return value of STATUS_CANNOT_DELETE indicates that either the file is read-only, or there is an existing mapped view to the file.
0 commit comments