Wednesday 3 June 2009

VirtualChannelInitEvent parameter meaning

If you are trying MSDN sample TSSysInf, you may get crash. The problem happens at

strcpy_s(gszClientName, strlen((LPSTR)pData)+1, (LPSTR)pData);


On MSDN, it describes the event CHANNEL_EVENT_CONNECTED as "A connection has been established with a terminal server that supports virtual channels. The pData parameter is a pointer to a null-terminated string with the name of the server.".

However, it was a different story when I debugged it.

dataLength = 256;

pData value is as following,

0x00BCFB7C d6 ad 96 15 c7 72 be 65 e2 d3 32 d1 23 69 c7 87 Ö­–.Çr.eâÓ2Ñ#iÇ.
0x00BCFB8C 0b 6a 41 3e b3 83 b4 b4 0c 24 ab 6d 00 00 00 00 .jA>.ƒ´´.$«m....
0x00BCFB9C 00 00 00 00 88 fc bc 00 30 fc bc 00 28 00 00 00 ....ˆü..0ü..(...
0x00BCFBAC 00 00 00 00 1c fc bc 00 68 22 67 6a 30 fc bc 00 .....ü..h"gj0ü..
0x00BCFBBC 90 fc bc 00 40 00 00 00 10 93 96 00 e4 92 96 00 .ü..@....“–.ä’–.
0x00BCFBCC 96 22 67 6a 80 00 00 00 00 00 00 00 00 00 00 00 –"gj€...........
0x00BCFBDC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x00BCFBEC 00 00 00 00 00 00 00 00 00 00 00 00 49 21 67 6a ............I!gj
0x00BCFBFC 38 fc bc 00 48 fc bc 00 10 93 96 00 e4 92 96 00 8ü..Hü...“–.ä’–.
0x00BCFC0C 04 93 96 00 00 00 00 00 a0 fc bc 00 95 65 00 00 .“–..... ü...e..
0x00BCFC1C a0 fc bc 00 17 fe 66 6a 30 fc bc 00 20 93 96 00  ü...þfj0ü.. “–.
0x00BCFC2C 28 fe 66 6a 00 04 00 00 00 00 00 00 32 e4 9f 4c (þfj........2äŸL
0x00BCFC3C 8e 8e d8 58 f3 c0 07 c0 4a ad 8a 20 00 00 00 00 ŽŽØXóÀ.ÀJ­Š ....
0x00BCFC4C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x00BCFC5C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x00BCFC6C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

MS should have updated their document on this function VirtualChannelInitEvent.

No comments: