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