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
9e351472
Commit
9e351472
authored
Dec 21, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Always set last error in Shell_NotifyIconW.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53101
parent
1cd47755
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
systray.c
dlls/shell32/systray.c
+7
-1
systray.c
dlls/shell32/tests/systray.c
+12
-0
No files found.
dlls/shell32/systray.c
View file @
9e351472
...
@@ -148,7 +148,11 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid)
...
@@ -148,7 +148,11 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid)
}
}
tray
=
FindWindowExW
(
0
,
NULL
,
L"Shell_TrayWnd"
,
NULL
);
tray
=
FindWindowExW
(
0
,
NULL
,
L"Shell_TrayWnd"
,
NULL
);
if
(
!
tray
)
return
FALSE
;
if
(
!
tray
)
{
SetLastError
(
E_FAIL
);
return
FALSE
;
}
cds
.
dwData
=
dwMessage
;
cds
.
dwData
=
dwMessage
;
cds
.
cbData
=
sizeof
(
*
data
);
cds
.
cbData
=
sizeof
(
*
data
);
...
@@ -185,6 +189,7 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid)
...
@@ -185,6 +189,7 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid)
{
{
DeleteObject
(
iconinfo
.
hbmMask
);
DeleteObject
(
iconinfo
.
hbmMask
);
if
(
iconinfo
.
hbmColor
)
DeleteObject
(
iconinfo
.
hbmColor
);
if
(
iconinfo
.
hbmColor
)
DeleteObject
(
iconinfo
.
hbmColor
);
SetLastError
(
E_OUTOFMEMORY
);
return
FALSE
;
return
FALSE
;
}
}
...
@@ -241,6 +246,7 @@ noicon:
...
@@ -241,6 +246,7 @@ noicon:
cds
.
lpData
=
data
;
cds
.
lpData
=
data
;
ret
=
SendMessageW
(
tray
,
WM_COPYDATA
,
(
WPARAM
)
nid
->
hWnd
,
(
LPARAM
)
&
cds
);
ret
=
SendMessageW
(
tray
,
WM_COPYDATA
,
(
WPARAM
)
nid
->
hWnd
,
(
LPARAM
)
&
cds
);
if
(
data
!=
&
data_buffer
)
heap_free
(
data
);
if
(
data
!=
&
data_buffer
)
heap_free
(
data
);
SetLastError
(
ret
?
S_OK
:
E_FAIL
);
return
ret
;
return
ret
;
}
}
...
...
dlls/shell32/tests/systray.c
View file @
9e351472
...
@@ -44,8 +44,11 @@ static void test_cbsize(void)
...
@@ -44,8 +44,11 @@ static void test_cbsize(void)
nidW
.
uFlags
=
NIF_ICON
|
NIF_MESSAGE
;
nidW
.
uFlags
=
NIF_ICON
|
NIF_MESSAGE
;
nidW
.
hIcon
=
LoadIconA
(
NULL
,
(
LPSTR
)
IDI_APPLICATION
);
nidW
.
hIcon
=
LoadIconA
(
NULL
,
(
LPSTR
)
IDI_APPLICATION
);
nidW
.
uCallbackMessage
=
WM_USER
+
17
;
nidW
.
uCallbackMessage
=
WM_USER
+
17
;
SetLastError
(
0xdeadbeef
);
ret
=
pShell_NotifyIconW
(
NIM_ADD
,
&
nidW
);
ret
=
pShell_NotifyIconW
(
NIM_ADD
,
&
nidW
);
ok
(
ret
,
"NIM_ADD failed!
\n
"
);
ok
(
ret
,
"NIM_ADD failed!
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
||
GetLastError
()
==
ERROR_NO_TOKEN
,
"GetLastError() = %lu
\n
"
,
GetLastError
());
/* using an invalid cbSize does work */
/* using an invalid cbSize does work */
nidW
.
cbSize
=
3
;
nidW
.
cbSize
=
3
;
nidW
.
hWnd
=
hMainWnd
;
nidW
.
hWnd
=
hMainWnd
;
...
@@ -54,7 +57,10 @@ static void test_cbsize(void)
...
@@ -54,7 +57,10 @@ static void test_cbsize(void)
ok
(
ret
||
broken
(
!
ret
),
/* nt4 */
"NIM_DELETE failed!
\n
"
);
ok
(
ret
||
broken
(
!
ret
),
/* nt4 */
"NIM_DELETE failed!
\n
"
);
/* as icon doesn't exist anymore - now there will be an error */
/* as icon doesn't exist anymore - now there will be an error */
nidW
.
cbSize
=
sizeof
(
nidW
);
nidW
.
cbSize
=
sizeof
(
nidW
);
SetLastError
(
0xdeadbeef
);
ok
(
!
pShell_NotifyIconW
(
NIM_DELETE
,
&
nidW
)
!=
!
ret
,
"The icon was not deleted
\n
"
);
ok
(
!
pShell_NotifyIconW
(
NIM_DELETE
,
&
nidW
)
!=
!
ret
,
"The icon was not deleted
\n
"
);
ok
(
GetLastError
()
==
E_FAIL
||
GetLastError
()
==
ERROR_TIMEOUT
,
"GetLastError() = %lu
\n
"
,
GetLastError
());
}
}
/* same for Shell_NotifyIconA */
/* same for Shell_NotifyIconA */
...
@@ -65,7 +71,10 @@ static void test_cbsize(void)
...
@@ -65,7 +71,10 @@ static void test_cbsize(void)
nidA
.
uFlags
=
NIF_ICON
|
NIF_MESSAGE
;
nidA
.
uFlags
=
NIF_ICON
|
NIF_MESSAGE
;
nidA
.
hIcon
=
LoadIconA
(
NULL
,
(
LPSTR
)
IDI_APPLICATION
);
nidA
.
hIcon
=
LoadIconA
(
NULL
,
(
LPSTR
)
IDI_APPLICATION
);
nidA
.
uCallbackMessage
=
WM_USER
+
17
;
nidA
.
uCallbackMessage
=
WM_USER
+
17
;
SetLastError
(
0xdeadbeef
);
ok
(
Shell_NotifyIconA
(
NIM_ADD
,
&
nidA
),
"NIM_ADD failed!
\n
"
);
ok
(
Shell_NotifyIconA
(
NIM_ADD
,
&
nidA
),
"NIM_ADD failed!
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
||
GetLastError
()
==
ERROR_NO_TOKEN
,
"GetLastError() = %lu
\n
"
,
GetLastError
());
/* using an invalid cbSize does work */
/* using an invalid cbSize does work */
nidA
.
cbSize
=
3
;
nidA
.
cbSize
=
3
;
...
@@ -75,7 +84,10 @@ static void test_cbsize(void)
...
@@ -75,7 +84,10 @@ static void test_cbsize(void)
ok
(
ret
,
"NIM_DELETE failed!
\n
"
);
ok
(
ret
,
"NIM_DELETE failed!
\n
"
);
/* as icon doesn't exist anymore - now there will be an error */
/* as icon doesn't exist anymore - now there will be an error */
nidA
.
cbSize
=
sizeof
(
nidA
);
nidA
.
cbSize
=
sizeof
(
nidA
);
SetLastError
(
0xdeadbeef
);
ok
(
!
Shell_NotifyIconA
(
NIM_DELETE
,
&
nidA
)
!=
!
ret
,
"The icon was not deleted
\n
"
);
ok
(
!
Shell_NotifyIconA
(
NIM_DELETE
,
&
nidA
)
!=
!
ret
,
"The icon was not deleted
\n
"
);
ok
(
GetLastError
()
==
E_FAIL
||
GetLastError
()
==
ERROR_TIMEOUT
,
"GetLastError() = %lu
\n
"
,
GetLastError
());
}
}
START_TEST
(
systray
)
START_TEST
(
systray
)
...
...
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