00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#include "precomp.h"
00013
#pragma hdrstop
00014
00015
00016
00017 PSVR_INSTANCE_INFO psiiList;
00018
00019 DWORD xxxCsDdeInitialize(
00020 PHANDLE phInst,
00021 HWND *phwndEvent,
00022 LPDWORD pMonitorFlags,
00023 DWORD afCmd,
00024 PVOID pcii)
00025 {
00026
PSVR_INSTANCE_INFO psii;
00027
PTHREADINFO ptiCurrent =
PtiCurrent();
00028
00029
CheckCritIn();
00030
00031 psii = (
PSVR_INSTANCE_INFO)
HMAllocObject(
PtiCurrent(),
NULL,
00032
TYPE_DDEACCESS,
sizeof(
SVR_INSTANCE_INFO));
00033
if (psii ==
NULL) {
00034
return DMLERR_SYS_ERROR;
00035 }
00036
00037
00038
00039
00040
00041
00042
00043
Lock(&(psii->
spwndEvent),
xxxCreateWindowEx(
00044 0,
00045 (
PLARGE_STRING)
gpsi->
atomSysClass[
ICLS_DDEMLEVENT],
00046
NULL,
00047 WS_POPUP | WS_CHILD,
00048 0, 0, 0, 0,
00049 (
PWND)
NULL,
00050 (
PMENU)
NULL,
00051
hModuleWin,
00052
NULL,
00053
CW_FLAGS_DIFFHMOD |
VER31));
00054
00055
if (psii->
spwndEvent ==
NULL) {
00056
HMFreeObject((PVOID)psii);
00057
return DMLERR_SYS_ERROR;
00058 }
00059
00060
00061
00062
xxxSetWindowLongPtr(psii->
spwndEvent,
GWLP_PSII, (LONG_PTR)
PtoH(psii),
FALSE);
00063 psii->afCmd = 0;
00064 psii->pcii = pcii;
00065
00066
00067
00068 psii->next =
psiiList;
00069
psiiList = psii;
00070
00071
00072
00073
00074 psii->
nextInThisThread = ptiCurrent->
psiiList;
00075 ptiCurrent->
psiiList = psii;
00076
00077 *phInst =
PtoH(psii);
00078 *phwndEvent =
PtoH(psii->spwndEvent);
00079
xxxChangeMonitorFlags(psii, afCmd);
00080 *pMonitorFlags =
MonitorFlags;
00081
return DMLERR_NO_ERROR;
00082 }
00083
00084
00085
00086
00087
00088 DWORD _CsUpdateInstance(
00089 HANDLE hInst,
00090 LPDWORD pMonitorFlags,
00091 DWORD afCmd)
00092 {
00093
PSVR_INSTANCE_INFO psii;
00094
00095
CheckCritIn();
00096
00097 psii = (
PSVR_INSTANCE_INFO)
HMValidateHandleNoRip(
hInst,
TYPE_DDEACCESS);
00098
if (psii ==
NULL) {
00099
return DMLERR_INVALIDPARAMETER;
00100 }
00101
xxxChangeMonitorFlags(psii, afCmd);
00102 *pMonitorFlags =
MonitorFlags;
00103
return DMLERR_NO_ERROR;
00104 }
00105
00106
00107
00108
00109
00110 BOOL _CsDdeUninitialize(
00111 HANDLE hInst)
00112 {
00113
PSVR_INSTANCE_INFO psii;
00114
00115
CheckCritIn();
00116
00117 psii =
HMValidateHandleNoRip(
hInst,
TYPE_DDEACCESS);
00118
if (psii ==
NULL) {
00119
return TRUE;
00120 }
00121
00122
xxxDestroyThreadDDEObject(
PtiCurrent(), psii);
00123
return TRUE;
00124 }
00125
00126
00127 VOID xxxDestroyThreadDDEObject(
00128
PTHREADINFO pti,
00129
PSVR_INSTANCE_INFO psii)
00130 {
00131
PSVR_INSTANCE_INFO psiiT;
00132
00133
CheckCritIn();
00134
00135
if (
HMIsMarkDestroy(psii)) {
00136
return;
00137 }
00138
00139
00140
00141
00142
if (psii ==
psiiList) {
00143
psiiList = psii->
next;
00144 }
else {
00145
for (psiiT =
psiiList; psiiT->
next != psii; psiiT = psiiT->
next) {
00146 UserAssert(psiiT->
next !=
NULL);
00147 }
00148 psiiT->
next = psii->
next;
00149 }
00150
00151
00152
00153
00154
00155
if (psii == pti->
psiiList) {
00156 pti->
psiiList = psii->
nextInThisThread;
00157 }
else {
00158
for (psiiT = pti->
psiiList; psiiT->
nextInThisThread != psii; psiiT = psiiT->
nextInThisThread) {
00159 UserAssert(psiiT->
nextInThisThread !=
NULL);
00160 }
00161 psiiT->
nextInThisThread = psii->
nextInThisThread;
00162 }
00163
00164
00165
if (
HMMarkObjectDestroy(psii)) {
00166
xxxDestroyWindow(psii->
spwndEvent);
00167
Unlock(&(psii->
spwndEvent));
00168
00169
HMFreeObject(psii);
00170 }
00171 }