Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendde_private.h
Go to the documentation of this file.
00001 /* 00002 * DDEML library 00003 * 00004 * Copyright 1997 Alexandre Julliard 00005 * Copyright 1997 Len White 00006 * Copyright 1999 Keith Matthews 00007 * Copyright 2000 Corel 00008 * Copyright 2001 Eric Pouech 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 00025 #ifndef __WINE_DDEML_PRIVATE_H 00026 #define __WINE_DDEML_PRIVATE_H 00027 00028 /* defined in atom.c file. 00029 */ 00030 #define MAX_ATOM_LEN 255 00031 00032 /* Maximum buffer size ( including the '\0' ). 00033 */ 00034 #define MAX_BUFFER_LEN (MAX_ATOM_LEN + 1) 00035 00036 /* The internal structures (prefixed by WDML) are used as follows: 00037 * + a WDML_INSTANCE is created for each instance creation (DdeInitialize) 00038 * - a popup window (InstanceClass) is created for each instance. 00039 * - this window is used to receive all the DDEML events (server registration, 00040 * conversation confirmation...). See the WM_WDML_???? messages for details 00041 * + when registering a server (DdeNameService) a WDML_SERVER is created 00042 * - a popup window (ServerNameClass) is created 00043 * + a conversation is represented by two WDML_CONV structures: 00044 * - one on the client side, the other one on the server side 00045 * - this is needed because the address spaces may be different 00046 * - therefore, two lists of links are kept for each instance 00047 * - two windows are created for a conversation: 00048 * o a popup window on client side (ClientConvClass) 00049 * o a child window (of the ServerName) on the server side 00050 * (ServerConvClass) 00051 * - all the exchanges then take place between those two windows 00052 * - windows for the conversation exist in two forms (Ansi & Unicode). This 00053 * is only needed when a partner in a conv is not handled by DDEML. The 00054 * type (A/W) of the window is used to handle the ansi <=> unicode 00055 * transformations 00056 * - two handles are created for a conversation (on each side). Each handle 00057 * is linked to a structure. To help differentiate those handles, the 00058 * local one has an even value, whereas the remote one has an odd value. 00059 * + a (warm or link) is represented by two WDML_LINK structures: 00060 * - one on client side, the other one on server side 00061 * - therefore, two lists of links are kept for each instance 00062 * 00063 * To help getting back to data, WDML windows store information: 00064 * - offset 0: the DDE instance 00065 * - offset 4: the current conversation (for ClientConv and ServerConv only) 00066 * 00067 * All the implementation (client & server) makes the assumption that the other side 00068 * is not always a DDEML partner. However, if it's the case, supplementary services 00069 * are available (most notably the REGISTER/UNREGISTER and CONNECT_CONFIRM messages 00070 * to the callback function). To be correct in every situation, all the basic 00071 * exchanges are made using the 'pure' DDE protocol. A (future !) enhancement would 00072 * be to provide a new protocol in the case were both partners are handled by DDEML. 00073 * 00074 * The StringHandles are in fact stored as local atoms. So an HSZ and a (local) atom 00075 * can be used interchangably. However, in order to keep track of the allocated HSZ, 00076 * and to free them upon instance termination, all HSZ are stored in a link list. 00077 * When the HSZ need to be passed thru DDE messages, we need to convert them back and 00078 * forth to global atoms. 00079 */ 00080 00081 /* this struct has the same mapping as all the DDE??? structures */ 00082 typedef struct { 00083 unsigned short unused:12, 00084 fResponse:1, 00085 fRelease:1, 00086 fDeferUpd:1, 00087 fAckReq:1; 00088 short cfFormat; 00089 } WINE_DDEHEAD; 00090 00091 typedef struct tagHSZNode 00092 { 00093 struct tagHSZNode* next; 00094 HSZ hsz; 00095 unsigned refCount; 00096 } HSZNode; 00097 00098 typedef struct tagWDML_SERVER 00099 { 00100 struct tagWDML_SERVER* next; 00101 HSZ hszService; 00102 HSZ hszServiceSpec; 00103 ATOM atomService; 00104 ATOM atomServiceSpec; 00105 BOOL filterOn; 00106 HWND hwndServer; 00107 } WDML_SERVER; 00108 00109 typedef struct tagWDML_XACT { 00110 struct tagWDML_XACT* next; /* list of transactions in conversation */ 00111 DWORD xActID; 00112 UINT ddeMsg; 00113 HDDEDATA hDdeData; 00114 DWORD dwTimeout; 00115 DWORD hUser; 00116 UINT wType; 00117 UINT wFmt; 00118 HSZ hszItem; 00119 ATOM atom; /* as converted from or to hszItem */ 00120 HGLOBAL hMem; 00121 LPARAM lParam; /* useful for reusing */ 00122 } WDML_XACT; 00123 00124 typedef struct tagWDML_CONV 00125 { 00126 struct tagWDML_CONV* next; /* to link all the conversations */ 00127 struct tagWDML_INSTANCE* instance; 00128 HSZ hszService; /* pmt used for connection */ 00129 HSZ hszTopic; /* pmt used for connection */ 00130 UINT magic; /* magic number to check validity */ 00131 UINT afCmd; /* service name flag */ 00132 CONVCONTEXT convContext; 00133 HWND hwndClient; /* source of conversation (ClientConvClass) */ 00134 HWND hwndServer; /* destination of conversation (ServerConvClass) */ 00135 WDML_XACT* transactions; /* pending transactions */ 00136 DWORD hUser; /* user defined value */ 00137 DWORD wStatus; /* same bits as convinfo.wStatus */ 00138 DWORD wConvst; /* same values as convinfo.wConvst */ 00139 } WDML_CONV; 00140 00141 #define WDML_CONV_MAGIC 0xbabe1234 00142 00143 /* DDE_LINK struct defines hot, warm, and cold links */ 00144 typedef struct tagWDML_LINK { 00145 struct tagWDML_LINK* next; /* to link all the active links */ 00146 HCONV hConv; /* to get back to the converstaion */ 00147 UINT transactionType;/* 0 for no link */ 00148 HSZ hszItem; /* item targetted for (hot/warm) link */ 00149 UINT uFmt; /* format for data */ 00150 } WDML_LINK; 00151 00152 typedef struct tagWDML_INSTANCE 00153 { 00154 struct tagWDML_INSTANCE* next; 00155 DWORD instanceID; /* needed to track monitor usage */ 00156 DWORD threadID; /* needed to keep instance linked to a unique thread */ 00157 BOOL monitor; /* have these two as full Booleans cos they'll be tested frequently */ 00158 BOOL clientOnly; /* bit wasteful of space but it will be faster */ 00159 BOOL unicode; /* Flag to indicate Win32 API used to initialise */ 00160 HSZNode* nodeList; /* for cleaning upon exit */ 00161 PFNCALLBACK callback; 00162 DWORD CBFflags; 00163 DWORD monitorFlags; 00164 DWORD lastError; 00165 HWND hwndEvent; 00166 DWORD wStatus; /* global instance status */ 00167 WDML_SERVER* servers; /* list of registered servers */ 00168 WDML_CONV* convs[2]; /* active conversations for this instance (client and server) */ 00169 WDML_LINK* links[2]; /* active links for this instance (client and server) */ 00170 } WDML_INSTANCE; 00171 00172 extern CRITICAL_SECTION WDML_CritSect; /* protection for instance list */ 00173 00174 /* header for the DDE Data objects */ 00175 typedef struct tagDDE_DATAHANDLE_HEAD 00176 { 00177 WORD cfFormat; 00178 WORD bAppOwned; 00179 } DDE_DATAHANDLE_HEAD; 00180 00181 typedef enum tagWDML_SIDE 00182 { 00183 WDML_CLIENT_SIDE = 0, WDML_SERVER_SIDE = 1 00184 } WDML_SIDE; 00185 00186 typedef enum { 00187 WDML_QS_ERROR, WDML_QS_HANDLED, WDML_QS_PASS, WDML_QS_SWALLOWED, WDML_QS_BLOCK, 00188 } WDML_QUEUE_STATE; 00189 00190 extern HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInst, UINT uType, UINT uFmt, HCONV hConv, 00191 HSZ hsz1, HSZ hsz2, HDDEDATA hdata, 00192 ULONG_PTR dwData1, ULONG_PTR dwData2); 00193 extern WDML_SERVER* WDML_AddServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic); 00194 extern void WDML_RemoveServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic); 00195 extern WDML_SERVER* WDML_FindServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic); 00196 /* transaction handler on the server side */ 00197 extern WDML_QUEUE_STATE WDML_ServerHandle(WDML_CONV* pConv, WDML_XACT* pXAct); 00198 /* transaction handler on the client side */ 00199 HDDEDATA WDML_ClientHandle(WDML_CONV *pConv, WDML_XACT *pXAct, DWORD dwTimeout, LPDWORD pdwResult) DECLSPEC_HIDDEN; 00200 /* called both in DdeClientTransaction and server side. */ 00201 extern UINT WDML_Initialize(LPDWORD pidInst, PFNCALLBACK pfnCallback, 00202 DWORD afCmd, DWORD ulRes, BOOL bUnicode); 00203 extern WDML_CONV* WDML_AddConv(WDML_INSTANCE* pInstance, WDML_SIDE side, 00204 HSZ hszService, HSZ hszTopic, HWND hwndClient, HWND hwndServer); 00205 extern void WDML_RemoveConv(WDML_CONV* pConv, WDML_SIDE side); 00206 extern WDML_CONV* WDML_GetConv(HCONV hConv, BOOL checkConnected); 00207 extern WDML_CONV* WDML_GetConvFromWnd(HWND hWnd); 00208 extern WDML_CONV* WDML_FindConv(WDML_INSTANCE* pInstance, WDML_SIDE side, 00209 HSZ hszService, HSZ hszTopic); 00210 extern BOOL WDML_PostAck(WDML_CONV* pConv, WDML_SIDE side, WORD appRetCode, 00211 BOOL fBusy, BOOL fAck, UINT_PTR pmt, LPARAM lParam, UINT oldMsg); 00212 extern void WDML_AddLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side, 00213 UINT wType, HSZ hszItem, UINT wFmt); 00214 extern WDML_LINK* WDML_FindLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side, 00215 HSZ hszItem, BOOL use_fmt, UINT uFmt); 00216 extern void WDML_RemoveLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side, 00217 HSZ hszItem, UINT wFmt); 00218 extern void WDML_RemoveAllLinks(WDML_INSTANCE* pInstance, WDML_CONV* pConv, WDML_SIDE side); 00219 /* string internals */ 00220 extern void WDML_FreeAllHSZ(WDML_INSTANCE* pInstance); 00221 extern BOOL WDML_DecHSZ(WDML_INSTANCE* pInstance, HSZ hsz); 00222 extern BOOL WDML_IncHSZ(WDML_INSTANCE* pInstance, HSZ hsz); 00223 extern ATOM WDML_MakeAtomFromHsz(HSZ hsz); 00224 extern HSZ WDML_MakeHszFromAtom(const WDML_INSTANCE* pInstance, ATOM atom); 00225 /* client calls these */ 00226 extern WDML_XACT* WDML_AllocTransaction(WDML_INSTANCE* pInstance, UINT ddeMsg, UINT wFmt, HSZ hszItem); 00227 extern void WDML_QueueTransaction(WDML_CONV* pConv, WDML_XACT* pXAct); 00228 extern BOOL WDML_UnQueueTransaction(WDML_CONV* pConv, WDML_XACT* pXAct); 00229 extern void WDML_FreeTransaction(WDML_INSTANCE* pInstance, WDML_XACT* pXAct, BOOL doFreePmt); 00230 extern WDML_XACT* WDML_FindTransaction(WDML_CONV* pConv, DWORD tid); 00231 extern HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease, 00232 BOOL fDeferUpd, BOOL fAckReq); 00233 extern HDDEDATA WDML_Global2DataHandle(WDML_CONV* pConv, HGLOBAL hMem, WINE_DDEHEAD* p); 00234 extern BOOL WDML_IsAppOwned(HDDEDATA hDdeData); 00235 extern WDML_INSTANCE* WDML_GetInstance(DWORD InstId); 00236 extern WDML_INSTANCE* WDML_GetInstanceFromWnd(HWND hWnd); 00237 /* broadcasting to DDE windows */ 00238 extern void WDML_BroadcastDDEWindows(LPCWSTR clsName, UINT uMsg, 00239 WPARAM wParam, LPARAM lParam); 00240 extern void WDML_NotifyThreadExit(DWORD tid); 00241 00242 static __inline void WDML_ExtractAck(WORD status, DDEACK* da) 00243 { 00244 *da = *((DDEACK*)&status); 00245 } 00246 00247 extern const WCHAR WDML_szEventClass[]; /* class of window for events (aka instance) */ 00248 extern const char WDML_szServerConvClassA[]; /* ANSI class of window for server side conv */ 00249 extern const WCHAR WDML_szServerConvClassW[]; /* unicode class of window for server side conv */ 00250 extern const char WDML_szClientConvClassA[]; /* ANSI class of window for client side conv */ 00251 extern const WCHAR WDML_szClientConvClassW[]; /* unicode class of window for client side conv */ 00252 00253 #define WM_WDML_REGISTER (WM_USER + 0x200) 00254 #define WM_WDML_UNREGISTER (WM_USER + 0x201) 00255 #define WM_WDML_CONNECT_CONFIRM (WM_USER + 0x202) 00256 00257 /* parameters for messages: 00258 * wParam lParam 00259 * Register atom for service name atom for service spec 00260 * Unregister atom for service name atom for service spec 00261 * ConnectConfirm client window handle server window handle 00262 */ 00263 00264 #define GWL_WDML_INSTANCE (0) 00265 #define GWL_WDML_CONVERSATION (sizeof(ULONG_PTR)) 00266 #define GWL_WDML_SERVER (sizeof(ULONG_PTR)) 00267 00268 #endif /* __WINE_DDEML_PRIVATE_H */ Generated on Sun May 27 2012 04:38:41 for ReactOS by
1.7.6.1
|