Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

ddemlcli.h File Reference

Go to the source code of this file.

Classes

struct  tagCHANDLEENTRY
struct  tagXACT_INFO
struct  tagADVISE_LINK
struct  tagDDE_MESSAGE_QUEUE
struct  tagSERVER_LOOKUP
struct  tagLINK_COUNT
struct  tagCL_INSTANCE_INFO
struct  tagCONV_INFO
struct  tagCL_CONV_INFO
struct  tagSVR_CONV_INFO
struct  tagCONVLIST
struct  tagENABLE_ENUM_STRUCT
struct  tagDDEMLDATA

Defines

#define DDEMLAlloc(cb)   LocalAlloc(LPTR, cb)
#define DDEMLReAlloc(p, cb)   LocalReAlloc(p, cb, LHND)
#define DDEMLFree(p)   LocalFree(p);
#define MONHSZ(pcii, hsz, type)
#define MONLINK(pcii, fEst, fNoD, aS, aT, aI, wFmt, fSvr, hConvS, hConvC)
#define MONCONV(pcoi, fConn)
#define EnterDDECrit   RtlEnterCriticalSection(&gcsDDEML);
#define LeaveDDECrit   RtlLeaveCriticalSection(&gcsDDEML);
#define CheckDDECritIn   ;
#define CheckDDECritOut   ;
#define HSZT_INVALID   0
#define HSZT_NORMAL   1
#define HSZT_INST_SPECIFIC   2
#define LATOM_FROM_HSZ(hsz)   (LATOM)(ULONG_PTR)(hsz)
#define NORMAL_HSZ_FROM_LATOM(a)   (HSZ)(ULONG_PTR)(a)
#define INST_SPECIFIC_HSZ_FROM_LATOM(a)   (HSZ)LongToHandle( MAKELONG(a, 1) )
#define MASK_ID   0xFF000000
#define SHIFT_ID   24
#define MASK_INDEX   0x00FFFC00
#define SHIFT_INDEX   10
#define MASK_TYPE   0x00000380
#define SHIFT_TYPE   7
#define MASK_INST   0x0000007F
#define SHIFT_INST   0
#define MAX_INST   MASK_INST
#define IdFromHandle(h)   (DWORD)(((ULONG_PTR)(h) & MASK_ID) >> SHIFT_ID)
#define IndexFromHandle(h)   (DWORD)(((ULONG_PTR)(h) & MASK_INDEX) >> SHIFT_INDEX)
#define TypeFromHandle(h)   (DWORD)(((ULONG_PTR)(h) & MASK_TYPE) >> SHIFT_TYPE)
#define InstFromHandle(h)   (DWORD)(((ULONG_PTR)(h) & MASK_INST) >> SHIFT_INST)
#define HandleFromId(h)   (((DWORD)(h)) << SHIFT_ID)
#define HandleFromIndex(h)   (((DWORD)(h)) << SHIFT_INDEX)
#define HandleFromType(h)   (((DWORD)(h)) << SHIFT_TYPE)
#define HandleFromInst(h)   (((DWORD)(h)) << SHIFT_INST)
#define HTYPE_EMPTY   0
#define HTYPE_INSTANCE   1
#define HTYPE_SERVER_CONVERSATION   2
#define HTYPE_CLIENT_CONVERSATION   3
#define HTYPE_CONVERSATION_LIST   4
#define HTYPE_TRANSACTION   5
#define HTYPE_DATA_HANDLE   6
#define HTYPE_ZOMBIE_CONVERSATION   7
#define HTYPE_ANY   (DWORD)(-1)
#define HINST_ANY   (DWORD)(-1)
#define XIF_SYNCHRONOUS   0x1
#define XIF_COMPLETE   0x2
#define XIF_ABANDONED   0x4
#define TID_TIMEOUT   1
#define ADVST_WAITING   0x0080
#define ADVST_CHANGED   0x0040
#define IIF_IN_SYNC_XACT   0x0001
#define IIF_UNICODE   0x8000

Typedefs

typedef ATOM LATOM
typedef ATOM GATOM
typedef tagCHANDLEENTRY CHANDLEENTRY
typedef tagCHANDLEENTRYPCHANDLEENTRY
typedef BOOL(* PFNHANDLEAPPLY )(HANDLE)
typedef tagXACT_INFOPXACT_INFO
typedef BOOL(* FNRESPONSE )(PXACT_INFO, UINT, LPARAM)
typedef tagXACT_INFO XACT_INFO
typedef tagLINK_COUNTPLINK_COUNT
typedef tagADVISE_LINK ADVISE_LINK
typedef tagADVISE_LINKPADVISE_LINK
typedef tagDDE_MESSAGE_QUEUE DDE_MESSAGE_QUEUE
typedef tagDDE_MESSAGE_QUEUEPDDE_MESSAGE_QUEUE
typedef tagSERVER_LOOKUP SERVER_LOOKUP
typedef tagSERVER_LOOKUPPSERVER_LOOKUP
typedef tagLINK_COUNT LINK_COUNT
typedef tagCL_INSTANCE_INFO CL_INSTANCE_INFO
typedef tagCL_INSTANCE_INFOPCL_INSTANCE_INFO
typedef tagCONV_INFO CONV_INFO
typedef tagCONV_INFOPCONV_INFO
typedef tagCL_CONV_INFO CL_CONV_INFO
typedef tagCL_CONV_INFOPCL_CONV_INFO
typedef tagSVR_CONV_INFO SVR_CONV_INFO
typedef tagSVR_CONV_INFOPSVR_CONV_INFO
typedef tagCONVLIST CONVLIST
typedef tagCONVLISTPCONVLIST
typedef tagENABLE_ENUM_STRUCT ENABLE_ENUM_STRUCT
typedef tagENABLE_ENUM_STRUCTPENABLE_ENUM_STRUCT
typedef tagDDEMLDATA DDEMLDATA
typedef tagDDEMLDATAPDDEMLDATA

Functions

HANDLE CreateHandle (ULONG_PTR dwData, DWORD type, DWORD inst)
ULONG_PTR DestroyHandle (HANDLE h)
ULONG_PTR GetHandleData (HANDLE h)
VOID SetHandleData (HANDLE h, ULONG_PTR dwData)
ULONG_PTR ValidateCHandle (HANDLE h, DWORD ExpectedType, DWORD ExpectedInstance)
PCL_INSTANCE_INFO PciiFromHandle (HANDLE h)
HANDLE FindIstanceHandleFromHandle (HANDLE h)
VOID ApplyFunctionToObjects (DWORD ExpectedType, DWORD ExpectedInstance, PFNHANDLEAPPLY pfn)
VOID BestSetLastDDEMLError (DWORD error)
BOOL RW_RegisterDDEML (void)
UINT InternalDdeInitialize (LPDWORD pidInst, PFNCALLBACK pfnCallback, DWORD afCmd, BOOL fUnicode)
HANDLE AddInstance (HANDLE hInst)
HANDLE DestroyInstance (HANDLE hInst)
PCL_INSTANCE_INFO ValidateInstance (HANDLE hInst)
BOOL CsClearSecurityForAck (HANDLE hInst, HWND hwndServer, HWND hwndClient)
VOID SetLastDDEMLError (PCL_INSTANCE_INFO pcii, DWORD error)
HSZ InternalDdeCreateStringHandle (DWORD idInst, PVOID psz, int iCodePage)
DWORD InternalDdeQueryString (DWORD idInst, HSZ hsz, PVOID psz, DWORD cchMax, INT iCodePage)
DWORD ValidateHSZ (HSZ hsz)
LATOM MakeInstSpecificAtom (LATOM la, HWND hwnd)
HWND ParseInstSpecificAtom (LATOM la, LATOM *plaNormal)
GATOM LocalToGlobalAtom (LATOM la)
LATOM GlobalToLocalAtom (GATOM ga)
GATOM IncGlobalAtomCount (GATOM la)
LATOM IncLocalAtomCount (LATOM la)
BOOL ValidateConnectParameters (HANDLE hInst, PCL_INSTANCE_INFO *ppcii, HSZ *phszService, HSZ hszTopic, LATOM *plaNormalSvcName, PCONVCONTEXT *ppCC, HWND *phwndTarget, HCONVLIST hConvList)
PCL_CONV_INFO ConnectConv (PCL_INSTANCE_INFO pcii, LATOM laService, LATOM laTopic, HWND hwndTarget, HWND hwndSkip, PCONVCONTEXT pCC, HCONVLIST hConvList, DWORD clst)
VOID SetCommonStateFlags (HWND hwndUs, HWND hwndThem, PWORD pwFlags)
VOID ShutdownConversation (PCONV_INFO pcoi, BOOL fMakeCallback)
VOID FreeConversationResources (PCONV_INFO pcoi)
BOOL WaitForZombieTerminate (HANDLE hData)
VOID GetConvContext (HWND hwnd, LONG *pl)
VOID SetConvContext (HWND hwnd, LONG *pl)
BOOL UpdateLinkIfChanged (PADVISE_LINK paLink, PXACT_INFO pxi, PCONV_INFO pcoi, PADVISE_LINK paLinkLast, PBOOL pfSwapped, DWORD cLinksToGo)
VOID LinkTransaction (PXACT_INFO pxi)
VOID UnlinkTransaction (PXACT_INFO pxi)
BOOL ValidateTransaction (HCONV hConv, HANDLE hXact, PCONV_INFO *ppcoi, PXACT_INFO *ppxi)
HDDEDATA InternalCreateDataHandle (PCL_INSTANCE_INFO pcii, LPBYTE pSrc, DWORD cb, DWORD cbOff, DWORD flags, WORD wStatus, WORD wFmt)
BOOL ApplyFreeDataHandle (HANDLE hData)
BOOL InternalFreeDataHandle (HDDEDATA hData, BOOL fIgnorefRelease)
VOID FreeDDEData (HANDLE hDDE, BOOL fIgnorefRelease, BOOL fFreeTruelyGlobalObjects)
HANDLE CopyDDEData (HANDLE hDDE, BOOL fExec)
HDDEDATA DoCallback (PCL_INSTANCE_INFO pcii, WORD wType, WORD wFmt, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, ULONG_PTR dw1, ULONG_PTR dw2)
DWORD _ClientEventCallback (PCL_INSTANCE_INFO pcii, PEVENT_PACKET pep)
BOOL SetEnableState (PCONV_INFO pcoi, UINT wCmd)
DWORD _ClientGetDDEHookData (UINT message, LPARAM lParam, PDDEML_MSG_HOOK_DATA pdmhd)
DWORD _ClientGetDDEFlags (HANDLE hClient, DWORD flags)
BOOL EnableEnumProc (HWND hwnd, PENABLE_ENUM_STRUCT pees)
LRESULT DDEMLMotherWndProc (HWND, UINT, WPARAM, LPARAM)
LRESULT DDEMLClientWndProc (HWND, UINT, WPARAM, LPARAM)
LRESULT DDEMLServerWndProc (HWND, UINT, WPARAM, LPARAM)
PCONV_INFO ProcessTerminateMsg (PCONV_INFO pcoi, HWND hwndFrom)
VOID ProcessAsyncDDEMsg (PCONV_INFO pcoi, UINT msg, HWND hwndFrom, LPARAM lParam)
BOOL CheckForQueuedMessages (PCONV_INFO pcoi)
VOID DumpDDEMessage (BOOL fFreeData, UINT msg, LPARAM lParam)
BOOL ProcessSyncDDEMessage (PCONV_INFO pcoi, UINT msg, LPARAM lParam)
BOOL ClStartAdvise (PXACT_INFO pxi)
BOOL SvSpontAdvise (PSVR_CONV_INFO psi, LPARAM lParam)
BOOL ClRespAdviseAck (PXACT_INFO pxi, UINT msg, LPARAM lParam)
BOOL SvStartAdviseUpdate (PXACT_INFO pxi, DWORD cLinksToGo)
BOOL ClSpontAdviseData (PCL_CONV_INFO pci, LPARAM lParam)
BOOL SvRespAdviseDataAck (PXACT_INFO pxi, UINT msg, LPARAM lParam)
BOOL ClStartUnadvise (PXACT_INFO pxi)
BOOL SvSpontUnadvise (PSVR_CONV_INFO psi, LPARAM lParam)
BOOL ClRespUnadviseAck (PXACT_INFO pxi, UINT msg, LPARAM lParam)
BOOL ClStartExecute (PXACT_INFO pxi)
BOOL ClRespExecuteAck (PXACT_INFO pxi, UINT msg, LPARAM lParam)
BOOL ClStartPoke (PXACT_INFO pxi)
BOOL SvSpontPoke (PSVR_CONV_INFO psi, LPARAM lParam)
BOOL ClRespPokeAck (PXACT_INFO pxi, UINT msg, LPARAM lParam)
BOOL ClStartRequest (PXACT_INFO pxi)
BOOL SvSpontRequest (PSVR_CONV_INFO psi, LPARAM lParam)
BOOL ClRespRequestData (PXACT_INFO pxi, UINT msg, LPARAM lParam)
BOOL SpontaneousClientMessage (PCL_CONV_INFO pci, UINT msg, LPARAM lParam)
BOOL SpontaneousServerMessage (PSVR_CONV_INFO psi, UINT msg, LPARAM lParam)
HANDLE AllocAndSetDDEData (LPBYTE pSrc, DWORD cb, WORD wStatus, WORD wFmt)
DWORD PackAndPostMessage (HWND hwndTo, UINT msgIn, UINT msgOut, HWND hwndFrom, LPARAM lParam, UINT_PTR uiLo, UINT_PTR uiHi)
BOOL ExtractDDEDataInfo (HANDLE hDDE, LPWORD pwStatus, LPWORD pwFmt)
BOOL TransactionComplete (PXACT_INFO pxi, HDDEDATA hData)
HANDLE UnpackAndFreeDDEMLDataHandle (HDDEDATA hData, BOOL fExec)
BOOL AddLink (PCONV_INFO pcoi, GATOM gaItem, WORD wFmt, WORD wType)
VOID DeleteLinkCount (PCL_INSTANCE_INFO pcii, PLINK_COUNT pLinkCountDelete)
VOID MonitorStringHandle (PCL_INSTANCE_INFO pcii, HSZ hsz, DWORD fsAction)
VOID MonitorLink (PCL_INSTANCE_INFO pcii, BOOL fEstablished, BOOL fNoData, LATOM laSvc, LATOM laTopic, GATOM gaItem, WORD wFmt, BOOL fServer, HCONV hConvServer, HCONV hConvClient)
VOID MonitorConv (PCONV_INFO pcoi, BOOL fConnect)
VOID RegisterService (BOOL fRegister, GATOM gaApp, HWND hwndListen)
LRESULT ProcessRegistrationMessage (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

Variables

RTL_CRITICAL_SECTION gcsDDEML
CONVCONTEXT DefConvContext
PHANDLE aInstance
DWORD gWM_REGISTERCALLBACK


Define Documentation

#define ADVST_CHANGED   0x0040
 

Definition at line 154 of file ddemlcli.h.

Referenced by DdePostAdvise(), and UpdateLinkIfChanged().

#define ADVST_WAITING   0x0080
 

Definition at line 153 of file ddemlcli.h.

Referenced by SvRespAdviseDataAck(), and UpdateLinkIfChanged().

#define CheckDDECritIn   ;
 

Definition at line 58 of file ddemlcli.h.

Referenced by ApplyFunctionToObjects(), BestSetLastDDEMLError(), CheckForQueuedMessages(), ConnectConv(), DoCallback(), FreeConversationResources(), InternalCreateDataHandle(), InternalFreeDataHandle(), LinkTransaction(), MonitorConv(), MonitorLink(), MonitorStringHandle(), PackAndPostMessage(), PciiFromHandle(), ProcessSyncDDEMessage(), ShutdownConversation(), SvStartAdviseUpdate(), UnlinkConvFromOthers(), UnlinkTransaction(), UnpackAndFreeDDEMLDataHandle(), and UpdateLinkIfChanged().

#define CheckDDECritOut   ;
 

Definition at line 59 of file ddemlcli.h.

Referenced by ApplyFreeDataHandle(), ApplyFunctionToObjects(), ConnectConv(), DdeClientTransaction(), DdeConnectList(), DdeDisconnect(), DdeDisconnectList(), DdeUninitialize(), DoCallback(), Event(), InitiateEnumerationProc(), PackAndPostMessage(), ProcessDDEMLInitiate(), ProcessRegistrationMessage(), RegisterService(), and WaitForZombieTerminate().

#define DDEMLAlloc cb   )     LocalAlloc(LPTR, cb)
 

Definition at line 16 of file ddemlcli.h.

Referenced by AddInstance(), AddLink(), CopyPalette(), CreateHandle(), DdeClientTransaction(), DdeConnectList(), DDEMLClientWndProc(), DdePostAdvise(), DdeReconnect(), DoCallback(), InternalCreateDataHandle(), InternalDdeInitialize(), MonitorConv(), MonitorLink(), MonitorStringHandle(), ProcessAsyncDDEMsg(), ProcessDDEMLInitiate(), SetLastDDEMLError(), and SvRespAdviseDataAck().

#define DDEMLFree  )     LocalFree(p);
 

Definition at line 18 of file ddemlcli.h.

Referenced by CheckForQueuedMessages(), CloseTransaction(), ClRespAdviseAck(), ClRespExecuteAck(), ClRespPokeAck(), ClRespRequestData(), ClRespUnadviseAck(), CopyPalette(), DdeClientTransaction(), DdeConnectList(), DdeDisconnectList(), DDEMLClientWndProc(), DdePostAdvise(), DdeReconnect(), DdeUninitialize(), DeleteLinkCount(), DoCallback(), FreeConversationResources(), InternalCreateDataHandle(), InternalDdeInitialize(), InternalFreeDataHandle(), ProcessDDEMLInitiate(), SvRespAdviseDataAck(), UnlinkConvFromOthers(), and UnpackAndFreeDDEMLDataHandle().

#define DDEMLReAlloc p,
cb   )     LocalReAlloc(p, cb, LHND)
 

Definition at line 17 of file ddemlcli.h.

Referenced by AddInstance(), AddLink(), CreateHandle(), DdeConnectList(), DdeNameService(), and ProcessDDEMLInitiate().

#define EnterDDECrit   RtlEnterCriticalSection(&gcsDDEML);
 

Definition at line 48 of file ddemlcli.h.

Referenced by _ClientEventCallback(), ApplyFreeDataHandle(), ApplyFunctionToObjects(), ConnectConv(), DdeAbandonTransaction(), DdeAccessData(), DdeAddData(), DdeClientTransaction(), DdeConnect(), DdeConnectList(), DdeCreateDataHandle(), DdeDisconnect(), DdeDisconnectList(), DdeEnableCallback(), DdeFreeDataHandle(), DdeFreeStringHandle(), DdeGetData(), DdeGetLastError(), DdeImpersonateClient(), DdeKeepStringHandle(), DDEMLClientWndProc(), DDEMLServerWndProc(), DdeNameService(), DdePostAdvise(), DdeQueryConvInfo(), DdeQueryNextServer(), DdeReconnect(), DdeSetUserHandle(), DdeUnaccessData(), DdeUninitialize(), DoCallback(), InitiateEnumerationProc(), InternalDdeCreateStringHandle(), InternalDdeInitialize(), InternalDdeQueryString(), MonitorConv(), MonitorLink(), MonitorStringHandle(), PackAndPostMessage(), ProcessDDEMLInitiate(), ProcessRegistrationMessage(), SetLastDDEMLError(), UnlinkConvFromOthers(), and WaitForZombieTerminate().

#define HandleFromId  )     (((DWORD)(h)) << SHIFT_ID)
 

Definition at line 97 of file ddemlcli.h.

Referenced by CreateHandle().

#define HandleFromIndex  )     (((DWORD)(h)) << SHIFT_INDEX)
 

Definition at line 98 of file ddemlcli.h.

#define HandleFromInst  )     (((DWORD)(h)) << SHIFT_INST)
 

Definition at line 100 of file ddemlcli.h.

Referenced by CreateHandle().

#define HandleFromType  )     (((DWORD)(h)) << SHIFT_TYPE)
 

Definition at line 99 of file ddemlcli.h.

Referenced by CreateHandle().

#define HINST_ANY   (DWORD)(-1)
 

Definition at line 112 of file ddemlcli.h.

Referenced by DdeAccessData(), DdeAddData(), DdeClientTransaction(), DdeDisconnect(), DdeDisconnectList(), DdeFreeDataHandle(), DdeGetData(), DdeImpersonateClient(), DdeQueryNextServer(), DdeReconnect(), DdeUnaccessData(), InitiateEnumerationProc(), InternalFreeDataHandle(), ProcessSyncDDEMessage(), UnpackAndFreeDDEMLDataHandle(), ValidateInstance(), and ValidateTransaction().

#define HSZT_INST_SPECIFIC   2
 

Definition at line 67 of file ddemlcli.h.

Referenced by ValidateConnectParameters(), and ValidateHSZ().

#define HSZT_INVALID   0
 

Definition at line 65 of file ddemlcli.h.

Referenced by DdeFreeStringHandle(), DdeKeepStringHandle(), DdeNameService(), DdePostAdvise(), InternalDdeQueryString(), ValidateConnectParameters(), and ValidateHSZ().

#define HSZT_NORMAL   1
 

Definition at line 66 of file ddemlcli.h.

Referenced by ValidateHSZ().

#define HTYPE_ANY   (DWORD)(-1)
 

Definition at line 111 of file ddemlcli.h.

Referenced by ApplyFunctionToObjects().

#define HTYPE_CLIENT_CONVERSATION   3
 

Definition at line 105 of file ddemlcli.h.

Referenced by DdeClientTransaction(), DdeDisconnect(), DdeEnableCallback(), DDEMLClientWndProc(), DdeQueryNextServer(), DdeReconnect(), DdeUninitialize(), and ValidateTransaction().

#define HTYPE_CONVERSATION_LIST   4
 

Definition at line 106 of file ddemlcli.h.

Referenced by DdeConnectList(), DdeDisconnectList(), DdeQueryNextServer(), DdeUninitialize(), InitiateEnumerationProc(), and ValidateConnectParameters().

#define HTYPE_DATA_HANDLE   6
 

Definition at line 108 of file ddemlcli.h.

Referenced by DdeAccessData(), DdeAddData(), DdeClientTransaction(), DdeFreeDataHandle(), DdeGetData(), DdeUnaccessData(), DdeUninitialize(), InternalCreateDataHandle(), InternalFreeDataHandle(), and UnpackAndFreeDDEMLDataHandle().

#define HTYPE_EMPTY   0
 

Definition at line 102 of file ddemlcli.h.

#define HTYPE_INSTANCE   1
 

Definition at line 103 of file ddemlcli.h.

Referenced by AddInstance(), BestSetLastDDEMLError(), PciiFromHandle(), and ValidateInstance().

#define HTYPE_SERVER_CONVERSATION   2
 

Definition at line 104 of file ddemlcli.h.

Referenced by DdeDisconnect(), DdeEnableCallback(), DdeImpersonateClient(), DdeUninitialize(), ProcessDDEMLInitiate(), and ValidateTransaction().

#define HTYPE_TRANSACTION   5
 

Definition at line 107 of file ddemlcli.h.

Referenced by DdeClientTransaction(), ProcessSyncDDEMessage(), and ValidateTransaction().

#define HTYPE_ZOMBIE_CONVERSATION   7
 

Definition at line 109 of file ddemlcli.h.

Referenced by DdeQueryNextServer(), DdeUninitialize(), DoCallback(), FreeConversationResources(), UnlinkConvFromOthers(), and WaitForZombieTerminate().

#define IdFromHandle  )     (DWORD)(((ULONG_PTR)(h) & MASK_ID) >> SHIFT_ID)
 

Definition at line 92 of file ddemlcli.h.

#define IIF_IN_SYNC_XACT   0x0001
 

Definition at line 205 of file ddemlcli.h.

Referenced by DdeClientTransaction(), DdePostAdvise(), DdeUninitialize(), and ProcessSyncDDEMessage().

#define IIF_UNICODE   0x8000
 

Definition at line 206 of file ddemlcli.h.

Referenced by _ClientEventCallback(), ClStartExecute(), ConnectConv(), InternalDdeInitialize(), ProcessDDEMLInitiate(), SvSpontExecute(), and ValidateConnectParameters().

#define IndexFromHandle  )     (DWORD)(((ULONG_PTR)(h) & MASK_INDEX) >> SHIFT_INDEX)
 

Definition at line 93 of file ddemlcli.h.

#define INST_SPECIFIC_HSZ_FROM_LATOM  )     (HSZ)LongToHandle( MAKELONG(a, 1) )
 

Definition at line 71 of file ddemlcli.h.

Referenced by _ClientEventCallback(), and ProcessRegistrationMessage().

#define InstFromHandle  )     (DWORD)(((ULONG_PTR)(h) & MASK_INST) >> SHIFT_INST)
 

Definition at line 95 of file ddemlcli.h.

Referenced by ApplyFunctionToObjects(), DdeClientTransaction(), DdeConnectList(), DdeEnableCallback(), DDEMLClientWndProc(), DdeQueryNextServer(), DdeUninitialize(), DestroyInstance(), FreeConversationResources(), InternalCreateDataHandle(), PciiFromHandle(), ProcessDDEMLInitiate(), ValidateCHandle(), ValidateConnectParameters(), ValidateTransaction(), and WaitForZombieTerminate().

#define LATOM_FROM_HSZ hsz   )     (LATOM)(ULONG_PTR)(hsz)
 

Definition at line 69 of file ddemlcli.h.

Referenced by _ClientEventCallback(), DdeClientTransaction(), DdeConnect(), DdeConnectList(), DdeFreeStringHandle(), DdeKeepStringHandle(), DdeNameService(), DdePostAdvise(), DoCallback(), InternalDdeQueryString(), MonitorStringHandle(), ProcessDDEMLInitiate(), and ValidateConnectParameters().

#define LeaveDDECrit   RtlLeaveCriticalSection(&gcsDDEML);
 

Definition at line 49 of file ddemlcli.h.

Referenced by _ClientEventCallback(), ApplyFreeDataHandle(), ApplyFunctionToObjects(), ConnectConv(), DdeAbandonTransaction(), DdeAccessData(), DdeAddData(), DdeClientTransaction(), DdeConnect(), DdeConnectList(), DdeCreateDataHandle(), DdeDisconnect(), DdeDisconnectList(), DdeEnableCallback(), DdeFreeDataHandle(), DdeFreeStringHandle(), DdeGetData(), DdeGetLastError(), DdeImpersonateClient(), DdeKeepStringHandle(), DDEMLClientWndProc(), DDEMLServerWndProc(), DdeNameService(), DdePostAdvise(), DdeQueryConvInfo(), DdeQueryNextServer(), DdeReconnect(), DdeSetUserHandle(), DdeUnaccessData(), DdeUninitialize(), DoCallback(), InitiateEnumerationProc(), InternalDdeCreateStringHandle(), InternalDdeInitialize(), InternalDdeQueryString(), MonitorConv(), MonitorLink(), MonitorStringHandle(), PackAndPostMessage(), ProcessDDEMLInitiate(), ProcessRegistrationMessage(), SetLastDDEMLError(), UnlinkConvFromOthers(), and WaitForZombieTerminate().

#define MASK_ID   0xFF000000
 

Definition at line 82 of file ddemlcli.h.

#define MASK_INDEX   0x00FFFC00
 

Definition at line 84 of file ddemlcli.h.

#define MASK_INST   0x0000007F
 

Definition at line 88 of file ddemlcli.h.

#define MASK_TYPE   0x00000380
 

Definition at line 86 of file ddemlcli.h.

#define MAX_INST   MASK_INST
 

Definition at line 90 of file ddemlcli.h.

Referenced by AddInstance().

#define MONCONV pcoi,
fConn   ) 
 

Value:

if (((pcoi)->pcii->MonitorFlags & MF_CONV) && \ ((((pcoi)->state & ST_ISLOCAL) && (pcoi)->state & ST_CLIENT) || \ !((pcoi)->state & ST_ISLOCAL))) \ MonitorConv(pcoi, fConn);

Definition at line 36 of file ddemlcli.h.

Referenced by ConnectConv(), ProcessDDEMLInitiate(), and ShutdownConversation().

#define MONHSZ pcii,
hsz,
type   ) 
 

Value:

if ((pcii->MonitorFlags & MF_HSZ_INFO) && hsz) \ MonitorStringHandle(pcii, hsz, type)

Definition at line 29 of file ddemlcli.h.

Referenced by DdeFreeStringHandle(), DdeKeepStringHandle(), and InternalDdeCreateStringHandle().

#define MONLINK pcii,
fEst,
fNoD,
aS,
aT,
aI,
wFmt,
fSvr,
hConvS,
hConvC   ) 
 

Value:

if (pcii->MonitorFlags & MF_LINKS) \ MonitorLink(pcii, fEst, fNoD, aS, aT, aI, \ wFmt, fSvr, hConvS, hConvC)

Definition at line 31 of file ddemlcli.h.

Referenced by ClRespAdviseAck(), ClStartUnadvise(), FreeConversationResources(), SvSpontAdvise(), and SvSpontUnadvise().

#define NORMAL_HSZ_FROM_LATOM  )     (HSZ)(ULONG_PTR)(a)
 

Definition at line 70 of file ddemlcli.h.

