kernel32/tests: Better check the NT path returned by QueryFullProcessImageName().
[wine] / dlls / mscoree / cordebug.c
1 /*
2  *
3  * Copyright 2011 Alistair Leslie-Hughes
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #define COBJMACROS
21
22 #include <stdarg.h>
23
24 #include "windef.h"
25 #include "winbase.h"
26
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"
39
40
41 WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
42
43
44 static inline RuntimeHost *impl_from_ICorDebug( ICorDebug *iface )
45 {
46     return CONTAINING_RECORD(iface, RuntimeHost, ICorDebug_iface);
47 }
48
49 /*** IUnknown methods ***/
50 static HRESULT WINAPI CorDebug_QueryInterface(ICorDebug *iface, REFIID riid, void **ppvObject)
51 {
52     RuntimeHost *This = impl_from_ICorDebug( iface );
53
54     TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
55
56     if ( IsEqualGUID( riid, &IID_ICorDebug ) ||
57          IsEqualGUID( riid, &IID_IUnknown ) )
58     {
59         *ppvObject = &This->ICorDebug_iface;
60     }
61     else
62     {
63         FIXME("Unsupported interface %s\n", debugstr_guid(riid));
64         return E_NOINTERFACE;
65     }
66
67     ICorDebug_AddRef( iface );
68
69     return S_OK;
70 }
71
72 static ULONG WINAPI CorDebug_AddRef(ICorDebug *iface)
73 {
74     RuntimeHost *This = impl_from_ICorDebug( iface );
75     return ICorRuntimeHost_AddRef(&This->ICorRuntimeHost_iface);
76 }
77
78 static ULONG WINAPI CorDebug_Release(ICorDebug *iface)
79 {
80     RuntimeHost *This = impl_from_ICorDebug( iface );
81     return ICorRuntimeHost_Release(&This->ICorRuntimeHost_iface);
82 }
83
84 /*** ICorDebug methods ***/
85 static HRESULT WINAPI CorDebug_Initialize(ICorDebug *iface)
86 {
87     RuntimeHost *This = impl_from_ICorDebug( iface );
88     FIXME("stub %p\n", This);
89     return S_OK;
90 }
91
92 static HRESULT WINAPI CorDebug_Terminate(ICorDebug *iface)
93 {
94     RuntimeHost *This = impl_from_ICorDebug( iface );
95     FIXME("stub %p\n", This);
96     return E_NOTIMPL;
97 }
98
99 static HRESULT WINAPI CorDebug_SetManagedHandler(ICorDebug *iface, ICorDebugManagedCallback *pCallback)
100 {
101     RuntimeHost *This = impl_from_ICorDebug( iface );
102     FIXME("stub %p %p\n", This, pCallback);
103     return E_NOTIMPL;
104 }
105
106 static HRESULT WINAPI CorDebug_SetUnmanagedHandler(ICorDebug *iface, ICorDebugUnmanagedCallback *pCallback)
107 {
108     RuntimeHost *This = impl_from_ICorDebug( iface );
109     FIXME("stub %p %p\n", This, pCallback);
110     return E_NOTIMPL;
111 }
112
113 static HRESULT WINAPI CorDebug_CreateProcess(ICorDebug *iface, LPCWSTR lpApplicationName,
114             LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes,
115             LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles,
116             DWORD dwCreationFlags, PVOID lpEnvironment,LPCWSTR lpCurrentDirectory,
117             LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation,
118             CorDebugCreateProcessFlags debuggingFlags, ICorDebugProcess **ppProcess)
119 {
120     RuntimeHost *This = impl_from_ICorDebug( iface );
121     FIXME("stub %p %s %s %p %p %d %d %p %s %p %p %d %p\n", This, debugstr_w(lpApplicationName),
122             debugstr_w(lpCommandLine), lpProcessAttributes, lpThreadAttributes,
123             bInheritHandles, dwCreationFlags, lpEnvironment, debugstr_w(lpCurrentDirectory),
124             lpStartupInfo, lpProcessInformation, debuggingFlags, ppProcess);
125     return E_NOTIMPL;
126 }
127
128 static HRESULT WINAPI CorDebug_DebugActiveProcess(ICorDebug *iface, DWORD id, BOOL win32Attach,
129             ICorDebugProcess **ppProcess)
130 {
131     RuntimeHost *This = impl_from_ICorDebug( iface );
132     FIXME("stub %p %d %d %p\n", This, id, win32Attach, ppProcess);
133     return E_NOTIMPL;
134 }
135
136 static HRESULT WINAPI CorDebug_EnumerateProcesses( ICorDebug *iface, ICorDebugProcessEnum **ppProcess)
137 {
138     RuntimeHost *This = impl_from_ICorDebug( iface );
139     FIXME("stub %p %p\n", This, ppProcess);
140     return E_NOTIMPL;
141 }
142
143 static HRESULT WINAPI CorDebug_GetProcess(ICorDebug *iface, DWORD dwProcessId, ICorDebugProcess **ppProcess)
144 {
145     RuntimeHost *This = impl_from_ICorDebug( iface );
146     FIXME("stub %p %d %p\n", This, dwProcessId, ppProcess);
147     return E_NOTIMPL;
148 }
149
150 static HRESULT WINAPI CorDebug_CanLaunchOrAttach(ICorDebug *iface, DWORD dwProcessId,
151             BOOL win32DebuggingEnabled)
152 {
153     RuntimeHost *This = impl_from_ICorDebug( iface );
154     FIXME("stub %p %d %d\n", This, dwProcessId, win32DebuggingEnabled);
155     return E_NOTIMPL;
156 }
157
158 static const struct ICorDebugVtbl cordebug_vtbl =
159 {
160     CorDebug_QueryInterface,
161     CorDebug_AddRef,
162     CorDebug_Release,
163     CorDebug_Initialize,
164     CorDebug_Terminate,
165     CorDebug_SetManagedHandler,
166     CorDebug_SetUnmanagedHandler,
167     CorDebug_CreateProcess,
168     CorDebug_DebugActiveProcess,
169     CorDebug_EnumerateProcesses,
170     CorDebug_GetProcess,
171     CorDebug_CanLaunchOrAttach
172 };
173
174 void cordebug_init(RuntimeHost *This)
175 {
176     This->ICorDebug_iface.lpVtbl = &cordebug_vtbl;
177 }