How to pass multiple files to shell context menu command (Windows Explorer)

You can archive it with my program called singleinstance (sourcecode).
No shell extensions involved.

The main idea is that one instance of my program will be launched per file you have selected. It is checking if another instance of singleinstance program is running, and using Inter-Process Communication to notify the existing instance that other files have been selected.

Do not forget to set option MultiSelectModel=Player, otherwise number of files will be limited.

Usage:

Usage: singleinstance.exe "%1" {command} $files [arguments]

Optional arguments for singleinstance (not passed to command):

--si-timeout {time to wait in msecs}

Sample registry file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\SystemFileAssociations\.txt\Shell\p4merge]
"MultiSelectModel"="Player"

[HKEY_CLASSES_ROOT\SystemFileAssociations\.txt\Shell\p4merge\Command]
@="\"d:\\singleinstance.exe\" %1 \"C:\\Program Files\\Perforce\\p4merge.exe\" $files --si-timeout 400"

Deploying Windows applications on Linux(Wine) with 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;
begin
  LibHandle := LoadLibraryA('ntdll.dll');
  Result:= GetProcAddress(LibHandle, 'wine_get_version')<> 0;
end;

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);
begin
 if  CurStep=ssPostInstall and IsWine   then
  begin
     filecopy(expandconstant('{tmp}\gdiplus.dll'),expandconstant('{app}\gdiplus.dll'),false);

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

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.