Referenced by _ClientEventCallback(), ClSpontAdviseData(), DdeQueryConvInfo(), InternalDdeCreateStringHandle(), ProcessDDEMLInitiate(), ProcessRegistrationMessage(), SvSpontAdvise(), SvSpontExecute(), SvSpontPoke(), SvSpontRequest(), SvSpontUnadvise(), SvStartAdviseUpdate(), TransactionComplete(), and ValidateConnectParameters().

#define SHIFT_ID   24
 

Definition at line 83 of file ddemlcli.h.

#define SHIFT_INDEX   10
 

Definition at line 85 of file ddemlcli.h.

#define SHIFT_INST   0
 

Definition at line 89 of file ddemlcli.h.

#define SHIFT_TYPE   7
 

Definition at line 87 of file ddemlcli.h.

#define TID_TIMEOUT   1
 

Definition at line 140 of file ddemlcli.h.

Referenced by DdeClientTransaction(), FreeConversationResources(), and TransactionComplete().

#define TypeFromHandle  )     (DWORD)(((ULONG_PTR)(h) & MASK_TYPE) >> SHIFT_TYPE)
 

Definition at line 94 of file ddemlcli.h.

Referenced by ApplyFunctionToObjects(), BestSetLastDDEMLError(), DdeQueryNextServer(), DoCallback(), PciiFromHandle(), UnlinkConvFromOthers(), and ValidateCHandle().

#define XIF_ABANDONED   0x4
 

Definition at line 138 of file ddemlcli.h.

Referenced by AbandonTransaction(), DdeClientTransaction(), DdeReconnect(), and TransactionComplete().

#define XIF_COMPLETE   0x2
 

Definition at line 137 of file ddemlcli.h.

Referenced by DdeClientTransaction(), and TransactionComplete().

#define XIF_SYNCHRONOUS   0x1
 

Definition at line 136 of file ddemlcli.h.

Referenced by DdeClientTransaction(), FreeConversationResources(), and TransactionComplete().


Typedef Documentation

typedef struct tagADVISE_LINK ADVISE_LINK
 

Referenced by SvSpontUnadvise().

typedef struct tagCHANDLEENTRY CHANDLEENTRY
 

typedef struct tagCL_CONV_INFO CL_CONV_INFO
 

typedef struct tagCL_INSTANCE_INFO CL_INSTANCE_INFO
 

Referenced by InternalDdeInitialize().

typedef struct tagCONV_INFO CONV_INFO
 

typedef struct tagCONVLIST CONVLIST
 

Referenced by DdeConnectList().

typedef struct tagDDE_MESSAGE_QUEUE DDE_MESSAGE_QUEUE
 

typedef struct tagDDEMLDATA DDEMLDATA
 

typedef struct tagENABLE_ENUM_STRUCT ENABLE_ENUM_STRUCT
 

Referenced by DdeEnableCallback().

typedef BOOL(* FNRESPONSE)(PXACT_INFO, UINT, LPARAM)
 

Definition at line 118 of file ddemlcli.h.

Referenced by ClStartAdvise(), ClStartExecute(), ClStartPoke(), ClStartRequest(), ClStartUnadvise(), and SvStartAdviseUpdate().

typedef ATOM GATOM
 

Definition at line 25 of file ddemlcli.h.

Referenced by _ClientEventCallback(), ClRespAdviseAck(), ClRespPokeAck(), ClRespRequestData(), ClRespUnadviseAck(), ClSpontAdviseData(), ConnectConv(), DdeNameService(), IncGlobalAtomCount(), LocalToGlobalAtom(), ProcessRegistrationMessage(), SvRespAdviseDataAck(), SvSpontAdvise(), SvSpontPoke(), SvSpontRequest(), and SvSpontUnadvise().

typedef ATOM LATOM
 

Definition at line 24 of file ddemlcli.h.

Referenced by _ClientEventCallback(), AddLink(), ClRespUnadviseAck(), ClSpontAdviseData(), DdeConnect(), DdeConnectList(), DdeNameService(), GlobalToLocalAtom(), IncLocalAtomCount(), InternalDdeInitialize(), MakeInstSpecificAtom(), ProcessDDEMLInitiate(), ProcessRegistrationMessage(), SvRespAdviseDataAck(), SvSpontAdvise(), SvSpontPoke(), SvSpontRequest(), SvSpontUnadvise(), SvStartAdviseUpdate(), and TransactionComplete().

typedef struct tagLINK_COUNT LINK_COUNT
 

typedef struct tagADVISE_LINK * PADVISE_LINK
 

Referenced by ClSpontAdviseData(), and DdeReconnect().

typedef struct tagCHANDLEENTRY * PCHANDLEENTRY
 

typedef struct tagCL_CONV_INFO * PCL_CONV_INFO
 

Referenced by ClRespAdviseAck(), and UnlinkConvFromOthers().

typedef struct tagCL_INSTANCE_INFO * PCL_INSTANCE_INFO
 

typedef struct tagCONV_INFO * PCONV_INFO
 

typedef struct tagCONVLIST * PCONVLIST
 

typedef struct tagDDE_MESSAGE_QUEUE * PDDE_MESSAGE_QUEUE
 

typedef struct tagDDEMLDATA * PDDEMLDATA
 

Referenced by UnpackAndFreeDDEMLDataHandle().

typedef struct tagENABLE_ENUM_STRUCT * PENABLE_ENUM_STRUCT
 

Referenced by EnableEnumProc().

typedef BOOL(* PFNHANDLEAPPLY)(HANDLE)
 

Definition at line 80 of file ddemlcli.h.

Referenced by DdeUninitialize().

typedef struct tagLINK_COUNT* PLINK_COUNT
 

Definition at line 144 of file ddemlcli.h.

typedef struct tagSERVER_LOOKUP * PSERVER_LOOKUP
 

typedef struct tagSVR_CONV_INFO * PSVR_CONV_INFO
 

Referenced by RW_RegisterDDEML(), and SvSpontAdvise().

typedef struct tagXACT_INFO* PXACT_INFO
 

Definition at line 116 of file ddemlcli.h.

Referenced by ClStartAdvise().

typedef struct tagSERVER_LOOKUP SERVER_LOOKUP
 

typedef struct tagSVR_CONV_INFO SVR_CONV_INFO
 

typedef struct tagXACT_INFO XACT_INFO
 

Referenced by DdePostAdvise(), DdeReconnect(), and SvRespAdviseDataAck().


Function Documentation

DWORD _ClientEventCallback PCL_INSTANCE_INFO  pcii,
PEVENT_PACKET  pep
 

Definition at line 129 of file w32/ntuser/client/callback.c.

References BOOL, BYTE, DoCallback(), DWORD, EnterDDECrit, tagCL_INSTANCE_INFO::flags, GATOM, GlobalToLocalAtom(), IIF_UNICODE, INST_SPECIFIC_HSZ_FROM_LATOM, InternalCreateDataHandle(), InternalFreeDataHandle(), L, LATOM, LATOM_FROM_HSZ, LeaveDDECrit, min, tagCL_INSTANCE_INFO::MonitorFlags, NORMAL_HSZ_FROM_LATOM, NULL, pep, RtlIsTextUnicode(), RtlMultiByteToUnicodeN(), RtlUnicodeToMultiByteN(), TRUE, and UserLocalFree.

