25#define WIN32_NO_STATUS
31#include "wine/rbtree.h"
33#ifndef STATUS_DEBUGGER_INACTIVE
34#define STATUS_DEBUGGER_INACTIVE ((NTSTATUS) 0xC0000354)
37#define child_ok (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_child_ok
142 ok(
ret && written ==
size,
"Error writing\n");
143 if (dbgtrace && dbgtrace[0])
146 ok(
ret && written ==
strlen(dbgtrace),
"Error writing\n");
151#define load_blackbox(a, b, c) _load_blackbox(__LINE__, (a), (b), (c))
171 ok(
read ==
size,
"wrong size for '%s': read=%ld\n", logfile,
read);
177 trace(
"debugger traces:>>>\n%s\n<<< Done.\n",
buf);
209 trace(
"child: crashing...\n");
289 return (
void *)
ctx->Eip;
290#elif defined(__x86_64__)
291 return (
void *)
ctx->Rip;
301#elif defined(__x86_64__)
306#define fetch_thread_context(a) fetch_thread_context_(__LINE__,a)
324#define set_thread_context(a,b) set_thread_context_(__LINE__,a,b)
332#define WAIT_EVENT_TIMEOUT 20000
333#define POLL_EVENT_TIMEOUT 200
335#define next_event(a,b) next_event_(__LINE__,a,b)
344 if (
ctx->process_cnt &&
ctx->ev.dwDebugEventCode != -1)
354 "WaitForDebugEvent failed, last error %ld.\n",
GetLastError());
355 ctx->ev.dwDebugEventCode = -1;
361 if (!
ctx->process_cnt)
ctx->pid =
ctx->ev.dwProcessId;
366 if (
ctx->ev.dwProcessId ==
ctx->pid)
break;
368 ok_(__FILE__,
line)(
ctx->process_cnt > 1,
"unexpected event pid\n");
371 switch (
ctx->ev.dwDebugEventCode)
375 ctx->image_base =
ctx->ev.u.CreateProcessInfo.lpBaseOfImage;
387 ok(
ctx->ev.u.LoadDll.lpBaseOfDll !=
ctx->image_base,
"process image reported as DLL load event\n");
400 return (ev >= 1 && ev <= 7) ? (1L
U << ev) : 0;
403#define next_event_filter(a, b,c) next_event_filter_(__LINE__, (a), (b), (c))
412#define wait_for_breakpoint(a) wait_for_breakpoint_(__LINE__,a)
420 ctx->ev.u.Exception.ExceptionRecord.ExceptionCode);
423#define check_thread_running(h) ok(_check_thread_suspend_count(h) == 0, "Expecting running thread\n")
424#define check_thread_suspended(h) ok(_check_thread_suspend_count(h) > 0, "Expecting suspended thread\n")
433 return suspend_count;
442 ctx->ev.dwDebugEventCode = -1;
448 prev_thread =
ctx->ev.u.CreateProcessInfo.hThread;
454 ok(
ctx->ev.u.LoadDll.lpBaseOfDll ==
ntdll,
"The first reported DLL is not ntdll.dll\n");
463 prev_thread =
ctx->ev.u.CreateThread.hThread;
475 ok(
ctx->ev.u.LoadDll.lpBaseOfDll !=
ntdll,
"ntdll.dll reported out of order\n");
477 ok(
ctx->dll_cnt > 2,
"dll_cnt = %d\n",
ctx->dll_cnt);
483 DWORD last_threads[5];
484 unsigned thd_idx = 0,
i;
493 last_threads[thd_idx++] =
ctx->ev.dwThreadId;
496 ok(thd_idx <=
ARRAY_SIZE(last_threads),
"too many threads created\n");
497 for (
i = 0;
i < thd_idx;
i++)
498 if (last_threads[
i] ==
ctx->ev.dwThreadId)
break;
499 ok(
i < thd_idx,
"unexpected thread\n");
503 ctx->ev.u.Exception.ExceptionRecord.ExceptionCode);
504 ok(
ctx->ev.u.Exception.ExceptionRecord.ExceptionAddress == pDbgBreakPoint,
"ExceptionAddress != DbgBreakPoint\n");
510 ctx->ev.dwDebugEventCode = -1;
518 ok(
ctx->ev.dwDebugEventCode == -1,
"dwDebugEventCode = %ld\n",
ctx->ev.dwDebugEventCode);
545 strcat(
buf,
"processing debug messages\n");
566 ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
576 strcat(
buf,
"waiting for the start signal...\n");
623 static BOOL skip_crash_and_debug =
FALSE;
635 if (skip_crash_and_debug)
637 win_skip(
"Skipping crash_and_debug\n");
644 skip_crash_and_debug =
TRUE;
645 skip(
"No write access to change the debugger\n");
654 sprintf(
cmd,
"%s debugger %s \"%s\" %%ld %%ld",
argv0, dbgtasks, dbglog);
662 trace(
"running %s...\n", dbgtasks);
673 trace(
"waiting for child exit...\n");
675#if defined(_WIN64) && defined(__MINGW32__)
678 if (skip_crash_and_debug)
684 win_skip(
"Giving up on child process\n");
688 ok(wait_code ==
WAIT_OBJECT_0,
"Timed out waiting for the child to crash\n");
691 if (
strstr(dbgtasks,
"code2"))
708 if (
strstr(dbgtasks,
"order"))
711 trace(
"waiting for the debugger...\n");
713#if defined(_WIN64) && defined(__MINGW32__)
716 if (skip_crash_and_debug)
719 win_skip(
"Giving up on debugger\n");
723 ok(wait_code ==
WAIT_OBJECT_0,
"Timed out waiting for the debugger\n");
725 ok(
load_blackbox(dbglog, &dbg_blackbox,
sizeof(dbg_blackbox)),
"failed to open: %s\n", dbglog);
727 ok(dbg_blackbox.
argc == 6,
"wrong debugger argument count: %d\n", dbg_blackbox.
argc);
728 ok(dbg_blackbox.
pid ==
info.dwProcessId,
"the child and debugged pids don't match: %ld != %ld\n",
info.dwProcessId, dbg_blackbox.
pid);
729 ok(dbg_blackbox.
debug_rc,
"debugger: SetEvent(debug_event) failed err=%ld\n", dbg_blackbox.
debug_err);
731 ok(dbg_blackbox.
nokill_rc,
"DebugSetProcessKillOnExit(FALSE) failed err=%ld\n", dbg_blackbox.
nokill_err);
732 ok(dbg_blackbox.
detach_rc,
"DebugActiveProcessStop(%ld) failed err=%ld\n", dbg_blackbox.
pid, dbg_blackbox.
detach_err);
733 ok(!dbg_blackbox.
failures,
"debugger reported %lu failures\n", dbg_blackbox.
failures);
762 trace(
"waiting for child exit...\n");
772 static const char* AeDebug=
"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug";
773 static const char* WineDbg=
"Software\\Wine\\WineDbg";
786 ok(0,
"could not find the test executable '%s'\n", test_exe);
794 save_value(hkey,
"debugger", &debugger_value);
795 trace(
"HKLM\\%s\\debugger is set to '%s'\n", AeDebug, debugger_value.
data);
799 skip(
"not enough privileges to change the debugger\n");
804 ok(0,
"could not open the AeDebug key: %ld\n",
ret);
814 strstr((
char*)debugger_value.
data,
"winedbg --auto"))
822 save_value(hkeyWinedbg,
"ShowCrashDialog", &crash_dlg_value);
831 ok(0,
"Couldn't access WineDbg Key - error %lu\n",
ret);
840 skip(
"\"none\" debugger test needs user interaction\n");
865 if(!pCheckRemoteDebuggerPresent)
867 win_skip(
"CheckRemoteDebuggerPresent is not available\n");
873 ok(bret ,
"expected CheckRemoteDebuggerPresent to succeed\n");
879 bret = pCheckRemoteDebuggerPresent(
NULL,&present);
880 ok(!bret ,
"expected CheckRemoteDebuggerPresent to fail\n");
881 ok(present,
"expected parameter to be unchanged\n");
887 ok(!bret ,
"expected CheckRemoteDebuggerPresent to fail\n");
900 const char *blackbox_file;
908 blackbox_file =
argv[4];
966 if (
sizeof(
void *) >
sizeof(
int))
974 static wchar_t expected_path[
MAX_PATH];
976 wcscat(expected_path,
L"\\sysnative\\oleacc.dll");
979 wcscpy(
path,
L"c:\\windows\\sysnative\\oleacc.dll" );
1027 const char *arguments =
" debugger child ";
1037 if (!pCheckRemoteDebuggerPresent)
1039 win_skip(
"CheckRemoteDebuggerPresent not available, skipping test.\n");
1042#if defined(__REACTOS__) && defined(_WIN64)
1046 skip(
"FIXME: Skipping test on ReactOS x64 because it is 64bit only!\n");
1050 if (
sizeof(
void *) >
sizeof(
int))
1057 skip(
"Skipping test on 64bit only configuration\n");
1064 ok(!
ret,
"DebugActiveProcess() succeeded on own process.\n");
1078 ok(
ret,
"CheckRemoteDebuggerPresent failed, last error %#lx.\n",
GetLastError());
1091#if defined(__i386__) || defined(__x86_64__)
1097 ok(
byte == 0xcc,
"got %02x\n",
byte);
1154 ok(fmw.
count,
"no window found\n");
1165 unsigned order = 0, bp_order = 0, bpwx_order = 0, num_ntdll = 0, num_wow64 = 0;
1168#if defined(__REACTOS__) && defined(_WIN64)
1170 skip(
"FIXME: ReactOS x64 does not have WoW64 yet!\n");
1182 skip(
"Skipping test on incompatible config\n");
1209 ok(bpwx_order == 0,
"loaddll for wow64 DLLs should appear before exception\n");
1214 ok(bp_order == 0 && bpwx_order == 0,
"loaddll on ntdll should appear before exception\n");
1283 ok(num_ntdll == 2,
"Expecting two ntdll instances\n");
1284 ok(num_wow64 >= 3,
"Expecting more than 3 wow64*.dll\n");
1288 ok(num_ntdll == 1,
"Expecting one ntdll instances\n");
1289 ok(num_wow64 == 0,
"Expecting more no wow64*.dll\n");
1291 ok(bp_order,
"Expecting 1 bp exceptions\n");
1294 ok(bpwx_order,
"Expecting 1 bpwx exceptions\n");
1295 ok(bp_order < bpwx_order,
"Out of order bp exceptions\n");
1301 const char *arguments =
"debugger children last";
1303 const char *blackbox_file, *
p;
1313 blackbox_file =
argv[3];
1318 p =
p ?
p+1 : blackbox_file;
1320 strcat(event_name,
"_init");
1327 p =
p ?
p+1 : blackbox_file;
1329 strcat(event_name,
"_attach");
1344 "Timed out waiting for the child to exit\n");
1359 const char *arguments =
"debugger children";
1369 HANDLE event_init, event_attach;
1374 if (!pCheckRemoteDebuggerPresent)
1376 win_skip(
"CheckRemoteDebuggerPresent not available, skipping test.\n");
1385 p =
p ?
p+1 : blackbox_file;
1387 strcat(event_name,
"_init");
1392 p =
p ?
p+1 : blackbox_file;
1394 strcat(event_name,
"_attach");
1413 ok(
ret,
"CheckRemoteDebuggerPresent failed, last error %ld.\n",
GetLastError());
1416 trace(
"starting debugger loop\n");
1428 last_thread =
ctx.ev.dwThreadId;
1431 ok(
ctx.dll_cnt > 2,
"dll_cnt = %d\n",
ctx.dll_cnt);
1434 ok(
ctx.ev.dwThreadId == last_thread,
"unexpected thread\n");
1436 ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
1443 ok(
ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress != pDbgBreakPoint,
"ExceptionAddress == pDbgBreakPoint\n");
1450 ctx.ev.dwDebugEventCode = -1;
1473 last_thread =
ctx.ev.dwThreadId;
1479 ok(
ctx.ev.dwThreadId == last_thread,
"unexpected thread\n");
1481 ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
1482 ok(
ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress == pDbgBreakPoint,
"ExceptionAddress != DbgBreakPoint\n");
1491 ctx.ev.dwDebugEventCode = -1;
1508 ok(
ctx.process_cnt == 2,
"didn't get any child events (flag: %lx).\n",
flag);
1510 ok(
ctx.process_cnt == 1,
"got child event (flag: %lx).\n",
flag);
1532#define expect_event(a,b) expect_event_(__LINE__,a,b)
1536 ok_(__FILE__,
line)(
ctx->ev.dwDebugEventCode == event_code,
"dwDebugEventCode = %ld expected %ld\n",
1537 ctx->ev.dwDebugEventCode, event_code);
1540#define expect_exception(a,b) expect_exception_(__LINE__,a,b)
1544 ok_(__FILE__,
line)(
ctx->ev.u.Exception.ExceptionRecord.ExceptionCode ==
exception_code,
"ExceptionCode = %lx expected %lx\n",
1548#define check_breakpoint_exception(a,b) expect_breakpoint_exception_(__LINE__,a,b)
1552 if (!expect_addr)
return;
1553 ok_(__FILE__,
line)(
ctx->ev.u.Exception.ExceptionRecord.ExceptionAddress == expect_addr,
1554 "ExceptionAddress = %p expected %p\n",
ctx->ev.u.Exception.ExceptionRecord.ExceptionAddress, expect_addr);
1557 ok_(__FILE__,
line)(
get_ip(&
thread->ctx) == (
char*)expect_addr + 1,
"unexpected instruction pointer %p expected %p\n",
1561#define expect_breakpoint_exception(a,b) expect_breakpoint_exception_(__LINE__,a,b)
1568#define single_step(a,b,c) single_step_(__LINE__,a,b,c)
1571#if defined(__i386__) || defined(__x86_64__)
1573 thread->ctx.EFlags |= 0x100;
1576 ok_(__FILE__,
line)(
ctx->ev.u.Exception.ExceptionRecord.ExceptionAddress == expect_addr,
1577 "ExceptionAddress = %p expected %p\n",
ctx->ev.u.Exception.ExceptionRecord.ExceptionAddress, expect_addr);
1579 ok_(__FILE__,
line)(
get_ip(&
thread->ctx) == expect_addr,
"unexpected instruction pointer %p expected %p\n",
1586#if defined(__i386__) || defined(__x86_64__)
1590 0xe9, 0xf8, 0xff, 0xff, 0xff
1598 0x8b, 0x44, 0x24, 0x0c,
1599 0xb9, 0x11, 0x11, 0x11, 0x11,
1600 0xba, 0x22, 0x22, 0x22, 0x22,
1601 0xbb, 0x33, 0x33, 0x33, 0x33,
1602 0xbf, 0x44, 0x44, 0x44, 0x44,
1608 0x90, 0x90, 0x90, 0x90,
1609 0x90, 0x90, 0x90, 0x90,
1616#elif defined(__x86_64__)
1620 0x48, 0xb9, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
1621 0x48, 0xba, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
1622 0x48, 0xbb, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
1623 0x48, 0xbf, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
1629 0x90, 0x90, 0x90, 0x90,
1630 0x90, 0x90, 0x90, 0x90,
1639#if defined(__i386__) || defined(__x86_64__)
1647 static const char arguments[] =
" debugger wait ";
1655 unsigned int i, worker_cnt, exception_cnt, skip_reply_later;
1676 win_skip(
"Skipping unsupported DBG_REPLY_LATER tests\n");
1682 ctx.ev.dwDebugEventCode = -1;
1685 "dwDebugEventCode differs: %lx (was %lx)\n",
ctx.ev.dwDebugEventCode, de.
dwDebugEventCode);
1687 "dwProcessId differs: %lx (was %lx)\n",
ctx.ev.dwProcessId, de.
dwProcessId);
1689 "dwThreadId differs: %lx (was %lx)\n",
ctx.ev.dwThreadId, de.
dwThreadId);
1711 "dwDebugEventCode differs: %lx (was %lx)\n",
ctx.ev.dwDebugEventCode, de.
dwDebugEventCode);
1720 ctx.ev.dwDebugEventCode = -1;
1723 "dwDebugEventCode differs: %lx (was %lx)\n",
ctx.ev.dwDebugEventCode, de.
dwDebugEventCode);
1725 "dwProcessId differs: %lx (was %lx)\n",
ctx.ev.dwProcessId, de.
dwProcessId);
1727 "dwThreadId differs: %lx (was %lx)\n",
ctx.ev.dwThreadId, de.
dwThreadId);
1732 while(
ctx.ev.dwDebugEventCode != -1);
1736 proc_code =
buf + 1024;
1744 proc_code[0] =
OP_BP;
1757 "ExceptionAddress = %p\n",
ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress);
1797#if defined(__REACTOS__) && defined(_WIN64)
1803 else todo_wine win_skip(
"call_debug_service_code not supported on this architecture\n");
1805 if (skip_reply_later)
1806 win_skip(
"Skipping unsupported DBG_REPLY_LATER tests\n");
1809 HANDLE thread_a, thread_b;
1838 ctx.ev.dwDebugEventCode = -1;
1841 "dwDebugEventCode = %ld\n",
ctx.ev.dwDebugEventCode);
1843 "dwProcessId differs: %lx (was %lx)\n",
ctx.ev.dwProcessId, de_a.
dwProcessId);
1845 "dwThreadId differs: %lx (was %lx)\n",
ctx.ev.dwThreadId, de_a.
dwThreadId);
1852 ok(pNtSuspendProcess !=
NULL,
"NtSuspendProcess not found\n");
1853 ok(pNtResumeProcess !=
NULL,
"pNtResumeProcess not found\n");
1854 if (pNtSuspendProcess && pNtResumeProcess)
1906 ctx.ev.dwDebugEventCode = -1;
1912 "dwDebugEventCode differs: %lx (was %lx)\n",
ctx.ev.dwDebugEventCode, de_a.
dwDebugEventCode);
1914 "dwProcessId differs: %lx (was %lx)\n",
ctx.ev.dwProcessId, de_a.
dwProcessId);
1916 "dwThreadId differs: %lx (was %lx)\n",
ctx.ev.dwThreadId, de_a.
dwThreadId);
1922 "dwProcessId differs: %lx (was %lx)\n",
ctx.ev.dwProcessId, de_a.
dwProcessId);
1924 "dwThreadId differs: %lx (was %lx)\n",
ctx.ev.dwThreadId, de_a.
dwThreadId);
1934 "dwDebugEventCode differs: %lx (was %lx)\n",
ctx.ev.dwDebugEventCode, de_b.
dwDebugEventCode);
1936 "dwProcessId differs: %lx (was %lx)\n",
ctx.ev.dwProcessId, de_b.
dwProcessId);
1938 "dwThreadId differs: %lx (was %lx)\n",
ctx.ev.dwThreadId, de_b.
dwThreadId);
1943 "dwDebugEventCode differs: %lx (was %lx)\n",
ctx.ev.dwDebugEventCode, de_b.
dwDebugEventCode);
1945 "dwProcessId differs: %lx (was %lx)\n",
ctx.ev.dwProcessId, de_b.
dwProcessId);
1947 "dwThreadId differs: %lx (was %lx)\n",
ctx.ev.dwThreadId, de_b.
dwThreadId);
1953 "dwProcessId differs: %lx (was %lx)\n",
ctx.ev.dwProcessId, de_b.
dwProcessId);
1955 "dwThreadId differs: %lx (was %lx)\n",
ctx.ev.dwThreadId, de_b.
dwThreadId);
1965 "dwDebugEventCode differs: %lx (was %lx)\n",
ctx.ev.dwDebugEventCode, de_a.
dwDebugEventCode);
1967 "dwProcessId differs: %lx (was %lx)\n",
ctx.ev.dwProcessId, de_a.
dwProcessId);
1969 "dwThreadId differs: %lx (was %lx)\n",
ctx.ev.dwThreadId, de_a.
dwThreadId);
1976 "dwDebugEventCode = %ld\n",
ctx.ev.dwDebugEventCode);
1987 "dwDebugEventCode = %ld\n",
ctx.ev.dwDebugEventCode);
1996 unsigned event_order = 0;
2006 for (
i = 0;
i < worker_cnt;
i++)
2015#if defined(__REACTOS__) && defined(_WIN64)
2021#if defined(__REACTOS__) && defined(_WIN64)
2023#elif defined(__REACTOS__)
2026 ok(
ctx.ev.u.CreateThread.lpStartAddress == (
void*)
thread_proc,
"Unexpected thread's start address\n");
2038#if defined(__REACTOS__) && defined(_WIN64)
2053#if defined(__REACTOS__) && defined(_WIN64)
2055 skip(
"These tests run far too long on Windows 8+ x64 and ReactOS x64.\n");
2076 if (event_order == 0) event_order = 1;
2077 if (!--worker_cnt)
break;
2080 if (!worker_cnt)
break;
2083 trace(
"exception at %p in thread %04lx\n",
ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress,
ctx.ev.dwThreadId);
2085 ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
2087 "ExceptionAddress = %p\n",
ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress);
2089 if (event_order == 1) event_order = 2;
2092 trace(
"received %u exceptions\n", exception_cnt);
2093 ok(!worker_cnt,
"Missing %u exit thread events\n", worker_cnt);
2094 ok(event_order == 1 ||
broken(event_order == 2),
"Intertwined exit thread & exception debug events\n");
2096#if defined(__REACTOS__) && defined(_WIN64)
2113 orig_context =
ctx.main_thread->
ctx;
2116#if defined(__i386__)
2123#elif defined(__x86_64__)
2124 ctx.main_thread->
ctx.Rax = 101;
2125 ctx.main_thread->
ctx.Rbx = 102;
2126 ctx.main_thread->
ctx.Rcx = 103;
2127 ctx.main_thread->
ctx.Rdx = 104;
2128 ctx.main_thread->
ctx.Rsi = 105;
2129 ctx.main_thread->
ctx.Rdi = 106;
2135 ctx.main_thread->
ctx.R13 = 112;
2136 ctx.main_thread->
ctx.R14 = 113;
2137 ctx.main_thread->
ctx.R15 = 114;
2142#if defined(__i386__)
2147#elif defined(__x86_64__)
2148 ok(
ctx.main_thread->
ctx.Rax == 101,
"Rax = %I64x\n",
ctx.main_thread->
ctx.Rax);
2149 ok(
ctx.main_thread->
ctx.Rbx == 102,
"Rbx = %I64x\n",
ctx.main_thread->
ctx.Rbx);
2150 ok(
ctx.main_thread->
ctx.Rcx == 103,
"Rcx = %I64x\n",
ctx.main_thread->
ctx.Rcx);
2151 ok(
ctx.main_thread->
ctx.Rdx == 104,
"Rdx = %I64x\n",
ctx.main_thread->
ctx.Rdx);
2152 ok(
ctx.main_thread->
ctx.Rsi == 105,
"Rsi = %I64x\n",
ctx.main_thread->
ctx.Rsi);
2153 ok(
ctx.main_thread->
ctx.Rdi == 106,
"Rdi = %I64x\n",
ctx.main_thread->
ctx.Rdi);
2159 ok(
ctx.main_thread->
ctx.R13 == 112,
"R13 = %I64x\n",
ctx.main_thread->
ctx.R13);
2160 ok(
ctx.main_thread->
ctx.R14 == 113,
"R14 = %I64x\n",
ctx.main_thread->
ctx.R14);
2161 ok(
ctx.main_thread->
ctx.R15 == 114,
"R15 = %I64x\n",
ctx.main_thread->
ctx.R15);
2174 ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
2175 ok(
ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress ==
ip,
2176 "ExceptionAddress = %p\n",
ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress);
2181#if defined(__i386__)
2188#elif defined(__x86_64__)
2189 ok(
ctx.main_thread->
ctx.Rax == 0,
"Rax = %I64x\n",
ctx.main_thread->
ctx.Rax);
2190 ok(
ctx.main_thread->
ctx.Rbx == 102,
"Rbx = %I64x\n",
ctx.main_thread->
ctx.Rbx);
2191 ok(
ctx.main_thread->
ctx.Rcx != 103,
"Rcx = %I64x\n",
ctx.main_thread->
ctx.Rcx);
2192 ok(
ctx.main_thread->
ctx.Rdx != 104,
"Rdx = %I64x\n",
ctx.main_thread->
ctx.Rdx);
2193 ok(
ctx.main_thread->
ctx.Rsi == 105,
"Rsi = %I64x\n",
ctx.main_thread->
ctx.Rsi);
2194 ok(
ctx.main_thread->
ctx.Rdi == 106,
"Rdi = %I64x\n",
ctx.main_thread->
ctx.Rdi);
2200 ok(
ctx.main_thread->
ctx.R13 == 112,
"R13 = %I64x\n",
ctx.main_thread->
ctx.R13);
2201 ok(
ctx.main_thread->
ctx.R14 == 113,
"R14 = %I64x\n",
ctx.main_thread->
ctx.R14);
2202 ok(
ctx.main_thread->
ctx.R15 == 114,
"R15 = %I64x\n",
ctx.main_thread->
ctx.R15);
2205 ctx.main_thread->
ctx = orig_context;
2220 orig_context =
ctx.main_thread->
ctx;
2223#if defined(__i386__)
2226#elif defined(__x86_64__)
2239 ctx.ev.u.Exception.ExceptionRecord.ExceptionCode);
2240 ok(
ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress ==
mem + 10 ||
2241 ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress ==
mem + 11,
2242 "ExceptionAddress = %p expected %p\n",
ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress,
mem + 10);
2245 ok(
get_ip(&
ctx.main_thread->
ctx) ==
ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress,
2249 else win_skip(
"got breakpoint instead of single step exception\n");
2251 ctx.main_thread->
ctx = orig_context;
2257#if defined(__REACTOS__) && defined(_MSC_VER)
2259 skip(
"This test doesn't work correctly on MSVC ReactOS.\n");
2270#if defined(__REACTOS__) && defined(_MSC_VER)
2293 pDbgUiSetThreadDebugObject( 0 );
2316 debug = pDbgUiGetThreadDebugObject();
2319 ok( !
status,
"NtSetInformationDebugObject failed %lx\n",
status );
2333 pDbgUiSetThreadDebugObject(
debug );
2336 debug = pDbgUiGetThreadDebugObject();
2339 ok( !
status,
"NtSetInformationDebugObject failed %lx\n",
status );
2350 *(
HANDLE *)
arg = pDbgUiGetThreadDebugObject();
2357 static const char arguments[] =
" debugger wait ";
2374 pDbgUiSetThreadDebugObject(
debug );
2380 pDbgUiSetThreadDebugObject(
debug );
2389 pDbgUiSetThreadDebugObject(
debug );
2393 ok( !
status,
"NtSetInformationDebugObject failed %lx\n",
status );
2399 pDbgUiSetThreadDebugObject(
debug );
2403 ok( !
status,
"NtSetInformationDebugObject failed %lx\n",
status );
2407 status = pDbgUiConnectToDbg();
2415 ok(
debug != 0,
"no debug port\n" );
2420 "NtSetInformationDebugObject failed %lx\n",
status );
2441 ok(
debug != 0,
"no debug port\n" );
2452 ok(
broken(
sizeof(
void*) ==
sizeof(
int)),
2453 "Terminating thread should terminate debuggee\n");
2480 ok(
debug != 0,
"no debug port\n" );
2491 "NtSetInformationDebugObject failed %lx\n",
status );
2504 pCheckRemoteDebuggerPresent=(
void*)
GetProcAddress(
hdll,
"CheckRemoteDebuggerPresent");
2508 "GetMappedFileNameW");
2514 pNtSetInformationDebugObject = (
void*)
GetProcAddress(
ntdll,
"NtSetInformationDebugObject");
2521 pDbgBreakPoint = (
void *)((
ULONG_PTR)pDbgBreakPoint & ~1);
std::map< E_MODULE, HMODULE > mod
static void startup(void)
static struct sockaddr_in sa
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
#define RegCloseKey(hKey)
#define STATUS_INVALID_HANDLE
@ DebugObjectKillProcessOnExitInformation
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
#define ReadProcessMemory(a, b, c, d, e)
#define ERROR_INVALID_PARAMETER
#define ReadFile(a, b, c, d, e)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileMappingW(a, b, c, d, e, f)
#define CreateFileA(a, b, c, d, e, f, g)
#define GetCurrentProcess()
#define HeapFree(x, y, z)
#define ERROR_ACCESS_DENIED
BOOL WINAPI DebugSetProcessKillOnExit(IN BOOL KillOnExit)
BOOL WINAPI DebugActiveProcessStop(IN DWORD dwProcessId)
BOOL WINAPI ContinueDebugEvent(IN DWORD dwProcessId, IN DWORD dwThreadId, IN DWORD dwContinueStatus)
BOOL WINAPI DebugActiveProcess(IN DWORD dwProcessId)
BOOL WINAPI DebugBreakProcess(IN HANDLE Process)
BOOL WINAPI WaitForDebugEvent(IN LPDEBUG_EVENT lpDebugEvent, IN DWORD dwMilliseconds)
UINT WINAPI SetErrorMode(IN UINT uMode)
LPTOP_LEVEL_EXCEPTION_FILTER WINAPI DECLSPEC_HOTPATCH SetUnhandledExceptionFilter(IN LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
UINT WINAPI GetSystemWow64DirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
BOOL NTAPI WriteProcessMemory(IN HANDLE hProcess, IN LPVOID lpBaseAddress, IN LPCVOID lpBuffer, IN SIZE_T nSize, OUT SIZE_T *lpNumberOfBytesWritten)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
VOID WINAPI ExitProcess(IN UINT uExitCode)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
DWORD WINAPI ResumeThread(IN HANDLE hThread)
HANDLE WINAPI CreateRemoteThread(IN HANDLE hProcess, IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
BOOL WINAPI SetThreadContext(IN HANDLE hThread, IN CONST CONTEXT *lpContext)
DWORD WINAPI SuspendThread(IN HANDLE hThread)
VOID WINAPI ExitThread(IN DWORD uExitCode)
HANDLE WINAPI OpenThread(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwThreadId)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
BOOL WINAPI TerminateThread(IN HANDLE hThread, IN DWORD dwExitCode)
BOOL WINAPI GetThreadContext(IN HANDLE hThread, OUT LPCONTEXT lpContext)
BOOL WINAPI IsDebuggerPresent(void)
static void basename(LPCWSTR path, LPWSTR name)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sscanf(const char *, const char *,...) __WINE_CRT_SCANF_ATTR(2
_ACRTIMP __msvcrt_long __cdecl atol(const char *)
_ACRTIMP int __cdecl atoi(const char *)
_ACRTIMP size_t __cdecl strlen(const char *)
_ACRTIMP char *__cdecl strstr(const char *, const char *)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
_ACRTIMP char *__cdecl strrchr(const char *, int)
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
#define STATUS_ACCESS_VIOLATION
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLdouble GLdouble GLint GLint order
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define PROCESS_QUERY_INFORMATION
#define THREAD_QUERY_INFORMATION
#define DEBUG_KILL_ON_CLOSE
#define THREAD_SET_CONTEXT
#define THREAD_SUSPEND_RESUME
#define THREAD_GET_CONTEXT
int winetest_vok(int condition, const char *msg, va_list ap)
const char * winetest_platform
LONG winetest_get_failures(void)
#define EXCEPTION_SINGLE_STEP
#define CREATE_PROCESS_DEBUG_EVENT
#define LOAD_DLL_DEBUG_EVENT
#define EXIT_PROCESS_DEBUG_EVENT
#define OUTPUT_DEBUG_STRING_EVENT
#define EXCEPTION_DEBUG_EVENT
#define CREATE_THREAD_DEBUG_EVENT
#define UNLOAD_DLL_DEBUG_EVENT
#define EXCEPTION_BREAKPOINT
#define EXIT_THREAD_DEBUG_EVENT
#define memcpy(s1, s2, n)
#define ERROR_FILE_NOT_FOUND
#define STATUS_DEBUGGER_INACTIVE
static int _load_blackbox(unsigned int line, const char *logfile, void *blackbox, int size)
#define WAIT_EVENT_TIMEOUT
#define expect_event(a, b)
static void expect_breakpoint_exception_(unsigned line, struct debugger_context *ctx, const void *expect_addr)
static void check_dll_event(HANDLE process, DEBUG_EVENT *ev)
static void expect_exception_(unsigned line, struct debugger_context *ctx, DWORD exception_code)
static void single_step_(unsigned line, struct debugger_context *ctx, struct debuggee_thread *thread, void *expect_addr)
static void test_debug_loop_wow64(void)
static LONG child_failures
static void doCrash(void)
static void crash_and_winedbg(HKEY hkey, const char *argv0)
static void test_ExitCode(void)
static void * get_ip(const CONTEXT *ctx)
static void test_debug_loop(int argc, char **argv)
#define check_thread_running(h)
#define check_thread_suspended(h)
static struct debuggee_thread * get_debuggee_thread(struct debugger_context *ctx, DWORD tid)
static void get_events(const char *name, HANDLE *start_event, HANDLE *done_event)
static DEBUGOBJECTINFOCLASS
static const BYTE call_debug_service_code[]
static DWORD WINAPI create_debug_port(void *arg)
static void crash_and_debug(HKEY hkey, const char *argv0, const char *dbgtasks)
static HMODULE oleaut32_mod
static void fetch_thread_context_(unsigned line, struct debuggee_thread *thread)
static LONG _check_thread_suspend_count(HANDLE h)
static void doChildren(int argc, char **argv)
#define set_thread_context(a, b)
static void run_background_thread(void)
static void test_kill_on_exit(const char *argv0)
static void set_ip(CONTEXT *ctx, void *ip)
static HMODULE oleacc_mod
static void doDebugger(int argc, char **argv)
#define fetch_thread_context(a)
static DWORD save_value(HKEY hkey, const char *value, reg_save_value *saved)
static void next_event_filter_(unsigned line, struct debugger_context *ctx, DWORD timeout, DWORD mask)
#define next_event_filter(a, b, c)
static void process_attach_events(struct debugger_context *ctx, BOOL pass_exception)
static DWORD WINAPI debug_and_wait(void *arg)
static OBJECT_ATTRIBUTES ULONG
static DWORD event_mask(DWORD ev)
static const BYTE loop_code[]
static void test_debugger(const char *argv0)
static PROCESS_INFORMATION pi
#define load_blackbox(a, b, c)
static void restore_value(HKEY hkey, reg_save_value *saved)
static void remove_thread(struct debugger_context *ctx, DWORD tid)
static void check_breakpoint_exception_(unsigned line, struct debugger_context *ctx, const void *expect_addr)
struct tag_reg_save_value reg_save_value
static BOOL CALLBACK enum_windows_callback(HWND handle, LPARAM lParam)
static void expect_event_(unsigned line, struct debugger_context *ctx, DWORD event_code)
static void next_event_(unsigned line, struct debugger_context *ctx, unsigned timeout)
static DWORD WINAPI debug_and_exit(void *arg)
#define check_breakpoint_exception(a, b)
int debuggee_thread_compare(const void *key, const struct wine_rb_entry *entry)
static void doChild(int argc, char **argv)
static void save_blackbox(const char *logfile, void *blackbox, int size, const char *dbgtrace)
#define wait_for_breakpoint(a)
#define POLL_EVENT_TIMEOUT
static DWORD run_child_wait(char *cmd, HANDLE event)
static void set_thread_context_(unsigned line, struct debugger_context *ctx, struct debuggee_thread *thread)
#define expect_breakpoint_exception(a, b)
static void add_thread(struct debugger_context *ctx, DWORD tid)
static void wait_for_breakpoint_(unsigned line, struct debugger_context *ctx)
static DWORD WINAPI thread_proc(void *arg)
static void test_debug_children(const char *name, DWORD flag, BOOL debug_child, BOOL pass_exception)
static void wait_debugger(HANDLE event, unsigned int cnt)
static void test_RemoteDebugger(void)
static void close_main_windows(DWORD pid)
#define single_step(a, b, c)
static HANDLE start_event
#define __WINE_PRINTF_ATTR(fmt, args)
#define REG_OPTION_NON_VOLATILE
#define REG_CREATED_NEW_KEY
#define REG_OPENED_EXISTING_KEY
#define PAGE_EXECUTE_READWRITE
NTSTATUS NTAPI NtReadVirtualMemory(IN HANDLE ProcessHandle, IN PVOID BaseAddress, OUT PVOID Buffer, IN SIZE_T NumberOfBytesToRead, OUT PSIZE_T NumberOfBytesRead OPTIONAL)
NTSTATUS NTAPI NtResumeThread(IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL)
NTSTATUS NTAPI NtSuspendThread(IN HANDLE ThreadHandle, OUT PULONG PreviousSuspendCount OPTIONAL)
#define STATUS_WX86_BREAKPOINT
#define DBG_EXCEPTION_NOT_HANDLED
#define WINE_RB_ENTRY_VALUE
#define ignore_exceptions
int winetest_get_mainargs(char ***pargv)
#define _WIN32_WINNT_WS03
#define _WIN32_WINNT_WIN8
#define _WIN32_WINNT_WIN7
#define _WIN32_WINNT_VISTA
static char argv0[MAX_PATH]
UNLOAD_DLL_DEBUG_INFO UnloadDll
union _DEBUG_EVENT::@3249 u
LOAD_DLL_DEBUG_INFO LoadDll
EXCEPTION_DEBUG_INFO Exception
EXCEPTION_RECORD ExceptionRecord
struct wine_rb_entry entry
struct wine_rb_tree threads
struct debuggee_thread * main_thread
struct debuggee_thread * current_thread
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
#define STATUS_INVALID_PARAMETER
#define INVALID_FILE_ATTRIBUTES
LPVOID NTAPI VirtualAllocEx(IN HANDLE hProcess, IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
DWORD WINAPI GetLastError(void)
#define STARTF_USESHOWWINDOW
DWORD WINAPI GetCurrentProcessId(void)
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
#define DEBUG_ONLY_THIS_PROCESS
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
#define ERROR_SEM_TIMEOUT
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_USER
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)