Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Side by Side Diff: chrome_frame/module_utils.h

Issue 5012001: Chrome Frame: Add explicit object security attributes to the Chrome Frame ver... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/shared_memory_win.cc ('k') | chrome_frame/module_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_FRAME_MODULE_UTILS_H_ 5 #ifndef CHROME_FRAME_MODULE_UTILS_H_
6 #define CHROME_FRAME_MODULE_UTILS_H_ 6 #define CHROME_FRAME_MODULE_UTILS_H_
7 7
8 #include <ObjBase.h> 8 #include <ObjBase.h>
9 #include <windows.h> 9 #include <windows.h>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "base/shared_memory.h" 13 #include "base/shared_memory.h"
14 #include "base/singleton.h" 14 #include "base/singleton.h"
15 15
16 // Forward 16 // Forward
17 namespace ATL {
18 class CSecurityAttributes;
19 }
17 class Version; 20 class Version;
18 21
19 // A singleton class that provides a facility to register the version of the 22 // A singleton class that provides a facility to register the version of the
20 // current module as the only version that should be loaded system-wide. If 23 // current module as the only version that should be loaded system-wide. If
21 // this module is not the first instance loaded in the system, then the version 24 // this module is not the first instance loaded in the system, then the version
22 // that loaded first will be delegated to. This makes a few assumptions: 25 // that loaded first will be delegated to. This makes a few assumptions:
23 // 1) That different versions of the module this code is in reside in 26 // 1) That different versions of the module this code is in reside in
24 // neighbouring versioned directories, e.g. 27 // neighbouring versioned directories, e.g.
25 // C:\foo\bar\1.2.3.4\my_module.dll 28 // C:\foo\bar\1.2.3.4\my_module.dll
26 // C:\foo\bar\1.2.3.5\my_module.dll 29 // C:\foo\bar\1.2.3.5\my_module.dll
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Returns the version of the current module or NULL if none can be found. 63 // Returns the version of the current module or NULL if none can be found.
61 // The caller must free the Version. 64 // The caller must free the Version.
62 virtual Version* GetCurrentModuleVersion(); 65 virtual Version* GetCurrentModuleVersion();
63 66
64 // Attempt to load the specified version dll. Finds it by walking up one 67 // Attempt to load the specified version dll. Finds it by walking up one
65 // directory from our current module's location, then appending the newly 68 // directory from our current module's location, then appending the newly
66 // found version number. The Version class in base will have ensured that we 69 // found version number. The Version class in base will have ensured that we
67 // actually have a valid version and not e.g. ..\..\..\..\MyEvilFolder\. 70 // actually have a valid version and not e.g. ..\..\..\..\MyEvilFolder\.
68 virtual HMODULE LoadVersionedModule(Version* version); 71 virtual HMODULE LoadVersionedModule(Version* version);
69 72
73 // Builds the necessary SECURITY_ATTRIBUTES to allow low integrity access
74 // to an object. Returns true on success, false otherwise.
75 virtual bool BuildSecurityAttributesForLock(
76 ATL::CSecurityAttributes* sec_attr);
77
78 // Attempts to change the permissions on the given file mapping to read only.
79 // Returns true on success, false otherwise.
80 virtual bool SetFileMappingToReadOnly(base::SharedMemoryHandle mapping);
81
70 // Shared memory segment that contains the version beacon. 82 // Shared memory segment that contains the version beacon.
71 scoped_ptr<base::SharedMemory> shared_memory_; 83 scoped_ptr<base::SharedMemory> shared_memory_;
72 84
73 // The current version of the DLL to be loaded. 85 // The current version of the DLL to be loaded.
74 scoped_ptr<Version> dll_version_; 86 scoped_ptr<Version> dll_version_;
75 87
76 // The handle to the first version of this module that was loaded. This 88 // The handle to the first version of this module that was loaded. This
77 // may refer to the current module, or another version of the same module 89 // may refer to the current module, or another version of the same module
78 // that we go and load. 90 // that we go and load.
79 HMODULE first_module_handle_; 91 HMODULE first_module_handle_;
80 92
81 // Used for tests to override the name of the shared memory segment. 93 // Used for tests to override the name of the shared memory segment.
82 std::string shared_memory_name_; 94 std::string shared_memory_name_;
83 95
84 friend class ModuleUtilsTest; 96 friend class ModuleUtilsTest;
85 97
86 DISALLOW_COPY_AND_ASSIGN(DllRedirector); 98 DISALLOW_COPY_AND_ASSIGN(DllRedirector);
87 }; 99 };
88 100
89 #endif // CHROME_FRAME_MODULE_UTILS_H_ 101 #endif // CHROME_FRAME_MODULE_UTILS_H_
OLDNEW
« no previous file with comments | « base/shared_memory_win.cc ('k') | chrome_frame/module_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698