blob: 5958f6eb0abbe36e1a796575cbeb62c383f420fe [file] [log] [blame]
Alexandre Julliard4cc1b331999-05-23 19:57:42 +00001/*
2 * Win32 debugger functions
3 *
4 * Copyright (C) 1999 Alexandre Julliard
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00005 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
Jonathan Ernst360a3f92006-05-18 14:49:52 +020018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Alexandre Julliard4cc1b331999-05-23 19:57:42 +000019 */
20
Alexandre Julliard5b971f02000-11-26 22:39:50 +000021#include <stdio.h>
Patrik Stridvall2c684081999-07-31 17:36:48 +000022#include <string.h>
23
Alexandre Julliardff81d782000-03-08 12:01:30 +000024#include "winerror.h"
Alexandre Julliard5b971f02000-11-26 22:39:50 +000025#include "wine/winbase16.h"
Alexandre Julliard37e95032001-07-19 00:39:09 +000026#include "wine/server.h"
Alexandre Julliard19bfcd32005-05-16 14:45:18 +000027#include "kernel_private.h"
Alexandre Julliard47760852005-05-16 19:44:54 +000028#include "kernel16_private.h"
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000029#include "wine/debug.h"
Alexandre Julliard4cc1b331999-05-23 19:57:42 +000030
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000031WINE_DEFAULT_DEBUG_CHANNEL(debugstr);
Alexandre Julliard4cc1b331999-05-23 19:57:42 +000032
33
Alexandre Julliard4cc1b331999-05-23 19:57:42 +000034/******************************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +000035 * WaitForDebugEvent (KERNEL32.@)
Alexandre Julliard4cc1b331999-05-23 19:57:42 +000036 *
Andrew Johnston03131aa2000-12-19 23:33:03 +000037 * Waits for a debugging event to occur in a process being debugged before
38 * filling out the debug event structure.
Alexandre Julliard4cc1b331999-05-23 19:57:42 +000039 *
Robert Shearman7ed44d52004-08-26 18:22:17 +000040 * PARAMS
41 * event [O] Address of structure for event information.
42 * timeout [I] Number of milliseconds to wait for event.
43 *
Andrew Johnston03131aa2000-12-19 23:33:03 +000044 * RETURNS
Alexandre Julliard4cc1b331999-05-23 19:57:42 +000045 *
Andrew Johnston03131aa2000-12-19 23:33:03 +000046 * Returns true if a debug event occurred and false if the call timed out.
Alexandre Julliard4cc1b331999-05-23 19:57:42 +000047 */
Andrew Johnston03131aa2000-12-19 23:33:03 +000048BOOL WINAPI WaitForDebugEvent(
Robert Shearman7ed44d52004-08-26 18:22:17 +000049 LPDEBUG_EVENT event,
50 DWORD timeout)
Alexandre Julliard4cc1b331999-05-23 19:57:42 +000051{
Alexandre Julliard9c2370b2000-08-30 00:00:48 +000052 BOOL ret;
Alexandre Julliarde9936d92001-01-26 00:22:26 +000053 DWORD res;
54
55 for (;;)
Alexandre Julliard4cc1b331999-05-23 19:57:42 +000056 {
Alexandre Julliarde9936d92001-01-26 00:22:26 +000057 HANDLE wait = 0;
Alexandre Julliard9caa71e2001-11-30 18:46:42 +000058 debug_event_t data;
59 SERVER_START_REQ( wait_debug_event )
Alexandre Julliard9c2370b2000-08-30 00:00:48 +000060 {
Alexandre Julliarde9936d92001-01-26 00:22:26 +000061 req->get_handle = (timeout != 0);
Alexandre Julliard9caa71e2001-11-30 18:46:42 +000062 wine_server_set_reply( req, &data, sizeof(data) );
63 if (!(ret = !wine_server_call_err( req ))) goto done;
Alexandre Julliarde9936d92001-01-26 00:22:26 +000064
Alexandre Julliard9caa71e2001-11-30 18:46:42 +000065 if (!wine_server_reply_size(reply)) /* timeout */
Alexandre Julliarde9936d92001-01-26 00:22:26 +000066 {
Alexandre Julliard9caa71e2001-11-30 18:46:42 +000067 wait = reply->wait;
Alexandre Julliarde9936d92001-01-26 00:22:26 +000068 ret = FALSE;
69 goto done;
70 }
Alexandre Julliard9caa71e2001-11-30 18:46:42 +000071 event->dwDebugEventCode = data.code;
72 event->dwProcessId = (DWORD)reply->pid;
73 event->dwThreadId = (DWORD)reply->tid;
74 switch(data.code)
Alexandre Julliarde9936d92001-01-26 00:22:26 +000075 {
76 case EXCEPTION_DEBUG_EVENT:
Alexandre Julliard9caa71e2001-11-30 18:46:42 +000077 event->u.Exception.ExceptionRecord = data.info.exception.record;
78 event->u.Exception.dwFirstChance = data.info.exception.first;
Alexandre Julliarde9936d92001-01-26 00:22:26 +000079 break;
80 case CREATE_THREAD_DEBUG_EVENT:
Alexandre Julliard9caa71e2001-11-30 18:46:42 +000081 event->u.CreateThread.hThread = data.info.create_thread.handle;
82 event->u.CreateThread.lpThreadLocalBase = data.info.create_thread.teb;
83 event->u.CreateThread.lpStartAddress = data.info.create_thread.start;
Alexandre Julliarde9936d92001-01-26 00:22:26 +000084 break;
85 case CREATE_PROCESS_DEBUG_EVENT:
Alexandre Julliard9caa71e2001-11-30 18:46:42 +000086 event->u.CreateProcessInfo.hFile = data.info.create_process.file;
87 event->u.CreateProcessInfo.hProcess = data.info.create_process.process;
88 event->u.CreateProcessInfo.hThread = data.info.create_process.thread;
89 event->u.CreateProcessInfo.lpBaseOfImage = data.info.create_process.base;
90 event->u.CreateProcessInfo.dwDebugInfoFileOffset = data.info.create_process.dbg_offset;
91 event->u.CreateProcessInfo.nDebugInfoSize = data.info.create_process.dbg_size;
92 event->u.CreateProcessInfo.lpThreadLocalBase = data.info.create_process.teb;
93 event->u.CreateProcessInfo.lpStartAddress = data.info.create_process.start;
94 event->u.CreateProcessInfo.lpImageName = data.info.create_process.name;
95 event->u.CreateProcessInfo.fUnicode = data.info.create_process.unicode;
Alexandre Julliarde9936d92001-01-26 00:22:26 +000096 break;
97 case EXIT_THREAD_DEBUG_EVENT:
Alexandre Julliard9caa71e2001-11-30 18:46:42 +000098 event->u.ExitThread.dwExitCode = data.info.exit.exit_code;
Alexandre Julliarde9936d92001-01-26 00:22:26 +000099 break;
100 case EXIT_PROCESS_DEBUG_EVENT:
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000101 event->u.ExitProcess.dwExitCode = data.info.exit.exit_code;
Alexandre Julliarde9936d92001-01-26 00:22:26 +0000102 break;
103 case LOAD_DLL_DEBUG_EVENT:
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000104 event->u.LoadDll.hFile = data.info.load_dll.handle;
105 event->u.LoadDll.lpBaseOfDll = data.info.load_dll.base;
106 event->u.LoadDll.dwDebugInfoFileOffset = data.info.load_dll.dbg_offset;
107 event->u.LoadDll.nDebugInfoSize = data.info.load_dll.dbg_size;
108 event->u.LoadDll.lpImageName = data.info.load_dll.name;
109 event->u.LoadDll.fUnicode = data.info.load_dll.unicode;
Alexandre Julliarde9936d92001-01-26 00:22:26 +0000110 break;
111 case UNLOAD_DLL_DEBUG_EVENT:
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000112 event->u.UnloadDll.lpBaseOfDll = data.info.unload_dll.base;
Alexandre Julliarde9936d92001-01-26 00:22:26 +0000113 break;
114 case OUTPUT_DEBUG_STRING_EVENT:
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000115 event->u.DebugString.lpDebugStringData = data.info.output_string.string;
116 event->u.DebugString.fUnicode = data.info.output_string.unicode;
117 event->u.DebugString.nDebugStringLength = data.info.output_string.length;
Alexandre Julliarde9936d92001-01-26 00:22:26 +0000118 break;
119 case RIP_EVENT:
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000120 event->u.RipInfo.dwError = data.info.rip_info.error;
121 event->u.RipInfo.dwType = data.info.rip_info.type;
Alexandre Julliarde9936d92001-01-26 00:22:26 +0000122 break;
123 }
124 done:
James Juran49c779a2001-11-19 02:24:14 +0000125 /* nothing */ ;
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000126 }
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000127 SERVER_END_REQ;
Alexandre Julliarde9936d92001-01-26 00:22:26 +0000128 if (ret) return TRUE;
129 if (!wait) break;
130 res = WaitForSingleObject( wait, timeout );
131 CloseHandle( wait );
132 if (res != STATUS_WAIT_0) break;
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000133 }
Alexandre Julliarde9936d92001-01-26 00:22:26 +0000134 SetLastError( ERROR_SEM_TIMEOUT );
135 return FALSE;
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000136}
137
138
139/**********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000140 * ContinueDebugEvent (KERNEL32.@)
Andrew Johnston03131aa2000-12-19 23:33:03 +0000141 *
142 * Enables a thread that previously produced a debug event to continue.
143 *
Robert Shearman7ed44d52004-08-26 18:22:17 +0000144 * PARAMS
145 * pid [I] The id of the process to continue.
146 * tid [I] The id of the thread to continue.
147 * status [I] The rule to apply to unhandled exeptions.
148 *
Andrew Johnston03131aa2000-12-19 23:33:03 +0000149 * RETURNS
150 *
151 * True if the debugger is listed as the processes owner and the process
152 * and thread are valid.
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000153 */
Andrew Johnston03131aa2000-12-19 23:33:03 +0000154BOOL WINAPI ContinueDebugEvent(
Robert Shearman7ed44d52004-08-26 18:22:17 +0000155 DWORD pid,
156 DWORD tid,
157 DWORD status)
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000158{
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000159 BOOL ret;
Alexandre Julliard67a74992001-02-27 02:09:16 +0000160 SERVER_START_REQ( continue_debug_event )
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000161 {
Alexandre Julliard54f22872002-10-03 19:54:57 +0000162 req->pid = pid;
163 req->tid = tid;
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000164 req->status = status;
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000165 ret = !wine_server_call_err( req );
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000166 }
167 SERVER_END_REQ;
168 return ret;
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000169}
170
171
172/**********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000173 * DebugActiveProcess (KERNEL32.@)
Andrew Johnston03131aa2000-12-19 23:33:03 +0000174 *
Eric Pouechfbccb382002-02-27 01:28:30 +0000175 * Attempts to attach the debugger to a process.
Andrew Johnston03131aa2000-12-19 23:33:03 +0000176 *
Robert Shearman7ed44d52004-08-26 18:22:17 +0000177 * PARAMS
178 * pid [I] The process to be debugged.
179 *
Andrew Johnston03131aa2000-12-19 23:33:03 +0000180 * RETURNS
181 *
182 * True if the debugger was attached to process.
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000183 */
Robert Shearman7ed44d52004-08-26 18:22:17 +0000184BOOL WINAPI DebugActiveProcess( DWORD pid )
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000185{
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000186 BOOL ret;
Alexandre Julliard67a74992001-02-27 02:09:16 +0000187 SERVER_START_REQ( debug_process )
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000188 {
Alexandre Julliard54f22872002-10-03 19:54:57 +0000189 req->pid = pid;
Eric Pouechfbccb382002-02-27 01:28:30 +0000190 req->attach = 1;
191 ret = !wine_server_call_err( req );
192 }
193 SERVER_END_REQ;
194 return ret;
195}
196
197/**********************************************************************
198 * DebugActiveProcessStop (KERNEL32.@)
199 *
200 * Attempts to detach the debugger from a process.
201 *
Robert Shearman7ed44d52004-08-26 18:22:17 +0000202 * PARAMS
203 * pid [I] The process to be detached.
204 *
Eric Pouechfbccb382002-02-27 01:28:30 +0000205 * RETURNS
206 *
207 * True if the debugger was detached from the process.
208 */
Robert Shearman7ed44d52004-08-26 18:22:17 +0000209BOOL WINAPI DebugActiveProcessStop( DWORD pid )
Eric Pouechfbccb382002-02-27 01:28:30 +0000210{
211 BOOL ret;
212 SERVER_START_REQ( debug_process )
213 {
Alexandre Julliard54f22872002-10-03 19:54:57 +0000214 req->pid = pid;
Eric Pouechfbccb382002-02-27 01:28:30 +0000215 req->attach = 0;
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000216 ret = !wine_server_call_err( req );
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000217 }
218 SERVER_END_REQ;
219 return ret;
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000220}
221
222
223/***********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000224 * OutputDebugStringA (KERNEL32.@)
Andrew Johnston03131aa2000-12-19 23:33:03 +0000225 *
Francois Gouget17112ea2004-01-16 21:26:08 +0000226 * Output by an application of an ascii string to a debugger (if attached)
Andrew Johnston03131aa2000-12-19 23:33:03 +0000227 * and program log.
Robert Shearman7ed44d52004-08-26 18:22:17 +0000228 *
229 * PARAMS
230 * str [I] The message to be logged and given to the debugger.
231 *
232 * RETURNS
233 *
234 * Nothing.
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000235 */
Robert Shearman7ed44d52004-08-26 18:22:17 +0000236void WINAPI OutputDebugStringA( LPCSTR str )
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000237{
Alexandre Julliard67a74992001-02-27 02:09:16 +0000238 SERVER_START_REQ( output_debug_string )
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000239 {
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000240 req->string = (void *)str;
241 req->unicode = 0;
242 req->length = strlen(str) + 1;
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000243 wine_server_call( req );
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000244 }
245 SERVER_END_REQ;
Andreas Mohrcd132372000-05-23 01:13:07 +0000246 WARN("%s\n", str);
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000247}
248
249
250/***********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000251 * OutputDebugStringW (KERNEL32.@)
Andrew Johnston03131aa2000-12-19 23:33:03 +0000252 *
Francois Gouget17112ea2004-01-16 21:26:08 +0000253 * Output by an application of a unicode string to a debugger (if attached)
Andrew Johnston03131aa2000-12-19 23:33:03 +0000254 * and program log.
Robert Shearman7ed44d52004-08-26 18:22:17 +0000255 *
256 * PARAMS
257 * str [I] The message to be logged and given to the debugger.
258 *
259 * RETURNS
260 *
261 * Nothing.
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000262 */
Robert Shearman7ed44d52004-08-26 18:22:17 +0000263void WINAPI OutputDebugStringW( LPCWSTR str )
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000264{
Alexandre Julliard67a74992001-02-27 02:09:16 +0000265 SERVER_START_REQ( output_debug_string )
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000266 {
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000267 req->string = (void *)str;
268 req->unicode = 1;
269 req->length = (lstrlenW(str) + 1) * sizeof(WCHAR);
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000270 wine_server_call( req );
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000271 }
272 SERVER_END_REQ;
Andreas Mohrcd132372000-05-23 01:13:07 +0000273 WARN("%s\n", debugstr_w(str));
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000274}
275
276
277/***********************************************************************
Patrik Stridvallc01c1932001-06-19 03:36:23 +0000278 * OutputDebugString (KERNEL.115)
Andrew Johnston03131aa2000-12-19 23:33:03 +0000279 *
280 * Output by a 16 bit application of an ascii string to a debugger (if attached)
281 * and program log.
Robert Shearman7ed44d52004-08-26 18:22:17 +0000282 *
283 * PARAMS
284 * str [I] The message to be logged and given to the debugger.
285 *
286 * RETURNS
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000287 */
Robert Shearman7ed44d52004-08-26 18:22:17 +0000288void WINAPI OutputDebugString16( LPCSTR str )
Alexandre Julliard4cc1b331999-05-23 19:57:42 +0000289{
290 OutputDebugStringA( str );
291}
Alexandre Julliard00641d52000-03-08 16:41:37 +0000292
293
294/***********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000295 * DebugBreak (KERNEL32.@)
Andrew Johnston03131aa2000-12-19 23:33:03 +0000296 *
297 * Raises an exception so that a debugger (if attached)
298 * can take some action.
Robert Shearman7ed44d52004-08-26 18:22:17 +0000299 *
300 * PARAMS
301 *
302 * RETURNS
Alexandre Julliard00641d52000-03-08 16:41:37 +0000303 */
304void WINAPI DebugBreak(void)
305{
306 DbgBreakPoint();
307}
308
Eric Pouechfbccb382002-02-27 01:28:30 +0000309/***********************************************************************
310 * DebugBreakProcess (KERNEL32.@)
311 *
312 * Raises an exception so that a debugger (if attached)
313 * can take some action. Same as DebugBreak, but applies to any process.
Robert Shearman7ed44d52004-08-26 18:22:17 +0000314 *
315 * PARAMS
316 * hProc [I] Process to break into.
317 *
318 * RETURNS
319 *
320 * True if successful.
Eric Pouechfbccb382002-02-27 01:28:30 +0000321 */
322BOOL WINAPI DebugBreakProcess(HANDLE hProc)
323{
Alexandre Julliard3c4538c2002-02-27 01:55:02 +0000324 BOOL ret, self;
Eric Pouechfbccb382002-02-27 01:28:30 +0000325
Michael Stefaniuc308e04f2002-10-25 21:02:30 +0000326 TRACE("(%p)\n", hProc);
Eric Pouechfbccb382002-02-27 01:28:30 +0000327
Alexandre Julliard3c4538c2002-02-27 01:55:02 +0000328 SERVER_START_REQ( debug_break )
Eric Pouechfbccb382002-02-27 01:28:30 +0000329 {
330 req->handle = hProc;
Alexandre Julliard3c4538c2002-02-27 01:55:02 +0000331 ret = !wine_server_call_err( req );
332 self = ret && reply->self;
Eric Pouechfbccb382002-02-27 01:28:30 +0000333 }
334 SERVER_END_REQ;
Alexandre Julliard3c4538c2002-02-27 01:55:02 +0000335 if (self) DbgBreakPoint();
336 return ret;
Eric Pouechfbccb382002-02-27 01:28:30 +0000337}
338
Alexandre Julliard00641d52000-03-08 16:41:37 +0000339
340/***********************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +0000341 * DebugBreak (KERNEL.203)
Andrew Johnston03131aa2000-12-19 23:33:03 +0000342 *
Austin Englishd5de9972008-03-17 15:51:39 -0500343 * Raises an exception in a 16 bit application so that a debugger (if attached)
Andrew Johnston03131aa2000-12-19 23:33:03 +0000344 * can take some action.
345 *
Robert Shearman7ed44d52004-08-26 18:22:17 +0000346 * PARAMS
347 *
348 * RETURNS
349 *
Andrew Johnston03131aa2000-12-19 23:33:03 +0000350 * BUGS
351 *
352 * Only 386 compatible processors implemented.
Alexandre Julliard00641d52000-03-08 16:41:37 +0000353 */
Andrew Johnston03131aa2000-12-19 23:33:03 +0000354void WINAPI DebugBreak16(
Patrik Stridvallbca4a8d2001-02-12 03:49:57 +0000355 CONTEXT86 *context) /* [in/out] A pointer to the 386 compatible processor state. */
Alexandre Julliard00641d52000-03-08 16:41:37 +0000356{
357#ifdef __i386__
358 EXCEPTION_RECORD rec;
359
360 rec.ExceptionCode = EXCEPTION_BREAKPOINT;
361 rec.ExceptionFlags = 0;
362 rec.ExceptionRecord = NULL;
Alexandre Julliarddfd3d4a2000-11-25 23:56:20 +0000363 rec.ExceptionAddress = (LPVOID)context->Eip;
Alexandre Julliard00641d52000-03-08 16:41:37 +0000364 rec.NumberParameters = 0;
365 NtRaiseException( &rec, context, TRUE );
366#endif /* defined(__i386__) */
367}
368
369
370/***********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000371 * IsDebuggerPresent (KERNEL32.@)
Andrew Johnston03131aa2000-12-19 23:33:03 +0000372 *
373 * Allows a process to determine if there is a debugger attached.
374 *
Robert Shearman7ed44d52004-08-26 18:22:17 +0000375 * PARAMS
376 *
Andrew Johnston03131aa2000-12-19 23:33:03 +0000377 * RETURNS
378 *
379 * True if there is a debugger attached.
Alexandre Julliard00641d52000-03-08 16:41:37 +0000380 */
381BOOL WINAPI IsDebuggerPresent(void)
382{
Alexandre Julliarde55d5932003-10-14 01:30:42 +0000383 return NtCurrentTeb()->Peb->BeingDebugged;
Alexandre Julliard00641d52000-03-08 16:41:37 +0000384}
Alexandre Julliard5b971f02000-11-26 22:39:50 +0000385
Stefan Dösingere90635f2007-02-16 19:12:06 +0100386/***********************************************************************
387 * CheckRemoteDebuggerPresent (KERNEL32.@)
388 *
389 * Allows a process to determine if there is a remote debugger
390 * attached.
391 *
392 * PARAMS
393 *
394 * RETURNS
395 *
396 * TRUE because it is a stub.
397 */
398BOOL WINAPI CheckRemoteDebuggerPresent(HANDLE process, PBOOL DebuggerPresent)
399{
400 FIXME("(%p)->(%p): Stub!\n", process, DebuggerPresent);
401 *DebuggerPresent = FALSE;
402 return TRUE;
403}
Alexandre Julliard5b971f02000-11-26 22:39:50 +0000404
405/***********************************************************************
406 * _DebugOutput (KERNEL.328)
407 */
Alexandre Julliard617839d2003-08-27 02:20:44 +0000408void WINAPIV _DebugOutput( WORD flags, LPCSTR spec, VA_LIST16 valist )
Alexandre Julliard5b971f02000-11-26 22:39:50 +0000409{
Alexandre Julliard5b971f02000-11-26 22:39:50 +0000410 char caller[101];
411
412 /* Decode caller address */
413 if (!GetModuleName16( GetExePtr(CURRENT_STACK16->cs), caller, sizeof(caller) ))
414 sprintf( caller, "%04X:%04X", CURRENT_STACK16->cs, CURRENT_STACK16->ip );
415
Alexandre Julliard5b971f02000-11-26 22:39:50 +0000416 /* FIXME: cannot use wvsnprintf16 from kernel */
Alexandre Julliard617839d2003-08-27 02:20:44 +0000417 /* wvsnprintf16( temp, sizeof(temp), spec, valist ); */
Alexandre Julliard5b971f02000-11-26 22:39:50 +0000418
419 /* Output */
Alexandre Julliard617839d2003-08-27 02:20:44 +0000420 FIXME("%s %04x %s\n", caller, flags, debugstr_a(spec) );
Alexandre Julliard5b971f02000-11-26 22:39:50 +0000421}
Eric Pouechfbccb382002-02-27 01:28:30 +0000422
423/***********************************************************************
Patrik Stridvallee7c86f2002-03-11 01:17:26 +0000424 * DebugSetProcessKillOnExit (KERNEL32.@)
Eric Pouechfbccb382002-02-27 01:28:30 +0000425 *
Francois Gouget17112ea2004-01-16 21:26:08 +0000426 * Let a debugger decide whether a debuggee will be killed upon debugger
Robert Shearman7ed44d52004-08-26 18:22:17 +0000427 * termination.
428 *
429 * PARAMS
430 * kill [I] If set to true then kill the process on exit.
431 *
432 * RETURNS
433 * True if successful, false otherwise.
Eric Pouechfbccb382002-02-27 01:28:30 +0000434 */
435BOOL WINAPI DebugSetProcessKillOnExit(BOOL kill)
436{
437 BOOL ret = FALSE;
438
439 SERVER_START_REQ( set_debugger_kill_on_exit )
440 {
441 req->kill_on_exit = kill;
442 ret = !wine_server_call_err( req );
443 }
444 SERVER_END_REQ;
445 return ret;
446}