OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome_elf/create_file/chrome_create_file.h" | 5 #include "chrome_elf/create_file/chrome_create_file.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <bitset> | 9 #include <bitset> |
10 #include <string> | 10 #include <string> |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 EXPECT_FALSE(ShouldBypass(desktop_junk_path.value().c_str())); | 370 EXPECT_FALSE(ShouldBypass(desktop_junk_path.value().c_str())); |
371 EXPECT_FALSE(ShouldBypass(desktop_prefs_path.value().c_str())); | 371 EXPECT_FALSE(ShouldBypass(desktop_prefs_path.value().c_str())); |
372 | 372 |
373 // Only redirect "Preferences" and "Local State" files. | 373 // Only redirect "Preferences" and "Local State" files. |
374 EXPECT_TRUE(ShouldBypass(local_prefs_path.value().c_str())); | 374 EXPECT_TRUE(ShouldBypass(local_prefs_path.value().c_str())); |
375 EXPECT_TRUE(ShouldBypass(local_state_path.value().c_str())); | 375 EXPECT_TRUE(ShouldBypass(local_state_path.value().c_str())); |
376 EXPECT_FALSE(ShouldBypass(local_junk_path.value().c_str())); | 376 EXPECT_FALSE(ShouldBypass(local_junk_path.value().c_str())); |
377 } | 377 } |
378 | 378 |
379 TEST_F(ChromeCreateFileTest, NtCreateFileAddressCheck) { | 379 TEST_F(ChromeCreateFileTest, NtCreateFileAddressCheck) { |
380 HMODULE ntdll_handle = ::GetModuleHandle(L"ntdll.dll"); | 380 EXPECT_EQ(&g_nt_thunk_storage, g_ntdll_lookup["NtCreateFile"]); |
381 EXPECT_EQ(::GetProcAddress(ntdll_handle, "NtCreateFile"), | |
382 g_ntdll_lookup["NtCreateFile"]); | |
383 } | 381 } |
384 | 382 |
385 TEST_F(ChromeCreateFileTest, ReadWriteFromNtDll) { | 383 TEST_F(ChromeCreateFileTest, ReadWriteFromNtDll) { |
386 base::FilePath file_name = temp_dir_.path().Append(L"some_file.txt"); | 384 base::FilePath file_name = temp_dir_.path().Append(L"some_file.txt"); |
387 DoWriteCheck(file_name, FILE_ATTRIBUTE_NORMAL, false); | 385 DoWriteCheck(file_name, FILE_ATTRIBUTE_NORMAL, false); |
388 DoReadCheck(file_name, FILE_ATTRIBUTE_NORMAL, false); | 386 DoReadCheck(file_name, FILE_ATTRIBUTE_NORMAL, false); |
389 } | 387 } |
390 | 388 |
391 } // namespace | 389 } // namespace |
OLD | NEW |