How to Disable Citrix API Hooks on a Per-application Basis

Table of Contents

Case #

There may be cases where your users complain about Citrix hosted application instability, performance degradation (high process CPU usage) and occasional application crashes (seamless apps or apps hosted inside a Citrix desktop). In these cases it is possible that the Citrix API hooks are interfering with application operations.

A very good explanation of the Citrix hooking mechanism can be found in the following Helge Klein article: https://helgeklein.com/blog/2015/10/citrix-xenappxendesktop-api-hooking-explained/.

Solution #

First check all Citrix VDA server system and application event logs as well as any other logs specific to the problematic applications. It is possible that the root cause of the crashes is related to the application itself, so check all relevant application software vendor knowledge bases as well.

If there no conclusive finding specific to the problematic application it is very possible that the app crashes or instability is due to Citrix Hooking. The instructions below are for disabling Citrix API hooks on a per application basis in Xenapp and XenDesktop version 7.9 and newer.

XenDesktop/XenApp 7.9 and later utilizes Kernel APC Hooking as a replacement of AppInit_DLLs used in previous versions of the products. You can completely disable all Citrix Hooking (including MfApHook.dll and MfApHook64.dll) on XenDesktop/XenApp 7.9 and later for specific applications by creating the following registry value:

Key: HKLM\SYSTEM\CurrentControlSet\services\CtxUvi
Value Name: UviProcessExcludes
Type: REG_SZ
Value: badapp1.exe;badlongname.ex;badapp2.exe

You must reboot the VDA to have the changes take effect. There is a 14 character limit on the process names - this means to exclude an application named “badlongname.exe” you would add “badlongname.ex”. The UviProcessExcludes key does not support wild cards. The registry will already exist on XenDesktop/XenApp 7.14.1 and newer VDAs so additional applications can be appended with a semicolon delimiter.

Example #

If the new Chrome-based Microsoft Edge consumes 100% CPU, then CTP James Kindon Deploying Brave and Microsoft Edge Dev Browsers in Citrix CVAD environments suggests disabling Citrix hooking for the MS Edge and Chrome processes as shown below.

  • Key = HKLM\SYSTEM\CurrentControlSet\services\CtxUvi
    • Value (String) = UviProcessExcludes = chrome.exe;msedge.exe;

You can add further problematic apps and processes in the above registry key if you are experiencing similar issues inside Citrix. A known case which is resolved by disabling Citrix hooks is related to Microsoft Office activation errors in Citrix VDA servers and is explained at https://support.citrix.com/article/CTX223973.

In some cases the above process might not work. In these cases follow instructions at: https://support.citrix.com/article/CTX216907.

You can find more detailed guidance and step-by-step procedures for analyzing and troubleshooting Citrix Virtual Apps and Desktops organized by category in my Citrix Virtual Apps and Desktops Troubleshooting e-book.

Source #

https://support.citrix.com/article/CTX107825

Powered by BetterDocs