diff options
author | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-13 18:07:00 +0000 |
---|---|---|
committer | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-13 18:07:00 +0000 |
commit | 8869a5f5c945fd2ce67aea4107c700dda12d150f (patch) | |
tree | 43df9e9f9c6fafa9b373394d1f447a56809c59ce /sandbox/src/registry_interception.cc | |
parent | 91115469ab00e0c314cf547e91e8b473890a90d2 (diff) | |
download | chromium_src-8869a5f5c945fd2ce67aea4107c700dda12d150f.zip chromium_src-8869a5f5c945fd2ce67aea4107c700dda12d150f.tar.gz chromium_src-8869a5f5c945fd2ce67aea4107c700dda12d150f.tar.bz2 |
In windows 7 there is a new Reg call that we need to
hook. NtOpenKeyEx.
I don't know what the last parameter is. I suspect it's
a reserved flag for "options". (As in RegOpenKeyEx).
I do not handle the case where this unknown flag is non-zero.
The current unit tests covers this code.
bug:7611
Review URL: http://codereview.chromium.org/20287
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9762 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/src/registry_interception.cc')
-rw-r--r-- | sandbox/src/registry_interception.cc | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/sandbox/src/registry_interception.cc b/sandbox/src/registry_interception.cc index adbbf6e..c4a7bc9 100644 --- a/sandbox/src/registry_interception.cc +++ b/sandbox/src/registry_interception.cc @@ -88,14 +88,9 @@ NTSTATUS WINAPI TargetNtCreateKey(NtCreateKeyFunction orig_CreateKey, return status; } -NTSTATUS WINAPI TargetNtOpenKey(NtOpenKeyFunction orig_OpenKey, PHANDLE key, +NTSTATUS WINAPI CommonNtOpenKey(NTSTATUS status, PHANDLE key, ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes) { - // Check if the process can open it first. - NTSTATUS status = orig_OpenKey(key, desired_access, object_attributes); - if (NT_SUCCESS(status)) - return status; - // We don't trust that the IPC can work this early. if (!SandboxFactory::GetTargetServices()->GetState()->InitCalled()) return status; @@ -146,5 +141,33 @@ NTSTATUS WINAPI TargetNtOpenKey(NtOpenKeyFunction orig_OpenKey, PHANDLE key, return status; } +NTSTATUS WINAPI TargetNtOpenKey(NtOpenKeyFunction orig_OpenKey, PHANDLE key, + ACCESS_MASK desired_access, + POBJECT_ATTRIBUTES object_attributes) { + // Check if the process can open it first. + NTSTATUS status = orig_OpenKey(key, desired_access, object_attributes); + if (NT_SUCCESS(status)) + return status; + + return CommonNtOpenKey(status, key, desired_access, object_attributes); +} + +NTSTATUS WINAPI TargetNtOpenKeyEx(NtOpenKeyExFunction orig_OpenKeyEx, + PHANDLE key, ACCESS_MASK desired_access, + POBJECT_ATTRIBUTES object_attributes, + DWORD unknown) { + // Check if the process can open it first. + NTSTATUS status = orig_OpenKeyEx(key, desired_access, object_attributes, + unknown); + + // TODO(nsylvain): We don't know what the last parameter is. If it's not + // zero, we don't attempt to proxy the call. We need to find out what it is! + // See bug 7611 + if (NT_SUCCESS(status) || unknown != 0) + return status; + + return CommonNtOpenKey(status, key, desired_access, object_attributes); +} + } // namespace sandbox |