2005-08-12 18:04:51 +00:00
|
|
|
/*
|
|
|
|
* Shell DDE Handling
|
|
|
|
*
|
|
|
|
* Copyright 2004 Robert Shearman
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2007-10-10 22:39:44 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-08-12 18:04:51 +00:00
|
|
|
*/
|
|
|
|
|
2008-08-26 15:50:23 +00:00
|
|
|
#include <precomp.h>
|
2005-08-12 18:04:51 +00:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
|
|
|
|
|
|
|
/* String handles */
|
|
|
|
static HSZ hszProgmanTopic;
|
|
|
|
static HSZ hszProgmanService;
|
|
|
|
static HSZ hszAsterisk;
|
|
|
|
static HSZ hszShell;
|
|
|
|
static HSZ hszAppProperties;
|
|
|
|
static HSZ hszFolders;
|
|
|
|
/* DDE Instance ID */
|
|
|
|
static DWORD dwDDEInst;
|
|
|
|
|
|
|
|
|
2008-08-26 15:50:23 +00:00
|
|
|
static BOOL __inline Dde_OnConnect(HSZ hszTopic, HSZ hszService)
|
2005-08-12 18:04:51 +00:00
|
|
|
{
|
|
|
|
if ((hszTopic == hszProgmanTopic) && (hszService == hszProgmanService))
|
|
|
|
return TRUE;
|
|
|
|
if ((hszTopic == hszProgmanTopic) && (hszService == hszAppProperties))
|
|
|
|
return TRUE;
|
|
|
|
if ((hszTopic == hszShell) && (hszService == hszFolders))
|
|
|
|
return TRUE;
|
|
|
|
if ((hszTopic == hszShell) && (hszService == hszAppProperties))
|
|
|
|
return TRUE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-08-26 15:50:23 +00:00
|
|
|
static void __inline Dde_OnConnectConfirm(HCONV hconv, HSZ hszTopic, HSZ hszService)
|
2005-08-12 18:04:51 +00:00
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
|
|
|
|
2008-08-26 15:50:23 +00:00
|
|
|
static BOOL __inline Dde_OnWildConnect(HSZ hszTopic, HSZ hszService)
|
2005-08-12 18:04:51 +00:00
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-08-26 15:50:23 +00:00
|
|
|
static HDDEDATA __inline Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
|
2005-08-12 18:04:51 +00:00
|
|
|
HSZ hszItem)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-08-26 15:50:23 +00:00
|
|
|
static DWORD __inline Dde_OnExecute(HCONV hconv, HSZ hszTopic, HDDEDATA hdata)
|
2005-08-12 18:04:51 +00:00
|
|
|
{
|
|
|
|
BYTE * pszCommand;
|
|
|
|
|
|
|
|
pszCommand = DdeAccessData(hdata, NULL);
|
|
|
|
if (!pszCommand)
|
|
|
|
return DDE_FNOTPROCESSED;
|
|
|
|
|
|
|
|
FIXME("stub: %s\n", pszCommand);
|
|
|
|
|
|
|
|
DdeUnaccessData(hdata);
|
|
|
|
|
|
|
|
return DDE_FNOTPROCESSED;
|
|
|
|
}
|
|
|
|
|
2008-08-26 15:50:23 +00:00
|
|
|
static void __inline Dde_OnDisconnect(HCONV hconv)
|
2005-08-12 18:04:51 +00:00
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
static HDDEDATA CALLBACK DdeCallback(
|
2005-08-12 18:04:51 +00:00
|
|
|
UINT uType,
|
|
|
|
UINT uFmt,
|
|
|
|
HCONV hconv,
|
|
|
|
HSZ hsz1,
|
|
|
|
HSZ hsz2,
|
|
|
|
HDDEDATA hdata,
|
|
|
|
ULONG_PTR dwData1,
|
|
|
|
ULONG_PTR dwData2)
|
|
|
|
{
|
|
|
|
switch (uType)
|
|
|
|
{
|
|
|
|
case XTYP_CONNECT:
|
Sync to Wine-20050930:
Michael Jung <mjung@iss.tu-darmstadt.de>
- Don't clone pidlLast in SHBindToParent.
- Pass correct pointer to SHFree in case of failure in
UNIXFS_path_to_pidl.
- Return E_FAIL if we can't get the unix path in
IPersistFolder3::InitializeEx.
- Return E_NOAGGREGATION if non-NULL pUnkOuter is given to the
constructor.
Alexandre Julliard <julliard@winehq.org>
- We are no longer generating .spec.c files.
- Generate 16-bit spec files as assembly code too.
- Use a more portable scheme for storing the name of a critical
section.
- Removed unused debug channels.
- Specify 64-bit integers as double instead of long long in spec files
so that we get the correct number of arguments.
- We are no longer generating .dbg.c files.
Milko Krachounov <milko@3mhz.net>
- Bulgarian resources for mpr, msi, user, commdlg, oleaut32, shdocvw,
shell32, comctl32, msrle32, mshtml, winspool, wineps, serialui,
setupapi, wininet, regedit, uninstaller, notepad, winecfg and
winhelp.
Kevin Koltzau <kevin@plop.org>
- Fix warnings in 64bit.
Dmitry Timoshkov <dmitry@codeweavers.com>
- Stop using a not initialized variable szTemp in
_dbg_ILSimpleGetText, make _dbg_ILSimpleGetText return no value since
nobody is using it.
- Stop dereferencing a possible NULL in pdump since
_dbg_ILGetDataPointer can potentially return NULL (for instance for
root or desktop pidl).
- Make shdebugstr_guid use standard wine_dbg_sprintf instead of the
handmade solution.
- Translate file name from unix to ANSI encoding in
UnixFolder_IShellFolder2_GetDisplayNameOf.
- Pass a locally modified version of SHELLEXECUTEINFO to
IShellExecuteHookW_Execute, this should pass through at least
sei_tmp.nShow retrieved from an .lnk file (fStartup).
Alexander N. Sørnes <alex@thehandofagony.com>
- Added Norwegian translation of comctl32 and shell32.
Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
- Update Finnish resources.
svn path=/trunk/; revision=18348
2005-10-08 17:41:41 +00:00
|
|
|
return (HDDEDATA)(DWORD_PTR)Dde_OnConnect(hsz1, hsz2);
|
2005-08-12 18:04:51 +00:00
|
|
|
case XTYP_CONNECT_CONFIRM:
|
|
|
|
Dde_OnConnectConfirm(hconv, hsz1, hsz2);
|
|
|
|
return NULL;
|
|
|
|
case XTYP_WILDCONNECT:
|
Sync to Wine-20050930:
Michael Jung <mjung@iss.tu-darmstadt.de>
- Don't clone pidlLast in SHBindToParent.
- Pass correct pointer to SHFree in case of failure in
UNIXFS_path_to_pidl.
- Return E_FAIL if we can't get the unix path in
IPersistFolder3::InitializeEx.
- Return E_NOAGGREGATION if non-NULL pUnkOuter is given to the
constructor.
Alexandre Julliard <julliard@winehq.org>
- We are no longer generating .spec.c files.
- Generate 16-bit spec files as assembly code too.
- Use a more portable scheme for storing the name of a critical
section.
- Removed unused debug channels.
- Specify 64-bit integers as double instead of long long in spec files
so that we get the correct number of arguments.
- We are no longer generating .dbg.c files.
Milko Krachounov <milko@3mhz.net>
- Bulgarian resources for mpr, msi, user, commdlg, oleaut32, shdocvw,
shell32, comctl32, msrle32, mshtml, winspool, wineps, serialui,
setupapi, wininet, regedit, uninstaller, notepad, winecfg and
winhelp.
Kevin Koltzau <kevin@plop.org>
- Fix warnings in 64bit.
Dmitry Timoshkov <dmitry@codeweavers.com>
- Stop using a not initialized variable szTemp in
_dbg_ILSimpleGetText, make _dbg_ILSimpleGetText return no value since
nobody is using it.
- Stop dereferencing a possible NULL in pdump since
_dbg_ILGetDataPointer can potentially return NULL (for instance for
root or desktop pidl).
- Make shdebugstr_guid use standard wine_dbg_sprintf instead of the
handmade solution.
- Translate file name from unix to ANSI encoding in
UnixFolder_IShellFolder2_GetDisplayNameOf.
- Pass a locally modified version of SHELLEXECUTEINFO to
IShellExecuteHookW_Execute, this should pass through at least
sei_tmp.nShow retrieved from an .lnk file (fStartup).
Alexander N. Sørnes <alex@thehandofagony.com>
- Added Norwegian translation of comctl32 and shell32.
Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
- Update Finnish resources.
svn path=/trunk/; revision=18348
2005-10-08 17:41:41 +00:00
|
|
|
return (HDDEDATA)(DWORD_PTR)Dde_OnWildConnect(hsz1, hsz2);
|
2005-08-12 18:04:51 +00:00
|
|
|
case XTYP_REQUEST:
|
2009-11-15 23:19:33 +00:00
|
|
|
return Dde_OnRequest(uFmt, hconv, hsz1, hsz2);
|
2005-08-12 18:04:51 +00:00
|
|
|
case XTYP_EXECUTE:
|
Sync to Wine-20050930:
Michael Jung <mjung@iss.tu-darmstadt.de>
- Don't clone pidlLast in SHBindToParent.
- Pass correct pointer to SHFree in case of failure in
UNIXFS_path_to_pidl.
- Return E_FAIL if we can't get the unix path in
IPersistFolder3::InitializeEx.
- Return E_NOAGGREGATION if non-NULL pUnkOuter is given to the
constructor.
Alexandre Julliard <julliard@winehq.org>
- We are no longer generating .spec.c files.
- Generate 16-bit spec files as assembly code too.
- Use a more portable scheme for storing the name of a critical
section.
- Removed unused debug channels.
- Specify 64-bit integers as double instead of long long in spec files
so that we get the correct number of arguments.
- We are no longer generating .dbg.c files.
Milko Krachounov <milko@3mhz.net>
- Bulgarian resources for mpr, msi, user, commdlg, oleaut32, shdocvw,
shell32, comctl32, msrle32, mshtml, winspool, wineps, serialui,
setupapi, wininet, regedit, uninstaller, notepad, winecfg and
winhelp.
Kevin Koltzau <kevin@plop.org>
- Fix warnings in 64bit.
Dmitry Timoshkov <dmitry@codeweavers.com>
- Stop using a not initialized variable szTemp in
_dbg_ILSimpleGetText, make _dbg_ILSimpleGetText return no value since
nobody is using it.
- Stop dereferencing a possible NULL in pdump since
_dbg_ILGetDataPointer can potentially return NULL (for instance for
root or desktop pidl).
- Make shdebugstr_guid use standard wine_dbg_sprintf instead of the
handmade solution.
- Translate file name from unix to ANSI encoding in
UnixFolder_IShellFolder2_GetDisplayNameOf.
- Pass a locally modified version of SHELLEXECUTEINFO to
IShellExecuteHookW_Execute, this should pass through at least
sei_tmp.nShow retrieved from an .lnk file (fStartup).
Alexander N. Sørnes <alex@thehandofagony.com>
- Added Norwegian translation of comctl32 and shell32.
Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
- Update Finnish resources.
svn path=/trunk/; revision=18348
2005-10-08 17:41:41 +00:00
|
|
|
return (HDDEDATA)(DWORD_PTR)Dde_OnExecute(hconv, hsz1, hdata);
|
2005-08-12 18:04:51 +00:00
|
|
|
case XTYP_DISCONNECT:
|
|
|
|
Dde_OnDisconnect(hconv);
|
|
|
|
return NULL;
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* ShellDDEInit (SHELL32.@)
|
|
|
|
*
|
|
|
|
* Registers the Shell DDE services with the system so that applications
|
|
|
|
* can use them.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* bInit [I] TRUE to initialize the services, FALSE to uninitalize.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Nothing.
|
|
|
|
*/
|
|
|
|
void WINAPI ShellDDEInit(BOOL bInit)
|
|
|
|
{
|
|
|
|
TRACE("bInit = %s\n", bInit ? "TRUE" : "FALSE");
|
|
|
|
|
|
|
|
if (bInit)
|
|
|
|
{
|
|
|
|
static const WCHAR wszProgman[] = {'P','r','o','g','m','a','n',0};
|
|
|
|
static const WCHAR wszAsterisk[] = {'*',0};
|
|
|
|
static const WCHAR wszShell[] = {'S','h','e','l','l',0};
|
|
|
|
static const WCHAR wszAppProperties[] =
|
|
|
|
{'A','p','p','P','r','o','p','e','r','t','i','e','s',0};
|
|
|
|
static const WCHAR wszFolders[] = {'F','o','l','d','e','r','s',0};
|
|
|
|
|
|
|
|
DdeInitializeW(&dwDDEInst, DdeCallback, CBF_FAIL_ADVISES | CBF_FAIL_POKES, 0);
|
|
|
|
|
|
|
|
hszProgmanTopic = DdeCreateStringHandleW(dwDDEInst, wszProgman, CP_WINUNICODE);
|
|
|
|
hszProgmanService = DdeCreateStringHandleW(dwDDEInst, wszProgman, CP_WINUNICODE);
|
|
|
|
hszAsterisk = DdeCreateStringHandleW(dwDDEInst, wszAsterisk, CP_WINUNICODE);
|
|
|
|
hszShell = DdeCreateStringHandleW(dwDDEInst, wszShell, CP_WINUNICODE);
|
|
|
|
hszAppProperties = DdeCreateStringHandleW(dwDDEInst, wszAppProperties, CP_WINUNICODE);
|
|
|
|
hszFolders = DdeCreateStringHandleW(dwDDEInst, wszFolders, CP_WINUNICODE);
|
|
|
|
|
|
|
|
DdeNameService(dwDDEInst, hszFolders, 0, DNS_REGISTER);
|
|
|
|
DdeNameService(dwDDEInst, hszProgmanService, 0, DNS_REGISTER);
|
|
|
|
DdeNameService(dwDDEInst, hszShell, 0, DNS_REGISTER);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* unregister all services */
|
|
|
|
DdeNameService(dwDDEInst, 0, 0, DNS_UNREGISTER);
|
|
|
|
|
|
|
|
DdeFreeStringHandle(dwDDEInst, hszFolders);
|
|
|
|
DdeFreeStringHandle(dwDDEInst, hszAppProperties);
|
|
|
|
DdeFreeStringHandle(dwDDEInst, hszShell);
|
|
|
|
DdeFreeStringHandle(dwDDEInst, hszAsterisk);
|
|
|
|
DdeFreeStringHandle(dwDDEInst, hszProgmanService);
|
|
|
|
DdeFreeStringHandle(dwDDEInst, hszProgmanTopic);
|
|
|
|
|
|
|
|
DdeUninitialize(dwDDEInst);
|
|
|
|
}
|
|
|
|
}
|