Unconditionally fall back to ANSI DDE APIs in ShellExecute if
current emulated Windows version is Win9x
Dmitry Timoshkov
dmitry at baikal.ru
Fri Nov 11 02:29:02 CST 2005
Hello,
one of the Crossover winelib applications uses unicode version of
ShellExecuteEx to launch applications associated with a particular
file type. But this doesn't work for .xls files because Excel simply
refuses to communicate by DDE in win9x mode if IsWindowUnicode returns
TRUE for a client window. My previous attempt to fix a similar problem
introduced a unicode flag to indicate what type of ShellExecute API
(A or W) called into a backend. But this obviously doesn't work for
W version of the API.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Unconditionally fall back to ANSI DDE APIs in ShellExecute if current
emulated Windows version is Win9x, Excel refuses to communicate with
a unicode client in win9x mode.
diff -up cvs/hq/wine/dlls/shell32/shell32_main.h wine/dlls/shell32/shell32_main.h
--- cvs/hq/wine/dlls/shell32/shell32_main.h 2005-10-20 16:39:05.000000000 +0900
+++ wine/dlls/shell32/shell32_main.h 2005-11-11 16:14:02.000000000 +0800
@@ -217,7 +217,7 @@ inline static WCHAR * __SHCloneStrAtoW(W
typedef UINT_PTR (*SHELL_ExecuteW32)(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
LPSHELLEXECUTEINFOW sei, LPSHELLEXECUTEINFOW sei_out);
-BOOL SHELL_execute(LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc, BOOL unicode);
+BOOL SHELL_execute(LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc);
UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpOperation,
LPWSTR lpResult, int resultLen, LPWSTR key, WCHAR **env, LPITEMIDLIST pidl, LPCWSTR args);
diff -up cvs/hq/wine/dlls/shell32/shell.c wine/dlls/shell32/shell.c
--- cvs/hq/wine/dlls/shell32/shell.c 2005-10-20 16:39:05.000000000 +0900
+++ wine/dlls/shell32/shell.c 2005-11-11 16:14:02.000000000 +0800
@@ -625,7 +625,7 @@ HINSTANCE16 WINAPI ShellExecute16( HWND1
seiW.dwHotKey = 0;
seiW.hProcess = hProcess;
- SHELL_execute( &seiW, SHELL_Execute16, FALSE );
+ SHELL_execute( &seiW, SHELL_Execute16 );
if (wVerb) SHFree(wVerb);
if (wFile) SHFree(wFile);
diff -up cvs/hq/wine/dlls/shell32/shlexec.c wine/dlls/shell32/shlexec.c
--- cvs/hq/wine/dlls/shell32/shlexec.c 2005-11-03 22:16:09.000000000 +0800
+++ wine/dlls/shell32/shlexec.c 2005-11-11 16:16:03.000000000 +0800
@@ -708,8 +708,7 @@ static HDDEDATA CALLBACK dde_cb(UINT uTy
static unsigned dde_connect(WCHAR* key, WCHAR* start, WCHAR* ddeexec,
const WCHAR* lpFile, WCHAR *env,
LPCWSTR szCommandline, LPITEMIDLIST pidl, SHELL_ExecuteW32 execfunc,
- LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out,
- BOOL unicode)
+ LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out)
{
static const WCHAR wApplication[] = {'\\','a','p','p','l','i','c','a','t','i','o','n',0};
static const WCHAR wTopic[] = {'\\','t','o','p','i','c',0};
@@ -723,6 +722,7 @@ static unsigned dde_connect(WCHAR* key,
HCONV hConv;
HDDEDATA hDdeData;
unsigned ret = 31;
+ BOOL unicode = !(GetVersion() & 0x80000000);
strcpyW(endkey, wApplication);
applen = sizeof(app);
@@ -819,8 +819,7 @@ static unsigned dde_connect(WCHAR* key,
*/
static UINT_PTR execute_from_key(LPWSTR key, LPCWSTR lpFile, WCHAR *env, LPCWSTR szCommandline,
SHELL_ExecuteW32 execfunc,
- LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out,
- BOOL unicode)
+ LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out)
{
WCHAR cmd[1024];
LONG cmdlen = sizeof(cmd);
@@ -848,7 +847,7 @@ static UINT_PTR execute_from_key(LPWSTR
if (RegQueryValueW(HKEY_CLASSES_ROOT, key, param, ¶mlen) == ERROR_SUCCESS)
{
TRACE("Got ddeexec %s => %s\n", debugstr_w(key), debugstr_w(param));
- retval = dde_connect(key, cmd, param, lpFile, env, szCommandline, psei->lpIDList, execfunc, psei, psei_out, unicode);
+ retval = dde_connect(key, cmd, param, lpFile, env, szCommandline, psei->lpIDList, execfunc, psei, psei_out);
}
else
{
@@ -1178,7 +1177,7 @@ static LONG ShellExecute_FromContextMenu
/*************************************************************************
* SHELL_execute [Internal]
*/
-BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc, BOOL unicode )
+BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
{
static const WCHAR wQuote[] = {'"',0};
static const WCHAR wSpace[] = {' ',0};
@@ -1438,7 +1437,7 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW
}
TRACE("%s/%s => %s/%s\n", debugstr_w(wszApplicationName), debugstr_w(sei_tmp.lpVerb), debugstr_w(wszQuotedCmd), debugstr_w(lpstrProtocol));
if (*lpstrProtocol)
- retval = execute_from_key(lpstrProtocol, wszApplicationName, env, sei_tmp.lpParameters, execfunc, &sei_tmp, sei, unicode);
+ retval = execute_from_key(lpstrProtocol, wszApplicationName, env, sei_tmp.lpParameters, execfunc, &sei_tmp, sei);
else
retval = execfunc(wszQuotedCmd, env, FALSE, &sei_tmp, sei);
HeapFree( GetProcessHeap(), 0, env );
@@ -1471,7 +1470,7 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW
lpFile += iSize;
while (*lpFile == ':') lpFile++;
}
- retval = execute_from_key(lpstrProtocol, lpFile, NULL, sei_tmp.lpParameters, execfunc, &sei_tmp, sei, unicode);
+ retval = execute_from_key(lpstrProtocol, lpFile, NULL, sei_tmp.lpParameters, execfunc, &sei_tmp, sei);
}
/* Check if file specified is in the form www.??????.*** */
else if (!strncmpiW(lpFile, wWww, 3))
@@ -1556,7 +1555,7 @@ BOOL WINAPI ShellExecuteExA (LPSHELLEXEC
else
seiW.lpClass = NULL;
- ret = SHELL_execute( &seiW, SHELL_ExecuteW, FALSE );
+ ret = SHELL_execute( &seiW, SHELL_ExecuteW );
sei->hInstApp = seiW.hInstApp;
@@ -1578,7 +1577,7 @@ BOOL WINAPI ShellExecuteExA (LPSHELLEXEC
*/
BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
{
- return SHELL_execute( sei, SHELL_ExecuteW, TRUE );
+ return SHELL_execute( sei, SHELL_ExecuteW );
}
/*************************************************************************
@@ -1607,6 +1606,6 @@ HINSTANCE WINAPI ShellExecuteW(HWND hwnd
sei.dwHotKey = 0;
sei.hProcess = 0;
- SHELL_execute( &sei, SHELL_ExecuteW, TRUE );
+ SHELL_execute( &sei, SHELL_ExecuteW );
return sei.hInstApp;
}
More information about the wine-patches
mailing list