| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/process_thread_interception.h" | 5 #include "sandbox/win/src/process_thread_interception.h" |
| 6 | 6 |
| 7 #include "sandbox/win/src/crosscall_client.h" | 7 #include "sandbox/win/src/crosscall_client.h" |
| 8 #include "sandbox/win/src/ipc_tags.h" | 8 #include "sandbox/win/src/ipc_tags.h" |
| 9 #include "sandbox/win/src/policy_params.h" | 9 #include "sandbox/win/src/policy_params.h" |
| 10 #include "sandbox/win/src/policy_target.h" | 10 #include "sandbox/win/src/policy_target.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 thread_attributes, inherit_handles, flags, | 272 thread_attributes, inherit_handles, flags, |
| 273 environment, current_directory, startup_info, | 273 environment, current_directory, startup_info, |
| 274 process_information)) { | 274 process_information)) { |
| 275 return TRUE; | 275 return TRUE; |
| 276 } | 276 } |
| 277 | 277 |
| 278 // We don't trust that the IPC can work this early. | 278 // We don't trust that the IPC can work this early. |
| 279 if (!SandboxFactory::GetTargetServices()->GetState()->InitCalled()) | 279 if (!SandboxFactory::GetTargetServices()->GetState()->InitCalled()) |
| 280 return FALSE; | 280 return FALSE; |
| 281 | 281 |
| 282 // Don't call GetLastError before InitCalled() succeeds because kernel32 may |
| 283 // not be mapped yet. |
| 282 DWORD original_error = ::GetLastError(); | 284 DWORD original_error = ::GetLastError(); |
| 283 | 285 |
| 284 do { | 286 do { |
| 285 if (!ValidParameter(process_information, sizeof(PROCESS_INFORMATION), | 287 if (!ValidParameter(process_information, sizeof(PROCESS_INFORMATION), |
| 286 WRITE)) | 288 WRITE)) |
| 287 break; | 289 break; |
| 288 | 290 |
| 289 void* memory = GetGlobalIPCMemory(); | 291 void* memory = GetGlobalIPCMemory(); |
| 290 if (NULL == memory) | 292 if (NULL == memory) |
| 291 break; | 293 break; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 thread_attributes, inherit_handles, flags, | 333 thread_attributes, inherit_handles, flags, |
| 332 environment, current_directory, startup_info, | 334 environment, current_directory, startup_info, |
| 333 process_information)) { | 335 process_information)) { |
| 334 return TRUE; | 336 return TRUE; |
| 335 } | 337 } |
| 336 | 338 |
| 337 // We don't trust that the IPC can work this early. | 339 // We don't trust that the IPC can work this early. |
| 338 if (!SandboxFactory::GetTargetServices()->GetState()->InitCalled()) | 340 if (!SandboxFactory::GetTargetServices()->GetState()->InitCalled()) |
| 339 return FALSE; | 341 return FALSE; |
| 340 | 342 |
| 343 // Don't call GetLastError before InitCalled() succeeds because kernel32 may |
| 344 // not be mapped yet. |
| 341 DWORD original_error = ::GetLastError(); | 345 DWORD original_error = ::GetLastError(); |
| 342 | 346 |
| 343 do { | 347 do { |
| 344 if (!ValidParameter(process_information, sizeof(PROCESS_INFORMATION), | 348 if (!ValidParameter(process_information, sizeof(PROCESS_INFORMATION), |
| 345 WRITE)) | 349 WRITE)) |
| 346 break; | 350 break; |
| 347 | 351 |
| 348 void* memory = GetGlobalIPCMemory(); | 352 void* memory = GetGlobalIPCMemory(); |
| 349 if (NULL == memory) | 353 if (NULL == memory) |
| 350 break; | 354 break; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 return FALSE; | 399 return FALSE; |
| 396 | 400 |
| 397 return TRUE; | 401 return TRUE; |
| 398 } while (false); | 402 } while (false); |
| 399 | 403 |
| 400 ::SetLastError(original_error); | 404 ::SetLastError(original_error); |
| 401 return FALSE; | 405 return FALSE; |
| 402 } | 406 } |
| 403 | 407 |
| 404 } // namespace sandbox | 408 } // namespace sandbox |
| OLD | NEW |