Chromium Code Reviews| Index: base/platform_file_win.cc |
| diff --git a/base/platform_file_win.cc b/base/platform_file_win.cc |
| index 07b5c48c22bf1add6aaf77e93cb63a0ee36d6da7..449910d3ec11104488c7517d0650b26eada985ae 100644 |
| --- a/base/platform_file_win.cc |
| +++ b/base/platform_file_win.cc |
| @@ -86,6 +86,19 @@ PlatformFile CreatePlatformFileUnsafe(const FilePath& name, |
| HANDLE file = CreateFile(name.value().c_str(), access, sharing, NULL, |
| disposition, create_flags, NULL); |
| + if (INVALID_HANDLE_VALUE != file){ |
|
Peter Kasting
2014/03/14 02:23:10
Drive-by: Please write (file != INVALID_HANDLE_VAL
|
| + // Don't allow directories to be opened without the proper flag (block ADS). |
| + if (!(flags & PLATFORM_FILE_BACKUP_SEMANTICS)) { |
| + BY_HANDLE_FILE_INFORMATION info = { 0 }; |
| + DCHECK(GetFileInformationByHandle(file, &info)); |
|
Peter Kasting
2014/03/14 02:23:10
Never do real work in a DCHECK. In non-DCHECK bui
|
| + if (info.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY | |
| + FILE_ATTRIBUTE_REPARSE_POINT)) { |
| + CloseHandle(file); |
| + file = INVALID_HANDLE_VALUE; |
| + } |
| + } |
| + } |
| + |
| if (created && (INVALID_HANDLE_VALUE != file)) { |
| if (flags & (PLATFORM_FILE_OPEN_ALWAYS)) |
| *created = (ERROR_ALREADY_EXISTS != GetLastError()); |