| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SANDBOX_SRC_TARGET_SERVICES_H__ | |
| 6 #define SANDBOX_SRC_TARGET_SERVICES_H__ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "sandbox/win/src/sandbox.h" | |
| 10 #include "sandbox/win/src/win_utils.h" | |
| 11 | |
| 12 namespace sandbox { | |
| 13 | |
| 14 class ProcessState { | |
| 15 public: | |
| 16 ProcessState(); | |
| 17 // Returns true if kernel32.dll has been loaded. | |
| 18 bool IsKernel32Loaded() const; | |
| 19 // Returns true if main has been called. | |
| 20 bool InitCalled() const; | |
| 21 // Returns true if LowerToken has been called. | |
| 22 bool RevertedToSelf() const; | |
| 23 // Returns true if Csrss is connected. | |
| 24 bool IsCsrssConnected() const; | |
| 25 // Set the current state. | |
| 26 void SetKernel32Loaded(); | |
| 27 void SetInitCalled(); | |
| 28 void SetRevertedToSelf(); | |
| 29 void SetCsrssConnected(bool csrss_connected); | |
| 30 | |
| 31 private: | |
| 32 int process_state_; | |
| 33 bool csrss_connected_; | |
| 34 DISALLOW_COPY_AND_ASSIGN(ProcessState); | |
| 35 }; | |
| 36 | |
| 37 // This class is an implementation of the TargetServices. | |
| 38 // Look in the documentation of sandbox::TargetServices for more info. | |
| 39 // Do NOT add a destructor to this class without changing the implementation of | |
| 40 // the factory method. | |
| 41 class TargetServicesBase : public TargetServices { | |
| 42 public: | |
| 43 TargetServicesBase(); | |
| 44 | |
| 45 // Public interface of TargetServices. | |
| 46 ResultCode Init() override; | |
| 47 void LowerToken() override; | |
| 48 ProcessState* GetState() override; | |
| 49 ResultCode DuplicateHandle(HANDLE source_handle, | |
| 50 DWORD target_process_id, | |
| 51 HANDLE* target_handle, | |
| 52 DWORD desired_access, | |
| 53 DWORD options) override; | |
| 54 | |
| 55 // Factory method. | |
| 56 static TargetServicesBase* GetInstance(); | |
| 57 | |
| 58 // Sends a simple IPC Message that has a well-known answer. Returns true | |
| 59 // if the IPC was successful and false otherwise. There are 2 versions of | |
| 60 // this test: 1 and 2. The first one send a simple message while the | |
| 61 // second one send a message with an in/out param. | |
| 62 bool TestIPCPing(int version); | |
| 63 | |
| 64 private: | |
| 65 ProcessState process_state_; | |
| 66 DISALLOW_COPY_AND_ASSIGN(TargetServicesBase); | |
| 67 }; | |
| 68 | |
| 69 } // namespace sandbox | |
| 70 | |
| 71 #endif // SANDBOX_SRC_TARGET_SERVICES_H__ | |
| OLD | NEW |