1 #include "stdafx.h"
2 
3 namespace
4 {
5 	using namespace MSTSCLib;
6 
7 	typedef HRESULT (STDAPICALLTYPE * PFNDLLGETCLASSOBJECT)(IN REFCLSID rclsid, IN REFIID riid, OUT LPVOID FAR * ppv);
8 	typedef HRESULT (STDAPICALLTYPE * PFNDLLCANUNLOADNOW)(void);
9 	typedef ULONG (STDAPICALLTYPE * PFNDLLGETTSCCTLVER)(void);
10 
11 	PFNDLLGETCLASSOBJECT pfnDllGetClassObject = NULL;
12 	PFNDLLCANUNLOADNOW pfnDllCanUnloadNow = NULL;
13 	PFNDLLGETTSCCTLVER pfnDllGetTscCtlVer = NULL;
14 
15 	HMODULE hmMstscax = NULL;
16 
17 	extern "C" char __ImageBase;
18 	static const HMODULE hmSelf = reinterpret_cast<HMODULE>(&__ImageBase);
19 
init()20 	void init()
21 	{
22 		if(hmMstscax)
23 			return;
24 
25 		TCHAR szFileName[MAX_PATH + 1];
26 		GetModuleFileName(hmSelf, szFileName, MAX_PATH);
27 
28 		std::basic_string<TCHAR> strFileName(&szFileName[0]);
29 		std::reverse_iterator<std::basic_string<TCHAR>::const_iterator > begin(strFileName.end());
30 		std::reverse_iterator<std::basic_string<TCHAR>::const_iterator > end(strFileName.begin());
31 		std::basic_string<TCHAR>::const_iterator endPath = std::find(begin, end, TEXT('\\')).base();
32 
33 		std::basic_string<TCHAR> strPath(strFileName.begin(), endPath);
34 		strPath.append(TEXT("original\\mstscax.dll"));
35 
36 		hmMstscax = LoadLibrary(strPath.c_str());
37 		pfnDllGetClassObject = (PFNDLLGETCLASSOBJECT)GetProcAddress(hmMstscax, "DllGetClassObject");
38 		pfnDllCanUnloadNow = (PFNDLLCANUNLOADNOW)GetProcAddress(hmMstscax, "DllCanUnloadNow");
39 		pfnDllGetTscCtlVer = (PFNDLLGETTSCCTLVER)GetProcAddress(hmMstscax, "DllGetTscCtlVer");
40 	}
41 
dbgprintf(LPCTSTR fmt,...)42 	void dbgprintf(LPCTSTR fmt, ...)
43 	{
44 		TCHAR buf[0x1000];
45 
46 		va_list args;
47 		va_start(args, fmt);
48 		StringCbVPrintf(buf, sizeof(buf), fmt, args);
49 		va_end(args);
50 
51 		StringCbCat(buf, sizeof(buf), TEXT("\n"));
52 
53 		OutputDebugString(buf);
54 	}
55 
56 #if 0
57 	const IID MsTscAxIIDs[] =
58 	{
59 		IID_IMsRdpClient,
60 		IID_IMsTscAx,
61 		//IID_IMsTscAxEvents,
62 		IID_IMsTscNonScriptable,
63 		IID_IMsRdpClientNonScriptable,
64 	};
65 
66 	const IID MsRdpClient[] =
67 	{
68 		IID_IMsRdpClient,
69 		IID_IMsTscAx,
70 		//IID_IMsTscAxEvents,
71 		IID_IMsTscNonScriptable,
72 		IID_IMsRdpClientNonScriptable,
73 	};
74 
75 	const IID MsRdpClient2[] =
76 	{
77 		IID_IMsRdpClient2,
78 		IID_IMsRdpClient,
79 		IID_IMsTscAx,
80 		//IID_IMsTscAxEvents,
81 		IID_IMsTscNonScriptable,
82 		IID_IMsRdpClientNonScriptable,
83 	};
84 
85 	const IID MsRdpClient3[] =
86 	{
87 		IID_IMsRdpClient3,
88 		IID_IMsRdpClient2,
89 		IID_IMsRdpClient,
90 		IID_IMsTscAx,
91 		//IID_IMsTscAxEvents,
92 		IID_IMsTscNonScriptable,
93 		IID_IMsRdpClientNonScriptable,
94 	};
95 
96 	const IID MsRdpClient4[] =
97 	{
98 		IID_IMsRdpClient4,
99 		IID_IMsRdpClient3,
100 		IID_IMsRdpClient2,
101 		IID_IMsRdpClient,
102 		IID_IMsTscAx,
103 		//IID_IMsTscAxEvents,
104 		IID_IMsTscNonScriptable,
105 		IID_IMsRdpClientNonScriptable,
106 		IID_IMsRdpClientNonScriptable2,
107 	};
108 #endif
109 
UUIDToString(const UUID & uuid)110 	std::wstring UUIDToString(const UUID& uuid)
111 	{
112 		std::wstring s;
113 		LPOLESTR str;
114 		StringFromCLSID(uuid, &str);
115 		s += str;
116 		CoTaskMemFree(str);
117 		return s;
118 	}
119 
MonikerToString(IMoniker * pmk)120 	std::wstring MonikerToString(IMoniker * pmk)
121 	{
122 		LPOLESTR pszName = NULL;
123 
124 		if(SUCCEEDED(pmk->GetDisplayName(NULL, NULL, &pszName)))
125 		{
126 			std::wstring s(pszName);
127 			CoTaskMemFree(pszName);
128 			return s;
129 		}
130 		else
131 			return std::wstring(L"<error>");
132 	}
133 
RectToString(const RECT & rc)134 	std::basic_string<TCHAR> RectToString(const RECT& rc)
135 	{
136 		if(&rc == NULL)
137 			return TEXT("<null>");
138 
139 		std::basic_ostringstream<TCHAR> o;
140 		o << "{" << " left:" << rc.left << " top:" << rc.top << " right:" << rc.right << " bottom:" << rc.bottom << " }";
141 		return o.str();
142 	}
143 
RectToString(const RECTL & rc)144 	std::basic_string<TCHAR> RectToString(const RECTL& rc)
145 	{
146 		if(&rc == NULL)
147 			return TEXT("<null>");
148 
149 		std::basic_ostringstream<TCHAR> o;
150 		o << "{" << " left:" << rc.left << " top:" << rc.top << " right:" << rc.right << " bottom:" << rc.bottom << " }";
151 		return o.str();
152 	}
153 
SizeToString(const SIZE & sz)154 	std::basic_string<TCHAR> SizeToString(const SIZE& sz)
155 	{
156 		if(&sz == NULL)
157 			return TEXT("<null>");
158 
159 		std::basic_ostringstream<TCHAR> o;
160 		o << "{ " << " cx:" << sz.cx << " cy:" << sz.cy << " }";
161 		return o.str();
162 	}
163 
BooleanToString(const T & X)164 	template<class T> LPCTSTR BooleanToString(const T& X)
165 	{
166 		return X ? TEXT("true") : TEXT("false");
167 	}
168 
VariantToString(const VARIANT & var)169 	std::basic_string<TCHAR> VariantToString(const VARIANT& var)
170 	{
171 		std::basic_ostringstream<TCHAR> o;
172 
173 		switch(var.vt & VT_TYPEMASK)
174 		{
175 		case VT_EMPTY:           o << "<empty>"; break;
176 		case VT_NULL:            o << "<null>"; break;
177 		case VT_I2:              o << "short"; break;
178 		case VT_I4:              o << "long"; break;
179 		case VT_R4:              o << "float"; break;
180 		case VT_R8:              o << "double"; break;
181 		case VT_CY:              o << "CURRENCY"; break;
182 		case VT_DATE:            o << "DATE"; break;
183 		case VT_BSTR:            o << "string"; break;
184 		case VT_DISPATCH:        o << "IDispatch *"; break;
185 		case VT_ERROR:           o << "SCODE"; break;
186 		case VT_BOOL:            o << "bool"; break;
187 		case VT_VARIANT:         o << "VARIANT *"; break;
188 		case VT_UNKNOWN:         o << "IUnknown *"; break;
189 		case VT_DECIMAL:         o << "DECIMAL"; break;
190 		case VT_I1:              o << "char"; break;
191 		case VT_UI1:             o << "unsigned char"; break;
192 		case VT_UI2:             o << "unsigned short"; break;
193 		case VT_UI4:             o << "unsigned long"; break;
194 		case VT_I8:              o << "long long"; break;
195 		case VT_UI8:             o << "unsigned long long"; break;
196 		case VT_INT:             o << "int"; break;
197 		case VT_UINT:            o << "unsigned int"; break;
198 		case VT_VOID:            o << "void"; break;
199 		case VT_HRESULT:         o << "HRESULT"; break;
200 		case VT_PTR:             o << "void *"; break;
201 		case VT_SAFEARRAY:       o << "SAFEARRAY *"; break;
202 		case VT_LPSTR:           o << "LPSTR"; break;
203 		case VT_LPWSTR:          o << "LPWSTR"; break;
204 		case VT_RECORD:          o << "struct { }"; break;
205 		case VT_INT_PTR:         o << "intptr_t"; break;
206 		case VT_UINT_PTR:        o << "uintptr_t"; break;
207 		case VT_FILETIME:        o << "FILETIME"; break;
208 		default:                 o << "???"; break;
209 		}
210 
211 		if(var.vt & VT_ARRAY)
212 			o << "[]";
213 		else if(var.vt & VT_BYREF)
214 			o << " *";
215 		else
216 		{
217 			switch(var.vt & VT_TYPEMASK)
218 			{
219 			case VT_EMPTY:
220 			case VT_NULL:
221 			case VT_RECORD:
222 			case VT_VOID:
223 
224 				// TODO
225 			case VT_CY:
226 			case VT_DATE:
227 			case VT_DECIMAL:
228 			case VT_FILETIME:
229 				break;
230 
231 			default:
232 				o << " = ";
233 			}
234 
235 			switch(var.vt & VT_TYPEMASK)
236 			{
237 			case VT_I2:       o << var.iVal; break;
238 			case VT_I4:       o << var.lVal; break;
239 			case VT_R4:       o << var.fltVal; break;
240 			case VT_R8:       o << var.dblVal; break;
241 			case VT_BSTR:     o << std::wstring(var.bstrVal, var.bstrVal + SysStringLen(var.bstrVal)); break;
242 			case VT_BOOL:     o << var.boolVal ? "true" : "false"; break;
243 			case VT_I1:       o << int(var.cVal); break;
244 			case VT_UI1:      o << unsigned int(var.bVal); break;
245 			case VT_UI2:      o << var.uiVal; break;
246 			case VT_UI4:      o << var.ulVal; break;
247 			case VT_I8:       o << var.llVal; break;
248 			case VT_UI8:      o << var.ullVal; break;
249 			case VT_INT:      o << var.intVal; break;
250 			case VT_UINT:     o << var.uintVal; break;
251 			case VT_LPSTR:    o << LPSTR(var.byref); break;
252 			case VT_LPWSTR:   o << LPWSTR(var.byref); break;
253 			case VT_INT_PTR:  o << var.intVal; break; // BUGBUG
254 			case VT_UINT_PTR: o << var.uintVal; break; // BUGBUG
255 
256 			case VT_DISPATCH:
257 			case VT_VARIANT:
258 			case VT_UNKNOWN:
259 			case VT_PTR:
260 			case VT_SAFEARRAY:
261 			case VT_RECORD:
262 				o << var.byref; break;
263 
264 			case VT_ERROR:
265 			case VT_HRESULT:
266 				o << std::hex << var.ulVal; break;
267 
268 			case VT_EMPTY:
269 			case VT_NULL:
270 			case VT_VOID:
271 				break;
272 
273 			default:
274 				assert(0);
275 			}
276 		}
277 
278 		return o.str();
279 	}
280 
281 #pragma warning(disable:4584)
282 
283 	IConnectionPointContainer * HookIConnectionPointContainer(IConnectionPointContainer * p);
284 	IEnumConnectionPoints * HookIEnumConnectionPoints(IEnumConnectionPoints * p);
285 	IConnectionPoint * HookIConnectionPoint(IConnectionPoint * p);
286 	IEnumConnections * HookIEnumConnections(IEnumConnections * p);
287 
288 	class CConnectionPointContainer: public IConnectionPointContainer
289 	{
290 	private:
291 		LONG m_refCount;
292 		IConnectionPointContainer * m_IConnectionPointContainer;
293 
294 	public:
CConnectionPointContainer(IConnectionPointContainer * pIConnectionPointContainer)295 		CConnectionPointContainer(IConnectionPointContainer * pIConnectionPointContainer):
296 			m_refCount(1),
297 			m_IConnectionPointContainer(pIConnectionPointContainer)
298 		{ }
299 
~CConnectionPointContainer()300 		~CConnectionPointContainer() { m_IConnectionPointContainer->Release(); }
301 
QueryInterface(REFIID riid,void ** ppvObject)302 		virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void ** ppvObject)
303 		{
304 			HRESULT hr = S_OK;
305 
306 			dbgprintf(TEXT("CConnectionPointContainer::QueryInterface(%ls, %p)"), UUIDToString(riid).c_str(), ppvObject);
307 
308 			if(riid == IID_IUnknown || riid == IID_IConnectionPointContainer)
309 				*ppvObject = this;
310 			else
311 			{
312 				*ppvObject = NULL;
313 				hr = E_NOINTERFACE;
314 			}
315 
316 			dbgprintf(TEXT("CConnectionPointContainer::QueryInterface -> %08X, ppvObject = %p"), hr, *ppvObject);
317 			return hr;
318 		}
319 
AddRef(void)320 		virtual ULONG STDMETHODCALLTYPE AddRef(void)
321 		{
322 			return InterlockedIncrement(&m_refCount);
323 		}
324 
Release(void)325 		virtual ULONG STDMETHODCALLTYPE Release(void)
326 		{
327 			LONG n = InterlockedDecrement(&m_refCount);
328 
329 			if(n == 0)
330 				delete this;
331 
332 			return n;
333 		}
334 
EnumConnectionPoints(IEnumConnectionPoints ** ppEnum)335         virtual HRESULT STDMETHODCALLTYPE EnumConnectionPoints(IEnumConnectionPoints ** ppEnum)
336 		{
337 			dbgprintf(TEXT("CConnectionPointContainer::EnumConnectionPoints(%p)"), ppEnum);
338 			HRESULT hr = m_IConnectionPointContainer->EnumConnectionPoints(ppEnum);
339 			dbgprintf(TEXT("CConnectionPointContainer::EnumConnectionPoints -> %08X, pEnum = %p"), hr, *ppEnum);
340 
341 			if(SUCCEEDED(hr))
342 				*ppEnum = HookIEnumConnectionPoints(*ppEnum);
343 
344 			return hr;
345 		}
346 
FindConnectionPoint(REFIID riid,IConnectionPoint ** ppCP)347 		virtual HRESULT STDMETHODCALLTYPE FindConnectionPoint(REFIID riid, IConnectionPoint ** ppCP)
348 		{
349 			dbgprintf(TEXT("CConnectionPointContainer::FindConnectionPoint(%ls, %p)"), UUIDToString(riid).c_str(), ppCP);
350 			HRESULT hr = m_IConnectionPointContainer->FindConnectionPoint(riid, ppCP);
351 			dbgprintf(TEXT("CConnectionPointContainer::FindConnectionPoint -> %08X, pCP = %p"), hr, *ppCP);
352 
353 			if(SUCCEEDED(hr))
354 				*ppCP = HookIConnectionPoint(*ppCP);
355 
356 			return hr;
357 		}
358 	};
359 
360 	class CEnumConnectionPoints: public IEnumConnectionPoints
361 	{
362 	private:
363 		LONG m_refCount;
364 		IEnumConnectionPoints * m_IEnumConnectionPoints;
365 
366 	public:
CEnumConnectionPoints(IEnumConnectionPoints * pIEnumConnectionPoints)367 		CEnumConnectionPoints(IEnumConnectionPoints * pIEnumConnectionPoints):
368 			m_refCount(1),
369 			m_IEnumConnectionPoints(pIEnumConnectionPoints)
370 		{ }
371 
~CEnumConnectionPoints()372 		~CEnumConnectionPoints() { m_IEnumConnectionPoints->Release(); }
373 
QueryInterface(REFIID riid,void ** ppvObject)374 		virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void ** ppvObject)
375 		{
376 			HRESULT hr = S_OK;
377 
378 			dbgprintf(TEXT("CEnumConnectionPoints::QueryInterface(%ls, %p)"), UUIDToString(riid).c_str(), ppvObject);
379 
380 			if(riid == IID_IUnknown || riid == IID_IEnumConnectionPoints)
381 				*ppvObject = this;
382 			else
383 			{
384 				*ppvObject = NULL;
385 				hr = E_NOINTERFACE;
386 			}
387 
388 			dbgprintf(TEXT("CEnumConnectionPoints::QueryInterface -> %08X, ppvObject = %p"), hr, *ppvObject);
389 			return hr;
390 		}
391 
AddRef(void)392 		virtual ULONG STDMETHODCALLTYPE AddRef(void)
393 		{
394 			return InterlockedIncrement(&m_refCount);
395 		}
396 
Release(void)397 		virtual ULONG STDMETHODCALLTYPE Release(void)
398 		{
399 			LONG n = InterlockedDecrement(&m_refCount);
400 
401 			if(n == 0)
402 				delete this;
403 
404 			return n;
405 		}
406 
Next(ULONG cConnections,LPCONNECTIONPOINT * ppCP,ULONG * pcFetched)407         virtual HRESULT STDMETHODCALLTYPE Next(ULONG cConnections, LPCONNECTIONPOINT * ppCP, ULONG * pcFetched)
408 		{
409 			dbgprintf(TEXT("CEnumConnectionPoints::Next(%lu, %p, %p)"), cConnections, ppCP, pcFetched);
410 			HRESULT hr = m_IEnumConnectionPoints->Next(cConnections, ppCP, pcFetched);
411 			dbgprintf(TEXT("CEnumConnectionPoints:: -> %08X, pCP = %p, cFetched = %lu"), hr, *ppCP, *pcFetched);
412 
413 			if(SUCCEEDED(hr))
414 				*ppCP = HookIConnectionPoint(*ppCP);
415 
416 			return hr;
417 		}
418 
Skip(ULONG cConnections)419         virtual HRESULT STDMETHODCALLTYPE Skip(ULONG cConnections)
420 		{
421 			dbgprintf(TEXT("CEnumConnectionPoints::Skip(%lu)"), cConnections);
422 			HRESULT hr = m_IEnumConnectionPoints->Skip(cConnections);
423 			dbgprintf(TEXT("CEnumConnectionPoints:: -> %08X"), hr);
424 			return hr;
425 		}
426 
Reset(void)427         virtual HRESULT STDMETHODCALLTYPE Reset(void)
428 		{
429 			dbgprintf(TEXT("CEnumConnectionPoints::Reset()"));
430 			HRESULT hr = m_IEnumConnectionPoints->Reset();
431 			dbgprintf(TEXT("CEnumConnectionPoints:: -> %08X"), hr);
432 			return hr;
433 		}
434 
Clone(IEnumConnectionPoints ** ppEnum)435         virtual HRESULT STDMETHODCALLTYPE Clone(IEnumConnectionPoints ** ppEnum)
436 		{
437 			dbgprintf(TEXT("CEnumConnectionPoints::Clone(%p)"), ppEnum);
438 			HRESULT hr = m_IEnumConnectionPoints->Clone(ppEnum);
439 			dbgprintf(TEXT("CEnumConnectionPoints:: -> %08X, pEnum"), hr, *ppEnum);
440 
441 			if(SUCCEEDED(hr))
442 				*ppEnum = HookIEnumConnectionPoints(*ppEnum);
443 
444 			return hr;
445 		}
446 	};
447 
448 	class CConnectionPoint: public IConnectionPoint
449 	{
450 	private:
451 		LONG m_refCount;
452 		IConnectionPoint * m_IConnectionPoint;
453 
454 	public:
CConnectionPoint(IConnectionPoint * pIConnectionPoint)455 		CConnectionPoint(IConnectionPoint * pIConnectionPoint):
456 			m_refCount(1),
457 			m_IConnectionPoint(pIConnectionPoint)
458 		{ }
459 
~CConnectionPoint()460 		~CConnectionPoint() { m_IConnectionPoint->Release(); }
461 
QueryInterface(REFIID riid,void ** ppvObject)462 		virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void ** ppvObject)
463 		{
464 			HRESULT hr = S_OK;
465 
466 			dbgprintf(TEXT("CConnectionPoint::QueryInterface(%ls, %p)"), UUIDToString(riid).c_str(), ppvObject);
467 
468 			if(riid == IID_IUnknown || riid == IID_IConnectionPoint)
469 				*ppvObject = this;
470 			else
471 			{
472 				*ppvObject = NULL;
473 				hr = E_NOINTERFACE;
474 			}
475 
476 			dbgprintf(TEXT("CConnectionPoint::QueryInterface -> %08X, ppvObject = %p"), hr, *ppvObject);
477 			return hr;
478 		}
479 
AddRef(void)480 		virtual ULONG STDMETHODCALLTYPE AddRef(void)
481 		{
482 			return InterlockedIncrement(&m_refCount);
483 		}
484 
Release(void)485 		virtual ULONG STDMETHODCALLTYPE Release(void)
486 		{
487 			LONG n = InterlockedDecrement(&m_refCount);
488 
489 			if(n == 0)
490 				delete this;
491 
492 			return n;
493 		}
494 
GetConnectionInterface(IID * pIID)495 		virtual HRESULT STDMETHODCALLTYPE GetConnectionInterface(IID * pIID)
496 		{
497 			dbgprintf(TEXT("CConnectionPoint::GetConnectionInterface(%p)"), pIID);
498 			HRESULT hr = m_IConnectionPoint->GetConnectionInterface(pIID);
499 			dbgprintf(TEXT("CConnectionPoint::GetConnectionInterface -> %08X, IID = %ls"), hr, UUIDToString(*pIID).c_str());
500 			return hr;
501 		}
502 
GetConnectionPointContainer(IConnectionPointContainer ** ppCPC)503 		virtual HRESULT STDMETHODCALLTYPE GetConnectionPointContainer(IConnectionPointContainer ** ppCPC)
504 		{
505 			dbgprintf(TEXT("CConnectionPoint::GetConnectionPointContainer(%p)"), ppCPC);
506 			HRESULT hr = m_IConnectionPoint->GetConnectionPointContainer(ppCPC);
507 			dbgprintf(TEXT("CConnectionPoint::GetConnectionPointContainer -> %08X, pCPC = %p"), hr, *ppCPC);
508 
509 			if(SUCCEEDED(hr))
510 				*ppCPC = HookIConnectionPointContainer(*ppCPC);
511 
512 			return hr;
513 		}
514 
Advise(IUnknown * pUnkSink,DWORD * pdwCookie)515 		virtual HRESULT STDMETHODCALLTYPE Advise(IUnknown * pUnkSink, DWORD * pdwCookie)
516 		{
517 			dbgprintf(TEXT("CConnectionPoint::Advise(%p, %p)"), pUnkSink, pdwCookie);
518 			HRESULT hr = m_IConnectionPoint->Advise(pUnkSink, pdwCookie);
519 			dbgprintf(TEXT("CConnectionPoint::Advise -> %08X, dwCookie = %lu"), hr, *pdwCookie);
520 			// TODO: hook sink
521 			return hr;
522 		}
523 
Unadvise(DWORD dwCookie)524 		virtual HRESULT STDMETHODCALLTYPE Unadvise(DWORD dwCookie)
525 		{
526 			dbgprintf(TEXT("CConnectionPoint::Unadvise(%lu)"), dwCookie);
527 			HRESULT hr = m_IConnectionPoint->Unadvise(dwCookie);
528 			dbgprintf(TEXT("CConnectionPoint::Unadvise -> %08X"), hr);
529 			return hr;
530 		}
531 
EnumConnections(IEnumConnections ** ppEnum)532 		virtual HRESULT STDMETHODCALLTYPE EnumConnections(IEnumConnections ** ppEnum)
533 		{
534 			dbgprintf(TEXT("CConnectionPoint::EnumConnections(%p)"), ppEnum);
535 			HRESULT hr = m_IConnectionPoint->EnumConnections(ppEnum);
536 			dbgprintf(TEXT("CConnectionPoint::EnumConnections -> %08X, pEnum = %p"), hr, *ppEnum);
537 
538 			if(SUCCEEDED(hr))
539 				*ppEnum = HookIEnumConnections(*ppEnum);
540 
541 			return hr;
542 		}
543 	};
544 
545 	class CEnumConnections: public IEnumConnections
546 	{
547 	private:
548 		LONG m_refCount;
549 		IEnumConnections * m_IEnumConnections;
550 
551 	public:
CEnumConnections(IEnumConnections * pIEnumConnections)552 		CEnumConnections(IEnumConnections * pIEnumConnections):
553 			m_refCount(1),
554 			m_IEnumConnections(pIEnumConnections)
555 		{ }
556 
~CEnumConnections()557 		~CEnumConnections() { m_IEnumConnections->Release(); }
558 
QueryInterface(REFIID riid,void ** ppvObject)559 		virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void ** ppvObject)
560 		{
561 			HRESULT hr = S_OK;
562 
563 			dbgprintf(TEXT("CEnumConnections::QueryInterface(%ls, %p)"), UUIDToString(riid).c_str(), ppvObject);
564 
565 			if(riid == IID_IUnknown || riid == IID_IEnumConnections)
566 				*ppvObject = this;
567 			else
568 			{
569 				*ppvObject = NULL;
570 				hr = E_NOINTERFACE;
571 			}
572 
573 			dbgprintf(TEXT("CEnumConnections::QueryInterface -> %08X, ppvObject = %p"), hr, *ppvObject);
574 			return hr;
575 		}
576 
AddRef(void)577 		virtual ULONG STDMETHODCALLTYPE AddRef(void)
578 		{
579 			return InterlockedIncrement(&m_refCount);
580 		}
581 
Release(void)582 		virtual ULONG STDMETHODCALLTYPE Release(void)
583 		{
584 			LONG n = InterlockedDecrement(&m_refCount);
585 
586 			if(n == 0)
587 				delete this;
588 
589 			return n;
590 		}
591 
Next(ULONG cConnections,LPCONNECTDATA pCD,ULONG * pcFetched)592 		virtual HRESULT STDMETHODCALLTYPE Next(ULONG cConnections, LPCONNECTDATA pCD, ULONG * pcFetched)
593 		{
594 			dbgprintf(TEXT("CEnumConnections::Next(%lu, %p, %p)"), cConnections, pCD, pcFetched);
595 			HRESULT hr = m_IEnumConnections->Next(cConnections, pCD, pcFetched);
596 			dbgprintf(TEXT("CEnumConnections:: -> %08X, CD = { pUnk = %p, dwCookie = %lu }, cFetched = %lu"), hr, pCD->pUnk, pCD->dwCookie, *pcFetched);
597 			return hr;
598 		}
599 
Skip(ULONG cConnections)600         virtual HRESULT STDMETHODCALLTYPE Skip(ULONG cConnections)
601 		{
602 			dbgprintf(TEXT("CEnumConnections::Skip(%lu)"), cConnections);
603 			HRESULT hr = m_IEnumConnections->Skip(cConnections);
604 			dbgprintf(TEXT("CEnumConnections:: -> %08X"), hr);
605 			return hr;
606 		}
607 
Reset(void)608         virtual HRESULT STDMETHODCALLTYPE Reset(void)
609 		{
610 			dbgprintf(TEXT("CEnumConnections::Reset()"));
611 			HRESULT hr = m_IEnumConnections->Reset();
612 			dbgprintf(TEXT("CEnumConnections:: -> %08X"), hr);
613 			return hr;
614 		}
615 
Clone(IEnumConnections ** ppEnum)616         virtual HRESULT STDMETHODCALLTYPE Clone(IEnumConnections ** ppEnum)
617 		{
618 			dbgprintf(TEXT("CEnumConnections::Clone(%p)"), ppEnum);
619 			HRESULT hr = m_IEnumConnections->Clone(ppEnum);
620 			dbgprintf(TEXT("CEnumConnections:: -> %08X, pEnum"), hr, *ppEnum);
621 
622 			if(SUCCEEDED(hr))
623 				*ppEnum = HookIEnumConnections(*ppEnum);
624 
625 			return hr;
626 		}
627 	};
628 
HookIConnectionPointContainer(IConnectionPointContainer * p)629 	IConnectionPointContainer * HookIConnectionPointContainer(IConnectionPointContainer * p)
630 	{
631 		return new CConnectionPointContainer(p);
632 	}
633 
HookIEnumConnectionPoints(IEnumConnectionPoints * p)634 	IEnumConnectionPoints * HookIEnumConnectionPoints(IEnumConnectionPoints * p)
635 	{
636 		return new CEnumConnectionPoints(p);
637 	}
638 
HookIConnectionPoint(IConnectionPoint * p)639 	IConnectionPoint * HookIConnectionPoint(IConnectionPoint * p)
640 	{
641 		return new CConnectionPoint(p);
642 	}
643 
HookIEnumConnections(IEnumConnections * p)644 	IEnumConnections * HookIEnumConnections(IEnumConnections * p)
645 	{
646 		return new CEnumConnections(p);
647 	}
648 
649 	class CAdvancedSettings: public IMsRdpClientAdvancedSettings4
650 	{
651 	private:
652 		LONG m_refCount;
653 		IUnknown * m_IUnknown;
654 		IDispatch * m_IDispatch;
655 		IMsTscAdvancedSettings * m_IMsTscAdvancedSettings;
656 		IMsRdpClientAdvancedSettings * m_IMsRdpClientAdvancedSettings;
657 		IMsRdpClientAdvancedSettings2 * m_IMsRdpClientAdvancedSettings2;
658 		IMsRdpClientAdvancedSettings3 * m_IMsRdpClientAdvancedSettings3;
659 		IMsRdpClientAdvancedSettings4 * m_IMsRdpClientAdvancedSettings4;
660 
getIDispatch()661 		IDispatch * getIDispatch()
662 		{
663 			assert(m_IDispatch);
664 			return m_IDispatch;
665 		}
666 
getIMsTscAdvancedSettings()667 		IMsTscAdvancedSettings * getIMsTscAdvancedSettings()
668 		{
669 			if(m_IMsTscAdvancedSettings)
670 				return m_IMsTscAdvancedSettings;
671 			else if(m_IMsRdpClientAdvancedSettings)
672 				m_IMsTscAdvancedSettings = m_IMsRdpClientAdvancedSettings;
673 			else if(m_IMsRdpClientAdvancedSettings2)
674 				m_IMsTscAdvancedSettings = m_IMsRdpClientAdvancedSettings2;
675 			else if(m_IMsRdpClientAdvancedSettings3)
676 				m_IMsTscAdvancedSettings = m_IMsRdpClientAdvancedSettings3;
677 			else if(m_IMsRdpClientAdvancedSettings4)
678 				m_IMsTscAdvancedSettings = m_IMsRdpClientAdvancedSettings4;
679 
680 			if(m_IMsTscAdvancedSettings)
681 			{
682 				m_IMsTscAdvancedSettings->AddRef();
683 				return m_IMsTscAdvancedSettings;
684 			}
685 
686 			m_IUnknown->QueryInterface(&m_IMsTscAdvancedSettings);
687 			return m_IMsTscAdvancedSettings;
688 		}
689 
getIMsRdpClientAdvancedSettings()690 		IMsRdpClientAdvancedSettings * getIMsRdpClientAdvancedSettings()
691 		{
692 			if(m_IMsRdpClientAdvancedSettings)
693 				return m_IMsRdpClientAdvancedSettings;
694 			else if(m_IMsRdpClientAdvancedSettings2)
695 				m_IMsRdpClientAdvancedSettings = m_IMsRdpClientAdvancedSettings2;
696 			else if(m_IMsRdpClientAdvancedSettings3)
697 				m_IMsRdpClientAdvancedSettings = m_IMsRdpClientAdvancedSettings3;
698 			else if(m_IMsRdpClientAdvancedSettings4)
699 				m_IMsRdpClientAdvancedSettings = m_IMsRdpClientAdvancedSettings4;
700 
701 			if(m_IMsRdpClientAdvancedSettings)
702 			{
703 				m_IMsRdpClientAdvancedSettings->AddRef();
704 				return m_IMsRdpClientAdvancedSettings;
705 			}
706 
707 			m_IUnknown->QueryInterface(&m_IMsRdpClientAdvancedSettings);
708 			return m_IMsRdpClientAdvancedSettings;
709 		}
710 
getIMsRdpClientAdvancedSettings2()711 		IMsRdpClientAdvancedSettings2 * getIMsRdpClientAdvancedSettings2()
712 		{
713 			if(m_IMsRdpClientAdvancedSettings2)
714 				return m_IMsRdpClientAdvancedSettings2;
715 			else if(m_IMsRdpClientAdvancedSettings3)
716 				m_IMsRdpClientAdvancedSettings2 = m_IMsRdpClientAdvancedSettings3;
717 			else if(m_IMsRdpClientAdvancedSettings4)
718 				m_IMsRdpClientAdvancedSettings2 = m_IMsRdpClientAdvancedSettings4;
719 
720 			if(m_IMsRdpClientAdvancedSettings2)
721 			{
722 				m_IMsRdpClientAdvancedSettings2->AddRef();
723 				return m_IMsRdpClientAdvancedSettings2;
724 			}
725 
726 			m_IUnknown->QueryInterface(&m_IMsRdpClientAdvancedSettings2);
727 			return m_IMsRdpClientAdvancedSettings2;
728 		}
729 
getIMsRdpClientAdvancedSettings3()730 		IMsRdpClientAdvancedSettings3 * getIMsRdpClientAdvancedSettings3()
731 		{
732 			if(m_IMsRdpClientAdvancedSettings3)
733 				return m_IMsRdpClientAdvancedSettings3;
734 			else if(m_IMsRdpClientAdvancedSettings4)
735 				m_IMsRdpClientAdvancedSettings3 = m_IMsRdpClientAdvancedSettings4;
736 
737 			if(m_IMsRdpClientAdvancedSettings3)
738 			{
739 				m_IMsRdpClientAdvancedSettings3->AddRef();
740 				return m_IMsRdpClientAdvancedSettings3;
741 			}
742 
743 			m_IUnknown->QueryInterface(&m_IMsRdpClientAdvancedSettings3);
744 			return m_IMsRdpClientAdvancedSettings3;
745 		}
746 
getIMsRdpClientAdvancedSettings4()747 		IMsRdpClientAdvancedSettings4 * getIMsRdpClientAdvancedSettings4()
748 		{
749 			if(m_IMsRdpClientAdvancedSettings4)
750 				return m_IMsRdpClientAdvancedSettings4;
751 
752 			if(m_IMsRdpClientAdvancedSettings4)
753 			{
754 				m_IMsRdpClientAdvancedSettings4->AddRef();
755 				return m_IMsRdpClientAdvancedSettings4;
756 			}
757 
758 			m_IUnknown->QueryInterface(&m_IMsRdpClientAdvancedSettings4);
759 			return m_IMsRdpClientAdvancedSettings4;
760 		}
761 
~CAdvancedSettings()762 		~CAdvancedSettings()
763 		{
764 			m_IUnknown->Release();
765 			m_IDispatch->Release();
766 
767 			if(m_IMsTscAdvancedSettings)
768 				m_IMsTscAdvancedSettings->Release();
769 
770 			if(m_IMsRdpClientAdvancedSettings)
771 				m_IMsRdpClientAdvancedSettings->Release();
772 
773 			if(m_IMsRdpClientAdvancedSettings2)
774 				m_IMsRdpClientAdvancedSettings2->Release();
775 
776 			if(m_IMsRdpClientAdvancedSettings3)
777 				m_IMsRdpClientAdvancedSettings3->Release();
778 
779 			if(m_IMsRdpClientAdvancedSettings4)
780 				m_IMsRdpClientAdvancedSettings4->Release();
781 		}
782 
Init(IMsTscAdvancedSettings * p)783 		void Init(IMsTscAdvancedSettings * p)
784 		{
785 			m_IMsTscAdvancedSettings = p;
786 		}
787 
Init(IMsRdpClientAdvancedSettings * p)788 		void Init(IMsRdpClientAdvancedSettings * p)
789 		{
790 			m_IMsRdpClientAdvancedSettings = p;
791 		}
792 
Init(IMsRdpClientAdvancedSettings2 * p)793 		void Init(IMsRdpClientAdvancedSettings2 * p)
794 		{
795 			m_IMsRdpClientAdvancedSettings2 = p;
796 		}
797 
Init(IMsRdpClientAdvancedSettings3 * p)798 		void Init(IMsRdpClientAdvancedSettings3 * p)
799 		{
800 			m_IMsRdpClientAdvancedSettings3 = p;
801 		}
802 
Init(IMsRdpClientAdvancedSettings4 * p)803 		void Init(IMsRdpClientAdvancedSettings4 * p)
804 		{
805 			m_IMsRdpClientAdvancedSettings4 = p;
806 		}
807 
808 	public:
CAdvancedSettings(Interface * p)809 		template<class Interface> CAdvancedSettings(Interface * p):
810 			m_refCount(1),
811 			m_IUnknown(p),
812 			m_IDispatch(p),
813 			m_IMsTscAdvancedSettings(NULL),
814 			m_IMsRdpClientAdvancedSettings(NULL),
815 			m_IMsRdpClientAdvancedSettings2(NULL),
816 			m_IMsRdpClientAdvancedSettings3(NULL),
817 			m_IMsRdpClientAdvancedSettings4(NULL)
818 		{
819 			assert(p);
820 			p->AddRef();
821 			p->AddRef();
822 			Init(p);
823 		}
824 
825 		/* IUnknown */
QueryInterface(REFIID riid,void ** ppvObject)826         virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void ** ppvObject)
827 		{
828 			HRESULT hr;
829 			IUnknown * pvObject;
830 
831 			dbgprintf(TEXT("CAdvancedSettings::QueryInterface(%ls, %p)"), UUIDToString(riid).c_str(), ppvObject);
832 
833 #define QIBEGIN() \
834 	if(riid == IID_IUnknown) \
835 	{ \
836 		hr = S_OK; \
837 		pvObject = (IUnknown *)(this); \
838 	}
839 
840 #define QI(I) \
841 	else if(riid == IID_ ## I) \
842 	{ \
843 		if(m_ ## I) \
844 		{ \
845 			m_ ## I->AddRef(); \
846 			hr = S_OK; \
847 		} \
848 		else \
849 		{ \
850 			hr = m_IUnknown->QueryInterface(&m_ ## I); \
851 		} \
852  \
853 		if(SUCCEEDED(hr)) \
854 			pvObject = static_cast<I *>(this); \
855 	}
856 
857 #define QIEND() \
858 	else \
859 	{ \
860 		hr = E_NOINTERFACE; \
861 		pvObject = NULL; \
862 	}
863 
864 			QIBEGIN()
865 			QI(IDispatch)
866 			QI(IMsTscAdvancedSettings)
867 			QI(IMsRdpClientAdvancedSettings)
868 			QI(IMsRdpClientAdvancedSettings2)
869 			QI(IMsRdpClientAdvancedSettings3)
870 			QI(IMsRdpClientAdvancedSettings4)
871 			QIEND()
872 
873 #undef QIBEGIN
874 #undef QIEND
875 #undef QI
876 
877 			if(SUCCEEDED(hr))
878 			{
879 				assert(pvObject);
880 				pvObject->AddRef();
881 			}
882 			else
883 			{
884 				assert(pvObject == NULL);
885 			}
886 
887 			*ppvObject = pvObject;
888 
889 			dbgprintf(TEXT("CAdvancedSettings::QueryInterface -> %08X, ppvObject = %p"), hr, *ppvObject);
890 			return hr;
891 		}
892 
AddRef(void)893         virtual ULONG STDMETHODCALLTYPE AddRef(void)
894 		{
895 			return InterlockedIncrement(&m_refCount);
896 		}
897 
Release(void)898         virtual ULONG STDMETHODCALLTYPE Release(void)
899 		{
900 			LONG n = InterlockedDecrement(&m_refCount);
901 
902 			if(n == 0)
903 				delete this;
904 
905 			return n;
906 		}
907 
908 		/* IDispatch */
909 		/*
910 			 * p = get();
911 			dbgprintf(TEXT("CAdvancedSettings::()"), );
912 			HRESULT hr = p->();
913 			dbgprintf(TEXT("CAdvancedSettings:: -> %08X, "), hr, );
914 			return hr;
915 		*/
GetTypeInfoCount(UINT * pctinfo)916 		virtual STDMETHODIMP IDispatch::GetTypeInfoCount(UINT * pctinfo)
917 		{
918 			IDispatch * pIDispatch = getIDispatch();
919 			dbgprintf(TEXT("CAdvancedSettings::GetTypeInfoCount(%p)"), pctinfo);
920 			HRESULT hr = pIDispatch->GetTypeInfoCount(pctinfo);
921 			dbgprintf(TEXT("CAdvancedSettings::GetTypeInfoCount -> %08X, ctinfo = %u"), hr, *pctinfo);
922 			return hr;
923 		}
924 
GetTypeInfo(UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)925 		virtual STDMETHODIMP IDispatch::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo ** ppTInfo)
926 		{
927 			IDispatch * pIDispatch = getIDispatch();
928 			dbgprintf(TEXT("CAdvancedSettings::GetTypeInfo(%u, %lu, %p)"), iTInfo, lcid, ppTInfo);
929 			HRESULT hr = pIDispatch->GetTypeInfo(iTInfo, lcid, ppTInfo);
930 			dbgprintf(TEXT("CAdvancedSettings::GetTypeInfo -> %08X, pTInfo = %p"), hr, *ppTInfo);
931 			return hr;
932 		}
933 
GetIDsOfNames(REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)934 		virtual STDMETHODIMP IDispatch::GetIDsOfNames(REFIID riid, LPOLESTR * rgszNames, UINT cNames, LCID lcid, DISPID * rgDispId)
935 		{
936 			IDispatch * pIDispatch = getIDispatch();
937 			dbgprintf(TEXT("CAdvancedSettings::GetIDsOfNames(%ls, %ls, %d, %lu, %p)"), UUIDToString(riid).c_str(), *rgszNames, cNames, lcid, rgDispId);
938 			HRESULT hr = pIDispatch->GetIDsOfNames(riid, rgszNames, cNames, lcid, rgDispId);
939 			dbgprintf(TEXT("CAdvancedSettings::GetIDsOfNames -> %08X, rgDispId = %ld"), hr, *rgDispId);
940 			return hr;
941 		}
942 
Invoke(DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)943 		virtual STDMETHODIMP IDispatch::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS * pDispParams, VARIANT * pVarResult, EXCEPINFO * pExcepInfo, UINT * puArgErr)
944 		{
945 			// TODO
946 			IDispatch * pIDispatch = getIDispatch();
947 			dbgprintf(TEXT("CAdvancedSettings::Invoke()")/*, */);
948 			HRESULT hr = pIDispatch->Invoke(dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
949 			dbgprintf(TEXT("CAdvancedSettings::Invoke -> %08X, "), hr/*, */);
950 			return hr;
951 		}
952 
953 		/* IMsTscAdvancedSettings */
put_Compress(long pcompress)954 		virtual STDMETHODIMP IMsTscAdvancedSettings::put_Compress(long pcompress)
955 		{
956 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
957 			dbgprintf(TEXT("CAdvancedSettings::put_Compress(%ld)"), pcompress);
958 			HRESULT hr = pIMsTscAdvancedSettings->put_Compress(pcompress);
959 			dbgprintf(TEXT("CAdvancedSettings::put_Compress -> %08X"), hr);
960 			return hr;
961 		}
962 
get_Compress(long * pcompress)963 		virtual STDMETHODIMP IMsTscAdvancedSettings::get_Compress(long * pcompress)
964 		{
965 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
966 			dbgprintf(TEXT("CAdvancedSettings::get_Compress(%p)"), pcompress);
967 			HRESULT hr = pIMsTscAdvancedSettings->get_Compress(pcompress);
968 			dbgprintf(TEXT("CAdvancedSettings::get_Compress -> %08X, compress = %ld"), hr, *pcompress);
969 			return hr;
970 		}
971 
put_BitmapPeristence(long pbitmapPeristence)972 		virtual STDMETHODIMP IMsTscAdvancedSettings::put_BitmapPeristence(long pbitmapPeristence)
973 		{
974 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
975 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapPeristence(%ld)"), pbitmapPeristence);
976 			HRESULT hr = pIMsTscAdvancedSettings->put_BitmapPeristence(pbitmapPeristence);
977 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapPeristence -> %08X"), hr);
978 			return hr;
979 		}
980 
get_BitmapPeristence(long * pbitmapPeristence)981 		virtual STDMETHODIMP IMsTscAdvancedSettings::get_BitmapPeristence(long * pbitmapPeristence)
982 		{
983 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
984 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapPeristence(%p)"), pbitmapPeristence);
985 			HRESULT hr = pIMsTscAdvancedSettings->get_BitmapPeristence(pbitmapPeristence);
986 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapPeristence -> %08X, bitmapPeristence = %ld"), hr, *pbitmapPeristence);
987 			return hr;
988 		}
989 
put_allowBackgroundInput(long pallowBackgroundInput)990 		virtual STDMETHODIMP IMsTscAdvancedSettings::put_allowBackgroundInput(long pallowBackgroundInput)
991 		{
992 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
993 			dbgprintf(TEXT("CAdvancedSettings::put_allowBackgroundInput(%ld)"), pallowBackgroundInput);
994 			HRESULT hr = pIMsTscAdvancedSettings->put_allowBackgroundInput(pallowBackgroundInput);
995 			dbgprintf(TEXT("CAdvancedSettings::put_allowBackgroundInput -> %08X"), hr);
996 			return hr;
997 		}
998 
get_allowBackgroundInput(long * pallowBackgroundInput)999 		virtual STDMETHODIMP IMsTscAdvancedSettings::get_allowBackgroundInput(long * pallowBackgroundInput)
1000 		{
1001 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
1002 			dbgprintf(TEXT("CAdvancedSettings::get_allowBackgroundInput(%p)"), pallowBackgroundInput);
1003 			HRESULT hr = pIMsTscAdvancedSettings->get_allowBackgroundInput(pallowBackgroundInput);
1004 			dbgprintf(TEXT("CAdvancedSettings::get_allowBackgroundInput -> %08X, allowBackgroundInput = %ld"), hr, *pallowBackgroundInput);
1005 			return hr;
1006 		}
1007 
put_KeyBoardLayoutStr(BSTR rhs)1008 		virtual STDMETHODIMP IMsTscAdvancedSettings::put_KeyBoardLayoutStr(BSTR rhs)
1009 		{
1010 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
1011 			dbgprintf(TEXT("CAdvancedSettings::put_KeyBoardLayoutStr(%ls)"), rhs);
1012 			HRESULT hr = pIMsTscAdvancedSettings->put_KeyBoardLayoutStr(rhs);
1013 			dbgprintf(TEXT("CAdvancedSettings::put_KeyBoardLayoutStr -> %08X"), hr);
1014 			return hr;
1015 		}
1016 
put_PluginDlls(BSTR rhs)1017 		virtual STDMETHODIMP IMsTscAdvancedSettings::put_PluginDlls(BSTR rhs)
1018 		{
1019 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
1020 			dbgprintf(TEXT("CAdvancedSettings::put_PluginDlls(%ls)"), rhs);
1021 			HRESULT hr = pIMsTscAdvancedSettings->put_PluginDlls(rhs);
1022 			dbgprintf(TEXT("CAdvancedSettings::put_PluginDlls -> %08X"), hr);
1023 			return hr;
1024 		}
1025 
put_IconFile(BSTR rhs)1026 		virtual STDMETHODIMP IMsTscAdvancedSettings::put_IconFile(BSTR rhs)
1027 		{
1028 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
1029 			dbgprintf(TEXT("CAdvancedSettings::put_IconFile(%ls)"), rhs);
1030 			HRESULT hr = pIMsTscAdvancedSettings->put_IconFile(rhs);
1031 			dbgprintf(TEXT("CAdvancedSettings::put_IconFile -> %08X"), hr);
1032 			return hr;
1033 		}
1034 
put_IconIndex(long rhs)1035 		virtual STDMETHODIMP IMsTscAdvancedSettings::put_IconIndex(long rhs)
1036 		{
1037 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
1038 			dbgprintf(TEXT("CAdvancedSettings::put_IconIndex(%ld)"), rhs);
1039 			HRESULT hr = pIMsTscAdvancedSettings->put_IconIndex(rhs);
1040 			dbgprintf(TEXT("CAdvancedSettings::put_IconIndex -> %08X"), hr);
1041 			return hr;
1042 		}
1043 
put_ContainerHandledFullScreen(long pContainerHandledFullScreen)1044 		virtual STDMETHODIMP IMsTscAdvancedSettings::put_ContainerHandledFullScreen(long pContainerHandledFullScreen)
1045 		{
1046 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
1047 			dbgprintf(TEXT("CAdvancedSettings::put_ContainerHandledFullScreen(%ld)"), pContainerHandledFullScreen);
1048 			HRESULT hr = pIMsTscAdvancedSettings->put_ContainerHandledFullScreen(pContainerHandledFullScreen);
1049 			dbgprintf(TEXT("CAdvancedSettings::put_ContainerHandledFullScreen -> %08X"), hr);
1050 			return hr;
1051 		}
1052 
get_ContainerHandledFullScreen(long * pContainerHandledFullScreen)1053 		virtual STDMETHODIMP IMsTscAdvancedSettings::get_ContainerHandledFullScreen(long * pContainerHandledFullScreen)
1054 		{
1055 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
1056 			dbgprintf(TEXT("CAdvancedSettings::get_ContainerHandledFullScreen(%p)"), pContainerHandledFullScreen);
1057 			HRESULT hr = pIMsTscAdvancedSettings->get_ContainerHandledFullScreen(pContainerHandledFullScreen);
1058 			dbgprintf(TEXT("CAdvancedSettings::get_ContainerHandledFullScreen -> %08X, ContainerHandledFullScreen = %ld"), hr, *pContainerHandledFullScreen);
1059 			return hr;
1060 		}
1061 
put_DisableRdpdr(long pDisableRdpdr)1062 		virtual STDMETHODIMP IMsTscAdvancedSettings::put_DisableRdpdr(long pDisableRdpdr)
1063 		{
1064 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
1065 			dbgprintf(TEXT("CAdvancedSettings::put_DisableRdpdr(%ld)"), pDisableRdpdr);
1066 			HRESULT hr = pIMsTscAdvancedSettings->put_DisableRdpdr(pDisableRdpdr);
1067 			dbgprintf(TEXT("CAdvancedSettings::put_DisableRdpdr -> %08X"), hr);
1068 			return hr;
1069 		}
1070 
get_DisableRdpdr(long * pDisableRdpdr)1071 		virtual STDMETHODIMP IMsTscAdvancedSettings::get_DisableRdpdr(long * pDisableRdpdr)
1072 		{
1073 			IMsTscAdvancedSettings * pIMsTscAdvancedSettings = getIMsTscAdvancedSettings();
1074 			dbgprintf(TEXT("CAdvancedSettings::get_DisableRdpdr(%p)"), pDisableRdpdr);
1075 			HRESULT hr = pIMsTscAdvancedSettings->get_DisableRdpdr(pDisableRdpdr);
1076 			dbgprintf(TEXT("CAdvancedSettings::get_DisableRdpdr -> %08X, DisableRdpdr = %ld"), hr, *pDisableRdpdr);
1077 			return hr;
1078 		}
1079 
1080 		/* IMsRdpClientAdvancedSettings */
put_SmoothScroll(long psmoothScroll)1081 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_SmoothScroll(long psmoothScroll)
1082 		{
1083 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1084 			dbgprintf(TEXT("CAdvancedSettings::put_SmoothScroll(%ld)"), psmoothScroll);
1085 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_SmoothScroll(psmoothScroll);
1086 			dbgprintf(TEXT("CAdvancedSettings::put_SmoothScroll -> %08X"), hr);
1087 			return hr;
1088 		}
1089 
get_SmoothScroll(long * psmoothScroll)1090 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_SmoothScroll(long * psmoothScroll)
1091 		{
1092 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1093 			dbgprintf(TEXT("CAdvancedSettings::get_SmoothScroll(%p)"), psmoothScroll);
1094 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_SmoothScroll(psmoothScroll);
1095 			dbgprintf(TEXT("CAdvancedSettings::get_SmoothScroll -> %08X, smoothScroll = %ld"), hr, *psmoothScroll);
1096 			return hr;
1097 		}
1098 
put_AcceleratorPassthrough(long pacceleratorPassthrough)1099 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_AcceleratorPassthrough(long pacceleratorPassthrough)
1100 		{
1101 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1102 			dbgprintf(TEXT("CAdvancedSettings::put_AcceleratorPassthrough(%ld)"), pacceleratorPassthrough);
1103 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_AcceleratorPassthrough(pacceleratorPassthrough);
1104 			dbgprintf(TEXT("CAdvancedSettings::put_AcceleratorPassthrough -> %08X"), hr);
1105 			return hr;
1106 		}
1107 
get_AcceleratorPassthrough(long * pacceleratorPassthrough)1108 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_AcceleratorPassthrough(long * pacceleratorPassthrough)
1109 		{
1110 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1111 			dbgprintf(TEXT("CAdvancedSettings::get_AcceleratorPassthrough(%p)"), pacceleratorPassthrough);
1112 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_AcceleratorPassthrough(pacceleratorPassthrough);
1113 			dbgprintf(TEXT("CAdvancedSettings::get_AcceleratorPassthrough -> %08X, acceleratorPassthrough = %ld"), hr, *pacceleratorPassthrough);
1114 			return hr;
1115 		}
1116 
put_ShadowBitmap(long pshadowBitmap)1117 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_ShadowBitmap(long pshadowBitmap)
1118 		{
1119 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1120 			dbgprintf(TEXT("CAdvancedSettings::put_ShadowBitmap(%ld)"), pshadowBitmap);
1121 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_ShadowBitmap(pshadowBitmap);
1122 			dbgprintf(TEXT("CAdvancedSettings::put_ShadowBitmap -> %08X"), hr);
1123 			return hr;
1124 		}
1125 
get_ShadowBitmap(long * pshadowBitmap)1126 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_ShadowBitmap(long * pshadowBitmap)
1127 		{
1128 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1129 			dbgprintf(TEXT("CAdvancedSettings::get_ShadowBitmap(%p)"), pshadowBitmap);
1130 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_ShadowBitmap(pshadowBitmap);
1131 			dbgprintf(TEXT("CAdvancedSettings::get_ShadowBitmap -> %08X, shadowBitmap = %ld"), hr, *pshadowBitmap);
1132 			return hr;
1133 		}
1134 
put_TransportType(long ptransportType)1135 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_TransportType(long ptransportType)
1136 		{
1137 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1138 			dbgprintf(TEXT("CAdvancedSettings::put_TransportType(%ld)"), ptransportType);
1139 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_TransportType(ptransportType);
1140 			dbgprintf(TEXT("CAdvancedSettings::put_TransportType -> %08X"), hr);
1141 			return hr;
1142 		}
1143 
get_TransportType(long * ptransportType)1144 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_TransportType(long * ptransportType)
1145 		{
1146 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1147 			dbgprintf(TEXT("CAdvancedSettings::get_TransportType(%p)"), ptransportType);
1148 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_TransportType(ptransportType);
1149 			dbgprintf(TEXT("CAdvancedSettings::get_TransportType -> %08X, transportType = %ld"), hr, *ptransportType);
1150 			return hr;
1151 		}
1152 
put_SasSequence(long psasSequence)1153 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_SasSequence(long psasSequence)
1154 		{
1155 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1156 			dbgprintf(TEXT("CAdvancedSettings::put_SasSequence(%ld)"), psasSequence);
1157 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_SasSequence(psasSequence);
1158 			dbgprintf(TEXT("CAdvancedSettings::put_SasSequence -> %08X"), hr);
1159 			return hr;
1160 		}
1161 
get_SasSequence(long * psasSequence)1162 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_SasSequence(long * psasSequence)
1163 		{
1164 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1165 			dbgprintf(TEXT("CAdvancedSettings::get_SasSequence(%p)"), psasSequence);
1166 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_SasSequence(psasSequence);
1167 			dbgprintf(TEXT("CAdvancedSettings::get_SasSequence -> %08X, sasSequence = %ld"), hr, *psasSequence);
1168 			return hr;
1169 		}
1170 
put_EncryptionEnabled(long pencryptionEnabled)1171 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_EncryptionEnabled(long pencryptionEnabled)
1172 		{
1173 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1174 			dbgprintf(TEXT("CAdvancedSettings::put_EncryptionEnabled(%ld)"), pencryptionEnabled);
1175 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_EncryptionEnabled(pencryptionEnabled);
1176 			dbgprintf(TEXT("CAdvancedSettings::put_EncryptionEnabled -> %08X"), hr);
1177 			return hr;
1178 		}
1179 
get_EncryptionEnabled(long * pencryptionEnabled)1180 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_EncryptionEnabled(long * pencryptionEnabled)
1181 		{
1182 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1183 			dbgprintf(TEXT("CAdvancedSettings::get_EncryptionEnabled(%p)"), pencryptionEnabled);
1184 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_EncryptionEnabled(pencryptionEnabled);
1185 			dbgprintf(TEXT("CAdvancedSettings::get_EncryptionEnabled -> %08X, encryptionEnabled = %ld"), hr, *pencryptionEnabled);
1186 			return hr;
1187 		}
1188 
put_DedicatedTerminal(long pdedicatedTerminal)1189 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_DedicatedTerminal(long pdedicatedTerminal)
1190 		{
1191 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1192 			dbgprintf(TEXT("CAdvancedSettings::put_DedicatedTerminal(%ld)"), pdedicatedTerminal);
1193 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_DedicatedTerminal(pdedicatedTerminal);
1194 			dbgprintf(TEXT("CAdvancedSettings::put_DedicatedTerminal -> %08X"), hr);
1195 			return hr;
1196 		}
1197 
get_DedicatedTerminal(long * pdedicatedTerminal)1198 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_DedicatedTerminal(long * pdedicatedTerminal)
1199 		{
1200 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1201 			dbgprintf(TEXT("CAdvancedSettings::get_DedicatedTerminal(%p)"), pdedicatedTerminal);
1202 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_DedicatedTerminal(pdedicatedTerminal);
1203 			dbgprintf(TEXT("CAdvancedSettings::get_DedicatedTerminal -> %08X, dedicatedTerminal = %ld"), hr, *pdedicatedTerminal);
1204 			return hr;
1205 		}
1206 
put_RDPPort(long prdpPort)1207 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_RDPPort(long prdpPort)
1208 		{
1209 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1210 			dbgprintf(TEXT("CAdvancedSettings::put_RDPPort(%ld)"), prdpPort);
1211 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_RDPPort(prdpPort);
1212 			dbgprintf(TEXT("CAdvancedSettings::put_RDPPort -> %08X"), hr);
1213 			return hr;
1214 		}
1215 
get_RDPPort(long * prdpPort)1216 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_RDPPort(long * prdpPort)
1217 		{
1218 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1219 			dbgprintf(TEXT("CAdvancedSettings::get_RDPPort(%p)"), prdpPort);
1220 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_RDPPort(prdpPort);
1221 			dbgprintf(TEXT("CAdvancedSettings::get_RDPPort -> %08X, rdpPort = %ld"), hr, *prdpPort);
1222 			return hr;
1223 		}
1224 
put_EnableMouse(long penableMouse)1225 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_EnableMouse(long penableMouse)
1226 		{
1227 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1228 			dbgprintf(TEXT("CAdvancedSettings::put_EnableMouse(%ld)"), penableMouse);
1229 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_EnableMouse(penableMouse);
1230 			dbgprintf(TEXT("CAdvancedSettings::put_EnableMouse -> %08X"), hr);
1231 			return hr;
1232 		}
1233 
get_EnableMouse(long * penableMouse)1234 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_EnableMouse(long * penableMouse)
1235 		{
1236 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1237 			dbgprintf(TEXT("CAdvancedSettings::get_EnableMouse(%p)"), penableMouse);
1238 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_EnableMouse(penableMouse);
1239 			dbgprintf(TEXT("CAdvancedSettings::get_EnableMouse -> %08X, enableMouse = %ld"), hr, *penableMouse);
1240 			return hr;
1241 		}
1242 
put_DisableCtrlAltDel(long pdisableCtrlAltDel)1243 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_DisableCtrlAltDel(long pdisableCtrlAltDel)
1244 		{
1245 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1246 			dbgprintf(TEXT("CAdvancedSettings::put_DisableCtrlAltDel(%ld)"), pdisableCtrlAltDel);
1247 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_DisableCtrlAltDel(pdisableCtrlAltDel);
1248 			dbgprintf(TEXT("CAdvancedSettings::put_DisableCtrlAltDel -> %08X"), hr);
1249 			return hr;
1250 		}
1251 
get_DisableCtrlAltDel(long * pdisableCtrlAltDel)1252 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_DisableCtrlAltDel(long * pdisableCtrlAltDel)
1253 		{
1254 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1255 			dbgprintf(TEXT("CAdvancedSettings::get_DisableCtrlAltDel(%p)"), pdisableCtrlAltDel);
1256 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_DisableCtrlAltDel(pdisableCtrlAltDel);
1257 			dbgprintf(TEXT("CAdvancedSettings::get_DisableCtrlAltDel -> %08X, disableCtrlAltDel = %ld"), hr, *pdisableCtrlAltDel);
1258 			return hr;
1259 		}
1260 
put_EnableWindowsKey(long penableWindowsKey)1261 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_EnableWindowsKey(long penableWindowsKey)
1262 		{
1263 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1264 			dbgprintf(TEXT("CAdvancedSettings::put_EnableWindowsKey(%ld)"), penableWindowsKey);
1265 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_EnableWindowsKey(penableWindowsKey);
1266 			dbgprintf(TEXT("CAdvancedSettings::put_EnableWindowsKey -> %08X"), hr);
1267 			return hr;
1268 		}
1269 
get_EnableWindowsKey(long * penableWindowsKey)1270 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_EnableWindowsKey(long * penableWindowsKey)
1271 		{
1272 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1273 			dbgprintf(TEXT("CAdvancedSettings::get_EnableWindowsKey(%p)"), penableWindowsKey);
1274 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_EnableWindowsKey(penableWindowsKey);
1275 			dbgprintf(TEXT("CAdvancedSettings::get_EnableWindowsKey -> %08X, enableWindowsKey = %ld"), hr, *penableWindowsKey);
1276 			return hr;
1277 		}
1278 
put_DoubleClickDetect(long pdoubleClickDetect)1279 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_DoubleClickDetect(long pdoubleClickDetect)
1280 		{
1281 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1282 			dbgprintf(TEXT("CAdvancedSettings::put_DoubleClickDetect(%ld)"), pdoubleClickDetect);
1283 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_DoubleClickDetect(pdoubleClickDetect);
1284 			dbgprintf(TEXT("CAdvancedSettings::put_DoubleClickDetect -> %08X"), hr);
1285 			return hr;
1286 		}
1287 
get_DoubleClickDetect(long * pdoubleClickDetect)1288 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_DoubleClickDetect(long * pdoubleClickDetect)
1289 		{
1290 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1291 			dbgprintf(TEXT("CAdvancedSettings::get_DoubleClickDetect(%p)"), pdoubleClickDetect);
1292 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_DoubleClickDetect(pdoubleClickDetect);
1293 			dbgprintf(TEXT("CAdvancedSettings::get_DoubleClickDetect -> %08X, doubleClickDetect = %ld"), hr, *pdoubleClickDetect);
1294 			return hr;
1295 		}
1296 
put_MaximizeShell(long pmaximizeShell)1297 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_MaximizeShell(long pmaximizeShell)
1298 		{
1299 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1300 			dbgprintf(TEXT("CAdvancedSettings::put_MaximizeShell(%ld)"), pmaximizeShell);
1301 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_MaximizeShell(pmaximizeShell);
1302 			dbgprintf(TEXT("CAdvancedSettings::put_MaximizeShell -> %08X"), hr);
1303 			return hr;
1304 		}
1305 
get_MaximizeShell(long * pmaximizeShell)1306 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_MaximizeShell(long * pmaximizeShell)
1307 		{
1308 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1309 			dbgprintf(TEXT("CAdvancedSettings::get_MaximizeShell(%p)"), pmaximizeShell);
1310 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_MaximizeShell(pmaximizeShell);
1311 			dbgprintf(TEXT("CAdvancedSettings::get_MaximizeShell -> %08X, maximizeShell = %ld"), hr, *pmaximizeShell);
1312 			return hr;
1313 		}
1314 
put_HotKeyFullScreen(long photKeyFullScreen)1315 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_HotKeyFullScreen(long photKeyFullScreen)
1316 		{
1317 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1318 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyFullScreen(%ld)"), photKeyFullScreen);
1319 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_HotKeyFullScreen(photKeyFullScreen);
1320 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyFullScreen -> %08X"), hr);
1321 			return hr;
1322 		}
1323 
get_HotKeyFullScreen(long * photKeyFullScreen)1324 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_HotKeyFullScreen(long * photKeyFullScreen)
1325 		{
1326 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1327 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyFullScreen(%p)"), photKeyFullScreen);
1328 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_HotKeyFullScreen(photKeyFullScreen);
1329 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyFullScreen -> %08X, hotKeyFullScreen = %ld"), hr, *photKeyFullScreen);
1330 			return hr;
1331 		}
1332 
put_HotKeyCtrlEsc(long photKeyCtrlEsc)1333 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_HotKeyCtrlEsc(long photKeyCtrlEsc)
1334 		{
1335 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1336 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyCtrlEsc(%ld)"), photKeyCtrlEsc);
1337 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_HotKeyCtrlEsc(photKeyCtrlEsc);
1338 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyCtrlEsc -> %08X"), hr);
1339 			return hr;
1340 		}
1341 
get_HotKeyCtrlEsc(long * photKeyCtrlEsc)1342 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_HotKeyCtrlEsc(long * photKeyCtrlEsc)
1343 		{
1344 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1345 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyCtrlEsc(%p)"), photKeyCtrlEsc);
1346 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_HotKeyCtrlEsc(photKeyCtrlEsc);
1347 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyCtrlEsc -> %08X, hotKeyCtrlEsc = %ld"), hr, *photKeyCtrlEsc);
1348 			return hr;
1349 		}
1350 
put_HotKeyAltEsc(long photKeyAltEsc)1351 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_HotKeyAltEsc(long photKeyAltEsc)
1352 		{
1353 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1354 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyAltEsc(%ld)"), photKeyAltEsc);
1355 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_HotKeyAltEsc(photKeyAltEsc);
1356 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyAltEsc -> %08X"), hr);
1357 			return hr;
1358 		}
1359 
get_HotKeyAltEsc(long * photKeyAltEsc)1360 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_HotKeyAltEsc(long * photKeyAltEsc)
1361 		{
1362 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1363 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyAltEsc(%p)"), photKeyAltEsc);
1364 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_HotKeyAltEsc(photKeyAltEsc);
1365 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyAltEsc -> %08X, hotKeyAltEsc = %ld"), hr, *photKeyAltEsc);
1366 			return hr;
1367 		}
1368 
put_HotKeyAltTab(long photKeyAltTab)1369 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_HotKeyAltTab(long photKeyAltTab)
1370 		{
1371 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1372 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyAltTab(%ld)"), photKeyAltTab);
1373 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_HotKeyAltTab(photKeyAltTab);
1374 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyAltTab -> %08X"), hr);
1375 			return hr;
1376 		}
1377 
get_HotKeyAltTab(long * photKeyAltTab)1378 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_HotKeyAltTab(long * photKeyAltTab)
1379 		{
1380 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1381 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyAltTab(%p)"), photKeyAltTab);
1382 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_HotKeyAltTab(photKeyAltTab);
1383 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyAltTab -> %08X, hotKeyAltTab = %ld"), hr, *photKeyAltTab);
1384 			return hr;
1385 		}
1386 
put_HotKeyAltShiftTab(long photKeyAltShiftTab)1387 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_HotKeyAltShiftTab(long photKeyAltShiftTab)
1388 		{
1389 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1390 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyAltShiftTab(%ld)"), photKeyAltShiftTab);
1391 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_HotKeyAltShiftTab(photKeyAltShiftTab);
1392 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyAltShiftTab -> %08X"), hr);
1393 			return hr;
1394 		}
1395 
get_HotKeyAltShiftTab(long * photKeyAltShiftTab)1396 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_HotKeyAltShiftTab(long * photKeyAltShiftTab)
1397 		{
1398 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1399 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyAltShiftTab(%p)"), photKeyAltShiftTab);
1400 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_HotKeyAltShiftTab(photKeyAltShiftTab);
1401 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyAltShiftTab -> %08X, hotKeyAltShiftTab = %ld"), hr, *photKeyAltShiftTab);
1402 			return hr;
1403 		}
1404 
put_HotKeyAltSpace(long photKeyAltSpace)1405 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_HotKeyAltSpace(long photKeyAltSpace)
1406 		{
1407 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1408 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyAltSpace(%ld)"), photKeyAltSpace);
1409 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_HotKeyAltSpace(photKeyAltSpace);
1410 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyAltSpace -> %08X"), hr);
1411 			return hr;
1412 		}
1413 
get_HotKeyAltSpace(long * photKeyAltSpace)1414 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_HotKeyAltSpace(long * photKeyAltSpace)
1415 		{
1416 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1417 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyAltSpace(%p)"), photKeyAltSpace);
1418 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_HotKeyAltSpace(photKeyAltSpace);
1419 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyAltSpace -> %08X, hotKeyAltSpace = %ld"), hr, *photKeyAltSpace);
1420 			return hr;
1421 		}
1422 
put_HotKeyCtrlAltDel(long photKeyCtrlAltDel)1423 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_HotKeyCtrlAltDel(long photKeyCtrlAltDel)
1424 		{
1425 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1426 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyCtrlAltDel(%ld)"), photKeyCtrlAltDel);
1427 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_HotKeyCtrlAltDel(photKeyCtrlAltDel);
1428 			dbgprintf(TEXT("CAdvancedSettings::put_HotKeyCtrlAltDel -> %08X"), hr);
1429 			return hr;
1430 		}
1431 
get_HotKeyCtrlAltDel(long * photKeyCtrlAltDel)1432 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_HotKeyCtrlAltDel(long * photKeyCtrlAltDel)
1433 		{
1434 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1435 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyCtrlAltDel(%p)"), photKeyCtrlAltDel);
1436 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_HotKeyCtrlAltDel(photKeyCtrlAltDel);
1437 			dbgprintf(TEXT("CAdvancedSettings::get_HotKeyCtrlAltDel -> %08X, hotKeyCtrlAltDel = %ld"), hr, *photKeyCtrlAltDel);
1438 			return hr;
1439 		}
1440 
put_orderDrawThreshold(long porderDrawThreshold)1441 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_orderDrawThreshold(long porderDrawThreshold)
1442 		{
1443 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1444 			dbgprintf(TEXT("CAdvancedSettings::put_orderDrawThreshold(%ld)"), porderDrawThreshold);
1445 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_orderDrawThreshold(porderDrawThreshold);
1446 			dbgprintf(TEXT("CAdvancedSettings::put_orderDrawThreshold -> %08X"), hr);
1447 			return hr;
1448 		}
1449 
get_orderDrawThreshold(long * porderDrawThreshold)1450 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_orderDrawThreshold(long * porderDrawThreshold)
1451 		{
1452 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1453 			dbgprintf(TEXT("CAdvancedSettings::get_orderDrawThreshold(%p)"), porderDrawThreshold);
1454 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_orderDrawThreshold(porderDrawThreshold);
1455 			dbgprintf(TEXT("CAdvancedSettings::get_orderDrawThreshold -> %08X, orderDrawThreshold = %ld"), hr, *porderDrawThreshold);
1456 			return hr;
1457 		}
1458 
put_BitmapCacheSize(long pbitmapCacheSize)1459 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_BitmapCacheSize(long pbitmapCacheSize)
1460 		{
1461 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1462 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapCacheSize(%ld)"), pbitmapCacheSize);
1463 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_BitmapCacheSize(pbitmapCacheSize);
1464 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapCacheSize -> %08X"), hr);
1465 			return hr;
1466 		}
1467 
get_BitmapCacheSize(long * pbitmapCacheSize)1468 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_BitmapCacheSize(long * pbitmapCacheSize)
1469 		{
1470 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1471 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapCacheSize(%p)"), pbitmapCacheSize);
1472 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_BitmapCacheSize(pbitmapCacheSize);
1473 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapCacheSize -> %08X, bitmapCacheSize = %ld"), hr, *pbitmapCacheSize);
1474 			return hr;
1475 		}
1476 
put_BitmapVirtualCacheSize(long pbitmapVirtualCacheSize)1477 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_BitmapVirtualCacheSize(long pbitmapVirtualCacheSize)
1478 		{
1479 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1480 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapVirtualCacheSize(%ld)"), pbitmapVirtualCacheSize);
1481 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_BitmapVirtualCacheSize(pbitmapVirtualCacheSize);
1482 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapVirtualCacheSize -> %08X"), hr);
1483 			return hr;
1484 		}
1485 
get_BitmapVirtualCacheSize(long * pbitmapVirtualCacheSize)1486 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_BitmapVirtualCacheSize(long * pbitmapVirtualCacheSize)
1487 		{
1488 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1489 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapVirtualCacheSize(%p)"), pbitmapVirtualCacheSize);
1490 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_BitmapVirtualCacheSize(pbitmapVirtualCacheSize);
1491 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapVirtualCacheSize -> %08X, bitmapVirtualCacheSize = %ld"), hr, *pbitmapVirtualCacheSize);
1492 			return hr;
1493 		}
1494 
put_ScaleBitmapCachesByBPP(long pbScale)1495 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_ScaleBitmapCachesByBPP(long pbScale)
1496 		{
1497 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1498 			dbgprintf(TEXT("CAdvancedSettings::put_ScaleBitmapCachesByBPP(%ld)"), pbScale);
1499 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_ScaleBitmapCachesByBPP(pbScale);
1500 			dbgprintf(TEXT("CAdvancedSettings::put_ScaleBitmapCachesByBPP -> %08X"), hr);
1501 			return hr;
1502 		}
1503 
get_ScaleBitmapCachesByBPP(long * pbScale)1504 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_ScaleBitmapCachesByBPP(long * pbScale)
1505 		{
1506 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1507 			dbgprintf(TEXT("CAdvancedSettings::get_ScaleBitmapCachesByBPP(%p)"), pbScale);
1508 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_ScaleBitmapCachesByBPP(pbScale);
1509 			dbgprintf(TEXT("CAdvancedSettings::get_ScaleBitmapCachesByBPP -> %08X, bScale = %ld"), hr, *pbScale);
1510 			return hr;
1511 		}
1512 
put_NumBitmapCaches(long pnumBitmapCaches)1513 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_NumBitmapCaches(long pnumBitmapCaches)
1514 		{
1515 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1516 			dbgprintf(TEXT("CAdvancedSettings::put_NumBitmapCaches(%ld)"), pnumBitmapCaches);
1517 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_NumBitmapCaches(pnumBitmapCaches);
1518 			dbgprintf(TEXT("CAdvancedSettings::put_NumBitmapCaches -> %08X"), hr);
1519 			return hr;
1520 		}
1521 
get_NumBitmapCaches(long * pnumBitmapCaches)1522 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_NumBitmapCaches(long * pnumBitmapCaches)
1523 		{
1524 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1525 			dbgprintf(TEXT("CAdvancedSettings::get_NumBitmapCaches(%p)"), pnumBitmapCaches);
1526 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_NumBitmapCaches(pnumBitmapCaches);
1527 			dbgprintf(TEXT("CAdvancedSettings::get_NumBitmapCaches -> %08X, numBitmapCaches = %ld"), hr, *pnumBitmapCaches);
1528 			return hr;
1529 		}
1530 
put_CachePersistenceActive(long pcachePersistenceActive)1531 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_CachePersistenceActive(long pcachePersistenceActive)
1532 		{
1533 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1534 			dbgprintf(TEXT("CAdvancedSettings::put_CachePersistenceActive(%ld)"), pcachePersistenceActive);
1535 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_CachePersistenceActive(pcachePersistenceActive);
1536 			dbgprintf(TEXT("CAdvancedSettings::put_CachePersistenceActive -> %08X"), hr);
1537 			return hr;
1538 		}
1539 
get_CachePersistenceActive(long * pcachePersistenceActive)1540 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_CachePersistenceActive(long * pcachePersistenceActive)
1541 		{
1542 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1543 			dbgprintf(TEXT("CAdvancedSettings::get_CachePersistenceActive(%p)"), pcachePersistenceActive);
1544 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_CachePersistenceActive(pcachePersistenceActive);
1545 			dbgprintf(TEXT("CAdvancedSettings::get_CachePersistenceActive -> %08X, cachePersistenceActive = %ld"), hr, *pcachePersistenceActive);
1546 			return hr;
1547 		}
1548 
put_PersistCacheDirectory(BSTR rhs)1549 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_PersistCacheDirectory(BSTR rhs)
1550 		{
1551 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1552 			dbgprintf(TEXT("CAdvancedSettings::put_PersistCacheDirectory(%ls)"), rhs);
1553 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_PersistCacheDirectory(rhs);
1554 			dbgprintf(TEXT("CAdvancedSettings::put_PersistCacheDirectory -> %08X"), hr);
1555 			return hr;
1556 		}
1557 
put_brushSupportLevel(long pbrushSupportLevel)1558 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_brushSupportLevel(long pbrushSupportLevel)
1559 		{
1560 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1561 			dbgprintf(TEXT("CAdvancedSettings::put_brushSupportLevel(%ld)"), pbrushSupportLevel);
1562 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_brushSupportLevel(pbrushSupportLevel);
1563 			dbgprintf(TEXT("CAdvancedSettings::put_brushSupportLevel -> %08X"), hr);
1564 			return hr;
1565 		}
1566 
get_brushSupportLevel(long * pbrushSupportLevel)1567 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_brushSupportLevel(long * pbrushSupportLevel)
1568 		{
1569 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1570 			dbgprintf(TEXT("CAdvancedSettings::get_brushSupportLevel(%p)"), pbrushSupportLevel);
1571 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_brushSupportLevel(pbrushSupportLevel);
1572 			dbgprintf(TEXT("CAdvancedSettings::get_brushSupportLevel -> %08X, brushSupportLevel = %ld"), hr, *pbrushSupportLevel);
1573 			return hr;
1574 		}
1575 
put_minInputSendInterval(long pminInputSendInterval)1576 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_minInputSendInterval(long pminInputSendInterval)
1577 		{
1578 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1579 			dbgprintf(TEXT("CAdvancedSettings::put_minInputSendInterval(%ld)"), pminInputSendInterval);
1580 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_minInputSendInterval(pminInputSendInterval);
1581 			dbgprintf(TEXT("CAdvancedSettings::put_minInputSendInterval -> %08X"), hr);
1582 			return hr;
1583 		}
1584 
get_minInputSendInterval(long * pminInputSendInterval)1585 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_minInputSendInterval(long * pminInputSendInterval)
1586 		{
1587 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1588 			dbgprintf(TEXT("CAdvancedSettings::get_minInputSendInterval(%p)"), pminInputSendInterval);
1589 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_minInputSendInterval(pminInputSendInterval);
1590 			dbgprintf(TEXT("CAdvancedSettings::get_minInputSendInterval -> %08X, minInputSendInterval = %ld"), hr, *pminInputSendInterval);
1591 			return hr;
1592 		}
1593 
put_InputEventsAtOnce(long pinputEventsAtOnce)1594 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_InputEventsAtOnce(long pinputEventsAtOnce)
1595 		{
1596 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1597 			dbgprintf(TEXT("CAdvancedSettings::put_InputEventsAtOnce(%ld)"), pinputEventsAtOnce);
1598 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_InputEventsAtOnce(pinputEventsAtOnce);
1599 			dbgprintf(TEXT("CAdvancedSettings::put_InputEventsAtOnce -> %08X"), hr);
1600 			return hr;
1601 		}
1602 
get_InputEventsAtOnce(long * pinputEventsAtOnce)1603 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_InputEventsAtOnce(long * pinputEventsAtOnce)
1604 		{
1605 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1606 			dbgprintf(TEXT("CAdvancedSettings::get_InputEventsAtOnce(%p)"), pinputEventsAtOnce);
1607 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_InputEventsAtOnce(pinputEventsAtOnce);
1608 			dbgprintf(TEXT("CAdvancedSettings::get_InputEventsAtOnce -> %08X, inputEventsAtOnce = %ld"), hr, *pinputEventsAtOnce);
1609 			return hr;
1610 		}
1611 
put_maxEventCount(long pmaxEventCount)1612 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_maxEventCount(long pmaxEventCount)
1613 		{
1614 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1615 			dbgprintf(TEXT("CAdvancedSettings::put_maxEventCount(%ld)"), pmaxEventCount);
1616 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_maxEventCount(pmaxEventCount);
1617 			dbgprintf(TEXT("CAdvancedSettings::put_maxEventCount -> %08X"), hr);
1618 			return hr;
1619 		}
1620 
get_maxEventCount(long * pmaxEventCount)1621 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_maxEventCount(long * pmaxEventCount)
1622 		{
1623 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1624 			dbgprintf(TEXT("CAdvancedSettings::get_maxEventCount(%p)"), pmaxEventCount);
1625 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_maxEventCount(pmaxEventCount);
1626 			dbgprintf(TEXT("CAdvancedSettings::get_maxEventCount -> %08X, maxEventCount = %ld"), hr, *pmaxEventCount);
1627 			return hr;
1628 		}
1629 
put_keepAliveInterval(long pkeepAliveInterval)1630 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_keepAliveInterval(long pkeepAliveInterval)
1631 		{
1632 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1633 			dbgprintf(TEXT("CAdvancedSettings::put_keepAliveInterval(%ld)"), pkeepAliveInterval);
1634 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_keepAliveInterval(pkeepAliveInterval);
1635 			dbgprintf(TEXT("CAdvancedSettings::put_keepAliveInterval -> %08X"), hr);
1636 			return hr;
1637 		}
1638 
get_keepAliveInterval(long * pkeepAliveInterval)1639 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_keepAliveInterval(long * pkeepAliveInterval)
1640 		{
1641 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1642 			dbgprintf(TEXT("CAdvancedSettings::get_keepAliveInterval(%p)"), pkeepAliveInterval);
1643 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_keepAliveInterval(pkeepAliveInterval);
1644 			dbgprintf(TEXT("CAdvancedSettings::get_keepAliveInterval -> %08X, keepAliveInterval = %ld"), hr, *pkeepAliveInterval);
1645 			return hr;
1646 		}
1647 
put_shutdownTimeout(long pshutdownTimeout)1648 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_shutdownTimeout(long pshutdownTimeout)
1649 		{
1650 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1651 			dbgprintf(TEXT("CAdvancedSettings::put_shutdownTimeout(%ld)"), pshutdownTimeout);
1652 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_shutdownTimeout(pshutdownTimeout);
1653 			dbgprintf(TEXT("CAdvancedSettings::put_shutdownTimeout -> %08X"), hr);
1654 			return hr;
1655 		}
1656 
get_shutdownTimeout(long * pshutdownTimeout)1657 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_shutdownTimeout(long * pshutdownTimeout)
1658 		{
1659 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1660 			dbgprintf(TEXT("CAdvancedSettings::get_shutdownTimeout(%p)"), pshutdownTimeout);
1661 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_shutdownTimeout(pshutdownTimeout);
1662 			dbgprintf(TEXT("CAdvancedSettings::get_shutdownTimeout -> %08X, shutdownTimeout = %ld"), hr, *pshutdownTimeout);
1663 			return hr;
1664 		}
1665 
put_overallConnectionTimeout(long poverallConnectionTimeout)1666 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_overallConnectionTimeout(long poverallConnectionTimeout)
1667 		{
1668 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1669 			dbgprintf(TEXT("CAdvancedSettings::put_overallConnectionTimeout(%ld)"), poverallConnectionTimeout);
1670 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_overallConnectionTimeout(poverallConnectionTimeout);
1671 			dbgprintf(TEXT("CAdvancedSettings::put_overallConnectionTimeout -> %08X"), hr);
1672 			return hr;
1673 		}
1674 
get_overallConnectionTimeout(long * poverallConnectionTimeout)1675 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_overallConnectionTimeout(long * poverallConnectionTimeout)
1676 		{
1677 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1678 			dbgprintf(TEXT("CAdvancedSettings::get_overallConnectionTimeout(%p)"), poverallConnectionTimeout);
1679 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_overallConnectionTimeout(poverallConnectionTimeout);
1680 			dbgprintf(TEXT("CAdvancedSettings::get_overallConnectionTimeout -> %08X, overallConnectionTimeout = %ld"), hr, *poverallConnectionTimeout);
1681 			return hr;
1682 		}
1683 
put_singleConnectionTimeout(long psingleConnectionTimeout)1684 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_singleConnectionTimeout(long psingleConnectionTimeout)
1685 		{
1686 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1687 			dbgprintf(TEXT("CAdvancedSettings::put_singleConnectionTimeout(%ld)"), psingleConnectionTimeout);
1688 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_singleConnectionTimeout(psingleConnectionTimeout);
1689 			dbgprintf(TEXT("CAdvancedSettings::put_singleConnectionTimeout -> %08X"), hr);
1690 			return hr;
1691 		}
1692 
get_singleConnectionTimeout(long * psingleConnectionTimeout)1693 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_singleConnectionTimeout(long * psingleConnectionTimeout)
1694 		{
1695 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1696 			dbgprintf(TEXT("CAdvancedSettings::get_singleConnectionTimeout(%p)"), psingleConnectionTimeout);
1697 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_singleConnectionTimeout(psingleConnectionTimeout);
1698 			dbgprintf(TEXT("CAdvancedSettings::get_singleConnectionTimeout -> %08X, singleConnectionTimeout = %ld"), hr, *psingleConnectionTimeout);
1699 			return hr;
1700 		}
1701 
put_KeyboardType(long pkeyboardType)1702 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_KeyboardType(long pkeyboardType)
1703 		{
1704 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1705 			dbgprintf(TEXT("CAdvancedSettings::put_KeyboardType(%ld)"), pkeyboardType);
1706 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_KeyboardType(pkeyboardType);
1707 			dbgprintf(TEXT("CAdvancedSettings::put_KeyboardType -> %08X"), hr);
1708 			return hr;
1709 		}
1710 
get_KeyboardType(long * pkeyboardType)1711 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_KeyboardType(long * pkeyboardType)
1712 		{
1713 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1714 			dbgprintf(TEXT("CAdvancedSettings::get_KeyboardType(%p)"), pkeyboardType);
1715 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_KeyboardType(pkeyboardType);
1716 			dbgprintf(TEXT("CAdvancedSettings::get_KeyboardType -> %08X, keyboardType = %ld"), hr, *pkeyboardType);
1717 			return hr;
1718 		}
1719 
put_KeyboardSubType(long pkeyboardSubType)1720 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_KeyboardSubType(long pkeyboardSubType)
1721 		{
1722 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1723 			dbgprintf(TEXT("CAdvancedSettings::put_KeyboardSubType(%ld)"), pkeyboardSubType);
1724 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_KeyboardSubType(pkeyboardSubType);
1725 			dbgprintf(TEXT("CAdvancedSettings::put_KeyboardSubType -> %08X"), hr);
1726 			return hr;
1727 		}
1728 
get_KeyboardSubType(long * pkeyboardSubType)1729 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_KeyboardSubType(long * pkeyboardSubType)
1730 		{
1731 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1732 			dbgprintf(TEXT("CAdvancedSettings::get_KeyboardSubType(%p)"), pkeyboardSubType);
1733 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_KeyboardSubType(pkeyboardSubType);
1734 			dbgprintf(TEXT("CAdvancedSettings::get_KeyboardSubType -> %08X, keyboardSubType = %ld"), hr, *pkeyboardSubType);
1735 			return hr;
1736 		}
1737 
put_KeyboardFunctionKey(long pkeyboardFunctionKey)1738 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_KeyboardFunctionKey(long pkeyboardFunctionKey)
1739 		{
1740 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1741 			dbgprintf(TEXT("CAdvancedSettings::put_KeyboardFunctionKey(%ld)"), pkeyboardFunctionKey);
1742 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_KeyboardFunctionKey(pkeyboardFunctionKey);
1743 			dbgprintf(TEXT("CAdvancedSettings::put_KeyboardFunctionKey -> %08X"), hr);
1744 			return hr;
1745 		}
1746 
get_KeyboardFunctionKey(long * pkeyboardFunctionKey)1747 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_KeyboardFunctionKey(long * pkeyboardFunctionKey)
1748 		{
1749 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1750 			dbgprintf(TEXT("CAdvancedSettings::get_KeyboardFunctionKey(%p)"), pkeyboardFunctionKey);
1751 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_KeyboardFunctionKey(pkeyboardFunctionKey);
1752 			dbgprintf(TEXT("CAdvancedSettings::get_KeyboardFunctionKey -> %08X, keyboardFunctionKey = %ld"), hr, *pkeyboardFunctionKey);
1753 			return hr;
1754 		}
1755 
put_WinceFixedPalette(long pwinceFixedPalette)1756 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_WinceFixedPalette(long pwinceFixedPalette)
1757 		{
1758 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1759 			dbgprintf(TEXT("CAdvancedSettings::put_WinceFixedPalette(%ld)"), pwinceFixedPalette);
1760 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_WinceFixedPalette(pwinceFixedPalette);
1761 			dbgprintf(TEXT("CAdvancedSettings::put_WinceFixedPalette -> %08X"), hr);
1762 			return hr;
1763 		}
1764 
get_WinceFixedPalette(long * pwinceFixedPalette)1765 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_WinceFixedPalette(long * pwinceFixedPalette)
1766 		{
1767 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1768 			dbgprintf(TEXT("CAdvancedSettings::get_WinceFixedPalette(%p)"), pwinceFixedPalette);
1769 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_WinceFixedPalette(pwinceFixedPalette);
1770 			dbgprintf(TEXT("CAdvancedSettings::get_WinceFixedPalette -> %08X, winceFixedPalette = %ld"), hr, *pwinceFixedPalette);
1771 			return hr;
1772 		}
1773 
put_ConnectToServerConsole(VARIANT_BOOL pConnectToConsole)1774 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_ConnectToServerConsole(VARIANT_BOOL pConnectToConsole)
1775 		{
1776 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1777 			dbgprintf(TEXT("CAdvancedSettings::put_ConnectToServerConsole(%s)"), BooleanToString(pConnectToConsole));
1778 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_ConnectToServerConsole(pConnectToConsole);
1779 			dbgprintf(TEXT("CAdvancedSettings::put_ConnectToServerConsole -> %08X"), hr);
1780 			return hr;
1781 		}
1782 
get_ConnectToServerConsole(VARIANT_BOOL * pConnectToConsole)1783 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_ConnectToServerConsole(VARIANT_BOOL * pConnectToConsole)
1784 		{
1785 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1786 			dbgprintf(TEXT("CAdvancedSettings::get_ConnectToServerConsole(%p)"), pConnectToConsole);
1787 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_ConnectToServerConsole(pConnectToConsole);
1788 			dbgprintf(TEXT("CAdvancedSettings::get_ConnectToServerConsole -> %08X, ConnectToConsole = %s"), hr, BooleanToString(*pConnectToConsole));
1789 			return hr;
1790 		}
1791 
put_BitmapPersistence(long pbitmapPersistence)1792 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_BitmapPersistence(long pbitmapPersistence)
1793 		{
1794 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1795 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapPersistence(%ld)"), pbitmapPersistence);
1796 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_BitmapPersistence(pbitmapPersistence);
1797 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapPersistence -> %08X"), hr);
1798 			return hr;
1799 		}
1800 
get_BitmapPersistence(long * pbitmapPersistence)1801 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_BitmapPersistence(long * pbitmapPersistence)
1802 		{
1803 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1804 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapPersistence(%p)"), pbitmapPersistence);
1805 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_BitmapPersistence(pbitmapPersistence);
1806 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapPersistence -> %08X, bitmapPersistence = %ld"), hr, *pbitmapPersistence);
1807 			return hr;
1808 		}
1809 
put_MinutesToIdleTimeout(long pminutesToIdleTimeout)1810 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_MinutesToIdleTimeout(long pminutesToIdleTimeout)
1811 		{
1812 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1813 			dbgprintf(TEXT("CAdvancedSettings::put_MinutesToIdleTimeout(%ld)"), pminutesToIdleTimeout);
1814 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_MinutesToIdleTimeout(pminutesToIdleTimeout);
1815 			dbgprintf(TEXT("CAdvancedSettings::put_MinutesToIdleTimeout -> %08X"), hr);
1816 			return hr;
1817 		}
1818 
get_MinutesToIdleTimeout(long * pminutesToIdleTimeout)1819 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_MinutesToIdleTimeout(long * pminutesToIdleTimeout)
1820 		{
1821 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1822 			dbgprintf(TEXT("CAdvancedSettings::get_MinutesToIdleTimeout(%p)"), pminutesToIdleTimeout);
1823 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_MinutesToIdleTimeout(pminutesToIdleTimeout);
1824 			dbgprintf(TEXT("CAdvancedSettings::get_MinutesToIdleTimeout -> %08X, minutesToIdleTimeout = %ld"), hr, *pminutesToIdleTimeout);
1825 			return hr;
1826 		}
1827 
put_SmartSizing(VARIANT_BOOL pfSmartSizing)1828 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_SmartSizing(VARIANT_BOOL pfSmartSizing)
1829 		{
1830 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1831 			dbgprintf(TEXT("CAdvancedSettings::put_SmartSizing(%s)"), BooleanToString(pfSmartSizing));
1832 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_SmartSizing(pfSmartSizing);
1833 			dbgprintf(TEXT("CAdvancedSettings::put_SmartSizing -> %08X"), hr);
1834 			return hr;
1835 		}
1836 
get_SmartSizing(VARIANT_BOOL * pfSmartSizing)1837 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_SmartSizing(VARIANT_BOOL * pfSmartSizing)
1838 		{
1839 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1840 			dbgprintf(TEXT("CAdvancedSettings::get_SmartSizing(%p)"), pfSmartSizing);
1841 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_SmartSizing(pfSmartSizing);
1842 			dbgprintf(TEXT("CAdvancedSettings::get_SmartSizing -> %08X, fSmartSizing = %s"), hr, BooleanToString(*pfSmartSizing));
1843 			return hr;
1844 		}
1845 
put_RdpdrLocalPrintingDocName(BSTR pLocalPrintingDocName)1846 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_RdpdrLocalPrintingDocName(BSTR pLocalPrintingDocName)
1847 		{
1848 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1849 			dbgprintf(TEXT("CAdvancedSettings::put_RdpdrLocalPrintingDocName(%ls)"), pLocalPrintingDocName);
1850 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_RdpdrLocalPrintingDocName(pLocalPrintingDocName);
1851 			dbgprintf(TEXT("CAdvancedSettings::put_RdpdrLocalPrintingDocName -> %08X"), hr);
1852 			return hr;
1853 		}
1854 
get_RdpdrLocalPrintingDocName(BSTR * pLocalPrintingDocName)1855 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_RdpdrLocalPrintingDocName(BSTR * pLocalPrintingDocName)
1856 		{
1857 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1858 			dbgprintf(TEXT("CAdvancedSettings::get_RdpdrLocalPrintingDocName(%p)"), pLocalPrintingDocName);
1859 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_RdpdrLocalPrintingDocName(pLocalPrintingDocName);
1860 			dbgprintf(TEXT("CAdvancedSettings::get_RdpdrLocalPrintingDocName -> %08X, LocalPrintingDocName = %ls"), hr, *pLocalPrintingDocName);
1861 			return hr;
1862 		}
1863 
put_RdpdrClipCleanTempDirString(BSTR clipCleanTempDirString)1864 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_RdpdrClipCleanTempDirString(BSTR clipCleanTempDirString)
1865 		{
1866 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1867 			dbgprintf(TEXT("CAdvancedSettings::put_RdpdrClipCleanTempDirString(%ls)"), clipCleanTempDirString);
1868 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_RdpdrClipCleanTempDirString(clipCleanTempDirString);
1869 			dbgprintf(TEXT("CAdvancedSettings::put_RdpdrClipCleanTempDirString -> %08X"), hr);
1870 			return hr;
1871 		}
1872 
get_RdpdrClipCleanTempDirString(BSTR * clipCleanTempDirString)1873 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_RdpdrClipCleanTempDirString(BSTR * clipCleanTempDirString)
1874 		{
1875 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1876 			dbgprintf(TEXT("CAdvancedSettings::get_RdpdrClipCleanTempDirString(%p)"), clipCleanTempDirString);
1877 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_RdpdrClipCleanTempDirString(clipCleanTempDirString);
1878 			dbgprintf(TEXT("CAdvancedSettings::get_RdpdrClipCleanTempDirString -> %08X, clipCleanTempDirString = %ls"), hr, *clipCleanTempDirString);
1879 			return hr;
1880 		}
1881 
put_RdpdrClipPasteInfoString(BSTR clipPasteInfoString)1882 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_RdpdrClipPasteInfoString(BSTR clipPasteInfoString)
1883 		{
1884 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1885 			dbgprintf(TEXT("CAdvancedSettings::put_RdpdrClipPasteInfoString(%ls)"), clipPasteInfoString);
1886 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_RdpdrClipPasteInfoString(clipPasteInfoString);
1887 			dbgprintf(TEXT("CAdvancedSettings::put_RdpdrClipPasteInfoString -> %08X"), hr);
1888 			return hr;
1889 		}
1890 
get_RdpdrClipPasteInfoString(BSTR * clipPasteInfoString)1891 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_RdpdrClipPasteInfoString(BSTR * clipPasteInfoString)
1892 		{
1893 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1894 			dbgprintf(TEXT("CAdvancedSettings::get_RdpdrClipPasteInfoString(%p)"), clipPasteInfoString);
1895 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_RdpdrClipPasteInfoString(clipPasteInfoString);
1896 			dbgprintf(TEXT("CAdvancedSettings::get_RdpdrClipPasteInfoString -> %08X, clipPasteInfoString = %ls"), hr, *clipPasteInfoString);
1897 			return hr;
1898 		}
1899 
put_ClearTextPassword(BSTR rhs)1900 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_ClearTextPassword(BSTR rhs)
1901 		{
1902 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1903 			dbgprintf(TEXT("CAdvancedSettings::put_ClearTextPassword(%ls)"), rhs);
1904 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_ClearTextPassword(rhs);
1905 			dbgprintf(TEXT("CAdvancedSettings::put_ClearTextPassword -> %08X"), hr);
1906 			return hr;
1907 		}
1908 
put_DisplayConnectionBar(VARIANT_BOOL pDisplayConnectionBar)1909 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_DisplayConnectionBar(VARIANT_BOOL pDisplayConnectionBar)
1910 		{
1911 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1912 			dbgprintf(TEXT("CAdvancedSettings::put_DisplayConnectionBar(%s)"), BooleanToString(pDisplayConnectionBar));
1913 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_DisplayConnectionBar(pDisplayConnectionBar);
1914 			dbgprintf(TEXT("CAdvancedSettings::put_DisplayConnectionBar -> %08X"), hr);
1915 			return hr;
1916 		}
1917 
get_DisplayConnectionBar(VARIANT_BOOL * pDisplayConnectionBar)1918 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_DisplayConnectionBar(VARIANT_BOOL * pDisplayConnectionBar)
1919 		{
1920 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1921 			dbgprintf(TEXT("CAdvancedSettings::get_DisplayConnectionBar(%p)"), pDisplayConnectionBar);
1922 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_DisplayConnectionBar(pDisplayConnectionBar);
1923 			dbgprintf(TEXT("CAdvancedSettings::get_DisplayConnectionBar -> %08X, DisplayConnectionBar = %s"), hr, BooleanToString(*pDisplayConnectionBar));
1924 			return hr;
1925 		}
1926 
put_PinConnectionBar(VARIANT_BOOL pPinConnectionBar)1927 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_PinConnectionBar(VARIANT_BOOL pPinConnectionBar)
1928 		{
1929 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1930 			dbgprintf(TEXT("CAdvancedSettings::put_PinConnectionBar(%s)"), BooleanToString(pPinConnectionBar));
1931 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_PinConnectionBar(pPinConnectionBar);
1932 			dbgprintf(TEXT("CAdvancedSettings::put_PinConnectionBar -> %08X"), hr);
1933 			return hr;
1934 		}
1935 
get_PinConnectionBar(VARIANT_BOOL * pPinConnectionBar)1936 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_PinConnectionBar(VARIANT_BOOL * pPinConnectionBar)
1937 		{
1938 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1939 			dbgprintf(TEXT("CAdvancedSettings::get_PinConnectionBar(%p)"), pPinConnectionBar);
1940 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_PinConnectionBar(pPinConnectionBar);
1941 			dbgprintf(TEXT("CAdvancedSettings::get_PinConnectionBar -> %08X, PinConnectionBar = %s"), hr, BooleanToString(*pPinConnectionBar));
1942 			return hr;
1943 		}
1944 
put_GrabFocusOnConnect(VARIANT_BOOL pfGrabFocusOnConnect)1945 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_GrabFocusOnConnect(VARIANT_BOOL pfGrabFocusOnConnect)
1946 		{
1947 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1948 			dbgprintf(TEXT("CAdvancedSettings::put_GrabFocusOnConnect(%s)"), BooleanToString(pfGrabFocusOnConnect));
1949 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_GrabFocusOnConnect(pfGrabFocusOnConnect);
1950 			dbgprintf(TEXT("CAdvancedSettings::put_GrabFocusOnConnect -> %08X"), hr);
1951 			return hr;
1952 		}
1953 
get_GrabFocusOnConnect(VARIANT_BOOL * pfGrabFocusOnConnect)1954 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_GrabFocusOnConnect(VARIANT_BOOL * pfGrabFocusOnConnect)
1955 		{
1956 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1957 			dbgprintf(TEXT("CAdvancedSettings::get_GrabFocusOnConnect(%p)"), pfGrabFocusOnConnect);
1958 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_GrabFocusOnConnect(pfGrabFocusOnConnect);
1959 			dbgprintf(TEXT("CAdvancedSettings::get_GrabFocusOnConnect -> %08X, fGrabFocusOnConnect = %s"), hr, BooleanToString(*pfGrabFocusOnConnect));
1960 			return hr;
1961 		}
1962 
put_LoadBalanceInfo(BSTR pLBInfo)1963 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_LoadBalanceInfo(BSTR pLBInfo)
1964 		{
1965 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1966 			dbgprintf(TEXT("CAdvancedSettings::put_LoadBalanceInfo(%ls)"), pLBInfo);
1967 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_LoadBalanceInfo(pLBInfo);
1968 			dbgprintf(TEXT("CAdvancedSettings::put_LoadBalanceInfo -> %08X"), hr);
1969 			return hr;
1970 		}
1971 
get_LoadBalanceInfo(BSTR * pLBInfo)1972 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_LoadBalanceInfo(BSTR * pLBInfo)
1973 		{
1974 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1975 			dbgprintf(TEXT("CAdvancedSettings::get_LoadBalanceInfo(%p)"), pLBInfo);
1976 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_LoadBalanceInfo(pLBInfo);
1977 			dbgprintf(TEXT("CAdvancedSettings::get_LoadBalanceInfo -> %08X, LBInfo = %ls"), hr, *pLBInfo);
1978 			return hr;
1979 		}
1980 
put_RedirectDrives(VARIANT_BOOL pRedirectDrives)1981 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_RedirectDrives(VARIANT_BOOL pRedirectDrives)
1982 		{
1983 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1984 			dbgprintf(TEXT("CAdvancedSettings::put_RedirectDrives(%s)"), BooleanToString(pRedirectDrives));
1985 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_RedirectDrives(pRedirectDrives);
1986 			dbgprintf(TEXT("CAdvancedSettings::put_RedirectDrives -> %08X"), hr);
1987 			return hr;
1988 		}
1989 
get_RedirectDrives(VARIANT_BOOL * pRedirectDrives)1990 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_RedirectDrives(VARIANT_BOOL * pRedirectDrives)
1991 		{
1992 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
1993 			dbgprintf(TEXT("CAdvancedSettings::get_RedirectDrives(%p)"), pRedirectDrives);
1994 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_RedirectDrives(pRedirectDrives);
1995 			dbgprintf(TEXT("CAdvancedSettings::get_RedirectDrives -> %08X, RedirectDrives = %s"), hr, BooleanToString(*pRedirectDrives));
1996 			return hr;
1997 		}
1998 
put_RedirectPrinters(VARIANT_BOOL pRedirectPrinters)1999 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_RedirectPrinters(VARIANT_BOOL pRedirectPrinters)
2000 		{
2001 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2002 			dbgprintf(TEXT("CAdvancedSettings::put_RedirectPrinters(%s)"), BooleanToString(pRedirectPrinters));
2003 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_RedirectPrinters(pRedirectPrinters);
2004 			dbgprintf(TEXT("CAdvancedSettings::put_RedirectPrinters -> %08X"), hr);
2005 			return hr;
2006 		}
2007 
get_RedirectPrinters(VARIANT_BOOL * pRedirectPrinters)2008 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_RedirectPrinters(VARIANT_BOOL * pRedirectPrinters)
2009 		{
2010 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2011 			dbgprintf(TEXT("CAdvancedSettings::get_RedirectPrinters(%p)"), pRedirectPrinters);
2012 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_RedirectPrinters(pRedirectPrinters);
2013 			dbgprintf(TEXT("CAdvancedSettings::get_RedirectPrinters -> %08X, RedirectPrinters = %s"), hr, BooleanToString(*pRedirectPrinters));
2014 			return hr;
2015 		}
2016 
put_RedirectPorts(VARIANT_BOOL pRedirectPorts)2017 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_RedirectPorts(VARIANT_BOOL pRedirectPorts)
2018 		{
2019 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2020 			dbgprintf(TEXT("CAdvancedSettings::put_RedirectPorts(%s)"), BooleanToString(pRedirectPorts));
2021 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_RedirectPorts(pRedirectPorts);
2022 			dbgprintf(TEXT("CAdvancedSettings::put_RedirectPorts -> %08X"), hr);
2023 			return hr;
2024 		}
2025 
get_RedirectPorts(VARIANT_BOOL * pRedirectPorts)2026 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_RedirectPorts(VARIANT_BOOL * pRedirectPorts)
2027 		{
2028 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2029 			dbgprintf(TEXT("CAdvancedSettings::get_RedirectPorts(%p)"), pRedirectPorts);
2030 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_RedirectPorts(pRedirectPorts);
2031 			dbgprintf(TEXT("CAdvancedSettings::get_RedirectPorts -> %08X, RedirectPorts = %s"), hr, BooleanToString(*pRedirectPorts));
2032 			return hr;
2033 		}
2034 
put_RedirectSmartCards(VARIANT_BOOL pRedirectSmartCards)2035 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_RedirectSmartCards(VARIANT_BOOL pRedirectSmartCards)
2036 		{
2037 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2038 			dbgprintf(TEXT("CAdvancedSettings::put_RedirectSmartCards(%s)"), BooleanToString(pRedirectSmartCards));
2039 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_RedirectSmartCards(pRedirectSmartCards);
2040 			dbgprintf(TEXT("CAdvancedSettings::put_RedirectSmartCards -> %08X"), hr);
2041 			return hr;
2042 		}
2043 
get_RedirectSmartCards(VARIANT_BOOL * pRedirectSmartCards)2044 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_RedirectSmartCards(VARIANT_BOOL * pRedirectSmartCards)
2045 		{
2046 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2047 			dbgprintf(TEXT("CAdvancedSettings::get_RedirectSmartCards(%p)"), pRedirectSmartCards);
2048 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_RedirectSmartCards(pRedirectSmartCards);
2049 			dbgprintf(TEXT("CAdvancedSettings::get_RedirectSmartCards -> %08X, RedirectSmartCards = %s"), hr, BooleanToString(*pRedirectSmartCards));
2050 			return hr;
2051 		}
2052 
put_BitmapVirtualCache16BppSize(long pBitmapVirtualCache16BppSize)2053 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_BitmapVirtualCache16BppSize(long pBitmapVirtualCache16BppSize)
2054 		{
2055 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2056 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapVirtualCache16BppSize(%ld)"), pBitmapVirtualCache16BppSize);
2057 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_BitmapVirtualCache16BppSize(pBitmapVirtualCache16BppSize);
2058 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapVirtualCache16BppSize -> %08X"), hr);
2059 			return hr;
2060 		}
2061 
get_BitmapVirtualCache16BppSize(long * pBitmapVirtualCache16BppSize)2062 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_BitmapVirtualCache16BppSize(long * pBitmapVirtualCache16BppSize)
2063 		{
2064 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2065 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapVirtualCache16BppSize(%p)"), pBitmapVirtualCache16BppSize);
2066 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_BitmapVirtualCache16BppSize(pBitmapVirtualCache16BppSize);
2067 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapVirtualCache16BppSize -> %08X, BitmapVirtualCache16BppSize = %ld"), hr, *pBitmapVirtualCache16BppSize);
2068 			return hr;
2069 		}
2070 
put_BitmapVirtualCache24BppSize(long pBitmapVirtualCache24BppSize)2071 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_BitmapVirtualCache24BppSize(long pBitmapVirtualCache24BppSize)
2072 		{
2073 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2074 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapVirtualCache24BppSize(%ld)"), pBitmapVirtualCache24BppSize);
2075 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_BitmapVirtualCache24BppSize(pBitmapVirtualCache24BppSize);
2076 			dbgprintf(TEXT("CAdvancedSettings::put_BitmapVirtualCache24BppSize -> %08X"), hr);
2077 			return hr;
2078 		}
2079 
get_BitmapVirtualCache24BppSize(long * pBitmapVirtualCache24BppSize)2080 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_BitmapVirtualCache24BppSize(long * pBitmapVirtualCache24BppSize)
2081 		{
2082 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2083 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapVirtualCache24BppSize(%p)"), pBitmapVirtualCache24BppSize);
2084 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_BitmapVirtualCache24BppSize(pBitmapVirtualCache24BppSize);
2085 			dbgprintf(TEXT("CAdvancedSettings::get_BitmapVirtualCache24BppSize -> %08X, BitmapVirtualCache24BppSize = %ld"), hr, *pBitmapVirtualCache24BppSize);
2086 			return hr;
2087 		}
2088 
put_PerformanceFlags(long pDisableList)2089 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_PerformanceFlags(long pDisableList)
2090 		{
2091 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2092 			dbgprintf(TEXT("CAdvancedSettings::put_PerformanceFlags(%ld)"), pDisableList);
2093 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_PerformanceFlags(pDisableList);
2094 			dbgprintf(TEXT("CAdvancedSettings::put_PerformanceFlags -> %08X"), hr);
2095 			return hr;
2096 		}
2097 
get_PerformanceFlags(long * pDisableList)2098 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_PerformanceFlags(long * pDisableList)
2099 		{
2100 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2101 			dbgprintf(TEXT("CAdvancedSettings::get_PerformanceFlags(%p)"), pDisableList);
2102 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_PerformanceFlags(pDisableList);
2103 			dbgprintf(TEXT("CAdvancedSettings::get_PerformanceFlags -> %08X, DisableList = %ld"), hr, *pDisableList);
2104 			return hr;
2105 		}
2106 
put_ConnectWithEndpoint(VARIANT * rhs)2107 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_ConnectWithEndpoint(VARIANT * rhs)
2108 		{
2109 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2110 			dbgprintf(TEXT("CAdvancedSettings::put_ConnectWithEndpoint(%s)"), VariantToString(*rhs).c_str());
2111 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_ConnectWithEndpoint(rhs);
2112 			dbgprintf(TEXT("CAdvancedSettings::put_ConnectWithEndpoint -> %08X"), hr);
2113 			return hr;
2114 		}
2115 
put_NotifyTSPublicKey(VARIANT_BOOL pfNotify)2116 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::put_NotifyTSPublicKey(VARIANT_BOOL pfNotify)
2117 		{
2118 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2119 			dbgprintf(TEXT("CAdvancedSettings::put_NotifyTSPublicKey(%s)"), BooleanToString(pfNotify));
2120 			HRESULT hr = pIMsRdpClientAdvancedSettings->put_NotifyTSPublicKey(pfNotify);
2121 			dbgprintf(TEXT("CAdvancedSettings::put_NotifyTSPublicKey -> %08X"), hr);
2122 			return hr;
2123 		}
2124 
get_NotifyTSPublicKey(VARIANT_BOOL * pfNotify)2125 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings::get_NotifyTSPublicKey(VARIANT_BOOL * pfNotify)
2126 		{
2127 			IMsRdpClientAdvancedSettings * pIMsRdpClientAdvancedSettings = getIMsRdpClientAdvancedSettings();
2128 			dbgprintf(TEXT("CAdvancedSettings::get_NotifyTSPublicKey(%p)"), pfNotify);
2129 			HRESULT hr = pIMsRdpClientAdvancedSettings->get_NotifyTSPublicKey(pfNotify);
2130 			dbgprintf(TEXT("CAdvancedSettings::get_NotifyTSPublicKey -> %08X, fNotify = %s"), hr, BooleanToString(*pfNotify));
2131 			return hr;
2132 		}
2133 
2134 		/* IMsRdpClientAdvancedSettings2 */
get_CanAutoReconnect(VARIANT_BOOL * pfCanAutoReconnect)2135 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings2::get_CanAutoReconnect(VARIANT_BOOL * pfCanAutoReconnect)
2136 		{
2137 			IMsRdpClientAdvancedSettings2 * pIMsRdpClientAdvancedSettings2 = getIMsRdpClientAdvancedSettings2();
2138 			dbgprintf(TEXT("CAdvancedSettings::get_CanAutoReconnect(%p)"), pfCanAutoReconnect);
2139 			HRESULT hr = pIMsRdpClientAdvancedSettings2->get_CanAutoReconnect(pfCanAutoReconnect);
2140 			dbgprintf(TEXT("CAdvancedSettings::get_CanAutoReconnect -> %08X, fCanAutoReconnect = %s"), hr, BooleanToString(*pfCanAutoReconnect));
2141 			return hr;
2142 		}
2143 
put_EnableAutoReconnect(VARIANT_BOOL pfEnableAutoReconnect)2144 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings2::put_EnableAutoReconnect(VARIANT_BOOL pfEnableAutoReconnect)
2145 		{
2146 			IMsRdpClientAdvancedSettings2 * pIMsRdpClientAdvancedSettings2 = getIMsRdpClientAdvancedSettings2();
2147 			dbgprintf(TEXT("CAdvancedSettings::put_EnableAutoReconnect(%s)"), BooleanToString(pfEnableAutoReconnect));
2148 			HRESULT hr = pIMsRdpClientAdvancedSettings2->put_EnableAutoReconnect(pfEnableAutoReconnect);
2149 			dbgprintf(TEXT("CAdvancedSettings::put_EnableAutoReconnect -> %08X"), hr);
2150 			return hr;
2151 		}
2152 
get_EnableAutoReconnect(VARIANT_BOOL * pfEnableAutoReconnect)2153 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings2::get_EnableAutoReconnect(VARIANT_BOOL * pfEnableAutoReconnect)
2154 		{
2155 			IMsRdpClientAdvancedSettings2 * pIMsRdpClientAdvancedSettings2 = getIMsRdpClientAdvancedSettings2();
2156 			dbgprintf(TEXT("CAdvancedSettings::get_EnableAutoReconnect(%p)"), pfEnableAutoReconnect);
2157 			HRESULT hr = pIMsRdpClientAdvancedSettings2->get_EnableAutoReconnect(pfEnableAutoReconnect);
2158 			dbgprintf(TEXT("CAdvancedSettings::get_EnableAutoReconnect -> %08X, fEnableAutoReconnect = %s"), hr, BooleanToString(*pfEnableAutoReconnect));
2159 			return hr;
2160 		}
2161 
put_MaxReconnectAttempts(long pMaxReconnectAttempts)2162 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings2::put_MaxReconnectAttempts(long pMaxReconnectAttempts)
2163 		{
2164 			IMsRdpClientAdvancedSettings2 * pIMsRdpClientAdvancedSettings2 = getIMsRdpClientAdvancedSettings2();
2165 			dbgprintf(TEXT("CAdvancedSettings::put_MaxReconnectAttempts(%ld)"), pMaxReconnectAttempts);
2166 			HRESULT hr = pIMsRdpClientAdvancedSettings2->put_MaxReconnectAttempts(pMaxReconnectAttempts);
2167 			dbgprintf(TEXT("CAdvancedSettings::put_MaxReconnectAttempts -> %08X"), hr);
2168 			return hr;
2169 		}
2170 
get_MaxReconnectAttempts(long * pMaxReconnectAttempts)2171 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings2::get_MaxReconnectAttempts(long * pMaxReconnectAttempts)
2172 		{
2173 			IMsRdpClientAdvancedSettings2 * pIMsRdpClientAdvancedSettings2 = getIMsRdpClientAdvancedSettings2();
2174 			dbgprintf(TEXT("CAdvancedSettings::get_MaxReconnectAttempts(%p)"), pMaxReconnectAttempts);
2175 			HRESULT hr = pIMsRdpClientAdvancedSettings2->get_MaxReconnectAttempts(pMaxReconnectAttempts);
2176 			dbgprintf(TEXT("CAdvancedSettings::get_MaxReconnectAttempts -> %08X, MaxReconnectAttempts = %ld"), hr, *pMaxReconnectAttempts);
2177 			return hr;
2178 		}
2179 
2180 		/* IMsRdpClientAdvancedSettings3 */
put_ConnectionBarShowMinimizeButton(VARIANT_BOOL pfShowMinimize)2181 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings3::put_ConnectionBarShowMinimizeButton(VARIANT_BOOL pfShowMinimize)
2182 		{
2183 			IMsRdpClientAdvancedSettings3 * pIMsRdpClientAdvancedSettings3 = getIMsRdpClientAdvancedSettings3();
2184 			dbgprintf(TEXT("CAdvancedSettings::put_ConnectionBarShowMinimizeButton(%s)"), BooleanToString(pfShowMinimize));
2185 			HRESULT hr = pIMsRdpClientAdvancedSettings3->put_ConnectionBarShowMinimizeButton(pfShowMinimize);
2186 			dbgprintf(TEXT("CAdvancedSettings::put_ConnectionBarShowMinimizeButton -> %08X"), hr);
2187 			return hr;
2188 		}
2189 
get_ConnectionBarShowMinimizeButton(VARIANT_BOOL * pfShowMinimize)2190 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings3::get_ConnectionBarShowMinimizeButton(VARIANT_BOOL * pfShowMinimize)
2191 		{
2192 			IMsRdpClientAdvancedSettings3 * pIMsRdpClientAdvancedSettings3 = getIMsRdpClientAdvancedSettings3();
2193 			dbgprintf(TEXT("CAdvancedSettings::get_ConnectionBarShowMinimizeButton(%p)"), pfShowMinimize);
2194 			HRESULT hr = pIMsRdpClientAdvancedSettings3->get_ConnectionBarShowMinimizeButton(pfShowMinimize);
2195 			dbgprintf(TEXT("CAdvancedSettings::get_ConnectionBarShowMinimizeButton -> %08X, fShowMinimize = %s"), hr, BooleanToString(*pfShowMinimize));
2196 			return hr;
2197 		}
2198 
put_ConnectionBarShowRestoreButton(VARIANT_BOOL pfShowRestore)2199 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings3::put_ConnectionBarShowRestoreButton(VARIANT_BOOL pfShowRestore)
2200 		{
2201 			IMsRdpClientAdvancedSettings3 * pIMsRdpClientAdvancedSettings3 = getIMsRdpClientAdvancedSettings3();
2202 			dbgprintf(TEXT("CAdvancedSettings::put_ConnectionBarShowRestoreButton(%s)"), BooleanToString(pfShowRestore));
2203 			HRESULT hr = pIMsRdpClientAdvancedSettings3->put_ConnectionBarShowRestoreButton(pfShowRestore);
2204 			dbgprintf(TEXT("CAdvancedSettings::put_ConnectionBarShowRestoreButton -> %08X"), hr);
2205 			return hr;
2206 		}
2207 
get_ConnectionBarShowRestoreButton(VARIANT_BOOL * pfShowRestore)2208 		virtual STDMETHODIMP IMsRdpClientAdvancedSettings3::get_ConnectionBarShowRestoreButton(VARIANT_BOOL * pfShowRestore)
2209 		{
2210 			IMsRdpClientAdvancedSettings3 * pIMsRdpClientAdvancedSettings3 = getIMsRdpClientAdvancedSettings3();
2211 			dbgprintf(TEXT("CAdvancedSettings::get_ConnectionBarShowRestoreButton(%p)"), pfShowRestore);
2212 			HRESULT hr = pIMsRdpClientAdvancedSettings3->get_ConnectionBarShowRestoreButton(pfShowRestore);
2213 			dbgprintf(TEXT("CAdvancedSettings::get_ConnectionBarShowRestoreButton -> %08X, fShowRestore = %s"), hr, BooleanToString(*pfShowRestore));
2214 			return hr;
2215 		}
2216 
2217 		/* IMsRdpClientAdvancedSettings4 */
put_AuthenticationLevel(unsigned int puiAuthLevel)2218         virtual STDMETHODIMP IMsRdpClientAdvancedSettings4::put_AuthenticationLevel(unsigned int puiAuthLevel)
2219 		{
2220 			IMsRdpClientAdvancedSettings4 * pIMsRdpClientAdvancedSettings4 = getIMsRdpClientAdvancedSettings4();
2221 			dbgprintf(TEXT("CAdvancedSettings::put_AuthenticationLevel(%u)"), puiAuthLevel);
2222 			HRESULT hr = pIMsRdpClientAdvancedSettings4->put_AuthenticationLevel(puiAuthLevel);
2223 			dbgprintf(TEXT("CAdvancedSettings::put_AuthenticationLevel -> %08X"), hr);
2224 			return hr;
2225 		}
get_AuthenticationLevel(unsigned int * puiAuthLevel)2226         virtual STDMETHODIMP IMsRdpClientAdvancedSettings4::get_AuthenticationLevel(unsigned int * puiAuthLevel)
2227 		{
2228 			IMsRdpClientAdvancedSettings4 * pIMsRdpClientAdvancedSettings4 = getIMsRdpClientAdvancedSettings4();
2229 			dbgprintf(TEXT("CAdvancedSettings::get_AuthenticationLevel(%p)"), puiAuthLevel);
2230 			HRESULT hr = pIMsRdpClientAdvancedSettings4->get_AuthenticationLevel(puiAuthLevel);
2231 			dbgprintf(TEXT("CAdvancedSettings::get_AuthenticationLevel -> %08X, uiAuthLevel = %ld"), hr, *puiAuthLevel);
2232 			return hr;
2233 		}
2234 	};
2235 
2236 	class CoClass:
2237 		/* Standard interfaces */
2238 		public IUnknown,
2239 		public IDispatch,
2240 		public IConnectionPointContainer,
2241 		public IDataObject,
2242 		public IObjectSafety,
2243 		public IOleControl,
2244 		public IOleInPlaceActiveObject,
2245 		public IOleInPlaceObject,
2246 		public IOleObject,
2247 		public IOleWindow,
2248 		public IPersist,
2249 		public IPersistPropertyBag,
2250 		public IPersistStorage,
2251 		public IPersistStreamInit,
2252 		public IProvideClassInfo,
2253 		public IProvideClassInfo2,
2254 		public IQuickActivate,
2255 		public ISpecifyPropertyPages,
2256 		public IViewObject,
2257 		public IViewObject2,
2258 
2259 		/* RDP client interfaces */
2260 		public IMsRdpClient4,
2261 		public IMsRdpClientNonScriptable2
2262 	{
2263 	private:
2264 		LONG m_refCount;
2265 
2266 		IUnknown * m_IUnknown;
2267 
2268 		IDispatch * m_IDispatch;
2269 		IConnectionPointContainer * m_IConnectionPointContainer;
2270 		IDataObject * m_IDataObject;
2271 		IObjectSafety * m_IObjectSafety;
2272 		IOleControl * m_IOleControl;
2273 		IOleInPlaceActiveObject * m_IOleInPlaceActiveObject;
2274 		IOleInPlaceObject * m_IOleInPlaceObject;
2275 		IOleObject * m_IOleObject;
2276 		IOleWindow * m_IOleWindow;
2277 		IPersist * m_IPersist;
2278 		IPersistPropertyBag * m_IPersistPropertyBag;
2279 		IPersistStorage * m_IPersistStorage;
2280 		IPersistStreamInit * m_IPersistStreamInit;
2281 		IProvideClassInfo * m_IProvideClassInfo;
2282 		IProvideClassInfo2 * m_IProvideClassInfo2;
2283 		IQuickActivate * m_IQuickActivate;
2284 		ISpecifyPropertyPages * m_ISpecifyPropertyPages;
2285 		IViewObject * m_IViewObject;
2286 		IViewObject2 * m_IViewObject2;
2287 
2288 		IMsRdpClient * m_IMsRdpClient;
2289 		IMsRdpClient2 * m_IMsRdpClient2;
2290 		IMsRdpClient3 * m_IMsRdpClient3;
2291 		IMsRdpClient4 * m_IMsRdpClient4;
2292 		IMsTscAx * m_IMsTscAx;
2293 		IMsTscNonScriptable * m_IMsTscNonScriptable;
2294 		IMsRdpClientNonScriptable * m_IMsRdpClientNonScriptable;
2295 		IMsRdpClientNonScriptable2 * m_IMsRdpClientNonScriptable2;
2296 
getIDispatch()2297 		IDispatch * getIDispatch()
2298 		{
2299 			if(m_IDispatch)
2300 				return m_IDispatch;
2301 
2302 			if(m_IMsRdpClient)
2303 				m_IDispatch = m_IMsRdpClient;
2304 			else if(m_IMsRdpClient2)
2305 				m_IDispatch = m_IMsRdpClient2;
2306 			else if(m_IMsRdpClient3)
2307 				m_IDispatch = m_IMsRdpClient3;
2308 			else if(m_IMsRdpClient4)
2309 				m_IDispatch = m_IMsRdpClient4;
2310 			else if(m_IMsTscAx)
2311 				m_IDispatch = m_IMsTscAx;
2312 
2313 			if(m_IDispatch)
2314 			{
2315 				m_IDispatch->AddRef();
2316 				return m_IDispatch;
2317 			}
2318 
2319 			if(SUCCEEDED(m_IUnknown->QueryInterface(&m_IDispatch)))
2320 				return m_IDispatch;
2321 
2322 			return NULL;
2323 		}
2324 
getIConnectionPointContainer()2325 		IConnectionPointContainer * getIConnectionPointContainer()
2326 		{
2327 			if(m_IConnectionPointContainer)
2328 				return m_IConnectionPointContainer;
2329 
2330 			m_IUnknown->QueryInterface(&m_IConnectionPointContainer);
2331 			return m_IConnectionPointContainer;
2332 
2333 		}
2334 
getIDataObject()2335 		IDataObject * getIDataObject()
2336 		{
2337 			if(m_IDataObject)
2338 				return m_IDataObject;
2339 
2340 			m_IUnknown->QueryInterface(&m_IDataObject);
2341 			return m_IDataObject;
2342 		}
2343 
getIObjectSafety()2344 		IObjectSafety * getIObjectSafety()
2345 		{
2346 			if(m_IObjectSafety)
2347 				return m_IObjectSafety;
2348 
2349 			m_IUnknown->QueryInterface(&m_IObjectSafety);
2350 			return m_IObjectSafety;
2351 		}
2352 
getIOleControl()2353 		IOleControl * getIOleControl()
2354 		{
2355 			if(m_IOleControl)
2356 				return m_IOleControl;
2357 
2358 			m_IUnknown->QueryInterface(&m_IOleControl);
2359 			return m_IOleControl;
2360 		}
2361 
getIOleInPlaceActiveObject()2362 		IOleInPlaceActiveObject * getIOleInPlaceActiveObject()
2363 		{
2364 			if(m_IOleInPlaceActiveObject)
2365 				return m_IOleInPlaceActiveObject;
2366 
2367 			m_IUnknown->QueryInterface(&m_IOleInPlaceActiveObject);
2368 			return m_IOleInPlaceActiveObject;
2369 		}
2370 
getIOleInPlaceObject()2371 		IOleInPlaceObject * getIOleInPlaceObject()
2372 		{
2373 			if(m_IOleInPlaceObject)
2374 				return m_IOleInPlaceObject;
2375 
2376 			m_IUnknown->QueryInterface(&m_IOleInPlaceObject);
2377 			return m_IOleInPlaceObject;
2378 		}
2379 
getIOleObject()2380 		IOleObject * getIOleObject()
2381 		{
2382 			if(m_IOleObject)
2383 				return m_IOleObject;
2384 
2385 			m_IUnknown->QueryInterface(&m_IOleObject);
2386 			return m_IOleObject;
2387 		}
2388 
getIOleWindow()2389 		IOleWindow * getIOleWindow()
2390 		{
2391 			if(m_IOleWindow)
2392 				return m_IOleWindow;
2393 
2394 			if(m_IOleInPlaceActiveObject)
2395 				m_IOleWindow = m_IOleInPlaceActiveObject;
2396 
2397 			if(m_IOleWindow)
2398 			{
2399 				m_IOleWindow->AddRef();
2400 				return m_IOleWindow;
2401 			}
2402 
2403 			m_IUnknown->QueryInterface(&m_IOleWindow);
2404 			return m_IOleWindow;
2405 		}
2406 
getIPersist()2407 		IPersist * getIPersist()
2408 		{
2409 			if(m_IPersist)
2410 				return m_IPersist;
2411 
2412 			if(m_IPersistPropertyBag)
2413 				m_IPersist = m_IPersistPropertyBag;
2414 			else if(m_IPersistStorage)
2415 				m_IPersist = m_IPersistStorage;
2416 			else if(m_IPersistStreamInit)
2417 				m_IPersist = m_IPersistStreamInit;
2418 
2419 			if(m_IPersist)
2420 			{
2421 				m_IPersist->AddRef();
2422 				return m_IPersist;
2423 			}
2424 
2425 			m_IUnknown->QueryInterface(&m_IPersist);
2426 			return m_IPersist;
2427 		}
2428 
getIPersistPropertyBag()2429 		IPersistPropertyBag * getIPersistPropertyBag()
2430 		{
2431 			if(m_IPersistPropertyBag)
2432 				return m_IPersistPropertyBag;
2433 
2434 			m_IUnknown->QueryInterface(&m_IPersistPropertyBag);
2435 			return m_IPersistPropertyBag;
2436 		}
2437 
getIPersistStorage()2438 		IPersistStorage * getIPersistStorage()
2439 		{
2440 			if(m_IPersistStorage)
2441 				return m_IPersistStorage;
2442 
2443 			m_IUnknown->QueryInterface(&m_IPersistStorage);
2444 			return m_IPersistStorage;
2445 		}
2446 
getIPersistStreamInit()2447 		IPersistStreamInit * getIPersistStreamInit()
2448 		{
2449 			if(m_IPersistStreamInit)
2450 				return m_IPersistStreamInit;
2451 
2452 			m_IUnknown->QueryInterface(&m_IPersistStreamInit);
2453 			return m_IPersistStreamInit;
2454 		}
2455 
getIProvideClassInfo()2456 		IProvideClassInfo * getIProvideClassInfo()
2457 		{
2458 			if(m_IProvideClassInfo)
2459 				return m_IProvideClassInfo;
2460 
2461 			if(m_IProvideClassInfo2)
2462 				m_IProvideClassInfo = m_IProvideClassInfo2;
2463 
2464 			if(m_IProvideClassInfo)
2465 			{
2466 				m_IProvideClassInfo->AddRef();
2467 				return m_IProvideClassInfo;
2468 			}
2469 
2470 			m_IUnknown->QueryInterface(&m_IProvideClassInfo);
2471 			return m_IProvideClassInfo;
2472 		}
2473 
getIProvideClassInfo2()2474 		IProvideClassInfo2 * getIProvideClassInfo2()
2475 		{
2476 			if(m_IProvideClassInfo2)
2477 				return m_IProvideClassInfo2;
2478 
2479 			m_IUnknown->QueryInterface(&m_IProvideClassInfo2);
2480 			return m_IProvideClassInfo2;
2481 		}
2482 
getIQuickActivate()2483 		IQuickActivate * getIQuickActivate()
2484 		{
2485 			if(m_IQuickActivate)
2486 				return m_IQuickActivate;
2487 
2488 			m_IUnknown->QueryInterface(&m_IQuickActivate);
2489 			return m_IQuickActivate;
2490 		}
2491 
getISpecifyPropertyPages()2492 		ISpecifyPropertyPages * getISpecifyPropertyPages()
2493 		{
2494 			if(m_ISpecifyPropertyPages)
2495 				return m_ISpecifyPropertyPages;
2496 
2497 			m_IUnknown->QueryInterface(&m_ISpecifyPropertyPages);
2498 			return m_ISpecifyPropertyPages;
2499 		}
2500 
getIViewObject()2501 		IViewObject * getIViewObject()
2502 		{
2503 			if(m_IViewObject)
2504 				return m_IViewObject;
2505 
2506 			if(m_IViewObject2)
2507 				m_IViewObject = m_IViewObject2;
2508 
2509 			if(m_IViewObject)
2510 			{
2511 				m_IViewObject->AddRef();
2512 				return m_IViewObject;
2513 			}
2514 
2515 			m_IUnknown->QueryInterface(&m_IViewObject);
2516 			return m_IViewObject;
2517 		}
2518 
getIViewObject2()2519 		IViewObject2 * getIViewObject2()
2520 		{
2521 			if(m_IViewObject2)
2522 				return m_IViewObject2;
2523 
2524 			m_IUnknown->QueryInterface(&m_IViewObject2);
2525 			return m_IViewObject2;
2526 		}
2527 
getIMsRdpClient()2528 		IMsRdpClient * getIMsRdpClient()
2529 		{
2530 			if(m_IMsRdpClient)
2531 				return m_IMsRdpClient;
2532 
2533 			if(m_IMsRdpClient2)
2534 				m_IMsRdpClient = m_IMsRdpClient2;
2535 			else if(m_IMsRdpClient3)
2536 				m_IMsRdpClient = m_IMsRdpClient3;
2537 			else if(m_IMsRdpClient4)
2538 				m_IMsRdpClient = m_IMsRdpClient4;
2539 
2540 			if(m_IMsRdpClient)
2541 			{
2542 				m_IMsRdpClient->AddRef();
2543 				return m_IMsRdpClient;
2544 			}
2545 
2546 			m_IUnknown->QueryInterface(&m_IMsRdpClient);
2547 			return m_IMsRdpClient;
2548 		}
2549 
getIMsRdpClient2()2550 		IMsRdpClient2 * getIMsRdpClient2()
2551 		{
2552 			if(m_IMsRdpClient2)
2553 				return m_IMsRdpClient2;
2554 
2555 			if(m_IMsRdpClient3)
2556 				m_IMsRdpClient2 = m_IMsRdpClient3;
2557 			else if(m_IMsRdpClient4)
2558 				m_IMsRdpClient2 = m_IMsRdpClient4;
2559 
2560 			if(m_IMsRdpClient2)
2561 			{
2562 				m_IMsRdpClient2->AddRef();
2563 				return m_IMsRdpClient2;
2564 			}
2565 
2566 			m_IUnknown->QueryInterface(&m_IMsRdpClient2);
2567 			return m_IMsRdpClient2;
2568 		}
2569 
getIMsRdpClient3()2570 		IMsRdpClient3 * getIMsRdpClient3()
2571 		{
2572 			if(m_IMsRdpClient3)
2573 				return m_IMsRdpClient3;
2574 
2575 			if(m_IMsRdpClient4)
2576 				m_IMsRdpClient3 = m_IMsRdpClient4;
2577 
2578 			if(m_IMsRdpClient3)
2579 			{
2580 				m_IMsRdpClient3->AddRef();
2581 				return m_IMsRdpClient3;
2582 			}
2583 
2584 			m_IUnknown->QueryInterface(&m_IMsRdpClient3);
2585 			return m_IMsRdpClient3;
2586 		}
2587 
getIMsRdpClient4()2588 		IMsRdpClient4 * getIMsRdpClient4()
2589 		{
2590 			if(m_IMsRdpClient4)
2591 				return m_IMsRdpClient4;
2592 
2593 			m_IUnknown->QueryInterface(&m_IMsRdpClient4);
2594 			return m_IMsRdpClient4;
2595 		}
2596 
getIMsTscAx()2597 		IMsTscAx * getIMsTscAx()
2598 		{
2599 			if(m_IMsTscAx)
2600 				return m_IMsTscAx;
2601 
2602 			if(m_IMsRdpClient)
2603 				m_IMsTscAx = m_IMsRdpClient;
2604 			else if(m_IMsRdpClient2)
2605 				m_IMsTscAx = m_IMsRdpClient2;
2606 			else if(m_IMsRdpClient3)
2607 				m_IMsTscAx = m_IMsRdpClient3;
2608 			else if(m_IMsRdpClient4)
2609 				m_IMsTscAx = m_IMsRdpClient4;
2610 
2611 			if(m_IMsTscAx)
2612 			{
2613 				m_IMsTscAx->AddRef();
2614 				return m_IMsTscAx;
2615 			}
2616 
2617 			m_IUnknown->QueryInterface(&m_IMsTscAx);
2618 			return m_IMsTscAx;
2619 		}
2620 
getIMsTscNonScriptable()2621 		IMsTscNonScriptable * getIMsTscNonScriptable()
2622 		{
2623 			if(m_IMsTscNonScriptable)
2624 				return m_IMsTscNonScriptable;
2625 
2626 			if(m_IMsRdpClientNonScriptable)
2627 				m_IMsTscNonScriptable = m_IMsRdpClientNonScriptable;
2628 			else if(m_IMsRdpClientNonScriptable2)
2629 				m_IMsTscNonScriptable = m_IMsRdpClientNonScriptable2;
2630 
2631 			if(m_IMsTscNonScriptable)
2632 			{
2633 				m_IMsTscNonScriptable->AddRef();
2634 				return m_IMsTscNonScriptable;
2635 			}
2636 
2637 			m_IUnknown->QueryInterface(&m_IMsTscNonScriptable);
2638 			return m_IMsTscNonScriptable;
2639 		}
2640 
getIMsRdpClientNonScriptable()2641 		IMsRdpClientNonScriptable * getIMsRdpClientNonScriptable()
2642 		{
2643 			if(m_IMsRdpClientNonScriptable)
2644 				return m_IMsRdpClientNonScriptable;
2645 
2646 			if(m_IMsRdpClientNonScriptable2)
2647 				m_IMsRdpClientNonScriptable = m_IMsRdpClientNonScriptable2;
2648 
2649 			if(m_IMsRdpClientNonScriptable)
2650 			{
2651 				m_IMsRdpClientNonScriptable->AddRef();
2652 				return m_IMsRdpClientNonScriptable;
2653 			}
2654 
2655 			m_IUnknown->QueryInterface(&m_IMsRdpClientNonScriptable);
2656 			return m_IMsRdpClientNonScriptable;
2657 		}
2658 
getIMsRdpClientNonScriptable2()2659 		IMsRdpClientNonScriptable2 * getIMsRdpClientNonScriptable2()
2660 		{
2661 			if(m_IMsRdpClientNonScriptable2)
2662 				return m_IMsRdpClientNonScriptable2;
2663 
2664 			m_IUnknown->QueryInterface(&m_IMsRdpClientNonScriptable2);
2665 			return m_IMsRdpClientNonScriptable2;
2666 		}
2667 
2668 	private:
2669 		IUnknown * m_outer;
2670 
queryInterface(REFIID riid,void ** ppvObject)2671         HRESULT queryInterface(REFIID riid, void ** ppvObject)
2672 		{
2673 			HRESULT hr;
2674 			IUnknown * pvObject = NULL;
2675 
2676 			dbgprintf(TEXT("IUnknown::QueryInterface(%ls, %p)"), UUIDToString(riid).c_str(), ppvObject);
2677 
2678 #define QIBEGIN() \
2679 	if(riid == IID_IUnknown) \
2680 	{ \
2681 		assert(0); \
2682 	}
2683 
2684 #define QI(I) \
2685 	else if(riid == IID_ ## I) \
2686 	{ \
2687 		if(m_ ## I) \
2688 		{ \
2689 			m_ ## I->AddRef(); \
2690 			hr = S_OK; \
2691 		} \
2692 		else \
2693 		{ \
2694 			hr = m_IUnknown->QueryInterface(&m_ ## I); \
2695 		} \
2696  \
2697 		if(SUCCEEDED(hr)) \
2698 			pvObject = static_cast<I *>(this); \
2699 	}
2700 
2701 #define QIEND() \
2702 	else \
2703 	{ \
2704 		hr = E_NOINTERFACE; \
2705 		pvObject = NULL; \
2706 	}
2707 
2708 			QIBEGIN()
2709 
2710 			/* Standard interfaces */
2711 			QI(IDispatch)
2712 			QI(IConnectionPointContainer)
2713 			QI(IDataObject)
2714 			QI(IObjectSafety)
2715 			QI(IOleControl)
2716 			QI(IOleInPlaceActiveObject)
2717 			QI(IOleInPlaceObject)
2718 			QI(IOleObject)
2719 			QI(IOleWindow)
2720 			QI(IPersist)
2721 			QI(IPersistPropertyBag)
2722 			QI(IPersistStorage)
2723 			QI(IPersistStreamInit)
2724 			QI(IProvideClassInfo)
2725 			QI(IProvideClassInfo2)
2726 			QI(IQuickActivate)
2727 			QI(ISpecifyPropertyPages)
2728 			QI(IViewObject)
2729 			QI(IViewObject2)
2730 
2731 			/* Terminal services client */
2732 			QI(IMsRdpClient)
2733 			QI(IMsRdpClient2)
2734 			QI(IMsRdpClient3)
2735 			QI(IMsRdpClient4)
2736 			QI(IMsTscAx)
2737 			QI(IMsTscNonScriptable)
2738 			QI(IMsRdpClientNonScriptable)
2739 			QI(IMsRdpClientNonScriptable2)
2740 			QIEND()
2741 
2742 #undef QIBEGIN
2743 #undef QIEND
2744 #undef QI
2745 
2746 			if(SUCCEEDED(hr))
2747 			{
2748 				assert(pvObject);
2749 				pvObject->AddRef();
2750 			}
2751 			else
2752 			{
2753 				assert(pvObject == NULL);
2754 			}
2755 
2756 			*ppvObject = pvObject;
2757 
2758 			dbgprintf(TEXT("IUnknown::QueryInterface -> %08X, ppvObject = %p"), hr, *ppvObject);
2759 			return hr;
2760 		}
2761 
addRef()2762         ULONG addRef()
2763 		{
2764 			return InterlockedIncrement(&m_refCount);
2765 		}
2766 
release()2767         ULONG release()
2768 		{
2769 			LONG n = InterlockedDecrement(&m_refCount);
2770 
2771 			if(n == 0)
2772 				delete this;
2773 
2774 			return n;
2775 		}
2776 
2777 		friend class CoClassInner;
2778 
2779 		class CoClassInner: public IUnknown
2780 		{
2781 		public:
QueryInterface(REFIID riid,void ** ppvObject)2782 			virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void ** ppvObject)
2783 			{
2784 				if(riid == IID_IUnknown)
2785 				{
2786 					AddRef();
2787 					*ppvObject = this;
2788 					return S_OK;
2789 				}
2790 
2791 				return InnerToOuter(this)->queryInterface(riid, ppvObject);
2792 			}
2793 
AddRef()2794 			virtual ULONG STDMETHODCALLTYPE AddRef()
2795 			{
2796 				return InnerToOuter(this)->addRef();
2797 			}
2798 
Release()2799 			virtual ULONG STDMETHODCALLTYPE Release()
2800 			{
2801 				return InnerToOuter(this)->release();
2802 			}
2803 		}
2804 		m_inner;
2805 
InnerToOuter(CoClassInner * inner)2806 		static CoClass * InnerToOuter(CoClassInner * inner)
2807 		{
2808 			return CONTAINING_RECORD(inner, CoClass, m_inner);
2809 		}
2810 
2811 	private:
CoClass(IUnknown * pUnknw,IUnknown * pUnkOuter)2812 		CoClass(IUnknown * pUnknw, IUnknown * pUnkOuter):
2813 			m_refCount(1),
2814 			m_outer(pUnkOuter),
2815 			m_IUnknown(pUnknw),
2816 			m_IDispatch(NULL),
2817 			m_IConnectionPointContainer(NULL),
2818 			m_IDataObject(NULL),
2819 			m_IObjectSafety(NULL),
2820 			m_IOleControl(NULL),
2821 			m_IOleInPlaceActiveObject(NULL),
2822 			m_IOleInPlaceObject(NULL),
2823 			m_IOleObject(NULL),
2824 			m_IOleWindow(NULL),
2825 			m_IPersist(NULL),
2826 			m_IPersistPropertyBag(NULL),
2827 			m_IPersistStorage(NULL),
2828 			m_IPersistStreamInit(NULL),
2829 			m_IProvideClassInfo(NULL),
2830 			m_IProvideClassInfo2(NULL),
2831 			m_IQuickActivate(NULL),
2832 			m_ISpecifyPropertyPages(NULL),
2833 			m_IViewObject(NULL),
2834 			m_IViewObject2(NULL),
2835 			m_IMsRdpClient(NULL),
2836 			m_IMsRdpClient2(NULL),
2837 			m_IMsRdpClient3(NULL),
2838 			m_IMsRdpClient4(NULL),
2839 			m_IMsTscAx(NULL),
2840 			m_IMsTscNonScriptable(NULL),
2841 			m_IMsRdpClientNonScriptable(NULL),
2842 			m_IMsRdpClientNonScriptable2(NULL)
2843 		{
2844 			if(m_outer == NULL)
2845 				m_outer = &m_inner;
2846 		}
2847 
2848 	public:
CreateInstance(IUnknown * pUnknw,IUnknown * pUnkOuter,REFIID riid,void ** ppvObject)2849 		static HRESULT CreateInstance(IUnknown * pUnknw, IUnknown * pUnkOuter, REFIID riid, void ** ppvObject)
2850 		{
2851 			HRESULT hr = S_OK;
2852 
2853 			if(pUnkOuter && riid != IID_IUnknown)
2854 				hr = CLASS_E_NOAGGREGATION;
2855 			else
2856 			{
2857 				CoClass * p = new CoClass(pUnknw, pUnkOuter);
2858 
2859 				if(p == NULL)
2860 					hr = E_OUTOFMEMORY;
2861 				else
2862 				{
2863 					hr = p->m_inner.QueryInterface(riid, ppvObject);
2864 
2865 					if(FAILED(hr))
2866 						delete p;
2867 					else
2868 						p->m_inner.Release();
2869 				}
2870 			}
2871 
2872 			if(FAILED(hr))
2873 				pUnknw->Release();
2874 
2875 			return hr;
2876 		}
2877 
2878 	private:
~CoClass()2879 		~CoClass()
2880 		{
2881 			if(m_IUnknown)
2882 				m_IUnknown->Release();
2883 
2884 			if(m_IDispatch)
2885 				m_IDispatch->Release();
2886 
2887 			if(m_IConnectionPointContainer)
2888 				m_IConnectionPointContainer->Release();
2889 
2890 			if(m_IDataObject)
2891 				m_IDataObject->Release();
2892 
2893 			if(m_IObjectSafety)
2894 				m_IObjectSafety->Release();
2895 
2896 			if(m_IOleControl)
2897 				m_IOleControl->Release();
2898 
2899 			if(m_IOleInPlaceActiveObject)
2900 				m_IOleInPlaceActiveObject->Release();
2901 
2902 			if(m_IOleInPlaceObject)
2903 				m_IOleInPlaceObject->Release();
2904 
2905 			if(m_IOleObject)
2906 				m_IOleObject->Release();
2907 
2908 			if(m_IOleWindow)
2909 				m_IOleWindow->Release();
2910 
2911 			if(m_IPersist)
2912 				m_IPersist->Release();
2913 
2914 			if(m_IPersistPropertyBag)
2915 				m_IPersistPropertyBag->Release();
2916 
2917 			if(m_IPersistStorage)
2918 				m_IPersistStorage->Release();
2919 
2920 			if(m_IPersistStreamInit)
2921 				m_IPersistStreamInit->Release();
2922 
2923 			if(m_IProvideClassInfo)
2924 				m_IProvideClassInfo->Release();
2925 
2926 			if(m_IProvideClassInfo2)
2927 				m_IProvideClassInfo2->Release();
2928 
2929 			if(m_IQuickActivate)
2930 				m_IQuickActivate->Release();
2931 
2932 			if(m_ISpecifyPropertyPages)
2933 				m_ISpecifyPropertyPages->Release();
2934 
2935 			if(m_IViewObject)
2936 				m_IViewObject->Release();
2937 
2938 			if(m_IViewObject2)
2939 				m_IViewObject2->Release();
2940 
2941 			if(m_IMsRdpClient)
2942 				m_IMsRdpClient->Release();
2943 
2944 			if(m_IMsRdpClient2)
2945 				m_IMsRdpClient2->Release();
2946 
2947 			if(m_IMsRdpClient3)
2948 				m_IMsRdpClient3->Release();
2949 
2950 			if(m_IMsRdpClient4)
2951 				m_IMsRdpClient4->Release();
2952 
2953 			if(m_IMsTscAx)
2954 				m_IMsTscAx->Release();
2955 
2956 			if(m_IMsTscNonScriptable)
2957 				m_IMsTscNonScriptable->Release();
2958 
2959 			if(m_IMsRdpClientNonScriptable)
2960 				m_IMsRdpClientNonScriptable->Release();
2961 
2962 			if(m_IMsRdpClientNonScriptable2)
2963 				m_IMsRdpClientNonScriptable2->Release();
2964 		}
2965 
2966 		/* IUnknown */
2967 	public:
QueryInterface(REFIID riid,void ** ppvObject)2968         virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void ** ppvObject)
2969 		{
2970 			return m_outer->QueryInterface(riid, ppvObject);
2971 		}
2972 
AddRef(void)2973         virtual ULONG STDMETHODCALLTYPE AddRef(void)
2974 		{
2975 			return m_outer->AddRef();
2976 		}
2977 
Release(void)2978         virtual ULONG STDMETHODCALLTYPE Release(void)
2979 		{
2980 			return m_outer->Release();
2981 		}
2982 
2983 		/* IDispatch */
2984 	private:
FreeExcepInfo(const EXCEPINFO & excepInfo)2985 		static void FreeExcepInfo(const EXCEPINFO& excepInfo)
2986 		{
2987 			if(excepInfo.bstrSource)
2988 				SysFreeString(excepInfo.bstrSource);
2989 
2990 			if(excepInfo.bstrDescription)
2991 				SysFreeString(excepInfo.bstrDescription);
2992 
2993 			if(excepInfo.bstrHelpFile)
2994 				SysFreeString(excepInfo.bstrHelpFile);
2995 		}
2996 
ExcepInfoToString(const EXCEPINFO & excepInfo)2997 		static std::basic_string<TCHAR> ExcepInfoToString(const EXCEPINFO& excepInfo)
2998 		{
2999 			std::basic_ostringstream<TCHAR> o;
3000 
3001 			o << "{";
3002 			o << " code: " << excepInfo.wCode << " from: " << std::basic_string<OLECHAR>(excepInfo.bstrSource, excepInfo.bstrSource + SysStringLen(excepInfo.bstrSource));
3003 
3004 			BSTR bstrDescription = NULL;
3005 
3006 			if(excepInfo.bstrDescription)
3007 				bstrDescription = excepInfo.bstrDescription;
3008 			else if(excepInfo.pfnDeferredFillIn)
3009 			{
3010 				EXCEPINFO excepInfoCopy = excepInfo;
3011 
3012 				if(SUCCEEDED(excepInfoCopy.pfnDeferredFillIn(&excepInfoCopy)) && excepInfoCopy.bstrDescription)
3013 				{
3014 					bstrDescription = excepInfoCopy.bstrDescription;
3015 					excepInfoCopy.bstrDescription = NULL;
3016 				}
3017 
3018 				if(excepInfoCopy.bstrSource == excepInfo.bstrSource)
3019 					excepInfoCopy.bstrSource = NULL;
3020 
3021 				if(excepInfoCopy.bstrHelpFile == excepInfo.bstrDescription)
3022 					excepInfoCopy.bstrDescription = NULL;
3023 
3024 				FreeExcepInfo(excepInfoCopy);
3025 			}
3026 
3027 			if(bstrDescription)
3028 			{
3029 				o << " msg: " << std::basic_string<OLECHAR>(bstrDescription, bstrDescription + SysStringLen(bstrDescription));
3030 
3031 				if(excepInfo.bstrDescription == NULL)
3032 					SysFreeString(bstrDescription);
3033 			}
3034 
3035 			o << " }";
3036 
3037 			return o.str().c_str();
3038 		}
3039 
3040 	public:
GetTypeInfoCount(UINT * pctinfo)3041         virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT * pctinfo)
3042 		{
3043 			IDispatch * pIDispatch = getIDispatch();
3044 			dbgprintf(TEXT("IDispatch::GetTypeInfoCount(%p)"), pctinfo);
3045 			HRESULT hr = pIDispatch->GetTypeInfoCount(pctinfo);
3046 			dbgprintf(TEXT("IDispatch::GetTypeInfoCount -> %08X, ctinfo = %lu"), hr, *pctinfo);
3047 			return hr;
3048 		}
3049 
GetTypeInfo(UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)3050         virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo ** ppTInfo)
3051 		{
3052 			IDispatch * pIDispatch = getIDispatch();
3053 			dbgprintf(TEXT("IDispatch::GetTypeInfo(%lu, %08X, %p)"), iTInfo, lcid, ppTInfo);
3054 			HRESULT hr = pIDispatch->GetTypeInfo(iTInfo, lcid, ppTInfo);
3055 			dbgprintf(TEXT("IDispatch::GetTypeInfo -> %08X, pTInfo = %p"), hr, *ppTInfo);
3056 			return hr;
3057 		}
3058 
GetIDsOfNames(REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)3059         virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR * rgszNames, UINT cNames, LCID lcid, DISPID * rgDispId)
3060 		{
3061 			IDispatch * pIDispatch = getIDispatch();
3062  			std::wstring strtemp;
3063 
3064 			std::wostringstream strtempo;
3065 
3066 			strtemp.resize(0);
3067 			strtemp += L"[ ";
3068 
3069 			for(UINT i = 0; i < cNames; ++ i)
3070 			{
3071 				if(i)
3072 					strtemp += L", ";
3073 
3074 				strtemp += rgszNames[i];
3075 			}
3076 
3077 			strtemp += L" ]";
3078 
3079 			dbgprintf(TEXT("IDispatch::GetIDsOfNames(%ls, %ls, %lu, %08X, %p)"), UUIDToString(riid).c_str(), strtemp.c_str(), cNames, lcid, rgDispId);
3080 			HRESULT hr = pIDispatch->GetIDsOfNames(riid, rgszNames, cNames, lcid, rgDispId);
3081 
3082 			strtemp.resize(0);
3083 			strtempo.str(strtemp);
3084 
3085 			strtempo << L"[ ";
3086 
3087 			for(UINT i = 0; i < cNames; ++ i)
3088 			{
3089 				if(i)
3090 					strtempo << L", ";
3091 
3092 				strtempo << rgDispId[i];
3093 			}
3094 
3095 			strtempo << L" ]";
3096 
3097 			dbgprintf(TEXT("IDispatch::GetIDsOfNames -> %08X, rgDispId = %ls"), hr, strtempo.str().c_str());
3098 
3099 			return hr;
3100 		}
3101 
Invoke(DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)3102 		virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS * pDispParams, VARIANT * pVarResult, EXCEPINFO * pExcepInfo, UINT * puArgErr)
3103 		{
3104 			IDispatch * pIDispatch = getIDispatch();
3105 
3106 			std::basic_ostringstream<TCHAR> strtempo;
3107 
3108 			strtempo << L"{";
3109 
3110 			for(unsigned int i = pDispParams->cArgs, j = pDispParams->cNamedArgs; j < pDispParams->cArgs; -- i, ++ j)
3111 			{
3112 				strtempo << L" ";
3113 				strtempo << VariantToString(pDispParams->rgvarg[i - 1]);
3114 				strtempo << L",";
3115 			}
3116 
3117 			for(unsigned int i = pDispParams->cArgs - pDispParams->cNamedArgs; i > 0; -- i)
3118 			{
3119 				strtempo << L" ";
3120 				strtempo << L"["; strtempo << pDispParams->rgdispidNamedArgs[i - 1]; strtempo << L"] => ";
3121 				strtempo << VariantToString(pDispParams->rgvarg[i - 1]);
3122 				strtempo << L",";
3123 			}
3124 
3125 			strtempo << L" }";
3126 
3127 			dbgprintf(TEXT("IDispatch::Invoke(%ld, %ls, %08X, %04X, %s, %p, %p, %p)"), dispIdMember, UUIDToString(riid).c_str(), lcid, wFlags, strtempo.str().c_str(), pVarResult, pExcepInfo, puArgErr);
3128 
3129 			VARIANT VarResult = { };
3130 			EXCEPINFO ExcepInfo = { };
3131 
3132 			if(pVarResult == NULL)
3133 				pVarResult = &VarResult;
3134 
3135 			if(pExcepInfo == NULL)
3136 				pExcepInfo = &ExcepInfo;
3137 
3138 			HRESULT hr = pIDispatch->Invoke(dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
3139 
3140 			dbgprintf(TEXT("IDispatch::Invoke -> %08X, returns %s, throws %s"), hr, VariantToString(*pVarResult).c_str(), ExcepInfoToString(*pExcepInfo).c_str());
3141 
3142 			FreeExcepInfo(ExcepInfo);
3143 
3144 			return hr;
3145 		}
3146 
3147 		/* IConnectionPointContainer */
3148 	public:
EnumConnectionPoints(IEnumConnectionPoints ** ppEnum)3149 		virtual HRESULT STDMETHODCALLTYPE EnumConnectionPoints(IEnumConnectionPoints ** ppEnum)
3150 		{
3151 			IConnectionPointContainer * pIConnectionPointContainer = getIConnectionPointContainer();
3152 			dbgprintf(TEXT("IConnectionPointContainer::EnumConnectionPoints(%p)"), ppEnum);
3153 			HRESULT hr = pIConnectionPointContainer->EnumConnectionPoints(ppEnum);
3154 			dbgprintf(TEXT("IConnectionPointContainer::EnumConnectionPoints -> %08X, pEnum = %p"), hr, *ppEnum);
3155 
3156 			if(SUCCEEDED(hr))
3157 				*ppEnum = HookIEnumConnectionPoints(*ppEnum);
3158 
3159 			return hr;
3160 		}
3161 
FindConnectionPoint(REFIID riid,IConnectionPoint ** ppCP)3162 		virtual HRESULT STDMETHODCALLTYPE FindConnectionPoint(REFIID riid, IConnectionPoint ** ppCP)
3163 		{
3164 			IConnectionPointContainer * pIConnectionPointContainer = getIConnectionPointContainer();
3165 			dbgprintf(TEXT("IConnectionPointContainer::FindConnectionPoint(%ls, %p)"), UUIDToString(riid).c_str(), ppCP);
3166 			HRESULT hr = pIConnectionPointContainer->FindConnectionPoint(riid, ppCP);
3167 			dbgprintf(TEXT("IConnectionPointContainer::FindConnectionPoint -> %08X, pCP = %p"), hr, *ppCP);
3168 
3169 			if(SUCCEEDED(hr))
3170 				*ppCP = HookIConnectionPoint(*ppCP);
3171 
3172 			return hr;
3173 		}
3174 
3175 		/* IDataObject */
3176 	private:
TargetDeviceToString(const DVTARGETDEVICE & targetdev)3177 		static std::basic_string<TCHAR> TargetDeviceToString(const DVTARGETDEVICE& targetdev)
3178 		{
3179 			if(&targetdev == NULL)
3180 				return TEXT("<null>");
3181 
3182 			std::basic_ostringstream<TCHAR> o;
3183 
3184 			o << "{";
3185 			o << LPCWSTR(targetdev.tdData[targetdev.tdDriverNameOffset]);
3186 
3187 			if(targetdev.tdDeviceNameOffset)
3188 			{
3189 				o << ",";
3190 				o << LPCWSTR(targetdev.tdData[targetdev.tdDeviceNameOffset]);
3191 			}
3192 
3193 			if(targetdev.tdPortNameOffset)
3194 			{
3195 				o << ",";
3196 				o << LPCWSTR(targetdev.tdData[targetdev.tdPortNameOffset]);
3197 			}
3198 
3199 			o << " }";
3200 
3201 			return o.str();
3202 		}
3203 
AspectToString(DWORD aspect)3204 		static LPCTSTR AspectToString(DWORD aspect)
3205 		{
3206 			switch(aspect)
3207 			{
3208 			case DVASPECT_CONTENT: return TEXT("content");
3209 			case DVASPECT_THUMBNAIL: return TEXT("thumbnail");
3210 			case DVASPECT_ICON: return TEXT("icon");
3211 			case DVASPECT_DOCPRINT: return TEXT("printable");
3212 			default: return TEXT("<unknown>");
3213 			}
3214 		}
3215 
TymedToString(DWORD tymed)3216 		static LPCTSTR TymedToString(DWORD tymed)
3217 		{
3218 			switch(tymed)
3219 			{
3220 			case TYMED_HGLOBAL: return TEXT("memory");
3221 			case TYMED_FILE: return TEXT("file");
3222 			case TYMED_ISTREAM: return TEXT("IStream");
3223 			case TYMED_ISTORAGE: return TEXT("IStorage");
3224 			case TYMED_GDI:  return TEXT("bitmap");
3225 			case TYMED_MFPICT: return TEXT("metafile");
3226 			case TYMED_ENHMF: return TEXT("enhanced metafile");
3227 			case TYMED_NULL: return TEXT("<no data>");
3228 			default: return TEXT("<unknown>");
3229 			}
3230 		}
3231 
FormatEtcToString(const FORMATETC & formatetc)3232 		static std::basic_string<TCHAR> FormatEtcToString(const FORMATETC& formatetc)
3233 		{
3234 			std::basic_ostringstream<TCHAR> o;
3235 
3236 			o << "{";
3237 
3238 			// cfFormat
3239 			o << " format: ";
3240 
3241 			switch(formatetc.cfFormat)
3242 			{
3243 			case CF_TEXT:            o << "ANSI text"; break;
3244 			case CF_BITMAP:          o << "bitmap"; break;
3245 			case CF_METAFILEPICT:    o << "metafile"; break;
3246 			case CF_SYLK:            o << "symlink"; break;
3247 			case CF_DIF:             o << "DIF"; break;
3248 			case CF_TIFF:            o << "TIFF"; break;
3249 			case CF_OEMTEXT:         o << "OEM text"; break;
3250 			case CF_DIB:             o << "DIBv4"; break;
3251 			case CF_PALETTE:         o << "palette"; break;
3252 			case CF_PENDATA:         o << "pen data"; break;
3253 			case CF_RIFF:            o << "RIFF"; break;
3254 			case CF_WAVE:            o << "WAV"; break;
3255 			case CF_UNICODETEXT:     o << "Unicode text"; break;
3256 			case CF_ENHMETAFILE:     o << "enhanced metafile"; break;
3257 			case CF_HDROP:           o << "list of files"; break;
3258 			case CF_LOCALE:          o << "LCID"; break;
3259 			case CF_DIBV5:           o << "DIBv5"; break;
3260 			case CF_OWNERDISPLAY:    o << "<owner displayed>"; break;
3261 			case CF_DSPTEXT:         o << "<display text>"; break;
3262 			case CF_DSPBITMAP:       o << "<display bitmap>"; break;
3263 			case CF_DSPMETAFILEPICT: o << "<display metafile>"; break;
3264 			case CF_DSPENHMETAFILE:  o << "<display enhanced metafile>"; break;
3265 
3266 			default:
3267 				o << "<";
3268 
3269 				if(formatetc.cfFormat >= CF_PRIVATEFIRST && formatetc.cfFormat <= CF_PRIVATELAST)
3270 					o << "private";
3271 				else if(formatetc.cfFormat >= CF_GDIOBJFIRST && formatetc.cfFormat <= CF_GDIOBJLAST)
3272 					o << "GDI object";
3273 				else
3274 					o << "unknown";
3275 
3276 				o << " " << std::hex << formatetc.cfFormat << std::dec << ">";
3277 			}
3278 
3279 			// ptd
3280 			if(formatetc.ptd)
3281 				o << " device: " << TargetDeviceToString(*formatetc.ptd);
3282 
3283 			// dwAspect
3284 			o << " aspect: " << AspectToString(formatetc.dwAspect);
3285 
3286 			// lindex
3287 			if(formatetc.dwAspect == DVASPECT_CONTENT || formatetc.dwAspect == DVASPECT_DOCPRINT)
3288 				o << " page split: " << formatetc.lindex;
3289 
3290 			// tymed
3291 			o << " medium: " << TymedToString(formatetc.tymed);
3292 
3293 			return o.str();
3294 		}
3295 
MediumToString(const STGMEDIUM & medium)3296 		static std::basic_string<TCHAR> MediumToString(const STGMEDIUM& medium)
3297 		{
3298 			std::basic_ostringstream<TCHAR> o;
3299 
3300 			o << "{ ";
3301 			o << TymedToString(medium.tymed);
3302 			o << " }";
3303 
3304 			return o.str();
3305 		}
3306 
3307 	public:
GetData(FORMATETC * pformatetcIn,STGMEDIUM * pmedium)3308         virtual HRESULT STDMETHODCALLTYPE GetData(FORMATETC * pformatetcIn, STGMEDIUM * pmedium)
3309 		{
3310 			IDataObject * pIDataObject = getIDataObject();
3311 			dbgprintf(TEXT("IDataObject::GetData(%s, %p)"), FormatEtcToString(*pformatetcIn).c_str(), pmedium);
3312 			HRESULT hr = pIDataObject->GetData(pformatetcIn, pmedium);
3313 			dbgprintf(TEXT("IDataObject::GetData -> %08X, %s"), hr, MediumToString(*pmedium).c_str());
3314 			return hr;
3315 		}
3316 
GetDataHere(FORMATETC * pformatetc,STGMEDIUM * pmedium)3317         virtual HRESULT STDMETHODCALLTYPE GetDataHere(FORMATETC * pformatetc, STGMEDIUM * pmedium)
3318 		{
3319 			IDataObject * pIDataObject = getIDataObject();
3320 			dbgprintf(TEXT("IDataObject::GetDataHere(%s, %p)"), FormatEtcToString(*pformatetc).c_str(), pmedium);
3321 			HRESULT hr = pIDataObject->GetDataHere(pformatetc, pmedium);
3322 			dbgprintf(TEXT("IDataObject::GetDataHere -> %08X, medium = %s"), hr, MediumToString(*pmedium).c_str());
3323 			return hr;
3324 		}
3325 
QueryGetData(FORMATETC * pformatetc)3326         virtual HRESULT STDMETHODCALLTYPE QueryGetData(FORMATETC * pformatetc)
3327 		{
3328 			IDataObject * pIDataObject = getIDataObject();
3329 			dbgprintf(TEXT("IDataObject::QueryGetData(%s)"), FormatEtcToString(*pformatetc).c_str());
3330 			HRESULT hr = pIDataObject->QueryGetData(pformatetc);
3331 			dbgprintf(TEXT("IDataObject::QueryGetData -> %08X"), hr);
3332 			return hr;
3333 		}
3334 
GetCanonicalFormatEtc(FORMATETC * pformatectIn,FORMATETC * pformatetcOut)3335         virtual HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc(FORMATETC * pformatectIn, FORMATETC * pformatetcOut)
3336 		{
3337 			IDataObject * pIDataObject = getIDataObject();
3338 			dbgprintf(TEXT("IDataObject::GetCanonicalFormatEtc(%s, %p)"), FormatEtcToString(*pformatectIn).c_str(), pformatetcOut);
3339 			HRESULT hr = pIDataObject->GetCanonicalFormatEtc(pformatectIn, pformatetcOut);
3340 			dbgprintf(TEXT("IDataObject::GetCanonicalFormatEtc -> %08X, formatetcOut = %s"), hr, FormatEtcToString(*pformatetcOut).c_str());
3341 			return hr;
3342 		}
3343 
SetData(FORMATETC * pformatetc,STGMEDIUM * pmedium,BOOL fRelease)3344         virtual HRESULT STDMETHODCALLTYPE SetData(FORMATETC * pformatetc, STGMEDIUM * pmedium, BOOL fRelease)
3345 		{
3346 			IDataObject * pIDataObject = getIDataObject();
3347 			dbgprintf(TEXT("IDataObject::SetData(%s, %p, %s)"), FormatEtcToString(*pformatetc).c_str(), MediumToString(*pmedium).c_str(), fRelease ? TEXT("true") : TEXT("false"));
3348 			HRESULT hr = pIDataObject->SetData(pformatetc, pmedium, fRelease);
3349 			dbgprintf(TEXT("IDataObject::SetData -> %08X"), hr);
3350 			return hr;
3351 		}
3352 
EnumFormatEtc(DWORD dwDirection,IEnumFORMATETC ** ppenumFormatEtc)3353         virtual HRESULT STDMETHODCALLTYPE EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC ** ppenumFormatEtc)
3354 		{
3355 			IDataObject * pIDataObject = getIDataObject();
3356 			dbgprintf(TEXT("IDataObject::EnumFormatEtc(%lu, %p)"), dwDirection, ppenumFormatEtc);
3357 			HRESULT hr = pIDataObject->EnumFormatEtc(dwDirection, ppenumFormatEtc);
3358 			dbgprintf(TEXT("IDataObject::EnumFormatEtc -> %08X, penumFormatEtc = %p"), hr, *ppenumFormatEtc);
3359 			// TODO: hook
3360 			return hr;
3361 		}
3362 
DAdvise(FORMATETC * pformatetc,DWORD advf,IAdviseSink * pAdvSink,DWORD * pdwConnection)3363         virtual HRESULT STDMETHODCALLTYPE DAdvise(FORMATETC * pformatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection)
3364 		{
3365 			IDataObject * pIDataObject = getIDataObject();
3366 			dbgprintf(TEXT("IDataObject::DAdvise(%s, %lu, %p, %p)"), FormatEtcToString(*pformatetc).c_str(), advf, pAdvSink, pdwConnection);
3367 			HRESULT hr = pIDataObject->DAdvise(pformatetc, advf, pAdvSink, pdwConnection);
3368 			dbgprintf(TEXT("IDataObject::DAdvise -> %08X, dwConnection = %lu"), hr, *pdwConnection);
3369 			// TODO: hook
3370 			return hr;
3371 		}
3372 
DUnadvise(DWORD dwConnection)3373         virtual HRESULT STDMETHODCALLTYPE DUnadvise(DWORD dwConnection)
3374 		{
3375 			IDataObject * pIDataObject = getIDataObject();
3376 			dbgprintf(TEXT("IDataObject::DUnadvise(%lu)"), dwConnection);
3377 			HRESULT hr = pIDataObject->DUnadvise(dwConnection);
3378 			dbgprintf(TEXT("IDataObject::DUnadvise -> %08X"), hr);
3379 			return hr;
3380 		}
3381 
EnumDAdvise(IEnumSTATDATA ** ppenumAdvise)3382         virtual HRESULT STDMETHODCALLTYPE EnumDAdvise(IEnumSTATDATA ** ppenumAdvise)
3383 		{
3384 			IDataObject * pIDataObject = getIDataObject();
3385 			dbgprintf(TEXT("IDataObject::EnumDAdvise(%p)"), ppenumAdvise);
3386 			HRESULT hr = pIDataObject->EnumDAdvise(ppenumAdvise);
3387 			dbgprintf(TEXT("IDataObject::EnumDAdvise -> %08X, penumAdvise = %p"), hr, *ppenumAdvise);
3388 			// TODO: hook
3389 			return hr;
3390 		}
3391 
3392 		/* IObjectSafety */
3393 	public:
GetInterfaceSafetyOptions(REFIID riid,DWORD * pdwSupportedOptions,DWORD * pdwEnabledOptions)3394 		virtual HRESULT STDMETHODCALLTYPE IObjectSafety::GetInterfaceSafetyOptions(REFIID riid, DWORD * pdwSupportedOptions, DWORD * pdwEnabledOptions)
3395 		{
3396 			IObjectSafety * pIObjectSafety = getIObjectSafety();
3397 			dbgprintf(TEXT("IObjectSafety::GetInterfaceSafetyOptions(%ls, %p, %p)"), UUIDToString(riid).c_str(), pdwSupportedOptions, pdwEnabledOptions);
3398 			HRESULT hr = pIObjectSafety->GetInterfaceSafetyOptions(riid, pdwSupportedOptions, pdwEnabledOptions);
3399 			dbgprintf(TEXT("IObjectSafety::GetInterfaceSafetyOptions -> %08X, dwSupportedOptions = %08X, dwEnabledOptions = %08X"), hr, *pdwSupportedOptions, *pdwEnabledOptions);
3400 			return hr;
3401 		}
3402 
SetInterfaceSafetyOptions(REFIID riid,DWORD dwOptionSetMask,DWORD dwEnabledOptions)3403 		virtual HRESULT STDMETHODCALLTYPE IObjectSafety::SetInterfaceSafetyOptions(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
3404 		{
3405 			IObjectSafety * pIObjectSafety = getIObjectSafety();
3406 			dbgprintf(TEXT("IObjectSafety::SetInterfaceSafetyOptions(%ls, %08X, %08X)"), UUIDToString(riid).c_str(), dwOptionSetMask, dwEnabledOptions);
3407 			HRESULT hr = pIObjectSafety->SetInterfaceSafetyOptions(riid, dwOptionSetMask, dwEnabledOptions);
3408 			dbgprintf(TEXT("IObjectSafety::SetInterfaceSafetyOptions -> %08X"), hr);
3409 			return hr;
3410 		}
3411 
3412 		/* IOleControl */
3413 	private:
ControlInfoToString(const CONTROLINFO & ci)3414 		std::basic_string<TCHAR> ControlInfoToString(const CONTROLINFO& ci)
3415 		{
3416 			std::basic_ostringstream<TCHAR> o;
3417 
3418 			int firstdone = 0;
3419 
3420 			o << "{ ";
3421 
3422 			if(ci.cAccel && ci.hAccel)
3423 			{
3424 				LPACCEL pAccel = static_cast<LPACCEL>(GlobalLock(ci.hAccel));
3425 
3426 				if(pAccel)
3427 				{
3428 					for(USHORT i = 0; i < ci.cAccel; ++ i)
3429 					{
3430 						if(i)
3431 							o << ", ";
3432 
3433 						if(pAccel[i].fVirt & FSHIFT)
3434 							o << "SHIFT + ";
3435 
3436 						if(pAccel[i].fVirt & FCONTROL)
3437 							o << "CONTROL + ";
3438 
3439 						if(pAccel[i].fVirt & FALT)
3440 							o << "ALT + ";
3441 
3442 						if(pAccel[i].fVirt & FVIRTKEY)
3443 							o << "<vkey:" << std::hex << pAccel[i].key << std::dec << ">";
3444 						else
3445 							o << wchar_t(pAccel[i].key);
3446 
3447 						o << " " << std::hex << pAccel[i].cmd << std::dec;
3448 					}
3449 
3450 					firstdone = ci.cAccel;
3451 
3452 					GlobalUnlock(pAccel);
3453 				}
3454 			}
3455 
3456 			if(ci.dwFlags & CTRLINFO_EATS_RETURN)
3457 			{
3458 				if(!firstdone)
3459 				{
3460 					o << ", ";
3461 					++ firstdone;
3462 				}
3463 
3464 				o << "ENTER";
3465 			}
3466 
3467 			if(ci.dwFlags & CTRLINFO_EATS_ESCAPE)
3468 			{
3469 				if(!firstdone)
3470 				{
3471 					o << ", ";
3472 					++ firstdone;
3473 				}
3474 
3475 				o << "ESC";
3476 			}
3477 
3478 			if(firstdone)
3479 				o << " ";
3480 
3481 			o << "}";
3482 
3483 			return o.str();
3484 		}
3485 
MnemonicToString(const MSG & msg)3486 		std::basic_string<TCHAR> MnemonicToString(const MSG& msg)
3487 		{
3488 			std::basic_ostringstream<TCHAR> o;
3489 
3490 			o << "[";
3491 
3492 			switch(msg.message)
3493 			{
3494 			case WM_SYSKEYDOWN:
3495 				o << "ALT + ";
3496 
3497 			case WM_KEYDOWN:
3498 				TCHAR sz[1024];
3499 				GetKeyNameText(LONG(msg.lParam), sz, ARRAYSIZE(sz));
3500 				o << sz;
3501 
3502 			default:
3503 				o << "<unknown message " << std::hex << msg.message << std::dec << ">";
3504 			}
3505 
3506 			o << "]";
3507 
3508 			return o.str();
3509 		}
3510 
3511 	public:
GetControlInfo(CONTROLINFO * pCI)3512         virtual HRESULT STDMETHODCALLTYPE GetControlInfo(CONTROLINFO * pCI)
3513 		{
3514 			IOleControl * pIOleControl = getIOleControl();
3515 			dbgprintf(TEXT("IOleControl::GetControlInfo(%p)"), pCI);
3516 			HRESULT hr = pIOleControl->GetControlInfo(pCI);
3517 			dbgprintf(TEXT("IOleControl::GetControlInfo -> %08X, %s"), hr, ControlInfoToString(*pCI).c_str());
3518 			return hr;
3519 		}
3520 
OnMnemonic(MSG * pMsg)3521         virtual HRESULT STDMETHODCALLTYPE OnMnemonic(MSG * pMsg)
3522 		{
3523 			IOleControl * pIOleControl = getIOleControl();
3524 			dbgprintf(TEXT("IOleControl::OnMnemonic(%s)"), MnemonicToString(*pMsg).c_str());
3525 			HRESULT hr = pIOleControl->OnMnemonic(pMsg);
3526 			dbgprintf(TEXT("IOleControl::OnMnemonic -> %08X"), hr);
3527 			return hr;
3528 		}
3529 
OnAmbientPropertyChange(DISPID dispID)3530         virtual HRESULT STDMETHODCALLTYPE OnAmbientPropertyChange(DISPID dispID)
3531 		{
3532 			IOleControl * pIOleControl = getIOleControl();
3533 			dbgprintf(TEXT("IOleControl::OnAmbientPropertyChange(%08X)"), dispID);
3534 			HRESULT hr = pIOleControl->OnAmbientPropertyChange(dispID);
3535 			dbgprintf(TEXT("IOleControl::OnAmbientPropertyChange -> %08X"), hr);
3536 			return hr;
3537 		}
3538 
FreezeEvents(BOOL bFreeze)3539         virtual HRESULT STDMETHODCALLTYPE FreezeEvents(BOOL bFreeze)
3540 		{
3541 			IOleControl * pIOleControl = getIOleControl();
3542 			dbgprintf(TEXT("IOleControl::FreezeEvents(%s)"), BooleanToString(bFreeze));
3543 			HRESULT hr = pIOleControl->FreezeEvents(bFreeze);
3544 			dbgprintf(TEXT("IOleControl::FreezeEvents -> %08X"), hr);
3545 			return hr;
3546 		}
3547 
3548 		/* IOleInPlaceActiveObject */
3549 	public:
TranslateAccelerator(LPMSG lpmsg)3550         virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(LPMSG lpmsg)
3551 		{
3552 			IOleInPlaceActiveObject * pIOleInPlaceActiveObject = getIOleInPlaceActiveObject();
3553 			dbgprintf(TEXT("IOleInPlaceActiveObject::TranslateAccelerator(%s)"), MnemonicToString(*lpmsg).c_str());
3554 			HRESULT hr = pIOleInPlaceActiveObject->TranslateAccelerator(lpmsg);
3555 			dbgprintf(TEXT("IOleInPlaceActiveObject::TranslateAccelerator -> %08X"), hr);
3556 			return hr;
3557 		}
3558 
OnFrameWindowActivate(BOOL fActivate)3559         virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivate(BOOL fActivate)
3560 		{
3561 			IOleInPlaceActiveObject * pIOleInPlaceActiveObject = getIOleInPlaceActiveObject();
3562 			dbgprintf(TEXT("IOleInPlaceActiveObject::OnFrameWindowActivate(%s)"), BooleanToString(fActivate));
3563 			HRESULT hr = pIOleInPlaceActiveObject->OnFrameWindowActivate(fActivate);
3564 			dbgprintf(TEXT("IOleInPlaceActiveObject::OnFrameWindowActivate -> %08X"), hr);
3565 			return hr;
3566 		}
3567 
OnDocWindowActivate(BOOL fActivate)3568         virtual HRESULT STDMETHODCALLTYPE OnDocWindowActivate(BOOL fActivate)
3569 		{
3570 			IOleInPlaceActiveObject * pIOleInPlaceActiveObject = getIOleInPlaceActiveObject();
3571 			dbgprintf(TEXT("IOleInPlaceActiveObject::OnDocWindowActivate(%s)"), BooleanToString(fActivate));
3572 			HRESULT hr = pIOleInPlaceActiveObject->OnDocWindowActivate(fActivate);
3573 			dbgprintf(TEXT("IOleInPlaceActiveObject::OnDocWindowActivate -> %08X"), hr);
3574 			return hr;
3575 		}
3576 
ResizeBorder(LPCRECT prcBorder,IOleInPlaceUIWindow * pUIWindow,BOOL fFrameWindow)3577         virtual HRESULT STDMETHODCALLTYPE ResizeBorder(LPCRECT prcBorder, IOleInPlaceUIWindow * pUIWindow, BOOL fFrameWindow)
3578 		{
3579 			// TODO: hook pUIWindow
3580 			IOleInPlaceActiveObject * pIOleInPlaceActiveObject = getIOleInPlaceActiveObject();
3581 			dbgprintf(TEXT("IOleInPlaceActiveObject::ResizeBorder(%s)"), RectToString(*prcBorder).c_str(), pUIWindow, BooleanToString(fFrameWindow));
3582 			HRESULT hr = pIOleInPlaceActiveObject->ResizeBorder(prcBorder, pUIWindow, fFrameWindow);
3583 			dbgprintf(TEXT("IOleInPlaceActiveObject::ResizeBorder -> %08X"), hr);
3584 			return hr;
3585 		}
3586 
EnableModeless(BOOL fEnable)3587         virtual HRESULT STDMETHODCALLTYPE EnableModeless(BOOL fEnable)
3588 		{
3589 			IOleInPlaceActiveObject * pIOleInPlaceActiveObject = getIOleInPlaceActiveObject();
3590 			dbgprintf(TEXT("IOleInPlaceActiveObject::EnableModeless(%s)"), BooleanToString(fEnable));
3591 			HRESULT hr = pIOleInPlaceActiveObject->EnableModeless(fEnable);
3592 			dbgprintf(TEXT("IOleInPlaceActiveObject::EnableModeless -> %08X"), hr);
3593 			return hr;
3594 		}
3595 
3596 		/* IOleInPlaceObject */
3597 	public:
InPlaceDeactivate(void)3598         virtual HRESULT STDMETHODCALLTYPE InPlaceDeactivate(void)
3599 		{
3600 			IOleInPlaceObject * pIOleInPlaceObject = getIOleInPlaceObject();
3601 			dbgprintf(TEXT("IOleInPlaceObject::InPlaceDeactivate()"));
3602 			HRESULT hr = pIOleInPlaceObject->InPlaceDeactivate();
3603 			dbgprintf(TEXT("IOleInPlaceObject::InPlaceDeactivate -> %08X"), hr);
3604 			return hr;
3605 		}
3606 
UIDeactivate(void)3607         virtual HRESULT STDMETHODCALLTYPE UIDeactivate(void)
3608 		{
3609 			IOleInPlaceObject * pIOleInPlaceObject = getIOleInPlaceObject();
3610 			dbgprintf(TEXT("IOleInPlaceObject::UIDeactivate()"));
3611 			HRESULT hr = pIOleInPlaceObject->UIDeactivate();
3612 			dbgprintf(TEXT("IOleInPlaceObject::UIDeactivate -> %08X"), hr);
3613 			return hr;
3614 		}
3615 
SetObjectRects(LPCRECT lprcPosRect,LPCRECT lprcClipRect)3616         virtual HRESULT STDMETHODCALLTYPE SetObjectRects(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
3617 		{
3618 			IOleInPlaceObject * pIOleInPlaceObject = getIOleInPlaceObject();
3619 			dbgprintf(TEXT("IOleInPlaceObject::SetObjectRects(%s, %s)"), RectToString(*lprcPosRect).c_str(), RectToString(*lprcClipRect).c_str());
3620 			HRESULT hr = pIOleInPlaceObject->SetObjectRects(lprcPosRect, lprcClipRect);
3621 			dbgprintf(TEXT("IOleInPlaceObject::SetObjectRects -> %08X"), hr);
3622 			return hr;
3623 		}
3624 
ReactivateAndUndo(void)3625         virtual HRESULT STDMETHODCALLTYPE ReactivateAndUndo(void)
3626 		{
3627 			IOleInPlaceObject * pIOleInPlaceObject = getIOleInPlaceObject();
3628 			dbgprintf(TEXT("IOleInPlaceObject::ReactivateAndUndo()"));
3629 			HRESULT hr = pIOleInPlaceObject->ReactivateAndUndo();
3630 			dbgprintf(TEXT("IOleInPlaceObject::ReactivateAndUndo -> %08X"), hr);
3631 			return hr;
3632 		}
3633 
3634 		/* IOleWindow */
3635 	public:
GetWindow(HWND * phwnd)3636         virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND * phwnd)
3637 		{
3638 			IOleWindow * pIOleWindow = getIOleWindow();
3639 			dbgprintf(TEXT("IOleWindow::GetWindow(%p)"), phwnd);
3640 			HRESULT hr = pIOleWindow->GetWindow(phwnd);
3641 			dbgprintf(TEXT("IOleWindow::GetWindow -> %08X, hwnd = %X"), hr, *phwnd);
3642 			return hr;
3643 		}
3644 
ContextSensitiveHelp(BOOL fEnterMode)3645         virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode)
3646 		{
3647 			IOleWindow * pIOleWindow = getIOleWindow();
3648 			dbgprintf(TEXT("IOleWindow::ContextSensitiveHelp(%s)"), BooleanToString(fEnterMode));
3649 			HRESULT hr = pIOleWindow->ContextSensitiveHelp(fEnterMode);
3650 			dbgprintf(TEXT("IOleWindow::ContextSensitiveHelp -> %08X"), hr);
3651 			return hr;
3652 		}
3653 
3654 		/* IOleObject */
3655 	public:
SetClientSite(IOleClientSite * pClientSite)3656         virtual HRESULT STDMETHODCALLTYPE SetClientSite(IOleClientSite * pClientSite)
3657 		{
3658 			// TODO: hook pClientSite
3659 			IOleObject * pIOleObject = getIOleObject();
3660 			dbgprintf(TEXT("IOleObject::SetClientSite(%p)"), pClientSite);
3661 			HRESULT hr = pIOleObject->SetClientSite(pClientSite);
3662 			dbgprintf(TEXT("IOleObject::SetClientSite -> %08X"), hr);
3663 			return hr;
3664 		}
3665 
GetClientSite(IOleClientSite ** ppClientSite)3666         virtual HRESULT STDMETHODCALLTYPE GetClientSite(IOleClientSite ** ppClientSite)
3667 		{
3668 			IOleObject * pIOleObject = getIOleObject();
3669 			dbgprintf(TEXT("IOleObject::GetClientSite(%s)"), ppClientSite);
3670 			HRESULT hr = pIOleObject->GetClientSite(ppClientSite);
3671 			dbgprintf(TEXT("IOleObject::GetClientSite -> %08X"), hr, ppClientSite);
3672 			return hr;
3673 		}
3674 
SetHostNames(LPCOLESTR szContainerApp,LPCOLESTR szContainerObj)3675 		virtual HRESULT STDMETHODCALLTYPE SetHostNames(LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
3676 		{
3677 			IOleObject * pIOleObject = getIOleObject();
3678 			dbgprintf(TEXT("IOleObject::SetHostNames(%ls, %ls)"), szContainerApp, szContainerObj);
3679 			HRESULT hr = pIOleObject->SetHostNames(szContainerApp, szContainerObj);
3680 			dbgprintf(TEXT("IOleObject::SetHostNames -> %08X"), hr);
3681 			return hr;
3682 		}
3683 
Close(DWORD dwSaveOption)3684         virtual HRESULT STDMETHODCALLTYPE Close(DWORD dwSaveOption)
3685 		{
3686 			IOleObject * pIOleObject = getIOleObject();
3687 			dbgprintf(TEXT("IOleObject::Close(%lu)"), dwSaveOption);
3688 			HRESULT hr = pIOleObject->Close(dwSaveOption);
3689 			dbgprintf(TEXT("IOleObject::Close -> %08X"), hr);
3690 			return hr;
3691 		}
3692 
SetMoniker(DWORD dwWhichMoniker,IMoniker * pmk)3693         virtual HRESULT STDMETHODCALLTYPE SetMoniker(DWORD dwWhichMoniker, IMoniker * pmk)
3694 		{
3695 			IOleObject * pIOleObject = getIOleObject();
3696 			dbgprintf(TEXT("IOleObject::SetMoniker(%lu, %p)"), dwWhichMoniker, MonikerToString(pmk).c_str());
3697 			HRESULT hr = pIOleObject->SetMoniker(dwWhichMoniker, pmk);
3698 			dbgprintf(TEXT("IOleObject::SetMoniker -> %08X"), hr);
3699 			return hr;
3700 		}
3701 
GetMoniker(DWORD dwAssign,DWORD dwWhichMoniker,IMoniker ** ppmk)3702         virtual HRESULT STDMETHODCALLTYPE GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker ** ppmk)
3703 		{
3704 			IOleObject * pIOleObject = getIOleObject();
3705 			dbgprintf(TEXT("IOleObject::GetMoniker(%lu, %lu, %p)"), dwAssign, dwWhichMoniker, ppmk);
3706 			HRESULT hr = pIOleObject->GetMoniker(dwAssign, dwWhichMoniker, ppmk);
3707 			dbgprintf(TEXT("IOleObject::GetMoniker -> %08X, pmk = %s"), hr, SUCCEEDED(hr) ? MonikerToString(*ppmk).c_str() : TEXT("<null>"));
3708 			return hr;
3709 		}
3710 
InitFromData(IDataObject * pDataObject,BOOL fCreation,DWORD dwReserved)3711         virtual HRESULT STDMETHODCALLTYPE InitFromData(IDataObject * pDataObject, BOOL fCreation, DWORD dwReserved)
3712 		{
3713 			IOleObject * pIOleObject = getIOleObject();
3714 			dbgprintf(TEXT("IOleObject::InitFromData(%p, %s, %lu)"), pDataObject, BooleanToString(fCreation), dwReserved);
3715 			HRESULT hr = pIOleObject->InitFromData(pDataObject, fCreation, dwReserved);
3716 			dbgprintf(TEXT("IOleObject::InitFromData -> %08X"), hr);
3717 			return hr;
3718 		}
3719 
GetClipboardData(DWORD dwReserved,IDataObject ** ppDataObject)3720         virtual HRESULT STDMETHODCALLTYPE GetClipboardData(DWORD dwReserved, IDataObject ** ppDataObject)
3721 		{
3722 			IOleObject * pIOleObject = getIOleObject();
3723 			dbgprintf(TEXT("IOleObject::GetClipboardData(%lu, %p)"), dwReserved, ppDataObject);
3724 			HRESULT hr = pIOleObject->GetClipboardData(dwReserved, ppDataObject);
3725 			dbgprintf(TEXT("IOleObject::GetClipboardData -> %08X, pDataObject = %p"), hr, *ppDataObject);
3726 			return hr;
3727 		}
3728 
DoVerb(LONG iVerb,LPMSG lpmsg,IOleClientSite * pActiveSite,LONG lindex,HWND hwndParent,LPCRECT lprcPosRect)3729         virtual HRESULT STDMETHODCALLTYPE DoVerb(LONG iVerb, LPMSG lpmsg, IOleClientSite * pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
3730 		{
3731 			IOleObject * pIOleObject = getIOleObject();
3732 			dbgprintf(TEXT("IOleObject::DoVerb(%ld, %p, %p, %ld, %p, %s)"), iVerb, lpmsg, pActiveSite, lindex, hwndParent, RectToString(*lprcPosRect).c_str());
3733 			HRESULT hr = pIOleObject->DoVerb(iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect);
3734 			dbgprintf(TEXT("IOleObject::DoVerb -> %08X"), hr);
3735 			return hr;
3736 		}
3737 
EnumVerbs(IEnumOLEVERB ** ppEnumOleVerb)3738         virtual HRESULT STDMETHODCALLTYPE EnumVerbs(IEnumOLEVERB ** ppEnumOleVerb)
3739 		{
3740 			IOleObject * pIOleObject = getIOleObject();
3741 			dbgprintf(TEXT("IOleObject::EnumVerbs(%p)"), ppEnumOleVerb);
3742 			HRESULT hr = pIOleObject->EnumVerbs(ppEnumOleVerb);
3743 			dbgprintf(TEXT("IOleObject::EnumVerbs -> %08X, pEnumOleVerb = %p"), hr, *ppEnumOleVerb);
3744 			// TODO: hook
3745 			return hr;
3746 		}
3747 
Update(void)3748         virtual HRESULT STDMETHODCALLTYPE Update(void)
3749 		{
3750 			IOleObject * pIOleObject = getIOleObject();
3751 			dbgprintf(TEXT("IOleObject::Update(%s)"));
3752 			HRESULT hr = pIOleObject->Update();
3753 			dbgprintf(TEXT("IOleObject::Update -> %08X"), hr);
3754 			return hr;
3755 		}
3756 
IsUpToDate(void)3757         virtual HRESULT STDMETHODCALLTYPE IsUpToDate(void)
3758 		{
3759 			IOleObject * pIOleObject = getIOleObject();
3760 			dbgprintf(TEXT("IOleObject::IsUpToDate(%s)"));
3761 			HRESULT hr = pIOleObject->IsUpToDate();
3762 			dbgprintf(TEXT("IOleObject::IsUpToDate -> %08X"), hr);
3763 			return hr;
3764 		}
3765 
GetUserClassID(CLSID * pClsid)3766         virtual HRESULT STDMETHODCALLTYPE GetUserClassID(CLSID * pClsid)
3767 		{
3768 			IOleObject * pIOleObject = getIOleObject();
3769 			dbgprintf(TEXT("IOleObject::GetUserClassID(%p)"), pClsid);
3770 			HRESULT hr = pIOleObject->GetUserClassID(pClsid);
3771 			dbgprintf(TEXT("IOleObject::GetUserClassID -> %08X, Clsid = %ls"), hr, UUIDToString(*pClsid).c_str());
3772 			return hr;
3773 		}
3774 
GetUserType(DWORD dwFormOfType,LPOLESTR * pszUserType)3775         virtual HRESULT STDMETHODCALLTYPE GetUserType(DWORD dwFormOfType, LPOLESTR * pszUserType)
3776 		{
3777 			IOleObject * pIOleObject = getIOleObject();
3778 			dbgprintf(TEXT("IOleObject::GetUserType(%lu, %p)"), dwFormOfType, pszUserType);
3779 			HRESULT hr = pIOleObject->GetUserType(dwFormOfType, pszUserType);
3780 			dbgprintf(TEXT("IOleObject::GetUserType -> %08X, szUserType = %s"), hr, *pszUserType);
3781 			return hr;
3782 		}
3783 
SetExtent(DWORD dwDrawAspect,SIZEL * psizel)3784         virtual HRESULT STDMETHODCALLTYPE SetExtent(DWORD dwDrawAspect, SIZEL * psizel)
3785 		{
3786 			IOleObject * pIOleObject = getIOleObject();
3787 			dbgprintf(TEXT("IOleObject::SetExtent(%lu, %s)"), dwDrawAspect, SizeToString(*psizel).c_str());
3788 			HRESULT hr = pIOleObject->SetExtent(dwDrawAspect, psizel);
3789 			dbgprintf(TEXT("IOleObject::SetExtent -> %08X"), hr);
3790 			return hr;
3791 		}
3792 
GetExtent(DWORD dwDrawAspect,SIZEL * psizel)3793         virtual HRESULT STDMETHODCALLTYPE GetExtent(DWORD dwDrawAspect, SIZEL * psizel)
3794 		{
3795 			IOleObject * pIOleObject = getIOleObject();
3796 			dbgprintf(TEXT("IOleObject::GetExtent(%lu, %p)"), dwDrawAspect, psizel);
3797 			HRESULT hr = pIOleObject->GetExtent(dwDrawAspect, psizel);
3798 			dbgprintf(TEXT("IOleObject::GetExtent -> %08X"), hr, SizeToString(*psizel).c_str());
3799 			return hr;
3800 		}
3801 
Advise(IAdviseSink * pAdvSink,DWORD * pdwConnection)3802         virtual HRESULT STDMETHODCALLTYPE Advise(IAdviseSink * pAdvSink, DWORD * pdwConnection)
3803 		{
3804 			// TODO: hook pAdvSink
3805 			IOleObject * pIOleObject = getIOleObject();
3806 			dbgprintf(TEXT("IOleObject::Advise(%p, %p)"), pAdvSink, pdwConnection);
3807 			HRESULT hr = pIOleObject->Advise(pAdvSink, pdwConnection);
3808 			dbgprintf(TEXT("IOleObject::Advise -> %08X, dwConnection = %lu"), hr, *pdwConnection);
3809 			return hr;
3810 		}
3811 
Unadvise(DWORD dwConnection)3812         virtual HRESULT STDMETHODCALLTYPE Unadvise(DWORD dwConnection)
3813 		{
3814 			IOleObject * pIOleObject = getIOleObject();
3815 			dbgprintf(TEXT("IOleObject::Unadvise(%lu)"), dwConnection);
3816 			HRESULT hr = pIOleObject->Unadvise(dwConnection);
3817 			dbgprintf(TEXT("IOleObject::Unadvise -> %08X"), hr);
3818 			return hr;
3819 		}
3820 
EnumAdvise(IEnumSTATDATA ** ppenumAdvise)3821         virtual HRESULT STDMETHODCALLTYPE EnumAdvise(IEnumSTATDATA ** ppenumAdvise)
3822 		{
3823 			IOleObject * pIOleObject = getIOleObject();
3824 			dbgprintf(TEXT("IOleObject::EnumAdvise(%p)"), ppenumAdvise);
3825 			HRESULT hr = pIOleObject->EnumAdvise(ppenumAdvise);
3826 			dbgprintf(TEXT("IOleObject::EnumAdvise -> %08X, penumAdvise = %p"), hr, *ppenumAdvise);
3827 			// TODO: hook
3828 			return hr;
3829 		}
3830 
GetMiscStatus(DWORD dwAspect,DWORD * pdwStatus)3831         virtual HRESULT STDMETHODCALLTYPE GetMiscStatus(DWORD dwAspect, DWORD * pdwStatus)
3832 		{
3833 			IOleObject * pIOleObject = getIOleObject();
3834 			dbgprintf(TEXT("IOleObject::GetMiscStatus(%lu, %p)"), dwAspect, pdwStatus);
3835 			HRESULT hr = pIOleObject->GetMiscStatus(dwAspect, pdwStatus);
3836 			dbgprintf(TEXT("IOleObject::GetMiscStatus -> %08X, dwStatus = %08X"), hr, *pdwStatus);
3837 			return hr;
3838 		}
3839 
SetColorScheme(LOGPALETTE * pLogpal)3840         virtual HRESULT STDMETHODCALLTYPE SetColorScheme(LOGPALETTE * pLogpal)
3841 		{
3842 			IOleObject * pIOleObject = getIOleObject();
3843 			dbgprintf(TEXT("IOleObject::SetColorScheme(%p)"), pLogpal);
3844 			HRESULT hr = pIOleObject->SetColorScheme(pLogpal);
3845 			dbgprintf(TEXT("IOleObject::SetColorScheme -> %08X"), hr);
3846 			return hr;
3847 		}
3848 
3849 		/* IPersist */
3850 	public:
GetClassID(CLSID * pClassID)3851         virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID * pClassID)
3852 		{
3853 			IPersist * pIPersist = getIPersist();
3854 			dbgprintf(TEXT("IPersist::GetClassID(%p)"), pClassID);
3855 			HRESULT hr = pIPersist->GetClassID(pClassID);
3856 			dbgprintf(TEXT("IPersist::GetClassID -> %08X, ClassId = %ls"), hr, UUIDToString(*pClassID).c_str());
3857 			return hr;
3858 		}
3859 
3860 		/* IPersistPropertyBag */
3861 	public:
InitNew(void)3862         virtual HRESULT STDMETHODCALLTYPE InitNew(void)
3863 		{
3864 			IPersistPropertyBag * pIPersistPropertyBag = getIPersistPropertyBag();
3865 			dbgprintf(TEXT("IPersistPropertyBag::InitNew()"));
3866 			HRESULT hr = pIPersistPropertyBag->InitNew();
3867 			dbgprintf(TEXT("IPersistPropertyBag::InitNew -> %08X"), hr);
3868 			return hr;
3869 		}
3870 
Load(IPropertyBag * pPropBag,IErrorLog * pErrorLog)3871         virtual HRESULT STDMETHODCALLTYPE Load(IPropertyBag * pPropBag, IErrorLog * pErrorLog)
3872 		{
3873 			// TODO: hook pPropBag, pErrorLog
3874 			IPersistPropertyBag * pIPersistPropertyBag = getIPersistPropertyBag();
3875 			dbgprintf(TEXT("IPersistPropertyBag::Load(%p, %p)"), pPropBag, pErrorLog);
3876 			HRESULT hr = pIPersistPropertyBag->Load(pPropBag, pErrorLog);
3877 			dbgprintf(TEXT("IPersistPropertyBag::Load -> %08X"), hr);
3878 			return hr;
3879 		}
3880 
Save(IPropertyBag * pPropBag,BOOL fClearDirty,BOOL fSaveAllProperties)3881         virtual HRESULT STDMETHODCALLTYPE Save(IPropertyBag * pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties)
3882 		{
3883 			// TODO: hook pPropBag
3884 			IPersistPropertyBag * pIPersistPropertyBag = getIPersistPropertyBag();
3885 			dbgprintf(TEXT("IPersistPropertyBag::Save(%p, %s, %s)"), pPropBag, BooleanToString(fClearDirty), BooleanToString(fSaveAllProperties));
3886 			HRESULT hr = pIPersistPropertyBag->Save(pPropBag, fClearDirty, fSaveAllProperties);
3887 			dbgprintf(TEXT("IPersistPropertyBag::Save -> %08X"), hr);
3888 			return hr;
3889 		}
3890 
3891 		/* IPersistStorage */
3892 	public:
IsDirty(void)3893 		virtual HRESULT STDMETHODCALLTYPE IPersistStorage::IsDirty(void)
3894 		{
3895 			IPersistStorage * pIPersistStorage = getIPersistStorage();
3896 			dbgprintf(TEXT("IPersistStorage::IsDirty()"));
3897 			HRESULT hr = pIPersistStorage->IsDirty();
3898 			dbgprintf(TEXT("IPersistStorage::IsDirty -> %08X"), hr);
3899 			return hr;
3900 		}
3901 
InitNew(IStorage * pStg)3902         virtual HRESULT STDMETHODCALLTYPE IPersistStorage::InitNew(IStorage * pStg)
3903 		{
3904 			IPersistStorage * pIPersistStorage = getIPersistStorage();
3905 			dbgprintf(TEXT("IPersistStorage::InitNew(%p)"), pStg);
3906 			HRESULT hr = pIPersistStorage->InitNew(pStg);
3907 			dbgprintf(TEXT("IPersistStorage::InitNew -> %08X"), hr);
3908 			return hr;
3909 		}
3910 
Load(IStorage * pStg)3911         virtual HRESULT STDMETHODCALLTYPE IPersistStorage::Load(IStorage * pStg)
3912 		{
3913 			IPersistStorage * pIPersistStorage = getIPersistStorage();
3914 			dbgprintf(TEXT("IPersistStorage::Load(%p)"), pStg);
3915 			HRESULT hr = pIPersistStorage->Load(pStg);
3916 			dbgprintf(TEXT("IPersistStorage::Load -> %08X"), hr);
3917 			return hr;
3918 		}
3919 
Save(IStorage * pStgSave,BOOL fSameAsLoad)3920         virtual HRESULT STDMETHODCALLTYPE IPersistStorage::Save(IStorage * pStgSave, BOOL fSameAsLoad)
3921 		{
3922 			IPersistStorage * pIPersistStorage = getIPersistStorage();
3923 			dbgprintf(TEXT("IPersistStorage::Save(%p, %s)"), pStgSave, BooleanToString(fSameAsLoad));
3924 			HRESULT hr = pIPersistStorage->Save(pStgSave, fSameAsLoad);
3925 			dbgprintf(TEXT("IPersistStorage::Save -> %08X"), hr);
3926 			return hr;
3927 		}
3928 
SaveCompleted(IStorage * pStgNew)3929         virtual HRESULT STDMETHODCALLTYPE SaveCompleted(IStorage * pStgNew)
3930 		{
3931 			IPersistStorage * pIPersistStorage = getIPersistStorage();
3932 			dbgprintf(TEXT("IPersistStorage::SaveCompleted(%p)"), pStgNew);
3933 			HRESULT hr = pIPersistStorage->SaveCompleted(pStgNew);
3934 			dbgprintf(TEXT("IPersistStorage::SaveCompleted -> %08X"), hr);
3935 			return hr;
3936 		}
3937 
HandsOffStorage(void)3938         virtual HRESULT STDMETHODCALLTYPE HandsOffStorage(void)
3939 		{
3940 			IPersistStorage * pIPersistStorage = getIPersistStorage();
3941 			dbgprintf(TEXT("IPersistStorage::HandsOffStorage()"));
3942 			HRESULT hr = pIPersistStorage->HandsOffStorage();
3943 			dbgprintf(TEXT("IPersistStorage::HandsOffStorage -> %08X"), hr);
3944 			return hr;
3945 		}
3946 
3947 		/* IPersistStreamInit */
3948 	public:
IsDirty(void)3949 		virtual HRESULT STDMETHODCALLTYPE IPersistStreamInit::IsDirty(void)
3950 		{
3951 			IPersistStreamInit * pIPersistStreamInit = getIPersistStreamInit();
3952 			dbgprintf(TEXT("IPersistStreamInit::IsDirty()"));
3953 			HRESULT hr = pIPersistStreamInit->IsDirty();
3954 			dbgprintf(TEXT("IPersistStreamInit::IsDirty -> %08X"), hr);
3955 			return hr;
3956 		}
3957 
Load(LPSTREAM pStm)3958 		virtual HRESULT STDMETHODCALLTYPE IPersistStreamInit::Load(LPSTREAM pStm)
3959 		{
3960 			IPersistStreamInit * pIPersistStreamInit = getIPersistStreamInit();
3961 			dbgprintf(TEXT("IPersistStreamInit::Load(%p)"), pStm);
3962 			HRESULT hr = pIPersistStreamInit->Load(pStm);
3963 			dbgprintf(TEXT("IPersistStreamInit::Load -> %08X"), hr);
3964 			return hr;
3965 		}
3966 
Save(LPSTREAM pStm,BOOL fClearDirty)3967         virtual HRESULT STDMETHODCALLTYPE IPersistStreamInit::Save(LPSTREAM pStm, BOOL fClearDirty)
3968 		{
3969 			IPersistStreamInit * pIPersistStreamInit = getIPersistStreamInit();
3970 			dbgprintf(TEXT("IPersistStreamInit::Save(%p, %s)"), pStm, BooleanToString(fClearDirty));
3971 			HRESULT hr = pIPersistStreamInit->Save(pStm, fClearDirty);
3972 			dbgprintf(TEXT("IPersistStreamInit::Save -> %08X"), hr);
3973 			return hr;
3974 		}
3975 
GetSizeMax(ULARGE_INTEGER * pCbSize)3976         virtual HRESULT STDMETHODCALLTYPE IPersistStreamInit::GetSizeMax(ULARGE_INTEGER * pCbSize)
3977 		{
3978 			IPersistStreamInit * pIPersistStreamInit = getIPersistStreamInit();
3979 			dbgprintf(TEXT("IPersistStreamInit::GetSizeMax(%p)"), pCbSize);
3980 			HRESULT hr = pIPersistStreamInit->GetSizeMax(pCbSize);
3981 			dbgprintf(TEXT("IPersistStreamInit::GetSizeMax -> %08X, CbSize = %llu"), hr, pCbSize->QuadPart);
3982 			return hr;
3983 		}
3984 
InitNew(void)3985         virtual HRESULT STDMETHODCALLTYPE IPersistStreamInit::InitNew(void)
3986 		{
3987 			IPersistStreamInit * pIPersistStreamInit = getIPersistStreamInit();
3988 			dbgprintf(TEXT("IPersistStreamInit::InitNew()"));
3989 			HRESULT hr = pIPersistStreamInit->InitNew();
3990 			dbgprintf(TEXT("IPersistStreamInit::InitNew -> %08X"), hr);
3991 			return hr;
3992 		}
3993 
3994 		/* IProvideClassInfo */
3995 	public:
GetClassInfo(ITypeInfo ** ppTI)3996         virtual HRESULT STDMETHODCALLTYPE GetClassInfo(ITypeInfo ** ppTI)
3997 		{
3998 			IProvideClassInfo * pIProvideClassInfo = getIProvideClassInfo();
3999 			dbgprintf(TEXT("IProvideClassInfo::GetClassInfo(%p)"), ppTI);
4000 			HRESULT hr = pIProvideClassInfo->GetClassInfo(ppTI);
4001 			dbgprintf(TEXT("IProvideClassInfo::GetClassInfo -> %08X, pTI = %p"), hr, *ppTI);
4002 			return hr;
4003 		}
4004 
4005 		/* IProvideClassInfo2 */
4006 	public:
GetGUID(DWORD dwGuidKind,GUID * pGUID)4007 		virtual HRESULT STDMETHODCALLTYPE IProvideClassInfo2::GetGUID(DWORD dwGuidKind, GUID * pGUID)
4008 		{
4009 			IProvideClassInfo2 * pIProvideClassInfo2 = getIProvideClassInfo2();
4010 			dbgprintf(TEXT("IProvideClassInfo2::GetGUID(%lu, %p)"), dwGuidKind, pGUID);
4011 			HRESULT hr = pIProvideClassInfo2->GetGUID(dwGuidKind, pGUID);
4012 			dbgprintf(TEXT("IProvideClassInfo2::GetGUID -> %08X, GUID = %ls"), hr, UUIDToString(*pGUID).c_str());
4013 			return hr;
4014 		}
4015 
4016 		/* IQuickActivate */
4017 	public:
QuickActivate(QACONTAINER * pQaContainer,QACONTROL * pQaControl)4018 		virtual HRESULT STDMETHODCALLTYPE IQuickActivate::QuickActivate(QACONTAINER * pQaContainer, QACONTROL * pQaControl) // TODO
4019 		{
4020 			IQuickActivate * pIQuickActivate = getIQuickActivate();
4021 
4022 			std::basic_stringstream<TCHAR> o1;
4023 
4024 			o1 << "{ ";
4025 			o1 << "pClientSite = " << (void *)pQaContainer->pClientSite << ", ";
4026 			o1 << "pAdviseSink = " << (void *)pQaContainer->pAdviseSink << ", ";
4027 			o1 << "pPropertyNotifySink = " << (void *)pQaContainer->pPropertyNotifySink << ", ";
4028 			o1 << "pUnkEventSink = " << (void *)pQaContainer->pUnkEventSink << ", ";
4029 
4030 			o1 << std::hex;
4031 			o1 << "dwAmbientFlags = " << pQaContainer->dwAmbientFlags << ", ";
4032 			o1 << "colorFore = " << pQaContainer->colorFore << ", ";
4033 			o1 << "colorBack = " << pQaContainer->colorBack << ", ";
4034 			o1 << std::dec;
4035 
4036 			o1 << "pFont = " << (void *)pQaContainer->pFont << ", ";
4037 			o1 << "pUndoMgr = " << (void *)pQaContainer->pUndoMgr << ", ";
4038 
4039 			o1 << std::hex;
4040 			o1 << "dwAppearance = " << pQaContainer->dwAppearance << ", ";
4041 			o1 << "lcid = " << pQaContainer->lcid << ", ";
4042 			o1 << std::dec;
4043 
4044 			o1 << "hpal = " << (void *)pQaContainer->hpal << ", ";
4045 			o1 << "pBindHost = " << (void *)pQaContainer->pBindHost << ", ";
4046 			o1 << "pOleControlSite = " << (void *)pQaContainer->pOleControlSite << ", ";
4047 			o1 << "pServiceProvider = " << (void *)pQaContainer->pServiceProvider << ", ";
4048 			o1 << "}";
4049 
4050 			dbgprintf(TEXT("IQuickActivate::QuickActivate(%s, %p)"), o1.str().c_str(), pQaControl);
4051 
4052 			HRESULT hr = pIQuickActivate->QuickActivate(pQaContainer, pQaControl);
4053 
4054 			std::basic_stringstream<TCHAR> o2;
4055 
4056 			o2 << "{ ";
4057 			o2 << std::hex;
4058 			o2 << "dwMiscStatus = " << pQaControl->dwMiscStatus << ", ";
4059 			o2 << "dwViewStatus = " << pQaControl->dwViewStatus << ", ";
4060 			o2 << "dwEventCookie = " << pQaControl->dwEventCookie << ", ";
4061 			o2 << "dwPropNotifyCookie = " << pQaControl->dwPropNotifyCookie << ", ";
4062 			o2 << "dwPointerActivationPolicy = " << pQaControl->dwPointerActivationPolicy << ", ";
4063 			o2 << std::dec;
4064 			o2 << "}";
4065 
4066 			dbgprintf(TEXT("IQuickActivate::QuickActivate -> %08X, QaControl = %s"), hr, o2.str().c_str());
4067 
4068 			return hr;
4069 		}
4070 
SetContentExtent(LPSIZEL pSizel)4071         virtual HRESULT STDMETHODCALLTYPE IQuickActivate::SetContentExtent(LPSIZEL pSizel)
4072 		{
4073 			IQuickActivate * pIQuickActivate = getIQuickActivate();
4074 			dbgprintf(TEXT("IQuickActivate::SetContentExtent(%s)"), SizeToString(*pSizel).c_str());
4075 			HRESULT hr = pIQuickActivate->SetContentExtent(pSizel);
4076 			dbgprintf(TEXT("IQuickActivate::SetContentExtent -> %08X"), hr);
4077 			return hr;
4078 		}
4079 
GetContentExtent(LPSIZEL pSizel)4080         virtual HRESULT STDMETHODCALLTYPE IQuickActivate::GetContentExtent(LPSIZEL pSizel)
4081 		{
4082 			IQuickActivate * pIQuickActivate = getIQuickActivate();
4083 			dbgprintf(TEXT("IQuickActivate::GetContentExtent(%p)"), pSizel);
4084 			HRESULT hr = pIQuickActivate->GetContentExtent(pSizel);
4085 			dbgprintf(TEXT("IQuickActivate::GetContentExtent -> %08X, Sizel = %s"), hr, SizeToString(*pSizel).c_str());
4086 			return hr;
4087 		}
4088 
4089 		/* ISpecifyPropertyPages */
4090 	private:
CauuidToString(const CAUUID & cauuid)4091 		std::basic_string<TCHAR> CauuidToString(const CAUUID& cauuid)
4092 		{
4093 			std::basic_ostringstream<TCHAR> o;
4094 
4095 			o << "{";
4096 
4097 			for(ULONG i = 0; i < cauuid.cElems; ++ i)
4098 			{
4099 				if(i)
4100 					o << ", ";
4101 				else
4102 					o << " ";
4103 
4104 				o << UUIDToString(cauuid.pElems[i]);
4105 			}
4106 
4107 			o << " }";
4108 
4109 			return o.str();
4110 		}
4111 
4112 	public:
GetPages(CAUUID * pPages)4113 		virtual HRESULT STDMETHODCALLTYPE ISpecifyPropertyPages::GetPages(CAUUID * pPages)
4114 		{
4115 			ISpecifyPropertyPages * pISpecifyPropertyPages = getISpecifyPropertyPages();
4116 			dbgprintf(TEXT("ISpecifyPropertyPages::GetPages(%p)"), pPages);
4117 			HRESULT hr = pISpecifyPropertyPages->GetPages(pPages);
4118 			dbgprintf(TEXT("ISpecifyPropertyPages::GetPages -> %08X, Pages = %s"), hr, CauuidToString(*pPages).c_str());
4119 			return hr;
4120 		}
4121 
4122 		/* IViewObject */
4123 	public:
Draw(DWORD dwDrawAspect,LONG lindex,void * pvAspect,DVTARGETDEVICE * ptd,HDC hdcTargetDev,HDC hdcDraw,LPCRECTL lprcBounds,LPCRECTL lprcWBounds,BOOL (STDMETHODCALLTYPE * pfnContinue)(ULONG_PTR dwContinue),ULONG_PTR dwContinue)4124 		virtual HRESULT STDMETHODCALLTYPE IViewObject::Draw(DWORD dwDrawAspect, LONG lindex, void * pvAspect, DVTARGETDEVICE * ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL (STDMETHODCALLTYPE * pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
4125 		{
4126 			IViewObject * pIViewObject = getIViewObject();
4127 			dbgprintf(TEXT("IViewObject::Draw(%s, %ld, %p, %s, %p, %p, %s, %s, %p, %p)"), AspectToString(dwDrawAspect), lindex, pvAspect, TargetDeviceToString(*ptd).c_str(), hdcTargetDev, hdcDraw, RectToString(*lprcBounds).c_str(), RectToString(*lprcWBounds).c_str(), pfnContinue, dwContinue);
4128 			HRESULT hr = pIViewObject->Draw(dwDrawAspect, lindex, pvAspect, ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue);
4129 			dbgprintf(TEXT("IViewObject::Draw -> %08X"), hr);
4130 			return hr;
4131 		}
4132 
GetColorSet(DWORD dwDrawAspect,LONG lindex,void * pvAspect,DVTARGETDEVICE * ptd,HDC hicTargetDev,LOGPALETTE ** ppColorSet)4133         virtual HRESULT STDMETHODCALLTYPE IViewObject::GetColorSet(DWORD dwDrawAspect, LONG lindex, void * pvAspect, DVTARGETDEVICE * ptd, HDC hicTargetDev, LOGPALETTE ** ppColorSet)
4134 		{
4135 			IViewObject * pIViewObject = getIViewObject();
4136 			dbgprintf(TEXT("IViewObject::GetColorSet(%s, %ld, %p, %s, %p, %p)"), AspectToString(dwDrawAspect), lindex, pvAspect, TargetDeviceToString(*ptd).c_str(), hicTargetDev, ppColorSet);
4137 			HRESULT hr = pIViewObject->GetColorSet(dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet);
4138 			dbgprintf(TEXT("IViewObject::GetColorSet -> %08X, pColorSet = %p"), hr, *ppColorSet);
4139 			return hr;
4140 		}
4141 
Freeze(DWORD dwDrawAspect,LONG lindex,void * pvAspect,DWORD * pdwFreeze)4142         virtual HRESULT STDMETHODCALLTYPE IViewObject::Freeze(DWORD dwDrawAspect, LONG lindex, void * pvAspect, DWORD * pdwFreeze)
4143 		{
4144 			IViewObject * pIViewObject = getIViewObject();
4145 			dbgprintf(TEXT("IViewObject::Freeze(%s, %ld, %p, %p)"), AspectToString(dwDrawAspect), lindex, pvAspect, pdwFreeze);
4146 			HRESULT hr = pIViewObject->Freeze(dwDrawAspect, lindex, pvAspect, pdwFreeze);
4147 			dbgprintf(TEXT("IViewObject::Freeze -> %08X, dwFreeze = %08X"), hr, *pdwFreeze);
4148 			return hr;
4149 		}
4150 
Unfreeze(DWORD dwFreeze)4151         virtual HRESULT STDMETHODCALLTYPE IViewObject::Unfreeze(DWORD dwFreeze)
4152 		{
4153 			IViewObject * pIViewObject = getIViewObject();
4154 			dbgprintf(TEXT("IViewObject::Unfreeze(%08X)"), dwFreeze);
4155 			HRESULT hr = pIViewObject->Unfreeze(dwFreeze);
4156 			dbgprintf(TEXT("IViewObject::Unfreeze -> %08X"), hr);
4157 			return hr;
4158 		}
4159 
SetAdvise(DWORD aspects,DWORD advf,IAdviseSink * pAdvSink)4160         virtual HRESULT STDMETHODCALLTYPE IViewObject::SetAdvise(DWORD aspects, DWORD advf, IAdviseSink * pAdvSink)
4161 		{
4162 			IViewObject * pIViewObject = getIViewObject();
4163 			dbgprintf(TEXT("IViewObject::SetAdvise(%s, %08X, %p)"), AspectToString(aspects), advf, pAdvSink);
4164 			HRESULT hr = pIViewObject->SetAdvise(aspects, advf, pAdvSink);
4165 			dbgprintf(TEXT("IViewObject::SetAdvise -> %08X"), hr);
4166 			return hr;
4167 		}
4168 
GetAdvise(DWORD * pAspects,DWORD * pAdvf,IAdviseSink ** ppAdvSink)4169         virtual HRESULT STDMETHODCALLTYPE IViewObject::GetAdvise(DWORD * pAspects, DWORD * pAdvf, IAdviseSink ** ppAdvSink)
4170 		{
4171 			IViewObject * pIViewObject = getIViewObject();
4172 			dbgprintf(TEXT("IViewObject::GetAdvise(%p, %p, %p)"), pAspects, pAdvf, ppAdvSink);
4173 			HRESULT hr = pIViewObject->GetAdvise(pAspects, pAdvf, ppAdvSink);
4174 			dbgprintf(TEXT("IViewObject::GetAdvise -> %08X, aspects = %s, advf = %08X, pAdvSink %p"), hr, AspectToString(*pAspects), *pAdvf, *ppAdvSink);
4175 			return hr;
4176 		}
4177 
4178 		/* IViewObject2 */
4179 	public:
GetExtent(DWORD dwDrawAspect,LONG lindex,DVTARGETDEVICE * ptd,LPSIZEL lpsizel)4180 		virtual HRESULT STDMETHODCALLTYPE IViewObject2::GetExtent(DWORD dwDrawAspect, LONG lindex, DVTARGETDEVICE * ptd, LPSIZEL lpsizel)
4181 		{
4182 			IViewObject2 * pIViewObject2 = getIViewObject2();
4183 			dbgprintf(TEXT("IViewObject2::GetExtent(%s, %ld, %s, %p)"), AspectToString(dwDrawAspect), lindex, TargetDeviceToString(*ptd).c_str(), lpsizel);
4184 			HRESULT hr = pIViewObject2->GetExtent(dwDrawAspect, lindex, ptd, lpsizel);
4185 			dbgprintf(TEXT("IViewObject2::GetExtent -> %08X, sizel = %s"), hr, SizeToString(*lpsizel).c_str());
4186 			return hr;
4187 		}
4188 
4189 		/* IMsTscAx */
4190 	public:
put_Server(BSTR pServer)4191 		virtual HRESULT __stdcall put_Server(BSTR pServer)
4192 		{
4193 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4194 			dbgprintf(TEXT("IMsTscAx::put_Server(%ls)"), pServer);
4195 			HRESULT hr = pIMsTscAx->put_Server(pServer);
4196 			dbgprintf(TEXT("IMsTscAx::put_Server -> %08X"), hr);
4197 			return hr;
4198 		}
4199 
get_Server(BSTR * pServer)4200 		virtual HRESULT __stdcall get_Server(BSTR * pServer)
4201 		{
4202 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4203 			dbgprintf(TEXT("IMsTscAx::get_Server()"), pServer);
4204 			HRESULT hr = pIMsTscAx->get_Server(pServer);
4205 			dbgprintf(TEXT("IMsTscAx::get_Server -> %08X, server = %ls"), hr, *pServer);
4206 			return hr;
4207 		}
4208 
put_Domain(BSTR pDomain)4209 		virtual HRESULT __stdcall put_Domain(BSTR pDomain)
4210 		{
4211 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4212 			dbgprintf(TEXT("IMsTscAx::put_Domain(%ls)"), pDomain);
4213 			HRESULT hr = pIMsTscAx->put_Domain(pDomain);
4214 			dbgprintf(TEXT("IMsTscAx::put_Domain -> %08X"), hr);
4215 			return hr;
4216 		}
4217 
get_Domain(BSTR * pDomain)4218 		virtual HRESULT __stdcall get_Domain(BSTR * pDomain)
4219 		{
4220 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4221 			dbgprintf(TEXT("IMsTscAx::get_Domain(%p)"), pDomain);
4222 			HRESULT hr = pIMsTscAx->get_Domain(pDomain);
4223 			dbgprintf(TEXT("IMsTscAx::get_Domain -> %08X, Domain = %ls"), hr, *pDomain);
4224 			return hr;
4225 		}
4226 
put_UserName(BSTR pUserName)4227 		virtual HRESULT __stdcall put_UserName(BSTR pUserName)
4228 		{
4229 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4230 			dbgprintf(TEXT("IMsTscAx::put_UserName(%ls)"), pUserName);
4231 			HRESULT hr = pIMsTscAx->put_UserName(pUserName);
4232 			dbgprintf(TEXT("IMsTscAx::put_UserName -> %08X"), hr);
4233 			return hr;
4234 		}
4235 
get_UserName(BSTR * pUserName)4236 		virtual HRESULT __stdcall get_UserName(BSTR * pUserName)
4237 		{
4238 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4239 			dbgprintf(TEXT("IMsTscAx::get_UserName(%p)"), pUserName);
4240 			HRESULT hr = pIMsTscAx->get_UserName(pUserName);
4241 			dbgprintf(TEXT("IMsTscAx::get_UserName -> %08X, UserName = %ls"), hr, *pUserName);
4242 			return hr;
4243 		}
4244 
put_DisconnectedText(BSTR pDisconnectedText)4245 		virtual HRESULT __stdcall put_DisconnectedText(BSTR pDisconnectedText)
4246 		{
4247 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4248 			dbgprintf(TEXT("IMsTscAx::put_DisconnectedText(%ls)"), pDisconnectedText);
4249 			HRESULT hr = pIMsTscAx->put_DisconnectedText(pDisconnectedText);
4250 			dbgprintf(TEXT("IMsTscAx::put_DisconnectedText -> %08X"), hr);
4251 			return hr;
4252 		}
4253 
get_DisconnectedText(BSTR * pDisconnectedText)4254 		virtual HRESULT __stdcall get_DisconnectedText(BSTR * pDisconnectedText)
4255 		{
4256 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4257 			dbgprintf(TEXT("IMsTscAx::get_DisconnectedText(%p)"), pDisconnectedText);
4258 			HRESULT hr = pIMsTscAx->get_DisconnectedText(pDisconnectedText);
4259 			dbgprintf(TEXT("IMsTscAx::get_DisconnectedText -> %08X, DisconnectedText = %ls"), hr, *pDisconnectedText);
4260 			return hr;
4261 		}
4262 
put_ConnectingText(BSTR pConnectingText)4263 		virtual HRESULT __stdcall put_ConnectingText(BSTR pConnectingText)
4264 		{
4265 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4266 			dbgprintf(TEXT("IMsTscAx::put_ConnectingText(%ls)"), pConnectingText);
4267 			HRESULT hr = pIMsTscAx->put_ConnectingText(pConnectingText);
4268 			dbgprintf(TEXT("IMsTscAx::put_ConnectingText -> %08X"), hr);
4269 			return hr;
4270 		}
4271 
get_ConnectingText(BSTR * pConnectingText)4272 		virtual HRESULT __stdcall get_ConnectingText(BSTR * pConnectingText)
4273 		{
4274 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4275 			dbgprintf(TEXT("IMsTscAx::get_ConnectingText(%p)"), pConnectingText);
4276 			HRESULT hr = pIMsTscAx->get_ConnectingText(pConnectingText);
4277 			dbgprintf(TEXT("IMsTscAx::get_ConnectingText -> %08X, ConnectingText = %ls"), hr, *pConnectingText);
4278 			return hr;
4279 		}
4280 
get_Connected(short * pIsConnected)4281 		virtual HRESULT __stdcall get_Connected(short * pIsConnected)
4282 		{
4283 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4284 			dbgprintf(TEXT("IMsTscAx::get_Connected(%p)"), pIsConnected);
4285 			HRESULT hr = pIMsTscAx->get_Connected(pIsConnected);
4286 			dbgprintf(TEXT("IMsTscAx::get_Connected -> %08X, IsConnected = %s"), hr, BooleanToString(*pIsConnected));
4287 			return hr;
4288 		}
4289 
put_DesktopWidth(long pVal)4290 		virtual HRESULT __stdcall put_DesktopWidth(long pVal)
4291 		{
4292 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4293 			dbgprintf(TEXT("IMsTscAx::put_DesktopWidth(%ld)"), pVal);
4294 			HRESULT hr = pIMsTscAx->put_DesktopWidth(pVal);
4295 			dbgprintf(TEXT("IMsTscAx::put_DesktopWidth -> %08X"), hr);
4296 			return hr;
4297 		}
4298 
get_DesktopWidth(long * pVal)4299 		virtual HRESULT __stdcall get_DesktopWidth(long * pVal)
4300 		{
4301 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4302 			dbgprintf(TEXT("IMsTscAx::get_DesktopWidth(%p)"), pVal);
4303 			HRESULT hr = pIMsTscAx->get_DesktopWidth(pVal);
4304 			dbgprintf(TEXT("IMsTscAx::get_DesktopWidth -> %08X, Val = %lu"), hr, *pVal);
4305 			return hr;
4306 		}
4307 
put_DesktopHeight(long pVal)4308 		virtual HRESULT __stdcall put_DesktopHeight(long pVal)
4309 		{
4310 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4311 			dbgprintf(TEXT("IMsTscAx::put_DesktopHeight(%ld)"), pVal);
4312 			HRESULT hr = pIMsTscAx->put_DesktopHeight(pVal);
4313 			dbgprintf(TEXT("IMsTscAx::put_DesktopHeight -> %08X"), hr);
4314 			return hr;
4315 		}
4316 
get_DesktopHeight(long * pVal)4317 		virtual HRESULT __stdcall get_DesktopHeight(long * pVal)
4318 		{
4319 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4320 			dbgprintf(TEXT("IMsTscAx::get_DesktopHeight(%p)"), pVal);
4321 			HRESULT hr = pIMsTscAx->get_DesktopHeight(pVal);
4322 			dbgprintf(TEXT("IMsTscAx::get_DesktopHeight -> %08X, Val = %lu"), hr, *pVal);
4323 			return hr;
4324 		}
4325 
put_StartConnected(long pfStartConnected)4326 		virtual HRESULT __stdcall put_StartConnected(long pfStartConnected)
4327 		{
4328 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4329 			dbgprintf(TEXT("IMsTscAx::put_StartConnected(%s)"), BooleanToString(pfStartConnected));
4330 			HRESULT hr = pIMsTscAx->put_StartConnected(pfStartConnected);
4331 			dbgprintf(TEXT("IMsTscAx::put_StartConnected -> %08X"), hr);
4332 			return hr;
4333 		}
4334 
get_StartConnected(long * pfStartConnected)4335 		virtual HRESULT __stdcall get_StartConnected(long * pfStartConnected)
4336 		{
4337 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4338 			dbgprintf(TEXT("IMsTscAx::get_StartConnected(%p)"), pfStartConnected);
4339 			HRESULT hr = pIMsTscAx->get_StartConnected(pfStartConnected);
4340 			dbgprintf(TEXT("IMsTscAx::get_StartConnected -> %08X, fStartConnected = %s"), hr, BooleanToString(*pfStartConnected));
4341 			return hr;
4342 		}
4343 
get_HorizontalScrollBarVisible(long * pfHScrollVisible)4344 		virtual HRESULT __stdcall get_HorizontalScrollBarVisible(long * pfHScrollVisible)
4345 		{
4346 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4347 			dbgprintf(TEXT("IMsTscAx::get_HorizontalScrollBarVisible(%p)"), pfHScrollVisible);
4348 			HRESULT hr = pIMsTscAx->get_HorizontalScrollBarVisible(pfHScrollVisible);
4349 			dbgprintf(TEXT("IMsTscAx::get_HorizontalScrollBarVisible -> %08X, fHScrollVisible = %s"), hr, BooleanToString(*pfHScrollVisible));
4350 			return hr;
4351 		}
4352 
get_VerticalScrollBarVisible(long * pfVScrollVisible)4353 		virtual HRESULT __stdcall get_VerticalScrollBarVisible(long * pfVScrollVisible)
4354 		{
4355 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4356 			dbgprintf(TEXT("IMsTscAx::get_VerticalScrollBarVisible(%p)"), pfVScrollVisible);
4357 			HRESULT hr = pIMsTscAx->get_VerticalScrollBarVisible(pfVScrollVisible);
4358 			dbgprintf(TEXT("IMsTscAx::get_VerticalScrollBarVisible -> %08X, fVScrollVisible"), hr, *pfVScrollVisible);
4359 			return hr;
4360 		}
4361 
put_FullScreenTitle(BSTR _arg1)4362 		virtual HRESULT __stdcall put_FullScreenTitle(BSTR _arg1)
4363 		{
4364 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4365 			dbgprintf(TEXT("IMsTscAx::put_FullScreenTitle(%ls)"), _arg1);
4366 			HRESULT hr = pIMsTscAx->put_FullScreenTitle(_arg1);
4367 			dbgprintf(TEXT("IMsTscAx::put_FullScreenTitle -> %08X"), hr);
4368 			return hr;
4369 		}
4370 
get_CipherStrength(long * pCipherStrength)4371 		virtual HRESULT __stdcall get_CipherStrength(long * pCipherStrength)
4372 		{
4373 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4374 			dbgprintf(TEXT("IMsTscAx::get_CipherStrength(%p)"), pCipherStrength);
4375 			HRESULT hr = pIMsTscAx->get_CipherStrength(pCipherStrength);
4376 			dbgprintf(TEXT("IMsTscAx::get_CipherStrength -> %08X, CipherStrength = %ld"), hr, *pCipherStrength);
4377 			return hr;
4378 		}
4379 
get_Version(BSTR * pVersion)4380 		virtual HRESULT __stdcall get_Version(BSTR * pVersion)
4381 		{
4382 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4383 			dbgprintf(TEXT("IMsTscAx::get_Version(%p)"), pVersion);
4384 			HRESULT hr = pIMsTscAx->get_Version(pVersion);
4385 			dbgprintf(TEXT("IMsTscAx::get_Version -> %08X, Version = %ls"), hr, *pVersion);
4386 			return hr;
4387 		}
4388 
get_SecuredSettingsEnabled(long * pSecuredSettingsEnabled)4389 		virtual HRESULT __stdcall get_SecuredSettingsEnabled(long * pSecuredSettingsEnabled)
4390 		{
4391 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4392 			dbgprintf(TEXT("IMsTscAx::get_SecuredSettingsEnabled(%p)"), pSecuredSettingsEnabled);
4393 			HRESULT hr = pIMsTscAx->get_SecuredSettingsEnabled(pSecuredSettingsEnabled);
4394 			dbgprintf(TEXT("IMsTscAx::get_SecuredSettingsEnabled -> %08X, SecuredSettingsEnabled = %s"), hr, BooleanToString(*pSecuredSettingsEnabled));
4395 			return hr;
4396 		}
4397 
get_SecuredSettings(IMsTscSecuredSettings ** ppSecuredSettings)4398 		virtual HRESULT __stdcall get_SecuredSettings(IMsTscSecuredSettings ** ppSecuredSettings)
4399 		{
4400 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4401 			dbgprintf(TEXT("IMsTscAx::get_SecuredSettings(%p)"), ppSecuredSettings);
4402 			HRESULT hr = pIMsTscAx->get_SecuredSettings(ppSecuredSettings);
4403 			dbgprintf(TEXT("IMsTscAx::get_SecuredSettings -> %08X, pSecuredSettings = %p"), hr, *ppSecuredSettings);
4404 			return hr;
4405 		}
4406 
get_AdvancedSettings(IMsTscAdvancedSettings ** ppAdvSettings)4407 		virtual HRESULT __stdcall get_AdvancedSettings(IMsTscAdvancedSettings ** ppAdvSettings)
4408 		{
4409 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4410 			dbgprintf(TEXT("IMsTscAx::get_AdvancedSettings(%p)"), ppAdvSettings);
4411 			HRESULT hr = pIMsTscAx->get_AdvancedSettings(ppAdvSettings);
4412 			dbgprintf(TEXT("IMsTscAx::get_AdvancedSettings -> %08X, pAdvSettings = %p"), hr, *ppAdvSettings);
4413 
4414 			if(SUCCEEDED(hr))
4415 				*ppAdvSettings = new CAdvancedSettings(*ppAdvSettings);
4416 
4417 			return hr;
4418 		}
4419 
get_Debugger(IMsTscDebug ** ppDebugger)4420 		virtual HRESULT __stdcall get_Debugger(IMsTscDebug ** ppDebugger)
4421 		{
4422 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4423 			dbgprintf(TEXT("IMsTscAx::get_Debugger(%p)"), ppDebugger);
4424 			HRESULT hr = pIMsTscAx->get_Debugger(ppDebugger);
4425 			dbgprintf(TEXT("IMsTscAx::get_Debugger -> %08X, pDebugger = %p"), hr, *ppDebugger);
4426 			return hr;
4427 		}
4428 
Connect()4429 		virtual HRESULT __stdcall Connect()
4430 		{
4431 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4432 			dbgprintf(TEXT("IMsTscAx::Connect()"));
4433 			HRESULT hr = pIMsTscAx->Connect();
4434 			dbgprintf(TEXT("IMsTscAx::Connect -> %08X"), hr);
4435 			return hr;
4436 		}
4437 
Disconnect()4438 		virtual HRESULT __stdcall Disconnect()
4439 		{
4440 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4441 			dbgprintf(TEXT("IMsTscAx::Disconnect()"));
4442 			HRESULT hr = pIMsTscAx->Disconnect();
4443 			dbgprintf(TEXT("IMsTscAx::Disconnect -> %08X"), hr);
4444 			return hr;
4445 		}
4446 
CreateVirtualChannels(BSTR newVal)4447 		virtual HRESULT __stdcall CreateVirtualChannels(BSTR newVal)
4448 		{
4449 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4450 			dbgprintf(TEXT("IMsTscAx::CreateVirtualChannels(%ls)"), newVal);
4451 			HRESULT hr = pIMsTscAx->CreateVirtualChannels(newVal);
4452 			dbgprintf(TEXT("IMsTscAx::CreateVirtualChannels -> %08X"), hr);
4453 			return hr;
4454 		}
4455 
SendOnVirtualChannel(BSTR chanName,BSTR ChanData)4456 		virtual HRESULT __stdcall SendOnVirtualChannel(BSTR chanName, BSTR ChanData)
4457 		{
4458 			IMsTscAx * pIMsTscAx = getIMsTscAx();
4459 			dbgprintf(TEXT("IMsTscAx::SendOnVirtualChannel(%ls, %p)"), chanName, ChanData);
4460 			HRESULT hr = pIMsTscAx->SendOnVirtualChannel(chanName, ChanData);
4461 			dbgprintf(TEXT("IMsTscAx::SendOnVirtualChannel -> %08X"), hr);
4462 			return hr;
4463 		}
4464 
4465 		/* IMsRdpClient */
4466 	public:
put_ColorDepth(long pcolorDepth)4467 		virtual HRESULT __stdcall put_ColorDepth(long pcolorDepth)
4468 		{
4469 			IMsRdpClient * pIMsRdpClient = getIMsRdpClient();
4470 			dbgprintf(TEXT("IMsRdpClient::put_ColorDepth(%ld)"), pcolorDepth);
4471 			HRESULT hr = pIMsRdpClient->put_ColorDepth(pcolorDepth);
4472 			dbgprintf(TEXT("IMsRdpClient::put_ColorDepth -> %08X"), hr);
4473 			return hr;
4474 		}
4475 
get_ColorDepth(long * pcolorDepth)4476 		virtual HRESULT __stdcall get_ColorDepth(long * pcolorDepth)
4477 		{
4478 			IMsRdpClient * pIMsRdpClient = getIMsRdpClient();
4479 			dbgprintf(TEXT("IMsRdpClient::get_ColorDepth(%p)"), pcolorDepth);
4480 			HRESULT hr = pIMsRdpClient->get_ColorDepth(pcolorDepth);
4481 			dbgprintf(TEXT("IMsRdpClient::get_ColorDepth -> %08X, colorDepth = %ld"), hr, *pcolorDepth);
4482 			return hr;
4483 		}
4484 
get_AdvancedSettings2(IMsRdpClientAdvancedSettings ** ppAdvSettings)4485 		virtual HRESULT __stdcall get_AdvancedSettings2(IMsRdpClientAdvancedSettings ** ppAdvSettings)
4486 		{
4487 			IMsRdpClient * pIMsRdpClient = getIMsRdpClient();
4488 			dbgprintf(TEXT("IMsRdpClient::get_AdvancedSettings2(%p)"), ppAdvSettings);
4489 			HRESULT hr = pIMsRdpClient->get_AdvancedSettings2(ppAdvSettings);
4490 			dbgprintf(TEXT("IMsRdpClient::get_AdvancedSettings2 -> %08X, pAdvSettings = %p"), hr, *ppAdvSettings);
4491 
4492 			if(SUCCEEDED(hr))
4493 				*ppAdvSettings = new CAdvancedSettings(*ppAdvSettings);
4494 
4495 			return hr;
4496 		}
4497 
get_SecuredSettings2(IMsRdpClientSecuredSettings ** ppSecuredSettings)4498 		virtual HRESULT __stdcall get_SecuredSettings2(IMsRdpClientSecuredSettings ** ppSecuredSettings)
4499 		{
4500 			IMsRdpClient * pIMsRdpClient = getIMsRdpClient();
4501 			dbgprintf(TEXT("IMsRdpClient::get_SecuredSettings2(%p)"), ppSecuredSettings);
4502 			HRESULT hr = pIMsRdpClient->get_SecuredSettings2(ppSecuredSettings);
4503 			dbgprintf(TEXT("IMsRdpClient::get_SecuredSettings2 -> %08X, pSecuredSettings = %p"), hr, *ppSecuredSettings);
4504 			return hr;
4505 		}
4506 
get_ExtendedDisconnectReason(ExtendedDisconnectReasonCode * pExtendedDisconnectReason)4507 		virtual HRESULT __stdcall get_ExtendedDisconnectReason(ExtendedDisconnectReasonCode * pExtendedDisconnectReason)
4508 		{
4509 			IMsRdpClient * pIMsRdpClient = getIMsRdpClient();
4510 			dbgprintf(TEXT("IMsRdpClient::get_ExtendedDisconnectReason(%p)"), pExtendedDisconnectReason);
4511 			HRESULT hr = pIMsRdpClient->get_ExtendedDisconnectReason(pExtendedDisconnectReason);
4512 			dbgprintf(TEXT("IMsRdpClient::get_ExtendedDisconnectReason -> %08X, ExtendedDisconnectReason = %u"), hr, *pExtendedDisconnectReason);
4513 			return hr;
4514 		}
4515 
put_FullScreen(VARIANT_BOOL pfFullScreen)4516 		virtual HRESULT __stdcall put_FullScreen(VARIANT_BOOL pfFullScreen)
4517 		{
4518 			IMsRdpClient * pIMsRdpClient = getIMsRdpClient();
4519 			dbgprintf(TEXT("IMsRdpClient::put_FullScreen(%s)"), BooleanToString(pfFullScreen));
4520 			HRESULT hr = pIMsRdpClient->put_FullScreen(pfFullScreen);
4521 			dbgprintf(TEXT("IMsRdpClient::put_FullScreen -> %08X"), hr);
4522 			return hr;
4523 		}
4524 
get_FullScreen(VARIANT_BOOL * pfFullScreen)4525 		virtual HRESULT __stdcall get_FullScreen(VARIANT_BOOL * pfFullScreen)
4526 		{
4527 			IMsRdpClient * pIMsRdpClient = getIMsRdpClient();
4528 			dbgprintf(TEXT("IMsRdpClient::get_FullScreen(%p)"), pfFullScreen);
4529 			HRESULT hr = pIMsRdpClient->get_FullScreen(pfFullScreen);
4530 			dbgprintf(TEXT("IMsRdpClient::get_FullScreen -> %08X, pfFullScreen = %s"), hr, BooleanToString(*pfFullScreen));
4531 			return hr;
4532 		}
4533 
SetVirtualChannelOptions(BSTR chanName,long chanOptions)4534 		virtual HRESULT __stdcall SetVirtualChannelOptions(BSTR chanName, long chanOptions)
4535 		{
4536 			IMsRdpClient * pIMsRdpClient = getIMsRdpClient();
4537 			dbgprintf(TEXT("IMsRdpClient::SetVirtualChannelOptions(%ls, %08X)"), chanName, chanOptions);
4538 			HRESULT hr = pIMsRdpClient->SetVirtualChannelOptions(chanName, chanOptions);
4539 			dbgprintf(TEXT("IMsRdpClient::SetVirtualChannelOptions -> %08X"), hr);
4540 			return hr;
4541 		}
4542 
GetVirtualChannelOptions(BSTR chanName,long * pChanOptions)4543 		virtual HRESULT __stdcall GetVirtualChannelOptions(BSTR chanName, long * pChanOptions)
4544 		{
4545 			IMsRdpClient * pIMsRdpClient = getIMsRdpClient();
4546 			dbgprintf(TEXT("IMsRdpClient::GetVirtualChannelOptions(%ls, %p)"), chanName, pChanOptions);
4547 			HRESULT hr = pIMsRdpClient->GetVirtualChannelOptions(chanName, pChanOptions);
4548 			dbgprintf(TEXT("IMsRdpClient::GetVirtualChannelOptions -> %08X, ChanOptions = %08X"), hr, *pChanOptions);
4549 			return hr;
4550 		}
4551 
RequestClose(ControlCloseStatus * pCloseStatus)4552 		virtual HRESULT __stdcall RequestClose(ControlCloseStatus * pCloseStatus)
4553 		{
4554 			IMsRdpClient * pIMsRdpClient = getIMsRdpClient();
4555 			dbgprintf(TEXT("IMsRdpClient::RequestClose(%p)"), pCloseStatus);
4556 			HRESULT hr = pIMsRdpClient->RequestClose(pCloseStatus);
4557 			dbgprintf(TEXT("IMsRdpClient::RequestClose -> %08X, CloseStatus = %ld"), hr, *pCloseStatus);
4558 			return hr;
4559 		}
4560 
4561 		/* IMsRdpClient2 */
4562 	public:
get_AdvancedSettings3(IMsRdpClientAdvancedSettings2 ** ppAdvSettings)4563 		virtual HRESULT __stdcall get_AdvancedSettings3(IMsRdpClientAdvancedSettings2 ** ppAdvSettings)
4564 		{
4565 			IMsRdpClient2 * pIMsRdpClient2 = getIMsRdpClient2();
4566 			dbgprintf(TEXT("IMsRdpClient2::get_AdvancedSettings3(%p)"), ppAdvSettings);
4567 			HRESULT hr = pIMsRdpClient2->get_AdvancedSettings3(ppAdvSettings);
4568 			dbgprintf(TEXT("IMsRdpClient2::get_AdvancedSettings3 -> %08X, pAdvSettings = %p"), hr, *ppAdvSettings);
4569 
4570 			if(SUCCEEDED(hr))
4571 				*ppAdvSettings = new CAdvancedSettings(*ppAdvSettings);
4572 
4573 			return hr;
4574 		}
4575 
put_ConnectedStatusText(BSTR pConnectedStatusText)4576 		virtual HRESULT __stdcall put_ConnectedStatusText(BSTR pConnectedStatusText)
4577 		{
4578 			IMsRdpClient2 * pIMsRdpClient2 = getIMsRdpClient2();
4579 			dbgprintf(TEXT("IMsRdpClient2::put_ConnectedStatusText(%ls)"), pConnectedStatusText);
4580 			HRESULT hr = pIMsRdpClient2->put_ConnectedStatusText(pConnectedStatusText);
4581 			dbgprintf(TEXT("IMsRdpClient2::put_ConnectedStatusText -> %08X"), hr);
4582 			return hr;
4583 		}
4584 
get_ConnectedStatusText(BSTR * pConnectedStatusText)4585 		virtual HRESULT __stdcall get_ConnectedStatusText(BSTR * pConnectedStatusText)
4586 		{
4587 			IMsRdpClient2 * pIMsRdpClient2 = getIMsRdpClient2();
4588 			dbgprintf(TEXT("IMsRdpClient2::get_ConnectedStatusText(%p)"), pConnectedStatusText);
4589 			HRESULT hr = pIMsRdpClient2->get_ConnectedStatusText(pConnectedStatusText);
4590 			dbgprintf(TEXT("IMsRdpClient2::get_ConnectedStatusText -> %08X, ConnectedStatusText = %ls"), hr, *pConnectedStatusText);
4591 			return hr;
4592 		}
4593 
4594 		/* IMsRdpClient3 */
4595 	public:
get_AdvancedSettings4(IMsRdpClientAdvancedSettings3 ** ppAdvSettings)4596 		virtual HRESULT __stdcall get_AdvancedSettings4(IMsRdpClientAdvancedSettings3 ** ppAdvSettings)
4597 		{
4598 			IMsRdpClient3 * pIMsRdpClient3 = getIMsRdpClient3();
4599 			dbgprintf(TEXT("IMsRdpClient3::get_AdvancedSettings4(%p)"), ppAdvSettings);
4600 			HRESULT hr = pIMsRdpClient3->get_AdvancedSettings4(ppAdvSettings);
4601 			dbgprintf(TEXT("IMsRdpClient3::get_AdvancedSettings4 -> %08X, pAdvSettings = %p"), hr, *ppAdvSettings);
4602 
4603 			if(SUCCEEDED(hr))
4604 				*ppAdvSettings = new CAdvancedSettings(*ppAdvSettings);
4605 
4606 			return hr;
4607 		}
4608 
4609 		/* IMsRdpClient4 */
4610 	public:
get_AdvancedSettings5(IMsRdpClientAdvancedSettings4 ** ppAdvSettings5)4611 		virtual HRESULT __stdcall get_AdvancedSettings5(IMsRdpClientAdvancedSettings4 ** ppAdvSettings5)
4612 		{
4613 			IMsRdpClient4 * pIMsRdpClient4 = getIMsRdpClient4();
4614 			dbgprintf(TEXT("IMsRdpClient4::get_AdvancedSettings5(%p)"), ppAdvSettings5);
4615 			HRESULT hr = pIMsRdpClient4->get_AdvancedSettings5(ppAdvSettings5);
4616 			dbgprintf(TEXT("IMsRdpClient4::get_AdvancedSettings5 -> %08X, pAdvSettings5 = %p"), hr, *ppAdvSettings5);
4617 
4618 			if(SUCCEEDED(hr))
4619 				*ppAdvSettings5 = new CAdvancedSettings(*ppAdvSettings5);
4620 
4621 			return hr;
4622 		}
4623 
4624 		/* IMsTscNonScriptable */
4625 	public:
put_ClearTextPassword(BSTR _arg1)4626 		virtual HRESULT __stdcall put_ClearTextPassword(BSTR _arg1)
4627 		{
4628 			IMsTscNonScriptable * pIMsTscNonScriptable = getIMsTscNonScriptable();
4629 			dbgprintf(TEXT("IMsTscNonScriptable::put_ClearTextPassword(%ls)"), _arg1);
4630 			HRESULT hr = pIMsTscNonScriptable->put_ClearTextPassword(_arg1);
4631 			dbgprintf(TEXT("IMsTscNonScriptable::put_ClearTextPassword -> %08X"), hr);
4632 			return hr;
4633 		}
4634 
put_PortablePassword(BSTR pPortablePass)4635 		virtual HRESULT __stdcall put_PortablePassword(BSTR pPortablePass)
4636 		{
4637 			IMsTscNonScriptable * pIMsTscNonScriptable = getIMsTscNonScriptable();
4638 			dbgprintf(TEXT("IMsTscNonScriptable::put_PortablePassword(%ls)"), pPortablePass);
4639 			HRESULT hr = pIMsTscNonScriptable->put_PortablePassword(pPortablePass);
4640 			dbgprintf(TEXT("IMsTscNonScriptable::put_PortablePassword -> %08X"), hr);
4641 			return hr;
4642 		}
4643 
get_PortablePassword(BSTR * pPortablePass)4644 		virtual HRESULT __stdcall get_PortablePassword(BSTR * pPortablePass)
4645 		{
4646 			IMsTscNonScriptable * pIMsTscNonScriptable = getIMsTscNonScriptable();
4647 			dbgprintf(TEXT("IMsTscNonScriptable::get_PortablePassword(%p)"), pPortablePass);
4648 			HRESULT hr = pIMsTscNonScriptable->get_PortablePassword(pPortablePass);
4649 			dbgprintf(TEXT("IMsTscNonScriptable::get_PortablePassword -> %08X, PortablePass = %ls"), hr, *pPortablePass);
4650 			return hr;
4651 		}
4652 
put_PortableSalt(BSTR pPortableSalt)4653 		virtual HRESULT __stdcall put_PortableSalt(BSTR pPortableSalt)
4654 		{
4655 			IMsTscNonScriptable * pIMsTscNonScriptable = getIMsTscNonScriptable();
4656 			dbgprintf(TEXT("IMsTscNonScriptable::put_PortableSalt(%ls)"), pPortableSalt);
4657 			HRESULT hr = pIMsTscNonScriptable->put_PortableSalt(pPortableSalt);
4658 			dbgprintf(TEXT("IMsTscNonScriptable::put_PortableSalt -> %08X"), hr);
4659 			return hr;
4660 		}
4661 
get_PortableSalt(BSTR * pPortableSalt)4662 		virtual HRESULT __stdcall get_PortableSalt(BSTR * pPortableSalt)
4663 		{
4664 			IMsTscNonScriptable * pIMsTscNonScriptable = getIMsTscNonScriptable();
4665 			dbgprintf(TEXT("IMsTscNonScriptable::get_PortableSalt()"), pPortableSalt);
4666 			HRESULT hr = pIMsTscNonScriptable->get_PortableSalt(pPortableSalt);
4667 			dbgprintf(TEXT("IMsTscNonScriptable::get_PortableSalt -> %08X, PortableSalt = %ls"), hr, *pPortableSalt);
4668 			return hr;
4669 		}
4670 
put_BinaryPassword(BSTR pBinaryPassword)4671 		virtual HRESULT __stdcall put_BinaryPassword(BSTR pBinaryPassword)
4672 		{
4673 			IMsTscNonScriptable * pIMsTscNonScriptable = getIMsTscNonScriptable();
4674 			dbgprintf(TEXT("IMsTscNonScriptable::put_BinaryPassword(%p)"), pBinaryPassword);
4675 			HRESULT hr = pIMsTscNonScriptable->put_BinaryPassword(pBinaryPassword);
4676 			dbgprintf(TEXT("IMsTscNonScriptable::put_BinaryPassword -> %08X"), hr);
4677 			return hr;
4678 		}
4679 
get_BinaryPassword(BSTR * pBinaryPassword)4680 		virtual HRESULT __stdcall get_BinaryPassword(BSTR * pBinaryPassword)
4681 		{
4682 			IMsTscNonScriptable * pIMsTscNonScriptable = getIMsTscNonScriptable();
4683 			dbgprintf(TEXT("IMsTscNonScriptable::get_BinaryPassword()"), pBinaryPassword);
4684 			HRESULT hr = pIMsTscNonScriptable->get_BinaryPassword(pBinaryPassword);
4685 			dbgprintf(TEXT("IMsTscNonScriptable::get_BinaryPassword -> %08X, BinaryPassword = %ls"), hr, *pBinaryPassword);
4686 			return hr;
4687 		}
4688 
put_BinarySalt(BSTR pSalt)4689 		virtual HRESULT __stdcall put_BinarySalt(BSTR pSalt)
4690 		{
4691 			IMsTscNonScriptable * pIMsTscNonScriptable = getIMsTscNonScriptable();
4692 			dbgprintf(TEXT("IMsTscNonScriptable::put_BinarySalt(%p)"), pSalt);
4693 			HRESULT hr = pIMsTscNonScriptable->put_BinarySalt(pSalt);
4694 			dbgprintf(TEXT("IMsTscNonScriptable::put_BinarySalt -> %08X"), hr);
4695 			return hr;
4696 		}
4697 
get_BinarySalt(BSTR * pSalt)4698 		virtual HRESULT __stdcall get_BinarySalt(BSTR * pSalt)
4699 		{
4700 			IMsTscNonScriptable * pIMsTscNonScriptable = getIMsTscNonScriptable();
4701 			dbgprintf(TEXT("IMsTscNonScriptable::get_BinarySalt()"), pSalt);
4702 			HRESULT hr = pIMsTscNonScriptable->get_BinarySalt(pSalt);
4703 			dbgprintf(TEXT("IMsTscNonScriptable::get_BinarySalt -> %08X, pSalt = %ls"), hr, *pSalt);
4704 			return hr;
4705 		}
4706 
ResetPassword()4707 		virtual HRESULT __stdcall ResetPassword()
4708 		{
4709 			IMsTscNonScriptable * pIMsTscNonScriptable = getIMsTscNonScriptable();
4710 			dbgprintf(TEXT("IMsTscNonScriptable::ResetPassword()"));
4711 			HRESULT hr = pIMsTscNonScriptable->ResetPassword();
4712 			dbgprintf(TEXT("IMsTscNonScriptable::ResetPassword -> %08X"), hr);
4713 			return hr;
4714 		}
4715 
4716 
4717 		/* IMsRdpClientNonScriptable */
4718 	public:
NotifyRedirectDeviceChange(UINT_PTR wParam,LONG_PTR lParam)4719 		virtual HRESULT __stdcall IMsRdpClientNonScriptable::NotifyRedirectDeviceChange(UINT_PTR wParam, LONG_PTR lParam)
4720 		{
4721 			IMsRdpClientNonScriptable * pIMsRdpClientNonScriptable = getIMsRdpClientNonScriptable();
4722 			dbgprintf(TEXT("IMsRdpClientNonScriptable::NotifyRedirectDeviceChange(%p, %p)"), wParam, lParam);
4723 			HRESULT hr = pIMsRdpClientNonScriptable->NotifyRedirectDeviceChange(wParam, lParam);
4724 			dbgprintf(TEXT("IMsRdpClientNonScriptable::NotifyRedirectDeviceChange -> %08X"), hr);
4725 			return hr;
4726 		}
4727 
SendKeys(long numKeys,VARIANT_BOOL * pbArrayKeyUp,long * plKeyData)4728 		virtual HRESULT __stdcall IMsRdpClientNonScriptable::SendKeys(long numKeys, VARIANT_BOOL * pbArrayKeyUp, long * plKeyData) // TBD
4729 		{
4730 			IMsRdpClientNonScriptable * pIMsRdpClientNonScriptable = getIMsRdpClientNonScriptable();
4731 			dbgprintf(TEXT("IMsRdpClientNonScriptable::SendKeys(%ld, %p, %p)"), numKeys, pbArrayKeyUp, plKeyData);
4732 			HRESULT hr = pIMsRdpClientNonScriptable->SendKeys(numKeys, pbArrayKeyUp, plKeyData);
4733 			dbgprintf(TEXT("IMsRdpClientNonScriptable::SendKeys -> %08X"), hr);
4734 			return hr;
4735 		}
4736 
4737 		/* IMsRdpClientNonScriptable2 */
4738 	public:
put_UIParentWindowHandle(wireHWND phwndUIParentWindowHandle)4739 		virtual HRESULT __stdcall IMsRdpClientNonScriptable2::put_UIParentWindowHandle(wireHWND phwndUIParentWindowHandle)
4740 		{
4741 			IMsRdpClientNonScriptable2 * pIMsRdpClientNonScriptable2 = getIMsRdpClientNonScriptable2();
4742 			dbgprintf(TEXT("IMsRdpClientNonScriptable2::put_UIParentWindowHandle(%p)"), phwndUIParentWindowHandle);
4743 			HRESULT hr = pIMsRdpClientNonScriptable2->put_UIParentWindowHandle(phwndUIParentWindowHandle);
4744 			dbgprintf(TEXT("IMsRdpClientNonScriptable2::put_UIParentWindowHandle -> %08X"), hr);
4745 			return hr;
4746 		}
4747 
get_UIParentWindowHandle(wireHWND * phwndUIParentWindowHandle)4748 		virtual HRESULT __stdcall IMsRdpClientNonScriptable2::get_UIParentWindowHandle(wireHWND * phwndUIParentWindowHandle)
4749 		{
4750 			IMsRdpClientNonScriptable2 * pIMsRdpClientNonScriptable2 = getIMsRdpClientNonScriptable2();
4751 			dbgprintf(TEXT("IMsRdpClientNonScriptable2::get_UIParentWindowHandle(%p)"), phwndUIParentWindowHandle);
4752 			HRESULT hr = pIMsRdpClientNonScriptable2->get_UIParentWindowHandle(phwndUIParentWindowHandle);
4753 			dbgprintf(TEXT("IMsRdpClientNonScriptable2::get_UIParentWindowHandle -> %08X, hwndUIParentWindowHandle = %p"), hr, *phwndUIParentWindowHandle);
4754 			return hr;
4755 		}
4756 
4757 		/*
4758 		{
4759 			 * p = m_;
4760 			dbgprintf(TEXT("::()"), );
4761 			HRESULT hr = p->();
4762 			dbgprintf(TEXT(":: -> %08X, "), hr, );
4763 			return hr;
4764 		}
4765 		*/
4766 	};
4767 
4768 	class ClassFactory: public IClassFactory2
4769 	{
4770 	private:
4771 		LONG m_refCount;
4772 		IUnknown * m_IUnknown;
4773 		IClassFactory * m_IClassFactory;
4774 		IClassFactory2 * m_IClassFactory2;
4775 
getIClassFactory()4776 		IClassFactory * getIClassFactory()
4777 		{
4778 			if(m_IClassFactory)
4779 				return m_IClassFactory;
4780 
4781 			if(m_IClassFactory2)
4782 				m_IClassFactory = m_IClassFactory2;
4783 
4784 			if(m_IClassFactory)
4785 			{
4786 				m_IClassFactory->AddRef();
4787 				return m_IClassFactory;
4788 			}
4789 
4790 			m_IUnknown->QueryInterface(&m_IClassFactory);
4791 			return m_IClassFactory;
4792 		}
4793 
getIClassFactory2()4794 		IClassFactory2 * getIClassFactory2()
4795 		{
4796 			if(m_IClassFactory2)
4797 				return m_IClassFactory2;
4798 
4799 			m_IUnknown->QueryInterface(&m_IClassFactory2);
4800 			return m_IClassFactory2;
4801 		}
4802 
4803 	public:
ClassFactory(IUnknown * pUnknwn)4804 		ClassFactory(IUnknown * pUnknwn):
4805 			m_refCount(1),
4806 			m_IUnknown(pUnknwn),
4807 			m_IClassFactory(NULL),
4808 			m_IClassFactory2(NULL)
4809 		{
4810 			m_IUnknown->AddRef();
4811 		}
4812 
~ClassFactory()4813 		~ClassFactory()
4814 		{
4815 			if(m_IUnknown)
4816 				m_IUnknown->Release();
4817 
4818 			if(m_IClassFactory)
4819 				m_IClassFactory->Release();
4820 
4821 			if(m_IClassFactory2)
4822 				m_IClassFactory2->Release();
4823 		}
4824 
4825 		/* IUnknown */
4826 	public:
QueryInterface(REFIID riid,void ** ppvObject)4827         virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void ** ppvObject)
4828 		{
4829 			HRESULT hr;
4830 			IUnknown * pvObject = NULL;
4831 
4832 			dbgprintf(TEXT("IUnknown::QueryInterface(%ls, %p)"), UUIDToString(riid).c_str(), ppvObject);
4833 
4834 #define QIBEGIN() \
4835 	if(riid == IID_IUnknown) \
4836 	{ \
4837 		hr = S_OK; \
4838 		pvObject = (IUnknown *)(this); \
4839 	}
4840 
4841 #define QI(I) \
4842 	else if(riid == IID_ ## I) \
4843 	{ \
4844 		if(m_ ## I) \
4845 		{ \
4846 			m_ ## I->AddRef(); \
4847 			hr = S_OK; \
4848 		} \
4849 		else \
4850 		{ \
4851 			hr = m_IUnknown->QueryInterface(&m_ ## I); \
4852 		} \
4853  \
4854 		if(SUCCEEDED(hr)) \
4855 			pvObject = static_cast<I *>(this); \
4856 	}
4857 
4858 #define QIEND() \
4859 	else \
4860 	{ \
4861 		hr = E_NOINTERFACE; \
4862 		pvObject = NULL; \
4863 	}
4864 
4865 			QIBEGIN()
4866 			QI(IClassFactory)
4867 			QI(IClassFactory2)
4868 			QIEND()
4869 
4870 #undef QIBEGIN
4871 #undef QIEND
4872 #undef QI
4873 
4874 			if(SUCCEEDED(hr))
4875 			{
4876 				assert(pvObject);
4877 				pvObject->AddRef();
4878 			}
4879 			else
4880 			{
4881 				assert(pvObject == NULL);
4882 			}
4883 
4884 			*ppvObject = pvObject;
4885 
4886 			dbgprintf(TEXT("IUnknown::QueryInterface -> %08X, ppvObject = %p"), hr, *ppvObject);
4887 			return hr;
4888 		}
4889 
AddRef(void)4890         virtual ULONG STDMETHODCALLTYPE AddRef(void)
4891 		{
4892 			return InterlockedIncrement(&m_refCount);
4893 		}
4894 
Release(void)4895         virtual ULONG STDMETHODCALLTYPE Release(void)
4896 		{
4897 			LONG n = InterlockedDecrement(&m_refCount);
4898 
4899 			if(n == 0)
4900 				delete this;
4901 
4902 			return n;
4903 		}
4904 
4905 		/* IClassFactory */
4906 	public:
CreateInstance(IUnknown * pUnkOuter,REFIID riid,void ** ppvObject)4907         virtual HRESULT STDMETHODCALLTYPE CreateInstance(IUnknown * pUnkOuter, REFIID riid, void ** ppvObject)
4908 		{
4909 			IClassFactory * pIClassFactory = getIClassFactory();
4910 			dbgprintf(TEXT("IClassFactory::CreateInstance(%p, %ls, %p)"), pUnkOuter, UUIDToString(riid).c_str(), ppvObject);
4911 			HRESULT hr = pIClassFactory->CreateInstance(NULL, riid, ppvObject);
4912 			dbgprintf(TEXT("IClassFactory::CreateInstance -> %08X, pvObject = %p"), hr, *ppvObject);
4913 			return CoClass::CreateInstance((IUnknown *)*ppvObject, pUnkOuter, riid, ppvObject);
4914 		}
4915 
LockServer(BOOL fLock)4916         virtual HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock)
4917 		{
4918 			IClassFactory * pIClassFactory = getIClassFactory();
4919 			dbgprintf(TEXT("IClassFactory::LockServer(%s)"), BooleanToString(fLock));
4920 			HRESULT hr = pIClassFactory->LockServer(fLock);
4921 			dbgprintf(TEXT("IClassFactory::LockServer -> %08X"), hr);
4922 			return hr;
4923 		}
4924 
4925 		/* IClassFactory2 */
4926 	public:
GetLicInfo(LICINFO * pLicInfo)4927         virtual HRESULT STDMETHODCALLTYPE GetLicInfo(LICINFO * pLicInfo)
4928 		{
4929 			IClassFactory2 * pIClassFactory2 = getIClassFactory2();
4930 			dbgprintf(TEXT("IClassFactory2::GetLicInfo(%p)"), pLicInfo);
4931 			HRESULT hr = pIClassFactory2->GetLicInfo(pLicInfo);
4932 			dbgprintf(TEXT("IClassFactory2::GetLicInfo -> %08X, LicInfo = %p"), hr, pLicInfo);
4933 			return hr;
4934 		}
4935 
RequestLicKey(DWORD dwReserved,BSTR * pBstrKey)4936         virtual HRESULT STDMETHODCALLTYPE RequestLicKey(DWORD dwReserved, BSTR * pBstrKey)
4937 		{
4938 			IClassFactory2 * pIClassFactory2 = getIClassFactory2();
4939 			dbgprintf(TEXT("IClassFactory2::RequestLicKey(%lu, %p)"), dwReserved, pBstrKey);
4940 			HRESULT hr = pIClassFactory2->RequestLicKey(dwReserved, pBstrKey);
4941 			dbgprintf(TEXT("IClassFactory2::RequestLicKey -> %08X, bstrKey = %ls"), hr, *pBstrKey);
4942 			return hr;
4943 		}
4944 
CreateInstanceLic(IUnknown * pUnkOuter,IUnknown * pUnkReserved,REFIID riid,BSTR bstrKey,PVOID * ppvObj)4945         virtual HRESULT STDMETHODCALLTYPE CreateInstanceLic(IUnknown * pUnkOuter, IUnknown * pUnkReserved, REFIID riid, BSTR bstrKey, PVOID * ppvObj)
4946 		{
4947 			IClassFactory2 * pIClassFactory2 = getIClassFactory2();
4948 			dbgprintf(TEXT("IClassFactory2::CreateInstanceLic(%p, %p, %ls, %ls, %p)"), pUnkOuter, pUnkReserved, UUIDToString(riid).c_str(), bstrKey, ppvObj);
4949 			HRESULT hr = pIClassFactory2->CreateInstanceLic(NULL, pUnkReserved, riid, bstrKey, ppvObj);
4950 			dbgprintf(TEXT("IClassFactory2::CreateInstanceLic -> %08X, pvObj = %p"), hr, *ppvObj);
4951 			return CoClass::CreateInstance((IUnknown *)*ppvObj, pUnkOuter, riid, ppvObj);
4952 		}
4953 	};
4954 
DllGetClassObject(IN REFCLSID rclsid,IN REFIID riid,OUT LPVOID * ppv)4955 	STDAPI DllGetClassObject(IN REFCLSID rclsid, IN REFIID riid, OUT LPVOID * ppv)
4956 	{
4957 		init();
4958 
4959 		dbgprintf(TEXT("DllGetClassObject(%ls, %ls, %p)"), UUIDToString(rclsid).c_str(), UUIDToString(riid).c_str(), ppv);
4960 		HRESULT hr = pfnDllGetClassObject(rclsid, IID_IUnknown, ppv);
4961 		dbgprintf(TEXT("DllGetClassObject -> %08X, pv = %p"), hr, *ppv);
4962 
4963 		IUnknown * pv = NULL;
4964 
4965 		if(SUCCEEDED(hr))
4966 		{
4967 			IUnknown * punk = (IUnknown *)*ppv;
4968 
4969 			if(rclsid == CLSID_MsTscAx || rclsid == CLSID_MsRdpClient || rclsid == CLSID_MsRdpClient2 || rclsid == CLSID_MsRdpClient3 || rclsid == CLSID_MsRdpClient4)
4970 				pv = new ClassFactory(punk);
4971 			else
4972 				hr = CLASS_E_CLASSNOTAVAILABLE;
4973 
4974 			punk->Release();
4975 		}
4976 
4977 		if(pv)
4978 		{
4979 			hr = pv->QueryInterface(riid, ppv);
4980 
4981 			if(FAILED(hr))
4982 				pv->Release();
4983 		}
4984 
4985 		return hr;
4986 	}
4987 
DllCanUnloadNow(void)4988 	STDAPI DllCanUnloadNow(void)
4989 	{
4990 		init();
4991 
4992 		dbgprintf(TEXT("DllCanUnloadNow()"));
4993 		HRESULT hr = pfnDllCanUnloadNow();
4994 		dbgprintf(TEXT("DllCanUnloadNow -> %08X"), hr);
4995 
4996 		return hr;
4997 	}
4998 
DllGetTscCtlVer(void)4999 	STDAPI_(ULONG) DllGetTscCtlVer(void)
5000 	{
5001 		init();
5002 
5003 		dbgprintf(TEXT("DllGetTscCtlVer()"));
5004 		ULONG ul = pfnDllGetTscCtlVer();
5005 		dbgprintf(TEXT("DllGetTscCtlVer-> %08X"), ul);
5006 
5007 		return ul;
5008 	}
5009 }
5010 
5011 // EOF
5012