00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
#include "precomp.h"
00014
#pragma hdrstop
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 VOID PseudoDestroyClassWindows(
PWND pwndParent,
PCLS pcls)
00043 {
00044
PWND pwnd;
00045
PTHREADINFO pti;
00046
00047 pti =
PtiCurrent();
00048
00049
00050
00051
00052
for (pwnd = pwndParent->
spwndChild; pwnd !=
NULL; pwnd = pwnd->
spwndNext) {
00053
00054
00055
00056
00057
00058
if (pwnd->
pcls == pcls && pti ==
GETPTI(pwnd)) {
00059
00060
00061
00062
00063
00064
00065
00066
00067 RIPMSG1(RIP_WARNING,
00068
"USER: Wow Window not destroyed: %lX", pwnd);
00069
00070
if (!
TestWF(pwnd,
WFSERVERSIDEPROC)) {
00071 pwnd->
lpfnWndProc = (
WNDPROC_PWND)
gpsi->
apfnClientA.
pfnDefWindowProc;
00072 }
00073 }
00074
00075
00076
00077
00078
00079
if (pwnd->
spwndChild !=
NULL)
00080
PseudoDestroyClassWindows(pwnd, pcls);
00081 }
00082 }
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 VOID _WOWModuleUnload(HANDLE hModule) {
00100
PPROCESSINFO ppi =
PpiCurrent();
00101
PHE pheT, pheMax;
00102
PPCLS ppcls;
00103
int i;
00104
00105 UserAssert(
gpfnwp[0]);
00106
00107
00108
00109
00110
00111
00112 pheMax = &
gSharedInfo.
aheList[
giheLast];
00113
for (pheT =
gSharedInfo.
aheList; pheT <= pheMax; pheT++) {
00114
PTHREADINFO ptiTest = (
PTHREADINFO)pheT->
pOwner;
00115
PWND pwnd;
00116
if ((pheT->
bType ==
TYPE_WINDOW) &&
00117 (ptiTest->
TIF_flags &
TIF_16BIT) &&
00118 (ptiTest->
ppi == ppi)) {
00119
00120 pwnd = (
PWND) pheT->
phead;
00121
if (!
TestWF(pwnd,
WFSERVERSIDEPROC) &&
00122 IsWOWProc(pwnd->
lpfnWndProc) &&
00123 (pwnd->hMod16 == (WORD)(ULONG_PTR)hModule)) {
00124 pwnd->
lpfnWndProc = (
WNDPROC_PWND)
gpsi->
apfnClientA.
pfnDefWindowProc;
00125 }
00126 }
00127 }
00128
00129
00130
00131
00132
00133
00134 ppcls = &(ppi->
pclsPrivateList);
00135
00136
for (i = 0; i < 2; ++i) {
00137
while (*ppcls !=
NULL) {
00138
00139 PWC pwc;
00140
PCLS pcls;
00141
00142
if (HIWORD((ULONG_PTR)(*ppcls)->hModule) == (WORD)(ULONG_PTR)hModule) {
00143
if ((*ppcls)->cWndReferenceCount == 0) {
00144
DestroyClass(ppcls);
00145
00146
00147
00148
00149 }
else {
00150
00151
00152
00153
00154
PseudoDestroyClassWindows(
PtiCurrent()->rpdesk->pDeskInfo->spwnd, *ppcls);
00155
00156
00157
00158
00159 (*ppcls)->CSF_flags |=
CSF_WOWDEFERDESTROY;
00160 ppcls = &((*ppcls)->pclsNext);
00161 }
00162
continue;
00163 }
00164
00165 pcls = *ppcls;
00166
00167
if ((pcls->
CSF_flags &
CSF_WOWCLASS) && ((WORD)(ULONG_PTR)hModule == (pwc =
PWCFromPCLS(pcls))->hMod16)) {
00168
00169 ATOM atom;
00170
int iSel;
00171
00172
00173
00174
00175
00176
00177 atom = (*ppcls)->
atomClassName;
00178
for (iSel =
ICLS_BUTTON; iSel <
ICLS_MAX; iSel++) {
00179
if ((
gpfnwp[iSel]) && (atom ==
gpsi->
atomSysClass[iSel])) {
00180 (*ppcls)->lpfnWndProc = (
WNDPROC_PWND)
gpfnwp[iSel];
00181
break;
00182 }
00183 }
00184
if (iSel ==
ICLS_MAX)
00185 (*ppcls)->lpfnWndProc = (
WNDPROC_PWND)
gpsi->
apfnClientW.
pfnDefWindowProc;
00186 }
00187
00188 ppcls = &((*ppcls)->pclsNext);
00189 }
00190
00191
00192
00193
00194
00195
00196 ppcls = &(ppi->
pclsPublicList);
00197 }
00198
return;
00199
00200 }
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218 VOID _WOWCleanup(
00219 HANDLE hInstance,
00220 DWORD hTaskWow)
00221 {
00222
PPROCESSINFO ppi =
PpiCurrent();
00223
PPCLS ppcls;
00224
PHE pheT, pheMax;
00225
int i;
00226
00227
if (hInstance !=
NULL) {
00228
00229
00230
00231
00232
00233
PWND pwnd;
00234 hTaskWow = (
DWORD) LOWORD(hTaskWow);
00235
00236
00237
00238
00239 pheMax = &
gSharedInfo.
aheList[
giheLast];
00240
for (pheT =
gSharedInfo.
aheList; pheT <= pheMax; pheT++) {
00241
PTHREADINFO ptiTest = (
PTHREADINFO)pheT->
pOwner;
00242
if ((pheT->
bType ==
TYPE_WINDOW) &&
00243 (ptiTest->
TIF_flags &
TIF_16BIT) &&
00244 (ptiTest->
ptdb) &&
00245 (ptiTest->
ptdb->
hTaskWow == hTaskWow) &&
00246 (ptiTest->
ppi == ppi)) {
00247
00248 pwnd = (
PWND) pheT->
phead;
00249
if (!
TestWF(pwnd,
WFSERVERSIDEPROC)) {
00250 pwnd->
lpfnWndProc = (
WNDPROC_PWND)
gpsi->
apfnClientA.
pfnDefWindowProc;
00251 }
00252 }
00253 }
00254
return;
00255 }
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267 ppcls = &(ppi->
pclsPrivateList);
00268
for (i = 0; i < 2; ++i) {
00269
while (*ppcls !=
NULL) {
00270
if ((*ppcls)->hTaskWow == hTaskWow &&
00271 ((*ppcls)->CSF_flags &
CSF_WOWDEFERDESTROY)) {
00272
if ((*ppcls)->cWndReferenceCount == 0) {
00273
DestroyClass(ppcls);
00274 }
else {
00275 RIPMSG0(RIP_ERROR,
"Windows remain for a WOW class marked for destruction");
00276 ppcls = &((*ppcls)->pclsNext);
00277 }
00278 }
else
00279 ppcls = &((*ppcls)->pclsNext);
00280 }
00281
00282
00283
00284
00285 ppcls = &(ppi->
pclsPublicList);
00286 }
00287
00288
00289
00290
00291 pheMax = &
gSharedInfo.
aheList[
giheLast];
00292
for (pheT =
gSharedInfo.
aheList; pheT <= pheMax; pheT++) {
00293
00294
00295
00296
00297
00298
if (pheT->
bType ==
TYPE_FREE)
00299
continue;
00300
00301
00302
00303
00304
if ( !(
gahti[pheT->
bType].
bObjectCreateFlags &
OCF_PROCESSOWNED) ||
00305 (
PPROCESSINFO)pheT->
pOwner != ppi ||
00306 (((
PPROCOBJHEAD)pheT->
phead)->hTaskWow != hTaskWow) ||
00307 (pheT->
bType ==
TYPE_CALLPROC)
00308
00309
00310
00311
00312 ) {
00313
00314
continue;
00315 }
00316
00317
00318
00319
00320
00321
if (pheT->
bFlags &
HANDLEF_DESTROY) {
00322
continue;
00323 }
00324
00325
00326
00327
00328
HMDestroyUnlockedObject(pheT);
00329 }
00330 }