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
a7188842
Commit
a7188842
authored
Sep 21, 2010
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Sep 21, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: UpdateLayeredWindow() should fail on non-layered or already initialized window.
parent
17ee7300
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
win.c
dlls/user32/tests/win.c
+35
-1
win.c
dlls/user32/win.c
+7
-0
No files found.
dlls/user32/tests/win.c
View file @
a7188842
...
...
@@ -49,6 +49,7 @@ static BOOL (WINAPI *pGetWindowInfo)(HWND,WINDOWINFO*);
static
UINT
(
WINAPI
*
pGetWindowModuleFileNameA
)(
HWND
,
LPSTR
,
UINT
);
static
BOOL
(
WINAPI
*
pGetLayeredWindowAttributes
)(
HWND
,
COLORREF
*
,
BYTE
*
,
DWORD
*
);
static
BOOL
(
WINAPI
*
pSetLayeredWindowAttributes
)(
HWND
,
COLORREF
,
BYTE
,
DWORD
);
static
BOOL
(
WINAPI
*
pUpdateLayeredWindow
)(
HWND
,
HDC
,
POINT
*
,
SIZE
*
,
HDC
,
POINT
*
,
COLORREF
,
BLENDFUNCTION
*
,
DWORD
);
static
BOOL
(
WINAPI
*
pGetMonitorInfoA
)(
HMONITOR
,
LPMONITORINFO
);
static
HMONITOR
(
WINAPI
*
pMonitorFromPoint
)(
POINT
,
DWORD
);
static
int
(
WINAPI
*
pGetWindowRgnBox
)(
HWND
,
LPRECT
);
...
...
@@ -5568,16 +5569,29 @@ static void test_layered_window(void)
COLORREF
key
=
0
;
BYTE
alpha
=
0
;
DWORD
flags
=
0
;
POINT
pt
=
{
0
,
0
};
SIZE
sz
=
{
200
,
200
};
HDC
hdc
;
HBITMAP
hbm
;
BOOL
ret
;
if
(
!
pGetLayeredWindowAttributes
||
!
pSetLayeredWindowAttributes
)
if
(
!
pGetLayeredWindowAttributes
||
!
pSetLayeredWindowAttributes
||
!
pUpdateLayeredWindow
)
{
win_skip
(
"layered windows not supported
\n
"
);
return
;
}
hdc
=
CreateCompatibleDC
(
0
);
hbm
=
CreateCompatibleBitmap
(
hdc
,
200
,
200
);
SelectObject
(
hdc
,
hbm
);
hwnd
=
CreateWindowExA
(
0
,
"MainWindowClass"
,
"message window"
,
WS_CAPTION
,
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
assert
(
hwnd
);
SetLastError
(
0xdeadbeef
);
ret
=
pUpdateLayeredWindow
(
hwnd
,
0
,
NULL
,
&
sz
,
hdc
,
&
pt
,
0
,
NULL
,
ULW_OPAQUE
);
ok
(
!
ret
,
"UpdateLayeredWindow should fail on non-layered window
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
()
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
!
ret
,
"GetLayeredWindowAttributes should fail on non-layered window
\n
"
);
ret
=
pSetLayeredWindowAttributes
(
hwnd
,
0
,
0
,
LWA_ALPHA
);
...
...
@@ -5585,6 +5599,10 @@ static void test_layered_window(void)
SetWindowLong
(
hwnd
,
GWL_EXSTYLE
,
GetWindowLong
(
hwnd
,
GWL_EXSTYLE
)
|
WS_EX_LAYERED
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
!
ret
,
"GetLayeredWindowAttributes should fail on layered but not initialized window
\n
"
);
ret
=
pUpdateLayeredWindow
(
hwnd
,
0
,
NULL
,
&
sz
,
hdc
,
&
pt
,
0
,
NULL
,
ULW_OPAQUE
);
ok
(
ret
,
"UpdateLayeredWindow should succeed on layered window
\n
"
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
!
ret
,
"GetLayeredWindowAttributes should fail on layered but not initialized window
\n
"
);
ret
=
pSetLayeredWindowAttributes
(
hwnd
,
0x123456
,
44
,
LWA_ALPHA
);
ok
(
ret
,
"SetLayeredWindowAttributes should succeed on layered window
\n
"
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
...
...
@@ -5592,14 +5610,23 @@ static void test_layered_window(void)
ok
(
key
==
0x123456
||
key
==
0
,
"wrong color key %x
\n
"
,
key
);
ok
(
alpha
==
44
,
"wrong alpha %u
\n
"
,
alpha
);
ok
(
flags
==
LWA_ALPHA
,
"wrong flags %x
\n
"
,
flags
);
SetLastError
(
0xdeadbeef
);
ret
=
pUpdateLayeredWindow
(
hwnd
,
0
,
NULL
,
&
sz
,
hdc
,
&
pt
,
0
,
NULL
,
ULW_OPAQUE
);
ok
(
!
ret
,
"UpdateLayeredWindow should fail on layered but initialized window
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
()
);
/* clearing WS_EX_LAYERED resets attributes */
SetWindowLong
(
hwnd
,
GWL_EXSTYLE
,
GetWindowLong
(
hwnd
,
GWL_EXSTYLE
)
&
~
WS_EX_LAYERED
);
SetLastError
(
0xdeadbeef
);
ret
=
pUpdateLayeredWindow
(
hwnd
,
0
,
NULL
,
&
sz
,
hdc
,
&
pt
,
0
,
NULL
,
ULW_OPAQUE
);
ok
(
!
ret
,
"UpdateLayeredWindow should fail on non-layered window
\n
"
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
!
ret
,
"GetLayeredWindowAttributes should fail on no longer layered window
\n
"
);
SetWindowLong
(
hwnd
,
GWL_EXSTYLE
,
GetWindowLong
(
hwnd
,
GWL_EXSTYLE
)
|
WS_EX_LAYERED
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
ok
(
!
ret
,
"GetLayeredWindowAttributes should fail on layered but not initialized window
\n
"
);
ret
=
pUpdateLayeredWindow
(
hwnd
,
0
,
NULL
,
&
sz
,
hdc
,
&
pt
,
0
,
NULL
,
ULW_OPAQUE
);
ok
(
ret
,
"UpdateLayeredWindow should succeed on layered window
\n
"
);
ret
=
pSetLayeredWindowAttributes
(
hwnd
,
0x654321
,
22
,
LWA_COLORKEY
|
LWA_ALPHA
);
ok
(
ret
,
"SetLayeredWindowAttributes should succeed on layered window
\n
"
);
ret
=
pGetLayeredWindowAttributes
(
hwnd
,
&
key
,
&
alpha
,
&
flags
);
...
...
@@ -5607,6 +5634,10 @@ static void test_layered_window(void)
ok
(
key
==
0x654321
,
"wrong color key %x
\n
"
,
key
);
ok
(
alpha
==
22
,
"wrong alpha %u
\n
"
,
alpha
);
ok
(
flags
==
(
LWA_COLORKEY
|
LWA_ALPHA
),
"wrong flags %x
\n
"
,
flags
);
SetLastError
(
0xdeadbeef
);
ret
=
pUpdateLayeredWindow
(
hwnd
,
0
,
NULL
,
&
sz
,
hdc
,
&
pt
,
0
,
NULL
,
ULW_OPAQUE
);
ok
(
!
ret
,
"UpdateLayeredWindow should fail on layered but initialized window
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
GetLastError
()
);
ret
=
pSetLayeredWindowAttributes
(
hwnd
,
0x888888
,
33
,
LWA_COLORKEY
);
ok
(
ret
,
"SetLayeredWindowAttributes should succeed on layered window
\n
"
);
...
...
@@ -5640,6 +5671,8 @@ static void test_layered_window(void)
ok
(
flags
==
0
,
"wrong flags %x
\n
"
,
flags
);
DestroyWindow
(
hwnd
);
DeleteDC
(
hdc
);
DeleteObject
(
hbm
);
}
static
MONITORINFO
mi
;
...
...
@@ -6140,6 +6173,7 @@ START_TEST(win)
pGetWindowModuleFileNameA
=
(
void
*
)
GetProcAddress
(
user32
,
"GetWindowModuleFileNameA"
);
pGetLayeredWindowAttributes
=
(
void
*
)
GetProcAddress
(
user32
,
"GetLayeredWindowAttributes"
);
pSetLayeredWindowAttributes
=
(
void
*
)
GetProcAddress
(
user32
,
"SetLayeredWindowAttributes"
);
pUpdateLayeredWindow
=
(
void
*
)
GetProcAddress
(
user32
,
"UpdateLayeredWindow"
);
pGetMonitorInfoA
=
(
void
*
)
GetProcAddress
(
user32
,
"GetMonitorInfoA"
);
pMonitorFromPoint
=
(
void
*
)
GetProcAddress
(
user32
,
"MonitorFromPoint"
);
pGetWindowRgnBox
=
(
void
*
)
GetProcAddress
(
user32
,
"GetWindowRgnBox"
);
...
...
dlls/user32/win.c
View file @
a7188842
...
...
@@ -3434,6 +3434,13 @@ BOOL WINAPI UpdateLayeredWindowIndirect( HWND hwnd, const UPDATELAYEREDWINDOWINF
{
BYTE
alpha
=
0xff
;
if
(
!
(
GetWindowLongW
(
hwnd
,
GWL_EXSTYLE
)
&
WS_EX_LAYERED
)
||
GetLayeredWindowAttributes
(
hwnd
,
NULL
,
NULL
,
NULL
))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
!
(
info
->
dwFlags
&
ULW_EX_NORESIZE
)
&&
(
info
->
pptDst
||
info
->
psize
))
{
int
x
=
0
,
y
=
0
,
cx
=
0
,
cy
=
0
;
...
...
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