8#define TEST_PROCESS_PROTECTION_INFORMATION ((PROCESSINFOCLASS)61)
12#define TEST_WIN32_PROTECTION_LEVEL_INFO ((PROCESSINFOCLASS)7)
15 PROCESSINFOCLASS ProcessInformationClass, PVOID ProcessInformation, ULONG ProcessInformationLength);
17static void SetInformation(HANDLE process, PROCESSINFOCLASS informationClass, PVOID information, ULONG length) {
22static void SetProtection(HANDLE process) {
23 UCHAR protection = 0x62;
27static const std::vector<HookTestCase> g_Cases = {
29 "Protection set on current process (pseudo-handle)",
31 SetProtection(GetCurrentProcess());
33 {
"NtSetInformationProcess: attempt to set the protection of the current process, status 0xc*" },
36 "Protection set on current process (real handle to self)",
38 HANDLE self = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());
42 {
"NtSetInformationProcess: attempt to set the protection of the current process, status 0xc*" },
45 "Protection set on remote process",
47 SetProtection(context.RemoteProcess());
49 {
"NtSetInformationProcess: attempt to set the protection of the remote process, status 0xc*" },
52 "Protection set through a handle without PROCESS_SET_INFORMATION",
54 HANDLE remote = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, GetProcessId(context.RemoteProcess()));
55 SetProtection(remote);
58 {
"NtSetInformationProcess: attempt to set the protection of the remote process, status 0xc*" },
61 "Other information class that succeeds is not reported",
64 SetProcessPriorityBoost(GetCurrentProcess(), FALSE);
69 "Win32 ProcessProtectionLevelInfo value (native ProcessDebugPort) is not reported",
78int main(
int argc,
char** argv) {
79 return RunHookTests(argc, argv,
"NtSetInformationProcess", g_Cases);
int main()
Loads the hook DLL for this architecture from bin/<config>, one directory above the tests folder this...
Resources shared by the cases of one test run, created in the child process. The remote processes are...
T NtdllFunction(const char *name)
Looks up an ntdll export. Calls through the result go through the hooks, because the hooks patch the ...
int RunHookTests(int argc, char **argv, const char *apiName, const std::vector< HookTestCase > &cases)
Runs the cases and prints a PASS/FAIL line for each. Call from main.