Set or clear the BeingDebugged flag in the PEB when a debugger is
attached to or detached from a process.
Don't send exception events to the server unless a debugger is
present.

diff --git a/dlls/kernel/debugger.c b/dlls/kernel/debugger.c
index 94c0fc1..dd2e015 100644
--- a/dlls/kernel/debugger.c
+++ b/dlls/kernel/debugger.c
@@ -334,14 +334,7 @@
  */
 BOOL WINAPI IsDebuggerPresent(void)
 {
-    BOOL ret = FALSE;
-    SERVER_START_REQ( get_process_info )
-    {
-        req->handle = GetCurrentProcess();
-        if (!wine_server_call_err( req )) ret = reply->debugged;
-    }
-    SERVER_END_REQ;
-    return ret;
+    return NtCurrentTeb()->Peb->BeingDebugged;
 }