Распространение Windows приложений в Linux (Wine) при помощи InnoSetup

First, we need to detect Wine in the InnoSetup script.

function LoadLibraryA(lpLibFileName: PAnsiChar): THandle;
external 'LoadLibraryA@kernel32.dll stdcall';
function GetProcAddress(Module: THandle; ProcName: PAnsiChar): Longword;
external 'GetProcAddress@kernel32.dll stdcall';

function IsWine: boolean;
var  LibHandle  : THandle;
  LibHandle := LoadLibraryA('ntdll.dll');
  Result:= GetProcAddress(LibHandle, 'wine_get_version')<> 0;

The IsWine function returns true, if the installer is launched under Wine. My application (Image Uploader) is extensively using Microsoft Gdi+ library, but Wine's implementation of this library is incomplete, so I had no other choice but to install the native version of gdiplus.dll. The important thing is to tell Wine to use the native library instead of the built-in one, it can be achieved by writing a setting to the Wine's registry.

procedure CurStepChanged(CurStep: TSetupStep);
 if  CurStep=ssPostInstall and IsWine   then

     RegWriteStringValue(HKEY_CURRENT_USER, 'Software\Wine\DllOverrides',
    'gdiplus', 'native, builtin');

There are some other issues when Image Uploader is running in Wine, for example, Wine is ignoring WM_CTLCOLORSTATIC message's result, also Richedit's EM_FORMATRANGE is not working. But I hope I'll find a workaround for these issues too.