diff options
author | jschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-27 20:56:11 +0000 |
---|---|---|
committer | jschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-27 20:56:11 +0000 |
commit | b0c7f15f03aba8cbf5d39b97dcee7b081fe3a412 (patch) | |
tree | 1d1879923c49f06c29bf53350c5a228156784d28 /sandbox | |
parent | b22ca5d0863eeca193126af1d47d560efd292955 (diff) | |
download | chromium_src-b0c7f15f03aba8cbf5d39b97dcee7b081fe3a412.zip chromium_src-b0c7f15f03aba8cbf5d39b97dcee7b081fe3a412.tar.gz chromium_src-b0c7f15f03aba8cbf5d39b97dcee7b081fe3a412.tar.bz2 |
Minor change to use ResolveNTFunctionPtr rather than calling GetProcAddress directly.
BUG=None.
TEST=None.
Review URL: http://codereview.chromium.org/7276003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90638 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/src/handle_table.cc | 28 | ||||
-rw-r--r-- | sandbox/src/handle_table.h | 1 |
2 files changed, 7 insertions, 22 deletions
diff --git a/sandbox/src/handle_table.cc b/sandbox/src/handle_table.cc index be84fa3..c7fcf0a 100644 --- a/sandbox/src/handle_table.cc +++ b/sandbox/src/handle_table.cc @@ -8,11 +8,10 @@ #include <cstdlib> #include "base/memory/scoped_ptr.h" +#include "sandbox/src/win_utils.h" namespace { -const wchar_t kNtdllDllName[] = L"ntdll.dll"; - bool CompareHandleEntries(const SYSTEM_HANDLE_INFORMATION& a, const SYSTEM_HANDLE_INFORMATION& b) { return a.ProcessId < b.ProcessId; @@ -22,7 +21,6 @@ bool CompareHandleEntries(const SYSTEM_HANDLE_INFORMATION& a, namespace sandbox { -HMODULE HandleTable::ntdll_ = 0; const char16* HandleTable::kTypeProcess = L"Process"; const char16* HandleTable::kTypeThread = L"Thread"; const char16* HandleTable::kTypeFile = L"File"; @@ -41,15 +39,9 @@ const char16* HandleTable::kTypeFileMap = L"FileMap"; const char16* HandleTable::kTypeAlpcPort = L"ALPC Port"; HandleTable::HandleTable() { - static NtQuerySystemInformation QuerySystemInformation; - if (!QuerySystemInformation) { - if (!ntdll_ && !(ntdll_ = ::GetModuleHandle(kNtdllDllName))) - return; - QuerySystemInformation = reinterpret_cast<NtQuerySystemInformation>( - ::GetProcAddress(ntdll_, "NtQuerySystemInformation")); - if (!QuerySystemInformation) - return; - } + static NtQuerySystemInformation QuerySystemInformation = NULL; + if (!QuerySystemInformation) + ResolveNTFunctionPtr("NtQuerySystemInformation", &QuerySystemInformation); ULONG size = 0x15000; NTSTATUS result; @@ -92,15 +84,9 @@ HandleTable::HandleEntry::HandleEntry( } void HandleTable::HandleEntry::UpdateInfo(UpdateType flag) { - static NtQueryObject QueryObject; - if (!QueryObject) { - if (!ntdll_ && !(ntdll_ = ::GetModuleHandle(kNtdllDllName))) - return; - QueryObject = reinterpret_cast<NtQueryObject>(::GetProcAddress(ntdll_, - "NtQueryObject")); - if (!QueryObject) - return; - } + static NtQueryObject QueryObject = NULL; + if (!QueryObject) + ResolveNTFunctionPtr("NtQueryObject", &QueryObject); NTSTATUS result; diff --git a/sandbox/src/handle_table.h b/sandbox/src/handle_table.h index 8d24524..9b1fc66 100644 --- a/sandbox/src/handle_table.h +++ b/sandbox/src/handle_table.h @@ -151,7 +151,6 @@ class HandleTable { } std::vector<BYTE> handle_info_buffer_; - static HMODULE ntdll_; DISALLOW_COPY_AND_ASSIGN(HandleTable); }; |