u/No_Addendum4340

Automating legacy Windows app on a headless Ubuntu server. Is Wine/Xvfb the right choice?

Hi, all. I'm working on automating a legacy Windows desktop application (built on an old Gupta SQLWindows framework) on a headless Ubuntu server. I finally got it working after repeatedly fixing dependencies, which has me questioning if this is the right approach.

I want to know if headless GUI automation via Wine is a standard industry pattern for this scenario, or if there is a better approach I overlooked?

Some more context:

Because of our infrastructure bias, the pipeline must run on Linux servers. To do this headlessly, I built out:

  • Ubuntu Server running Xvfb to handle the graphical rendering layer
  • 32-bit Wine prefix running an isolated, embedded Windows Python 3.10 instance
  • Dropped down to raw Win32 API hooks

Initially, I tried using modern Python libraries like pywinauto and pandas for handling extracted data manipulation but this created more errors.

  • I ran into UCRT crashes due to missing math hooks inside Wine. I had to take out pandas/numpy entirely and rewrite my script using the native Python csv module
  • since Xvfb is an invisible memory display layer, traditional background macrotriggers threw COM errors because they can't grab physical system foreground focus. I had to switch to scan-code injection to bypass window focus constraints
  • headless winetricks installers panic without a visual display engine, meaning I had to manually use cabextract to rip old Visual C++ components (mfc42.dll) out of Microsoft cabinet setup caches and register them by hand.

For those who've had to host legacy, closed-source Windows desktop apps on Linux infra, is wine+xvfb+win32 hardware sim the standard procedure?

Are there any better approaches? Assuming a rewrite of the source app and commercial RPA's (not enough use cases) are off the table what else can I do? ie: docker on windows server nodes?
Is there an open-source toolchain better suited for headless Windows-on-Linux UI interaction than raw Win32 API calls via Python

reddit.com
u/No_Addendum4340 — 2 days ago