Changeset 1474 for branches/eraser6/6.0
- Timestamp:
- 1/6/2010 5:11:47 AM (3 years ago)
- Location:
- branches/eraser6/6.0
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
Eraser.Util/File.cs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/6.0
- Property svn:mergeinfo changed
/trunk/eraser6 merged: 1473
- Property svn:mergeinfo changed
-
branches/eraser6/6.0/Eraser.Util/File.cs
r1360 r1474 150 150 public static bool IsProtectedSystemFile(string filePath) 151 151 { 152 if (filePath.Length > 255) 153 return false; 154 if (SfcIsFileProtected(IntPtr.Zero, filePath)) 155 return true; 156 157 switch (Marshal.GetLastWin32Error()) 158 { 159 case 0: //ERROR_SUCCESS 160 case 2: //ERROR_FILE_NOT_FOUND 161 return false; 162 163 default: 164 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error()); 165 } 152 return SfcIsFileProtected(IntPtr.Zero, filePath); 166 153 } 167 154 … … 223 210 /// <param name="RpcHandle">This parameter must be NULL.</param> 224 211 /// <param name="ProtFileName">The name of the file.</param> 225 /// <returns>If the file is protected, the return value is true. 226 /// 227 /// If the file is not protected, the return value is false and 228 /// Marshal.GetLastWin32Error() returns ERROR_FILE_NOT_FOUND. If the 229 /// function fails, Marshal.GetLastWin32Error() will return a different 230 /// error code.</returns> 231 [DllImport("Sfc.dll", SetLastError = true, CharSet = CharSet.Unicode)] 212 /// <returns>If the file is protected, the return value is true.</returns> 213 [DllImport("Sfc.dll", CharSet = CharSet.Unicode)] 232 214 [return: MarshalAs(UnmanagedType.Bool)] 233 215 private static extern bool SfcIsFileProtected(IntPtr RpcHandle,
Note: See TracChangeset
for help on using the changeset viewer.
