Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
37a4639e
Commit
37a4639e
authored
Sep 12, 2001
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that functions returning an HWND always return a full 32-bit
handle.
parent
ef58632a
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
100 additions
and
63 deletions
+100
-63
message.c
dlls/user/message.c
+2
-2
win.h
include/win.h
+12
-1
clipboard.c
windows/clipboard.c
+8
-11
dce.c
windows/dce.c
+17
-21
dialog.c
windows/dialog.c
+5
-0
focus.c
windows/focus.c
+1
-0
input.c
windows/input.c
+1
-1
win.c
windows/win.c
+49
-25
winpos.c
windows/winpos.c
+5
-2
No files found.
dlls/user/message.c
View file @
37a4639e
...
@@ -1091,7 +1091,7 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar
...
@@ -1091,7 +1091,7 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar
cwp
.
lParam
=
lparam
;
cwp
.
lParam
=
lparam
;
cwp
.
wParam
=
wparam
;
cwp
.
wParam
=
wparam
;
cwp
.
message
=
msg
;
cwp
.
message
=
msg
;
cwp
.
hwnd
=
hwnd
;
cwp
.
hwnd
=
WIN_GetFullHandle
(
hwnd
)
;
if
(
unicode
)
HOOK_CallHooksW
(
WH_CALLWNDPROC
,
HC_ACTION
,
1
,
(
LPARAM
)
&
cwp
);
if
(
unicode
)
HOOK_CallHooksW
(
WH_CALLWNDPROC
,
HC_ACTION
,
1
,
(
LPARAM
)
&
cwp
);
else
HOOK_CallHooksA
(
WH_CALLWNDPROC
,
HC_ACTION
,
1
,
(
LPARAM
)
&
cwp
);
else
HOOK_CallHooksA
(
WH_CALLWNDPROC
,
HC_ACTION
,
1
,
(
LPARAM
)
&
cwp
);
lparam
=
cwp
.
lParam
;
lparam
=
cwp
.
lParam
;
...
@@ -1120,7 +1120,7 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar
...
@@ -1120,7 +1120,7 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar
cwp
.
lParam
=
lparam
;
cwp
.
lParam
=
lparam
;
cwp
.
wParam
=
wparam
;
cwp
.
wParam
=
wparam
;
cwp
.
message
=
msg
;
cwp
.
message
=
msg
;
cwp
.
hwnd
=
hwnd
;
cwp
.
hwnd
=
WIN_GetFullHandle
(
hwnd
)
;
if
(
unicode
)
HOOK_CallHooksW
(
WH_CALLWNDPROCRET
,
HC_ACTION
,
1
,
(
LPARAM
)
&
cwp
);
if
(
unicode
)
HOOK_CallHooksW
(
WH_CALLWNDPROCRET
,
HC_ACTION
,
1
,
(
LPARAM
)
&
cwp
);
else
HOOK_CallHooksA
(
WH_CALLWNDPROCRET
,
HC_ACTION
,
1
,
(
LPARAM
)
&
cwp
);
else
HOOK_CallHooksA
(
WH_CALLWNDPROCRET
,
HC_ACTION
,
1
,
(
LPARAM
)
&
cwp
);
}
}
...
...
include/win.h
View file @
37a4639e
...
@@ -85,7 +85,7 @@ extern WND* WIN_FindWndPtr( HWND hwnd );
...
@@ -85,7 +85,7 @@ extern WND* WIN_FindWndPtr( HWND hwnd );
extern
WND
*
WIN_LockWndPtr
(
WND
*
wndPtr
);
extern
WND
*
WIN_LockWndPtr
(
WND
*
wndPtr
);
extern
void
WIN_ReleaseWndPtr
(
WND
*
wndPtr
);
extern
void
WIN_ReleaseWndPtr
(
WND
*
wndPtr
);
extern
void
WIN_UpdateWndPtr
(
WND
**
oldPtr
,
WND
*
newPtr
);
extern
void
WIN_UpdateWndPtr
(
WND
**
oldPtr
,
WND
*
newPtr
);
extern
HWND
WIN_
GetFullHandle
(
HWND
hwnd
);
extern
HWND
WIN_
Handle32
(
HWND16
hwnd16
);
extern
void
WIN_LinkWindow
(
HWND
hwnd
,
HWND
parent
,
HWND
hwndInsertAfter
);
extern
void
WIN_LinkWindow
(
HWND
hwnd
,
HWND
parent
,
HWND
hwndInsertAfter
);
extern
void
WIN_UnlinkWindow
(
HWND
hwnd
);
extern
void
WIN_UnlinkWindow
(
HWND
hwnd
);
extern
HWND
WIN_FindWinToRepaint
(
HWND
hwnd
);
extern
HWND
WIN_FindWinToRepaint
(
HWND
hwnd
);
...
@@ -96,6 +96,17 @@ extern HWND *WIN_ListParents( HWND hwnd );
...
@@ -96,6 +96,17 @@ extern HWND *WIN_ListParents( HWND hwnd );
extern
HWND
*
WIN_ListChildren
(
HWND
hwnd
);
extern
HWND
*
WIN_ListChildren
(
HWND
hwnd
);
extern
BOOL
WIN_InternalShowOwnedPopups
(
HWND
owner
,
BOOL
fShow
,
BOOL
unmanagedOnly
);
extern
BOOL
WIN_InternalShowOwnedPopups
(
HWND
owner
,
BOOL
fShow
,
BOOL
unmanagedOnly
);
inline
static
HWND
WIN_GetFullHandle
(
HWND
hwnd
)
{
if
(
!
HIWORD
(
hwnd
)
&&
hwnd
)
hwnd
=
WIN_Handle32
(
LOWORD
(
hwnd
)
);
return
hwnd
;
}
inline
static
HWND16
WIN_Handle16
(
HWND
hwnd
)
{
return
LOWORD
(
hwnd
);
}
extern
HWND
CARET_GetHwnd
(
void
);
extern
HWND
CARET_GetHwnd
(
void
);
extern
void
CARET_GetRect
(
LPRECT
lprc
);
/* windows/caret.c */
extern
void
CARET_GetRect
(
LPRECT
lprc
);
/* windows/caret.c */
...
...
windows/clipboard.c
View file @
37a4639e
...
@@ -12,9 +12,6 @@
...
@@ -12,9 +12,6 @@
* The internal implementation talks to a "clipboard driver" to fill or
* The internal implementation talks to a "clipboard driver" to fill or
* expose the cache to the native device. (Currently only the X11 and
* expose the cache to the native device. (Currently only the X11 and
* TTY clipboard driver are available)
* TTY clipboard driver are available)
*
* TODO:
*
*/
*/
#include <stdlib.h>
#include <stdlib.h>
...
@@ -31,6 +28,7 @@
...
@@ -31,6 +28,7 @@
#include "wine/winbase16.h"
#include "wine/winbase16.h"
#include "heap.h"
#include "heap.h"
#include "user.h"
#include "user.h"
#include "win.h"
#include "clipboard.h"
#include "clipboard.h"
#include "debugtools.h"
#include "debugtools.h"
...
@@ -45,10 +43,10 @@ DEFAULT_DEBUG_CHANNEL(clipboard);
...
@@ -45,10 +43,10 @@ DEFAULT_DEBUG_CHANNEL(clipboard);
static
HANDLE
hClipLock
=
0
;
static
HANDLE
hClipLock
=
0
;
static
BOOL
bCBHasChanged
=
FALSE
;
static
BOOL
bCBHasChanged
=
FALSE
;
HWND
hWndClipWindow
=
0
;
/* window that last opened clipboard */
static
HWND
hWndClipWindow
;
/* window that last opened clipboard */
HWND
hWndClipOwner
=
0
;
/* current clipboard owner */
static
HWND
hWndClipOwner
;
/* current clipboard owner */
HANDLE16
hTaskClipOwner
=
0
;
/* clipboard owner's task */
static
HANDLE16
hTaskClipOwner
;
/* clipboard owner's task */
static
HWND
hWndViewer
=
0
;
/* start of viewers chain */
static
HWND
hWndViewer
;
/* start of viewers chain */
static
WORD
LastRegFormat
=
CF_REGFORMATBASE
;
static
WORD
LastRegFormat
=
CF_REGFORMATBASE
;
...
@@ -737,7 +735,7 @@ BOOL WINAPI OpenClipboard( HWND hWnd )
...
@@ -737,7 +735,7 @@ BOOL WINAPI OpenClipboard( HWND hWnd )
hClipLock
=
GetCurrentTask
();
hClipLock
=
GetCurrentTask
();
/* Save current user of the clipboard */
/* Save current user of the clipboard */
hWndClipWindow
=
hWnd
;
hWndClipWindow
=
WIN_GetFullHandle
(
hWnd
)
;
bCBHasChanged
=
FALSE
;
bCBHasChanged
=
FALSE
;
bRet
=
TRUE
;
bRet
=
TRUE
;
}
}
...
@@ -1320,7 +1318,7 @@ HWND WINAPI SetClipboardViewer( HWND hWnd )
...
@@ -1320,7 +1318,7 @@ HWND WINAPI SetClipboardViewer( HWND hWnd )
TRACE
(
"(%04x): returning %04x
\n
"
,
hWnd
,
hwndPrev
);
TRACE
(
"(%04x): returning %04x
\n
"
,
hWnd
,
hwndPrev
);
hWndViewer
=
hWnd
;
hWndViewer
=
WIN_GetFullHandle
(
hWnd
)
;
return
hwndPrev
;
return
hwndPrev
;
}
}
...
@@ -1368,7 +1366,7 @@ BOOL WINAPI ChangeClipboardChain(HWND hWnd, HWND hWndNext)
...
@@ -1368,7 +1366,7 @@ BOOL WINAPI ChangeClipboardChain(HWND hWnd, HWND hWndNext)
else
else
WARN
(
"hWndViewer is lost
\n
"
);
WARN
(
"hWndViewer is lost
\n
"
);
if
(
hWnd
==
hWndViewer
)
hWndViewer
=
hWndNext
;
if
(
hWnd
==
hWndViewer
)
hWndViewer
=
WIN_GetFullHandle
(
hWndNext
)
;
return
bRet
;
return
bRet
;
}
}
...
@@ -1474,4 +1472,3 @@ DWORD WINAPI GetClipboardSequenceNumber(VOID)
...
@@ -1474,4 +1472,3 @@ DWORD WINAPI GetClipboardSequenceNumber(VOID)
/* FIXME: Use serial numbers */
/* FIXME: Use serial numbers */
return
0
;
return
0
;
}
}
windows/dce.c
View file @
37a4639e
...
@@ -70,7 +70,6 @@ DCE *DCE_AllocDCE( HWND hWnd, DCE_TYPE type )
...
@@ -70,7 +70,6 @@ DCE *DCE_AllocDCE( HWND hWnd, DCE_TYPE type )
{
{
FARPROC16
hookProc
;
FARPROC16
hookProc
;
DCE
*
dce
;
DCE
*
dce
;
WND
*
wnd
;
if
(
!
(
dce
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DCE
)
)))
return
NULL
;
if
(
!
(
dce
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DCE
)
)))
return
NULL
;
if
(
!
(
dce
->
hDC
=
CreateDCA
(
"DISPLAY"
,
NULL
,
NULL
,
NULL
)))
if
(
!
(
dce
->
hDC
=
CreateDCA
(
"DISPLAY"
,
NULL
,
NULL
,
NULL
)))
...
@@ -80,32 +79,31 @@ DCE *DCE_AllocDCE( HWND hWnd, DCE_TYPE type )
...
@@ -80,32 +79,31 @@ DCE *DCE_AllocDCE( HWND hWnd, DCE_TYPE type )
}
}
if
(
!
defaultDCstate
)
defaultDCstate
=
GetDCState16
(
dce
->
hDC
);
if
(
!
defaultDCstate
)
defaultDCstate
=
GetDCState16
(
dce
->
hDC
);
wnd
=
WIN_FindWndPtr
(
hWnd
);
/* store DCE handle in DC hook data field */
/* store DCE handle in DC hook data field */
hookProc
=
GetProcAddress16
(
GetModuleHandle16
(
"USER"
),
(
LPCSTR
)
362
);
hookProc
=
GetProcAddress16
(
GetModuleHandle16
(
"USER"
),
(
LPCSTR
)
362
);
SetDCHook
(
dce
->
hDC
,
hookProc
,
(
DWORD
)
dce
);
SetDCHook
(
dce
->
hDC
,
hookProc
,
(
DWORD
)
dce
);
dce
->
hwndCurrent
=
hWnd
;
dce
->
hwndCurrent
=
WIN_GetFullHandle
(
hWnd
)
;
dce
->
hClipRgn
=
0
;
dce
->
hClipRgn
=
0
;
dce
->
next
=
firstDCE
;
firstDCE
=
dce
;
if
(
type
!=
DCE_CACHE_DC
)
/* owned or class DC */
if
(
type
!=
DCE_CACHE_DC
)
/* owned or class DC */
{
{
dce
->
DCXflags
=
DCX_DCEBUSY
;
dce
->
DCXflags
=
DCX_DCEBUSY
;
if
(
hWnd
)
if
(
hWnd
)
{
{
if
(
wnd
->
dwStyle
&
WS_CLIPCHILDREN
)
dce
->
DCXflags
|=
DCX_CLIPCHILDREN
;
LONG
style
=
GetWindowLongW
(
hWnd
,
GWL_STYLE
);
if
(
wnd
->
dwStyle
&
WS_CLIPSIBLINGS
)
dce
->
DCXflags
|=
DCX_CLIPSIBLINGS
;
if
(
style
&
WS_CLIPCHILDREN
)
dce
->
DCXflags
|=
DCX_CLIPCHILDREN
;
if
(
style
&
WS_CLIPSIBLINGS
)
dce
->
DCXflags
|=
DCX_CLIPSIBLINGS
;
}
}
SetHookFlags16
(
dce
->
hDC
,
DCHF_INVALIDATEVISRGN
);
SetHookFlags16
(
dce
->
hDC
,
DCHF_INVALIDATEVISRGN
);
}
}
else
dce
->
DCXflags
=
DCX_CACHE
|
DCX_DCEEMPTY
;
else
dce
->
DCXflags
=
DCX_CACHE
|
DCX_DCEEMPTY
;
WIN_ReleaseWndPtr
(
wnd
);
USER_Lock
();
dce
->
next
=
firstDCE
;
firstDCE
=
dce
;
USER_Unlock
();
return
dce
;
return
dce
;
}
}
...
@@ -115,7 +113,7 @@ DCE *DCE_AllocDCE( HWND hWnd, DCE_TYPE type )
...
@@ -115,7 +113,7 @@ DCE *DCE_AllocDCE( HWND hWnd, DCE_TYPE type )
*/
*/
DCE
*
DCE_FreeDCE
(
DCE
*
dce
)
DCE
*
DCE_FreeDCE
(
DCE
*
dce
)
{
{
DCE
**
ppDCE
;
DCE
**
ppDCE
,
*
ret
;
if
(
!
dce
)
return
NULL
;
if
(
!
dce
)
return
NULL
;
...
@@ -125,6 +123,8 @@ DCE* DCE_FreeDCE( DCE *dce )
...
@@ -125,6 +123,8 @@ DCE* DCE_FreeDCE( DCE *dce )
while
(
*
ppDCE
&&
(
*
ppDCE
!=
dce
))
ppDCE
=
&
(
*
ppDCE
)
->
next
;
while
(
*
ppDCE
&&
(
*
ppDCE
!=
dce
))
ppDCE
=
&
(
*
ppDCE
)
->
next
;
if
(
*
ppDCE
==
dce
)
*
ppDCE
=
dce
->
next
;
if
(
*
ppDCE
==
dce
)
*
ppDCE
=
dce
->
next
;
ret
=
*
ppDCE
;
USER_Unlock
();
SetDCHook
(
dce
->
hDC
,
NULL
,
0L
);
SetDCHook
(
dce
->
hDC
,
NULL
,
0L
);
...
@@ -133,9 +133,7 @@ DCE* DCE_FreeDCE( DCE *dce )
...
@@ -133,9 +133,7 @@ DCE* DCE_FreeDCE( DCE *dce )
DeleteObject
(
dce
->
hClipRgn
);
DeleteObject
(
dce
->
hClipRgn
);
HeapFree
(
GetProcessHeap
(),
0
,
dce
);
HeapFree
(
GetProcessHeap
(),
0
,
dce
);
USER_Unlock
();
return
ret
;
return
*
ppDCE
;
}
}
/***********************************************************************
/***********************************************************************
...
@@ -146,22 +144,21 @@ DCE* DCE_FreeDCE( DCE *dce )
...
@@ -146,22 +144,21 @@ DCE* DCE_FreeDCE( DCE *dce )
void
DCE_FreeWindowDCE
(
HWND
hwnd
)
void
DCE_FreeWindowDCE
(
HWND
hwnd
)
{
{
DCE
*
pDCE
;
DCE
*
pDCE
;
WND
*
pWnd
=
WIN_FindWndPtr
(
hwnd
);
USER_Lock
();
pDCE
=
firstDCE
;
pDCE
=
firstDCE
;
hwnd
=
pWnd
->
hwndSelf
;
/* make it a full handle */
while
(
pDCE
)
while
(
pDCE
)
{
{
if
(
pDCE
->
hwndCurrent
==
hwnd
)
if
(
pDCE
->
hwndCurrent
==
hwnd
)
{
{
WND
*
pWnd
=
WIN_FindWndPtr
(
hwnd
);
if
(
pDCE
==
pWnd
->
dce
)
/* owned or Class DCE*/
if
(
pDCE
==
pWnd
->
dce
)
/* owned or Class DCE*/
{
{
if
(
pWnd
->
clsStyle
&
CS_OWNDC
)
/* owned DCE*/
if
(
pWnd
->
clsStyle
&
CS_OWNDC
)
/* owned DCE*/
{
{
pDCE
=
DCE_FreeDCE
(
pDCE
);
pDCE
=
DCE_FreeDCE
(
pDCE
);
pWnd
->
dce
=
NULL
;
pWnd
->
dce
=
NULL
;
WIN_ReleaseWndPtr
(
pWnd
);
continue
;
continue
;
}
}
else
if
(
pDCE
->
DCXflags
&
(
DCX_INTERSECTRGN
|
DCX_EXCLUDERGN
)
)
/* Class DCE*/
else
if
(
pDCE
->
DCXflags
&
(
DCX_INTERSECTRGN
|
DCX_EXCLUDERGN
)
)
/* Class DCE*/
...
@@ -181,8 +178,7 @@ void DCE_FreeWindowDCE( HWND hwnd )
...
@@ -181,8 +178,7 @@ void DCE_FreeWindowDCE( HWND hwnd )
* We should change this to WARN when Wine is more stable
* We should change this to WARN when Wine is more stable
* (for 1.0?).
* (for 1.0?).
*/
*/
ERR
(
"[%04x] GetDC() without ReleaseDC()!
\n
"
,
ERR
(
"[%08x] GetDC() without ReleaseDC()!
\n
"
,
hwnd
);
pWnd
->
hwndSelf
);
DCE_ReleaseDC
(
pDCE
);
DCE_ReleaseDC
(
pDCE
);
}
}
...
@@ -190,12 +186,11 @@ void DCE_FreeWindowDCE( HWND hwnd )
...
@@ -190,12 +186,11 @@ void DCE_FreeWindowDCE( HWND hwnd )
pDCE
->
DCXflags
|=
DCX_DCEEMPTY
;
pDCE
->
DCXflags
|=
DCX_DCEEMPTY
;
pDCE
->
hwndCurrent
=
0
;
pDCE
->
hwndCurrent
=
0
;
}
}
WIN_ReleaseWndPtr
(
pWnd
);
}
}
pDCE
=
pDCE
->
next
;
pDCE
=
pDCE
->
next
;
}
}
USER_Unlock
(
);
WIN_ReleaseWndPtr
(
pWnd
);
}
}
...
@@ -403,6 +398,7 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
...
@@ -403,6 +398,7 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
if
(
!
hwnd
)
hwnd
=
GetDesktopWindow
();
if
(
!
hwnd
)
hwnd
=
GetDesktopWindow
();
if
(
!
(
wndPtr
=
WIN_FindWndPtr
(
hwnd
)))
return
0
;
if
(
!
(
wndPtr
=
WIN_FindWndPtr
(
hwnd
)))
return
0
;
hwnd
=
wndPtr
->
hwndSelf
;
/* make it a full handle */
/* fixup flags */
/* fixup flags */
...
...
windows/dialog.c
View file @
37a4639e
...
@@ -1953,6 +1953,9 @@ HWND WINAPI GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl,
...
@@ -1953,6 +1953,9 @@ HWND WINAPI GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl,
{
{
HWND
hwnd
,
retvalue
;
HWND
hwnd
,
retvalue
;
hwndDlg
=
WIN_GetFullHandle
(
hwndDlg
);
hwndCtrl
=
WIN_GetFullHandle
(
hwndCtrl
);
if
(
hwndCtrl
)
if
(
hwndCtrl
)
{
{
/* if the hwndCtrl is the child of the control in the hwndDlg,
/* if the hwndCtrl is the child of the control in the hwndDlg,
...
@@ -2108,6 +2111,8 @@ static HWND DIALOG_GetNextTabItem( HWND hwndMain, HWND hwndDlg, HWND hwndCtrl, B
...
@@ -2108,6 +2111,8 @@ static HWND DIALOG_GetNextTabItem( HWND hwndMain, HWND hwndDlg, HWND hwndCtrl, B
HWND
WINAPI
GetNextDlgTabItem
(
HWND
hwndDlg
,
HWND
hwndCtrl
,
HWND
WINAPI
GetNextDlgTabItem
(
HWND
hwndDlg
,
HWND
hwndCtrl
,
BOOL
fPrevious
)
BOOL
fPrevious
)
{
{
hwndDlg
=
WIN_GetFullHandle
(
hwndDlg
);
hwndCtrl
=
WIN_GetFullHandle
(
hwndCtrl
);
return
DIALOG_GetNextTabItem
(
hwndDlg
,
hwndDlg
,
hwndCtrl
,
fPrevious
);
return
DIALOG_GetNextTabItem
(
hwndDlg
,
hwndDlg
,
hwndCtrl
,
fPrevious
);
}
}
...
...
windows/focus.c
View file @
37a4639e
...
@@ -74,6 +74,7 @@ HWND WINAPI SetFocus( HWND hwnd )
...
@@ -74,6 +74,7 @@ HWND WINAPI SetFocus( HWND hwnd )
/* Check if we can set the focus to this window */
/* Check if we can set the focus to this window */
WND
*
wndPtr
;
WND
*
wndPtr
;
hwnd
=
WIN_GetFullHandle
(
hwnd
);
for
(;;)
for
(;;)
{
{
HWND
parent
;
HWND
parent
;
...
...
windows/input.c
View file @
37a4639e
...
@@ -493,7 +493,7 @@ HWND EVENT_Capture(HWND hwnd, INT16 ht)
...
@@ -493,7 +493,7 @@ HWND EVENT_Capture(HWND hwnd, INT16 ht)
if
(
wndPtr
)
if
(
wndPtr
)
{
{
TRACE_
(
win
)(
"(0x%04x)
\n
"
,
hwnd
);
TRACE_
(
win
)(
"(0x%04x)
\n
"
,
hwnd
);
captureWnd
=
hwnd
;
captureWnd
=
wndPtr
->
hwndSelf
;
captureHT
=
ht
;
captureHT
=
ht
;
}
}
}
}
...
...
windows/win.c
View file @
37a4639e
...
@@ -147,17 +147,50 @@ static WND *free_window_handle( HWND hwnd )
...
@@ -147,17 +147,50 @@ static WND *free_window_handle( HWND hwnd )
/***********************************************************************
/***********************************************************************
*
WIN_GetFullHandle
*
get_wnd_ptr
*
*
* Get the full 32-bit window handle from a possibly truncated handle.
* Return a pointer to the WND structure if local to the process.
* If ret value is non-NULL, the user lock is held.
*/
*/
HWND
WIN_GetFullHandle
(
HWND
hwnd
)
static
WND
*
get_wnd_ptr
(
HWND
hwnd
)
{
{
if
(
!
HIWORD
(
hwnd
))
WND
*
ptr
;
if
(
!
hwnd
)
return
NULL
;
USER_Lock
();
if
((
ptr
=
user_handles
[
LOWORD
(
hwnd
)]))
{
if
(
ptr
->
dwMagic
==
WND_MAGIC
&&
(
!
HIWORD
(
hwnd
)
||
hwnd
==
ptr
->
hwndSelf
))
return
ptr
;
}
USER_Unlock
();
return
NULL
;
}
/***********************************************************************
* WIN_Handle32
*
* Convert a 16-bit window handle to a full 32-bit handle.
*/
HWND
WIN_Handle32
(
HWND16
hwnd16
)
{
WND
*
ptr
;
HWND
hwnd
=
(
HWND
)
hwnd16
;
if
(
!
hwnd
||
hwnd
==
HWND_BROADCAST
)
return
hwnd
;
if
((
ptr
=
get_wnd_ptr
(
hwnd
)))
{
hwnd
=
ptr
->
hwndSelf
;
USER_Unlock
();
}
else
/* may belong to another process */
{
{
SERVER_START_REQ
(
get_window_info
)
SERVER_START_REQ
(
get_window_info
)
{
{
req
->
handle
=
hwnd
;
req
->
handle
=
(
user_handle_t
)
hwnd16
;
if
(
!
SERVER_CALL_ERR
())
hwnd
=
req
->
full_handle
;
if
(
!
SERVER_CALL_ERR
())
hwnd
=
req
->
full_handle
;
}
}
SERVER_END_REQ
;
SERVER_END_REQ
;
...
@@ -177,27 +210,19 @@ WND * WIN_FindWndPtr( HWND hwnd )
...
@@ -177,27 +210,19 @@ WND * WIN_FindWndPtr( HWND hwnd )
if
(
!
hwnd
)
return
NULL
;
if
(
!
hwnd
)
return
NULL
;
USER_Lock
();
if
((
ptr
=
get_wnd_ptr
(
hwnd
)))
if
(
!
(
ptr
=
user_handles
[
LOWORD
(
hwnd
)]))
{
{
/* increment destruction monitoring */
ptr
->
irefCount
++
;
return
ptr
;
}
/* check other processes */
/* check other processes */
if
(
IsWindow
(
hwnd
))
if
(
IsWindow
(
hwnd
))
{
{
ERR
(
"window %04x belongs to other process
\n
"
,
hwnd
);
ERR
(
"window %04x belongs to other process
\n
"
,
hwnd
);
/* DbgBreakPoint(); */
/* DbgBreakPoint(); */
}
}
goto
error
;
}
if
(
ptr
->
dwMagic
!=
WND_MAGIC
)
goto
error
;
/* verify that handle highword (if any) matches the window */
if
(
HIWORD
(
hwnd
)
&&
hwnd
!=
ptr
->
hwndSelf
)
goto
error
;
/*and increment destruction monitoring*/
ptr
->
irefCount
++
;
return
ptr
;
error:
/* Unlock all WND structures for thread safeness*/
USER_Unlock
();
SetLastError
(
ERROR_INVALID_WINDOW_HANDLE
);
SetLastError
(
ERROR_INVALID_WINDOW_HANDLE
);
return
NULL
;
return
NULL
;
}
}
...
@@ -2078,24 +2103,24 @@ BOOL16 WINAPI IsWindow16( HWND16 hwnd )
...
@@ -2078,24 +2103,24 @@ BOOL16 WINAPI IsWindow16( HWND16 hwnd )
BOOL
WINAPI
IsWindow
(
HWND
hwnd
)
BOOL
WINAPI
IsWindow
(
HWND
hwnd
)
{
{
WND
*
ptr
;
WND
*
ptr
;
BOOL
ret
=
FALSE
;
BOOL
ret
;
USER_Lock
();
USER_Lock
();
if
((
ptr
=
user_handles
[
LOWORD
(
hwnd
)]))
if
((
ptr
=
user_handles
[
LOWORD
(
hwnd
)]))
{
{
ret
=
((
ptr
->
dwMagic
==
WND_MAGIC
)
&&
(
!
HIWORD
(
hwnd
)
||
hwnd
==
ptr
->
hwndSelf
));
ret
=
((
ptr
->
dwMagic
==
WND_MAGIC
)
&&
(
!
HIWORD
(
hwnd
)
||
hwnd
==
ptr
->
hwndSelf
));
USER_Unlock
();
return
ret
;
}
}
USER_Unlock
();
USER_Unlock
();
if
(
!
ret
)
/* check other processes */
/* check other processes */
{
SERVER_START_REQ
(
get_window_info
)
SERVER_START_REQ
(
get_window_info
)
{
{
req
->
handle
=
hwnd
;
req
->
handle
=
hwnd
;
ret
=
!
SERVER_CALL_ERR
();
ret
=
!
SERVER_CALL_ERR
();
}
}
SERVER_END_REQ
;
SERVER_END_REQ
;
}
return
ret
;
return
ret
;
}
}
...
@@ -2601,9 +2626,8 @@ HWND WINAPI GetLastActivePopup( HWND hwnd )
...
@@ -2601,9 +2626,8 @@ HWND WINAPI GetLastActivePopup( HWND hwnd )
WND
*
wndPtr
=
WIN_FindWndPtr
(
hwnd
);
WND
*
wndPtr
=
WIN_FindWndPtr
(
hwnd
);
if
(
!
wndPtr
)
return
hwnd
;
if
(
!
wndPtr
)
return
hwnd
;
retval
=
wndPtr
->
hwndLastActive
;
retval
=
wndPtr
->
hwndLastActive
;
if
(
!
IsWindow
(
retval
))
retval
=
wndPtr
->
hwndSelf
;
WIN_ReleaseWndPtr
(
wndPtr
);
WIN_ReleaseWndPtr
(
wndPtr
);
if
((
retval
!=
hwnd
)
&&
(
!
IsWindow
(
retval
)))
retval
=
hwnd
;
return
retval
;
return
retval
;
}
}
...
...
windows/winpos.c
View file @
37a4639e
...
@@ -374,6 +374,7 @@ HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest )
...
@@ -374,6 +374,7 @@ HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest )
if
(
!
hwndScope
)
hwndScope
=
GetDesktopWindow
();
if
(
!
hwndScope
)
hwndScope
=
GetDesktopWindow
();
if
(
!
(
wndScope
=
WIN_FindWndPtr
(
hwndScope
)))
return
0
;
if
(
!
(
wndScope
=
WIN_FindWndPtr
(
hwndScope
)))
return
0
;
hwndScope
=
wndScope
->
hwndSelf
;
/* make it a full handle */
*
hittest
=
HTERROR
;
*
hittest
=
HTERROR
;
wndPtr
=
WIN_LockWndPtr
(
wndScope
->
child
);
wndPtr
=
WIN_LockWndPtr
(
wndScope
->
child
);
...
@@ -892,7 +893,7 @@ HWND16 WINAPI GetShellWindow16(void)
...
@@ -892,7 +893,7 @@ HWND16 WINAPI GetShellWindow16(void)
HWND
WINAPI
SetShellWindow
(
HWND
hwndshell
)
HWND
WINAPI
SetShellWindow
(
HWND
hwndshell
)
{
WARN
(
"(hWnd=%08x) semi stub
\n
"
,
hwndshell
);
{
WARN
(
"(hWnd=%08x) semi stub
\n
"
,
hwndshell
);
hGlobalShellWindow
=
hwndshell
;
hGlobalShellWindow
=
WIN_GetFullHandle
(
hwndshell
)
;
return
hGlobalShellWindow
;
return
hGlobalShellWindow
;
}
}
...
@@ -1423,6 +1424,9 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
...
@@ -1423,6 +1424,9 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
hwndActive
=
PERQDATA_GetActiveWnd
(
pOldActiveQueue
->
pQData
);
hwndActive
=
PERQDATA_GetActiveWnd
(
pOldActiveQueue
->
pQData
);
}
}
if
((
wndPtr
=
WIN_FindWndPtr
(
hWnd
)))
hWnd
=
wndPtr
->
hwndSelf
;
/* make it a full handle */
/* paranoid checks */
/* paranoid checks */
if
(
hWnd
==
GetDesktopWindow
()
||
(
bRet
=
(
hWnd
==
hwndActive
))
)
if
(
hWnd
==
GetDesktopWindow
()
||
(
bRet
=
(
hWnd
==
hwndActive
))
)
goto
CLEANUP_END
;
goto
CLEANUP_END
;
...
@@ -1430,7 +1434,6 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
...
@@ -1430,7 +1434,6 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
/* if (wndPtr && (GetFastQueue16() != wndPtr->hmemTaskQ))
/* if (wndPtr && (GetFastQueue16() != wndPtr->hmemTaskQ))
* return 0;
* return 0;
*/
*/
wndPtr
=
WIN_FindWndPtr
(
hWnd
);
hOldActiveQueue
=
hActiveQueue
;
hOldActiveQueue
=
hActiveQueue
;
if
(
(
wndTemp
=
WIN_FindWndPtr
(
hwndActive
))
)
if
(
(
wndTemp
=
WIN_FindWndPtr
(
hwndActive
))
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment