Chromium Code Reviews| Index: chrome_elf/create_file/chrome_create_file.cc |
| diff --git a/chrome_elf/create_file/chrome_create_file.cc b/chrome_elf/create_file/chrome_create_file.cc |
| index 9521ecb208778ac14233fd9ce593c8f8fa678ca6..8a75fb65ce6bd2402d106785f9a843b1691d2b5b 100644 |
| --- a/chrome_elf/create_file/chrome_create_file.cc |
| +++ b/chrome_elf/create_file/chrome_create_file.cc |
| @@ -10,6 +10,7 @@ |
| #include "chrome_elf/chrome_elf_constants.h" |
| #include "chrome_elf/chrome_elf_util.h" |
| #include "chrome_elf/ntdll_cache.h" |
| +#include "sandbox/win/src/interception_internal.h" |
| #include "sandbox/win/src/nt_internals.h" |
| namespace { |
| @@ -184,13 +185,21 @@ HANDLE CreateFileNTDLL( |
| if (flags_and_attributes & FILE_FLAG_OPEN_NO_RECALL) |
| flags |= FILE_OPEN_NO_RECALL; |
| - if (!g_ntdll_lookup["NtCreateFile"] || |
| - !g_ntdll_lookup["RtlInitUnicodeString"]) { |
| + if (!g_ntdll_lookup["RtlInitUnicodeString"]) |
| return INVALID_HANDLE_VALUE; |
| - } |
| - NtCreateFileFunction create_file = |
| - reinterpret_cast<NtCreateFileFunction>(g_ntdll_lookup["NtCreateFile"]); |
| + NtCreateFileFunction create_file; |
| + char thunk_buffer[sizeof(sandbox::ThunkData)] = {}; |
|
robertshield
2014/03/17 22:21:27
Please add a comment that explains that this is fo
Cait (Slow)
2014/03/18 00:23:10
Done.
|
| + |
| + if (g_nt_thunk_storage.data[0] != 0) { |
| + create_file = reinterpret_cast<NtCreateFileFunction>(&g_nt_thunk_storage); |
| + memcpy(&thunk_buffer, &g_nt_thunk_storage, sizeof(sandbox::ThunkData)); |
| + } else if (g_ntdll_lookup["NtCreateFile"]) { |
| + create_file = |
| + reinterpret_cast<NtCreateFileFunction>(g_ntdll_lookup["NtCreateFile"]); |
| + } else { |
| + return INVALID_HANDLE_VALUE; |
| + } |
| RtlInitUnicodeStringFunction init_unicode_string = |
| reinterpret_cast<RtlInitUnicodeStringFunction>( |