Alexandre Julliard : ntdll: Implement DbgUiConnectToDbg().
Alexandre Julliard
julliard at winehq.org
Fri Jan 29 15:10:21 CST 2021
Module: wine
Branch: master
Commit: a24e330b203a6b37987633ba03fc3b2e1c3a004f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a24e330b203a6b37987633ba03fc3b2e1c3a004f
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Jan 28 11:20:38 2021 +0100
ntdll: Implement DbgUiConnectToDbg().
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/ntdll.spec | 2 +-
dlls/ntdll/process.c | 16 ++++++++++++++++
include/winternl.h | 1 +
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 285b719f2d5..740030f2066 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -34,7 +34,7 @@
@ stub DbgPrompt
# @ stub DbgQueryDebugFilterState
# @ stub DbgSetDebugFilterState
-@ stub DbgUiConnectToDbg
+@ stdcall DbgUiConnectToDbg()
@ stub DbgUiContinue
@ stub DbgUiConvertStateChangeStructure
# @ stub DbgUiDebugActiveProcess
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index d8280277418..c52f00d123e 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -134,6 +134,22 @@ void WINAPI DbgUiSetThreadDebugObject( HANDLE handle )
NtCurrentTeb()->DbgSsReserved[1] = handle;
}
+/***********************************************************************
+ * DbgUiConnectToDbg (NTDLL.@)
+ */
+NTSTATUS WINAPI DbgUiConnectToDbg(void)
+{
+ HANDLE handle;
+ NTSTATUS status;
+ OBJECT_ATTRIBUTES attr = { sizeof(attr) };
+
+ if (DbgUiGetThreadDebugObject()) return STATUS_SUCCESS; /* already connected */
+
+ status = NtCreateDebugObject( &handle, DEBUG_ALL_ACCESS, &attr, 0 );
+ if (!status) DbgUiSetThreadDebugObject( handle );
+ return status;
+}
+
/***********************************************************************
* DbgUiRemoteBreakin (NTDLL.@)
*/
diff --git a/include/winternl.h b/include/winternl.h
index ac63567dad3..fc4792a194a 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -3020,6 +3020,7 @@ typedef struct _PS_CREATE_INFO
NTSYSAPI void WINAPI DbgBreakPoint(void);
NTSYSAPI NTSTATUS WINAPIV DbgPrint(LPCSTR fmt, ...);
NTSYSAPI NTSTATUS WINAPIV DbgPrintEx(ULONG iComponentId, ULONG Level, LPCSTR fmt, ...);
+NTSYSAPI NTSTATUS WINAPI DbgUiConnectToDbg(void);
NTSYSAPI HANDLE WINAPI DbgUiGetThreadDebugObject(void);
NTSYSAPI NTSTATUS WINAPI DbgUiIssueRemoteBreakin(HANDLE);
NTSYSAPI void WINAPI DbgUiRemoteBreakin(void*);
More information about the wine-cvs
mailing list