├── LICENSE ├── README.md ├── deleteex.cpp ├── deleteex.sln ├── deleteex.vcxproj ├── deleteex.vcxproj.filters ├── stdafx.cpp ├── stdafx.h └── targetver.h /LICENSE: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2008-2017 OSR Open Systems Resources, Inc. 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are met: 7 | // 8 | // 1. Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // 11 | // 2. Redistributions in binary form must reproduce the above copyright notice, 12 | // this list of conditions and the following disclaimer in the documentation 13 | // and/or other materials provided with the distribution. 14 | // 15 | // 3. Neither the name of the copyright holder nor the names of its 16 | // contributors may be used to endorse or promote products derived from this 17 | // software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE 30 | // -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # deleteex # 2 | 3 | There was an interesting discussion on NTFSD recently due to a file that could not be deleted: 4 | 5 | 6 | http://www.osronline.com/showThread.CFM?link=286551 7 | 8 | The issue was due to the fact that the file had an active image section (i.e. was currently loaded as an executable). However, the poster was only trying to delete **a** hard link to the file, not the **last** hard link to the file. 9 | 10 | In playing with this more, it turns out that this case is properly handled by NTFS if you send the new FileDispositionInfoEx request. This will allow the link to be deleted even though there is an active image section, so long as it's not the last link to the file. This test application demonstrates the new behavior. 11 | 12 | # Building the sample # 13 | The provided solution builds using Visual Studio 2017. The target system must be running Windows 10 RS3 or later in order for the test to succeed. 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /deleteex.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSRDrivers/deleteex/164fe0ce455f6ec99b264119f0e5afbc7eed2265/deleteex.cpp -------------------------------------------------------------------------------- /deleteex.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27004.2002 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "deleteex", "deleteex.vcxproj", "{6B22B839-E119-404F-ADF4-48B541C51EF4}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {6B22B839-E119-404F-ADF4-48B541C51EF4}.Debug|x64.ActiveCfg = Debug|x64 17 | {6B22B839-E119-404F-ADF4-48B541C51EF4}.Debug|x64.Build.0 = Debug|x64 18 | {6B22B839-E119-404F-ADF4-48B541C51EF4}.Debug|x86.ActiveCfg = Debug|Win32 19 | {6B22B839-E119-404F-ADF4-48B541C51EF4}.Debug|x86.Build.0 = Debug|Win32 20 | {6B22B839-E119-404F-ADF4-48B541C51EF4}.Release|x64.ActiveCfg = Release|x64 21 | {6B22B839-E119-404F-ADF4-48B541C51EF4}.Release|x64.Build.0 = Release|x64 22 | {6B22B839-E119-404F-ADF4-48B541C51EF4}.Release|x86.ActiveCfg = Release|Win32 23 | {6B22B839-E119-404F-ADF4-48B541C51EF4}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {AD64A973-7BF4-4E60-8F61-758FD2E654F1} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /deleteex.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 15.0 23 | {6B22B839-E119-404F-ADF4-48B541C51EF4} 24 | Win32Proj 25 | deleteex 26 | 10.0.16299.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v141 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v141 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v141 46 | Unicode 47 | 48 | 49 | Application 50 | false 51 | v141 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | 76 | 77 | true 78 | 79 | 80 | false 81 | 82 | 83 | false 84 | 85 | 86 | 87 | Use 88 | Level3 89 | Disabled 90 | true 91 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 92 | MultiThreaded 93 | 94 | 95 | Console 96 | true 97 | 98 | 99 | 100 | 101 | Use 102 | Level3 103 | Disabled 104 | true 105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 106 | MultiThreaded 107 | 108 | 109 | Console 110 | true 111 | 112 | 113 | 114 | 115 | Use 116 | Level3 117 | MaxSpeed 118 | true 119 | true 120 | true 121 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 122 | MultiThreaded 123 | 124 | 125 | Console 126 | true 127 | true 128 | true 129 | 130 | 131 | 132 | 133 | Use 134 | Level3 135 | MaxSpeed 136 | true 137 | true 138 | true 139 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 140 | MultiThreaded 141 | 142 | 143 | Console 144 | true 145 | true 146 | true 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | Create 157 | Create 158 | Create 159 | Create 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /deleteex.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSRDrivers/deleteex/164fe0ce455f6ec99b264119f0e5afbc7eed2265/stdafx.cpp -------------------------------------------------------------------------------- /stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSRDrivers/deleteex/164fe0ce455f6ec99b264119f0e5afbc7eed2265/stdafx.h -------------------------------------------------------------------------------- /targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSRDrivers/deleteex/164fe0ce455f6ec99b264119f0e5afbc7eed2265/targetver.h --------------------------------------------------------------------------------