Saturday, January 19, 2019

2.0 Working with Citrix Virtual Channel SDK

Writing this blog to consolidate the steps involved to build Citrix virtual channel client side and server side components.

Software requirements :  Citrix Virtual channel sdk, WFAPI sdk, Visual Studio.

Install Citrix virtual channel SDK and WFAPI  sdk in your machine. Please go through the documentation that comes with Citrix sdk before proceeding with these steps, you may not need this blog at all :).. I faced a lot of challenges so decided to sum up the steps at one place and hence this blog. Virtual channel sdk comes with some pretty good examples, build one of the example using the steps mentioned in this blog. I used VS 2015 but other version will also be file. WFAPI  sdk is required to build the server side component of the example.  

Building Server side program using VS: Server side project will give an executable (.exe) file.

1. Create a new project in Visual Studio under "Visual C++" > "Empty project". Its better to follow the naming convention as suggested in documentation, append word ctx to the example name. Click Ok and this will create a blank template project.

2. Add the example source file(.c file) as an existing item into Source files folder of VS. 

3. Add paths of all the required header files in Project Properties > C/C++> General>Additional Include Directories section. 

4. To get rid of unsafe function or variable error, add _CRT_SECURE_NO_WARNINGS to Project Properties > C/C++> Preprocessor> Preprocessor Definitions section.

5. Add wfapi.lib as dependency in Project Properties > Linker>Input>Additional Dependencies section.


Building Client side program using VS: Unlike server side client side component  is a DLL file, which is a virtual driver for the application. 

1. Create a new project in Visual Studio under "Visual C++" > "Empty project". Its better to follow the naming convention as suggested in documentation, append word vd to the example name. Click Ok and this will create a blank template project. 

2. Change configuration type to Dynamic Library (.dll) under Project Properties >General> Configuration Type.

3. Add the example source file(.c file) as an existing item into Source files folder of VS. 

4. Add paths of all the required header files in Project Properties > C/C++> General>Additional Include Directories section.

5. Add vdapi.lib, clibdll.lib as dependency in Project Properties > Linker>Input>Additional Dependencies section.

6. Modify the function destinations of source file methods by adding __stdcall calling convention. Also modify calling convention of VdCallWd function in vd.h file by adding __stdcall.

7. In Source files folder of VS add new item Module-Definition File (.def) and add the below lines of code:
LIBRARY DLL_NAME
EXPORTS
     Load     @1

8. To deploy virtual driver dll add the below entries to host files.

Under the HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA
Client\Engine\Configuration\Advanced\Modules key, create a new <driver> key.
Add the following string REG_SZ values under the above key:
DriverName  =  DLL_NAME.dll
DriverNameWin16 = DLL_NAME.dll
DriverNameWin32 = DLL_NAME.dll

HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA
Client\Engine\Configuration\Advanced\Modules\ICA3.0 key. Append the name of the virtual
driver (<driver> created above) to the end of this line.


















No comments:

Post a Comment