Commit in reactos/lib/kernel32/debug on MAIN
debugger.c+84-411.4 -> 1.5
implemented CheckRemoteDebuggerPresent() (only kernel32 part)

reactos/lib/kernel32/debug
debugger.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- debugger.c	23 Jan 2004 17:12:54 -0000	1.4
+++ debugger.c	9 Dec 2004 19:03:33 -0000	1.5
@@ -1,4 +1,4 @@
-/* $Id: debugger.c,v 1.4 2004/01/23 17:12:54 ekohl Exp $
+/* $Id: debugger.c,v 1.5 2004/12/09 19:03:33 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -14,89 +14,132 @@
 /* FUNCTIONS *****************************************************************/
 
 /*
- * @unimplemented
+ * @implemented
  */
-BOOL WINAPI CheckRemoteDebuggerPresent(HANDLE hProcess, PBOOL pbDebuggerPresent)
-{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
+BOOL WINAPI
+CheckRemoteDebuggerPresent (
+    HANDLE hProcess,
+    PBOOL pbDebuggerPresent
+    )
+{
+  HANDLE DebugPort;
+  NTSTATUS Status;
+  
+  if(pbDebuggerPresent == NULL)
+  {
+    SetLastError(ERROR_INVALID_PARAMETER);
+    return FALSE;
+  }
+  
+  Status = NtQueryInformationProcess(hProcess,
+                                     ProcessDebugPort,
+                                     (PVOID)&DebugPort,
+                                     sizeof(HANDLE),
+                                     NULL);
+  if(NT_SUCCESS(Status))
+  {
+    *pbDebuggerPresent = ((DebugPort != NULL) ? TRUE : FALSE);
+    return TRUE;
+  }
+  
+  SetLastErrorByStatus(Status);
+  return FALSE;
 }
 
 
 /*
  * @implemented
  */
-BOOL WINAPI ContinueDebugEvent
-(
- DWORD dwProcessId,
- DWORD dwThreadId,
- DWORD dwContinueStatus
-)
-{
- CLIENT_ID ClientId;
- NTSTATUS Status;
-
- ClientId.UniqueProcess = (HANDLE)dwProcessId;
- ClientId.UniqueThread = (HANDLE)dwThreadId;
-
- Status = DbgUiContinue(&ClientId, dwContinueStatus);
+BOOL WINAPI
+ContinueDebugEvent (
+    DWORD dwProcessId,
+    DWORD dwThreadId,
+    DWORD dwContinueStatus
+    )
+{
+  CLIENT_ID ClientId;
+  NTSTATUS Status;
+
+  ClientId.UniqueProcess = (HANDLE)dwProcessId;
+  ClientId.UniqueThread = (HANDLE)dwThreadId;
+
+  Status = DbgUiContinue(&ClientId, dwContinueStatus);
+
+  if(!NT_SUCCESS(Status))
+  {
+    SetLastErrorByStatus(Status);
+    return FALSE;
+  }
 
- if(!NT_SUCCESS(Status))
- {
-  SetLastErrorByStatus(Status);
-  return FALSE;
- }
-
- return TRUE;
+  return TRUE;
 }
 
 
 /*
  * @unimplemented
  */
-BOOL WINAPI DebugActiveProcess(DWORD dwProcessId)
+BOOL
+WINAPI
+DebugActiveProcess (
+    DWORD dwProcessId
+    )
 {
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 
 /*
  * @unimplemented
  */
-BOOL WINAPI DebugActiveProcessStop(DWORD dwProcessId)
+BOOL
+WINAPI
+DebugActiveProcessStop (
+    DWORD dwProcessId
+    )
 {
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 
 /*
  * @unimplemented
  */
-BOOL WINAPI DebugSetProcessKillOnExit(BOOL KillOnExit)
+BOOL
+WINAPI
+DebugSetProcessKillOnExit (
+    BOOL KillOnExit
+    )
 {
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 
 /*
  * @implemented
  */
-BOOL WINAPI IsDebuggerPresent(VOID)
+BOOL
+WINAPI
+IsDebuggerPresent (VOID)
 {
- return (BOOL)NtCurrentPeb()->BeingDebugged;
+  return (BOOL)NtCurrentPeb()->BeingDebugged;
 }
 
 
 /*
  * @unimplemented
  */
-BOOL WINAPI WaitForDebugEvent(LPDEBUG_EVENT lpDebugEvent, DWORD dwMilliseconds)
+BOOL
+WINAPI
+WaitForDebugEvent (
+    LPDEBUG_EVENT lpDebugEvent,
+    DWORD dwMilliseconds
+    )
 {
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /* EOF */
CVSspam 0.2.8