OLD | NEW |
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 <windows.h> | 5 #include <windows.h> |
6 #include <Tlhelp32.h> | 6 #include <Tlhelp32.h> |
7 #include "sandbox/sandbox_poc/pocdll/exports.h" | 7 #include "sandbox/win/sandbox_poc/pocdll/exports.h" |
8 #include "sandbox/sandbox_poc/pocdll/utils.h" | 8 #include "sandbox/win/sandbox_poc/pocdll/utils.h" |
9 | 9 |
10 // This file contains the tests used to verify the security of threads and | 10 // This file contains the tests used to verify the security of threads and |
11 // processes. | 11 // processes. |
12 | 12 |
13 void POCDLL_API TestProcesses(HANDLE log) { | 13 void POCDLL_API TestProcesses(HANDLE log) { |
14 HandleToFile handle2file; | 14 HandleToFile handle2file; |
15 FILE *output = handle2file.Translate(log, "w"); | 15 FILE *output = handle2file.Translate(log, "w"); |
16 | 16 |
17 HANDLE snapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL); | 17 HANDLE snapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL); |
18 if (INVALID_HANDLE_VALUE == snapshot) { | 18 if (INVALID_HANDLE_VALUE == snapshot) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 if (ERROR_NO_MORE_FILES != err_code) { | 93 if (ERROR_NO_MORE_FILES != err_code) { |
94 fprintf(output, "[ERROR] Error %d while looking at the processes on " | 94 fprintf(output, "[ERROR] Error %d while looking at the processes on " |
95 "the system\r\n", err_code); | 95 "the system\r\n", err_code); |
96 } | 96 } |
97 | 97 |
98 fprintf(output, "[INFO] Found %d threads. Able to open %d of them\r\n", | 98 fprintf(output, "[INFO] Found %d threads. Able to open %d of them\r\n", |
99 nb_success + nb_failure, nb_success); | 99 nb_success + nb_failure, nb_success); |
100 | 100 |
101 ::CloseHandle(snapshot); | 101 ::CloseHandle(snapshot); |
102 } | 102 } |
OLD | NEW |