4 * Copyright 2004 Robert Shearman
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
33 static HSZ hszProgmanTopic
;
34 static HSZ hszProgmanService
;
35 static HSZ hszAsterisk
;
37 static HSZ hszAppProperties
;
38 static HSZ hszFolders
;
40 static DWORD dwDDEInst
;
43 static inline BOOL
Dde_OnConnect(HSZ hszTopic
, HSZ hszService
)
45 if ((hszTopic
== hszProgmanTopic
) && (hszService
== hszProgmanService
))
47 if ((hszTopic
== hszProgmanTopic
) && (hszService
== hszAppProperties
))
49 if ((hszTopic
== hszShell
) && (hszService
== hszFolders
))
51 if ((hszTopic
== hszShell
) && (hszService
== hszAppProperties
))
56 static inline void Dde_OnConnectConfirm(HCONV hconv
, HSZ hszTopic
, HSZ hszService
)
61 static inline BOOL
Dde_OnWildConnect(HSZ hszTopic
, HSZ hszService
)
67 static inline HDDEDATA
Dde_OnRequest(UINT uFmt
, HCONV hconv
, HSZ hszTopic
,
74 static inline DWORD
Dde_OnExecute(HCONV hconv
, HSZ hszTopic
, HDDEDATA hdata
)
78 pszCommand
= DdeAccessData(hdata
, NULL
);
80 return DDE_FNOTPROCESSED
;
82 FIXME("stub: %s\n", pszCommand
);
84 DdeUnaccessData(hdata
);
86 return DDE_FNOTPROCESSED
;
89 static inline void Dde_OnDisconnect(HCONV hconv
)
94 static HDDEDATA CALLBACK
DdeCallback(
107 return (HDDEDATA
)(DWORD_PTR
)Dde_OnConnect(hsz1
, hsz2
);
108 case XTYP_CONNECT_CONFIRM
:
109 Dde_OnConnectConfirm(hconv
, hsz1
, hsz2
);
111 case XTYP_WILDCONNECT
:
112 return (HDDEDATA
)(DWORD_PTR
)Dde_OnWildConnect(hsz1
, hsz2
);
114 return Dde_OnRequest(uFmt
, hconv
, hsz1
, hsz2
);
116 return (HDDEDATA
)(DWORD_PTR
)Dde_OnExecute(hconv
, hsz1
, hdata
);
117 case XTYP_DISCONNECT
:
118 Dde_OnDisconnect(hconv
);
125 /*************************************************************************
126 * ShellDDEInit (SHELL32.@)
128 * Registers the Shell DDE services with the system so that applications
132 * bInit [I] TRUE to initialize the services, FALSE to uninitalize.
137 void WINAPI
ShellDDEInit(BOOL bInit
)
139 TRACE("bInit = %s\n", bInit
? "TRUE" : "FALSE");
143 static const WCHAR wszProgman
[] = {'P','r','o','g','m','a','n',0};
144 static const WCHAR wszAsterisk
[] = {'*',0};
145 static const WCHAR wszShell
[] = {'S','h','e','l','l',0};
146 static const WCHAR wszAppProperties
[] =
147 {'A','p','p','P','r','o','p','e','r','t','i','e','s',0};
148 static const WCHAR wszFolders
[] = {'F','o','l','d','e','r','s',0};
150 DdeInitializeW(&dwDDEInst
, DdeCallback
, CBF_FAIL_ADVISES
| CBF_FAIL_POKES
, 0);
152 hszProgmanTopic
= DdeCreateStringHandleW(dwDDEInst
, wszProgman
, CP_WINUNICODE
);
153 hszProgmanService
= DdeCreateStringHandleW(dwDDEInst
, wszProgman
, CP_WINUNICODE
);
154 hszAsterisk
= DdeCreateStringHandleW(dwDDEInst
, wszAsterisk
, CP_WINUNICODE
);
155 hszShell
= DdeCreateStringHandleW(dwDDEInst
, wszShell
, CP_WINUNICODE
);
156 hszAppProperties
= DdeCreateStringHandleW(dwDDEInst
, wszAppProperties
, CP_WINUNICODE
);
157 hszFolders
= DdeCreateStringHandleW(dwDDEInst
, wszFolders
, CP_WINUNICODE
);
159 DdeNameService(dwDDEInst
, hszFolders
, 0, DNS_REGISTER
);
160 DdeNameService(dwDDEInst
, hszProgmanService
, 0, DNS_REGISTER
);
161 DdeNameService(dwDDEInst
, hszShell
, 0, DNS_REGISTER
);
165 /* unregister all services */
166 DdeNameService(dwDDEInst
, 0, 0, DNS_UNREGISTER
);
168 DdeFreeStringHandle(dwDDEInst
, hszFolders
);
169 DdeFreeStringHandle(dwDDEInst
, hszAppProperties
);
170 DdeFreeStringHandle(dwDDEInst
, hszShell
);
171 DdeFreeStringHandle(dwDDEInst
, hszAsterisk
);
172 DdeFreeStringHandle(dwDDEInst
, hszProgmanService
);
173 DdeFreeStringHandle(dwDDEInst
, hszProgmanTopic
);
175 DdeUninitialize(dwDDEInst
);