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

Side by Side Diff: sandbox/sandbox_poc/sandbox.cc

Issue 1168002: Fix the POC and some of unit tests to be build and... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « sandbox/sandbox_poc/pocdll/handles.cc ('k') | sandbox/src/policy_target_test.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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 #include <windows.h> 5 #include <windows.h>
6 #include <tchar.h> 6 #include <tchar.h>
7 #include <shellapi.h> 7 #include <shellapi.h>
8 #include "sandbox/sandbox_poc/sandbox.h" 8 #include "sandbox/sandbox_poc/sandbox.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "sandbox/sandbox_poc/main_ui_window.h" 10 #include "sandbox/sandbox_poc/main_ui_window.h"
11 #include "sandbox/src/sandbox.h" 11 #include "sandbox/src/sandbox.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 FILE_SHARE_READ | FILE_SHARE_WRITE, 141 FILE_SHARE_READ | FILE_SHARE_WRITE,
142 NULL, // Default security attributes. 142 NULL, // Default security attributes.
143 CREATE_ALWAYS, 143 CREATE_ALWAYS,
144 FILE_ATTRIBUTE_NORMAL, 144 FILE_ATTRIBUTE_NORMAL,
145 NULL); // No template 145 NULL); // No template
146 146
147 if (INVALID_HANDLE_VALUE == pipe) { 147 if (INVALID_HANDLE_VALUE == pipe) {
148 return -4; 148 return -4;
149 } 149 }
150 150
151 // Initialization is finished, so we can enter lock-down mode
152 target_service->LowerToken();
153
154 // We now know what we should load, so load it 151 // We now know what we should load, so load it
155 HMODULE dll_module = ::LoadLibraryA(dll_name.c_str()); 152 HMODULE dll_module = ::LoadLibraryA(dll_name.c_str());
156 if (dll_module == NULL) { 153 if (dll_module == NULL) {
157 // TODO(finnur): write the failure to the log file 154 // TODO(finnur): write the failure to the log file
158 return -5; 155 return -5;
159 } 156 }
160 157
158 // Initialization is finished, so we can enter lock-down mode
159 target_service->LowerToken();
160
161 lpfnInit init_function = 161 lpfnInit init_function =
162 (lpfnInit) ::GetProcAddress(dll_module, entry_point.c_str()); 162 (lpfnInit) ::GetProcAddress(dll_module, entry_point.c_str());
163 163
164 if (!init_function) { 164 if (!init_function) {
165 // TODO(finnur): write the failure to the log file 165 // TODO(finnur): write the failure to the log file
166 ::FreeLibrary(dll_module); 166 ::FreeLibrary(dll_module);
167 CloseHandle(pipe); 167 CloseHandle(pipe);
168 return -6; 168 return -6;
169 } 169 }
170 170
171 // Transfer control to the entry point in the DLL requested 171 // Transfer control to the entry point in the DLL requested
172 init_function(pipe); 172 init_function(pipe);
173 173
174 CloseHandle(pipe); 174 CloseHandle(pipe);
175 Sleep(1000); // Give a change to the debug output to arrive before the 175 Sleep(1000); // Give a change to the debug output to arrive before the
176 // end of the process 176 // end of the process
177 177
178 ::FreeLibrary(dll_module); 178 ::FreeLibrary(dll_module);
179 } 179 }
180 180
181 return 0; 181 return 0;
182 } 182 }
OLDNEW
« no previous file with comments | « sandbox/sandbox_poc/pocdll/handles.cc ('k') | sandbox/src/policy_target_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698