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

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

Issue 42013: Slight code change to make some global variables const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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 | « net/url_request/url_request_job_tracker.cc ('k') | sandbox/src/service_resolver.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-2008 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 <malloc.h> 5 #include <malloc.h>
6 #include "sandbox/sandbox_poc/pocdll/exports.h" 6 #include "sandbox/sandbox_poc/pocdll/exports.h"
7 #include "sandbox/sandbox_poc/pocdll/utils.h" 7 #include "sandbox/sandbox_poc/pocdll/utils.h"
8 8
9 // This file contains the tests used to verify if it's possible to DOS or crash 9 // This file contains the tests used to verify if it's possible to DOS or crash
10 // the machine. All tests that can impact the stability of the machine should 10 // the machine. All tests that can impact the stability of the machine should
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 events, mutexes + jobs + events); 165 events, mutexes + jobs + events);
166 } 166 }
167 167
168 BOOL CALLBACK EnumWindowCallback(HWND hwnd, LPARAM output) { 168 BOOL CALLBACK EnumWindowCallback(HWND hwnd, LPARAM output) {
169 DWORD pid; 169 DWORD pid;
170 ::GetWindowThreadProcessId(hwnd, &pid); 170 ::GetWindowThreadProcessId(hwnd, &pid);
171 if (pid != ::GetCurrentProcessId()) { 171 if (pid != ::GetCurrentProcessId()) {
172 wchar_t window_title[100 + 1] = {0}; 172 wchar_t window_title[100 + 1] = {0};
173 ::GetWindowText(hwnd, window_title, 100); 173 ::GetWindowText(hwnd, window_title, 100);
174 fprintf(reinterpret_cast<FILE*>(output), 174 fprintf(reinterpret_cast<FILE*>(output),
175 "[GRANTED] Found window 0x%p with title %S\r\n", hwnd, window_title) ; 175 "[GRANTED] Found window 0x%p with title %S\r\n",
176 hwnd,
177 window_title);
176 ::CloseWindow(hwnd); 178 ::CloseWindow(hwnd);
177 } 179 }
178 180
179 return TRUE; 181 return TRUE;
180 } 182 }
181 183
182 // Enumerates all the windows on the system and call the function to try to 184 // Enumerates all the windows on the system and call the function to try to
183 // close them. The goal of this function is to try to kill the system by 185 // close them. The goal of this function is to try to kill the system by
184 // closing all windows. 186 // closing all windows.
185 // "output" is the stream used for logging. 187 // "output" is the stream used for logging.
186 void POCDLL_API TestCloseHWND(HANDLE log) { 188 void POCDLL_API TestCloseHWND(HANDLE log) {
187 HandleToFile handle2file; 189 HandleToFile handle2file;
188 FILE *output = handle2file.Translate(log, "w"); 190 FILE *output = handle2file.Translate(log, "w");
189 191
190 ::EnumWindows(EnumWindowCallback, PtrToLong(output)); 192 ::EnumWindows(EnumWindowCallback, PtrToLong(output));
191 // TODO(nsylvain): find a way to know when the enum is finished 193 // TODO(nsylvain): find a way to know when the enum is finished
192 // before returning. 194 // before returning.
193 ::Sleep(3000); 195 ::Sleep(3000);
194 } 196 }
195 197
OLDNEW
« no previous file with comments | « net/url_request/url_request_job_tracker.cc ('k') | sandbox/src/service_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698