| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "sandbox/win/src/registry_interception.h" | 5 #include "sandbox/win/src/registry_interception.h" |
| 6 | 6 |
| 7 #include <stdint.h> | |
| 8 | |
| 9 #include "sandbox/win/src/crosscall_client.h" | 7 #include "sandbox/win/src/crosscall_client.h" |
| 10 #include "sandbox/win/src/ipc_tags.h" | 8 #include "sandbox/win/src/ipc_tags.h" |
| 11 #include "sandbox/win/src/policy_params.h" | 9 #include "sandbox/win/src/policy_params.h" |
| 12 #include "sandbox/win/src/policy_target.h" | 10 #include "sandbox/win/src/policy_target.h" |
| 13 #include "sandbox/win/src/sandbox_factory.h" | 11 #include "sandbox/win/src/sandbox_factory.h" |
| 14 #include "sandbox/win/src/sandbox_nt_util.h" | 12 #include "sandbox/win/src/sandbox_nt_util.h" |
| 15 #include "sandbox/win/src/sharedmem_ipc_client.h" | 13 #include "sandbox/win/src/sharedmem_ipc_client.h" |
| 16 #include "sandbox/win/src/target_services.h" | 14 #include "sandbox/win/src/target_services.h" |
| 17 | 15 |
| 18 namespace sandbox { | 16 namespace sandbox { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 46 | 44 |
| 47 // We don't support creating link keys, volatile keys and backup/restore. | 45 // We don't support creating link keys, volatile keys and backup/restore. |
| 48 if (create_options) | 46 if (create_options) |
| 49 break; | 47 break; |
| 50 | 48 |
| 51 void* memory = GetGlobalIPCMemory(); | 49 void* memory = GetGlobalIPCMemory(); |
| 52 if (NULL == memory) | 50 if (NULL == memory) |
| 53 break; | 51 break; |
| 54 | 52 |
| 55 wchar_t* name; | 53 wchar_t* name; |
| 56 uint32_t attributes = 0; | 54 uint32 attributes = 0; |
| 57 HANDLE root_directory = 0; | 55 HANDLE root_directory = 0; |
| 58 NTSTATUS ret = AllocAndCopyName(object_attributes, &name, &attributes, | 56 NTSTATUS ret = AllocAndCopyName(object_attributes, &name, &attributes, |
| 59 &root_directory); | 57 &root_directory); |
| 60 if (!NT_SUCCESS(ret) || NULL == name) | 58 if (!NT_SUCCESS(ret) || NULL == name) |
| 61 break; | 59 break; |
| 62 | 60 |
| 63 uint32_t desired_access_uint32 = desired_access; | 61 uint32 desired_access_uint32 = desired_access; |
| 64 CountedParameterSet<OpenKey> params; | 62 CountedParameterSet<OpenKey> params; |
| 65 params[OpenKey::ACCESS] = ParamPickerMake(desired_access_uint32); | 63 params[OpenKey::ACCESS] = ParamPickerMake(desired_access_uint32); |
| 66 | 64 |
| 67 wchar_t* full_name = NULL; | 65 wchar_t* full_name = NULL; |
| 68 | 66 |
| 69 if (root_directory) { | 67 if (root_directory) { |
| 70 ret = sandbox::AllocAndGetFullPath(root_directory, name, &full_name); | 68 ret = sandbox::AllocAndGetFullPath(root_directory, name, &full_name); |
| 71 if (!NT_SUCCESS(ret) || NULL == full_name) | 69 if (!NT_SUCCESS(ret) || NULL == full_name) |
| 72 break; | 70 break; |
| 73 params[OpenKey::NAME] = ParamPickerMake(full_name); | 71 params[OpenKey::NAME] = ParamPickerMake(full_name); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 126 |
| 129 do { | 127 do { |
| 130 if (!ValidParameter(key, sizeof(HANDLE), WRITE)) | 128 if (!ValidParameter(key, sizeof(HANDLE), WRITE)) |
| 131 break; | 129 break; |
| 132 | 130 |
| 133 void* memory = GetGlobalIPCMemory(); | 131 void* memory = GetGlobalIPCMemory(); |
| 134 if (NULL == memory) | 132 if (NULL == memory) |
| 135 break; | 133 break; |
| 136 | 134 |
| 137 wchar_t* name; | 135 wchar_t* name; |
| 138 uint32_t attributes; | 136 uint32 attributes; |
| 139 HANDLE root_directory; | 137 HANDLE root_directory; |
| 140 NTSTATUS ret = AllocAndCopyName(object_attributes, &name, &attributes, | 138 NTSTATUS ret = AllocAndCopyName(object_attributes, &name, &attributes, |
| 141 &root_directory); | 139 &root_directory); |
| 142 if (!NT_SUCCESS(ret) || NULL == name) | 140 if (!NT_SUCCESS(ret) || NULL == name) |
| 143 break; | 141 break; |
| 144 | 142 |
| 145 uint32_t desired_access_uint32 = desired_access; | 143 uint32 desired_access_uint32 = desired_access; |
| 146 CountedParameterSet<OpenKey> params; | 144 CountedParameterSet<OpenKey> params; |
| 147 params[OpenKey::ACCESS] = ParamPickerMake(desired_access_uint32); | 145 params[OpenKey::ACCESS] = ParamPickerMake(desired_access_uint32); |
| 148 | 146 |
| 149 wchar_t* full_name = NULL; | 147 wchar_t* full_name = NULL; |
| 150 | 148 |
| 151 if (root_directory) { | 149 if (root_directory) { |
| 152 ret = sandbox::AllocAndGetFullPath(root_directory, name, &full_name); | 150 ret = sandbox::AllocAndGetFullPath(root_directory, name, &full_name); |
| 153 if (!NT_SUCCESS(ret) || NULL == full_name) | 151 if (!NT_SUCCESS(ret) || NULL == full_name) |
| 154 break; | 152 break; |
| 155 params[OpenKey::NAME] = ParamPickerMake(full_name); | 153 params[OpenKey::NAME] = ParamPickerMake(full_name); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // We do not support open_options at this time. The 2 current known values | 215 // We do not support open_options at this time. The 2 current known values |
| 218 // are REG_OPTION_CREATE_LINK, to open a symbolic link, and | 216 // are REG_OPTION_CREATE_LINK, to open a symbolic link, and |
| 219 // REG_OPTION_BACKUP_RESTORE to open the key with special privileges. | 217 // REG_OPTION_BACKUP_RESTORE to open the key with special privileges. |
| 220 if (NT_SUCCESS(status) || open_options != 0) | 218 if (NT_SUCCESS(status) || open_options != 0) |
| 221 return status; | 219 return status; |
| 222 | 220 |
| 223 return CommonNtOpenKey(status, key, desired_access, object_attributes); | 221 return CommonNtOpenKey(status, key, desired_access, object_attributes); |
| 224 } | 222 } |
| 225 | 223 |
| 226 } // namespace sandbox | 224 } // namespace sandbox |
| OLD | NEW |