Add the ContextMenuHandlers key for shortcuts so the new context menu
[wine/multimedia.git] / dlls / ntdll / debugbuffer.c
blob9e251e59fdb648c812d561871be576d6b4002543
1 /*
2 * NtDll debug buffer functions
4 * Copyright 2004 Raphael Junqueira
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.
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.
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
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include <stdarg.h>
25 #include <stdlib.h>
26 #include <string.h>
28 #include "windef.h"
29 #include "winnt.h"
30 #include "winternl.h"
31 #include "ntdll_misc.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(debug_buffer);
36 static void dump_DEBUG_MODULE_INFORMATION(PDEBUG_MODULE_INFORMATION iBuf)
38 TRACE( "MODULE_INFORMATION:%p\n", iBuf );
39 if (NULL == iBuf) return ;
40 TRACE( "Base:%ld\n", iBuf->Base );
41 TRACE( "Size:%ld\n", iBuf->Size );
42 TRACE( "Flags:%ld\n", iBuf->Flags );
45 static void dump_DEBUG_HEAP_INFORMATION(PDEBUG_HEAP_INFORMATION iBuf)
47 TRACE( "HEAP_INFORMATION:%p\n", iBuf );
48 if (NULL == iBuf) return ;
49 TRACE( "Base:%ld\n", iBuf->Base );
50 TRACE( "Flags:%ld\n", iBuf->Flags );
53 static void dump_DEBUG_LOCK_INFORMATION(PDEBUG_LOCK_INFORMATION iBuf)
55 TRACE( "LOCK_INFORMATION:%p\n", iBuf );
57 if (NULL == iBuf) return ;
59 TRACE( "Address:%p\n", iBuf->Address );
60 TRACE( "Type:%d\n", iBuf->Type );
61 TRACE( "CreatorBackTraceIndex:%d\n", iBuf->CreatorBackTraceIndex );
62 TRACE( "OwnerThreadId:%ld\n", iBuf->OwnerThreadId );
63 TRACE( "ActiveCount:%ld\n", iBuf->ActiveCount );
64 TRACE( "ContentionCount:%ld\n", iBuf->ContentionCount );
65 TRACE( "EntryCount:%ld\n", iBuf->EntryCount );
66 TRACE( "RecursionCount:%ld\n", iBuf->RecursionCount );
67 TRACE( "NumberOfSharedWaiters:%ld\n", iBuf->NumberOfSharedWaiters );
68 TRACE( "NumberOfExclusiveWaiters:%ld\n", iBuf->NumberOfExclusiveWaiters );
71 static void dump_DEBUG_BUFFER(PDEBUG_BUFFER iBuf)
73 if (NULL == iBuf) return ;
74 TRACE( "SectionHandle:%p\n", iBuf->SectionHandle);
75 TRACE( "SectionBase:%p\n", iBuf->SectionBase);
76 TRACE( "RemoteSectionBase:%p\n", iBuf->RemoteSectionBase);
77 TRACE( "SectionBaseDelta:%ld\n", iBuf->SectionBaseDelta);
78 TRACE( "EventPairHandle:%p\n", iBuf->EventPairHandle);
79 TRACE( "RemoteThreadHandle:%p\n", iBuf->RemoteThreadHandle);
80 TRACE( "InfoClassMask:%lx\n", iBuf->InfoClassMask);
81 TRACE( "SizeOfInfo:%ld\n", iBuf->SizeOfInfo);
82 TRACE( "AllocatedSize:%ld\n", iBuf->AllocatedSize);
83 TRACE( "SectionSize:%ld\n", iBuf->SectionSize);
84 TRACE( "BackTraceInfo:%p\n", iBuf->BackTraceInformation);
85 dump_DEBUG_MODULE_INFORMATION(iBuf->ModuleInformation);
86 dump_DEBUG_HEAP_INFORMATION(iBuf->HeapInformation);
87 dump_DEBUG_LOCK_INFORMATION(iBuf->LockInformation);
90 PDEBUG_BUFFER WINAPI RtlCreateQueryDebugBuffer(IN ULONG iSize, IN BOOLEAN iEventPair)
92 PDEBUG_BUFFER oBuf = NULL;
93 FIXME("(%ld, %d): stub\n", iSize, iEventPair);
94 if (iSize < sizeof(DEBUG_BUFFER)) {
95 iSize = sizeof(DEBUG_BUFFER);
97 oBuf = (PDEBUG_BUFFER) RtlAllocateHeap(GetProcessHeap(), 0, iSize);
98 memset(oBuf, 0, iSize);
99 FIXME("(%ld, %d): returning %p\n", iSize, iEventPair, oBuf);
100 return oBuf;
103 NTSTATUS WINAPI RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER iBuf)
105 NTSTATUS nts = STATUS_SUCCESS;
106 FIXME("(%p): stub\n", iBuf);
107 if (NULL != iBuf) {
108 if (NULL != iBuf->ModuleInformation) RtlFreeHeap(GetProcessHeap(), 0, iBuf->ModuleInformation);
109 if (NULL != iBuf->HeapInformation) RtlFreeHeap(GetProcessHeap(), 0, iBuf->HeapInformation);
110 if (NULL != iBuf->LockInformation) RtlFreeHeap(GetProcessHeap(), 0, iBuf->LockInformation);
111 RtlFreeHeap(GetProcessHeap(), 0, iBuf);
113 return nts;
116 NTSTATUS WINAPI RtlQueryProcessDebugInformation(IN ULONG iProcessId, IN ULONG iDebugInfoMask, IN OUT PDEBUG_BUFFER iBuf)
118 NTSTATUS nts = STATUS_SUCCESS;
119 FIXME("(%ld, %lx, %p): stub\n", iProcessId, iDebugInfoMask, iBuf);
120 iBuf->InfoClassMask = iDebugInfoMask;
122 if (iDebugInfoMask & PDI_MODULES) {
123 PDEBUG_MODULE_INFORMATION info = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(DEBUG_MODULE_INFORMATION));
124 memset(info, 0, sizeof(DEBUG_MODULE_INFORMATION));
125 iBuf->ModuleInformation = info;
127 if (iDebugInfoMask & PDI_HEAPS) {
128 PDEBUG_HEAP_INFORMATION info = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(DEBUG_HEAP_INFORMATION));
129 memset(info, 0, sizeof(DEBUG_HEAP_INFORMATION));
130 if (iDebugInfoMask & PDI_HEAP_TAGS) {
132 if (iDebugInfoMask & PDI_HEAP_BLOCKS) {
134 iBuf->HeapInformation = info;
136 if (iDebugInfoMask & PDI_LOCKS) {
137 PDEBUG_LOCK_INFORMATION info = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(DEBUG_LOCK_INFORMATION));
138 memset(info, 0, sizeof(DEBUG_LOCK_INFORMATION));
139 iBuf->LockInformation = info;
141 TRACE("returns:%p\n", iBuf);
142 dump_DEBUG_BUFFER(iBuf);
143 return nts;