How To Tell If Your Windows Application Is Running Inside VMWare

I recently had a case come up related to OpenGL where I needed to know programmatically if my application was running within VMWare Fusion.

VMWare Fusion Logo

VMWare Fusion

It took me a while to understand and piece together a solution, but here is one based on the half-psuedo-code from VMWare’s site.

(Note: Q_OS_WIN is a Qt framework define. Use whatever you use to conditionally compile Windows-only code.)

I didn’t need the extra checks for testing the virtual BIOS DMI information and hypervisor port outlined in that VMWare page, so I didn’t try to implement them.

Hope this helps someone!