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

Side by Side Diff: base/vista_utils.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months 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
« no previous file with comments | « base/utils_unittest.cc ('k') | base/vista_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
(Empty)
1 // Copyright 2006-2009 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15
16 #ifndef OMAHA_COMMON_VISTA_UTILS_H__
17 #define OMAHA_COMMON_VISTA_UTILS_H__
18
19 #include <windows.h>
20 #include <aclapi.h>
21 #include <sddl.h>
22 #include <userenv.h>
23 #include <atlstr.h>
24 #include <vector>
25 #include "base/basictypes.h"
26
27 namespace omaha {
28
29 // Constants.
30 const TCHAR* const kExplorer = _T("EXPLORER.EXE");
31 const TCHAR* const kIExplore = _T("IEXPLORE.EXE");
32
33 namespace vista {
34
35 // Returns true if the current process is running in 'protected mode'.
36 bool IsProcessProtected();
37
38 // Allows processes that run under protected mode access to a shared kernel
39 // object such as mapped memory.
40 //
41 // Returns S_OK if successful, S_FALSE if not running on vista, or an
42 // error value.
43 HRESULT AllowProtectedProcessAccessToSharedObject(const TCHAR* name);
44
45 // Restarts IEUser process if we can. This is to allow for
46 // IEUser.exe to refresh it's ElevationPolicy cache. Due to a bug
47 // within IE7, IEUser.exe does not refresh it's cache unless it
48 // is restarted in the manner below. If the cache is not refreshed
49 // IEUser does not respect any new ElevationPolicies that a fresh
50 // setup program installs for an ActiveX control or BHO. This code
51 // is adapted from Toolbar.
52 HRESULT RestartIEUser();
53
54 // TODO(Omaha): Move these to a different utils file, since these are not
55 // Vista-specific.
56 // TODO(Omaha): rename for consistency with
57 // GetProcessPidsForActiveUserOrSession.
58 //
59 // Gets current user's explorer.exe pid. If that fails, gets the pid of any
60 // explorer.exe running in the current session.
61 HRESULT GetExplorerPidForCurrentUserOrSession(uint32* pid);
62
63 // Returns the TOKEN of the explorer process of any user that is logged in.
64 HRESULT GetExplorerTokenForLoggedInUser(HANDLE* token);
65
66 // Retrieves a primary token for one of the logged on users. The logged on
67 // user is either the current user or a user logged on in the same session as
68 // the current user. The caller must close the token handle.
69 // If this function is called before the dependent services of Remote
70 // Desktop Services have started, an RPC_S_INVALID_BINDING error code may
71 // be returned.
72 HRESULT GetLoggedOnUserToken(HANDLE* token);
73
74 // Get PIDs for the processes running with the specified executable, user_sid,
75 // and session_id. user_sid can be blank, in which case, the search will
76 // encompass all processes with the given name in session_id. The session
77 // always has to be a valid session, hence the name GetPidsInSession().
78 HRESULT GetPidsInSession(const TCHAR* exe_name,
79 const TCHAR* user_sid,
80 DWORD session_id,
81 std::vector<uint32>* pids);
82
83 // Get the handle of exe_name running under the active user or active session.
84 // If the call is made from the SYSTEM account, returns PIDs for exe_name
85 // in the currently active user session. If the call is made from a user account
86 // returns PIDs for that user, or if that cannot be found, in the current
87 // session.
88 HRESULT GetProcessPidsForActiveUserOrSession(const TCHAR* exe_name,
89 std::vector<uint32>* pids);
90
91 // Starts process with the token obtained from the specified process.
92 HRESULT StartProcessWithTokenOfProcess(uint32 pid,
93 const CString& command_line);
94
95 // Runs the command on behalf of the current user. Creates a fresh environment
96 // block based on the user's token.
97 HRESULT RunAsCurrentUser(const CString& command_line);
98
99 } // namespace vista
100
101 } // namespace omaha
102
103 #endif // OMAHA_COMMON_VISTA_UTILS_H__
104
OLDNEW
« no previous file with comments | « base/utils_unittest.cc ('k') | base/vista_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698