security/sandbox/win/src/target_services.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial