wineps: Stroke and fill GDI paths using Postscript paths.
[wine/multimedia.git] / dlls / mscoree / cordebug.c
blobc5342bce814326c3d402fc9440e5394a9ad75381
1 /*
3 * Copyright 2011 Alistair Leslie-Hughes
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #define COBJMACROS
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
27 #include "winuser.h"
28 #include "winnls.h"
29 #include "winreg.h"
30 #include "ole2.h"
31 #include "shellapi.h"
32 #include "mscoree.h"
33 #include "corhdr.h"
34 #include "metahost.h"
35 #include "cordebug.h"
36 #include "wine/list.h"
37 #include "mscoree_private.h"
38 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
43 static inline CorDebug *impl_from_ICorDebug( ICorDebug *iface )
45 return CONTAINING_RECORD(iface, CorDebug, ICorDebug_iface);
48 /*** IUnknown methods ***/
49 static HRESULT WINAPI CorDebug_QueryInterface(ICorDebug *iface, REFIID riid, void **ppvObject)
51 CorDebug *This = impl_from_ICorDebug( iface );
53 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
55 if ( IsEqualGUID( riid, &IID_ICorDebug ) ||
56 IsEqualGUID( riid, &IID_IUnknown ) )
58 *ppvObject = &This->ICorDebug_iface;
60 else
62 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
63 return E_NOINTERFACE;
66 ICorDebug_AddRef( iface );
68 return S_OK;
71 static ULONG WINAPI CorDebug_AddRef(ICorDebug *iface)
73 CorDebug *This = impl_from_ICorDebug( iface );
74 ULONG ref = InterlockedIncrement(&This->ref);
76 TRACE("%p ref=%u\n", This, ref);
78 return ref;
81 static ULONG WINAPI CorDebug_Release(ICorDebug *iface)
83 CorDebug *This = impl_from_ICorDebug( iface );
84 ULONG ref = InterlockedDecrement(&This->ref);
86 TRACE("%p ref=%u\n", This, ref);
88 if (ref == 0)
90 if(This->runtimehost)
91 ICLRRuntimeHost_Release(This->runtimehost);
93 if(This->pCallback)
94 ICorDebugManagedCallback2_Release(This->pCallback2);
96 if(This->pCallback)
97 ICorDebugManagedCallback_Release(This->pCallback);
99 HeapFree(GetProcessHeap(), 0, This);
102 return ref;
105 /*** ICorDebug methods ***/
106 static HRESULT WINAPI CorDebug_Initialize(ICorDebug *iface)
108 CorDebug *This = impl_from_ICorDebug( iface );
109 FIXME("stub %p\n", This);
110 return S_OK;
113 static HRESULT WINAPI CorDebug_Terminate(ICorDebug *iface)
115 CorDebug *This = impl_from_ICorDebug( iface );
116 FIXME("stub %p\n", This);
117 return E_NOTIMPL;
120 static HRESULT WINAPI CorDebug_SetManagedHandler(ICorDebug *iface, ICorDebugManagedCallback *pCallback)
122 CorDebug *This = impl_from_ICorDebug( iface );
123 HRESULT hr;
124 ICorDebugManagedCallback2 *pCallback2;
126 TRACE("%p (%p)\n", This, pCallback);
128 if(!pCallback)
129 return E_INVALIDARG;
131 hr = ICorDebugManagedCallback_QueryInterface(pCallback, &IID_ICorDebugManagedCallback2, (void**)&pCallback2);
132 if(hr == S_OK)
134 if(This->pCallback2)
135 ICorDebugManagedCallback2_Release(This->pCallback2);
137 if(This->pCallback)
138 ICorDebugManagedCallback_Release(This->pCallback);
140 This->pCallback = pCallback;
141 This->pCallback2 = pCallback2;
143 ICorDebugManagedCallback_AddRef(This->pCallback);
145 else
147 WARN("Debugging without interface ICorDebugManagedCallback2 is currently not supported.\n");
150 return hr;
153 static HRESULT WINAPI CorDebug_SetUnmanagedHandler(ICorDebug *iface, ICorDebugUnmanagedCallback *pCallback)
155 CorDebug *This = impl_from_ICorDebug( iface );
156 FIXME("stub %p %p\n", This, pCallback);
157 return E_NOTIMPL;
160 static HRESULT WINAPI CorDebug_CreateProcess(ICorDebug *iface, LPCWSTR lpApplicationName,
161 LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes,
162 LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles,
163 DWORD dwCreationFlags, PVOID lpEnvironment,LPCWSTR lpCurrentDirectory,
164 LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation,
165 CorDebugCreateProcessFlags debuggingFlags, ICorDebugProcess **ppProcess)
167 CorDebug *This = impl_from_ICorDebug( iface );
168 FIXME("stub %p %s %s %p %p %d %d %p %s %p %p %d %p\n", This, debugstr_w(lpApplicationName),
169 debugstr_w(lpCommandLine), lpProcessAttributes, lpThreadAttributes,
170 bInheritHandles, dwCreationFlags, lpEnvironment, debugstr_w(lpCurrentDirectory),
171 lpStartupInfo, lpProcessInformation, debuggingFlags, ppProcess);
172 return E_NOTIMPL;
175 static HRESULT WINAPI CorDebug_DebugActiveProcess(ICorDebug *iface, DWORD id, BOOL win32Attach,
176 ICorDebugProcess **ppProcess)
178 CorDebug *This = impl_from_ICorDebug( iface );
179 FIXME("stub %p %d %d %p\n", This, id, win32Attach, ppProcess);
180 return E_NOTIMPL;
183 static HRESULT WINAPI CorDebug_EnumerateProcesses( ICorDebug *iface, ICorDebugProcessEnum **ppProcess)
185 CorDebug *This = impl_from_ICorDebug( iface );
186 FIXME("stub %p %p\n", This, ppProcess);
187 return E_NOTIMPL;
190 static HRESULT WINAPI CorDebug_GetProcess(ICorDebug *iface, DWORD dwProcessId, ICorDebugProcess **ppProcess)
192 CorDebug *This = impl_from_ICorDebug( iface );
193 FIXME("stub %p %d %p\n", This, dwProcessId, ppProcess);
194 return E_NOTIMPL;
197 static HRESULT WINAPI CorDebug_CanLaunchOrAttach(ICorDebug *iface, DWORD dwProcessId,
198 BOOL win32DebuggingEnabled)
200 CorDebug *This = impl_from_ICorDebug( iface );
201 FIXME("stub %p %d %d\n", This, dwProcessId, win32DebuggingEnabled);
202 return E_NOTIMPL;
205 static const struct ICorDebugVtbl cordebug_vtbl =
207 CorDebug_QueryInterface,
208 CorDebug_AddRef,
209 CorDebug_Release,
210 CorDebug_Initialize,
211 CorDebug_Terminate,
212 CorDebug_SetManagedHandler,
213 CorDebug_SetUnmanagedHandler,
214 CorDebug_CreateProcess,
215 CorDebug_DebugActiveProcess,
216 CorDebug_EnumerateProcesses,
217 CorDebug_GetProcess,
218 CorDebug_CanLaunchOrAttach
221 HRESULT CorDebug_Create(ICLRRuntimeHost *runtimehost, IUnknown** ppUnk)
223 CorDebug *This;
225 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
226 if ( !This )
227 return E_OUTOFMEMORY;
229 This->ICorDebug_iface.lpVtbl = &cordebug_vtbl;
230 This->ref = 1;
231 This->pCallback = NULL;
232 This->pCallback2 = NULL;
233 This->runtimehost = runtimehost;
235 if(This->runtimehost)
236 ICLRRuntimeHost_AddRef(This->runtimehost);
238 *ppUnk = (IUnknown*)This;
240 return S_OK;