Hello!
I'm creating client dll for virtual channel. And I got stuck in the beginning.
HANDLE ClientHandle= NULL; CHANNEL_DEF pChannel[1]; CHANNEL_ENTRY_POINTS SavedEntryPoints; PCHANNEL_INIT_EVENT_FN pChannelInitEventProc; BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints){ ofstream myfile; myfile.open ("D:\\Projects\\bench_cli\\ConsoleApplication1\\Release\\example.txt"); myfile <<"Writing this to a file.\n"; UINT retval1 =0;ZeroMemory(&pChannel[0],sizeof(CHANNEL_DEF)); strcpy(pChannel[0].name,"Bench"); pChannel[0].options = CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP; pChannelInitEventProc =VirtualChannelInitEvent; memcpy(&SavedEntryPoints, pEntryPoints,sizeof(CHANNEL_ENTRY_POINTS)); myfile <<" copied"<< endl;// call VirtualChannelInit using the function pointer in// PCHANNEL_ENTRY_POINTS myfile <<"Initing"<< endl; retval1 = pEntryPoints->pVirtualChannelInit (&ClientHandle, pChannel,1, VIRTUAL_CHANNEL_VERSION_WIN2000, pChannelInitEventProc); myfile <<" init"<< endl; myfile.close();return TRUE;}
VOID VCAPITYPE VirtualChannelInitEvent( LPVOID pInitHandle, UINT event, LPVOID pData, UINT dataLength)
{
...
}
On pEntryPoints->pVirtualChannelInit dll stucks, it doesn't return any error code, so I never get string "init" printed.
Debugger show that addresses in pEntryPoints are like that:
pVirtualChannelInit - 0x00000004
pVirtualChannelOpen - 0x0000ffff
pVirtualChannelClose - 0x000000b8
pVirtualChannelWrite - 0x00000000
if I go with Debugger, and do not just stop on pVirtualChannelInit, then I can see that VirtualChannelEntry called twice.
RDP session works after this. What am I doing wrong?