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 3 // found in the LICENSE file. 4 5 #ifndef SANDBOX_SANDBOX_POC_POCDLL_EXPORTS_H__ 6 #define SANDBOX_SANDBOX_POC_POCDLL_EXPORTS_H__ 7 8 #include <windows.h> 9 10 #ifdef POCDLL_EXPORTS 11 #define POCDLL_API __declspec(dllexport) __cdecl 12 #else 13 #define POCDLL_API __declspec(dllimport) __cdecl 14 #endif 15 16 extern "C" { 17 // Tries to open several known system path and outputs 18 // the result. 19 // "log" is the handle of the log file. 20 void POCDLL_API TestFileSystem(HANDLE log); 21 22 // Tries to find all handles open in the process and prints the name of the 23 // resource references by the handle along with the access right. 24 // "log" is the handle of the log file. 25 void POCDLL_API TestGetHandle(HANDLE log); 26 27 // Creates a lot of threads until it cannot create more. The goal of this 28 // function is to determine if it's possible to crash the machine when we 29 // flood the machine with new threads 30 // "log" is the handle of the log file. 31 void POCDLL_API TestThreadBombing(HANDLE log); 32 33 // Takes all cpu of the machine. For each processor on the machine we assign 34 // a thread. This thread will compute a mathematical expression over and over 35 // to take all cpu. 36 // "log" is the handle of the log file. 37 // Note: here we are using the affinity to find out how many processors are on 38 // the machine and to force a thread to run only on a given processor. 39 void POCDLL_API TestTakeAllCpu(HANDLE log); 40 41 // Creates memory in the heap until it fails 5 times in a row and prints the 42 // amount of memory created. This function is used to find out if it's possible 43 // to take all memory on the machine and crash the system. 44 // "log" is the handle of the log file. 45 void POCDLL_API TestUseAllMemory(HANDLE log); 46 47 // Creates millions of kernel objects. This function is used to find out if it's 48 // possible to crash the system if we create too many kernel objects and if we 49 // hold too many handles. All those kernel objects are unnamed. 50 // "log" is the handle of the log file. 51 void POCDLL_API TestCreateObjects(HANDLE log); 52 53 // Receives a hwnd and tries to close it. This is the callback for EnumWindows. 54 // It will be called for each window(hwnd) on the system. 55 // "log" is the handle of the log file. 56 // Always returns TRUE to tell the system that we want to continue the 57 // enumeration. 58 void POCDLL_API TestCloseHWND(HANDLE log); 59 60 // Tries to listen on the port 88. 61 // "log" is the handle of the log file. 62 void POCDLL_API TestNetworkListen(HANDLE log); 63 64 // Lists all processes on the system and tries to open them 65 // "log" is the handle of the log file. 66 void POCDLL_API TestProcesses(HANDLE log); 67 68 // Lists all threads on the system and tries to open them 69 // "log" is the handle of the log file. 70 void POCDLL_API TestThreads(HANDLE log); 71 72 // Tries to open some known system registry key and outputs the result. 73 // "log" is the handle of the log file. 74 void POCDLL_API TestRegistry(HANDLE log); 75 76 // Records all keystrokes typed for 15 seconds and then display them. 77 // "log" is the handle of the log file. 78 void POCDLL_API TestSpyKeys(HANDLE log); 79 80 // Tries to read pixels on the monitor and output if the operation 81 // failes or succeeded. 82 // "log" is the handle of the log file. 83 void POCDLL_API TestSpyScreen(HANDLE log); 84 85 // Runs all tests except those who are invasive 86 void POCDLL_API Run(HANDLE log); 87 } 88 89 #endif // SANDBOX_SANDBOX_POC_POCDLL_EXPORTS_H__ 90