test: monitor.c File Reference

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

# monitor.c File Reference

`#include "precomp.h"`

Go to the source code of this file.

## Defines

#define | phszs ((MONHSZSTRUCT *)&pep->Data)
#define | pls ((MONLINKSTRUCT *)&pep->Data)
#define | pcs ((MONCONVSTRUCT *)&pep->Data)

## Functions

VOID | MonitorStringHandle (PCL_INSTANCE_INFO pcii, HSZ hsz, DWORD fsAction)
VOID | MonitorLink (PCL_INSTANCE_INFO pcii, BOOL fEstablished, BOOL fNoData, LATOM aService, LATOM aTopic, GATOM aItem, WORD wFmt, BOOL fServer, HCONV hConvServer, HCONV hConvClient)
VOID | MonitorConv (PCONV_INFO pcoi, BOOL fConnect)

## Define Documentation

#define pcs ((MONCONVSTRUCT *)&pep->Data)

| Referenced by GetCPConnSpace(), GetPS2PreviewColorRenderingDictionary(), InitNamedColorProfileData(), MonitorConv(), ReaderWndProc(), SendCRDABC(), and SendCRDLMN().

#define phszs ((MONHSZSTRUCT *)&pep->Data)

| Referenced by MonitorStringHandle().

#define pls ((MONLINKSTRUCT *)&pep->Data)

| Referenced by MonitorLink().

## Function Documentation

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 | aService,
|  | LATOM | aTopic,
|  | GATOM | aItem,
|  | 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 }