UIAutomationCore Fix

Fix for UIAutomationCore.dll error on Linux with Streamer.bot v1.0.5 or later

JoacoSlime
Guide provided by JoacoSlime in the #linux-mac-os channel on Discord

The problem is caused by Wine's incomplete UIAutomationCore implementation; there are two ways to fix it:

You will need to get the UIAutomationCore.dll file from C:\Windows\System32\UIAutomationCore.dll

  • If you have dual boot or another computer with Windows 10 or 11 available:
    • You can simply copy the file from there to the prefix's drive_c/Windows/System32 see below
  • If the options above are not available, then you can download a clean Windows 10 ISO from Microsoft and use that:
    1. Download the ISO from here: https://www.microsoft.com/en-us/software-download/windows10ISO
    2. Either use the attached UIAC.sh script to extract the file (requires p7zip) OR do the following:
      1. Mount the Win 10 ISO and go to the sources folder inside OR extract install.wim using p7zip: 7z e ISO_PATH sources/install.wim
      2. Either mount the install.wim file using wimlib and copy the file from Windows/System32/UIAutomationCore.dll OR extract the file using p7zip 7z e install.wim 1/Windows/System32/UIAutomationCore.dll
      UIAC.sh
      #!/bin/bash
      # Saving the script directory
      DIR=$(pwd)
      
      # Changing to a temporal working directory
      cd "$(mktemp -d)" || echo Error changing to a temporal directory, \
              will use the script directory instead.
      
      # Verifing that we have a working environment
      
      if ! command -v 7z &>/dev/null; then
          echo Install the needed package: p7zip
          echo Fedora: sudo dnf install p7zip
          echo Debian/Ubuntu: sudo apt-get install p7zip-full
          exit 1
      fi
      
      # Asking for the ISO file
      echo Insert the path to the Windows ISO file:
      read -r ISO_PATH
      ISO_PATH=$(realpath "$ISO_PATH") # Solving path, just because
      echo
      
      echo Extracting install.wim...
      # Getting the install.wim from the ISO
      if ! 7z e "$ISO_PATH" sources/install.wim &>/dev/null; then
          echo An error ocurred extracting the Windows installation file.
          exit 1
      fi
      echo
      
      echo Extracting UIAutomationCore.dll...
      # Get the UIAutomationCore.dll from the .wim
      if ! 7z e install.wim 1/Windows/System32/UIAutomationCore.dll &>/dev/null; then
          echo An error ocurred extracting UIAutomationCore.dll from the installation file.
          exit 1
      fi
      echo
      
      # Move the file where the script is called from and clean the directory
      mv UIAutomationCore.dll "$DIR/UIAutomationCore.dll"
      rm install.wim
      
      echo "Done! UIAutomationCore.dll was extracted and moved to $DIR/UIAutomationCore.dll"
      

Depending on how you installed Streamer.Bot, the location of where you have to place the obtained file varies:

The install script creates a prefix in ~/.local/lib/streamer.bot/pfx, so you have to place the file in:

~/.local/lib/streamer.bot/pfx/drive_c/windows/system32

This method might cause audio and/or performance problems since we won't be using Proton fixes.
For both Lutris and Bottles, you have to manage and install other runners than the default if you haven't already.

Depending on how you installed Streamer.Bot, the way of changing the wine version used is different:

Check that your wine version is 11.9 (staging) or newer (use wine --version), if it's not, then you'll have to update wine.

Use your distribution's way of doing that or follow winehq guide to add their repos.