00132 { 00133 HDDEDATA hData; 00134 00135 EnterDDECrit; 00136 00137 switch (pep->EventType) { 00138 case 0: // MonitorFlags change event - everybody gets it 00139 pcii->MonitorFlags = pep->Data; 00140 break; 00141 00142 case MF_CALLBACKS: 00143 { 00144 MONCBSTRUCT mcb; 00145 00146 mcb = *((MONCBSTRUCT *)&pep->Data); 00147 mcb.hsz1 = NORMAL_HSZ_FROM_LATOM(GlobalToLocalAtom((GATOM)(ULONG_PTR)mcb.hsz1)); 00148 mcb.hsz2 = NORMAL_HSZ_FROM_LATOM(GlobalToLocalAtom((GATOM)(ULONG_PTR)mcb.hsz2)); 00149 if ( mcb.wType == XTYP_REGISTER || 00150 mcb.wType == XTYP_UNREGISTER) { 00151 mcb.hsz2 = INST_SPECIFIC_HSZ_FROM_LATOM((LATOM)(ULONG_PTR)mcb.hsz2); 00152 } 00153 hData = InternalCreateDataHandle(pcii, (LPSTR)&mcb, 00154 pep->cbEventData, 0, 00155 HDATA_NOAPPFREE | HDATA_READONLY | HDATA_EXECUTE, 0, 0); 00156 if (hData) { 00157 DoCallback(pcii, (WORD)XTYP_MONITOR, 0, 0, 0, 0, hData, 0L, 00158 pep->EventType); 00159 InternalFreeDataHandle((HDDEDATA)hData, TRUE); 00160 DeleteAtom(LATOM_FROM_HSZ(mcb.hsz1)); 00161 DeleteAtom(LATOM_FROM_HSZ(mcb.hsz2)); 00162 } 00163 } 00164 break; 00165 00166 case MF_LINKS: 00167 { 00168 MONLINKSTRUCT ml; 00169 00170 ml = *((MONLINKSTRUCT *)&pep->Data); 00171 ml.hszSvc = NORMAL_HSZ_FROM_LATOM(GlobalToLocalAtom((GATOM)(ULONG_PTR)ml.hszSvc)); 00172 ml.hszTopic = NORMAL_HSZ_FROM_LATOM(GlobalToLocalAtom((GATOM)(ULONG_PTR)ml.hszTopic)); 00173 ml.hszItem = NORMAL_HSZ_FROM_LATOM(GlobalToLocalAtom((GATOM)(ULONG_PTR)ml.hszItem)); 00174 hData = InternalCreateDataHandle(pcii, (LPSTR)&ml, 00175 pep->cbEventData, 0, 00176 HDATA_NOAPPFREE | HDATA_READONLY | HDATA_EXECUTE, 0, 0); 00177 if (hData) { 00178 DoCallback(pcii, (WORD)XTYP_MONITOR, 0, 0, 0, 0, hData, 0L, 00179 pep->EventType); 00180 InternalFreeDataHandle((HDDEDATA)hData, TRUE); 00181 DeleteAtom(LATOM_FROM_HSZ(ml.hszSvc)); 00182 DeleteAtom(LATOM_FROM_HSZ(ml.hszTopic)); 00183 DeleteAtom(LATOM_FROM_HSZ(ml.hszItem)); 00184 } 00185 } 00186 break; 00187 00188 case MF_CONV: 00189 { 00190 MONCONVSTRUCT mc; 00191 00192 mc = *((MONCONVSTRUCT *)&pep->Data); 00193 mc.hszSvc = NORMAL_HSZ_FROM_LATOM(GlobalToLocalAtom((GATOM)(ULONG_PTR)mc.hszSvc)); 00194 mc.hszTopic = NORMAL_HSZ_FROM_LATOM(GlobalToLocalAtom((GATOM)(ULONG_PTR)mc.hszTopic)); 00195 hData = InternalCreateDataHandle(pcii, (LPSTR)&mc, 00196 pep->cbEventData, 0, 00197 HDATA_NOAPPFREE | HDATA_READONLY | HDATA_EXECUTE, 0, 0); 00198 if (hData) { 00199 DoCallback(pcii, (WORD)XTYP_MONITOR, 0, 0, 0, 0, hData, 0L, 00200 pep->EventType); 00201 InternalFreeDataHandle((HDDEDATA)hData, TRUE); 00202 DeleteAtom(LATOM_FROM_HSZ(mc.hszSvc)); 00203 DeleteAtom(LATOM_FROM_HSZ(mc.hszTopic)); 00204 } 00205 } 00206 break; 00207 00208 case MF_HSZ_INFO: 00209 if (!(pcii->flags & IIF_UNICODE)) { 00210 LPSTR pszAnsi; 00211 /* 00212 * Translate HSZ string back into ANSI 00213 */ 00214 if (WCSToMB(((PMONHSZSTRUCT)&pep->Data)->str, 00215 ((int)pep->cbEventData - (int)((PMONHSZSTRUCT)&pep->Data)->cb) / sizeof(WCHAR), 00216 &pszAnsi, 00217 (int)pep->cbEventData - (int)((PMONHSZSTRUCT)&pep->Data)->cb, 00218 TRUE)) { 00219 strcpy(((PMONHSZSTRUCTA)&pep->Data)->str, pszAnsi); 00220 UserLocalFree(pszAnsi); 00221 } 00222 ((PMONHSZSTRUCT)&pep->Data)->cb = sizeof(MONHSZSTRUCTA); 00223 } 00224 // fall through 00225 case MF_SENDMSGS: 00226 case MF_POSTMSGS: 00227 if (pep->EventType == MF_POSTMSGS) { 00228 PMONMSGSTRUCT pmms = (PMONMSGSTRUCT)&pep->Data; 00229 BYTE buf[32]; 00230 00231 /* 00232 * We may need to translate the Execute string to/from 00233 * UNICODE depending on what type of monitor this is 00234 * going to. 00235 */ 00236 if (pmms->wMsg == WM_DDE_EXECUTE) { 00237 BOOL fUnicodeText; 00238 int flags; 00239 00240 flags = (IS_TEXT_UNICODE_UNICODE_MASK | 00241 IS_TEXT_UNICODE_REVERSE_MASK | 00242 (IS_TEXT_UNICODE_NOT_UNICODE_MASK & 00243 (~IS_TEXT_UNICODE_ILLEGAL_CHARS)) | 00244 IS_TEXT_UNICODE_NOT_ASCII_MASK); 00245 #ifdef ISTEXTUNICODE_WORKS 00246 fUnicodeText = RtlIsTextUnicode(pmms->dmhd.Data, 00247 min(32, pmms->dmhd.cbData), &flags); 00248 #else 00249 fUnicodeText = (*(LPSTR)pmms->dmhd.Data == '\0'); 00250 #endif 00251 00252 if (pcii->flags & IIF_UNICODE && !fUnicodeText) { 00253 /* Ascii->UNICODE */ 00254 RtlMultiByteToUnicodeN((LPWSTR)buf, 32, NULL, 00255 (LPSTR)&pmms->dmhd.Data, 00256 min(32, pmms->dmhd.cbData)); 00257 RtlCopyMemory(&pmms->dmhd.Data, buf, 32); 00258 } else if (!(pcii->flags & IIF_UNICODE) && fUnicodeText) { 00259 /* UNICODE->Ascii */ 00260 RtlUnicodeToMultiByteN((LPSTR)buf, 32, NULL, 00261 (LPWSTR)&pmms->dmhd.Data, 00262 min(32, pmms->dmhd.cbData)); 00263 RtlCopyMemory(&pmms->dmhd.Data, buf, 32); 00264 } 00265 } 00266 } 00267 case MF_ERRORS: 00268 hData = InternalCreateDataHandle(pcii, (LPSTR)&pep->Data, 00269 pep->cbEventData, 0, 00270 HDATA_NOAPPFREE | HDATA_READONLY | HDATA_EXECUTE, 0, 0); 00271 if (hData) { 00272 DoCallback(pcii, (WORD)XTYP_MONITOR, 0, 0, 0, 0, hData, 0L, 00273 pep->EventType); 00274 InternalFreeDataHandle((HDDEDATA)hData, TRUE); 00275 } 00276 break; 00277 } 00278 00279 LeaveDDECrit; 00280 return (0); 00281 }

DWORD _ClientGetDDEFlags HANDLE  hClient,
DWORD  flags
 

Definition at line 532 of file client/ddetrack.c.

00535 { 00536 PDDEPACK pDdePack; 00537 PWORD pw; 00538 HANDLE hData; 00539 DWORD retval = 0; 00540 00541 pDdePack = (PDDEPACK)hDDE; 00542 if (pDdePack == NULL) { 00543 return (0); 00544 } 00545 00546 if (flags & XS_DATA) { 00547 if (pDdePack->uiLo) { 00548 hData = (HANDLE)pDdePack->uiLo; 00549 USERGLOBALLOCK(hData, pw); 00550 if (pw != NULL) { 00551 retval = (DWORD)*pw; // first word is hData is wStatus 00552 USERGLOBALUNLOCK(hData); 00553 } 00554 } 00555 } else { 00556 retval = (DWORD)pDdePack->uiLo; 00557 } 00558 00559 return (retval); 00560 }

DWORD _ClientGetDDEHookData UINT  message,
LPARAM  lParam,
PDDEML_MSG_HOOK_DATA  pdmhd
 

Definition at line 500 of file w32/ntuser/client/callback.c.

References DWORD, min, NULL, PBYTE, UnpackDDElParam(), USERGLOBALLOCK, UserGlobalSize, and USERGLOBALUNLOCK.

00504 { 00505 PBYTE pb; 00506 HANDLE hDDE; 00507 00508 UnpackDDElParam(message, lParam, &pdmhd->uiLo, &pdmhd->uiHi); 00509 switch (message) { 00510 case WM_DDE_DATA: 00511 case WM_DDE_POKE: 00512 case WM_DDE_ADVISE: 00513 hDDE = (HANDLE)pdmhd->uiLo; 00514 break; 00515 00516 case WM_DDE_EXECUTE: 00517 hDDE = (HANDLE)pdmhd->uiHi; 00518 break; 00519 00520 case WM_DDE_ACK: 00521 case WM_DDE_REQUEST: 00522 case WM_DDE_UNADVISE: 00523 case WM_DDE_TERMINATE: 00524 pdmhd->cbData = 0; 00525 return (1); 00526 } 00527 00528 pdmhd->cbData = (DWORD)UserGlobalSize(hDDE); 00529 if (pdmhd->cbData) { 00530 USERGLOBALLOCK(hDDE, pb); 00531 if (pb == NULL) { 00532 pdmhd->cbData = 0; 00533 } else { 00534 RtlCopyMemory(&pdmhd->Data, pb, min(pdmhd->cbData, 00535 sizeof(DDEML_MSG_HOOK_DATA) - 00536 FIELD_OFFSET(DDEML_MSG_HOOK_DATA, Data))); 00537 USERGLOBALUNLOCK(hDDE); 00538 } 00539 } 00540 return (1); 00541 }

HANDLE AddInstance HANDLE  hInst  ) 
 

Definition at line 40 of file instance.c.

References aInstance, cInstAllocated, CreateHandle(), DDEMLAlloc, DDEMLReAlloc, HTYPE_INSTANCE, iFirstFreeInst, INST_GROW_COUNT, MAX_INST, and UINT.

Referenced by InternalDdeInitialize().

00042 { 00043 int i, iNextFree; 00044 PHANDLE ph; 00045 00046 if (iFirstFreeInst >= cInstAllocated) { 00047 if (cInstAllocated == 0) { 00048 aInstance = (PHANDLE)DDEMLAlloc(sizeof(HANDLE) * INST_GROW_COUNT); 00049 } else { 00050 aInstance = (PHANDLE)DDEMLReAlloc((PVOID)aInstance, 00051 sizeof(HANDLE) * (cInstAllocated + INST_GROW_COUNT)); 00052 } 00053 if (aInstance == 0) { 00054 return (0); 00055 } 00056 ph = &aInstance[cInstAllocated]; 00057 i = cInstAllocated + 1; 00058 while (i <= cInstAllocated + INST_GROW_COUNT) { 00059 *ph++ = (HANDLE)(UINT_PTR)(UINT)i++; 00060 } 00061 cInstAllocated += INST_GROW_COUNT; 00062 } 00063 iNextFree = HandleToUlong(aInstance[iFirstFreeInst]); 00064 if (iNextFree > MAX_INST) { 00065 /* 00066 * Instance limit for this process exceeded! 00067 */ 00068 return(0); 00069 } 00070 aInstance[iFirstFreeInst] = hInstServer; 00071 i = iFirstFreeInst; 00072 iFirstFreeInst = iNextFree; 00073 return (CreateHandle(0, HTYPE_INSTANCE, i)); 00074 }

BOOL AddLink PCONV_INFO  pcoi,
GATOM  gaItem,
WORD  wFmt,
WORD  wType
 

Definition at line 23 of file util.c.

References tagCONV_INFO::aLinks, BOOL, tagCONV_INFO::cLinks, DDEMLAlloc, DDEMLReAlloc, FALSE, tagLINK_COUNT::gaItem, GlobalToLocalAtom(), IncGlobalAtomCount(), IncLocalAtomCount(), tagADVISE_LINK::laItem, tagLINK_COUNT::laItem, LATOM, tagLINK_COUNT::laTopic, tagCONV_INFO::laTopic, tagLINK_COUNT::next, NULL, tagCONV_INFO::pcii, tagADVISE_LINK::pLinkCount, tagCL_INSTANCE_INFO::pLinkCount, SetLastDDEMLError(), tagADVISE_LINK::state, tagCONV_INFO::state, tagLINK_COUNT::Total, TRUE, tagADVISE_LINK::wFmt, tagLINK_COUNT::wFmt, and tagADVISE_LINK::wType.

Referenced by ClRespAdviseAck(), and SvSpontAdvise().

00028 { 00029 PADVISE_LINK aLinkNew; 00030 int cLinks; 00031 LATOM la; 00032 PCL_INSTANCE_INFO pcii; 00033 00034 /* 00035 * if the link already exists, update its flags, otherwise create a 00036 * new one. 00037 */ 00038 00039 aLinkNew = pcoi->aLinks; 00040 cLinks = pcoi->cLinks; 00041 la = GlobalToLocalAtom(gaItem); // aLinkNew copy 00042 while (cLinks) { 00043 if (aLinkNew->laItem == la && aLinkNew->wFmt == wFmt) { 00044 aLinkNew->wType = wType; 00045 aLinkNew->state = 0; 00046 DeleteAtom(la); 00047 return TRUE; 00048 } 00049 aLinkNew++; 00050 cLinks--; 00051 } 00052 00053 if (pcoi->aLinks == NULL) { 00054 aLinkNew = (PADVISE_LINK)DDEMLAlloc(sizeof(ADVISE_LINK)); 00055 } else { 00056 aLinkNew = (PADVISE_LINK)DDEMLReAlloc(pcoi->aLinks, 00057 sizeof(ADVISE_LINK) * (pcoi->cLinks + 1)); 00058 } 00059 if (aLinkNew == NULL) { 00060 SetLastDDEMLError(pcoi->pcii, DMLERR_MEMORY_ERROR); 00061 DeleteAtom(la); 00062 return FALSE; 00063 } 00064 pcoi->aLinks = aLinkNew; 00065 aLinkNew += pcoi->cLinks; 00066 pcoi->cLinks++; 00067 00068 aLinkNew->laItem = la; 00069 aLinkNew->wFmt = wFmt; 00070 aLinkNew->wType = wType; 00071 aLinkNew->state = 0; 00072 00073 if (!(pcoi->state & ST_CLIENT)) { 00074 /* 00075 * Add count for this link 00076 */ 00077 pcii = pcoi->pcii; 00078 00079 for (aLinkNew->pLinkCount = pcii->pLinkCount; 00080 aLinkNew->pLinkCount; 00081 aLinkNew->pLinkCount = aLinkNew->pLinkCount->next) { 00082 if (aLinkNew->pLinkCount->laTopic == pcoi->laTopic && 00083 aLinkNew->pLinkCount->gaItem == gaItem && 00084 aLinkNew->pLinkCount->wFmt == wFmt) { 00085 aLinkNew->pLinkCount->Total++; 00086 return(TRUE); 00087 } 00088 } 00089 00090 /* 00091 * Not found - add an entry 00092 */ 00093 aLinkNew->pLinkCount = (PLINK_COUNT)DDEMLAlloc(sizeof(LINK_COUNT)); 00094 if (aLinkNew->pLinkCount == NULL) { 00095 SetLastDDEMLError(pcoi->pcii, DMLERR_MEMORY_ERROR); 00096 return FALSE; 00097 } 00098 aLinkNew->pLinkCount->next = pcii->pLinkCount; 00099 pcii->pLinkCount = aLinkNew->pLinkCount; 00100 00101 aLinkNew->pLinkCount->laTopic = IncLocalAtomCount(pcoi->laTopic); // LinkCount copy 00102 aLinkNew->pLinkCount->gaItem = IncGlobalAtomCount(gaItem); // LinkCount copy 00103 aLinkNew->pLinkCount->laItem = IncLocalAtomCount(la); // LinkCount copy 00104 00105 aLinkNew->pLinkCount->wFmt = wFmt; 00106 aLinkNew->pLinkCount->Total = 1; 00107 // doesn't matter: aLinkNew->pLinkCount->Count = 0; 00108 } 00109 00110 return TRUE; 00111 }

HANDLE AllocAndSetDDEData LPBYTE  pSrc,
DWORD  cb,
WORD  wStatus,
WORD  wFmt
 

Definition at line 1479 of file stdptcl.c.

References DWORD, FALSE, NULL, PBYTE, UserGlobalAlloc, USERGLOBALLOCK, USERGLOBALUNLOCK, tagDDE_DATA::wFmt, WOWGLOBALFREE, and tagDDE_DATA::wStatus.

Referenced by ClStartAdvise(), DdeClientTransaction(), and SvSpontRequest().

01484 { 01485 HANDLE hDDE; 01486 DWORD cbOff; 01487 PDDE_DATA pdde; 01488 DWORD fCopyIt; 01489 01490 if (cb == -1) { 01491 hDDE = (HANDLE)pSrc; 01492 cb = (DWORD)GlobalSize(hDDE); 01493 fCopyIt = FALSE; 01494 } else { 01495 hDDE = UserGlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE | GMEM_ZEROINIT, 01496 (wFmt ? (cb + 4) : cb)); 01497 fCopyIt = (pSrc != NULL); 01498 } 01499 if (hDDE == NULL) { 01500 return(0); 01501 } 01502 USERGLOBALLOCK(hDDE, pdde); 01503 if (pdde == NULL) { 01504 WOWGLOBALFREE(hDDE); 01505 return (0); 01506 } 01507 if (wFmt) { 01508 pdde->wStatus = wStatus; 01509 pdde->wFmt = wFmt; 01510 cbOff = 4; 01511 } else { 01512 cbOff = 0; 01513 } 01514 if (fCopyIt) { 01515 RtlCopyMemory((PBYTE)pdde + cbOff, pSrc, cb); 01516 } 01517 USERGLOBALUNLOCK(hDDE); 01518 01519 return (hDDE); 01520 }

BOOL ApplyFreeDataHandle HANDLE  hData  ) 
 

Definition at line 451 of file hdata.c.

References BOOL, CheckDDECritOut, EnterDDECrit, FALSE, InternalFreeDataHandle(), and LeaveDDECrit.

Referenced by DdeUninitialize().

00453 { 00454 BOOL fRet; 00455 00456 CheckDDECritOut; 00457 EnterDDECrit; 00458 fRet = InternalFreeDataHandle((HDDEDATA)hData, FALSE); 00459 LeaveDDECrit; 00460 return(fRet); 00461 }

VOID ApplyFunctionToObjects DWORD  ExpectedType,
DWORD  ExpectedInstance,
PFNHANDLEAPPLY  pfn
 

Definition at line 263 of file handles.c.

References aHandleEntry, cHandlesAllocated, CheckDDECritIn, CheckDDECritOut, EnterDDECrit, tagCHANDLEENTRY::handle, HTYPE_ANY, InstFromHandle, LeaveDDECrit, TypeFromHandle, and VOID().

Referenced by DdeUninitialize().

00267 { 00268 PCHANDLEENTRY phe; 00269 00270 CheckDDECritIn; 00271 00272 if (!cHandlesAllocated) { 00273 return; 00274 } 00275 phe = &aHandleEntry[cHandlesAllocated]; 00276 00277 do { 00278 phe--; 00279 if (phe->handle != 0 && 00280 (ExpectedType == HTYPE_ANY || 00281 ExpectedType == TypeFromHandle(phe->handle)) && 00282 (ExpectedInstance == HTYPE_ANY || 00283 ExpectedInstance == InstFromHandle(phe->handle))) { 00284 LeaveDDECrit; 00285 CheckDDECritOut; 00286 (*pfn)(phe->handle); 00287 EnterDDECrit; 00288 } 00289 } while (phe != aHandleEntry); 00290 }

VOID BestSetLastDDEMLError DWORD  error  ) 
 

Definition at line 336 of file handles.c.

References aHandleEntry, cHandlesAllocated, CheckDDECritIn, tagCHANDLEENTRY::dwData, tagCHANDLEENTRY::handle, HTYPE_INSTANCE, SetLastDDEMLError(), TypeFromHandle, and VOID().

Referenced by DdeAddData(), DdeClientTransaction(), DdeCreateDataHandle(), DdeDisconnect(), DdeDisconnectList(), DdeEnableCallback(), DdeFreeStringHandle(), DdeGetData(), DdeImpersonateClient(), DdeKeepStringHandle(), DdeNameService(), DdePostAdvise(), DdeQueryNextServer(), DdeReconnect(), DdeUninitialize(), InternalDdeCreateStringHandle(), InternalDdeQueryString(), and ValidateTransaction().

00338 { 00339 PCHANDLEENTRY phe; 00340 00341 CheckDDECritIn; 00342 00343 if (!cHandlesAllocated) { 00344 return; 00345 } 00346 phe = &aHandleEntry[cHandlesAllocated]; 00347 do { 00348 phe--; 00349 if (phe->handle != 0 && TypeFromHandle(phe->handle) == HTYPE_INSTANCE) { 00350 SetLastDDEMLError((PCL_INSTANCE_INFO)phe->dwData, error); 00351 } 00352 } while (phe != aHandleEntry); 00353 }

BOOL CheckForQueuedMessages PCONV_INFO  pcoi  ) 
 

Definition at line 664 of file ddemlwp.c.

References BOOL, CheckDDECritIn, _CLIENTINFO::CI_flags, CI_PROCESSING_QUEUE, _CLIENTINFO::cInDDEMLCallback, tagCONV_INFO::cLocks, DDEMLFree, tagCONV_INFO::dmqIn, tagCONV_INFO::dmqOut, FALSE, GetClientInfo, tagDDE_MESSAGE_QUEUE::lParam, tagDDE_MESSAGE_QUEUE::msg, tagDDE_MESSAGE_QUEUE::next, NULL, ProcessSyncDDEMessage(), tagCONV_INFO::state, and TRUE.

Referenced by DdeEnableCallback(), ProcessAsyncDDEMsg(), and SetEnableState().

00666 { 00667 PDDE_MESSAGE_QUEUE pdmq; 00668 BOOL fRet = FALSE; 00669 PCLIENTINFO pci; 00670 00671 CheckDDECritIn; 00672 00673 if (pcoi->state & ST_PROCESSING) { // recursion prevention 00674 return(FALSE); 00675 } 00676 00677 UserAssert(pcoi->cLocks); 00678 00679 pci = GetClientInfo(); 00680 00681 pcoi->state |= ST_PROCESSING; 00682 while (!(pcoi->state & ST_BLOCKED) && 00683 pcoi->dmqOut != NULL && 00684 !pci->cInDDEMLCallback) { 00685 pci->CI_flags |= CI_PROCESSING_QUEUE; 00686 if (ProcessSyncDDEMessage(pcoi, pcoi->dmqOut->msg, pcoi->dmqOut->lParam)) { 00687 fRet = TRUE; 00688 pdmq = pcoi->dmqOut; 00689 pcoi->dmqOut = pcoi->dmqOut->next; 00690 if (pcoi->dmqOut == NULL) { 00691 pcoi->dmqIn = NULL; 00692 } 00693 DDEMLFree(pdmq); 00694 } 00695 pci->CI_flags &= ~CI_PROCESSING_QUEUE; 00696 } 00697 pcoi->state &= ~ST_PROCESSING; 00698 return(fRet); 00699 }

BOOL ClRespAdviseAck PXACT_INFO  pxi,
UINT  msg,
LPARAM  lParam
 

Definition at line 190 of file stdptcl.c.

References AddLink(), BOOL, DDEMLFree, FALSE, FreeDDElParam(), tagXACT_INFO::gaItem, GATOM, tagXACT_INFO::hDDESent, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, L, tagCONV_INFO::laService, tagCONV_INFO::laTopic, MONLINK, msg, tagCONV_INFO::pcii, PCL_CONV_INFO, tagXACT_INFO::pcoi, SpontaneousClientMessage(), tagXACT_INFO::state, tagCONV_INFO::state, TransactionComplete(), TRUE, UnlinkTransaction(), UnpackDDElParam(), tagXACT_INFO::wFmt, WOWGLOBALFREE, tagXACT_INFO::wStatus, and tagXACT_INFO::wType.

Referenced by ClStartAdvise().

00194 { 00195 UINT_PTR uiLo, uiHi; 00196 00197 if (msg) { 00198 if (msg != WM_DDE_ACK) { 00199 return (SpontaneousClientMessage((PCL_CONV_INFO)pxi->pcoi, msg, lParam)); 00200 } 00201 00202 UnpackDDElParam(WM_DDE_ACK, lParam, &uiLo, &uiHi); 00203 #if DBG 00204 if ((GATOM)uiHi != pxi->gaItem) { 00205 return (SpontaneousClientMessage((PCL_CONV_INFO)pxi->pcoi, msg, lParam)); 00206 } 00207 #endif 00208 00209 GlobalDeleteAtom((ATOM)uiHi); // message copy 00210 00211 pxi->state = XST_ADVACKRCVD; 00212 pxi->wStatus = (WORD)uiLo; 00213 00214 if (pxi->wStatus & DDE_FACK) { 00215 if (AddLink(pxi->pcoi, pxi->gaItem, pxi->wFmt, 00216 (WORD)((pxi->wType << 12) & (DDE_FACKREQ | DDE_FDEFERUPD)))) { 00217 // 00218 // only server side reports links on local conversations. 00219 // 00220 if (!(pxi->pcoi->state & ST_ISLOCAL)) { 00221 MONLINK(pxi->pcoi->pcii, TRUE, (WORD)uiLo & DDE_FDEFERUPD, 00222 pxi->pcoi->laService, pxi->pcoi->laTopic, pxi->gaItem, 00223 pxi->wFmt, FALSE, (HCONV)pxi->pcoi->hwndPartner, 00224 (HCONV)pxi->pcoi->hwndConv); 00225 } 00226 } else { 00227 pxi->wStatus = 0; // memory failure - fake a NACK. 00228 } 00229 } else { 00230 WOWGLOBALFREE(pxi->hDDESent); // Nack free. 00231 } 00232 00233 if (TransactionComplete(pxi, 00234 (pxi->wStatus & DDE_FACK) ? (HDDEDATA)1L : (HDDEDATA)0L)) { 00235 goto Cleanup; 00236 } 00237 } else { 00238 Cleanup: 00239 GlobalDeleteAtom(pxi->gaItem); // pxi copy 00240 UnlinkTransaction(pxi); 00241 DDEMLFree(pxi); 00242 } 00243 if (msg) { 00244 FreeDDElParam(msg, lParam); 00245 } 00246 return (TRUE); 00247 }

BOOL ClRespExecuteAck PXACT_INFO  pxi,
UINT  msg,
LPARAM  lParam
 

Definition at line 958 of file stdptcl.c.

References BOOL, DDEMLFree, DestroyHandle(), FreeDDElParam(), tagXACT_INFO::gaItem, tagXACT_INFO::hDDESent, tagXACT_INFO::hXact, msg, tagXACT_INFO::pcoi, SpontaneousClientMessage(), tagXACT_INFO::state, TransactionComplete(), TRUE, UnlinkTransaction(), UnpackDDElParam(), WOWGLOBALFREE, and tagXACT_INFO::wStatus.

Referenced by ClStartExecute().

00962 { 00963 UINT_PTR uiLo, uiHi; 00964 00965 if (msg) { 00966 if (msg != WM_DDE_ACK) { 00967 return (SpontaneousClientMessage((PCL_CONV_INFO)pxi->pcoi, msg, lParam)); 00968 } 00969 00970 UnpackDDElParam(WM_DDE_ACK, lParam, &uiLo, &uiHi); 00971 if (uiHi != HandleToUlong(pxi->hDDESent)) { 00972 return (SpontaneousClientMessage((PCL_CONV_INFO)pxi->pcoi, msg, lParam)); 00973 } 00974 00975 WOWGLOBALFREE((HANDLE)uiHi); 00976 00977 pxi->state = XST_EXECACKRCVD; 00978 pxi->wStatus = (WORD)uiLo; 00979 00980 if (TransactionComplete(pxi, (HDDEDATA)(pxi->wStatus & DDE_FACK ? 1 : 0))) { 00981 goto Cleanup; 00982 } 00983 } else { 00984 Cleanup: 00985 GlobalDeleteAtom(pxi->gaItem); // pxi copy 00986 UnlinkTransaction(pxi); 00987 if (pxi->hXact) { 00988 DestroyHandle(pxi->hXact); 00989 } 00990 DDEMLFree(pxi); 00991 } 00992 if (msg) { 00993 FreeDDElParam(msg, lParam); 00994 } 00995 return (TRUE); 00996 }

BOOL ClRespPokeAck PXACT_INFO  pxi,
UINT  msg,
LPARAM  lParam
 

Definition at line 1116 of file stdptcl.c.

References BOOL, DDEMLFree, DestroyHandle(), FALSE, FreeDDEData(), FreeDDElParam(), tagXACT_INFO::gaItem, GATOM, tagXACT_INFO::hDDESent, tagXACT_INFO::hXact, msg, tagXACT_INFO::pcoi, SpontaneousClientMessage(), tagXACT_INFO::state, TransactionComplete(), TRUE, UnlinkTransaction(), UnpackDDElParam(), and tagXACT_INFO::wStatus.

Referenced by ClStartPoke().

01120 { 01121 UINT_PTR uiLo, uiHi; 01122 01123 if (msg) { 01124 if (msg != WM_DDE_ACK) { 01125 return (SpontaneousClientMessage((PCL_CONV_INFO)pxi->pcoi, msg, lParam)); 01126 } 01127 01128 UnpackDDElParam(WM_DDE_ACK, lParam, &uiLo, &uiHi); 01129 if ((GATOM)uiHi != pxi->gaItem) { 01130 return (SpontaneousClientMessage((PCL_CONV_INFO)pxi->pcoi, msg, lParam)); 01131 } 01132 01133 GlobalDeleteAtom((ATOM)uiHi); // message copy 01134 01135 pxi->state = XST_POKEACKRCVD; 01136 pxi->wStatus = (WORD)uiLo; 01137 01138 if (!((WORD)uiLo & DDE_FACK)) { 01139 // 01140 // NACKs make it our business to free the poked data. 01141 // 01142 FreeDDEData(pxi->hDDESent, FALSE, TRUE); 01143 } 01144 01145 if (TransactionComplete(pxi, 01146 (HDDEDATA)(pxi->wStatus & DDE_FACK ? 1 : 0))) { 01147 goto Cleanup; 01148 } 01149 } else { 01150 Cleanup: 01151 GlobalDeleteAtom(pxi->gaItem); // pxi copy 01152 UnlinkTransaction(pxi); 01153 if (pxi->hXact) { 01154 DestroyHandle(pxi->hXact); 01155 } 01156 DDEMLFree(pxi); 01157 } 01158 if (msg) { 01159 FreeDDElParam(msg, lParam); 01160 } 01161 return (TRUE); 01162 }

BOOL ClRespRequestData PXACT_INFO  pxi,
UINT  msg,
LPARAM  lParam
 

Definition at line 1294 of file stdptcl.c.

References BOOL, ClSpontAdviseData(), DDEMLFree, DWORD, ExtractDDEDataInfo(), FALSE, FreeDDEData(), FreeDDElParam(), tagXACT_INFO::gaItem, GATOM, tagXACT_INFO::hDDEResult, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, msg, PackAndPostMessage(), tagCONV_INFO::pcii, tagXACT_INFO::pcoi, SetLastDDEMLError(), SpontaneousClientMessage(), tagXACT_INFO::state, TransactionComplete(), TRUE, UnlinkTransaction(), UnpackDDElParam(), tagXACT_INFO::wFmt, and tagXACT_INFO::wStatus.

Referenced by ClStartRequest().

01298 { 01299 UINT_PTR uiLo, uiHi; 01300 WORD wFmt, wStatus; 01301 DWORD dwError; 01302 01303 if (msg) { 01304 switch (msg) { 01305 case WM_DDE_DATA: 01306 UnpackDDElParam(WM_DDE_DATA, lParam, (PUINT_PTR)&pxi->hDDEResult, &uiHi); 01307 if (!pxi->hDDEResult) { 01308 // must be an advise data message with NODATA. 01309 return (ClSpontAdviseData((PCL_CONV_INFO)pxi->pcoi, lParam)); 01310 } 01311 if (!ExtractDDEDataInfo(pxi->hDDEResult, &wStatus, &wFmt)) { 01312 return (ClSpontAdviseData((PCL_CONV_INFO)pxi->pcoi, lParam)); 01313 } 01314 if (!(wStatus & DDE_FREQUESTED)) { 01315 // must be advise data 01316 return (ClSpontAdviseData((PCL_CONV_INFO)pxi->pcoi, lParam)); 01317 } 01318 if (wStatus & DDE_FACKREQ) { 01319 01320 // if DDE_FRELEASE is not set, and this is a synchronous 01321 // transaction, we need to make a copy here so the user 01322 // can free at his leisure. 01323 01324 // reuse uiHi - message copy 01325 dwError = PackAndPostMessage(pxi->pcoi->hwndPartner, 01326 WM_DDE_DATA, WM_DDE_ACK, pxi->pcoi->hwndConv, 0, 01327 pxi->wFmt == wFmt && pxi->gaItem == (GATOM)uiHi ? 01328 DDE_FACK : 0, uiHi); 01329 if (dwError) { 01330 SetLastDDEMLError(pxi->pcoi->pcii, dwError); 01331 } 01332 } else { 01333 GlobalDeleteAtom((GATOM)uiHi); // message copy 01334 } 01335 if (wFmt != pxi->wFmt || (GATOM)uiHi != pxi->gaItem) { 01336 /* 01337 * BOGUS returned data! Just free it and make it look like 01338 * a NACK 01339 */ 01340 FreeDDEData(pxi->hDDEResult, FALSE, TRUE); 01341 pxi->hDDEResult = 0; 01342 if (TransactionComplete(pxi, 0)) { 01343 goto Cleanup; 01344 } 01345 } else { 01346 if (TransactionComplete(pxi, (HDDEDATA)-1)) { 01347 goto Cleanup; 01348 } 01349 } 01350 break; 01351 01352 case WM_DDE_ACK: 01353 UnpackDDElParam(WM_DDE_ACK, lParam, &uiLo, &uiHi); 01354 if ((GATOM)uiHi != pxi->gaItem) { 01355 return(SpontaneousClientMessage((PCL_CONV_INFO)pxi->pcoi, msg, lParam)); 01356 } 01357 pxi->state = XST_DATARCVD; 01358 pxi->wStatus = (WORD)uiLo; 01359 GlobalDeleteAtom((GATOM)uiHi); // message copy 01360 if (TransactionComplete(pxi, 0)) { 01361 goto Cleanup; 01362 } 01363 break; 01364 01365 default: 01366 return (SpontaneousClientMessage((PCL_CONV_INFO)pxi->pcoi, msg, lParam)); 01367 } 01368 01369 } else { 01370 01371 Cleanup: 01372 GlobalDeleteAtom(pxi->gaItem); // pxi copy 01373 if (pxi->hDDEResult) { 01374 FreeDDEData(pxi->hDDEResult, FALSE, TRUE); // free message data 01375 } 01376 UnlinkTransaction(pxi); 01377 DDEMLFree(pxi); 01378 } 01379 if (msg) { 01380 FreeDDElParam(msg, lParam); 01381 } 01382 return (TRUE); 01383 }

BOOL ClRespUnadviseAck PXACT_INFO  pxi,
UINT  msg,
LPARAM  lParam
 

Definition at line 719 of file stdptcl.c.

References tagCONV_INFO::aLinks, BOOL, tagCONV_INFO::cLinks, DDEMLFree, DestroyHandle(), FreeDDElParam(), tagXACT_INFO::gaItem, GATOM, GlobalToLocalAtom(), tagXACT_INFO::hXact, tagADVISE_LINK::laItem, LATOM, msg, tagXACT_INFO::pcoi, SpontaneousClientMessage(), tagXACT_INFO::state, TransactionComplete(), TRUE, UnlinkTransaction(), UnpackDDElParam(), tagXACT_INFO::wFmt, tagADVISE_LINK::wFmt, and tagXACT_INFO::wStatus.

Referenced by ClStartUnadvise().

00723 { 00724 UINT_PTR uiLo, uiHi; 00725 LATOM al; 00726 PADVISE_LINK aLink; 00727 int iLink; 00728 00729 if (msg) { 00730 if (msg != WM_DDE_ACK) { 00731 return (SpontaneousClientMessage((PCL_CONV_INFO)pxi->pcoi, msg, lParam)); 00732 } 00733 00734 UnpackDDElParam(WM_DDE_ACK, lParam, &uiLo, &uiHi); 00735 if ((GATOM)uiHi != pxi->gaItem) { 00736 return (SpontaneousClientMessage((PCL_CONV_INFO)pxi->pcoi, msg, lParam)); 00737 } 00738 00739 al = GlobalToLocalAtom((ATOM)uiHi); 00740 for (aLink = pxi->pcoi->aLinks, iLink = 0; 00741 iLink < pxi->pcoi->cLinks; 00742 ) { 00743 if (aLink->laItem == al && 00744 (pxi->wFmt == 0 || aLink->wFmt == pxi->wFmt)) { 00745 DeleteAtom(al); // aLink copy 00746 if (--pxi->pcoi->cLinks) { 00747 memmove((LPSTR)aLink, (LPSTR)(aLink + 1), 00748 sizeof(ADVISE_LINK) * (pxi->pcoi->cLinks - iLink)); 00749 } 00750 } else { 00751 aLink++; 00752 iLink++; 00753 } 00754 } 00755 DeleteAtom(al); // local copy 00756 GlobalDeleteAtom((ATOM)uiHi); // message copy 00757 00758 pxi->state = XST_UNADVACKRCVD; 00759 pxi->wStatus = (WORD)uiLo; 00760 if (TransactionComplete(pxi, (HDDEDATA)1)) { 00761 goto Cleanup; 00762 } 00763 } else { 00764 Cleanup: 00765 GlobalDeleteAtom(pxi->gaItem); // pxi copy 00766 UnlinkTransaction(pxi); 00767 if (pxi->hXact) { 00768 DestroyHandle(pxi->hXact); 00769 } 00770 DDEMLFree(pxi); 00771 } 00772 if (msg) { 00773 FreeDDElParam(msg, lParam); 00774 } 00775 return (TRUE); 00776 }

BOOL ClSpontAdviseData PCL_CONV_INFO  pci,
LPARAM  lParam
 

Definition at line 362 of file stdptcl.c.

References tagCONV_INFO::aLinks, BOOL, tagCL_CONV_INFO::ci, tagCONV_INFO::cLinks, DoCallback(), DWORD, FALSE, FreeDDEData(), FreeDDElParam(), GATOM, GlobalToLocalAtom(), tagCONV_INFO::hConv, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, InternalCreateDataHandle(), tagADVISE_LINK::laItem, LATOM, tagCONV_INFO::laTopic, NORMAL_HSZ_FROM_LATOM, NULL, PackAndPostMessage(), PADVISE_LINK, tagCONV_INFO::pcii, SetLastDDEMLError(), TRUE, UnpackAndFreeDDEMLDataHandle(), UnpackDDElParam(), USERGLOBALLOCK, USERGLOBALUNLOCK, tagDDE_DATA::wFmt, tagADVISE_LINK::wFmt, tagDDE_DATA::wStatus, and tagADVISE_LINK::wType.

Referenced by ClRespRequestData(), and SpontaneousClientMessage().

00365 { 00366 UINT_PTR uiHi; 00367 DWORD dwError; 00368 HANDLE hDDE = 0; 00369 HDDEDATA hData, hDataReturn; 00370 PDDE_DATA pdde; 00371 WORD wFmt; 00372 WORD wStatus; 00373 LATOM la; 00374 PADVISE_LINK paLink; 00375 int iLink; 00376 00377 UnpackDDElParam(WM_DDE_DATA, lParam, (PUINT_PTR)&hDDE, &uiHi); 00378 UserAssert(!hDDE || GlobalSize(hDDE)); 00379 wFmt = 0; 00380 wStatus = 0; 00381 hDataReturn = 0; 00382 la = GlobalToLocalAtom((GATOM)uiHi); 00383 if (hDDE) { 00384 USERGLOBALLOCK(hDDE, pdde); 00385 if (pdde == NULL) { 00386 hData = 0; 00387 } else { 00388 wFmt = pdde->wFmt; 00389 wStatus = pdde->wStatus; 00390 USERGLOBALUNLOCK(hDDE); 00391 00392 /* 00393 * if data is coming in, create a data handle for the app 00394 */ 00395 hData = InternalCreateDataHandle(pci->ci.pcii, (LPBYTE)hDDE, 00396 (DWORD)-1, 0, HDATA_NOAPPFREE | HDATA_READONLY, 0, 0); 00397 } 00398 if (hData) { 00399 hDataReturn = DoCallback(pci->ci.pcii, XTYP_ADVDATA, 00400 wFmt, pci->ci.hConv, 00401 NORMAL_HSZ_FROM_LATOM(pci->ci.laTopic), 00402 NORMAL_HSZ_FROM_LATOM(la), 00403 hData, 0, 0); 00404 if (hDataReturn != CBR_BLOCK) { 00405 UnpackAndFreeDDEMLDataHandle(hData, FALSE); 00406 if (((ULONG_PTR)hDataReturn & DDE_FACK) || !(wStatus & DDE_FACKREQ)) { 00407 /* 00408 * Nacked Advise data with fAckReq set is server's 00409 * responsibility to free! 00410 */ 00411 FreeDDEData(hDDE, FALSE, TRUE); 00412 } 00413 } 00414 } 00415 } else { 00416 /* 00417 * WARM LINK CASE 00418 * 00419 * Search through the client's link info to find what formats this 00420 * puppy is on. We let the client know for each format being supported 00421 * on this item that is warm-linked. The last hDataReturn determines 00422 * the ACK returned - for lack of a better method. 00423 */ 00424 for (paLink = pci->ci.aLinks, iLink = 0; iLink < pci->ci.cLinks; iLink++, paLink++) { 00425 if ((paLink->laItem == la) && (paLink->wType & DDE_FDEFERUPD)) { 00426 hDataReturn = DoCallback(pci->ci.pcii, XTYP_ADVDATA, 00427 paLink->wFmt, pci->ci.hConv, 00428 NORMAL_HSZ_FROM_LATOM(pci->ci.laTopic), 00429 NORMAL_HSZ_FROM_LATOM(la), 00430 0, 0, 0); 00431 if (hDataReturn == CBR_BLOCK) { 00432 DeleteAtom(la); 00433 return (FALSE); 00434 } 00435 } 00436 } 00437 } 00438 DeleteAtom(la); 00439 if (hDataReturn == CBR_BLOCK) { 00440 return (FALSE); 00441 } 00442 00443 if (wStatus & DDE_FACKREQ) { 00444 00445 (ULONG_PTR)hDataReturn &= ~DDE_FACKRESERVED; 00446 // reuse uiHi 00447 if (dwError = PackAndPostMessage(pci->ci.hwndPartner, WM_DDE_DATA, 00448 WM_DDE_ACK, pci->ci.hwndConv, lParam, (UINT_PTR)hDataReturn, uiHi)) { 00449 SetLastDDEMLError(pci->ci.pcii, dwError); 00450 } 00451 } else { 00452 GlobalDeleteAtom((ATOM)uiHi); // data message copy 00453 FreeDDElParam(WM_DDE_DATA, lParam); // not reused so free it. 00454 } 00455 return (TRUE); 00456 }

BOOL ClStartAdvise PXACT_INFO  pxi  ) 
 

Definition at line 67 of file stdptcl.c.

References AllocAndSetDDEData(), BOOL, ClRespAdviseAck(), DDE_DATA, DWORD, FALSE, FNRESPONSE, tagXACT_INFO::gaItem, tagXACT_INFO::hDDESent, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, IncGlobalAtomCount(), LinkTransaction(), NULL, PackAndPostMessage(), tagCONV_INFO::pcii, tagXACT_INFO::pcoi, tagXACT_INFO::pfnResponse, PXACT_INFO, SetLastDDEMLError(), tagXACT_INFO::state, TRUE, tagXACT_INFO::wFmt, WOWGLOBALFREE, and tagXACT_INFO::wType.

Referenced by DdeClientTransaction(), and DdeReconnect().

00069 { 00070 DWORD dwError; 00071 00072 // 00073 // protocol quirk: DDE_FRELEASE is always assumed set in a WM_DDE_ADVISE 00074 // message. We set it here just in case the dork on the other end 00075 // pays attention to it. 00076 // 00077 pxi->hDDESent = AllocAndSetDDEData(NULL, sizeof(DDE_DATA), 00078 (WORD)(((pxi->wType << 12) & (DDE_FDEFERUPD | DDE_FACKREQ)) | DDE_FRELEASE), 00079 pxi->wFmt); 00080 if (!pxi->hDDESent) { 00081 SetLastDDEMLError(pxi->pcoi->pcii, DMLERR_MEMORY_ERROR); 00082 return (FALSE); 00083 } 00084 00085 IncGlobalAtomCount(pxi->gaItem); // message copy 00086 dwError = PackAndPostMessage(pxi->pcoi->hwndPartner, 0, WM_DDE_ADVISE, 00087 pxi->pcoi->hwndConv, 0, HandleToUlong(pxi->hDDESent), pxi->gaItem); 00088 if (dwError) { 00089 SetLastDDEMLError(pxi->pcoi->pcii, dwError); 00090 WOWGLOBALFREE(pxi->hDDESent); 00091 pxi->hDDESent = 0; 00092 GlobalDeleteAtom(pxi->gaItem); // message copy 00093 return (FALSE); 00094 } 00095 00096 pxi->state = XST_ADVSENT; 00097 pxi->pfnResponse = (FNRESPONSE)ClRespAdviseAck; 00098 LinkTransaction(pxi); 00099 return (TRUE); 00100 }

BOOL ClStartExecute PXACT_INFO  pxi  ) 
 

Definition at line 852 of file stdptcl.c.

References BOOL, ClRespExecuteAck(), DWORD, FALSE, tagCL_INSTANCE_INFO::flags, FNRESPONSE, tagXACT_INFO::hDDESent, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, IIF_UNICODE, LinkTransaction(), MaybeTranslateExecuteData(), PackAndPostMessage(), tagCONV_INFO::pcii, tagXACT_INFO::pcoi, tagXACT_INFO::pfnResponse, SetLastDDEMLError(), tagCONV_INFO::state, tagXACT_INFO::state, and TRUE.

Referenced by DdeClientTransaction().

00854 { 00855 DWORD dwError; 00856 00857 pxi->hDDESent = MaybeTranslateExecuteData(pxi->hDDESent, 00858 pxi->pcoi->pcii->flags & IIF_UNICODE, 00859 pxi->pcoi->state & ST_UNICODE_EXECUTE, 00860 TRUE); 00861 00862 dwError = PackAndPostMessage(pxi->pcoi->hwndPartner, 0, WM_DDE_EXECUTE, 00863 pxi->pcoi->hwndConv, 0, 0, HandleToUlong(pxi->hDDESent)); 00864 if (dwError) { 00865 SetLastDDEMLError(pxi->pcoi->pcii, dwError); 00866 return (FALSE); 00867 } 00868 pxi->state = XST_EXECSENT; 00869 pxi->pfnResponse = (FNRESPONSE)ClRespExecuteAck; 00870 LinkTransaction(pxi); 00871 return (TRUE); 00872 }

BOOL ClStartPoke PXACT_INFO  pxi  ) 
 

Definition at line 1012 of file stdptcl.c.

References BOOL, ClRespPokeAck(), DWORD, FALSE, FNRESPONSE, tagXACT_INFO::gaItem, tagXACT_INFO::hDDESent, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, IncGlobalAtomCount(), LinkTransaction(), PackAndPostMessage(), tagCONV_INFO::pcii, tagXACT_INFO::pcoi, tagXACT_INFO::pfnResponse, SetLastDDEMLError(), tagXACT_INFO::state, and TRUE.

Referenced by DdeClientTransaction().

01014 { 01015 DWORD dwError; 01016 01017 IncGlobalAtomCount(pxi->gaItem); // message copy 01018 dwError = PackAndPostMessage(pxi->pcoi->hwndPartner, 0, WM_DDE_POKE, 01019 pxi->pcoi->hwndConv, 0, HandleToUlong(pxi->hDDESent), pxi->gaItem); 01020 if (dwError) { 01021 SetLastDDEMLError(pxi->pcoi->pcii, dwError); 01022 GlobalDeleteAtom(pxi->gaItem); // message copy 01023 return (FALSE); 01024 } 01025 01026 pxi->state = XST_POKESENT; 01027 pxi->pfnResponse = (FNRESPONSE)ClRespPokeAck; 01028 LinkTransaction(pxi); 01029 return (TRUE); 01030 }

BOOL ClStartRequest PXACT_INFO  pxi  ) 
 

Definition at line 1176 of file stdptcl.c.

References BOOL, ClRespRequestData(), DWORD, FALSE, FNRESPONSE, tagXACT_INFO::gaItem, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, IncGlobalAtomCount(), LinkTransaction(), PackAndPostMessage(), tagCONV_INFO::pcii, tagXACT_INFO::pcoi, tagXACT_INFO::pfnResponse, SetLastDDEMLError(), tagXACT_INFO::state, TRUE, and tagXACT_INFO::wFmt.

Referenced by DdeClientTransaction().

01178 { 01179 DWORD dwError; 01180 01181 IncGlobalAtomCount(pxi->gaItem); // message copy 01182 dwError = PackAndPostMessage(pxi->pcoi->hwndPartner, 0, WM_DDE_REQUEST, 01183 pxi->pcoi->hwndConv, 0, pxi->wFmt, pxi->gaItem); 01184 if (dwError) { 01185 SetLastDDEMLError(pxi->pcoi->pcii, dwError); 01186 GlobalDeleteAtom(pxi->gaItem); // message copy 01187 return (FALSE); 01188 } 01189 01190 pxi->state = XST_REQSENT; 01191 pxi->pfnResponse = (FNRESPONSE)ClRespRequestData; 01192 LinkTransaction(pxi); 01193 return (TRUE); 01194 }

BOOL ClStartUnadvise PXACT_INFO  pxi  ) 
 

Definition at line 561 of file stdptcl.c.

References BOOL, ClRespUnadviseAck(), DWORD, FALSE, FNRESPONSE, tagXACT_INFO::gaItem, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, IncGlobalAtomCount(), tagCONV_INFO::laService, tagCONV_INFO::laTopic, LinkTransaction(), MONLINK, PackAndPostMessage(), tagCONV_INFO::pcii, tagXACT_INFO::pcoi, tagXACT_INFO::pfnResponse, SetLastDDEMLError(), tagCONV_INFO::state, tagXACT_INFO::state, TRUE, and tagXACT_INFO::wFmt.

Referenced by DdeClientTransaction().

00563 { 00564 DWORD dwError; 00565 00566 IncGlobalAtomCount(pxi->gaItem); // message copy 00567 dwError = PackAndPostMessage(pxi->pcoi->hwndPartner, 0, WM_DDE_UNADVISE, 00568 pxi->pcoi->hwndConv, 0, pxi->wFmt, pxi->gaItem); 00569 if (dwError) { 00570 SetLastDDEMLError(pxi->pcoi->pcii, dwError); 00571 GlobalDeleteAtom(pxi->gaItem); // message copy 00572 return (FALSE); 00573 } 00574 00575 // 00576 // only server side reports links on local conversations. 00577 // 00578 if (!(pxi->pcoi->state & ST_ISLOCAL)) { 00579 MONLINK(pxi->pcoi->pcii, FALSE, 0, 00580 pxi->pcoi->laService, pxi->pcoi->laTopic, pxi->gaItem, 00581 pxi->wFmt, FALSE, (HCONV)pxi->pcoi->hwndPartner, 00582 (HCONV)pxi->pcoi->hwndConv); 00583 } 00584 pxi->state = XST_UNADVSENT; 00585 pxi->pfnResponse = (FNRESPONSE)ClRespUnadviseAck; 00586 LinkTransaction(pxi); 00587 return (TRUE); 00588 }

PCL_CONV_INFO ConnectConv PCL_INSTANCE_INFO  pcii,
LATOM  laService,
LATOM  laTopic,
HWND  hwndTarget,
HWND  hwndSkip,
PCONVCONTEXT  pCC,
HCONVLIST  hConvList,
DWORD  clst
 

Definition at line 607 of file connect.c.

References tagSERVERINFO::atomSysClass, CheckDDECritIn, CheckDDECritOut, tagCL_CONV_INFO::ci, tagINIT_ENUM::clst, CLST_CONNECTED, DWORD, EnterDDECrit, EnumWindows(), Error, tagCL_INSTANCE_INFO::flags, GATOM, GetWindowLongPtr(), gpsi, GWL_CONVSTATE, GWLP_CHINST, GWLP_PCI, GWLP_SHINST, tagINIT_ENUM::hConvList, tagCL_INSTANCE_INFO::hInstClient, tagCL_INSTANCE_INFO::hInstServer, tagINIT_ENUM::hwndClient, tagCL_INSTANCE_INFO::hwndMother, tagCL_CONV_INFO::hwndReconnect, tagINIT_ENUM::hwndSkip, ICLS_DDEMLCLIENTA, ICLS_DDEMLCLIENTW, IIF_UNICODE, IncLocalAtomCount(), InitiateEnumerationProc(), L, tagCONV_INFO::laServiceRequested, tagINIT_ENUM::laServiceRequested, tagINIT_ENUM::laTopic, LeaveDDECrit, LocalToGlobalAtom(), tagINIT_ENUM::lParam, LPVOID, MONCONV, tagCL_INSTANCE_INFO::MonitorFlags, tagCONV_INFO::next, NtUserDdeSetQualityOfService(), NtUserDestroyWindow(), NULL, SendMessage(), SetConvContext(), SetLastDDEMLError(), SetWindowLongPtr(), and TRUE.

Referenced by DdeConnect(), DdeConnectList(), and DdeReconnect().

00616 { 00617 INIT_ENUM ie; 00618 PCL_CONV_INFO pci; 00619 PCONV_INFO pcoi; 00620 GATOM gaService, gaTopic; 00621 00622 CheckDDECritIn; 00623 00624 if (hwndTarget && hwndTarget == hwndSkip) { 00625 return(NULL); 00626 } 00627 00628 LeaveDDECrit; 00629 CheckDDECritOut; 00630 00631 if (pcii->flags & IIF_UNICODE) { 00632 ie.hwndClient = CreateWindowW((LPWSTR)(gpsi->atomSysClass[ICLS_DDEMLCLIENTW]), 00633 L"", 00634 WS_CHILD, 00635 0, 0, 0, 0, 00636 pcii->hwndMother, 00637 (HMENU)0, 00638 (HANDLE)0, 00639 (LPVOID)NULL); 00640 } else { 00641 ie.hwndClient = CreateWindowA((LPSTR)(gpsi->atomSysClass[ICLS_DDEMLCLIENTA]), 00642 "", 00643 WS_CHILD, 00644 0, 0, 0, 0, 00645 pcii->hwndMother, 00646 (HMENU)0, 00647 (HANDLE)0, 00648 (LPVOID)NULL); 00649 } 00650 00651 EnterDDECrit; 00652 00653 if (ie.hwndClient == 0) { 00654 return (NULL); 00655 } 00656 00657 if (pCC != NULL) { 00658 if (!NtUserDdeSetQualityOfService(ie.hwndClient, &(pCC->qos), NULL)) { 00659 SetLastDDEMLError(pcii, DMLERR_MEMORY_ERROR); 00660 goto Error; 00661 } 00662 } 00663 /* 00664 * Note that a pci will be created and allocated for each ACK recieved. 00665 */ 00666 SetConvContext(ie.hwndClient, (LONG *)pCC); 00667 SetWindowLong(ie.hwndClient, GWL_CONVSTATE, clst); 00668 SetWindowLongPtr(ie.hwndClient, GWLP_SHINST, (LONG_PTR)pcii->hInstServer); 00669 SetWindowLongPtr(ie.hwndClient, GWLP_CHINST, (LONG_PTR)pcii->hInstClient); 00670 00671 gaService = LocalToGlobalAtom(laService); 00672 gaTopic = LocalToGlobalAtom(laTopic); 00673 ie.lParam = MAKELONG(gaService, gaTopic); 00674 if (!hwndTarget) { 00675 ie.hwndSkip = hwndSkip; 00676 ie.laServiceRequested = laService; 00677 ie.laTopic = laTopic; 00678 ie.hConvList = hConvList; 00679 ie.clst = clst; 00680 } 00681 00682 LeaveDDECrit; 00683 00684 if (hwndTarget) { 00685 SendMessage(hwndTarget, WM_DDE_INITIATE, (WPARAM)ie.hwndClient, 00686 ie.lParam); 00687 } else { 00688 /* 00689 * Send this message to the nddeagnt app first so it can start 00690 * the netdde services BEFORE we do an enumeration of windows. 00691 * This lets things work the first time. NetDDEAgent caches 00692 * service status so this is the fastest way to do this. 00693 */ 00694 HWND hwndAgent = FindWindowW(SZ_NDDEAGNT_CLASS, SZ_NDDEAGNT_TITLE); 00695 if (hwndAgent) { 00696 SendMessage(hwndAgent, 00697 WM_DDE_INITIATE, (WPARAM)ie.hwndClient, ie.lParam); 00698 } 00699 EnumWindows((WNDENUMPROC)InitiateEnumerationProc, (LPARAM)&ie); 00700 } 00701 00702 EnterDDECrit; 00703 /* 00704 * hConvList may have been destroyed during the enumeration but we are 00705 * done with it now so no need to revalidate. 00706 */ 00707 00708 #if DBG 00709 { 00710 WCHAR sz[10]; 00711 00712 if (gaService && GlobalGetAtomName(gaService, sz, 10) == 0) { 00713 RIPMSG1(RIP_ERROR, "Bad Service Atom after Initiate phase: %lX", (DWORD)gaService); 00714 } 00715 if (gaTopic && GlobalGetAtomName(gaTopic, sz, 10) == 0) { 00716 RIPMSG1(RIP_ERROR, "Bad Topic Atom after Initiate phase: %lX", (DWORD)gaTopic); 00717 } 00718 } 00719 #endif // DBG 00720 00721 GlobalDeleteAtom(gaService); 00722 GlobalDeleteAtom(gaTopic); 00723 00724 // 00725 // Get the first pci allocated when a WM_DDE_ACK was recieved. 00726 // 00727 pci = (PCL_CONV_INFO)GetWindowLongPtr(ie.hwndClient, GWLP_PCI); 00728 if (pci == NULL) { 00729 Error: 00730 LeaveDDECrit; 00731 NtUserDestroyWindow(ie.hwndClient); 00732 EnterDDECrit; 00733 return (NULL); 00734 } 00735 00736 SetWindowLong(ie.hwndClient, GWL_CONVSTATE, CLST_CONNECTED); 00737 if (hwndTarget) { 00738 /* 00739 * If hwndTarget was NULL, the enumeration proc took care of this. 00740 */ 00741 pci->hwndReconnect = hwndTarget; 00742 UserAssert(pci->ci.next == NULL); 00743 pci->ci.laServiceRequested = laService; 00744 IncLocalAtomCount(laService); // pci copy 00745 } 00746 00747 if (pcii->MonitorFlags & MF_CONV) { 00748 for (pcoi = (PCONV_INFO)pci; pcoi; pcoi = pcoi->next) { 00749 MONCONV(pcoi, TRUE); 00750 } 00751 } 00752 return (pci); 00753 }

HANDLE CopyDDEData HANDLE  hDDE,
BOOL  fExec
 

Definition at line 660 of file hdata.c.

References CopyBitmap(), CopyPalette(), tagDDE_DATA::Data, FALSE, NULL, TRUE, UserGlobalAlloc, UserGlobalFree, USERGLOBALLOCK, UserGlobalSize, USERGLOBALUNLOCK, tagDDE_DATA::wFmt, and WOWGLOBALFREE.

Referenced by DdeClientTransaction(), and SvSpontRequest().

00663 { 00664 HANDLE hDDENew; 00665 PDDE_DATA pdde, pddeNew; 00666 LPMETAFILEPICT pmfPict; 00667 HANDLE hmfPict; 00668 00669 hDDENew = UserGlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, 00670 UserGlobalSize(hDDE)); 00671 if (!hDDENew) { 00672 return (0); 00673 } 00674 USERGLOBALLOCK(hDDE, pdde); 00675 if (pdde == NULL) { 00676 UserGlobalFree(hDDENew); 00677 return (0); 00678 } 00679 USERGLOBALLOCK(hDDENew, pddeNew); 00680 UserAssert(pddeNew); 00681 RtlCopyMemory(pddeNew, pdde, UserGlobalSize(hDDE)); 00682 00683 if (!fIsExecute) { 00684 switch (pdde->wFmt) { 00685 case CF_BITMAP: 00686 case CF_DSPBITMAP: 00687 pddeNew->Data = (ULONG_PTR)CopyBitmap((HBITMAP)pdde->Data); 00688 break; 00689 00690 case CF_PALETTE: 00691 pddeNew->Data = (ULONG_PTR)CopyPalette((HPALETTE)pdde->Data); 00692 break; 00693 00694 case CF_DIB: 00695 pddeNew->Data = (ULONG_PTR)CopyDDEData((HANDLE)pdde->Data, TRUE); 00696 break; 00697 00698 case CF_METAFILEPICT: 00699 case CF_DSPMETAFILEPICT: 00700 hmfPict = CopyDDEData((HANDLE)pdde->Data, TRUE); 00701 USERGLOBALLOCK(hmfPict, pmfPict); 00702 if (pmfPict == NULL) { 00703 WOWGLOBALFREE(hmfPict); 00704 USERGLOBALUNLOCK(hDDENew); 00705 WOWGLOBALFREE(hDDENew); 00706 USERGLOBALUNLOCK(hDDE); 00707 return (FALSE); 00708 } 00709 pmfPict->hMF = CopyMetaFile(pmfPict->hMF, NULL); 00710 USERGLOBALUNLOCK(hmfPict); 00711 pddeNew->Data = (ULONG_PTR)hmfPict; 00712 break; 00713 00714 case CF_ENHMETAFILE: 00715 case CF_DSPENHMETAFILE: 00716 pddeNew->Data = (ULONG_PTR)CopyEnhMetaFile((HANDLE)pdde->Data, NULL); 00717 break; 00718 } 00719 } 00720 USERGLOBALUNLOCK(hDDENew); 00721 USERGLOBALUNLOCK(hDDE); 00722 return (hDDENew); 00723 }

HANDLE CreateHandle ULONG_PTR  dwData,
DWORD  type,
DWORD  inst
 

Definition at line 75 of file handles.c.

References aHandleEntry, cHandlesAllocated, CheckHandleTable, DDEMLAlloc, DDEMLReAlloc, tagCHANDLEENTRY::dwData, GROW_COUNT, tagCHANDLEENTRY::handle, HandleFromId, HandleFromIndex, HandleFromInst, HandleFromType, iFirstFree, nextId, NULL, and type.

Referenced by AddInstance(), DdeClientTransaction(), DdeConnectList(), DDEMLClientWndProc(), FreeConversationResources(), InternalCreateDataHandle(), and ProcessDDEMLInitiate().

00079 { 00080 HANDLE h; 00081 int i, iNextFree; 00082 PCHANDLEENTRY phe; 00083 00084 if (iFirstFree >= cHandlesAllocated) { 00085 if (cHandlesAllocated == 0) { 00086 aHandleEntry = (PCHANDLEENTRY)DDEMLAlloc(sizeof(CHANDLEENTRY) * GROW_COUNT); 00087 } else { 00088 aHandleEntry = (PCHANDLEENTRY)DDEMLReAlloc(aHandleEntry, 00089 sizeof(CHANDLEENTRY) * (cHandlesAllocated + GROW_COUNT)); 00090 } 00091 if (aHandleEntry == NULL) { 00092 return (0); 00093 } 00094 i = cHandlesAllocated; 00095 cHandlesAllocated += GROW_COUNT; 00096 phe = &aHandleEntry[i]; 00097 while (i < cHandlesAllocated) { 00098 // phe->handle = 0; // indicates empty - ZERO init. 00099 phe->dwData = ++i; // index to next free spot. 00100 phe++; 00101 } 00102 } 00103 h = aHandleEntry[iFirstFree].handle = (HANDLE)LongToHandle( 00104 HandleFromId(nextId) | 00105 HandleFromIndex(iFirstFree) | 00106 HandleFromType(type) | 00107 HandleFromInst(inst) ); 00108 iNextFree = (int)aHandleEntry[iFirstFree].dwData; 00109 aHandleEntry[iFirstFree].dwData = dwData; 00110 nextId++; 00111 if (nextId == 0) { // guarentees HIWORD of handle != 0 00112 nextId++; 00113 } 00114 iFirstFree = iNextFree; 00115 00116 CheckHandleTable(); 00117 return (h); 00118 }

BOOL CsClearSecurityForAck HANDLE  hInst,
HWND  hwndServer,
HWND  hwndClient
 

LRESULT DDEMLClientWndProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 376 of file ddemlwp.c.

References tagCLS::atomClassName, tagSERVERINFO::atomSysClass, tagCL_CONV_INFO::ci, CLST_CONNECTED, CLST_SINGLE_INITIALIZING, CreateHandle(), DDEMLAlloc, DDEMLFree, DefWindowProc(), EnterDDECrit, GetWindowLongPtr(), GlobalToLocalAtom(), gpsi, GWL_CONVSTATE, GWLP_CHINST, GWLP_PCI, HTYPE_CLIENT_CONVERSATION, tagCONV_INFO::hwndConv, ICLS_DDEMLSERVERA, ICLS_DDEMLSERVERW, InstFromHandle, LeaveDDECrit, tagCONV_INFO::next, NULL, tagCONV_INFO::pcii, PostMessage(), ProcessAsyncDDEMsg(), ProcessTerminateMsg(), REBASEALWAYS, SetCommonStateFlags(), SetWindowLongPtr(), TestWF, ValidateHwnd, ValidateInstance(), and WFANSIPROC.

Referenced by RW_RegisterDDEML().

00381 { 00382 PCL_CONV_INFO pci, pciNew; 00383 LONG lState; 00384 LRESULT lRet = 0; 00385 PWND pwnd; 00386 PCLS pcls; 00387 00388 EnterDDECrit; 00389 00390 pci = (PCL_CONV_INFO)GetWindowLongPtr(hwnd, GWLP_PCI); 00391 UserAssert(pci == NULL || pci->ci.hwndConv == hwnd); 00392 00393 switch (message) { 00394 case WM_DDE_ACK: 00395 lState = GetWindowLong(hwnd, GWL_CONVSTATE); 00396 if (lState != CLST_CONNECTED) { 00397 00398 // Initiation mode 00399 00400 pciNew = (PCL_CONV_INFO)DDEMLAlloc(sizeof(CL_CONV_INFO)); 00401 if (pciNew == NULL || 00402 (pci != NULL && lState == CLST_SINGLE_INITIALIZING)) { 00403 PostMessage((HWND)wParam, WM_DDE_TERMINATE, (WPARAM)hwnd, 0); 00404 goto Exit; 00405 } 00406 00407 // PCL_CONV_INFO initialization 00408 00409 pciNew->ci.pcii = ValidateInstance((HANDLE)GetWindowLongPtr(hwnd, GWLP_CHINST)); 00410 00411 if (pciNew->ci.pcii == NULL) { 00412 DDEMLFree(pciNew); 00413 goto Exit; 00414 } 00415 00416 pciNew->ci.next = (PCONV_INFO)pci; // pci may be NULL 00417 // 00418 // Seting GWLP_PCI gives feedback to ConnectConv() which issued 00419 // the WM_DDE_INITIATE message. 00420 // 00421 SetWindowLongPtr(hwnd, GWLP_PCI, (LONG_PTR)pciNew); 00422 // pciNew->hUser = 0; // Zero init. 00423 00424 // BUG: If this fails we can have some nasty problems 00425 pciNew->ci.hConv = (HCONV)CreateHandle((ULONG_PTR)pciNew, 00426 HTYPE_CLIENT_CONVERSATION, InstFromHandle(pciNew->ci.pcii->hInstClient)); 00427 00428 pciNew->ci.laService = GlobalToLocalAtom(LOWORD(lParam)); // pci copy 00429 GlobalDeleteAtom(LOWORD(lParam)); 00430 pciNew->ci.laTopic = GlobalToLocalAtom(HIWORD(lParam)); // pci copy 00431 GlobalDeleteAtom(HIWORD(lParam)); 00432 pciNew->ci.hwndPartner = (HWND)wParam; 00433 pciNew->ci.hwndConv = hwnd; 00434 pciNew->ci.state = (WORD)(ST_CONNECTED | ST_CLIENT | 00435 pciNew->ci.pcii->ConvStartupState); 00436 SetCommonStateFlags(hwnd, (HWND)wParam, &pciNew->ci.state); 00437 00438 pwnd = ValidateHwnd((HWND)wParam); 00439 00440 if (pwnd == NULL) goto Exit; 00441 pcls = (PCLS)REBASEALWAYS(pwnd, pcls); 00442 00443 if (!TestWF(pwnd, WFANSIPROC)) { 00444 if (pcls->atomClassName == gpsi->atomSysClass[ICLS_DDEMLSERVERW]) { 00445 pciNew->ci.state |= ST_ISLOCAL; 00446 } 00447 } else { 00448 if (pcls->atomClassName == gpsi->atomSysClass[ICLS_DDEMLSERVERA]) { 00449 pciNew->ci.state |= ST_ISLOCAL; 00450 } 00451 } 00452 00453 // pciNew->ci.laServiceRequested = 0; // Set by InitiateEnumerationProc() 00454 // pciNew->ci.pxiIn = 0; 00455 // pciNew->ci.pxiOut = 0; 00456 // pciNew->ci.dmqIn = 0; 00457 // pciNew->ci.dmqOut = 0; 00458 // pciNew->ci.aLinks = NULL; 00459 // pciNew->ci.cLinks = 0; 00460 // pciNew->ci.cLocks = 0; 00461 goto Exit; 00462 } 00463 // fall through to handle posted messages here. 00464 00465 case WM_DDE_DATA: 00466 ProcessAsyncDDEMsg((PCONV_INFO)pci, message, (HWND)wParam, lParam); 00467 goto Exit; 00468 00469 case WM_DDE_TERMINATE: 00470 case WM_DESTROY: 00471 { 00472 ProcessTerminateMsg((PCONV_INFO)pci, (HWND)wParam); 00473 break; 00474 } 00475 } 00476 00477 lRet = DefWindowProc(hwnd, message, wParam, lParam); 00478 00479 Exit: 00480 LeaveDDECrit; 00481 return (lRet); 00482 }

LRESULT DDEMLMotherWndProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 27 of file ddemlwp.c.

References DefWindowProc(), GetWindowLongPtr(), GWLP_PCI, ProcessDDEMLInitiate(), and ProcessRegistrationMessage().

Referenced by RW_RegisterDDEML().

00032 { 00033 switch (message) { 00034 case UM_REGISTER: 00035 case UM_UNREGISTER: 00036 return(ProcessRegistrationMessage(hwnd, message, wParam, lParam)); 00037 00038 case WM_DDE_INITIATE: 00039 ProcessDDEMLInitiate((PCL_INSTANCE_INFO)GetWindowLongPtr(hwnd, GWLP_PCI), 00040 (HWND)wParam, (ATOM)LOWORD(lParam), (ATOM)HIWORD(lParam)); 00041 return(0); 00042 00043 } 00044 return(DefWindowProc(hwnd, message, wParam, lParam)); 00045 }

LRESULT DDEMLServerWndProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 496 of file ddemlwp.c.

References tagSVR_CONV_INFO::ci, DefWindowProc(), EnterDDECrit, GetWindowLongPtr(), GWLP_PSI, tagCONV_INFO::hwndConv, LeaveDDECrit, NULL, ProcessAsyncDDEMsg(), and ProcessTerminateMsg().

Referenced by RW_RegisterDDEML().

00501 { 00502 PSVR_CONV_INFO psi; 00503 LRESULT lRet = 0; 00504 00505 EnterDDECrit; 00506 00507 psi = (PSVR_CONV_INFO)GetWindowLongPtr(hwnd, GWLP_PSI); 00508 UserAssert(psi == NULL || psi->ci.hwndConv == hwnd); 00509 00510 switch (message) { 00511 case WM_DDE_REQUEST: 00512 case WM_DDE_POKE: 00513 case WM_DDE_ADVISE: 00514 case WM_DDE_EXECUTE: 00515 case WM_DDE_ACK: 00516 case WM_DDE_UNADVISE: 00517 ProcessAsyncDDEMsg((PCONV_INFO)psi, message, (HWND)wParam, lParam); 00518 goto Exit; 00519 00520 case WM_DDE_TERMINATE: 00521 case WM_DESTROY: 00522 ProcessTerminateMsg((PCONV_INFO)psi, (HWND)wParam); 00523 break; 00524 } 00525 lRet = DefWindowProc(hwnd, message, wParam, lParam); 00526 Exit: 00527 LeaveDDECrit; 00528 return (lRet); 00529 }

VOID DeleteLinkCount PCL_INSTANCE_INFO  pcii,
PLINK_COUNT  pLinkCountDelete
 

Definition at line 123 of file util.c.

References DDEMLFree, tagLINK_COUNT::gaItem, tagLINK_COUNT::laItem, tagLINK_COUNT::laTopic, tagLINK_COUNT::next, NULL, tagCL_INSTANCE_INFO::pLinkCount, tagLINK_COUNT::Total, and VOID().

Referenced by FreeConversationResources(), and SvSpontUnadvise().

00126 { 00127 PLINK_COUNT pLinkCount, pLinkCountPrev; 00128 00129 if (--pLinkCountDelete->Total != 0) { 00130 return; 00131 } 00132 pLinkCountPrev = NULL; 00133 pLinkCount = pcii->pLinkCount; 00134 while (pLinkCount) { 00135 00136 if (pLinkCount == pLinkCountDelete) { 00137 GlobalDeleteAtom(pLinkCount->gaItem); 00138 DeleteAtom(pLinkCount->laItem); 00139 DeleteAtom(pLinkCount->laTopic); 00140 if (pLinkCountPrev == NULL) { 00141 pcii->pLinkCount = pLinkCount->next; 00142 } else { 00143 pLinkCountPrev->next = pLinkCount->next; 00144 } 00145 DDEMLFree(pLinkCount); 00146 return; 00147 } 00148 00149 pLinkCountPrev = pLinkCount; 00150 pLinkCount = pLinkCount->next; 00151 } 00152 }

ULONG_PTR DestroyHandle HANDLE  h  ) 
 

Definition at line 137 of file handles.c.

References aHandleEntry, CheckHandleTable, tagCHANDLEENTRY::dwData, tagCHANDLEENTRY::handle, iFirstFree, and IndexFromHandle.

Referenced by ClRespExecuteAck(), ClRespPokeAck(), ClRespUnadviseAck(), DdeClientTransaction(), DdeConnectList(), DdeDisconnectList(), DestroyInstance(), FreeConversationResources(), InternalFreeDataHandle(), TransactionComplete(), and UnpackAndFreeDDEMLDataHandle().

00139 { 00140 register int i; 00141 register ULONG_PTR dwRet; 00142 00143 CheckHandleTable(); 00144 00145 i = IndexFromHandle(h); 00146 UserAssert(aHandleEntry[i].handle == h); 00147 aHandleEntry[i].handle = 0; 00148 dwRet = aHandleEntry[i].dwData; 00149 aHandleEntry[i].dwData = iFirstFree; 00150 iFirstFree = i; 00151 00152 return (dwRet); 00153 }

HANDLE DestroyInstance HANDLE  hInst  ) 
 

Definition at line 87 of file instance.c.

References aInstance, DestroyHandle(), iFirstFreeInst, and InstFromHandle.

Referenced by DdeUninitialize().

00089 { 00090 register HANDLE hInstServerRet = 0; 00091 00092 DestroyHandle(hInstClient); 00093 hInstServerRet = aInstance[InstFromHandle(hInstClient)]; 00094 aInstance[InstFromHandle(hInstClient)] = (HANDLE)UIntToPtr( iFirstFreeInst ); 00095 iFirstFreeInst = InstFromHandle(hInstClient); 00096 00097 return (hInstServerRet); 00098 }

HDDEDATA DoCallback PCL_INSTANCE_INFO  pcii,
WORD  wType,
WORD  wFmt,
HCONV  hConv,
HSZ  hsz1,
HSZ  hsz2,
HDDEDATA  hData,
ULONG_PTR  dw1,
ULONG_PTR  dw2
 

Definition at line 24 of file w32/ntuser/client/callback.c.

References tagCL_INSTANCE_INFO::afCmd, CheckDDECritIn, CheckDDECritOut, tagCL_INSTANCE_INFO::cInDDEMLCallback, _CLIENTINFO::cInDDEMLCallback, DdeGetData(), DDEMLAlloc, DDEMLFree, DWORD, EnterDDECrit, Event(), EVENT_PACKET, GetClientInfo, HTYPE_ZOMBIE_CONVERSATION, LATOM_FROM_HSZ, LeaveDDECrit, LocalToGlobalAtom(), tagCL_INSTANCE_INFO::MonitorFlags, NtGetTickCount(), NULL, pcbs, pep, PEVENT_PACKET, tagCL_INSTANCE_INFO::pfnCallback, tagCL_INSTANCE_INFO::tid, TRUE, TypeFromHandle, UINT, and UserCallDDECallback.

Referenced by _ClientEventCallback(), ClSpontAdviseData(), ProcessDDEMLInitiate(), ProcessRegistrationMessage(), ShutdownConversation(), SvSpontAdvise(), SvSpontExecute(), SvSpontPoke(), SvSpontRequest(), SvSpontUnadvise(), SvStartAdviseUpdate(), and TransactionComplete().

00034 { 00035 HDDEDATA hDataRet; 00036 PCLIENTINFO pci; 00037 00038 CheckDDECritIn; 00039 00040 00041 /* 00042 * Zombie conversations don't generate callbacks! 00043 */ 00044 if (hConv && TypeFromHandle(hConv) == HTYPE_ZOMBIE_CONVERSATION) { 00045 return(0); 00046 } 00047 00048 pci = GetClientInfo(); 00049 pci->cInDDEMLCallback++; 00050 00051 pcii->cInDDEMLCallback++; 00052 LeaveDDECrit; 00053 CheckDDECritOut; 00054 00055 /* 00056 * Bug 246472 - joejo 00057 * fixup all DDE Callbacks since some apps make their callbacks 00058 * C-Style instead of PASCAL. 00059 */ 00060 hDataRet = UserCallDDECallback(*pcii->pfnCallback, (UINT)wType, (UINT)wFmt, hConv, hsz1, hsz2, 00061 hData, dw1, dw2); 00062 00063 EnterDDECrit; 00064 pcii->cInDDEMLCallback--; 00065 pci->cInDDEMLCallback--; 00066 00067 if (!(pcii->afCmd & APPCLASS_MONITOR) && pcii->MonitorFlags & MF_CALLBACKS) { 00068 PEVENT_PACKET pep; 00069 00070 pep = (PEVENT_PACKET)DDEMLAlloc(sizeof(EVENT_PACKET) - sizeof(DWORD) + 00071 sizeof(MONCBSTRUCT)); 00072 if (pep != NULL) { 00073 00074 pep->EventType = MF_CALLBACKS; 00075 pep->fSense = TRUE; 00076 pep->cbEventData = sizeof(MONCBSTRUCT); 00077 00078 #define pcbs ((MONCBSTRUCT *)&pep->Data) 00079 pcbs->cb = sizeof(MONCBSTRUCT); 00080 pcbs->dwTime = NtGetTickCount(); 00081 pcbs->hTask = (HANDLE)LongToHandle( pcii->tid ); 00082 pcbs->dwRet = HandleToUlong(hDataRet); 00083 pcbs->wType = wType; 00084 pcbs->wFmt = wFmt; 00085 pcbs->hConv = hConv; 00086 pcbs->hsz1 = (HSZ)LocalToGlobalAtom(LATOM_FROM_HSZ(hsz1)); 00087 pcbs->hsz2 = (HSZ)LocalToGlobalAtom(LATOM_FROM_HSZ(hsz2)); 00088 pcbs->hData = hData; 00089 pcbs->dwData1 = dw1; 00090 pcbs->dwData2 = dw2; 00091 if (((wType == XTYP_CONNECT) || (wType == XTYP_WILDCONNECT)) && dw1) { 00092 RtlCopyMemory(&pcbs->cc, (PVOID)dw1, sizeof(CONVCONTEXT)); 00093 } 00094 00095 LeaveDDECrit; 00096 00097 if (wType & XCLASS_DATA) { 00098 if (hDataRet && hDataRet != CBR_BLOCK) { 00099 pcbs->cbData = DdeGetData(hDataRet, (LPBYTE)pcbs->Data, 32, 0); 00100 } 00101 } else if (hData) { 00102 pcbs->cbData = DdeGetData(hData, (LPBYTE)pcbs->Data, 32, 0); 00103 } 00104 00105 Event(pep); 00106 00107 EnterDDECrit; 00108 00109 GlobalDeleteAtom(LATOM_FROM_HSZ(pcbs->hsz1)); 00110 GlobalDeleteAtom(LATOM_FROM_HSZ(pcbs->hsz2)); 00111 DDEMLFree(pep); 00112 #undef pcbs 00113 } 00114 } 00115 return (hDataRet); 00116 }

VOID DumpDDEMessage BOOL  fFreeData,
UINT  msg,
LPARAM  lParam
 

Definition at line 714 of file ddemlwp.c.

References FALSE, FreeDDEData(), FreeDDElParam(), msg, TRUE, UnpackDDElParam(), VOID(), and WOWGLOBALFREE.

Referenced by FreeConversationResources(), ProcessAsyncDDEMsg(), ProcessSyncDDEMessage(), SpontaneousClientMessage(), and SpontaneousServerMessage().

00718 { 00719 UINT_PTR uiLo, uiHi; 00720 00721 RIPMSG2(RIP_WARNING, "Dump DDE msg %x lParam %x", msg, lParam); 00722 00723 switch (msg) { 00724 case WM_DDE_ACK: 00725 case WM_DDE_DATA: 00726 case WM_DDE_POKE: 00727 case WM_DDE_ADVISE: 00728 UnpackDDElParam(msg, lParam, &uiLo, &uiHi); 00729 switch (msg) { 00730 case WM_DDE_DATA: 00731 case WM_DDE_POKE: 00732 if (uiLo) { 00733 if (fFreeData) { 00734 FreeDDEData((HANDLE)uiLo, FALSE, TRUE); 00735 } 00736 GlobalDeleteAtom((ATOM)uiHi); 00737 } 00738 break; 00739 00740 case WM_DDE_ADVISE: 00741 if (uiLo) { 00742 if (fFreeData) { 00743 FreeDDEData((HANDLE)uiLo, FALSE, TRUE); 00744 } 00745 GlobalDeleteAtom((ATOM)uiHi); 00746 } 00747 break; 00748 00749 case WM_DDE_ACK: 00750 // could be EXEC Ack - cant know what to do exactly. 00751 break; 00752 } 00753 FreeDDElParam(msg, lParam); 00754 break; 00755 00756 case WM_DDE_EXECUTE: 00757 if (fFreeData) { 00758 WOWGLOBALFREE((HANDLE)lParam); 00759 } 00760 break; 00761 00762 case WM_DDE_REQUEST: 00763 case WM_DDE_UNADVISE: 00764 GlobalDeleteAtom((ATOM)HIWORD(lParam)); 00765 break; 00766 } 00767 }

BOOL EnableEnumProc HWND  hwnd,
PENABLE_ENUM_STRUCT  pees
 

Definition at line 295 of file w32/ntuser/client/callback.c.

References BOOL, tagCONV_INFO::cLocks, FreeConversationResources(), GetWindowLongPtr(), GWLP_PCI, tagCONV_INFO::next, NULL, PENABLE_ENUM_STRUCT, tagENABLE_ENUM_STRUCT::pfRet, SetEnableState(), tagCONV_INFO::state, TRUE, tagENABLE_ENUM_STRUCT::wCmd, and tagENABLE_ENUM_STRUCT::wCmd2.

Referenced by DdeEnableCallback(), and ProcessSyncDDEMessage().

00298 { 00299 PCONV_INFO pcoi; 00300 00301 for (pcoi = (PCONV_INFO)GetWindowLongPtr(hwnd, GWLP_PCI); 00302 pcoi != NULL; pcoi = pcoi->next) { 00303 pcoi->cLocks++; 00304 *pees->pfRet |= SetEnableState(pcoi, pees->wCmd); 00305 if (pees->wCmd2) { 00306 /* 00307 * Only let ES_CHECKQUEUEONCE be done on one window but 00308 * don't stop the wCmd from getting to all the other 00309 * windows. 00310 */ 00311 if (SetEnableState(pcoi, pees->wCmd2) && 00312 pees->wCmd2 == EC_CHECKQUEUEONCE) { 00313 pees->wCmd2 = 0; 00314 } 00315 } 00316 pcoi->cLocks--; 00317 if (pcoi->cLocks == 0 && pcoi->state & ST_FREE_CONV_RES_NOW) { 00318 FreeConversationResources(pcoi); 00319 break; 00320 } 00321 } 00322 return (TRUE); 00323 }

BOOL ExtractDDEDataInfo HANDLE  hDDE,
LPWORD  pwStatus,
LPWORD  pwFmt
 

Definition at line 1591 of file stdptcl.c.

References BOOL, FALSE, NULL, TRUE, USERGLOBALLOCK, USERGLOBALUNLOCK, tagDDE_DATA::wFmt, and tagDDE_DATA::wStatus.

Referenced by ClRespRequestData(), SvSpontAdvise(), SvSpontPoke(), and SvSpontRequest().

01595 { 01596 PDDE_DATA pdde; 01597 01598 USERGLOBALLOCK(hDDE, pdde); 01599 if (pdde == NULL) { 01600 return (FALSE); 01601 } 01602 *pwStatus = pdde->wStatus; 01603 *pwFmt = pdde->wFmt; 01604 USERGLOBALUNLOCK(hDDE); 01605 return (TRUE); 01606 }

HANDLE FindIstanceHandleFromHandle HANDLE  h  ) 
 

VOID FreeConversationResources PCONV_INFO  pcoi  ) 
 

Definition at line 1354 of file connect.c.

References tagCONV_INFO::aLinks, CheckDDECritIn, tagCONV_INFO::cLinks, tagCONV_INFO::cLocks, CreateHandle(), DDEMLFree, DeleteLinkCount(), DestroyHandle(), tagCONV_INFO::dmqIn, tagCONV_INFO::dmqOut, DumpDDEMessage(), FALSE, tagXACT_INFO::flags, tagCONV_INFO::hConv, HTYPE_ZOMBIE_CONVERSATION, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, InstFromHandle, tagADVISE_LINK::laItem, tagCONV_INFO::laService, tagCONV_INFO::laServiceRequested, tagCONV_INFO::laTopic, LocalToGlobalAtom(), tagDDE_MESSAGE_QUEUE::lParam, MONLINK, tagDDE_MESSAGE_QUEUE::msg, tagDDE_MESSAGE_QUEUE::next, tagXACT_INFO::next, NULL, tagCONV_INFO::pcii, tagXACT_INFO::pfnResponse, tagADVISE_LINK::pLinkCount, PostMessage(), tagCONV_INFO::pxiOut, tagCONV_INFO::state, TID_TIMEOUT, TRUE, UnlinkConvFromOthers(), VOID(), tagADVISE_LINK::wFmt, tagADVISE_LINK::wType, and XIF_SYNCHRONOUS.

Referenced by DdeClientTransaction(), DdeEnableCallback(), DdePostAdvise(), EnableEnumProc(), ProcessAsyncDDEMsg(), ProcessSyncDDEMessage(), and ShutdownConversation().

01356 { 01357 PADVISE_LINK paLink; 01358 PDDE_MESSAGE_QUEUE pdmq; 01359 PXACT_INFO pxi; 01360 01361 CheckDDECritIn; 01362 01363 /* 01364 * Don't free resources on locked conversations. 01365 */ 01366 if (pcoi->cLocks > 0) { 01367 pcoi->state |= ST_FREE_CONV_RES_NOW; 01368 return; 01369 } 01370 01371 /* 01372 * Don't free resources if a synchronous transaction is in effect! 01373 */ 01374 pxi = pcoi->pxiOut; 01375 while (pxi != NULL) { 01376 if (pxi->flags & XIF_SYNCHRONOUS) { 01377 /* 01378 * This conversation is in a synchronous transaction. 01379 * Shutdown the modal loop FIRST, then call this when 01380 * the loop exits. 01381 */ 01382 PostMessage(pcoi->hwndConv, WM_TIMER, TID_TIMEOUT, 0); 01383 pcoi->state |= ST_FREE_CONV_RES_NOW; 01384 return; 01385 } 01386 pxi = pxi->next; 01387 } 01388 01389 /* 01390 * If this is an Intra-Process conversation that hasn't yet received 01391 * a terminate message, make it a zombie. We will call this routine 01392 * again once the terminate arrives or when WaitForZombieTerminate() has 01393 * timed out waiting. 01394 */ 01395 if (pcoi->state & ST_INTRA_PROCESS && !(pcoi->state & ST_TERMINATE_RECEIVED)) { 01396 DestroyHandle((HANDLE)pcoi->hConv); 01397 pcoi->hConv = (HCONV)CreateHandle((ULONG_PTR)pcoi, HTYPE_ZOMBIE_CONVERSATION, 01398 InstFromHandle(pcoi->hConv)); 01399 UnlinkConvFromOthers(pcoi, TRUE); 01400 return; 01401 } 01402 01403 /* 01404 * remove any transactions left in progress 01405 */ 01406 while (pcoi->pxiOut != NULL) { 01407 (pcoi->pxiOut->pfnResponse)(pcoi->pxiOut, 0, 0); 01408 } 01409 01410 /* 01411 * Throw away any incoming queued DDE messages. 01412 */ 01413 while (pcoi->dmqOut != NULL) { 01414 01415 pdmq = pcoi->dmqOut; 01416 DumpDDEMessage(!(pcoi->state & ST_INTRA_PROCESS), pdmq->msg, pdmq->lParam); 01417 pcoi->dmqOut = pcoi->dmqOut->next; 01418 if (pcoi->dmqOut == NULL) { 01419 pcoi->dmqIn = NULL; 01420 } 01421 DDEMLFree(pdmq); 01422 } 01423 01424 // 01425 // Remove all link info 01426 // 01427 paLink = pcoi->aLinks; 01428 while (pcoi->cLinks) { 01429 if (pcoi->state & ST_CLIENT) { 01430 MONLINK(pcoi->pcii, FALSE, paLink->wType & XTYPF_NODATA, 01431 pcoi->laService, pcoi->laTopic, 01432 LocalToGlobalAtom(paLink->laItem), 01433 paLink->wFmt, FALSE, 01434 (HCONV)pcoi->hwndPartner, (HCONV)pcoi->hwndConv); 01435 } else { 01436 MONLINK(pcoi->pcii, FALSE, paLink->wType & XTYPF_NODATA, 01437 pcoi->laService, pcoi->laTopic, 01438 LocalToGlobalAtom(paLink->laItem), 01439 paLink->wFmt, TRUE, 01440 (HCONV)pcoi->hwndConv, (HCONV)pcoi->hwndPartner); 01441 } 01442 if (!(pcoi->state & ST_CLIENT)) { 01443 DeleteLinkCount(pcoi->pcii, paLink->pLinkCount); 01444 } 01445 DeleteAtom(paLink->laItem); // link structure copy 01446 paLink++; 01447 pcoi->cLinks--; 01448 } 01449 if (pcoi->aLinks) { 01450 DDEMLFree(pcoi->aLinks); 01451 } 01452 01453 // 01454 // free atoms associated with this conv 01455 // 01456 DeleteAtom(pcoi->laService); 01457 DeleteAtom(pcoi->laTopic); 01458 if (pcoi->laServiceRequested) { 01459 DeleteAtom(pcoi->laServiceRequested); 01460 } 01461 01462 UnlinkConvFromOthers(pcoi, FALSE); 01463 01464 /* 01465 * invalidate app's conversation handle 01466 */ 01467 DestroyHandle((HANDLE)pcoi->hConv); 01468 01469 DDEMLFree(pcoi); 01470 }

VOID FreeDDEData HANDLE  hDDE,
BOOL  fIgnorefRelease,
BOOL  fFreeTruelyGlobalObjects
 

Definition at line 491 of file hdata.c.

References tagDDE_DATA::Data, DWORD, NULL, USERGLOBALLOCK, USERGLOBALUNLOCK, VOID(), tagDDE_DATA::wFmt, WOWGLOBALFREE, and tagDDE_DATA::wStatus.

Referenced by _ClientFreeDDEHandle(), ClRespPokeAck(), ClRespRequestData(), ClSpontAdviseData(), DdeClientTransaction(), DumpDDEMessage(), InternalFreeDataHandle(), SvRespAdviseDataAck(), SvSpontPoke(), and UserRegisterWowHandlers().

00495 { 00496 PDDE_DATA pdde; 00497 LPMETAFILEPICT pmfPict; 00498 DWORD cb; 00499 00500 USERGLOBALLOCK(hDDE, pdde); 00501 if (pdde == NULL) { 00502 return ; 00503 } 00504 00505 if ((pdde->wStatus & DDE_FRELEASE) || fIgnorefRelease) { 00506 cb = (DWORD)GlobalSize(hDDE); 00507 /* 00508 * Because there is the possibility that the data never got 00509 * initialized we need to do this in a try-except so we 00510 * behave nicely. 00511 */ 00512 switch (pdde->wFmt) { 00513 case CF_BITMAP: 00514 case CF_DSPBITMAP: 00515 case CF_PALETTE: 00516 if (cb >= sizeof(HANDLE)) { 00517 if (fFreeTruelyGlobalObjects) { 00518 if (pdde->Data != 0) { 00519 DeleteObject((HANDLE)pdde->Data); 00520 } 00521 } else { 00522 /* 00523 * !fFreeTruelyGlobalObject implies we are only freeing 00524 * the Gdi proxy. (another process may still have this 00525 * object in use.) 00526 * 00527 * ChrisWil: removed this call. No longer 00528 * applicable in KMode. 00529 * 00530 * GdiDeleteLocalObject((ULONG)pdde->Data); 00531 * 00532 */ 00533 } 00534 } 00535 break; 00536 00537 case CF_DIB: 00538 if (cb >= sizeof(HANDLE)) { 00539 if (pdde->Data != 0) { 00540 WOWGLOBALFREE((HANDLE)pdde->Data); 00541 } 00542 } 00543 break; 00544 00545 case CF_METAFILEPICT: 00546 case CF_DSPMETAFILEPICT: 00547 if (cb >= sizeof(HANDLE)) { 00548 if (pdde->Data != 0) { 00549 USERGLOBALLOCK(pdde->Data, pmfPict); 00550 if (pmfPict != NULL) { 00551 if (GlobalSize((HANDLE)pdde->Data) >= sizeof(METAFILEPICT)) { 00552 DeleteMetaFile(pmfPict->hMF); 00553 } 00554 USERGLOBALUNLOCK((HANDLE)pdde->Data); 00555 WOWGLOBALFREE((HANDLE)pdde->Data); 00556 } 00557 } 00558 } 00559 break; 00560 00561 case CF_ENHMETAFILE: 00562 case CF_DSPENHMETAFILE: 00563 if (cb >= sizeof(HANDLE)) { 00564 if (pdde->Data != 0) { 00565 DeleteEnhMetaFile((HANDLE)pdde->Data); 00566 } 00567 } 00568 break; 00569 } 00570 USERGLOBALUNLOCK(hDDE); 00571 WOWGLOBALFREE(hDDE); 00572 } else { 00573 USERGLOBALUNLOCK(hDDE); 00574 } 00575 }

VOID GetConvContext HWND  hwnd,
LONG *  pl
 

Definition at line 368 of file xact.c.

References GWL_CONVCONTEXT, and VOID().

Referenced by DdeQueryConvInfo(), DdeReconnect(), and ProcessDDEMLInitiate().

00371 { 00372 int i; 00373 00374 for (i = 0; i < sizeof(CONVCONTEXT); i += 4) { 00375 *pl++ = GetWindowLong(hwnd, GWL_CONVCONTEXT + i); 00376 } 00377 }

ULONG_PTR GetHandleData HANDLE  h  ) 
 

Definition at line 165 of file handles.c.

References aHandleEntry, CheckHandleTable, tagCHANDLEENTRY::dwData, and IndexFromHandle.

Referenced by DdeConnectList(), and UnlinkConvFromOthers().

00167 { 00168 register ULONG_PTR dwRet; 00169 00170 CheckHandleTable(); 00171 dwRet = aHandleEntry[IndexFromHandle(h)].dwData; 00172 return (dwRet); 00173 }

LATOM GlobalToLocalAtom GATOM  ga  ) 
 

Definition at line 464 of file hsz.c.

References LATOM.

Referenced by _ClientEventCallback(), AddLink(), ClRespUnadviseAck(), ClSpontAdviseData(), DDEMLClientWndProc(), DdeQueryConvInfo(), ProcessDDEMLInitiate(), ProcessRegistrationMessage(), SvRespAdviseDataAck(), SvSpontAdvise(), SvSpontPoke(), SvSpontRequest(), SvSpontUnadvise(), SvStartAdviseUpdate(), and TransactionComplete().

00466 { 00467 WCHAR sz[256]; 00468 00469 if (ga == 0) { 00470 return (0); 00471 } 00472 if (GlobalGetAtomName((ATOM)ga, sz, 256) == 0) { 00473 RIPMSG0(RIP_WARNING, "GlobalToLocalAtom out of memory"); 00474 return (0); 00475 } 00476 return ((LATOM)AddAtom(sz)); 00477 }

GATOM IncGlobalAtomCount GATOM  la  ) 
 

Definition at line 490 of file hsz.c.

References GATOM.

Referenced by AddLink(), ClStartAdvise(), ClStartPoke(), ClStartRequest(), ClStartUnadvise(), MonitorLink(), SendRegisterMessageToClass(), and SvStartAdviseUpdate().

00492 { 00493 WCHAR sz[256]; 00494 00495 if (ga == 0) { 00496 return (0); 00497 } 00498 if (GlobalGetAtomName(ga, sz, 256) == 0) { 00499 RIPMSG0(RIP_WARNING, "IncGlobalAtomCount out of memory"); 00500 return (0); 00501 } 00502 return ((GATOM)GlobalAddAtom(sz)); 00503 }

LATOM IncLocalAtomCount LATOM  la  ) 
 

Definition at line 516 of file hsz.c.

References LATOM.

Referenced by AddLink(), ConnectConv(), DdeKeepStringHandle(), DdeNameService(), InitiateEnumerationProc(), and ProcessDDEMLInitiate().

00518 { 00519 WCHAR sz[256]; 00520 00521 if (la == 0) { 00522 return (0); 00523 } 00524 if (GetAtomName(la, sz, 256) == 0) { 00525 RIPMSG0(RIP_WARNING, "IncLocalAtomCount out of memory"); 00526 return (0); 00527 } 00528 return ((LATOM)AddAtom(sz)); 00529 }

HDDEDATA InternalCreateDataHandle PCL_INSTANCE_INFO  pcii,
LPBYTE  pSrc,
DWORD  cb,
DWORD  cbOff,
DWORD  flags,
WORD  wStatus,
WORD  wFmt
 

Definition at line 94 of file hdata.c.

References CheckDDECritIn, CreateHandle(), DDEMLAlloc, DDEMLFree, DWORD, tagDDEMLDATA::flags, tagDDEMLDATA::hDDE, tagCL_INSTANCE_INFO::hInstClient, HTYPE_DATA_HANDLE, InstFromHandle, NULL, UserGlobalAlloc, USERGLOBALLOCK, USERGLOBALUNLOCK, tagDDE_DATA::wFmt, WOWGLOBALFREE, and tagDDE_DATA::wStatus.

Referenced by _ClientEventCallback(), ClSpontAdviseData(), DdeClientTransaction(), DdeCreateDataHandle(), SvSpontExecute(), SvSpontPoke(), and TransactionComplete().

00102 { 00103 PDDEMLDATA pdd; 00104 HDDEDATA hRet; 00105 LPBYTE p; 00106 DWORD cbOff2; 00107 00108 CheckDDECritIn; 00109 00110 pdd = (PDDEMLDATA)DDEMLAlloc(sizeof(DDEMLDATA)); 00111 if (pdd == NULL) { 00112 return (0); 00113 } 00114 if (cb == -1) { 00115 pdd->hDDE = (HANDLE)pSrc; 00116 } else { 00117 if (flags & HDATA_EXECUTE) { 00118 cbOff2 = 0; 00119 } else { 00120 cbOff2 = sizeof(WORD) + sizeof(WORD); // skip wStatus, wFmt 00121 } 00122 pdd->hDDE = UserGlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE | GMEM_ZEROINIT, 00123 cb + cbOff + cbOff2); 00124 if (pdd->hDDE == NULL) { 00125 DDEMLFree(pdd); 00126 return (0); 00127 } 00128 00129 if (!(flags & HDATA_EXECUTE)) { 00130 PDDE_DATA pdde; 00131 00132 USERGLOBALLOCK(pdd->hDDE, pdde); 00133 UserAssert(pdde); 00134 pdde->wStatus = wStatus; 00135 pdde->wFmt = wFmt; 00136 USERGLOBALUNLOCK(pdd->hDDE); 00137 } 00138 } 00139 pdd->flags = (WORD)flags; 00140 hRet = (HDDEDATA)CreateHandle((ULONG_PTR)pdd, HTYPE_DATA_HANDLE, 00141 InstFromHandle(pcii->hInstClient)); 00142 if (!hRet) { 00143 WOWGLOBALFREE(pdd->hDDE); 00144 DDEMLFree(pdd); 00145 return (0); 00146 } 00147 if (cb != -1 && pSrc != NULL) { 00148 USERGLOBALLOCK(pdd->hDDE, p); 00149 UserAssert(p); 00150 RtlCopyMemory(p + cbOff + cbOff2, pSrc, cb); 00151 USERGLOBALUNLOCK(pdd->hDDE); 00152 pdd->flags |= HDATA_INITIALIZED; 00153 } 00154 return (hRet); 00155 }

HSZ InternalDdeCreateStringHandle DWORD  idInst,
PVOID  psz,
int  iCodePage
 

Definition at line 49 of file hsz.c.

References BestSetLastDDEMLError(), EnterDDECrit, L, LeaveDDECrit, MONHSZ, NORMAL_HSZ_FROM_LATOM, NULL, UINT, and ValidateInstance().

Referenced by DdeCreateStringHandleA(), and DdeCreateStringHandleW().

00053 { 00054 PCL_INSTANCE_INFO pcii; 00055 HSZ hszRet = 0; 00056 int cb; 00057 WCHAR szw[256]; 00058 00059 EnterDDECrit; 00060 00061 pcii = ValidateInstance((HANDLE)LongToHandle( idInst )); 00062 if (pcii == NULL) { 00063 BestSetLastDDEMLError(DMLERR_INVALIDPARAMETER); 00064 goto Exit; 00065 } 00066 00067 switch (iCodePage) { 00068 case CP_WINANSI: 00069 if (*(LPSTR)psz == '\0') { 00070 goto Exit; 00071 } 00072 hszRet = NORMAL_HSZ_FROM_LATOM(AddAtomA((LPSTR)psz)); 00073 break; 00074 00075 default: 00076 00077 /* 00078 * Convert psz to unicode and fall through. 00079 */ 00080 cb = sizeof(szw) / sizeof(WCHAR); 00081 #ifdef LATER 00082 MultiByteToWideChar((UINT)iCodePage, MB_PRECOMPOSED, 00083 (LPSTR)psz, -1, szw, cb); 00084 #endif 00085 psz = &szw[0]; 00086 00087 00088 case CP_WINUNICODE: 00089 if (*(LPWSTR)psz == L'\0') { 00090 goto Exit; 00091 } 00092 hszRet = NORMAL_HSZ_FROM_LATOM(AddAtomW((LPWSTR)psz)); 00093 break; 00094 } 00095 MONHSZ(pcii, hszRet, MH_CREATE); 00096 00097 Exit: 00098 LeaveDDECrit; 00099 return (hszRet); 00100 }

UINT InternalDdeInitialize LPDWORD  pidInst,
PFNCALLBACK  pfnCallback,
DWORD  afCmd,
BOOL  fUnicode
 

Definition at line 65 of file ddemlcli.c.

References _CreateWindowEx(), AddInstance(), tagCL_INSTANCE_INFO::afCmd, tagSERVERINFO::atomSysClass, CL_INSTANCE_INFO, tagCL_INSTANCE_INFO::cNameServiceAlloc, CW_FLAGS_DIFFHMOD, DDEMLAlloc, DDEMLFree, EnterDDECrit, tagCL_INSTANCE_INFO::flags, gpsi, GWLP_INSTANCE_INFO, tagCL_INSTANCE_INFO::hInstServer, tagCL_INSTANCE_INFO::hwndMother, ICLS_DDEMLMOTHER, IIF_UNICODE, L, LATOM, LeaveDDECrit, LPVOID, tagCL_INSTANCE_INFO::MonitorFlags, NtUserCallOneParam(), NtUserDdeInitialize(), NtUserDestroyWindow(), NtUserUpdateInstance(), NULL, pciiList, tagCL_INSTANCE_INFO::plaNameService, SetHandleData(), SetWindowLongPtr(), UINT, and ValidateInstance().

Referenced by DdeInitializeA(), and DdeInitializeW().

00070 { 00071 UINT uiRet = DMLERR_MEMORY_ERROR; 00072 register PCL_INSTANCE_INFO pcii; 00073 00074 if (afCmd & APPCLASS_MONITOR) { 00075 afCmd |= CBF_MONMASK; 00076 } 00077 00078 if (afCmd & APPCMD_CLIENTONLY) { 00079 afCmd |= CBF_FAIL_CONNECTIONS; 00080 } 00081 00082 EnterDDECrit; 00083 00084 if (*pidInst != 0) { 00085 pcii = ValidateInstance((HANDLE)LongToHandle( *pidInst )); 00086 if (pcii == NULL) { 00087 uiRet = DMLERR_INVALIDPARAMETER; 00088 goto Exit; 00089 } 00090 00091 // only allow certain bits to be changed on reinitialize call 00092 00093 pcii->afCmd = (pcii->afCmd & ~(CBF_MASK | MF_MASK)) | 00094 (afCmd & (CBF_MASK | MF_MASK)); 00095 00096 LeaveDDECrit; 00097 NtUserUpdateInstance(pcii->hInstServer, &pcii->MonitorFlags, afCmd); 00098 return (DMLERR_NO_ERROR); 00099 } 00100 00101 pcii = (PCL_INSTANCE_INFO)DDEMLAlloc(sizeof(CL_INSTANCE_INFO)); 00102 if (pcii == NULL) { 00103 uiRet = DMLERR_MEMORY_ERROR; 00104 goto Exit; 00105 } 00106 00107 pcii->plaNameService = (LATOM *)DDEMLAlloc(sizeof(LATOM)); 00108 if (pcii->plaNameService == NULL) { 00109 uiRet = DMLERR_MEMORY_ERROR; 00110 goto Backout3; 00111 } 00112 // *pcii->plaNameService = 0; // zero init takes care of this 00113 pcii->cNameServiceAlloc = 1; 00114 00115 00116 /* 00117 * Flag this window as being create from a diff hmod as the app so 00118 * hotkeys don't take it as the first window created in the app and 00119 * assign it as the hotkey. 00120 */ 00121 pcii->hwndMother = _CreateWindowEx(0, (LPTSTR)(gpsi->atomSysClass[ICLS_DDEMLMOTHER]), L"", 00122 WS_POPUP, 0, 0, 0, 0, (HWND)0, 00123 (HMENU)0, 0, (LPVOID)NULL, CW_FLAGS_DIFFHMOD); 00124 00125 if (pcii->hwndMother == 0) { 00126 uiRet = DMLERR_SYS_ERROR; 00127 goto Backout2; 00128 } 00129 SetWindowLongPtr(pcii->hwndMother, GWLP_INSTANCE_INFO, (LONG_PTR)pcii); 00130 00131 pcii->afCmd = afCmd | APPCMD_FILTERINITS; 00132 pcii->pfnCallback = pfnCallback; 00133 // pcii->LastError = DMLERR_NO_ERROR; // zero init 00134 pcii->tid = GetCurrentThreadId(); 00135 // pcii->aServerLookup = NULL; // zero init 00136 // pcii->cServerLookupAlloc = 0; // zero init 00137 // pcii->ConvStartupState = 0; // zero init - Not blocked. 00138 // pcii->flags = 0; // zero init 00139 // pcii->cInDDEMLCallback = 0; // zero init 00140 // pcii->pLinkCounts = NULL; // zero init 00141 00142 // Do this last when the client side is ready for whatever events 00143 // flying around may come charging in. 00144 00145 LeaveDDECrit; 00146 uiRet = NtUserDdeInitialize(&pcii->hInstServer, 00147 &pcii->hwndEvent, 00148 &pcii->MonitorFlags, 00149 pcii->afCmd, 00150 pcii); 00151 EnterDDECrit; 00152 00153 if (uiRet != DMLERR_NO_ERROR) { 00154 Backout: 00155 NtUserDestroyWindow(pcii->hwndMother); 00156 Backout2: 00157 DDEMLFree(pcii->plaNameService); 00158 Backout3: 00159 DDEMLFree(pcii); 00160 goto Exit; 00161 } 00162 pcii->hInstClient = AddInstance(pcii->hInstServer); 00163 *pidInst = HandleToUlong(pcii->hInstClient); 00164 if (pcii->hInstClient == 0) { 00165 LeaveDDECrit; 00166 NtUserCallOneParam((ULONG_PTR)pcii->hInstServer, SFI__CSDDEUNINITIALIZE); 00167 EnterDDECrit; 00168 uiRet = DMLERR_MEMORY_ERROR; 00169 goto Backout; 00170 } 00171 SetHandleData(pcii->hInstClient, (ULONG_PTR)pcii); 00172 00173 pcii->next = pciiList; 00174 pciiList = pcii; 00175 if (fUnicode) { 00176 pcii->flags |= IIF_UNICODE; 00177 } 00178 uiRet = DMLERR_NO_ERROR; 00179 00180 Exit: 00181 LeaveDDECrit; 00182 return (uiRet); 00183 }

DWORD InternalDdeQueryString DWORD  idInst,
HSZ  hsz,
PVOID  psz,
DWORD  cchMax,
INT  iCodePage
 

Definition at line 141 of file hsz.c.

References BestSetLastDDEMLError(), CHAR, DWORD, EnterDDECrit, HSZT_INVALID, L, LATOM_FROM_HSZ, LeaveDDECrit, NULL, SetLastDDEMLError(), UINT, ValidateHSZ(), and ValidateInstance().

Referenced by DdeQueryStringA(), and DdeQueryStringW().

00147 { 00148 PCL_INSTANCE_INFO pcii; 00149 DWORD dwRet = 0; 00150 WCHAR szw[256]; 00151 // BOOL fDefUsed; // LATER 00152 00153 EnterDDECrit; 00154 00155 pcii = ValidateInstance((HANDLE)LongToHandle( idInst )); 00156 if (pcii == NULL) { 00157 BestSetLastDDEMLError(DMLERR_INVALIDPARAMETER); 00158 goto Exit; 00159 } 00160 00161 if (ValidateHSZ(hsz) == HSZT_INVALID) { 00162 SetLastDDEMLError(pcii, DMLERR_INVALIDPARAMETER); 00163 goto Exit; 00164 } 00165 00166 if (LATOM_FROM_HSZ(hsz) == 0) { 00167 if (iCodePage == CP_WINUNICODE) { 00168 if (psz != NULL) { 00169 *(LPWSTR)psz = L'\0'; 00170 } 00171 dwRet = sizeof(WCHAR); 00172 goto Exit; 00173 } else { 00174 if (psz != NULL) { 00175 *(LPSTR)psz = '\0'; 00176 } 00177 dwRet = sizeof(CHAR); 00178 goto Exit; 00179 } 00180 } 00181 00182 if (psz == NULL) { 00183 cbMax = sizeof(szw); 00184 psz = (PVOID)szw; 00185 } 00186 00187 switch (iCodePage) { 00188 case CP_WINANSI: 00189 dwRet = GetAtomNameA(LATOM_FROM_HSZ(hsz), psz, cbMax); 00190 break; 00191 00192 default: 00193 dwRet = GetAtomNameW(LATOM_FROM_HSZ(hsz), (LPWSTR)psz, cbMax / sizeof(WCHAR)); 00194 if (iCodePage != CP_WINUNICODE) { 00195 00196 /* 00197 * convert psz to the appropriate codepage and count the 00198 * characters(ie BYTES for DBCS!) to alter dwRet. 00199 */ 00200 #ifdef LATER 00201 // Does this routine work in place? (i.e. input and output buffer the same). 00202 WideCharToMultiByte((UINT)iCodePage, 0, szw, 00203 sizeof(szw) / sizeof(WCHAR), 00204 (LPSTR)psz, cbMax, NULL, &fDefUsed); 00205 #endif 00206 dwRet = cbMax + 1; 00207 } 00208 break; 00209 } 00210 00211 Exit: 00212 LeaveDDECrit; 00213 return (dwRet); 00214 }

BOOL InternalFreeDataHandle HDDEDATA  hData,
BOOL  fIgnorefRelease
 

Definition at line 416 of file hdata.c.

References BOOL, CheckDDECritIn, DDEMLFree, DestroyHandle(), FALSE, tagDDEMLDATA::flags, FreeDDEData(), tagDDEMLDATA::hDDE, HINST_ANY, HTYPE_DATA_HANDLE, NULL, TRUE, ValidateCHandle(), and WOWGLOBALFREE.

Referenced by _ClientEventCallback(), ApplyFreeDataHandle(), DdeFreeDataHandle(), ProcessDDEMLInitiate(), SvStartAdviseUpdate(), and TransactionComplete().

00419 { 00420 PDDEMLDATA pdd; 00421 00422 CheckDDECritIn; 00423 00424 pdd = (PDDEMLDATA)ValidateCHandle((HANDLE)hData, 00425 HTYPE_DATA_HANDLE, HINST_ANY); 00426 if (pdd == NULL) { 00427 return (FALSE); 00428 } 00429 if (pdd->flags & HDATA_EXECUTE) { 00430 if (!(pdd->flags & HDATA_APPOWNED) || fIgnorefRelease) { 00431 WOWGLOBALFREE(pdd->hDDE); 00432 } 00433 } else { 00434 FreeDDEData(pdd->hDDE, fIgnorefRelease, TRUE); 00435 } 00436 DDEMLFree(pdd); 00437 DestroyHandle((HANDLE)hData); 00438 return (TRUE); 00439 }

VOID LinkTransaction PXACT_INFO  pxi  ) 
 

Definition at line 846 of file xact.c.

References CheckDDECritIn, tagXACT_INFO::next, NULL, tagXACT_INFO::pcoi, tagCONV_INFO::pxiIn, tagCONV_INFO::pxiOut, and VOID().

Referenced by ClStartAdvise(), ClStartExecute(), ClStartPoke(), ClStartRequest(), ClStartUnadvise(), and SvStartAdviseUpdate().

00848 { 00849 CheckDDECritIn; 00850 00851 pxi->next = NULL; 00852 if (pxi->pcoi->pxiOut == NULL) { 00853 pxi->pcoi->pxiIn = pxi->pcoi->pxiOut = pxi; 00854 } else { 00855 pxi->pcoi->pxiIn->next = pxi; 00856 pxi->pcoi->pxiIn = pxi; 00857 } 00858 #if DBG 00859 /* 00860 * Temporary check to find stress bug - make sure pxi list is not 00861 * looped on itself. If it is, this loop will never exit and things 00862 * will get investigated. (sanfords) 00863 */ 00864 { 00865 PXACT_INFO pxiT; 00866 00867 for (pxiT = pxi->pcoi->pxiOut; pxiT != NULL; pxiT = pxiT->next) { 00868 ; 00869 } 00870 } 00871 #endif // DBG 00872 }

GATOM LocalToGlobalAtom LATOM  la  ) 
 

Definition at line 438 of file hsz.c.

References GATOM.

Referenced by ConnectConv(), DdeClientTransaction(), DdeNameService(), DdeReconnect(), DoCallback(), FreeConversationResources(), MonitorConv(), MonitorLink(), ProcessDDEMLInitiate(), and UpdateLinkIfChanged().

00440 { 00441 WCHAR sz[256]; 00442 00443 if (la == 0) { 00444 return (0); 00445 } 00446 if (GetAtomName((ATOM)la, sz, 256) == 0) { 00447 RIPMSG0(RIP_WARNING, "LocalToGlobalAtom out of memory"); 00448 return (0); 00449 } 00450 return ((GATOM)GlobalAddAtom(sz)); 00451 }

LATOM MakeInstSpecificAtom LATOM  la,
HWND  hwnd
 

Definition at line 367 of file hsz.c.

References LATOM, and strlen().

Referenced by ProcessRegistrationMessage().

00370 { 00371 WCHAR sz[256]; 00372 LPWSTR psz; 00373 00374 if (GetAtomName(la, sz, 256) == 0) { 00375 return (0); 00376 } 00377 #ifdef UNICODE 00378 psz = sz + wcslen(sz); 00379 #else 00380 psz = sz + strlen(sz); 00381 #endif 00382 wsprintf(psz, TEXT("(%#p)"), hwnd); 00383 la = AddAtom(sz); 00384 return (la); 00385 }

VOID MonitorConv PCONV_INFO  pcoi,
BOOL  fConnect
 

Definition at line 167 of file monitor.c.

References CheckDDECritIn, DDEMLAlloc, DWORD, EnterDDECrit, Event(), tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, tagCONV_INFO::laService, tagCONV_INFO::laTopic, LeaveDDECrit, LocalToGlobalAtom(), tagCL_INSTANCE_INFO::MonitorFlags, NtGetTickCount(), NULL, tagCONV_INFO::pcii, pcs, pep, SetLastDDEMLError(), tagCONV_INFO::state, tagCL_INSTANCE_INFO::tid, TRUE, and VOID().

00170 { 00171 PEVENT_PACKET pep; 00172 00173 CheckDDECritIn; 00174 00175 UserAssert(pcoi->pcii->MonitorFlags & MF_CONV); 00176 00177 pep = (PEVENT_PACKET)DDEMLAlloc(sizeof(EVENT_PACKET) - sizeof(DWORD) + 00178 sizeof(MONCONVSTRUCT)); 00179 if (pep == NULL) { 00180 SetLastDDEMLError(pcoi->pcii, DMLERR_MEMORY_ERROR); 00181 return ; 00182 } 00183 00184 pep->EventType = MF_CONV; 00185 pep->fSense = TRUE; 00186 pep->cbEventData = sizeof(MONCONVSTRUCT); 00187 00188 #define pcs ((MONCONVSTRUCT *)&pep->Data) 00189 pcs->cb = sizeof(MONCONVSTRUCT); 00190 pcs->fConnect = fConnect; 00191 pcs->dwTime = NtGetTickCount(); 00192 pcs->hTask = (HANDLE)LongToHandle( pcoi->pcii->tid ); 00193 pcs->hszSvc = (HSZ)LocalToGlobalAtom(pcoi->laService); 00194 pcs->hszTopic = (HSZ)LocalToGlobalAtom(pcoi->laTopic); 00195 if (pcoi->state & ST_CLIENT) { 00196 pcs->hConvClient = (HCONV)pcoi->hwndConv; 00197 pcs->hConvServer = (HCONV)pcoi->hwndPartner; 00198 } else { 00199 pcs->hConvClient = (HCONV)pcoi->hwndPartner; 00200 pcs->hConvServer = (HCONV)pcoi->hwndConv; 00201 } 00202 00203 LeaveDDECrit; 00204 Event(pep); 00205 EnterDDECrit; 00206 00207 GlobalDeleteAtom((ATOM)(ULONG_PTR)pcs->hszSvc); 00208 GlobalDeleteAtom((ATOM)(ULONG_PTR)pcs->hszTopic); 00209 #undef pcs 00210 }

VOID MonitorLink PCL_INSTANCE_INFO  pcii,
BOOL  fEstablished,
BOOL  fNoData,
LATOM  laSvc,
LATOM  laTopic,
GATOM  gaItem,
WORD  wFmt,
BOOL  fServer,
HCONV  hConvServer,
HCONV  hConvClient
 

Definition at line 90 of file monitor.c.

References CheckDDECritIn, DDEMLAlloc, DWORD, EnterDDECrit, Event(), IncGlobalAtomCount(), LeaveDDECrit, LocalToGlobalAtom(), tagCL_INSTANCE_INFO::MonitorFlags, NtGetTickCount(), NULL, pep, pls, SetLastDDEMLError(), tagCL_INSTANCE_INFO::tid, TRUE, and VOID().

00101 { 00102 PEVENT_PACKET pep; 00103 00104 CheckDDECritIn; 00105 00106 UserAssert(pcii->MonitorFlags & MF_LINKS); 00107 00108 pep = (PEVENT_PACKET)DDEMLAlloc(sizeof(EVENT_PACKET) - sizeof(DWORD) + 00109 sizeof(MONLINKSTRUCT)); 00110 if (pep == NULL) { 00111 SetLastDDEMLError(pcii, DMLERR_MEMORY_ERROR); 00112 return ; 00113 } 00114 00115 pep->EventType = MF_LINKS; 00116 pep->fSense = TRUE; 00117 pep->cbEventData = sizeof(MONLINKSTRUCT); 00118 00119 #define pls ((MONLINKSTRUCT *)&pep->Data) 00120 pls->cb = sizeof(MONLINKSTRUCT); 00121 pls->dwTime = NtGetTickCount(); 00122 pls->hTask = (HANDLE)LongToHandle( pcii->tid ); 00123 pls->fEstablished = fEstablished; 00124 pls->fNoData = fNoData; 00125 00126 // use global atoms here - these need to be changed to local atoms before 00127 // the callbacks to the ddespy apps. 00128 00129 pls->hszSvc = (HSZ)LocalToGlobalAtom(aService); 00130 pls->hszTopic = (HSZ)LocalToGlobalAtom(aTopic); 00131 IncGlobalAtomCount(aItem); 00132 pls->hszItem = (HSZ)aItem; 00133 00134 pls->wFmt = wFmt; 00135 pls->fServer = fServer; 00136 pls->hConvServer = hConvServer; 00137 pls->hConvClient = hConvClient; 00138 00139 LeaveDDECrit; 00140 Event(pep); 00141 EnterDDECrit; 00142 00143 GlobalDeleteAtom((ATOM)(ULONG_PTR)pls->hszSvc); 00144 GlobalDeleteAtom((ATOM)(ULONG_PTR)pls->hszTopic); 00145 GlobalDeleteAtom(aItem); 00146 #undef pls 00147 }

VOID MonitorStringHandle PCL_INSTANCE_INFO  pcii,
HSZ  hsz,
DWORD  fsAction
 

Definition at line 31 of file monitor.c.

References CheckDDECritIn, DDEMLAlloc, DWORD, EnterDDECrit, Event(), LATOM_FROM_HSZ, LeaveDDECrit, tagCL_INSTANCE_INFO::MonitorFlags, NtGetTickCount(), NULL, pep, phszs, SetLastDDEMLError(), tagCL_INSTANCE_INFO::tid, TRUE, and VOID().

00035 { 00036 WCHAR szT[256]; 00037 PEVENT_PACKET pep; 00038 DWORD cchString; 00039 00040 CheckDDECritIn; 00041 00042 UserAssert(pcii->MonitorFlags & MF_HSZ_INFO); 00043 00044 if (!(cchString = GetAtomName(LATOM_FROM_HSZ(hsz), szT, 00045 sizeof(szT) / sizeof(WCHAR)))) { 00046 SetLastDDEMLError(pcii, DMLERR_INVALIDPARAMETER); 00047 return ; 00048 } 00049 cchString++; 00050 pep = (PEVENT_PACKET)DDEMLAlloc(sizeof(EVENT_PACKET) - sizeof(DWORD) + 00051 sizeof(MONHSZSTRUCT) + cchString * sizeof(WCHAR)); 00052 if (pep == NULL) { 00053 SetLastDDEMLError(pcii, DMLERR_MEMORY_ERROR); 00054 return ; 00055 } 00056 00057 pep->EventType = MF_HSZ_INFO; 00058 pep->fSense = TRUE; 00059 pep->cbEventData = (WORD)(sizeof(MONHSZSTRUCT) + cchString * sizeof(WCHAR)); 00060 00061 #define phszs ((MONHSZSTRUCT *)&pep->Data) 00062 phszs->cb = sizeof(MONHSZSTRUCT); 00063 phszs->fsAction = fsAction; 00064 phszs->dwTime = NtGetTickCount(); 00065 phszs->hsz = hsz; 00066 phszs->hTask = (HANDLE)LongToHandle( pcii->tid ); 00067 // phszs->wReserved = 0; // zero init. 00068 wcscpy(phszs->str, szT); 00069 00070 LeaveDDECrit; 00071 Event(pep); 00072 EnterDDECrit; 00073 #undef phszs 00074 }

DWORD PackAndPostMessage HWND  hwndTo,
UINT  msgIn,
UINT  msgOut,
HWND  hwndFrom,
LPARAM  lParam,
UINT_PTR  uiLo,
UINT_PTR  uiHi
 

Definition at line 1534 of file stdptcl.c.

References CheckDDECritIn, CheckDDECritOut, DWORD, EnterDDECrit, FAIL_POST, FAILNOFREE_POST, FreeDDElParam(), LeaveDDECrit, PostMessage(), ReuseDDElParam(), and TRUE.

Referenced by ClRespRequestData(), ClSpontAdviseData(), ClStartAdvise(), ClStartExecute(), ClStartPoke(), ClStartRequest(), ClStartUnadvise(), SvSpontAdvise(), SvSpontExecute(), SvSpontPoke(), SvSpontRequest(), SvSpontUnadvise(), and SvStartAdviseUpdate().

01542 { 01543 DWORD retval; 01544 01545 lParam = ReuseDDElParam(lParam, msgIn, msgOut, uiLo, uiHi); 01546 if (!lParam) { 01547 return (DMLERR_MEMORY_ERROR); 01548 } 01549 CheckDDECritIn; 01550 LeaveDDECrit; 01551 CheckDDECritOut; 01552 01553 retval = (DWORD)PostMessage(hwndTo, msgOut, (WPARAM)hwndFrom, lParam); 01554 switch (retval) { 01555 case FAIL_POST: 01556 #if (FAIL_POST != FALSE) 01557 #error FAIL_POST must be defined as PostMessage's failure return value. 01558 #endif 01559 FreeDDElParam(msgOut, lParam); 01560 RIPMSG0(RIP_WARNING, "PostMessage failed."); 01561 /* Fall through */ 01562 01563 case FAILNOFREE_POST: 01564 retval = DMLERR_POSTMSG_FAILED; 01565 break; 01566 01567 default: 01568 #if (FAKE_POST != TRUE) 01569 #error FAKE_POST must be defined as PostMessage's success return value. 01570 #endif 01571 UserAssert(retval == TRUE); 01572 retval = 0; 01573 } 01574 01575 EnterDDECrit; 01576 return (retval); 01577 }

HWND ParseInstSpecificAtom LATOM  la,
LATOM plaNormal
 

Definition at line 398 of file hsz.c.

References CHAR, and NULL.

Referenced by ValidateConnectParameters().

00401 { 00402 CHAR sz[256]; 00403 LPSTR pszHwnd; 00404 HWND hwnd; 00405 00406 /* 00407 * LATER- NEED TO MAKE THIS UNICODE BASED WHEN WE GET A SCANF WE CAN USE 00408 */ 00409 if (GetAtomNameA(la, sz, 256) == 0) { 00410 return (0); 00411 } 00412 pszHwnd = strrchr(sz, '('); 00413 if (pszHwnd == NULL) { 00414 return (0); 00415 } 00416 if (sscanf(pszHwnd, "(%#p)", &hwnd) != 1) { 00417 return (0); 00418 } 00419 if (plaNormal != NULL) { 00420 *pszHwnd = '\0'; 00421 *plaNormal = AddAtomA(sz); 00422 } 00423 return (hwnd); 00424 }

PCL_INSTANCE_INFO PciiFromHandle HANDLE  h  ) 
 

Definition at line 226 of file handles.c.

References aHandleEntry, cHandlesAllocated, CheckDDECritIn, tagCHANDLEENTRY::dwData, tagCHANDLEENTRY::handle, HTYPE_INSTANCE, InstFromHandle, NULL, and TypeFromHandle.

Referenced by DdeAccessData(), DdeAddData(), DdeDisconnect(), DdeDisconnectList(), DdeGetData(), DdeImpersonateClient(), DdeQueryNextServer(), and DdeReconnect().

00228 { 00229 PCHANDLEENTRY phe; 00230 00231 CheckDDECritIn; 00232 00233 if (!cHandlesAllocated) { 00234 return(NULL); 00235 } 00236 phe = &aHandleEntry[cHandlesAllocated]; 00237 00238 do { 00239 phe--; 00240 if (phe->handle != 0 && 00241 TypeFromHandle(phe->handle) == HTYPE_INSTANCE && 00242 (InstFromHandle(phe->handle) == InstFromHandle(h))) { 00243 return(((PCL_INSTANCE_INFO)phe->dwData)->tid == GetCurrentThreadId() ? 00244 (PCL_INSTANCE_INFO)phe->dwData : NULL); 00245 } 00246 } while (phe != aHandleEntry); 00247 return(NULL); 00248 }

VOID ProcessAsyncDDEMsg PCONV_INFO  pcoi,
UINT  msg,
HWND  hwndFrom,
LPARAM  lParam
 

Definition at line 572 of file ddemlwp.c.

References CheckForQueuedMessages(), tagCONV_INFO::cLocks, DDEMLAlloc, tagCONV_INFO::dmqIn, tagCONV_INFO::dmqOut, DumpDDEMessage(), FALSE, FreeConversationResources(), tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, tagDDE_MESSAGE_QUEUE::lParam, msg, tagDDE_MESSAGE_QUEUE::msg, tagCONV_INFO::next, tagDDE_MESSAGE_QUEUE::next, NULL, tagDDE_MESSAGE_QUEUE::pcoi, PostMessage(), ProcessSyncDDEMessage(), tagCONV_INFO::state, and VOID().

Referenced by DDEMLClientWndProc(), and DDEMLServerWndProc().

00577 { 00578 PDDE_MESSAGE_QUEUE pdmq; 00579 #if DBG 00580 HWND hwndT = pcoi->hwndConv; 00581 #endif // DBG 00582 00583 while (pcoi != NULL && pcoi->hwndPartner != hwndFrom) { 00584 pcoi = pcoi->next; 00585 } 00586 if (pcoi == NULL) { 00587 RIPMSG3(RIP_WARNING, 00588 "Bogus DDE message %x received from %x by %x. Dumping.", 00589 msg, hwndFrom, hwndT); 00590 DumpDDEMessage(FALSE, msg, lParam); 00591 return ; 00592 } 00593 if (pcoi->state & ST_CONNECTED) { 00594 00595 if (pcoi->dmqOut == NULL && 00596 !(pcoi->state & ST_BLOCKED) 00597 // && !PctiCurrent()->cInDDEMLCallback 00598 ) { 00599 00600 if (ProcessSyncDDEMessage(pcoi, msg, lParam)) { 00601 return; // not blocked, ok to return. 00602 } 00603 } 00604 00605 // enter into queue 00606 00607 pdmq = DDEMLAlloc(sizeof(DDE_MESSAGE_QUEUE)); 00608 if (pdmq == NULL) { 00609 00610 // insufficient memory - we can't process this msg - we MUST 00611 // terminate. 00612 00613 if (pcoi->state & ST_CONNECTED) { 00614 PostMessage(pcoi->hwndPartner, WM_DDE_TERMINATE, 00615 (WPARAM)pcoi->hwndConv, 0); 00616 pcoi->state &= ~ST_CONNECTED; 00617 } 00618 DumpDDEMessage(!(pcoi->state & ST_INTRA_PROCESS), msg, lParam); 00619 return ; 00620 } 00621 pdmq->pcoi = pcoi; 00622 pdmq->msg = msg; 00623 pdmq->lParam = lParam; 00624 pdmq->next = NULL; 00625 00626 // dmqOut->next->next->next->dmqIn->NULL 00627 00628 if (pcoi->dmqIn != NULL) { 00629 pcoi->dmqIn->next = pdmq; 00630 } 00631 pcoi->dmqIn = pdmq; 00632 if (pcoi->dmqOut == NULL) { 00633 pcoi->dmqOut = pcoi->dmqIn; 00634 } 00635 pcoi->cLocks++; 00636 CheckForQueuedMessages(pcoi); 00637 pcoi->cLocks--; 00638 if (pcoi->cLocks == 0 && pcoi->state & ST_FREE_CONV_RES_NOW) { 00639 FreeConversationResources(pcoi); 00640 } 00641 } else { 00642 DumpDDEMessage(!(pcoi->state & ST_INTRA_PROCESS), msg, lParam); 00643 } 00644 }

LRESULT ProcessRegistrationMessage HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 90 of file register.c.

References tagCL_INSTANCE_INFO::afCmd, CheckDDECritOut, DoCallback(), EnterDDECrit, GATOM, GetWindowLongPtr(), GlobalToLocalAtom(), GWLP_INSTANCE_INFO, HMValidateHandleNoRip(), INST_SPECIFIC_HSZ_FROM_LATOM, L, LATOM, LeaveDDECrit, MakeInstSpecificAtom(), msg, NORMAL_HSZ_FROM_LATOM, NULL, PtoH, and TYPE_WINDOW.

Referenced by DDEMLMotherWndProc().

00095 { 00096 PCL_INSTANCE_INFO pcii; 00097 LRESULT lRet = 0; 00098 00099 CheckDDECritOut; 00100 00101 /* 00102 * wParam = GATOM of app 00103 * lParam = hwndListen of source - may be a WOW DDEML source unthunked. 00104 */ 00105 lParam = (LPARAM)HMValidateHandleNoRip((HWND)lParam, TYPE_WINDOW); 00106 lParam = (LPARAM)PtoH((PVOID)lParam); 00107 00108 if (lParam == 0) { 00109 return(0); 00110 } 00111 00112 EnterDDECrit; 00113 00114 pcii = (PCL_INSTANCE_INFO)GetWindowLongPtr(hwnd, GWLP_INSTANCE_INFO); 00115 if (pcii != NULL && 00116 !((msg == UM_REGISTER) && (pcii->afCmd & CBF_SKIP_REGISTRATIONS)) && 00117 !((msg == UM_UNREGISTER) && (pcii->afCmd & CBF_SKIP_UNREGISTRATIONS))) { 00118 00119 LATOM la, lais; 00120 00121 la = GlobalToLocalAtom((GATOM)wParam); 00122 lais = MakeInstSpecificAtom(la, (HWND)lParam); 00123 00124 DoCallback(pcii, 00125 (WORD)((msg == UM_REGISTER) ? XTYP_REGISTER : XTYP_UNREGISTER), 00126 0, 00127 (HCONV)0L, 00128 (HSZ)NORMAL_HSZ_FROM_LATOM(la), 00129 INST_SPECIFIC_HSZ_FROM_LATOM(lais), 00130 (HDDEDATA)0L, 00131 0L, 00132 0L); 00133 00134 DeleteAtom(la); 00135 DeleteAtom(lais); 00136 lRet = 1; 00137 } 00138 00139 GlobalDeleteAtom((ATOM)wParam); // receiver frees 00140 LeaveDDECrit; 00141 return(1); 00142 }

BOOL ProcessSyncDDEMessage PCONV_INFO  pcoi,
UINT  msg,
LPARAM  lParam
 

Definition at line 782 of file ddemlwp.c.

References tagCL_INSTANCE_INFO::afCmd, BOOL, CheckDDECritIn, tagCL_INSTANCE_INFO::cInDDEMLCallback, tagCONV_INFO::cLocks, DdeUninitialize(), DumpDDEMessage(), EnableEnumProc(), EnumChildWindows(), FALSE, tagCL_INSTANCE_INFO::flags, FreeConversationResources(), HINST_ANY, tagCL_INSTANCE_INFO::hInstClient, HTYPE_TRANSACTION, tagCL_INSTANCE_INFO::hwndMother, tagXACT_INFO::hXact, IIF_IN_SYNC_XACT, msg, NULL, tagCONV_INFO::pcii, tagXACT_INFO::pfnResponse, tagENABLE_ENUM_STRUCT::pfRet, tagCONV_INFO::pxiOut, SpontaneousClientMessage(), SpontaneousServerMessage(), tagCONV_INFO::state, TRUE, ValidateCHandle(), tagENABLE_ENUM_STRUCT::wCmd, and tagENABLE_ENUM_STRUCT::wCmd2.

Referenced by CheckForQueuedMessages(), and ProcessAsyncDDEMsg().

00786 { 00787 BOOL fNotBlocked = TRUE; 00788 PCL_INSTANCE_INFO pcii; 00789 ENABLE_ENUM_STRUCT ees; 00790 BOOL fRet; 00791 00792 CheckDDECritIn; 00793 00794 /* 00795 * lock the conversation so its resources don't go away till we are 00796 * done with them. This function could generate a callback which could 00797 * disconnect the conversation. 00798 */ 00799 pcoi->cLocks++; 00800 00801 if (pcoi->state & ST_BLOCKNEXT) { 00802 pcoi->state ^= ST_BLOCKNEXT | ST_BLOCKED; 00803 } 00804 if (pcoi->state & ST_BLOCKALLNEXT) { 00805 ees.pfRet = &fRet; 00806 ees.wCmd = EC_DISABLE; 00807 ees.wCmd2 = 0; 00808 EnumChildWindows(pcoi->pcii->hwndMother, (WNDENUMPROC)EnableEnumProc, 00809 (LPARAM)&ees); 00810 } 00811 00812 if (pcoi->state & ST_CONNECTED) { 00813 if (pcoi->pxiOut == NULL) { 00814 if (pcoi->state & ST_CLIENT) { 00815 fNotBlocked = SpontaneousClientMessage((PCL_CONV_INFO)pcoi, msg, lParam); 00816 } else { 00817 fNotBlocked = SpontaneousServerMessage((PSVR_CONV_INFO)pcoi, msg, lParam); 00818 } 00819 } else { 00820 UserAssert(pcoi->pxiOut->hXact == (HANDLE)0 || 00821 ValidateCHandle(pcoi->pxiOut->hXact, HTYPE_TRANSACTION, 00822 HINST_ANY) 00823 == (ULONG_PTR)pcoi->pxiOut); 00824 fNotBlocked = (pcoi->pxiOut->pfnResponse)(pcoi->pxiOut, msg, lParam); 00825 } 00826 } else { 00827 DumpDDEMessage(!(pcoi->state & ST_INTRA_PROCESS), msg, lParam); 00828 } 00829 if (!fNotBlocked) { 00830 pcoi->state |= ST_BLOCKED; 00831 pcoi->state &= ~ST_BLOCKNEXT; 00832 } 00833 00834 pcii = pcoi->pcii; // save this incase unlocking makes pcoi go away. 00835 00836 pcoi->cLocks--; 00837 if (pcoi->cLocks == 0 && pcoi->state & ST_FREE_CONV_RES_NOW) { 00838 FreeConversationResources(pcoi); 00839 } 00840 00841 /* 00842 * Because callbacks are capable of blocking DdeUninitialize(), we check 00843 * before exit to see if it needs to be called. 00844 */ 00845 if (pcii->afCmd & APPCMD_UNINIT_ASAP && 00846 !(pcii->flags & IIF_IN_SYNC_XACT) && 00847 !pcii->cInDDEMLCallback) { 00848 DdeUninitialize(HandleToUlong(pcii->hInstClient)); 00849 return(FALSE); 00850 } 00851 return (fNotBlocked); 00852 }

PCONV_INFO ProcessTerminateMsg PCONV_INFO  pcoi,
HWND  hwndFrom
 

Definition at line 543 of file ddemlwp.c.

References tagCONV_INFO::hwndPartner, tagCONV_INFO::next, NULL, ShutdownConversation(), tagCONV_INFO::state, and TRUE.

Referenced by DDEMLClientWndProc(), DDEMLServerWndProc(), and WaitForZombieTerminate().

00546 { 00547 while (pcoi != NULL && pcoi->hwndPartner != hwndFrom) { 00548 pcoi = pcoi->next; 00549 } 00550 if (pcoi != NULL) { 00551 pcoi->state |= ST_TERMINATE_RECEIVED; 00552 ShutdownConversation(pcoi, TRUE); 00553 } 00554 return (pcoi); 00555 }

VOID RegisterService BOOL  fRegister,
GATOM  gaApp,
HWND  hwndListen
 

Definition at line 68 of file register.c.

References tagSERVERINFO::atomSysClass, CheckDDECritOut, gpsi, ICLS_DDEML16BIT, ICLS_DDEMLMOTHER, SendRegisterMessageToClass(), and VOID().

Referenced by DdeNameService().

00072 { 00073 CheckDDECritOut; 00074 00075 /* 00076 * Send notification to each DDEML32 listening window. 00077 */ 00078 SendRegisterMessageToClass(gpsi->atomSysClass[ICLS_DDEMLMOTHER], fRegister ? UM_REGISTER : UM_UNREGISTER, 00079 gaApp, hwndListen, fRegister); 00080 /* 00081 * Send notification to each DDEML16 listening window. 00082 */ 00083 SendRegisterMessageToClass(gpsi->atomSysClass[ICLS_DDEML16BIT], fRegister ? UM_REGISTER : UM_UNREGISTER, 00084 gaApp, hwndListen, fRegister); 00085 }

BOOL RW_RegisterDDEML void   ) 
 

Referenced by ClientThreadSetup(), and CtxInitUser32().

VOID SetCommonStateFlags HWND  hwndUs,
HWND  hwndThem,
PWORD  pwFlags
 

Definition at line 876 of file connect.c.

References DWORD, GetWindowThreadProcessId(), IsWindowUnicode(), and VOID().

Referenced by DDEMLClientWndProc(), and ProcessDDEMLInitiate().

00880 { 00881 DWORD pidUs, pidThem; 00882 00883 GetWindowThreadProcessId(hwndUs, &pidUs); 00884 GetWindowThreadProcessId(hwndThem, &pidThem); 00885 if (pidUs == pidThem) { 00886 *pwFlags |= ST_INTRA_PROCESS; 00887 } 00888 00889 if (IsWindowUnicode(hwndUs) && IsWindowUnicode(hwndThem)) { 00890 *pwFlags |= ST_UNICODE_EXECUTE; 00891 } 00892 }

VOID SetConvContext HWND  hwnd,
LONG *  pl
 

Definition at line 387 of file xact.c.

References GWL_CONVCONTEXT, and VOID().

Referenced by ConnectConv().

00390 { 00391 int i; 00392 00393 for (i = 0; i < sizeof(CONVCONTEXT); i += 4) { 00394 SetWindowLong(hwnd, GWL_CONVCONTEXT + i, *pl++); 00395 } 00396 }

BOOL SetEnableState PCONV_INFO  pcoi,
UINT  wCmd
 

Definition at line 441 of file w32/ntuser/client/callback.c.

References BOOL, CheckForQueuedMessages(), CI_PROCESSING_QUEUE, tagCONV_INFO::dmqOut, FALSE, GetClientInfo, tagDDE_MESSAGE_QUEUE::next, NULL, tagCONV_INFO::state, and TRUE.

Referenced by DdeEnableCallback(), and EnableEnumProc().

00444 { 00445 BOOL fRet = TRUE; 00446 00447 switch (wCmd) { 00448 case EC_CHECKQUEUEONCE: 00449 case EC_CHECKQUEUE: 00450 fRet = CheckForQueuedMessages(pcoi); 00451 break; 00452 00453 case EC_QUERYWAITING: 00454 fRet = !(pcoi->dmqOut == NULL || 00455 (pcoi->dmqOut->next == NULL && 00456 GetClientInfo()->CI_flags & CI_PROCESSING_QUEUE)); 00457 break; 00458 00459 case EC_DISABLE: 00460 pcoi->state |= ST_BLOCKED; 00461 pcoi->state &= ~(ST_BLOCKNEXT | ST_BLOCKALLNEXT); 00462 break; 00463 00464 case EC_ENABLEONE: 00465 pcoi->state &= ~ST_BLOCKED; 00466 pcoi->state |= ST_BLOCKNEXT; 00467 break; 00468 00469 case EC_ENABLEONEOFALL: 00470 pcoi->state &= ~ST_BLOCKED; 00471 pcoi->state |= (ST_BLOCKNEXT | ST_BLOCKALLNEXT); 00472 break; 00473 00474 case EC_ENABLEALL: 00475 pcoi->state &= ~(ST_BLOCKED | ST_BLOCKNEXT | ST_BLOCKALLNEXT); 00476 break; 00477 00478 default: 00479 return(FALSE); 00480 } 00481 return (fRet); 00482 }

VOID SetHandleData HANDLE  h,
ULONG_PTR  dwData
 

Definition at line 185 of file handles.c.

References aHandleEntry, tagCHANDLEENTRY::dwData, IndexFromHandle, and VOID().

Referenced by DdeConnectList(), and InternalDdeInitialize().

00188 { 00189 aHandleEntry[IndexFromHandle(h)].dwData = dwData; 00190 }

VOID SetLastDDEMLError PCL_INSTANCE_INFO  pcii,
DWORD  error
 

Definition at line 137 of file instance.c.

References tagCL_INSTANCE_INFO::afCmd, DDEMLAlloc, DWORD, EnterDDECrit, Event(), GetCurrentProcessId, tagCL_INSTANCE_INFO::LastError, LeaveDDECrit, tagCL_INSTANCE_INFO::MonitorFlags, NtGetTickCount(), NULL, pep, perrs, tagCL_INSTANCE_INFO::tid, TRUE, and VOID().

Referenced by AddLink(), BestSetLastDDEMLError(), ClRespRequestData(), ClSpontAdviseData(), ClStartAdvise(), ClStartExecute(), ClStartPoke(), ClStartRequest(), ClStartUnadvise(), ConnectConv(), DdeAbandonTransaction(), DdeAddData(), DdeClientTransaction(), DdeConnect(), DdeConnectList(), DdeCreateDataHandle(), DdeEnableCallback(), DdeFreeStringHandle(), DdeGetData(), DdeKeepStringHandle(), DdeNameService(), DdePostAdvise(), DdeQueryConvInfo(), DdeQueryNextServer(), DdeReconnect(), InternalDdeQueryString(), MonitorConv(), MonitorLink(), MonitorStringHandle(), SvSpontAdvise(), SvSpontExecute(), SvSpontPoke(), SvSpontRequest(), SvSpontUnadvise(), SvStartAdviseUpdate(), TransactionComplete(), ValidateConnectParameters(), and ValidateTransaction().

00140 { 00141 PEVENT_PACKET pep; 00142 00143 if (pcii->MonitorFlags & MF_ERRORS && !(pcii->afCmd & APPCLASS_MONITOR)) { 00144 pep = (PEVENT_PACKET)DDEMLAlloc(sizeof(EVENT_PACKET) - sizeof(DWORD) + 00145 sizeof(MONERRSTRUCT)); 00146 if (pep != NULL) { 00147 pep->EventType = MF_ERRORS; 00148 pep->fSense = TRUE; 00149 pep->cbEventData = sizeof(MONERRSTRUCT); 00150 #define perrs ((MONERRSTRUCT *)&pep->Data) 00151 perrs->cb = sizeof(MONERRSTRUCT); 00152 perrs->wLastError = (WORD)error; 00153 perrs->dwTime = NtGetTickCount(); 00154 perrs->hTask = (HANDLE)LongToHandle( pcii->tid ); 00155 #undef perrs 00156 LeaveDDECrit; 00157 Event(pep); 00158 EnterDDECrit; 00159 } 00160 } 00161 #if DBG 00162 if (error != 0 && error != DMLERR_NO_CONV_ESTABLISHED) { 00163 RIPMSG3(RIP_WARNING, 00164 "DDEML Error set=%x, Client Instance=%x, Process=%x.", 00165 error, pcii, GetCurrentProcessId()); 00166 } 00167 #endif 00168 pcii->LastError = error; 00169 }

VOID ShutdownConversation PCONV_INFO  pcoi,
BOOL  fMakeCallback
 

Definition at line 1109 of file connect.c.

References tagCL_INSTANCE_INFO::afCmd, CheckDDECritIn, DoCallback(), FALSE, FreeConversationResources(), tagCONV_INFO::hConv, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, IsWindow(), L, MONCONV, tagCONV_INFO::pcii, PostMessage(), tagCONV_INFO::state, and VOID().

Referenced by DdeConnectList(), DdeDisconnect(), DdeDisconnectList(), DisconnectConv(), ProcessTerminateMsg(), and SpontaneousClientMessage().

01112 { 01113 CheckDDECritIn; 01114 01115 if (pcoi->state & ST_CONNECTED) { 01116 pcoi->state &= ~ST_CONNECTED; 01117 01118 if (IsWindow(pcoi->hwndPartner)) { 01119 PostMessage(pcoi->hwndPartner, WM_DDE_TERMINATE, 01120 (WPARAM)pcoi->hwndConv, 0); 01121 } 01122 if (fMakeCallback && !(pcoi->pcii->afCmd & CBF_SKIP_DISCONNECTS)) { 01123 DoCallback(pcoi->pcii, (WORD)XTYP_DISCONNECT, 0, pcoi->hConv, 01124 0, 0, 0, 0, (pcoi->state & ST_ISSELF) ? 1L : 0L); 01125 } 01126 MONCONV(pcoi, FALSE); 01127 } 01128 01129 FreeConversationResources(pcoi); 01130 }

BOOL SpontaneousClientMessage PCL_CONV_INFO  pci,
UINT  msg,
LPARAM  lParam
 

Definition at line 1396 of file stdptcl.c.

References BOOL, tagCL_CONV_INFO::ci, ClSpontAdviseData(), DumpDDEMessage(), msg, ShutdownConversation(), tagCONV_INFO::state, and TRUE.

Referenced by ClRespAdviseAck(), ClRespExecuteAck(), ClRespPokeAck(), ClRespRequestData(), ClRespUnadviseAck(), and ProcessSyncDDEMessage().

01400 { 01401 switch (msg) { 01402 case WM_DDE_DATA: 01403 return (ClSpontAdviseData(pci, lParam)); 01404 break; 01405 01406 default: 01407 DumpDDEMessage(!(pci->ci.state & ST_INTRA_PROCESS), msg, lParam); 01408 ShutdownConversation((PCONV_INFO)pci, TRUE); 01409 return (TRUE); 01410 } 01411 }

BOOL SpontaneousServerMessage PSVR_CONV_INFO  psi,
UINT  msg,
LPARAM  lParam
 

Definition at line 1424 of file stdptcl.c.

References BOOL, tagSVR_CONV_INFO::ci, DumpDDEMessage(), msg, tagCONV_INFO::state, SvSpontAdvise(), SvSpontExecute(), SvSpontPoke(), SvSpontRequest(), SvSpontUnadvise(), and TRUE.

Referenced by ProcessSyncDDEMessage(), and SvRespAdviseDataAck().

01428 { 01429 switch (msg) { 01430 case WM_DDE_ADVISE: 01431 return (SvSpontAdvise(psi, lParam)); 01432 break; 01433 01434 case WM_DDE_UNADVISE: 01435 return (SvSpontUnadvise(psi, lParam)); 01436 break; 01437 01438 case WM_DDE_EXECUTE: 01439 return (SvSpontExecute(psi, lParam)); 01440 break; 01441 01442 case WM_DDE_POKE: 01443 return (SvSpontPoke(psi, lParam)); 01444 break; 01445 01446 case WM_DDE_REQUEST: 01447 return (SvSpontRequest(psi, lParam)); 01448 break; 01449 01450 default: 01451 DumpDDEMessage(!(psi->ci.state & ST_INTRA_PROCESS), msg, lParam); 01452 01453 /* 01454 * It use to call ShutdownConversation here. Don't call it 01455 * anymore. Fix for bugs: 49063, 70906 01456 */ 01457 //ShutdownConversation((PCONV_INFO)psi, TRUE); 01458 return (TRUE); 01459 } 01460 }

BOOL SvRespAdviseDataAck PXACT_INFO  pxi,
UINT  msg,
LPARAM  lParam
 

Definition at line 470 of file stdptcl.c.

References ADVST_WAITING, tagCONV_INFO::aLinks, BOOL, tagCONV_INFO::cLinks, DDEMLAlloc, DDEMLFree, FALSE, FreeDDEData(), FreeDDElParam(), tagXACT_INFO::gaItem, GATOM, GlobalToLocalAtom(), tagXACT_INFO::hDDESent, tagADVISE_LINK::laItem, LATOM, msg, tagXACT_INFO::pcoi, SpontaneousServerMessage(), tagADVISE_LINK::state, TRUE, UnlinkTransaction(), UnpackDDElParam(), UpdateLinkIfChanged(), and XACT_INFO.

Referenced by SvStartAdviseUpdate(), and UpdateLinkIfChanged().

00474 { 00475 UINT_PTR uiLo, uiHi; 00476 int iLink; 00477 PADVISE_LINK paLink; 00478 PXACT_INFO pxiNew; 00479 LATOM la; 00480 BOOL fSwapped; 00481 #if DBG 00482 int cLinks; 00483 #endif 00484 00485 if (msg) { 00486 if (msg != WM_DDE_ACK) { 00487 return (SpontaneousServerMessage((PSVR_CONV_INFO)pxi->pcoi, msg, lParam)); 00488 } 00489 UnpackDDElParam(WM_DDE_ACK, lParam, &uiLo, &uiHi); 00490 if ((GATOM)uiHi != pxi->gaItem) { 00491 RIPMSG0(RIP_ERROR, "DDE Protocol violation: Data ACK had wrong item"); 00492 return (SpontaneousServerMessage((PSVR_CONV_INFO)pxi->pcoi, msg, lParam)); 00493 } 00494 00495 GlobalDeleteAtom((ATOM)uiHi); // message copy 00496 FreeDDElParam(WM_DDE_ACK, lParam); 00497 00498 if (!((uiLo & DDE_FACK) && pxi->hDDESent)) { 00499 FreeDDEData(pxi->hDDESent, FALSE, TRUE); 00500 } 00501 00502 #if DBG 00503 /* 00504 * Rememeber the number of links so we can assert if they change during the loop below 00505 */ 00506 cLinks = pxi->pcoi->cLinks; 00507 #endif 00508 /* 00509 * locate link info and clear ADVST_WAITING bit 00510 */ 00511 la = GlobalToLocalAtom((GATOM)uiHi); 00512 paLink = pxi->pcoi->aLinks; 00513 for (iLink = 0; iLink < pxi->pcoi->cLinks; iLink++, paLink++) { 00514 if (paLink->laItem == la && 00515 paLink->state & ADVST_WAITING) { 00516 paLink->state &= ~ADVST_WAITING; 00517 /* 00518 * We have to allocate pxiNew because it may become linked 00519 * into pcoi->pxiIn. 00520 */ 00521 pxiNew = (PXACT_INFO)DDEMLAlloc(sizeof(XACT_INFO)); 00522 00523 if (pxiNew && !UpdateLinkIfChanged(paLink, pxiNew, pxi->pcoi, 00524 &pxi->pcoi->aLinks[pxi->pcoi->cLinks - 1], &fSwapped, 00525 CADV_LATEACK)) { 00526 /* 00527 * Not used, free it. 00528 */ 00529 DDEMLFree(pxiNew); 00530 } 00531 break; 00532 } 00533 } 00534 #if DBG 00535 if (cLinks != pxi->pcoi->cLinks) { 00536 RIPMSG1(RIP_ERROR, "SvRespAdviseDataAck: cLinks changed. pxi:%#p", pxi); 00537 } 00538 #endif 00539 00540 DeleteAtom(la); 00541 } 00542 GlobalDeleteAtom(pxi->gaItem); // pxi copy 00543 UnlinkTransaction(pxi); 00544 DDEMLFree(pxi); 00545 return (TRUE); 00546 }

BOOL SvSpontAdvise PSVR_CONV_INFO  psi,
LPARAM  lParam
 

Definition at line 112 of file stdptcl.c.

References AddLink(), tagCL_INSTANCE_INFO::afCmd, BOOL, tagSVR_CONV_INFO::ci, DoCallback(), DWORD, ExtractDDEDataInfo(), FALSE, GATOM, GlobalToLocalAtom(), tagCONV_INFO::hConv, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, tagCONV_INFO::laService, LATOM, tagCONV_INFO::laTopic, MONLINK, NORMAL_HSZ_FROM_LATOM, PackAndPostMessage(), tagCONV_INFO::pcii, PSVR_CONV_INFO, SetLastDDEMLError(), TRUE, UnpackDDElParam(), and WOWGLOBALFREE.

Referenced by SpontaneousServerMessage().

00115 { 00116 UINT_PTR uiHi; 00117 HANDLE hDDE; 00118 WORD wFmt, wStatus; 00119 ULONG_PTR dwRet = 0; 00120 DWORD dwError; 00121 LATOM la; 00122 00123 UnpackDDElParam(WM_DDE_ADVISE, lParam, (PUINT_PTR)&hDDE, &uiHi); 00124 if (psi->ci.pcii->afCmd & CBF_FAIL_ADVISES) { 00125 goto Ack; 00126 } 00127 00128 if (!ExtractDDEDataInfo(hDDE, &wStatus, &wFmt)) { 00129 goto Ack; 00130 } 00131 00132 if (wStatus & DDE_FDEFERUPD) { 00133 wStatus &= ~DDE_FACKREQ; // warm links shouldn't have this flag set 00134 } 00135 00136 la = GlobalToLocalAtom((GATOM)uiHi); 00137 dwRet = (ULONG_PTR)DoCallback(psi->ci.pcii, 00138 XTYP_ADVSTART, 00139 wFmt, psi->ci.hConv, 00140 NORMAL_HSZ_FROM_LATOM(psi->ci.laTopic), 00141 NORMAL_HSZ_FROM_LATOM(la), 00142 (HDDEDATA)0, 0, 0); 00143 DeleteAtom(la); 00144 00145 // check CBR_BLOCK case 00146 00147 if (dwRet == (ULONG_PTR)CBR_BLOCK) { 00148 return (FALSE); 00149 } 00150 00151 if (dwRet) { 00152 // 00153 // If we fail to add the link internally, dwRet == 0 -> NACK 00154 // 00155 dwRet = AddLink((PCONV_INFO)psi, (GATOM)uiHi, wFmt, 00156 (WORD)(wStatus & (WORD)(DDE_FDEFERUPD | DDE_FACKREQ))); 00157 if (dwRet) { 00158 MONLINK(psi->ci.pcii, TRUE, wStatus & DDE_FDEFERUPD, psi->ci.laService, 00159 psi->ci.laTopic, (GATOM)uiHi, wFmt, TRUE, 00160 (HCONV)psi->ci.hwndConv, (HCONV)psi->ci.hwndPartner); 00161 } 00162 } 00163 00164 Ack: 00165 if (dwRet) { 00166 WOWGLOBALFREE(hDDE); // hOptions - NACK -> HE frees it. 00167 } 00168 // IncGlobalAtomCount((GATOM)uiHi); // message copy - reuse 00169 dwError = PackAndPostMessage(psi->ci.hwndPartner, WM_DDE_ADVISE, WM_DDE_ACK, 00170 psi->ci.hwndConv, lParam, dwRet ? DDE_FACK : 0, uiHi); 00171 if (dwError) { 00172 SetLastDDEMLError(psi->ci.pcii, dwError); 00173 GlobalDeleteAtom((ATOM)uiHi); // message copy 00174 } 00175 00176 return (TRUE); 00177 }

BOOL SvSpontPoke PSVR_CONV_INFO  psi,
LPARAM  lParam
 

Definition at line 1042 of file stdptcl.c.

References tagCL_INSTANCE_INFO::afCmd, BOOL, tagSVR_CONV_INFO::ci, DoCallback(), DWORD, ExtractDDEDataInfo(), FALSE, FreeDDEData(), GATOM, GlobalToLocalAtom(), tagCONV_INFO::hConv, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, InternalCreateDataHandle(), LATOM, tagCONV_INFO::laTopic, NORMAL_HSZ_FROM_LATOM, PackAndPostMessage(), tagCONV_INFO::pcii, SetLastDDEMLError(), TRUE, UnpackAndFreeDDEMLDataHandle(), and UnpackDDElParam().

Referenced by SpontaneousServerMessage().

01045 { 01046 UINT_PTR uiHi; 01047 HANDLE hDDE = 0; 01048 HDDEDATA hData; 01049 ULONG_PTR dwRet = 0; 01050 DWORD dwError; 01051 WORD wFmt, wStatus; 01052 LATOM al; 01053 01054 // See what we have 01055 01056 UnpackDDElParam(WM_DDE_DATA, lParam, (PUINT_PTR)&hDDE, &uiHi); 01057 01058 if (!(psi->ci.pcii->afCmd & CBF_FAIL_POKES)) { 01059 if (!hDDE) { 01060 goto Ack; 01061 } 01062 if (!ExtractDDEDataInfo(hDDE, &wStatus, &wFmt)) { 01063 FreeDDEData(hDDE, FALSE, TRUE); // free message data 01064 goto Ack; 01065 } 01066 01067 hData = InternalCreateDataHandle(psi->ci.pcii, (LPBYTE)hDDE, (DWORD)-1, 0, 01068 HDATA_NOAPPFREE | HDATA_READONLY, 0, 0); 01069 if (!hData) { 01070 SetLastDDEMLError(psi->ci.pcii, DMLERR_MEMORY_ERROR); 01071 FreeDDEData(hDDE, FALSE, TRUE); // free message data 01072 goto Ack; // Nack it. 01073 return(TRUE); 01074 } 01075 01076 al = GlobalToLocalAtom((GATOM)uiHi); 01077 dwRet = (ULONG_PTR)DoCallback(psi->ci.pcii, XTYP_POKE, 01078 wFmt, psi->ci.hConv, 01079 NORMAL_HSZ_FROM_LATOM(psi->ci.laTopic), 01080 NORMAL_HSZ_FROM_LATOM(al), 01081 hData, 0, 0); 01082 DeleteAtom(al); 01083 UnpackAndFreeDDEMLDataHandle(hData, FALSE); 01084 } 01085 if (dwRet == (ULONG_PTR)CBR_BLOCK) { 01086 01087 // Note: this code makes an app that return s CBR_BLOCK unable to 01088 // access the data after the callback return . 01089 01090 return (FALSE); 01091 } 01092 if (dwRet & DDE_FACK) { 01093 FreeDDEData(hDDE, FALSE, TRUE); 01094 } 01095 01096 Ack: 01097 dwRet &= ~DDE_FACKRESERVED; 01098 dwError = PackAndPostMessage(psi->ci.hwndPartner, WM_DDE_POKE, WM_DDE_ACK, 01099 psi->ci.hwndConv, lParam, dwRet, uiHi); 01100 if (dwError) { 01101 SetLastDDEMLError(psi->ci.pcii, dwError); 01102 } 01103 return (TRUE); 01104 }

BOOL SvSpontRequest PSVR_CONV_INFO  psi,
LPARAM  lParam
 

Definition at line 1207 of file stdptcl.c.

References tagCL_INSTANCE_INFO::afCmd, AllocAndSetDDEData(), BOOL, tagSVR_CONV_INFO::ci, CopyDDEData(), DoCallback(), DWORD, ExtractDDEDataInfo(), FALSE, GATOM, GlobalToLocalAtom(), tagCONV_INFO::hConv, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, LATOM, tagCONV_INFO::laTopic, NORMAL_HSZ_FROM_LATOM, PackAndPostMessage(), tagCONV_INFO::pcii, SetLastDDEMLError(), TRUE, and UnpackAndFreeDDEMLDataHandle().

Referenced by SpontaneousServerMessage().

01210 { 01211 HANDLE hDDE = 0; 01212 HDDEDATA hDataRet; 01213 WORD wFmt, wStatus; 01214 DWORD dwError; 01215 LATOM la; 01216 01217 if (psi->ci.pcii->afCmd & CBF_FAIL_REQUESTS) { 01218 goto Nack; 01219 } 01220 // See what we have 01221 01222 // UnpackDDElParam(lParam, WM_DDE_REQUEST, .... Requests arn't packed 01223 wFmt = LOWORD(lParam); 01224 la = GlobalToLocalAtom((GATOM)HIWORD(lParam)); 01225 hDataRet = DoCallback(psi->ci.pcii, XTYP_REQUEST, 01226 wFmt, psi->ci.hConv, 01227 NORMAL_HSZ_FROM_LATOM(psi->ci.laTopic), 01228 NORMAL_HSZ_FROM_LATOM(la), 01229 (HDDEDATA)0, 0, 0); 01230 DeleteAtom(la); 01231 01232 if (hDataRet == CBR_BLOCK) { 01233 return (FALSE); 01234 } 01235 01236 if (hDataRet) { 01237 01238 hDDE = UnpackAndFreeDDEMLDataHandle(hDataRet, FALSE); 01239 if (!hDDE) { 01240 SetLastDDEMLError(psi->ci.pcii, DMLERR_DLL_USAGE); 01241 goto Nack; 01242 } 01243 if (!ExtractDDEDataInfo(hDDE, &wStatus, &wFmt)) { 01244 SetLastDDEMLError(psi->ci.pcii, DMLERR_DLL_USAGE); 01245 goto Nack; 01246 } 01247 if (!(wStatus & DDE_FRELEASE)) { 01248 // Its APPOWNED or relayed from another server - only safe 01249 // thing to do is use a copy. 01250 hDDE = CopyDDEData(hDDE, FALSE); 01251 if (!hDDE) { 01252 SetLastDDEMLError(psi->ci.pcii, DMLERR_MEMORY_ERROR); 01253 goto Nack; 01254 } 01255 } 01256 01257 // Keep it simple, DDEML servers never ask for acks from requests. 01258 01259 wStatus = DDE_FRELEASE | DDE_FREQUESTED; 01260 AllocAndSetDDEData((LPBYTE)hDDE, (DWORD)-1, wStatus, wFmt); 01261 01262 // just reuse HIWORD(lParam) (aItem) - message copy 01263 if (dwError = PackAndPostMessage(psi->ci.hwndPartner, WM_DDE_REQUEST, 01264 WM_DDE_DATA, psi->ci.hwndConv, 0, HandleToUlong(hDDE), HIWORD(lParam))) { 01265 SetLastDDEMLError(psi->ci.pcii, dwError); 01266 GlobalDeleteAtom(HIWORD(lParam)); // message copy 01267 } 01268 01269 } else { 01270 Nack: 01271 // just reuse HIWORD(lParam) (aItem) - message copy 01272 dwError = PackAndPostMessage(psi->ci.hwndPartner, WM_DDE_REQUEST, 01273 WM_DDE_ACK, psi->ci.hwndConv, 0, 0, HIWORD(lParam)); 01274 if (dwError) { 01275 SetLastDDEMLError(psi->ci.pcii, dwError); 01276 GlobalDeleteAtom(HIWORD(lParam)); // message copy 01277 } 01278 } 01279 01280 return (TRUE); 01281 }

BOOL SvSpontUnadvise PSVR_CONV_INFO  psi,
LPARAM  lParam
 

Definition at line 640 of file stdptcl.c.

References ADVISE_LINK, tagCL_INSTANCE_INFO::afCmd, tagCONV_INFO::aLinks, BOOL, tagSVR_CONV_INFO::ci, tagCONV_INFO::cLinks, CloseTransaction(), DeleteLinkCount(), DoCallback(), DWORD, FALSE, GATOM, GlobalToLocalAtom(), tagCONV_INFO::hConv, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, INT, L, tagADVISE_LINK::laItem, tagCONV_INFO::laService, LATOM, tagCONV_INFO::laTopic, MONLINK, NORMAL_HSZ_FROM_LATOM, PackAndPostMessage(), tagCONV_INFO::pcii, tagADVISE_LINK::pLinkCount, SetLastDDEMLError(), TRUE, and tagADVISE_LINK::wFmt.

Referenced by SpontaneousServerMessage().

00643 { 00644 ULONG_PTR dwRet = 0; 00645 DWORD dwError; 00646 INT iLink; 00647 PADVISE_LINK aLink; 00648 LATOM la; 00649 00650 la = GlobalToLocalAtom((GATOM)HIWORD(lParam)); 00651 00652 CloseTransaction(&psi->ci, HIWORD(lParam)); 00653 00654 for (aLink = psi->ci.aLinks, iLink = 0; iLink < psi->ci.cLinks;) { 00655 00656 if (la == 0 || aLink->laItem == la && 00657 (LOWORD(lParam) == 0 || LOWORD(lParam) == aLink->wFmt)) { 00658 00659 if (!(psi->ci.pcii->afCmd & CBF_FAIL_ADVISES)) { 00660 /* 00661 * Only do the callbacks if he wants them. 00662 */ 00663 dwRet = (ULONG_PTR)DoCallback(psi->ci.pcii, 00664 (WORD)XTYP_ADVSTOP, aLink->wFmt, psi->ci.hConv, 00665 NORMAL_HSZ_FROM_LATOM(psi->ci.laTopic), 00666 NORMAL_HSZ_FROM_LATOM(la), 00667 (HDDEDATA)0, 0L, 0L); 00668 if (dwRet == (ULONG_PTR)CBR_BLOCK) { 00669 DeleteAtom(la); 00670 return(FALSE); 00671 } 00672 } 00673 /* 00674 * Notify any DDESPY apps. 00675 */ 00676 MONLINK(psi->ci.pcii, TRUE, 0, psi->ci.laService, 00677 psi->ci.laTopic, HIWORD(lParam), aLink->wFmt, TRUE, 00678 (HCONV)psi->ci.hwndConv, (HCONV)psi->ci.hwndPartner); 00679 /* 00680 * Remove link info 00681 */ 00682 DeleteAtom(aLink->laItem); // aLink copy 00683 DeleteLinkCount(psi->ci.pcii, aLink->pLinkCount); 00684 if (--psi->ci.cLinks) { 00685 memmove((LPSTR)aLink, (LPSTR)(aLink + 1), 00686 sizeof(ADVISE_LINK) * (psi->ci.cLinks - iLink)); 00687 } 00688 } else { 00689 aLink++; 00690 iLink++; 00691 } 00692 } 00693 00694 DeleteAtom(la); 00695 00696 /* 00697 * Now ACK the unadvise message. 00698 */ 00699 dwError = PackAndPostMessage(psi->ci.hwndPartner, 0, 00700 WM_DDE_ACK, psi->ci.hwndConv, 0, DDE_FACK, HIWORD(lParam)); 00701 if (dwError) { 00702 SetLastDDEMLError(psi->ci.pcii, dwError); 00703 GlobalDeleteAtom((ATOM)HIWORD(lParam)); // message copy 00704 // FreeDDElParam(WM_DDE_UNADVISE, lParam); // no unpack needed 00705 } 00706 00707 return (TRUE); 00708 }

BOOL SvStartAdviseUpdate PXACT_INFO  pxi,
DWORD  cLinksToGo
 

Definition at line 263 of file stdptcl.c.

References BOOL, CheckDDECritIn, DoCallback(), DWORD, FALSE, FNRESPONSE, tagXACT_INFO::gaItem, GlobalToLocalAtom(), tagCONV_INFO::hConv, tagXACT_INFO::hDDESent, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, IncGlobalAtomCount(), InternalFreeDataHandle(), LATOM, tagCONV_INFO::laTopic, LinkTransaction(), NORMAL_HSZ_FROM_LATOM, NULL, PackAndPostMessage(), tagCONV_INFO::pcii, tagXACT_INFO::pcoi, PDDE_DATA, tagXACT_INFO::pfnResponse, SetLastDDEMLError(), tagXACT_INFO::state, SvRespAdviseDataAck(), TRUE, UnpackAndFreeDDEMLDataHandle(), USERGLOBALLOCK, USERGLOBALUNLOCK, tagXACT_INFO::wFmt, tagDDE_DATA::wFmt, tagDDE_DATA::wStatus, and tagXACT_INFO::wType.

Referenced by UpdateLinkIfChanged().

00266 { 00267 HDDEDATA hData = NULL; 00268 PDDE_DATA pdde; 00269 DWORD dwError; 00270 HANDLE hDDE; 00271 LATOM al; 00272 00273 CheckDDECritIn; 00274 00275 if (pxi->wType & DDE_FDEFERUPD) { 00276 hDDE = 0; 00277 } else { 00278 al = GlobalToLocalAtom(pxi->gaItem); 00279 hData = DoCallback(pxi->pcoi->pcii, 00280 XTYP_ADVREQ, 00281 pxi->wFmt, 00282 pxi->pcoi->hConv, 00283 NORMAL_HSZ_FROM_LATOM(pxi->pcoi->laTopic), 00284 NORMAL_HSZ_FROM_LATOM(al), 00285 (HDDEDATA)0, 00286 MAKELONG(cLinksToGo, 0), 00287 0); 00288 DeleteAtom(al); 00289 if (!hData) { 00290 // app doesn't honor the advise. 00291 return (FALSE); // reuse pxi 00292 } 00293 hDDE = UnpackAndFreeDDEMLDataHandle(hData, FALSE); 00294 if (!hDDE) { 00295 00296 /* 00297 * failed - must be execute type data 00298 */ 00299 InternalFreeDataHandle(hData, FALSE); 00300 SetLastDDEMLError(pxi->pcoi->pcii, DMLERR_DLL_USAGE); 00301 return (FALSE); 00302 } 00303 /* 00304 * Set fAckReq bit apropriately - note APPOWNED handles will already 00305 * have the fAckReq bit set so this will not change their state. 00306 */ 00307 USERGLOBALLOCK(hDDE, pdde); 00308 if (pdde == NULL) { 00309 return (FALSE); 00310 } 00311 if (pdde->wFmt != pxi->wFmt) { 00312 00313 /* 00314 * bogus data - wrong format! 00315 */ 00316 USERGLOBALUNLOCK(hDDE); 00317 InternalFreeDataHandle(hData, FALSE); 00318 SetLastDDEMLError(pxi->pcoi->pcii, DMLERR_DLL_USAGE); 00319 return (FALSE); 00320 } 00321 if (!(pdde->wStatus & DDE_FRELEASE)) { 00322 pxi->wType |= DDE_FACKREQ; // dare not allow neither flag set! 00323 } 00324 pdde->wStatus |= (pxi->wType & DDE_FACKREQ); 00325 USERGLOBALUNLOCK(hDDE); 00326 } 00327 00328 IncGlobalAtomCount(pxi->gaItem); // message copy 00329 dwError = PackAndPostMessage(pxi->pcoi->hwndPartner, 0, WM_DDE_DATA, 00330 pxi->pcoi->hwndConv, 0, HandleToUlong(hDDE), pxi->gaItem); 00331 if (dwError) { 00332 if (hData) { 00333 InternalFreeDataHandle(hData, FALSE); 00334 } 00335 SetLastDDEMLError(pxi->pcoi->pcii, dwError); 00336 GlobalDeleteAtom(pxi->gaItem); // message copy 00337 return (FALSE); 00338 } 00339 00340 pxi->state = XST_ADVDATASENT; 00341 if (pxi->wType & DDE_FACKREQ) { 00342 pxi->hDDESent = hDDE; 00343 pxi->pfnResponse = (FNRESPONSE)SvRespAdviseDataAck; 00344 LinkTransaction(pxi); 00345 return (TRUE); // prevents reuse - since its queued. 00346 } else { 00347 return (FALSE); // causes pxi to be reused for next advdata message. 00348 } 00349 }

BOOL TransactionComplete PXACT_INFO  pxi,
HDDEDATA  hData
 

Definition at line 1624 of file stdptcl.c.

References BOOL, DestroyHandle(), DoCallback(), DWORD, FALSE, tagXACT_INFO::flags, tagXACT_INFO::gaItem, GlobalToLocalAtom(), tagCONV_INFO::hConv, tagXACT_INFO::hDDEResult, tagCONV_INFO::hwndConv, tagXACT_INFO::hXact, InternalCreateDataHandle(), InternalFreeDataHandle(), LATOM, tagCONV_INFO::laTopic, NORMAL_HSZ_FROM_LATOM, tagCONV_INFO::pcii, tagXACT_INFO::pcoi, PostMessage(), SetLastDDEMLError(), TID_TIMEOUT, TRUE, UnlinkTransaction(), tagXACT_INFO::wFmt, tagXACT_INFO::wStatus, XIF_ABANDONED, XIF_COMPLETE, and XIF_SYNCHRONOUS.

Referenced by ClRespAdviseAck(), ClRespExecuteAck(), ClRespPokeAck(), ClRespRequestData(), and ClRespUnadviseAck().

01627 { 01628 LATOM al; 01629 BOOL fMustFree; 01630 01631 if (pxi->flags & XIF_ABANDONED) { 01632 UserAssert(!(pxi->flags & XIF_SYNCHRONOUS)); 01633 return (TRUE); 01634 } 01635 pxi->flags |= XIF_COMPLETE; 01636 if (pxi->flags & XIF_SYNCHRONOUS) { 01637 PostMessage(pxi->pcoi->hwndConv, WM_TIMER, TID_TIMEOUT, 0); 01638 return (FALSE); 01639 } else { 01640 if (hData == (HDDEDATA)(-1)) { 01641 fMustFree = TRUE; 01642 hData = InternalCreateDataHandle(pxi->pcoi->pcii, 01643 (LPBYTE)pxi->hDDEResult, (DWORD)-1, 0, 01644 HDATA_NOAPPFREE | HDATA_READONLY, 0, 0); 01645 } else { 01646 fMustFree = FALSE; 01647 } 01648 al = GlobalToLocalAtom(pxi->gaItem); 01649 01650 if (!(pxi->wStatus & DDE_FACK)) { 01651 if (pxi->wStatus & DDE_FBUSY) { 01652 SetLastDDEMLError(pxi->pcoi->pcii, DMLERR_BUSY); 01653 } else { 01654 SetLastDDEMLError(pxi->pcoi->pcii, DMLERR_NOTPROCESSED); 01655 } 01656 } 01657 01658 /* 01659 * During the callback the app may disconnect or otherwise kill 01660 * this conversation so we unlink the pxi FIRST so cleanup code 01661 * doesn't destroy it before this transaction code exits. 01662 */ 01663 UnlinkTransaction(pxi); 01664 01665 DoCallback( 01666 pxi->pcoi->pcii, 01667 (WORD)XTYP_XACT_COMPLETE, 01668 pxi->wFmt, 01669 pxi->pcoi->hConv, 01670 NORMAL_HSZ_FROM_LATOM(pxi->pcoi->laTopic), 01671 (HSZ)al, 01672 hData, 01673 HandleToUlong(pxi->hXact), 01674 (DWORD)pxi->wStatus); 01675 DeleteAtom(al); 01676 if (fMustFree) { 01677 InternalFreeDataHandle(hData, FALSE); 01678 pxi->hDDEResult = 0; 01679 } 01680 01681 /* 01682 * during the callback is the only time the app has to access the 01683 * transaction information. pxi->hXact will be invalid once he 01684 * returns. 01685 */ 01686 if (pxi->hXact) { 01687 DestroyHandle(pxi->hXact); 01688 pxi->hXact = 0; 01689 } 01690 return (TRUE); 01691 } 01692 }

VOID UnlinkTransaction PXACT_INFO  pxi  ) 
 

Definition at line 885 of file xact.c.

References CheckDDECritIn, tagXACT_INFO::next, NULL, tagXACT_INFO::pcoi, tagCONV_INFO::pxiIn, tagCONV_INFO::pxiOut, and VOID().

Referenced by ClRespAdviseAck(), ClRespExecuteAck(), ClRespPokeAck(), ClRespRequestData(), ClRespUnadviseAck(), SvRespAdviseDataAck(), and TransactionComplete().

00887 { 00888 CheckDDECritIn; 00889 if (pxi == pxi->pcoi->pxiOut) { 00890 pxi->pcoi->pxiOut = pxi->next; 00891 if (pxi->next == NULL) { 00892 pxi->pcoi->pxiIn = NULL; 00893 } 00894 } 00895 }

HANDLE UnpackAndFreeDDEMLDataHandle HDDEDATA  hData,
BOOL  fExec
 

Definition at line 1708 of file stdptcl.c.

References CheckDDECritIn, DDEMLFree, DestroyHandle(), tagDDEMLDATA::flags, tagDDEMLDATA::hDDE, HINST_ANY, HTYPE_DATA_HANDLE, NULL, PDDEMLDATA, and ValidateCHandle().

Referenced by ClSpontAdviseData(), SvSpontExecute(), SvSpontPoke(), SvSpontRequest(), and SvStartAdviseUpdate().

01711 { 01712 PDDEMLDATA pdd; 01713 HANDLE hDDE; 01714 01715 CheckDDECritIn; 01716 01717 if (hData == 0) { 01718 return (0); 01719 } 01720 pdd = (PDDEMLDATA)ValidateCHandle((HANDLE)hData, HTYPE_DATA_HANDLE, 01721 HINST_ANY); 01722 if (pdd == NULL) { 01723 return (0); 01724 } 01725 if (!fExec && pdd->flags & HDATA_EXECUTE) { 01726 return (0); 01727 } 01728 01729 hDDE = pdd->hDDE; 01730 if (pdd->flags & HDATA_APPOWNED) { 01731 return (hDDE); // don't destroy appowned data handles 01732 } 01733 DDEMLFree(pdd); 01734 DestroyHandle((HANDLE)hData); 01735 return (hDDE); 01736 }

BOOL UpdateLinkIfChanged PADVISE_LINK  paLink,
PXACT_INFO  pxi,
PCONV_INFO  pcoi,
PADVISE_LINK  paLinkLast,
PBOOL  pfSwapped,
DWORD  cLinksToGo
 

Definition at line 611 of file xact.c.

References ADVST_CHANGED, ADVST_WAITING, BOOL, CheckDDECritIn, FALSE, tagXACT_INFO::gaItem, tagADVISE_LINK::laItem, LocalToGlobalAtom(), PBYTE, tagXACT_INFO::pcoi, tagXACT_INFO::pfnResponse, tagADVISE_LINK::state, SvRespAdviseDataAck(), SvStartAdviseUpdate(), TRUE, tagXACT_INFO::wFmt, tagADVISE_LINK::wFmt, tagXACT_INFO::wType, and tagADVISE_LINK::wType.

Referenced by DdePostAdvise(), and SvRespAdviseDataAck().

00618 { 00619 ADVISE_LINK aLinkT; 00620 00621 CheckDDECritIn; 00622 00623 *pfSwapped = FALSE; 00624 if (paLink->state & ADVST_CHANGED && !(paLink->state & ADVST_WAITING)) { 00625 pxi->pfnResponse = SvRespAdviseDataAck; 00626 pxi->pcoi = pcoi; 00627 pxi->gaItem = LocalToGlobalAtom(paLink->laItem); // pxi copy 00628 pxi->wFmt = paLink->wFmt; 00629 pxi->wType = paLink->wType; 00630 paLink->state &= ~ADVST_CHANGED; 00631 if (SvStartAdviseUpdate(pxi, cLinksToGo)) { 00632 if (pxi->wType & DDE_FACKREQ) { 00633 paLink->state |= ADVST_WAITING; 00634 /* 00635 * swap paLink with the last non-moved link to make ack search find 00636 * oldest updated format. 00637 */ 00638 if (paLink != paLinkLast) { 00639 aLinkT = *paLink; 00640 RtlMoveMemory(paLink, paLink + 1, 00641 (PBYTE)paLinkLast - (PBYTE)paLink); 00642 *paLinkLast = aLinkT; 00643 *pfSwapped = TRUE; 00644 } 00645 } 00646 return(TRUE); 00647 } else { 00648 GlobalDeleteAtom(pxi->gaItem); // pxi copy 00649 return(FALSE); 00650 } 00651 } 00652 return(FALSE); 00653 }

ULONG_PTR ValidateCHandle HANDLE  h,
DWORD  ExpectedType,
DWORD  ExpectedInstance
 

Definition at line 204 of file handles.c.

References aHandleEntry, cHandlesAllocated, CheckHandleTable, tagCHANDLEENTRY::dwData, tagCHANDLEENTRY::handle, IndexFromHandle, InstFromHandle, and TypeFromHandle.

Referenced by DdeAccessData(), DdeAddData(), DdeClientTransaction(), DdeDisconnect(), DdeDisconnectList(), DdeEnableCallback(), DdeFreeDataHandle(), DdeGetData(), DdeImpersonateClient(), DdeQueryNextServer(), DdeReconnect(), DdeUnaccessData(), InitiateEnumerationProc(), InternalFreeDataHandle(), ProcessSyncDDEMessage(), UnpackAndFreeDDEMLDataHandle(), ValidateConnectParameters(), ValidateInstance(), ValidateTransaction(), and WaitForZombieTerminate().

00208 { 00209 register int i; 00210 register ULONG_PTR dwRet; 00211 00212 CheckHandleTable(); 00213 dwRet = 0; 00214 i = IndexFromHandle(h); 00215 if (i < cHandlesAllocated && 00216 aHandleEntry[i].handle == h && 00217 (ExpectedType == -1 || ExpectedType == TypeFromHandle(h)) && 00218 (ExpectedInstance == -1 || ExpectedInstance == InstFromHandle(h))) { 00219 dwRet = aHandleEntry[i].dwData; 00220 } 00221 00222 return (dwRet); 00223 }

BOOL ValidateConnectParameters HANDLE  hInst,
PCL_INSTANCE_INFO ppcii,
HSZ *  phszService,
HSZ  hszTopic,
LATOM plaNormalSvcName,
PCONVCONTEXT *  ppCC,
HWND *  phwndTarget,
HCONVLIST  hConvList
 

Definition at line 491 of file connect.c.

References BOOL, DefConvContext, DWORD, FALSE, hInst, HSZT_INST_SPECIFIC, HSZT_INVALID, HTYPE_CONVERSATION_LIST, IIF_UNICODE, InstFromHandle, LATOM_FROM_HSZ, NORMAL_HSZ_FROM_LATOM, NULL, ParseInstSpecificAtom(), SetLastDDEMLError(), TempConvContext, TRUE, ValidateCHandle(), ValidateHSZ(), and ValidateInstance().

Referenced by DdeConnect(), and DdeConnectList().

00500 { 00501 DWORD hszType; 00502 BOOL fError = FALSE; 00503 00504 *ppcii = ValidateInstance(hInst); 00505 if (*ppcii == NULL) { 00506 return (FALSE); 00507 } 00508 hszType = ValidateHSZ(*phszService); 00509 if (hszType == HSZT_INVALID || ValidateHSZ(hszTopic) == HSZT_INVALID) { 00510 SetLastDDEMLError(*ppcii, DMLERR_INVALIDPARAMETER); 00511 return (FALSE); 00512 } 00513 if (hszType == HSZT_INST_SPECIFIC) { 00514 *phwndTarget = ParseInstSpecificAtom(LATOM_FROM_HSZ(*phszService), 00515 plaNormalSvcName); 00516 if (*plaNormalSvcName == 0) { 00517 SetLastDDEMLError(*ppcii, DMLERR_SYS_ERROR); 00518 return (FALSE); 00519 } 00520 *phszService = NORMAL_HSZ_FROM_LATOM(*plaNormalSvcName); 00521 } 00522 if (*ppCC == NULL) { 00523 *ppCC = &DefConvContext; 00524 if ((*ppcii)->flags & IIF_UNICODE) { 00525 (*ppCC)->iCodePage = CP_WINUNICODE; 00526 } else { 00527 (*ppCC)->iCodePage = CP_WINANSI; 00528 } 00529 } else try { 00530 if ((*ppCC)->cb > sizeof(CONVCONTEXT)) { 00531 SetLastDDEMLError(*ppcii, DMLERR_INVALIDPARAMETER); 00532 fError = TRUE; 00533 } else if ((*ppCC)->cb < sizeof(CONVCONTEXT)) { 00534 TempConvContext = DefConvContext; 00535 /* 00536 * we can use this static temp because we are synchronized. 00537 */ 00538 RtlCopyMemory(&TempConvContext, *ppCC, (*ppCC)->cb); 00539 *ppCC = &TempConvContext; 00540 } 00541 } except(W32ExceptionHandler(FALSE, RIP_WARNING)) { 00542 SetLastDDEMLError(*ppcii, DMLERR_INVALIDPARAMETER); 00543 fError = TRUE; 00544 } 00545 if (fError) { 00546 return(FALSE); 00547 } 00548 if (hConvList != 0 && 00549 !ValidateCHandle((HANDLE)hConvList, HTYPE_CONVERSATION_LIST, 00550 (DWORD)InstFromHandle((*ppcii)->hInstClient))) { 00551 return (FALSE); 00552 } 00553 return (TRUE); 00554 }

DWORD ValidateHSZ HSZ  hsz  ) 
 

Definition at line 340 of file hsz.c.

References DWORD, HSZT_INST_SPECIFIC, HSZT_INVALID, and HSZT_NORMAL.

Referenced by DdeFreeStringHandle(), DdeKeepStringHandle(), DdeNameService(), DdePostAdvise(), InternalDdeQueryString(), and ValidateConnectParameters().

00342 { 00343 if (hsz == 0) { 00344 return (HSZT_NORMAL); 00345 } 00346 if (LOWORD((ULONG_PTR)hsz) < 0xC000) { 00347 return (HSZT_INVALID); 00348 } 00349 if (HIWORD((ULONG_PTR)hsz) == 0) { 00350 return (HSZT_NORMAL); 00351 } 00352 if (HIWORD((ULONG_PTR)hsz) == 1) { 00353 return (HSZT_INST_SPECIFIC); 00354 } 00355 return (HSZT_INVALID); 00356 }

PCL_INSTANCE_INFO ValidateInstance HANDLE  hInst  ) 
 

Definition at line 111 of file instance.c.

References HINST_ANY, tagCL_INSTANCE_INFO::hInstClient, HTYPE_INSTANCE, NULL, tagCL_INSTANCE_INFO::tid, and ValidateCHandle().

Referenced by DdeAbandonTransaction(), DdeCreateDataHandle(), DdeEnableCallback(), DdeFreeStringHandle(), DdeGetLastError(), DdeKeepStringHandle(), DDEMLClientWndProc(), DdeNameService(), DdePostAdvise(), DdeUninitialize(), InternalDdeCreateStringHandle(), InternalDdeInitialize(), InternalDdeQueryString(), ValidateConnectParameters(), and ValidateTransaction().

00113 { 00114 PCL_INSTANCE_INFO pcii; 00115 00116 pcii = (PCL_INSTANCE_INFO)ValidateCHandle(hInstClient, HTYPE_INSTANCE, HINST_ANY); 00117 00118 if (pcii != NULL) { 00119 if (pcii->tid != GetCurrentThreadId() || 00120 pcii->hInstClient != hInstClient) { 00121 return (NULL); 00122 } 00123 } 00124 return (pcii); 00125 }

BOOL ValidateTransaction HCONV  hConv,
HANDLE  hXact,
PCONV_INFO ppcoi,
PXACT_INFO ppxi
 

Definition at line 909 of file xact.c.

References BestSetLastDDEMLError(), BOOL, FALSE, HINST_ANY, HTYPE_CLIENT_CONVERSATION, HTYPE_SERVER_CONVERSATION, HTYPE_TRANSACTION, InstFromHandle, NULL, SetLastDDEMLError(), TRUE, ValidateCHandle(), and ValidateInstance().

Referenced by DdeAbandonTransaction(), DdeQueryConvInfo(), and DdeSetUserHandle().

00914 { 00915 PCL_INSTANCE_INFO pcii; 00916 00917 *ppcoi = (PCONV_INFO)ValidateCHandle((HANDLE)hConv, 00918 HTYPE_CLIENT_CONVERSATION, HINST_ANY); 00919 if (*ppcoi == NULL) { 00920 *ppcoi = (PCONV_INFO)ValidateCHandle((HANDLE)hConv, 00921 HTYPE_SERVER_CONVERSATION, HINST_ANY); 00922 } 00923 if (*ppcoi == NULL) { 00924 BestSetLastDDEMLError(DMLERR_INVALIDPARAMETER); 00925 return (FALSE); 00926 } 00927 pcii = ValidateInstance((*ppcoi)->pcii->hInstClient); 00928 if (pcii != (*ppcoi)->pcii) { 00929 BestSetLastDDEMLError(DMLERR_INVALIDPARAMETER); 00930 return (FALSE); 00931 } 00932 00933 if (hXact == (HANDLE)IntToPtr( QID_SYNC )) { 00934 *ppxi = NULL; 00935 } else { 00936 *ppxi = (PXACT_INFO)ValidateCHandle(hXact, HTYPE_TRANSACTION, 00937 InstFromHandle((*ppcoi)->pcii->hInstClient)); 00938 if (*ppxi == NULL) { 00939 SetLastDDEMLError((*ppcoi)->pcii, DMLERR_INVALIDPARAMETER); 00940 return (FALSE); 00941 } 00942 } 00943 return (TRUE); 00944 }

BOOL WaitForZombieTerminate HANDLE  hData  ) 
 

Definition at line 1474 of file connect.c.

References BOOL, CheckDDECritOut, DispatchMessage(), DWORD, EnterDDECrit, FALSE, HTYPE_ZOMBIE_CONVERSATION, tagCONV_INFO::hwndConv, tagCONV_INFO::hwndPartner, InstFromHandle, LeaveDDECrit, msg, MsgWaitForMultipleObjectsEx(), NULL, PeekMessage(), ProcessTerminateMsg(), tagCONV_INFO::state, TRUE, and ValidateCHandle().

Referenced by DdeUninitialize().

01476 { 01477 PCONV_INFO pcoi; 01478 MSG msg; 01479 HWND hwnd; 01480 BOOL fTerminated; 01481 DWORD fRet = 0; 01482 01483 CheckDDECritOut; 01484 EnterDDECrit; 01485 01486 fTerminated = FALSE; 01487 while ((pcoi = (PCONV_INFO)ValidateCHandle(hData, 01488 HTYPE_ZOMBIE_CONVERSATION, InstFromHandle(hData))) != NULL && 01489 !(pcoi->state & ST_TERMINATE_RECEIVED)) { 01490 hwnd = pcoi->hwndConv; 01491 LeaveDDECrit; 01492 while (PeekMessage(&msg, hwnd, WM_DDE_FIRST, WM_DDE_LAST, PM_REMOVE)) { 01493 DispatchMessage(&msg); 01494 if (msg.message == WM_DDE_TERMINATE) { 01495 fTerminated = TRUE; 01496 } 01497 } 01498 if (!fTerminated) { 01499 fRet = MsgWaitForMultipleObjectsEx(0, NULL, 100, QS_POSTMESSAGE, 0); 01500 if (fRet == 0xFFFFFFFF) { 01501 RIPMSG0(RIP_WARNING, "WaitForZombieTerminate: I give up - faking terminate."); 01502 ProcessTerminateMsg(pcoi, pcoi->hwndPartner); 01503 EnterDDECrit; 01504 return(FALSE); 01505 } 01506 } 01507 EnterDDECrit; 01508 } 01509 LeaveDDECrit; 01510 return(TRUE); 01511 }


Variable Documentation

PHANDLE aInstance
 

Definition at line 262 of file ddemlcli.h.

Referenced by AddInstance(), and DestroyInstance().

CONVCONTEXT DefConvContext
 

Definition at line 245 of file ddemlcli.h.

Referenced by DdeQueryConvInfo(), and ValidateConnectParameters().

RTL_CRITICAL_SECTION gcsDDEML
 

Definition at line 44 of file ddemlcli.h.

Referenced by UserClientDllInitialize().

DWORD gWM_REGISTERCALLBACK
 

Definition at line 263 of file ddemlcli.h.


Generated on Sat May 15 19:43:24 2004 for test by doxygen 1.3.7