-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmstschook.cpp
3304 lines (2809 loc) · 103 KB
/
mstschook.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* mstscdump: MSTSC Packet Dump Utility
* MSTSCAX Packet Dump Hook
*
* Copyright 2014-2022 Nogginware Corporation <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define _CRT_SECURE_NO_WARNINGS
#define SECURITY_WIN32
#define WIN32_LEAN_AND_MEAN
#include <intrin.h>
#include <winsock2.h>
#include <sspi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
#include <time.h>
#include <psapi.h>
#include <comdef.h>
#include <detours.h>
#if 0
#import "mstscax.dll" named_guids
#else
#include "mstscax.tlh"
#include "mstscax.tli"
#endif
#pragma comment(lib, "ws2_32.lib")
using namespace MSTSCLib;
////////////////////////////////////////////////////////////////////////
//
// Constant Definitions
//
#define REGISTRY_KEY TEXT("SOFTWARE\\Nogginware\\MsTscHook")
#define PCAP_FILE "mstscdump.pcap"
#define WRITE_LOG 0
#define DETOUR_ATTACH(_proc, _type, _real, _hook) \
{ \
_real = (_type)_proc; \
if (_real) DetourAttach(&(PVOID&)_real, _hook); \
}
#define DETOUR_DETACH(_real, _hook) \
{ \
if (_real) DetourDetach(&(PVOID&)_real, _hook); \
}
////////////////////////////////////////////////////////////////////////
//
// Type Definitions
//
typedef void (WINAPI *LPCloseThreadpoolIo)(PTP_IO);
typedef PTP_IO (WINAPI *LPCreateThreadpoolIo)(HANDLE, PTP_WIN32_IO_CALLBACK, PVOID, PTP_CALLBACK_ENVIRON);
typedef BOOL (WINAPI *LPGetOverlappedResult)(HANDLE, LPWSAOVERLAPPED, LPDWORD, BOOL);
typedef BOOL (WINAPI *LPGetOverlappedResultEx)(HANDLE, LPWSAOVERLAPPED, LPDWORD, DWORD, BOOL);
typedef void (WINAPI *LPStartThreadpoolIo)(PTP_IO);
typedef HRESULT (WINAPI *LPDllGetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID *ppv);
typedef int (WSAAPI *LPWSAAsyncSelect)(SOCKET, HWND, UINT, long);
typedef int (WSAAPI *LPWSAEnumNetworkEvents)(SOCKET, WSAEVENT, LPWSANETWORKEVENTS);
typedef int (WSAAPI *LPWSAEventSelect)(SOCKET, WSAEVENT, long);
typedef int (WSAAPI *LPWSAGetLastError)();
typedef BOOL (WSAAPI *LPWSAGetOverlappedResult)(SOCKET, LPWSAOVERLAPPED, LPDWORD, BOOL, LPDWORD);
typedef int (WSAAPI *LPWSAIoctl)(SOCKET, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
typedef int (WSAAPI *LPWSARecv)(SOCKET, LPWSABUF, DWORD, LPDWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
typedef int (WSAAPI *LPWSASend)(SOCKET, LPWSABUF, DWORD, LPDWORD, DWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
typedef void (WSAAPI *LPWSASetLastError)(int iError);
typedef SOCKET (WSAAPI *LPWSASocketW)(int, int, int, LPWSAPROTOCOL_INFOW, GROUP, DWORD);
typedef DWORD (WSAAPI *LPWSAWaitForMultipleEvents)(DWORD, const WSAEVENT *, BOOL, DWORD, BOOL);
typedef int (WSAAPI *LPgetsockopt)(SOCKET, int, int, char *, int *);
typedef int (WSAAPI *LPioctlsocket)(SOCKET, long cmd, u_long *argp);
typedef int (WSAAPI *LPrecv)(SOCKET, char *, int, int);
typedef int (WSAAPI *LPselect)(int, fd_set *, fd_set *, fd_set *, const timeval *);
typedef int (WSAAPI *LPsend)(SOCKET, char *, int, int);
typedef int (WSAAPI *LPsetsockopt)(SOCKET, int, int, const char *, int);
typedef signed char sint8;
typedef signed short sint16;
typedef signed long sint32;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
#pragma pack(push, 1)
typedef struct pcap_hdr_s
{
uint32 magic_number; /* magic number */
uint16 version_major; /* major version number */
uint16 version_minor; /* minor version number */
sint32 thiszone; /* GMT to local correction */
uint32 sigfigs; /* accuracy of timestamps */
uint32 snaplen; /* max length of captured packets, in octets */
uint32 network; /* data link type */
} pcap_hdr_t;
typedef struct pcaprec_hdr_s
{
uint32 ts_sec; /* timestamp seconds */
uint32 ts_usec; /* timestamp microseconds */
uint32 incl_len; /* number of octets of packet saved in file */
uint32 orig_len; /* actual length of packet */
} pcaprec_hdr_t;
typedef struct ethernet_hdr_s
{
uint8 dest_addr[6]; /* destination MAC address */
uint8 source_addr[6]; /* source MAC address */
uint16 frame_type; /* ethernet frame type */
} ethernet_hdr_t;
typedef struct ipv4_hdr_s
{
uint8 version_ihl; /* version and internet header length (IHL) */
uint8 dscp_ecn; /* DSCP and ECN */
uint16 total_length; /* total length */
uint16 identification; /* identification */
uint16 flags_fragment_offset; /* flags and fragment offset */
uint8 ttl; /* time to live */
uint8 protocol; /* protocol */
uint16 checksum; /* header checksum */
uint32 source_ip_addr; /* source IP address */
uint32 dest_ip_addr; /* destination IP address */
} ipv4_hdr_t;
typedef struct tcp_hdr_s
{
uint16 source_port; /* source port */
uint16 dest_port; /* destination port */
uint32 seq_number; /* sequence number */
uint32 ack_number; /* acknowledgement number */
uint16 flags; /* data offset and flags */
uint16 window_size; /* window size */
uint16 checksum; /* checksum */
uint16 urgent_pointer; /* urgent pointer */
} tcp_hdr_t;
#pragma pack(pop)
////////////////////////////////////////////////////////////////////////
//
// Data Declarations
//
static HMODULE g_hModule;
static HMODULE g_hModKernel32;
static HMODULE g_hModMsTscAx;
static HMODULE g_hModSspiCli;
static HMODULE g_hModWinsock;
static HANDLE g_hMutex;
static BOOL g_fShowAllBuffers;
static BOOL g_fPCapHeaderWritten;
static BOOL g_fTransportSecured;
static uint8 g_clientMacAddr[6] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
static uint8 g_serverMacAddr[6] = { 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6 };
static uint32 g_clientIPAddr = 0xc0a80164;
static uint32 g_serverIPAddr = 0xc0a801c8;
static uint16 g_clientTcpPort = 3389;
static uint16 g_serverTcpPort = 3389;
static uint32 g_clientSeqNumber;
static uint32 g_serverSeqNumber;
static LPCloseThreadpoolIo Real_CloseThreadpoolIo;
static LPCreateThreadpoolIo Real_CreateThreadpoolIo;
static LPGetOverlappedResult Real_GetOverlappedResult;
static LPGetOverlappedResultEx Real_GetOverlappedResultEx;
static LPStartThreadpoolIo Real_StartThreadpoolIo;
static LPDllGetClassObject Real_DllGetClassObject;
static ACCEPT_SECURITY_CONTEXT_FN Real_AcceptSecurityContext;
static ACQUIRE_CREDENTIALS_HANDLE_FN_A Real_AcquireCredentialsHandleA;
static ACQUIRE_CREDENTIALS_HANDLE_FN_W Real_AcquireCredentialsHandleW;
static DECRYPT_MESSAGE_FN Real_DecryptMessage;
static ENCRYPT_MESSAGE_FN Real_EncryptMessage;
static LPWSAAsyncSelect Real_WSAAsyncSelect;
static LPWSAEnumNetworkEvents Real_WSAEnumNetworkEvents;
static LPWSAEventSelect Real_WSAEventSelect;
static LPWSAGetLastError Real_WSAGetLastError;
static LPWSAGetOverlappedResult Real_WSAGetOverlappedResult;
static LPWSAIoctl Real_WSAIoctl;
static LPWSARecv Real_WSARecv;
static LPWSASend Real_WSASend;
static LPWSASetLastError Real_WSASetLastError;
static LPWSASocketW Real_WSASocketW;
static LPWSAWaitForMultipleEvents Real_WSAWaitForMultipleEvents;
static LPgetsockopt Real_getsockopt;
static LPioctlsocket Real_ioctlsocket;
static LPrecv Real_recv;
static LPselect Real_select;
static LPsend Real_send;
static LPsetsockopt Real_setsockopt;
typedef struct
{
SOCKET socket;
WSAOVERLAPPED overlapped;
LPWSABUF lpBuffers;
DWORD dwBufferCount;
LPWSAOVERLAPPED lpOverlapped;
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine;
} wsa_context_t;
static wsa_context_t g_wsaRecvContext;
static wsa_context_t g_wsaSendContext;
////////////////////////////////////////////////////////////////////////
//
// Function Prototypes
//
static VOID WriteLog(LPCTSTR, ...);
////////////////////////////////////////////////////////////////////////
//
// COM Utility Functions
//
static VOID WriteCLSID(REFCLSID rclsid)
{
LPOLESTR polestrCLSID;
if (StringFromCLSID(rclsid, &polestrCLSID) == S_OK)
{
LONG lStatus;
char szSubKey[128];
char szValue[128];
LONG cbValue;
_bstr_t bstrCLSID = polestrCLSID;
sprintf(szSubKey, "CLSID\\%s", (LPCTSTR)bstrCLSID);
ZeroMemory(szValue, sizeof(szValue));
cbValue = sizeof(szValue);
lStatus = RegQueryValue(HKEY_CLASSES_ROOT, szSubKey, szValue, &cbValue);
if ((lStatus == ERROR_SUCCESS) && (strlen(szValue) > 0))
{
WriteLog("--> CLSID=%s (%s)", (LPCTSTR)bstrCLSID, szValue);
}
else
{
WriteLog("--> CLSID=%s", (LPCTSTR)bstrCLSID);
}
CoTaskMemFree(polestrCLSID);
}
}
static VOID WriteIID(REFIID riid)
{
LPOLESTR polestrIID;
if (StringFromIID(riid, &polestrIID) == S_OK)
{
LONG lStatus;
char szSubKey[128];
char szValue[128];
LONG cbValue;
_bstr_t bstrIID = polestrIID;
sprintf(szSubKey, "Interface\\%s", (LPCTSTR)bstrIID);
ZeroMemory(szValue, sizeof(szValue));
cbValue = sizeof(szValue);
lStatus = RegQueryValue(HKEY_CLASSES_ROOT, szSubKey, szValue, &cbValue);
if ((lStatus == ERROR_SUCCESS) && (strlen(szValue) > 0))
{
WriteLog("--> IID=%s (%s)", (LPCTSTR)bstrIID, szValue);
}
else
{
WriteLog("--> IID=%s", (LPCTSTR)bstrIID);
}
CoTaskMemFree(polestrIID);
}
}
////////////////////////////////////////////////////////////////////////
//
// DumpMsTscProperties
//
#define DumpBool(_name,_value) try { WriteLog(" ." _name "=%s", _value ? "TRUE" : "FALSE"); } catch (...) { WriteLog(" ." _name "=(undefined)"); }
#define DumpLong(_name,_value) try { WriteLog(" ." _name "=%d", _value); } catch (...) { WriteLog(" ." _name "=(undefined)"); }
#define DumpPointer(_name, _value) try { WriteLog(" ." _name "=%x", _value); } catch (...) { WriteLog(" ." _name "=(undefined)"); }
#define DumpShort(_name,_value) try { WriteLog(" ." _name "=%d", _value); } catch (...) { WriteLog(" ." _name "=(undefined)"); }
#define DumpString(_name,_value) try { WriteLog(" ." _name "=%s", (LPCTSTR)_value); } catch (...) { WriteLog(" ." _name "=(undefined)"); }
static VOID DumpMsTscAdvancedSettings(IMsTscAdvancedSettings *p)
{
if (p == NULL) return;
WriteLog("IMsTscAdvancedSettings");
DumpLong("Compress", p->GetCompress());
DumpLong("BitmapPersistence", p->GetBitmapPeristence());
DumpLong("AllowBackgroundInput", p->GetallowBackgroundInput());
DumpLong("ContainerHandledFullScreen", p->GetContainerHandledFullScreen());
DumpLong("DisableRdpdr", p->GetDisableRdpdr());
}
static VOID DumpMsTscDebug(IMsTscDebug *p)
{
if (p == NULL) return;
WriteLog("IMsTscDebug");
DumpLong("HatchBitmapPDU", p->GetHatchBitmapPDU());
DumpLong("HatchSSBOrder", p->GetHatchSSBOrder());
DumpLong("HatchMembltOrder", p->GetHatchMembltOrder());
DumpLong("HatchIndexPDU", p->GetHatchIndexPDU());
DumpLong("LabelMemblt", p->GetLabelMemblt());
DumpLong("BitmapCacheMonitor", p->GetBitmapCacheMonitor());
DumpLong("MallocFailuresPercent", p->GetMallocFailuresPercent());
DumpLong("MallocHugeFailuresPercent", p->GetMallocHugeFailuresPercent());
DumpLong("NetThroughput", p->GetNetThroughput());
DumpString("CLXCmdLine", p->GetCLXCmdLine());
DumpString("CLXDll", p->GetCLXDll());
DumpLong("RemoteProgramsHatchVisibleRegion", p->GetRemoteProgramsHatchVisibleRegion());
DumpLong("RemoteProgramsHatchVisibleNoDataRegion", p->GetRemoteProgramsHatchVisibleNoDataRegion());
DumpLong("RemoteProgramsHatchWindow", p->GetRemoteProgramsHatchWindow());
DumpLong("RemoteProgramsStayConnectOnBadCaps", p->GetRemoteProgramsStayConnectOnBadCaps());
DumpLong("ControlType", p->GetControlType());
}
static VOID DumpMsTscNonScriptable(IMsTscNonScriptable *p)
{
if (p == NULL) return;
WriteLog("IMsTscNonScriptable");
DumpString("PortablePassword", p->GetPortablePassword());
DumpString("PortableSalt", p->GetPortableSalt());
DumpString("BinaryPassword", p->GetBinaryPassword());
DumpString("BinarySalt", p->GetBinarySalt());
}
static VOID DumpMsTscSecuredSettings(IMsTscSecuredSettings *p)
{
if (p == NULL) return;
WriteLog("IMsTscSecuredSettings");
DumpString("StartProgram", p->GetStartProgram());
DumpString("WorkDir", p->GetWorkDir());
DumpLong("FullScreen", p->GetFullScreen());
}
static VOID DumpMsRdpClientAdvancedSettings(IMsRdpClientAdvancedSettings *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientAdvancedSettings");
DumpLong("SmoothScroll", p->GetSmoothScroll());
DumpLong("AcceleratorPassthrough", p->GetAcceleratorPassthrough());
DumpLong("ShadowBitmap", p->GetShadowBitmap());
DumpLong("TransportType", p->GetTransportType());
DumpLong("SasSequence", p->GetSasSequence());
DumpLong("EncryptionEnabled", p->GetEncryptionEnabled());
DumpLong("DedicatedTerminal", p->GetDedicatedTerminal());
DumpLong("RDPPort", p->GetRDPPort());
DumpLong("EnableMouse", p->GetEnableMouse());
DumpLong("DisableCtrlAltDel", p->GetDisableCtrlAltDel());
DumpLong("EnableWindowsKey", p->GetEnableWindowsKey());
DumpLong("DoubleClickDetect", p->GetDoubleClickDetect());
DumpLong("MaximizeShell", p->GetMaximizeShell());
DumpLong("HotKeyFullScreen", p->GetHotKeyFullScreen());
DumpLong("HotKeyCtrlEsc", p->GetHotKeyCtrlEsc());
DumpLong("HotKeyAltEsc", p->GetHotKeyAltEsc());
DumpLong("HotKeyAltTab", p->GetHotKeyAltTab());
DumpLong("HotKeyAltShiftTab", p->GetHotKeyAltShiftTab());
DumpLong("HotKeyAltSpace", p->GetHotKeyAltSpace());
DumpLong("HotKeyCtrlAltDel", p->GetHotKeyCtrlAltDel());
DumpLong("OrderDrawThreshold", p->GetorderDrawThreshold());
DumpLong("BitmapCacheSize", p->GetBitmapCacheSize());
DumpLong("BitmapVirtualCacheSize", p->GetBitmapVirtualCacheSize());
DumpLong("ScaleBitmapCachesByBPP", p->GetScaleBitmapCachesByBPP());
DumpLong("NumBitmapCaches", p->GetNumBitmapCaches());
DumpLong("CachePersistenceActive", p->GetCachePersistenceActive());
DumpLong("BrushSupportLevel", p->GetbrushSupportLevel());
DumpLong("MinInputSendInterval", p->GetminInputSendInterval());
DumpLong("InputEventsAtOnce", p->GetInputEventsAtOnce());
DumpLong("MaxEventCount", p->GetmaxEventCount());
DumpLong("KeepAliveInterval", p->GetkeepAliveInterval());
DumpLong("ShutdownTimeout", p->GetshutdownTimeout());
DumpLong("OverallConnectionTimeout", p->GetoverallConnectionTimeout());
DumpLong("SingleConnectionTimeout", p->GetsingleConnectionTimeout());
DumpLong("KeyboardType", p->GetKeyboardType());
DumpLong("KeyboardSubType", p->GetKeyboardSubType());
DumpLong("KeyboardFunctionKey", p->GetKeyboardFunctionKey());
DumpLong("WinceFixedPalette", p->GetWinceFixedPalette());
DumpLong("ConnectToServerConsole", p->GetConnectToServerConsole());
DumpLong("BitmapPersistence", p->GetBitmapPersistence());
DumpLong("MinutesToIdleTimeout", p->GetMinutesToIdleTimeout());
DumpLong("SmartSizing", p->GetSmartSizing());
DumpString("RdpdrLocalPrintingDocName", (LPCTSTR)p->GetRdpdrLocalPrintingDocName());
DumpString("RdpdrClipCleanTempDirString", (LPCTSTR)p->GetRdpdrClipCleanTempDirString());
DumpString("RdpdrClipPasteInfoString", (LPCTSTR)p->GetRdpdrClipPasteInfoString());
DumpBool("DisplayConnectionBar", p->GetDisplayConnectionBar());
DumpBool("PinConnectionBar", p->GetPinConnectionBar());
DumpBool("GrabFocusOnConnect", p->GetGrabFocusOnConnect());
DumpString("LoadBalanceInfo", (LPCTSTR)p->GetLoadBalanceInfo());
DumpBool("RedirectDrives", p->GetRedirectDrives());
DumpBool("RedirectPrinters", p->GetRedirectPrinters());
DumpBool("RedirectPorts", p->GetRedirectPorts());
DumpBool("RedirectSmartCards", p->GetRedirectSmartCards());
DumpLong("BitmapVirtualCache16BppSize", p->GetBitmapVirtualCache16BppSize());
DumpLong("BitmapVirtualCache24BppSize", p->GetBitmapVirtualCache24BppSize());
DumpLong("PerformanceFlags", p->GetPerformanceFlags());
DumpBool("NotifyTSPublicKey", p->GetNotifyTSPublicKey());
DumpMsTscAdvancedSettings((IMsTscAdvancedSettings *)p);
}
static VOID DumpMsRdpClientAdvancedSettings2(IMsRdpClientAdvancedSettings2 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientAdvancedSettings2");
DumpBool("CanAutoReconnect", p->GetCanAutoReconnect());
DumpBool("EnableAutoReconnect", p->GetEnableAutoReconnect());
DumpLong("MaxReconnectAttempts", p->GetMaxReconnectAttempts());
DumpMsRdpClientAdvancedSettings((IMsRdpClientAdvancedSettings *)p);
}
static VOID DumpMsRdpClientAdvancedSettings3(IMsRdpClientAdvancedSettings3 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientAdvancedSettings3");
DumpBool("ConnectionBarShowMinimizeButton", p->GetConnectionBarShowMinimizeButton());
DumpBool("ConnectionBarShowRestoreButton", p->GetConnectionBarShowRestoreButton());
DumpMsRdpClientAdvancedSettings2((IMsRdpClientAdvancedSettings2 *)p);
}
static VOID DumpMsRdpClientAdvancedSettings4(IMsRdpClientAdvancedSettings4 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientAdvancedSettings4");
DumpLong("AuthenticationLevel", p->GetAuthenticationLevel());
DumpMsRdpClientAdvancedSettings3((IMsRdpClientAdvancedSettings3 *)p);
}
static VOID DumpMsRdpClientAdvancedSettings5(IMsRdpClientAdvancedSettings5 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientAdvancedSettings5");
DumpBool("RedirectClipboard", p->GetRedirectClipboard());
DumpLong("AudioRedirectionMode", p->GetAudioRedirectionMode());
DumpBool("ConnectionBarShowPinButton", p->GetConnectionBarShowPinButton());
DumpBool("PublicMode", p->GetPublicMode());
DumpBool("RedirectDevices", p->GetRedirectDevices());
DumpBool("RedirectPOSDevices", p->GetRedirectPOSDevices());
DumpLong("BitmapVirtualCache32BppSize", p->GetBitmapVirtualCache32BppSize());
DumpMsRdpClientAdvancedSettings4((IMsRdpClientAdvancedSettings4 *)p);
}
static VOID DumpMsRdpClientAdvancedSettings6(IMsRdpClientAdvancedSettings6 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientAdvancedSettings6");
DumpBool("RelativeMouseMode", p->GetRelativeMouseMode());
DumpString("AuthenticationServiceClass", p->GetAuthenticationServiceClass());
DumpString("PCB", p->GetPCB());
DumpLong("HotKeyFocusReleaseLeft", p->GetHotKeyFocusReleaseLeft());
DumpLong("HotKeyFocusReleaseRight", p->GetHotKeyFocusReleaseRight());
DumpBool("EnableCredSspSupport", p->GetEnableCredSspSupport());
DumpLong("AuthenticationType", p->GetAuthenticationType());
DumpMsRdpClientAdvancedSettings5((IMsRdpClientAdvancedSettings5 *)p);
}
static VOID DumpMsRdpClientAdvancedSettings7(IMsRdpClientAdvancedSettings7 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientAdvancedSettings7");
DumpBool("AudioCaptureRedirectionMode", p->GetAudioCaptureRedirectionMode());
DumpLong("VideoPlaybackMode", p->GetVideoPlaybackMode());
DumpBool("EnableSuperPan", p->GetEnableSuperPan());
DumpLong("SuperPanAccelerationFactor", p->GetSuperPanAccelerationFactor());
DumpBool("NegotiateSecurityLayer", p->GetNegotiateSecurityLayer());
DumpLong("AudioQualityMode", p->GetAudioQualityMode());
DumpBool("RedirectDirectX", p->GetRedirectDirectX());
DumpLong("NetworkConnectionType", p->GetNetworkConnectionType());
DumpMsRdpClientAdvancedSettings6((IMsRdpClientAdvancedSettings6 *)p);
}
static VOID DumpMsRdpClientAdvancedSettings8(IMsRdpClientAdvancedSettings8 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientAdvancedSettings8");
DumpBool("BandwidthDetection", p->GetBandwidthDetection());
DumpLong("ClientProtocolSpec", p->GetClientProtocolSpec());
DumpMsRdpClientAdvancedSettings7((IMsRdpClientAdvancedSettings7 *)p);
}
static VOID DumpMsRdpClientNonScriptable(IMsRdpClientNonScriptable *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientNonScriptable");
DumpMsTscNonScriptable((IMsTscNonScriptable *)p);
}
static VOID DumpMsRdpClientNonScriptable2(IMsRdpClientNonScriptable2 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientNonScriptable2");
DumpPointer("UIParentWindowHandle", p->GetUIParentWindowHandle());
DumpMsRdpClientNonScriptable((IMsRdpClientNonScriptable *)p);
}
static VOID DumpMsRdpClientNonScriptable3(IMsRdpClientNonScriptable3 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientNonScriptable3");
DumpBool("ShowRedirectionWarningDialog", p->GetShowRedirectionWarningDialog());
DumpBool("PromptForCredentials", p->GetPromptForCredentials());
DumpBool("NegotiateSecurityLayer", p->GetNegotiateSecurityLayer());
DumpBool("EnableCredSspSupport", p->GetEnableCredSspSupport());
DumpBool("RedirectDynamicDrives", p->GetRedirectDynamicDrives());
DumpBool("RedirectDynamicDevices", p->GetRedirectDynamicDevices());
DumpPointer("DeviceCollection", p->GetDeviceCollection());
DumpPointer("DriveCollection", p->GetDriveCollection());
DumpBool("WarnAboutSendingCredentials", p->GetWarnAboutSendingCredentials());
DumpBool("WarnAboutClipboardRedirection", p->GetWarnAboutClipboardRedirection());
DumpString("ConnectionBarText", p->GetConnectionBarText());
DumpMsRdpClientNonScriptable2((IMsRdpClientNonScriptable2 *)p);
}
static VOID DumpMsRdpClientSecuredSettings(IMsRdpClientSecuredSettings *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientSecuredSettings");
DumpLong("KeyboardHookMode", p->GetKeyboardHookMode());
DumpLong("AudioRedirectionMode", p->GetAudioRedirectionMode());
DumpMsTscSecuredSettings((IMsTscSecuredSettings *)p);
}
static VOID DumpMsRdpClientSecuredSettings2(IMsRdpClientSecuredSettings2 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientSecuredSettings2");
DumpString("PCB", p->GetPCB());
DumpMsRdpClientSecuredSettings((IMsRdpClientSecuredSettings *)p);
}
static VOID DumpMsRdpClientShell(IMsRdpClientShell *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientShell");
DumpString("RdpFileContents", p->GetRdpFileContents());
DumpBool("IsRemoteProgramClientInstalled", p->GetIsRemoteProgramClientInstalled());
DumpBool("PublicMode", p->GetPublicMode());
}
static VOID DumpMsRdpClientTransportSettings(IMsRdpClientTransportSettings *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientTransportSettings");
DumpString("GatewayHostname", p->GetGatewayHostname());
DumpLong("GatewayUsageMethod", p->GetGatewayUsageMethod());
DumpLong("GatewayProfileUsageMethod", p->GetGatewayProfileUsageMethod());
DumpLong("GatewayCredsSource", p->GetGatewayCredsSource());
DumpLong("GatewayUserSelectedCredsSource", p->GetGatewayUserSelectedCredsSource());
DumpLong("GatewayDefaultUsageMethod", p->GetGatewayDefaultUsageMethod());
}
static VOID DumpMsRdpClientTransportSettings2(IMsRdpClientTransportSettings2 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientTransportSettings2");
DumpLong("GatewayCredSharing", p->GetGatewayCredSharing());
DumpLong("GatewayPreAuthRequirement", p->GetGatewayPreAuthRequirement());
DumpString("GatewayPreAuthServerAddr", p->GetGatewayPreAuthServerAddr());
DumpString("GatewaySupportUrl", p->GetGatewaySupportUrl());
DumpString("GatewayEncryptedOtpCookie", p->GetGatewayEncryptedOtpCookie());
DumpLong("GatewayEncryptedOtpCookeSize", p->GetGatewayEncryptedOtpCookieSize());
DumpString("GatewayUsername", p->GetGatewayUsername());
DumpString("GatewayDomain", p->GetGatewayDomain());
DumpMsRdpClientTransportSettings((IMsRdpClientTransportSettings *)p);
}
static VOID DumpMsRdpClientTransportSettings3(IMsRdpClientTransportSettings3 *p)
{
if (p == NULL) return;
WriteLog("IMsRdpClientTransportSettings3");
DumpLong("GatewayCredSourceCookie", p->GetGatewayCredSourceCookie());
DumpString("GatewayAuthCookieServerAddr", p->GetGatewayAuthCookieServerAddr());
DumpString("GatewayEncryptedAuthCookie", p->GetGatewayEncryptedAuthCookie());
DumpLong("GatewayEncryptedAuthCookieSize", p->GetGatewayEncryptedAuthCookieSize());
DumpString("GatewayAuthLoginPage", p->GetGatewayAuthLoginPage());
DumpMsRdpClientTransportSettings2((IMsRdpClientTransportSettings2 *)p);
}
static VOID DumpTSRemoteProgram(ITSRemoteProgram *p)
{
if (p == NULL) return;
WriteLog("ITSRemoteProgram");
DumpBool("RemoteProgramMode", p->GetRemoteProgramMode());
}
static VOID DumpMsTscAx(IMsTscAx *p, BOOL fDumpChildren = TRUE)
{
if (p == NULL) return;
WriteLog("IMsTscAx");
DumpString("Server", p->GetServer());
DumpString("Domain", p->GetDomain());
DumpString("UserName", p->GetUserName());
DumpString("DisconnectedText", p->GetDisconnectedText());
DumpString("ConnectingText", p->GetConnectingText());
DumpShort("Connected", p->GetConnected());
DumpPointer("AdvancedSettings", p->GetAdvancedSettings());
DumpPointer("SecuredSettings", p->GetSecuredSettings());
DumpPointer("Debugger", p->GetDebugger());
DumpLong("DesktopWidth", p->GetDesktopWidth());
DumpLong("DesktopHeight", p->GetDesktopHeight());
DumpLong("StartConnected", p->GetStartConnected());
DumpLong("HorizontalScrollBarVisible", p->GetHorizontalScrollBarVisible());
DumpLong("VerticalScrollBarVisible", p->GetVerticalScrollBarVisible());
DumpLong("CipherStrength", p->GetCipherStrength());
DumpString("Version", p->GetVersion());
DumpLong("SecuredSettingsEnabled", p->GetSecuredSettingsEnabled());
if (fDumpChildren)
{
DumpMsTscAdvancedSettings(p->GetAdvancedSettings());
DumpMsTscSecuredSettings(p->GetSecuredSettings());
DumpMsTscDebug(p->GetDebugger());
}
}
static VOID DumpMsRdpClient(IMsRdpClient *p, BOOL fDumpChildren = TRUE)
{
if (p == NULL) return;
WriteLog("IMsRdpClient");
DumpLong("ColorDepth", p->GetColorDepth());
DumpPointer("AdvancedSettings2", p->GetAdvancedSettings2());
DumpPointer("SecuredSettings2", p->GetSecuredSettings2());
DumpBool("FullScreen", p->GetFullScreen());
DumpLong("ExtendedDisconnectReason", p->GetExtendedDisconnectReason());
DumpMsTscAx((IMsTscAx *)p, FALSE);
if (fDumpChildren)
{
if (p->GetAdvancedSettings2())
{
DumpMsRdpClientAdvancedSettings(p->GetAdvancedSettings2());
}
else
{
DumpMsTscAdvancedSettings(p->GetAdvancedSettings());
}
if (p->GetSecuredSettings2())
{
DumpMsRdpClientSecuredSettings(p->GetSecuredSettings2());
}
else
{
DumpMsTscSecuredSettings(p->GetSecuredSettings());
}
DumpMsTscDebug(p->GetDebugger());
}
}
static VOID DumpMsRdpClient2(IMsRdpClient2 *p, BOOL fDumpChildren = TRUE)
{
if (p == NULL) return;
WriteLog("IMsRdpClient2");
DumpPointer("AdvancedSettings3", p->GetAdvancedSettings3());
DumpString("ConnectedStatusText", p->GetConnectedStatusText());
DumpMsRdpClient((IMsRdpClient *)p, FALSE);
if (fDumpChildren)
{
if (p->GetAdvancedSettings3())
{
DumpMsRdpClientAdvancedSettings2(p->GetAdvancedSettings3());
}
else if (p->GetAdvancedSettings2())
{
DumpMsRdpClientAdvancedSettings(p->GetAdvancedSettings2());
}
else
{
DumpMsTscAdvancedSettings(p->GetAdvancedSettings());
}
if (p->GetSecuredSettings2())
{
DumpMsRdpClientSecuredSettings(p->GetSecuredSettings2());
}
else
{
DumpMsTscSecuredSettings(p->GetSecuredSettings());
}
DumpMsTscDebug(p->GetDebugger());
}
}
static VOID DumpMsRdpClient3(IMsRdpClient3 *p, BOOL fDumpChildren = TRUE)
{
if (p == NULL) return;
WriteLog("IMsRdpClient3");
DumpPointer("AdvancedSettings4", p->GetAdvancedSettings4());
DumpMsRdpClient2((IMsRdpClient2 *)p, FALSE);
if (fDumpChildren)
{
if (p->GetAdvancedSettings4())
{
DumpMsRdpClientAdvancedSettings3(p->GetAdvancedSettings4());
}
else if (p->GetAdvancedSettings3())
{
DumpMsRdpClientAdvancedSettings2(p->GetAdvancedSettings3());
}
else if (p->GetAdvancedSettings2())
{
DumpMsRdpClientAdvancedSettings(p->GetAdvancedSettings2());
}
else
{
DumpMsTscAdvancedSettings(p->GetAdvancedSettings());
}
if (p->GetSecuredSettings2())
{
DumpMsRdpClientSecuredSettings(p->GetSecuredSettings2());
}
else
{
DumpMsTscSecuredSettings(p->GetSecuredSettings());
}
DumpMsTscDebug(p->GetDebugger());
}
}
static VOID DumpMsRdpClient4(IMsRdpClient4 *p, BOOL fDumpChildren = TRUE)
{
if (p == NULL) return;
WriteLog("IMsRdpClient4");
DumpPointer("AdvancedSettings5", p->GetAdvancedSettings5());
DumpMsRdpClient3((IMsRdpClient3 *)p, FALSE);
if (fDumpChildren)
{
if (p->GetAdvancedSettings5())
{
DumpMsRdpClientAdvancedSettings4(p->GetAdvancedSettings5());
}
else if (p->GetAdvancedSettings4())
{
DumpMsRdpClientAdvancedSettings3(p->GetAdvancedSettings4());
}
else if (p->GetAdvancedSettings3())
{
DumpMsRdpClientAdvancedSettings2(p->GetAdvancedSettings3());
}
else if (p->GetAdvancedSettings2())
{
DumpMsRdpClientAdvancedSettings(p->GetAdvancedSettings2());
}
else
{
DumpMsTscAdvancedSettings(p->GetAdvancedSettings());
}
if (p->GetSecuredSettings2())
{
DumpMsRdpClientSecuredSettings(p->GetSecuredSettings2());
}
else
{
DumpMsTscSecuredSettings(p->GetSecuredSettings());
}
DumpMsTscDebug(p->GetDebugger());
}
}
static VOID DumpMsRdpClient5(IMsRdpClient5 *p, BOOL fDumpChildren = TRUE)
{
if (p == NULL) return;
WriteLog("IMsRdpClient5");
DumpPointer("AdvancedSettings6", p->GetAdvancedSettings6());
DumpPointer("TransportSettings", p->GetTransportSettings());
DumpPointer("RemoteProgram", p->GetRemoteProgram());
DumpPointer("MsRdpClientShell", p->GetMsRdpClientShell());
DumpMsRdpClient4((IMsRdpClient4 *)p, FALSE);
if (fDumpChildren)
{
if (p->GetAdvancedSettings6())
{
DumpMsRdpClientAdvancedSettings5(p->GetAdvancedSettings6());
}
else if (p->GetAdvancedSettings5())
{
DumpMsRdpClientAdvancedSettings4(p->GetAdvancedSettings5());
}
else if (p->GetAdvancedSettings4())
{
DumpMsRdpClientAdvancedSettings3(p->GetAdvancedSettings4());
}
else if (p->GetAdvancedSettings3())
{
DumpMsRdpClientAdvancedSettings2(p->GetAdvancedSettings3());
}
else if (p->GetAdvancedSettings2())
{
DumpMsRdpClientAdvancedSettings(p->GetAdvancedSettings2());
}
else
{
DumpMsTscAdvancedSettings(p->GetAdvancedSettings());
}
if (p->GetSecuredSettings2())
{
DumpMsRdpClientSecuredSettings(p->GetSecuredSettings2());
}
else
{
DumpMsTscSecuredSettings(p->GetSecuredSettings());
}
DumpMsRdpClientTransportSettings(p->GetTransportSettings());
DumpMsRdpClientShell(p->GetMsRdpClientShell());
DumpTSRemoteProgram(p->GetRemoteProgram());
DumpMsTscDebug(p->GetDebugger());
}
}
static VOID DumpMsRdpClient6(IMsRdpClient6 *p, BOOL fDumpChildren = TRUE)
{
if (p == NULL) return;
WriteLog("IMsRdpClient6");
DumpPointer("AdvancedSettings7", p->GetAdvancedSettings7());
DumpPointer("TransportSettings2", p->GetTransportSettings2());
DumpMsRdpClient5((IMsRdpClient5 *)p, FALSE);
if (fDumpChildren)
{
if (p->GetAdvancedSettings7())
{
DumpMsRdpClientAdvancedSettings6(p->GetAdvancedSettings7());
}
else if (p->GetAdvancedSettings6())
{
DumpMsRdpClientAdvancedSettings5(p->GetAdvancedSettings6());
}
else if (p->GetAdvancedSettings5())
{
DumpMsRdpClientAdvancedSettings4(p->GetAdvancedSettings5());
}
else if (p->GetAdvancedSettings4())
{
DumpMsRdpClientAdvancedSettings3(p->GetAdvancedSettings4());
}
else if (p->GetAdvancedSettings3())
{
DumpMsRdpClientAdvancedSettings2(p->GetAdvancedSettings3());
}
else if (p->GetAdvancedSettings2())
{
DumpMsRdpClientAdvancedSettings(p->GetAdvancedSettings2());
}
else
{
DumpMsTscAdvancedSettings(p->GetAdvancedSettings());
}
if (p->GetSecuredSettings2())
{
DumpMsRdpClientSecuredSettings(p->GetSecuredSettings2());
}
else
{
DumpMsTscSecuredSettings(p->GetSecuredSettings());
}
if (p->GetTransportSettings2())
{
DumpMsRdpClientTransportSettings2(p->GetTransportSettings2());
}
else
{
DumpMsRdpClientTransportSettings(p->GetTransportSettings());
}
DumpMsRdpClientShell(p->GetMsRdpClientShell());
DumpTSRemoteProgram(p->GetRemoteProgram());
DumpMsTscDebug(p->GetDebugger());
}
}
static VOID DumpMsRdpClient7(IMsRdpClient7 *p, BOOL fDumpChildren = TRUE)
{
if (p == NULL) return;
WriteLog("IMsRdpClient7");
DumpPointer("AdvancedSettings8", p->GetAdvancedSettings8());
DumpPointer("TransportSettings3", p->GetTransportSettings3());
DumpPointer("SecuredSettings3", p->GetSecuredSettings3());