00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
#include "precomp.h"
00016
#pragma hdrstop
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
BOOL WINAPI
00036 _GetGUIThreadInfo(
PTHREADINFO pti, PGUITHREADINFO pgui)
00037 {
00038
PQ pq;
00039
00040
00041
00042
00043
if (pgui->cbSize !=
sizeof(GUITHREADINFO)) {
00044 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING,
"GUITHREADINFO.cbSize %d is wrong", pgui->cbSize);
00045
return FALSE;
00046 }
00047
00048
00049
00050
00051
if (pti !=
NULL) {
00052
if ((pq = pti->
pq) ==
NULL) {
00053
00054 RIPMSG1(RIP_ERROR,
"GetGUIThreadInfo: No queue for pti %lx", pti);
00055
return FALSE;
00056 }
00057 }
else {
00058
00059
00060
00061
00062
if ((pq =
gpqForeground) ==
NULL) {
00063
00064 RIPMSG0(RIP_WARNING,
"GetGUIThreadInfo: No foreground queue");
00065
return FALSE;
00066 }
00067
00068
if (pq->
spwndActive && (
GETPTI(pq->
spwndActive)->pq == pq)) {
00069 pti =
GETPTI(pq->
spwndActive);
00070
if (
PtiCurrentShared()->rpdesk != pti->
rpdesk) {
00071 RIPERR0(ERROR_ACCESS_DENIED, RIP_VERBOSE,
"Foreground window on different desktop");
00072
return FALSE;
00073 }
00074 }
00075 }
00076
00077 UserAssert(pq !=
NULL);
00078
00079
00080
00081
00082
00083
00084
if (pq->
caret.
spwnd &&
00085 (
GETPTI(pq->
caret.
spwnd)->rpdesk !=
PtiCurrentShared()->rpdesk)) {
00086 RIPERR0(ERROR_ACCESS_DENIED, RIP_VERBOSE,
"Foreground caret on different desktop");
00087
return FALSE;
00088 }
00089
if (pti && (pti->
rpdesk !=
PtiCurrentShared()->rpdesk)) {
00090 RIPERR0(ERROR_ACCESS_DENIED, RIP_VERBOSE,
"Foreground thread on different desktop");
00091
return FALSE;
00092 }
00093
00094 pgui->flags = 0;
00095 pgui->hwndMoveSize =
NULL;
00096 pgui->hwndMenuOwner =
NULL;
00097
00098
00099
00100
00101
if (pti !=
NULL) {
00102
if (pti->
pmsd && !pti->
pmsd->
fTrackCancelled && pti->
pmsd->
spwnd) {
00103 pgui->flags |= GUI_INMOVESIZE;
00104 pgui->hwndMoveSize =
HWq(pti->
pmsd->
spwnd);
00105 }
00106
00107
if (pti->
pMenuState && pti->
pMenuState->
pGlobalPopupMenu) {
00108 pgui->flags |= GUI_INMENUMODE;
00109
00110
if (pti->
pMenuState->
pGlobalPopupMenu->
fHasMenuBar) {
00111
if (pti->
pMenuState->
pGlobalPopupMenu->
fIsSysMenu) {
00112 pgui->flags |= GUI_SYSTEMMENUMODE;
00113 }
00114 }
else {
00115 pgui->flags |= GUI_POPUPMENUMODE;
00116 }
00117
00118
if (pti->
pMenuState->
pGlobalPopupMenu->
spwndNotify)
00119 pgui->hwndMenuOwner =
HWq(pti->
pMenuState->
pGlobalPopupMenu->
spwndNotify);
00120 }
00121 }
00122
00123
00124
00125
00126 pgui->hwndActive =
HW(pq->
spwndActive);
00127 pgui->hwndFocus =
HW(pq->
spwndFocus);
00128 pgui->hwndCapture =
HW(pq->
spwndCapture);
00129
00130 pgui->hwndCaret =
NULL;
00131
00132
if (pq->
caret.
spwnd) {
00133 pgui->hwndCaret =
HWq(pq->
caret.
spwnd);
00134
00135
00136
00137
00138
00139 pgui->rcCaret.left = pq->
caret.
x;
00140 pgui->rcCaret.right = pgui->rcCaret.left + pq->
caret.
cx;
00141 pgui->rcCaret.top = pq->
caret.
y;
00142 pgui->rcCaret.bottom = pgui->rcCaret.top + pq->
caret.
cy;
00143
00144
if (pq->
caret.
iHideLevel == 0)
00145 pgui->flags |= GUI_CARETBLINKING;
00146 }
else if (pti && (pti->
ppi->W32PF_Flags &
W32PF_CONSOLEHASFOCUS)) {
00147
00148
00149
00150
00151 pgui->hwndCaret = pti->
rpdesk->
cciConsole.hwnd;
00152 pgui->rcCaret = pti->
rpdesk->
cciConsole.rc;
00153 }
else {
00154
SetRectEmpty(&pgui->rcCaret);
00155 }
00156
00157
return TRUE;
00158 }
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
BOOL WINAPI
00170 xxxGetTitleBarInfo(
PWND pwnd, PTITLEBARINFO ptbi)
00171 {
00172
int cxB;
00173
00174
CheckLock(pwnd);
00175
00176
00177
00178
00179
if (ptbi->cbSize !=
sizeof(TITLEBARINFO)) {
00180 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING,
"TITLEBARINFO.cbSize %d is wrong", ptbi->cbSize);
00181
return FALSE;
00182 }
00183
00184 RtlZeroMemory(&ptbi->rgstate,
sizeof(ptbi->rgstate));
00185
00186 ptbi->rgstate[INDEX_TITLEBAR_SELF] |= STATE_SYSTEM_FOCUSABLE;
00187
if (
TestWF(pwnd,
WFBORDERMASK) !=
LOBYTE(
WFCAPTION))
00188 {
00189
00190 ptbi->rgstate[INDEX_TITLEBAR_SELF] |= STATE_SYSTEM_INVISIBLE;
00191
return TRUE;
00192 }
00193
00194
if (!
TestWF(pwnd,
WFMINIMIZED) && !
TestWF(pwnd,
WFCPRESENT))
00195 {
00196
00197 ptbi->rgstate[INDEX_TITLEBAR_SELF] |= STATE_SYSTEM_OFFSCREEN;
00198
SetRectEmpty(&ptbi->rcTitleBar);
00199
return TRUE;
00200 }
00201
00202
00203
00204
00205 ptbi->rcTitleBar = pwnd->
rcWindow;
00206 cxB =
GetWindowBorders(pwnd->style, pwnd->ExStyle,
TRUE,
FALSE);
00207
InflateRect(&ptbi->rcTitleBar, -cxB *
SYSMET(CXBORDER), -cxB *
SYSMET(CYBORDER));
00208
if (
TestWF(pwnd,
WEFTOOLWINDOW)) {
00209 ptbi->rcTitleBar.bottom = ptbi->rcTitleBar.top +
SYSMET(CYSMCAPTION);
00210 }
else {
00211 ptbi->rcTitleBar.bottom = ptbi->rcTitleBar.top +
SYSMET(CYCAPTION);
00212 }
00213
00214
00215
00216
00217
if (
TestWF(pwnd,
WFSYSMENU) &&
_HasCaptionIcon(pwnd))
00218 ptbi->rcTitleBar.left += (ptbi->rcTitleBar.bottom - ptbi->rcTitleBar.top -
SYSMET(CYBORDER));
00219
00220
00221
00222
00223
if (!
TestWF(pwnd,
WFSYSMENU) &&
TestWF(pwnd,
WFWIN40COMPAT)) {
00224 ptbi->rgstate[INDEX_TITLEBAR_CLOSEBUTTON] |= STATE_SYSTEM_INVISIBLE;
00225 }
else {
00226
if (!
xxxMNCanClose(pwnd))
00227 ptbi->rgstate[INDEX_TITLEBAR_CLOSEBUTTON] |= STATE_SYSTEM_UNAVAILABLE;
00228
00229
if (
TestWF(pwnd,
WFCLOSEBUTTONDOWN))
00230 ptbi->rgstate[INDEX_TITLEBAR_CLOSEBUTTON] |= STATE_SYSTEM_PRESSED;
00231 }
00232
00233
00234
00235
00236
00237
if (!
TestWF(pwnd,
WFSYSMENU) &&
TestWF(pwnd,
WFWIN40COMPAT)) {
00238 ptbi->rgstate[INDEX_TITLEBAR_MAXBUTTON] |= STATE_SYSTEM_INVISIBLE;
00239 }
else {
00240
if (!
TestWF(pwnd,
WFMAXBOX)) {
00241
if (!
TestWF(pwnd,
WFMINBOX)) {
00242 ptbi->rgstate[INDEX_TITLEBAR_MAXBUTTON] |= STATE_SYSTEM_INVISIBLE;
00243 }
else {
00244 ptbi->rgstate[INDEX_TITLEBAR_MAXBUTTON] |= STATE_SYSTEM_UNAVAILABLE;
00245 }
00246 }
00247
00248
if (
TestWF(pwnd,
WFZOOMBUTTONDOWN))
00249 ptbi->rgstate[INDEX_TITLEBAR_MAXBUTTON] |= STATE_SYSTEM_PRESSED;
00250 }
00251
00252
00253
00254
00255
00256
if (!
TestWF(pwnd,
WFSYSMENU) &&
TestWF(pwnd,
WFWIN40COMPAT)) {
00257 ptbi->rgstate[INDEX_TITLEBAR_MINBUTTON] |= STATE_SYSTEM_INVISIBLE;
00258 }
else {
00259
if (!
TestWF(pwnd,
WFMINBOX)) {
00260
if (!
TestWF(pwnd,
WFMAXBOX)) {
00261 ptbi->rgstate[INDEX_TITLEBAR_MINBUTTON] |= STATE_SYSTEM_INVISIBLE;
00262 }
else {
00263 ptbi->rgstate[INDEX_TITLEBAR_MINBUTTON] |= STATE_SYSTEM_UNAVAILABLE;
00264 }
00265 }
00266
00267
if (
TestWF(pwnd,
WFREDUCEBUTTONDOWN))
00268 ptbi->rgstate[INDEX_TITLEBAR_MINBUTTON] |= STATE_SYSTEM_PRESSED;
00269 }
00270
00271
00272
00273
00274
00275
if (!
TestWF(pwnd,
WEFCONTEXTHELP) ||
TestWF(pwnd,
WFMINBOX) ||
00276
TestWF(pwnd,
WFMAXBOX)) {
00277 ptbi->rgstate[INDEX_TITLEBAR_HELPBUTTON] |= STATE_SYSTEM_INVISIBLE;
00278 }
else {
00279
if (
TestWF(pwnd,
WFHELPBUTTONDOWN))
00280 ptbi->rgstate[INDEX_TITLEBAR_HELPBUTTON] |= STATE_SYSTEM_PRESSED;
00281 }
00282
00283
00284 ptbi->rgstate[INDEX_TITLEBAR_IMEBUTTON] = STATE_SYSTEM_INVISIBLE;
00285
00286
#if 0
00287
00288
00289
00290
if (!
TestWF(pwnd,
WFSYSMENU) || !
_HasCaptionIcon(pwnd))
00291 ptbi->stateSysMenu |= STATE_SYSTEM_INVISIBLE;
00292
#endif
00293
00294
return TRUE;
00295 }
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
BOOL WINAPI
00309 _GetScrollBarInfo(
PWND pwnd, LONG idObject, PSCROLLBARINFO psbi)
00310 {
00311
UINT wDisable;
00312
BOOL fVertical;
00313
SBCALC SBCalc;
00314
00315
00316
00317
00318
if (psbi->cbSize !=
sizeof(SCROLLBARINFO)) {
00319 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING,
"SCROLLBARINFO.cbSize %d is wrong", psbi->cbSize);
00320
return FALSE;
00321 }
00322
00323 RtlZeroMemory(&psbi->rgstate,
sizeof(psbi->rgstate));
00324
00325
00326
00327
00328
if (idObject == OBJID_CLIENT) {
00329 RECT rc;
00330 wDisable = ((
PSBWND)pwnd)->wDisableFlags;
00331 fVertical = ((
PSBWND)pwnd)->fVert;
00332
GetRect(pwnd, &rc,
GRECT_CLIENT |
GRECT_CLIENTCOORDS);
00333
CalcSBStuff2(&SBCalc, &rc, (
PSBDATA)&((
PSBWND)pwnd)->SBCalc, ((
PSBWND)pwnd)->fVert);
00334 }
else {
00335
00336
00337
00338
if (idObject == OBJID_VSCROLL) {
00339 fVertical =
TRUE;
00340
if (!
TestWF(pwnd,
WFVSCROLL)) {
00341
00342 psbi->rgstate[INDEX_SCROLLBAR_SELF] |= STATE_SYSTEM_INVISIBLE;
00343 }
else if (!
TestWF(pwnd,
WFVPRESENT)) {
00344
00345 psbi->rgstate[INDEX_SCROLLBAR_SELF] |= STATE_SYSTEM_OFFSCREEN;
00346 }
00347 }
else if (idObject == OBJID_HSCROLL) {
00348 fVertical =
FALSE;
00349
if (!
TestWF(pwnd,
WFHSCROLL)) {
00350
00351 psbi->rgstate[INDEX_SCROLLBAR_SELF] |= STATE_SYSTEM_INVISIBLE;
00352 }
else if (!
TestWF(pwnd,
WFHPRESENT)) {
00353 psbi->rgstate[INDEX_SCROLLBAR_SELF] |= STATE_SYSTEM_OFFSCREEN;
00354 }
00355 }
else {
00356 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING,
"invalid idObject %d", idObject);
00357
return FALSE;
00358 }
00359
00360
if (psbi->rgstate[INDEX_SCROLLBAR_SELF] & STATE_SYSTEM_INVISIBLE)
00361
return TRUE;
00362
00363 wDisable =
GetWndSBDisableFlags(pwnd, fVertical);
00364
00365
if (!(psbi->rgstate[INDEX_SCROLLBAR_SELF] & STATE_SYSTEM_OFFSCREEN))
00366
CalcSBStuff(pwnd, &SBCalc, fVertical);
00367 }
00368
00369
00370
00371
00372
if (wDisable &
LTUPFLAG) {
00373 psbi->rgstate[INDEX_SCROLLBAR_UP] |= STATE_SYSTEM_UNAVAILABLE;
00374 psbi->rgstate[INDEX_SCROLLBAR_UPPAGE] |= STATE_SYSTEM_UNAVAILABLE;
00375 }
00376
00377
if (wDisable &
RTDNFLAG) {
00378 psbi->rgstate[INDEX_SCROLLBAR_DOWN] |= STATE_SYSTEM_UNAVAILABLE;
00379 psbi->rgstate[INDEX_SCROLLBAR_DOWNPAGE] |= STATE_SYSTEM_UNAVAILABLE;
00380 }
00381
00382
if ((wDisable & (
LTUPFLAG |
RTDNFLAG)) == (
LTUPFLAG |
RTDNFLAG))
00383 psbi->rgstate[INDEX_SCROLLBAR_SELF] |= STATE_SYSTEM_UNAVAILABLE;
00384
00385
00386
00387
00388
if (
TestWF(pwnd,
WFSCROLLBUTTONDOWN) &&
00389 ((idObject != OBJID_VSCROLL) ||
TestWF(pwnd,
WFVERTSCROLLTRACK))) {
00390
if (
TestWF(pwnd,
WFLINEUPBUTTONDOWN))
00391 psbi->rgstate[INDEX_SCROLLBAR_UP] |= STATE_SYSTEM_PRESSED;
00392
00393
if (
TestWF(pwnd,
WFPAGEUPBUTTONDOWN))
00394 psbi->rgstate[INDEX_SCROLLBAR_UPPAGE] |= STATE_SYSTEM_PRESSED;
00395
00396
if (
TestWF(pwnd,
WFPAGEDNBUTTONDOWN))
00397 psbi->rgstate[INDEX_SCROLLBAR_DOWNPAGE] |= STATE_SYSTEM_PRESSED;
00398
00399
if (
TestWF(pwnd,
WFLINEDNBUTTONDOWN))
00400 psbi->rgstate[INDEX_SCROLLBAR_DOWN] |= STATE_SYSTEM_PRESSED;
00401 }
00402
00403
00404
00405
00406
if (!(psbi->rgstate[INDEX_SCROLLBAR_SELF] & STATE_SYSTEM_OFFSCREEN)) {
00407
if (fVertical) {
00408 psbi->rcScrollBar.left = SBCalc.
pxLeft;
00409 psbi->rcScrollBar.top = SBCalc.
pxTop;
00410 psbi->rcScrollBar.right = SBCalc.
pxRight;
00411 psbi->rcScrollBar.bottom = SBCalc.
pxBottom;
00412 }
else {
00413 psbi->rcScrollBar.left = SBCalc.
pxTop;
00414 psbi->rcScrollBar.top = SBCalc.
pxLeft;
00415 psbi->rcScrollBar.right = SBCalc.
pxBottom;
00416 psbi->rcScrollBar.bottom = SBCalc.
pxRight;
00417 }
00418
00419
if (idObject == OBJID_CLIENT) {
00420
OffsetRect(&psbi->rcScrollBar, pwnd->
rcClient.left, pwnd->
rcClient.top);
00421 }
else {
00422
OffsetRect(&psbi->rcScrollBar, pwnd->
rcWindow.left, pwnd->
rcWindow.top);
00423 }
00424
00425 psbi->dxyLineButton = (SBCalc.
pxUpArrow - SBCalc.
pxTop);
00426 psbi->xyThumbTop = (SBCalc.
pxThumbTop - SBCalc.
pxTop);
00427 psbi->xyThumbBottom = (SBCalc.
pxThumbBottom - SBCalc.
pxTop);
00428
00429
00430
00431
00432
00433
if (SBCalc.
pxThumbTop == SBCalc.
pxUpArrow)
00434 psbi->rgstate[INDEX_SCROLLBAR_UPPAGE] |= STATE_SYSTEM_INVISIBLE;
00435
00436
00437
00438
00439
00440
if (SBCalc.
pxThumbBottom == SBCalc.
pxDownArrow)
00441 psbi->rgstate[INDEX_SCROLLBAR_DOWNPAGE] |= STATE_SYSTEM_INVISIBLE;
00442 }
00443
00444
return TRUE;
00445 }
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
PWND WINAPI
00460 _GetAncestor(
PWND pwnd, UINT gaFlags)
00461 {
00462
PWND pwndParent;
00463
00464
00465
00466
00467
if (pwnd ==
PWNDDESKTOP(pwnd))
00468
return NULL;
00469
00470
switch (gaFlags) {
00471
case GA_PARENT:
00472 pwnd = pwnd->
spwndParent;
00473
break;
00474
00475
case GA_ROOT:
00476
while ((pwnd->
spwndParent !=
PWNDDESKTOP(pwnd)) &&
00477 (pwnd->
spwndParent !=
PWNDMESSAGE(pwnd))) {
00478 pwnd = pwnd->
spwndParent;
00479 }
00480
break;
00481
00482
case GA_ROOTOWNER:
00483
while (pwndParent =
_GetParent(pwnd)) {
00484 pwnd = pwndParent;
00485 }
00486
break;
00487 }
00488
00489
return pwnd;
00490 }
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
PWND WINAPI
00505 _RealChildWindowFromPoint(
PWND pwndParent, POINT pt)
00506 {
00507
PWND pwndChild;
00508
PWND pwndSave;
00509
00510
if (pwndParent !=
PWNDDESKTOP(pwndParent)) {
00511 pt.x += pwndParent->
rcClient.left;
00512 pt.y += pwndParent->
rcClient.top;
00513 }
00514
00515
00516
00517
00518
if (!
PtInRect(&pwndParent->
rcClient, pt) ||
00519 (pwndParent->
hrgnClip && !GrePtInRegion(pwndParent->
hrgnClip, pt.x, pt.y))) {
00520
00521
return NULL;
00522 }
00523
00524 pwndSave =
NULL;
00525
00526
00527
00528
00529
for (pwndChild = pwndParent->
spwndChild; pwndChild; pwndChild = pwndChild->
spwndNext) {
00530
if (!
TestWF(pwndChild,
WFVISIBLE))
00531
continue;
00532
00533
00534
00535
00536
if (!
PtInRect(&pwndChild->
rcWindow, pt) ||
00537 (pwndChild->
hrgnClip && !GrePtInRegion(pwndChild->
hrgnClip, pt.x, pt.y)))
00538
continue;
00539
00540
00541
00542
00543
if ((pwndChild->
pcls->
atomClassName ==
gpsi->
atomSysClass[
ICLS_BUTTON]) ||
00544 (
GETFNID(pwndChild) ==
FNID_BUTTON)) {
00545
if (
TestWF(pwndChild,
BFTYPEMASK) ==
LOBYTE(BS_GROUPBOX)) {
00546 pwndSave = pwndChild;
00547
continue;
00548 }
00549 }
00550
00551
return pwndChild;
00552 }
00553
00554
00555
00556
00557
00558
if (pwndSave) {
00559
return pwndSave;
00560 }
else {
00561
return pwndParent;
00562 }
00563 }
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
BOOL WINAPI
00580 xxxGetMenuBarInfo(
PWND pwnd,
long idObject,
long idItem, PMENUBARINFO pmbi)
00581 {
00582
PMENU pMenu;
00583
int cBorders;
00584
PITEM pItem;
00585
PPOPUPMENU ppopup;
00586
00587
CheckLock(pwnd);
00588
00589
00590
00591
00592
if (pmbi->cbSize !=
sizeof(MENUBARINFO)) {
00593 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING,
"MENUBARINFO.cbSize %d is wrong", pmbi->cbSize);
00594
return FALSE;
00595 }
00596
00597
00598
00599
00600
SetRectEmpty(&pmbi->rcBar);
00601 pmbi->hMenu =
NULL;
00602 pmbi->hwndMenu =
NULL;
00603 pmbi->fBarFocused =
FALSE;
00604 pmbi->fFocused =
FALSE;
00605
00606
00607
00608
00609
if (idObject == OBJID_MENU) {
00610
int cBorders;
00611
00612
if (
TestWF(pwnd,
WFCHILD) || !pwnd->
spmenu)
00613
return FALSE;
00614
00615 pMenu = pwnd->
spmenu;
00616
if (!pMenu)
00617
return FALSE;
00618
00619
00620
if ((idItem < 0) || ((DWORD)idItem > pMenu->
cItems))
00621
return FALSE;
00622
00623
00624
00625
00626 pmbi->hMenu =
PtoHq(pMenu);
00627
00628
00629
00630
00631
if (pMenu->
cxMenu && pMenu->
cyMenu) {
00632
if (!idItem) {
00633 cBorders =
GetWindowBorders(pwnd->style, pwnd->ExStyle,
TRUE,
FALSE);
00634 pmbi->rcBar.left = pwnd->
rcWindow.left + cBorders *
SYSMET(CXBORDER);
00635 pmbi->rcBar.top = pwnd->
rcWindow.top + cBorders *
SYSMET(CYBORDER);
00636
00637
if (
TestWF(pwnd,
WFCPRESENT)) {
00638 pmbi->rcBar.top += (
TestWF(pwnd,
WEFTOOLWINDOW) ?
SYSMET(CYSMCAPTION) :
SYSMET(CYCAPTION));
00639 }
00640
00641 pmbi->rcBar.right = pmbi->rcBar.left + pMenu->
cxMenu;
00642 pmbi->rcBar.bottom = pmbi->rcBar.top + pMenu->
cyMenu;
00643 }
else {
00644 pItem = pMenu->
rgItems + idItem - 1;
00645
00646 pmbi->rcBar.left = pwnd->
rcWindow.left + pItem->
xItem;
00647 pmbi->rcBar.top = pwnd->
rcWindow.top + pItem->
yItem;
00648 pmbi->rcBar.right = pmbi->rcBar.left + pItem->
cxItem;
00649 pmbi->rcBar.bottom = pmbi->rcBar.top + pItem->
cyItem;
00650 }
00651 }
00652
00653
00654
00655
00656 ppopup =
GetpGlobalPopupMenu(pwnd);
00657
if (ppopup && ppopup->
fHasMenuBar && !ppopup->
fIsSysMenu &&
00658 (ppopup->
spwndNotify == pwnd))
00659 {
00660
00661 pmbi->fBarFocused =
TRUE;
00662
00663
if (!idItem) {
00664 pmbi->fFocused =
TRUE;
00665 }
else if (ppopup->
ppopupmenuRoot->
posSelectedItem == (
UINT)idItem-1) {
00666 pmbi->fFocused =
TRUE;
00667 UserAssert(ppopup->
ppopupmenuRoot);
00668 pmbi->hwndMenu =
HW(ppopup->
ppopupmenuRoot->
spwndNextPopup);
00669 }
00670 }
00671
00672 }
else if (idObject == OBJID_SYSMENU) {
00673
if (!
TestWF(pwnd,
WFSYSMENU))
00674
return FALSE;
00675
00676 pMenu =
xxxGetSysMenu(pwnd,
FALSE);
00677
if (!pMenu)
00678
return FALSE;
00679
00680
00681
if ((idItem < 0) || ((DWORD)idItem > pMenu->
cItems))
00682
return FALSE;
00683
00684 pmbi->hMenu =
PtoHq(pMenu);
00685
00686
00687
00688
00689
if (
_HasCaptionIcon(pwnd)) {
00690
00691 cBorders =
GetWindowBorders(pwnd->style, pwnd->ExStyle,
TRUE,
FALSE);
00692 pmbi->rcBar.left = pwnd->
rcWindow.left + cBorders *
SYSMET(CXBORDER);
00693 pmbi->rcBar.top = pwnd->
rcWindow.top + cBorders *
SYSMET(CYBORDER);
00694
00695 pmbi->rcBar.right = pmbi->rcBar.left +
00696 (
TestWF(pwnd,
WEFTOOLWINDOW) ?
SYSMET(CXSMSIZE) :
SYSMET(CXSIZE));
00697
00698 pmbi->rcBar.bottom = pmbi->rcBar.top +
00699 (
TestWF(pwnd,
WEFTOOLWINDOW) ?
SYSMET(CYSMSIZE) :
SYSMET(CYSIZE));
00700 }
00701
00702
00703
00704
00705 ppopup =
GetpGlobalPopupMenu(pwnd);
00706
if (ppopup && ppopup->
fHasMenuBar && ppopup->
fIsSysMenu &&
00707 (ppopup->
spwndNotify == pwnd))
00708 {
00709
00710 pmbi->fBarFocused =
TRUE;
00711
00712
if (!idItem) {
00713 pmbi->fFocused =
TRUE;
00714 }
else if (ppopup->
ppopupmenuRoot->
posSelectedItem == (
UINT)idItem - 1) {
00715 pmbi->fFocused =
TRUE;
00716 UserAssert(ppopup->
ppopupmenuRoot);
00717 pmbi->hwndMenu =
HW(ppopup->
ppopupmenuRoot->
spwndNextPopup);
00718 }
00719 }
00720 }
00721
else if (idObject == OBJID_CLIENT)
00722 {
00723 HMENU hMenu;
00724 hMenu = (HMENU)
xxxSendMessage(pwnd, MN_GETHMENU, 0, 0);
00725 pMenu =
HtoP(hMenu);
00726
if (!pMenu)
00727
return FALSE;
00728
00729
00730
if ((idItem < 0) || ((DWORD)idItem > pMenu->
cItems))
00731
return FALSE;
00732
00733 pmbi->hMenu = hMenu;
00734
00735
if (!idItem) {
00736 pmbi->rcBar = pwnd->
rcClient;
00737 }
else {
00738 pItem = pMenu->
rgItems + idItem - 1;
00739
00740 pmbi->rcBar.left = pwnd->
rcClient.left + pItem->
xItem;
00741 pmbi->rcBar.top = pwnd->
rcClient.top + pItem->
yItem;
00742 pmbi->rcBar.right = pmbi->rcBar.left + pItem->
cxItem;
00743 pmbi->rcBar.bottom = pmbi->rcBar.top + pItem->
cyItem;
00744 }
00745
00746
00747
00748
00749
00750 ppopup = ((
PMENUWND)pwnd)->ppopupmenu;
00751
if (ppopup && (ppopup->
ppopupmenuRoot ==
GetpGlobalPopupMenu(pwnd))) {
00752 pmbi->fBarFocused =
TRUE;
00753
00754
if (!idItem) {
00755 pmbi->fFocused =
TRUE;
00756 }
else if ((
UINT)idItem == ppopup->
posSelectedItem + 1) {
00757 pmbi->fFocused =
TRUE;
00758 pmbi->hwndMenu =
HW(ppopup->
spwndNextPopup);
00759 }
00760 }
00761 }
else {
00762
return FALSE;
00763 }
00764
00765
return TRUE;
00766 }
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
BOOL WINAPI
00778 _GetComboBoxInfo(
PWND pwnd, PCOMBOBOXINFO pcbi)
00779 {
00780
PCLS pcls;
00781 COMBOBOXINFO cbi = {
00782
sizeof cbi,
00783 };
00784
BOOL fOtherProcess;
00785
BOOL bRetval =
FALSE;
00786 WORD wWindowType = 0;
00787
00788
00789
00790
00791 pcls = pwnd->
pcls;
00792
00793
00794
if ((
GETFNID(pwnd) ==
FNID_COMBOBOX) ||
00795 (pcls->
atomClassName ==
gpsi->
atomSysClass[
ICLS_COMBOBOX])) {
00796 wWindowType =
FNID_COMBOBOX;
00797 }
else if ((
GETFNID(pwnd) ==
FNID_COMBOLISTBOX) ||
00798 (pcls->
atomClassName ==
gpsi->
atomSysClass[
ICLS_COMBOLISTBOX])) {
00799 wWindowType =
FNID_COMBOLISTBOX;
00800 }
else {
00801 RIPERR1(ERROR_WINDOW_NOT_COMBOBOX, RIP_WARNING,
00802
"pwnd %#p not a combobox or dropdown", pwnd);
00803
return FALSE;
00804 }
00805
00806
00807
00808
00809
if (pcbi->cbSize !=
sizeof(COMBOBOXINFO)) {
00810 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING,
"COMBOBOXINFO.cbSize %d is wrong", pcbi->cbSize);
00811
return FALSE;
00812 }
00813
00814
if (fOtherProcess = (
GETPTI(pwnd)->ppi !=
PpiCurrent())) {
00815
KeAttachProcess(&
GETPTI(pwnd)->ppi->Process->Pcb);
00816 }
00817
00818
try {
00819
PCBOX ccxPcboxSnap;
00820
PWND ccxPwndSnap;
00821 HWND ccxHwndSnap;
00822
00823
00824
00825
00826
if (wWindowType ==
FNID_COMBOBOX) {
00827 ccxPcboxSnap = ((
PCOMBOWND)pwnd)->pcbox;
00828 }
else {
00829
PLBIV ccxPlbSnap;
00830
00831
00832
00833
00834 ccxPlbSnap = ((
PLBWND)pwnd)->pLBIV;
00835
if (!ccxPlbSnap) {
00836
goto errorexit;
00837 }
00838
ProbeForRead(ccxPlbSnap,
sizeof(
LBIV),
DATAALIGN);
00839 ccxPcboxSnap = ccxPlbSnap->
pcbox;
00840 }
00841
if (!ccxPcboxSnap) {
00842
goto errorexit;
00843 }
00844
ProbeForRead(ccxPcboxSnap,
sizeof(
CBOX),
DATAALIGN);
00845
00846
00847
00848
00849
00850
00851
00852
00853 ccxPwndSnap = ccxPcboxSnap->
spwnd;
00854
ProbeForRead(ccxPwndSnap,
sizeof(
HEAD),
DATAALIGN);
00855 cbi.hwndCombo =
HWCCX(ccxPwndSnap);
00856
00857
00858
00859
00860
00861
00862
00863
00864 ccxPwndSnap = ccxPcboxSnap->
spwndEdit;
00865
00866
00867
00868
00869
ProbeForRead(ccxPwndSnap,
sizeof(
HEAD),
DATAALIGN);
00870 ccxHwndSnap =
HWCCX(ccxPwndSnap);
00871
if (ccxHwndSnap ==
HW(pwnd)) {
00872
00873
00874
00875 cbi.hwndItem =
NULL;
00876 }
else {
00877 cbi.hwndItem =
HWCCX(ccxPwndSnap);
00878 }
00879
00880
00881
00882
00883 ccxPwndSnap = ccxPcboxSnap->
spwndList;
00884
00885
00886
00887
00888
ProbeForRead(ccxPwndSnap,
sizeof(
HEAD),
DATAALIGN);
00889 cbi.hwndList =
HWCCX(ccxPwndSnap);
00890
00891
00892
00893
00894
00895 cbi.rcItem = ccxPcboxSnap->
editrc;
00896 cbi.rcButton = ccxPcboxSnap->
buttonrc;
00897
00898
00899
00900
00901 cbi.stateButton = 0;
00902
if (ccxPcboxSnap->
CBoxStyle == CBS_SIMPLE) {
00903 cbi.stateButton |= STATE_SYSTEM_INVISIBLE;
00904 }
00905
if (ccxPcboxSnap->
fButtonPressed) {
00906 cbi.stateButton |= STATE_SYSTEM_PRESSED;
00907 }
00908 } except (W32ExceptionHandler(
FALSE, RIP_WARNING)) {
00909
goto errorexit;
00910 }
00911
00912 *pcbi = cbi;
00913 bRetval =
TRUE;
00914
00915 errorexit:
00916
if (fOtherProcess) {
00917
KeDetachProcess();
00918 }
00919
return bRetval;
00920 }
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
DWORD WINAPI
00946 _GetListBoxInfo(
PWND pwnd)
00947 {
00948
PCLS pcls;
00949
DWORD dwRet = 0;
00950
BOOL fOtherProcess;
00951
00952
00953
00954
00955 pcls = pwnd->
pcls;
00956
if ((pcls->
atomClassName !=
gpsi->
atomSysClass[
ICLS_LISTBOX]) &&
00957 (
GETFNID(pwnd) !=
FNID_LISTBOX)) {
00958 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING,
"pwnd %#p is not a listbox", pwnd);
00959
return 0;
00960 }
00961
00962
if (fOtherProcess = (
GETPTI(pwnd)->ppi !=
PpiCurrent())) {
00963
KeAttachProcess(&
GETPTI(pwnd)->ppi->Process->Pcb);
00964 }
00965
00966
try {
00967
PLBIV ccxPlbSnap;
00968
00969
00970
00971
00972 ccxPlbSnap = ((
PLBWND)pwnd)->pLBIV;
00973
if (!ccxPlbSnap) {
00974
goto errorexit;
00975 }
00976
ProbeForRead(ccxPlbSnap,
sizeof(
LBIV),
DATAALIGN);
00977
00978
if (ccxPlbSnap->
fMultiColumn) {
00979 dwRet = ccxPlbSnap->
itemsPerColumn;
00980 }
else {
00981 dwRet = ccxPlbSnap->
cMac;
00982 }
00983 } except (W32ExceptionHandler(
FALSE, RIP_WARNING)) {
00984 dwRet = 0;
00985 }
00986
00987 errorexit:
00988
if (fOtherProcess) {
00989
KeDetachProcess();
00990 }
00991
00992
return dwRet;
00993 }