source: trunk/src/vdmdbg/vdmdbg.cpp@ 6502

Last change on this file since 6502 was 5984, checked in by bird, 24 years ago

Initial coding.

File size: 13.2 KB
Line 
1/* $Id: vdmdbg.cpp,v 1.1 2001-06-13 04:45:33 bird Exp $
2 *
3 * VDMDbg - Virtual Dos Machine Debug interface.
4 * (It's not only debuging. TaskMgr uses it and that's the reason for implementing it.)
5 *
6 * Copyright (c) 2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11
12
13/*******************************************************************************
14* Header Files *
15*******************************************************************************/
16#include <odin.h>
17#include <odinwrap.h>
18#include <os2sel.h>
19
20#include <os2win.h>
21#include <winnt.h>
22#include <winnls.h>
23#include <stdlib.h>
24#include <string.h>
25#include <ctype.h>
26
27#include <misc.h>
28#include <unicode.h>
29#include <versionos2.h>
30
31#include <vdmdbg.h>
32
33#define DBG_LOCALLOG DBG_vdmdbg
34#include "dbglocal.h"
35
36/*******************************************************************************
37* Defined Constants And Macros *
38*******************************************************************************/
39ODINDEBUGCHANNEL(VDMDBG-VDMVDG)
40
41/**
42 *
43 * @returns Success indicator.
44 * @status stub
45 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
46 */
47BOOL WIN32API VDMProcessException(
48 LPDEBUG_EVENT lpDebugEvent
49 )
50{
51 dprintf(("VDMDBG: " __FUNCTION__ "(%x) - stub\n", lpDebugEvent));
52 return FALSE;
53}
54
55/**
56 *
57 * @returns Success indicator.
58 * @status stub
59 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
60 */
61BOOL WIN32API VDMGetThreadSelectorEntry(
62 HANDLE hProcess,
63 HANDLE hThread,
64 WORD wSelector,
65 LPVDMLDT_ENTRY lpSelectorEntry
66 )
67{
68 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x, %x) - stub\n", hProcess, hThread, wSelector, lpSelectorEntry));
69 return FALSE;
70}
71
72
73/**
74 *
75 * @returns Pointer.
76 * @status stub
77 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
78 */
79ULONG WIN32API VDMGetPointer(
80 HANDLE hProcess,
81 HANDLE hThread,
82 WORD wSelector,
83 DWORD dwOffset,
84 BOOL fProtMode
85 )
86{
87 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x, %x, %x) - stub\n", hProcess, hThread, wSelector, dwOffset, fProtMode));
88 return NULL;
89}
90
91/**
92 *
93 * @returns Success indicator.
94 * @status stub
95 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
96 * @remark Marked as obsolete, use VDMGetContex.
97 */
98BOOL WIN32API VDMGetThreadContext(
99 LPDEBUG_EVENT lpDebugEvent,
100 LPVDMCONTEXT lpVDMContext
101)
102{
103 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x) - stub\n", lpDebugEvent, lpVDMContext));
104 return FALSE;
105}
106
107/**
108 *
109 * @returns Success indicator.
110 * @status stub
111 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
112 * @remark Marked as obsolete, use VDMSetContex.
113 */
114BOOL WIN32API VDMSetThreadContext(
115 LPDEBUG_EVENT lpDebugEvent,
116 LPVDMCONTEXT lpVDMContext
117)
118{
119 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x) - stub\n", lpDebugEvent, lpVDMContext));
120 return FALSE;
121}
122
123/**
124 *
125 * @returns Success indicator.
126 * @status stub
127 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
128 */
129BOOL WIN32API VDMGetContext(
130 HANDLE hProcess,
131 HANDLE hThread,
132 LPVDMCONTEXT lpVDMContext
133 )
134{
135 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x) - stub\n", hProcess, hThread, lpVDMContext));
136 return FALSE;
137}
138
139/**
140 *
141 * @returns Success indicator.
142 * @status stub
143 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
144 */
145BOOL WIN32API VDMSetContext(
146 HANDLE hProcess,
147 HANDLE hThread,
148 LPVDMCONTEXT lpVDMContext
149 )
150{
151 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x) - stub\n", hProcess, hThread, lpVDMContext));
152 return FALSE;
153}
154
155/**
156 *
157 * @returns Success indicator.
158 * @status stub
159 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
160 */
161BOOL WIN32API VDMGetSelectorModule(
162 HANDLE hProcess,
163 HANDLE hThread,
164 WORD wSelector,
165 PUINT lpSegmentNumber,
166 LPSTR lpModuleName,
167 UINT nNameSize,
168 LPSTR lpModulePath,
169 UINT nPathSize
170)
171{
172 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x, %x, %x, %x, %x, %x) - stub\n",
173 hProcess, hThread, wSelector, lpSegmentNumber, lpModuleName, nNameSize, lpModulePath, nPathSize));
174 return FALSE;
175}
176
177
178/**
179 *
180 * @returns Success indicator.
181 * @status stub
182 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
183 */
184BOOL WIN32API VDMGetModuleSelector(
185 HANDLE hProcess,
186 HANDLE hThread,
187 UINT wSegmentNumber,
188 LPSTR lpModuleName,
189 LPWORD lpSelector
190)
191{
192 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x, %x, %x) - stub\n",
193 hProcess, hThread, wSegmentNumber, lpModuleName, lpSelector));
194 return FALSE;
195}
196
197/**
198 *
199 * @returns Success indicator.
200 * @status stub
201 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
202 */
203BOOL WIN32API VDMModuleFirst(
204 HANDLE hProcess,
205 HANDLE hThread,
206 LPMODULEENTRY lpModuleEntry,
207 DEBUGEVENTPROC lpEventProc,
208 LPVOID lpData
209)
210{
211 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x, %x, %x) - stub\n",
212 hProcess, hThread, lpModuleEntry, lpEventProc, lpData));
213 return FALSE;
214}
215
216
217/**
218 *
219 * @returns Success indicator.
220 * @status stub
221 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
222 */
223BOOL WIN32API VDMModuleNext(
224 HANDLE hProcess,
225 HANDLE hThread,
226 LPMODULEENTRY lpModuleEntry,
227 DEBUGEVENTPROC lpEventProc,
228 LPVOID lpData
229)
230{
231 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x, %x, %x) - stub\n",
232 hProcess, hThread, lpModuleEntry, lpEventProc, lpData));
233 return FALSE;
234}
235
236
237/**
238 *
239 * @returns Success indicator.
240 * @status stub
241 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
242 */
243BOOL WIN32API VDMGlobalFirst(
244 HANDLE hProcess,
245 HANDLE hThread,
246 LPGLOBALENTRY lpGlobalEntry,
247 WORD wFlags,
248 DEBUGEVENTPROC lpEventProc,
249 LPVOID lpData
250)
251{
252 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x, %x, %x, %x) - stub\n",
253 hProcess, hThread, lpGlobalEntry, wFlags, lpEventProc, lpData));
254 return FALSE;
255}
256
257/**
258 *
259 * @returns Success indicator.
260 * @status stub
261 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
262 */
263BOOL WIN32API VDMGlobalNext(
264 HANDLE hProcess,
265 HANDLE hThread,
266 LPGLOBALENTRY lpGlobalEntry,
267 WORD wFlags,
268 DEBUGEVENTPROC lpEventProc,
269 LPVOID lpData
270)
271{
272 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x, %x, %x, %x) - stub\n",
273 hProcess, hThread, lpGlobalEntry, wFlags, lpEventProc, lpData));
274 return FALSE;
275}
276
277
278
279/**
280 *
281 * @returns Count of Win16 subsystem processes or the count of subsystem processes enumerated before terminating.
282 * @param dwProcessId
283 * @param fp
284 * @param lparam
285 * @status stub
286 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
287 */
288INT WIN32API VDMEnumProcessWOW(
289 PROCESSENUMPROC fp,
290 LPARAM lparam
291)
292{
293 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x) - stub\n", fp, lparam));
294 return 0;
295}
296
297
298/**
299 *
300 * @returns Count of Win16 tasks or the count of tasks enumerated before terminating.
301 * @param dwProcessId
302 * @param fp
303 * @param lparam
304 * @status stub
305 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
306 */
307INT WIN32API VDMEnumTaskWOW(
308 DWORD dwProcessId,
309 TASKENUMPROC fp,
310 LPARAM lparam
311)
312{
313 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x) - stub\n", dwProcessId, fp, lparam));
314 return 0;
315}
316
317
318/**
319 * Same as VDMEnumTaskWOW, but the callback procedure gets two extra
320 * parameters. The module name of the EXE and the full path to the EXE.
321 *
322 * @returns Count of Win16 tasks or the count of tasks enumerated before terminating.
323 * @param dwProcessId
324 * @param fp
325 * @param lparam
326 * @status stub
327 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
328 */
329INT WIN32API VDMEnumTaskWOWEx(
330 DWORD dwProcessId,
331 TASKENUMPROCEX fp,
332 LPARAM lparam
333)
334{
335 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x) - stub\n", dwProcessId, fp, lparam));
336 return 0;
337}
338
339
340/**
341 * This function rudely terminates a WOW task.
342 * It's similar to the way TerminateProcess kills a Win32 process.
343 * @returns Success indicator.
344 * @param dwProcessId
345 * @param htask
346 * @status stub
347 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
348 */
349BOOL WIN32API VDMTerminateTaskWOW(
350 DWORD dwProcessId,
351 WORD htask
352)
353{
354 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x) - stub\n", dwProcessId, htask));
355 return FALSE;
356}
357
358
359/**
360 * VDMStartTaskInWOW launches a Win16 task in a pre-existing WOW VDM.
361 * The caller is responsible for ensuring the program is a 16-bit
362 * Windows program. If it is a DOS or Win32 program, it will still
363 * be launched from within the target WOW VDM.
364 *
365 * The supplied command line and show command are passed
366 * unchanged to the 16-bit WinExec API in the target WOW VDM.
367 *
368 * @returns Success indicator.
369 * @param dwProcessId
370 * @param lpCommandLine
371 * @param wShow
372 * @status stub
373 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
374 * @remark This routine is ANSI-only.
375 * Not 100% sure this is WIN32API... (kso)
376 */
377BOOL WIN32API VDMStartTaskInWOW(
378 DWORD dwProcessId,
379 LPSTR lpCommandLine,
380 WORD wShow
381)
382{
383 dprintf(("VDMDBG: " __FUNCTION__ " (%x, %s, %x) - stub\n", dwProcessId, lpCommandLine, wShow));
384 return FALSE;
385}
386
387
388/**
389 *
390 * @returns Success indicator.
391 * @status stub
392 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
393 * @remark SDK says: VDMKillWOW is not implemented.
394 */
395BOOL WIN32API VDMKillWOW(VOID)
396{
397 dprintf(("VDMDBG: " __FUNCTION__ " - stub\n"));
398 return FALSE;
399}
400
401
402/**
403 *
404 * @returns Success indicator.
405 * @status stub
406 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
407 * @remark SDK says: VDMDetectWOW is not implemented.
408 */
409BOOL WIN32API VDMDetectWOW(VOID)
410{
411 dprintf(("VDMDBG: " __FUNCTION__ " - stub\n"));
412 return FALSE;
413}
414
415/**
416 *
417 * @returns Success indicator.
418 * @param hProcess
419 * @param hThread
420 * @status stub
421 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
422 */
423BOOL WIN32API VDMBreakThread(
424 HANDLE hProcess,
425 HANDLE hThread
426)
427{
428 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x) - stub\n", hProcess, hThread));
429 return FALSE;
430}
431
432
433/**
434 *
435 * @returns Debug flags.
436 * @status stub
437 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
438 */
439DWORD WIN32API VDMGetDbgFlags(
440 HANDLE hProcess
441 )
442{
443 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x) - stub\n", hProcess));
444 return 0;
445}
446
447/**
448 *
449 * @returns Success indicator.
450 * @status stub
451 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
452 */
453BOOL WIN32API VDMSetDbgFlags(
454 HANDLE hProcess,
455 DWORD dwFlags
456 )
457{
458 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x) - stub\n", hProcess, dwFlags));
459 return FALSE;
460}
461
462/**
463 * Used to check if a module is loaded.
464 * @returns Success indicator.
465 * @status stub
466 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
467 */
468BOOL WIN32API VDMIsModuleLoaded(
469 LPSTR szPath
470 )
471{
472 dprintf(("VDMDBG: " __FUNCTION__ "(%s) - stub\n", szPath));
473 return FALSE;
474}
475
476/**
477 *
478 * @returns Success indicator.
479 * @status stub
480 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
481 */
482BOOL WIN32API VDMGetSegmentInfo(
483 WORD Selector,
484 ULONG Offset,
485 BOOL bProtectMode,
486 VDM_SEGINFO *pSegInfo
487 )
488{
489 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x, %x) - stub\n", Selector, Offset, bProtectMode, pSegInfo));
490 return FALSE;
491}
492
493/**
494 * This API is used to read the standard .SYM file format.
495 * @returns Success indicator.
496 * @param pszModule module name (max 9 chars)
497 * @param SegNumber logical segment number of segment (see VDM_SEGINFO)
498 * @param Offset offset in segment
499 * @param bProtectMode TRUE for PM, FALSE for V86 mode
500 * @param bNextSymbol FALSE to find nearest sym BEFORE offset, TRUE for AFTER
501 * @param szSymbolName receives symbol name (must point to 256 byte buffer)
502 * @param pDisplacement distance in bytes from nearest symbol
503 * @status stub
504 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
505 */
506BOOL WIN32API VDMGetSymbol(
507 LPSTR pszModule,
508 WORD SegNumber,
509 DWORD Offset,
510 BOOL bProtectMode,
511 BOOL bNextSymbol,
512 LPSTR szSymbolName,
513 PDWORD pDisplacement
514 )
515{
516 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x, %x, %x, %x, %x) - stub\n",
517 pszModule, SegNumber, Offset, bProtectMode, bNextSymbol, szSymbolName, pDisplacement));
518 return FALSE;
519}
520
521/**
522 *
523 * @returns Success indicator.
524 * @status stub
525 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
526 */
527BOOL WIN32API VDMGetAddrExpression(
528 LPSTR szModule,
529 LPSTR szSymbol,
530 LPWORD Selector,
531 PDWORD Offset,
532 LPWORD Type
533 )
534{
535 dprintf(("VDMDBG: " __FUNCTION__ "(%x, %x, %x, %x, %x) - stub\n",
536 szModule, szSymbol, Selector, Offset, Type));
537 return FALSE;
538}
Note: See TracBrowser for help on using the repository browser.