diff options
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/src/win_utils.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sandbox/src/win_utils.cc b/sandbox/src/win_utils.cc index aa13bda..ace9127 100644 --- a/sandbox/src/win_utils.cc +++ b/sandbox/src/win_utils.cc @@ -213,5 +213,26 @@ void ResolveNTFunctionPtr(const char* name, void* ptr) { *function_ptr = ::GetProcAddress(ntdll, name); (*function_map)[name] = *function_ptr; - DCHECK(*function_ptr); + DCHECK(*function_ptr) << "Failed to resolve NTDLL function"; + + if (!*function_ptr) { + // If we return NULL, we are going to crash. Unfortunately, this happens. + // See bug 11789. + // Maybe our module handle is not valid anymore? + HMODULE ntdll2 = ::GetModuleHandle(sandbox::kNtdllName); + *function_ptr = ::GetProcAddress(ntdll2, name); + (*function_map)[name] = *function_ptr; + + // TODO(nsylvain): Remove this check after we are done troubleshooting. + CHECK(ntdll2) << "Fatal error: NTLL module is NULL"; + CHECK(*function_ptr) << "Fatal error: Failed to resolve NTDLL function"; + + // If we are here, it means that getting the new module handle worked. This + // is not really expected. We want to receive some reports from users, so + // we will crash anyway. + // TODO(nsylvain): Remove this check after we are done troubleshooting. + CHECK(ntdll) << "Fatal Error: NTDLL module was NULL."; + CHECK(ntdll == ntdll2) << "Fatal Error: NTDLL module has been moved."; + CHECK(false) << "Fatal Error: GetProcAddress Inconsistency"; + } } |