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
b391b8af
Commit
b391b8af
authored
Feb 05, 2008
by
Kirill K. Smirnov
Committed by
Alexandre Julliard
Feb 06, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
systray: Properly track errors.
parent
7df3ed5f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
24 deletions
+28
-24
systray.c
dlls/shell32/systray.c
+3
-2
systray.c
dlls/shell32/tests/systray.c
+2
-4
systray.c
programs/explorer/systray.c
+23
-18
No files found.
dlls/shell32/systray.c
View file @
b391b8af
...
...
@@ -104,6 +104,7 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid)
HWND
tray
;
COPYDATASTRUCT
cds
;
char
*
buffer
=
NULL
;
BOOL
ret
;
TRACE
(
"dwMessage = %d, nid->cbSize=%d
\n
"
,
dwMessage
,
nid
->
cbSize
);
...
...
@@ -185,11 +186,11 @@ noicon:
cds
.
lpData
=
nid
;
}
SendMessageW
(
tray
,
WM_COPYDATA
,
(
WPARAM
)
nid
->
hWnd
,
(
LPARAM
)
&
cds
);
ret
=
SendMessageW
(
tray
,
WM_COPYDATA
,
(
WPARAM
)
nid
->
hWnd
,
(
LPARAM
)
&
cds
);
/* FIXME: if statement only needed because we don't support interprocess
* icon handles */
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
TRUE
;
return
ret
;
}
dlls/shell32/tests/systray.c
View file @
b391b8af
...
...
@@ -52,8 +52,7 @@ void test_cbsize(void)
ok
(
pShell_NotifyIconW
(
NIM_DELETE
,
&
nidW
),
"NIM_DELETE failed!
\n
"
);
/* as icon doesn't exist anymore - now there will be an error */
nidW
.
cbSize
=
sizeof
(
nidW
);
/* wine currently doesn't return error code put prints an ERR(...) */
todo_wine
ok
(
!
pShell_NotifyIconW
(
NIM_DELETE
,
&
nidW
),
"The icon was not deleted
\n
"
);
ok
(
!
pShell_NotifyIconW
(
NIM_DELETE
,
&
nidW
),
"The icon was not deleted
\n
"
);
}
/* same for Shell_NotifyIconA */
...
...
@@ -73,8 +72,7 @@ void test_cbsize(void)
ok
(
Shell_NotifyIconA
(
NIM_DELETE
,
&
nidA
),
"NIM_DELETE failed!
\n
"
);
/* as icon doesn't exist anymore - now there will be an error */
nidA
.
cbSize
=
sizeof
(
nidA
);
/* wine currently doesn't return error code put prints an ERR(...) */
todo_wine
ok
(
!
Shell_NotifyIconA
(
NIM_DELETE
,
&
nidA
),
"The icon was not deleted
\n
"
);
ok
(
!
Shell_NotifyIconA
(
NIM_DELETE
,
&
nidA
),
"The icon was not deleted
\n
"
);
}
START_TEST
(
systray
)
...
...
programs/explorer/systray.c
View file @
b391b8af
...
...
@@ -182,7 +182,7 @@ static void set_tooltip(struct icon *icon, WCHAR *szTip, BOOL modify)
SendMessageW
(
icon
->
tooltip
,
TTM_ADDTOOLW
,
0
,
(
LPARAM
)
&
ti
);
}
static
void
modify_icon
(
NOTIFYICONDATAW
*
nid
,
BOOL
modify_tooltip
)
static
BOOL
modify_icon
(
NOTIFYICONDATAW
*
nid
,
BOOL
modify_tooltip
)
{
struct
icon
*
icon
;
...
...
@@ -193,7 +193,7 @@ static void modify_icon(NOTIFYICONDATAW *nid, BOOL modify_tooltip)
if
(
!
icon
)
{
WINE_WARN
(
"Invalid icon ID (0x%x) for HWND %p
\n
"
,
nid
->
uID
,
nid
->
hWnd
);
return
;
return
FALSE
;
}
if
(
nid
->
uFlags
&
NIF_ICON
)
...
...
@@ -216,9 +216,10 @@ static void modify_icon(NOTIFYICONDATAW *nid, BOOL modify_tooltip)
{
WINE_FIXME
(
"balloon tip title %s, message %s
\n
"
,
wine_dbgstr_w
(
nid
->
szInfoTitle
),
wine_dbgstr_w
(
nid
->
szInfo
));
}
return
TRUE
;
}
static
void
add_icon
(
NOTIFYICONDATAW
*
nid
)
static
BOOL
add_icon
(
NOTIFYICONDATAW
*
nid
)
{
HMODULE
x11drv
=
GetModuleHandleA
(
"winex11.drv"
);
RECT
rect
;
...
...
@@ -231,13 +232,13 @@ static void add_icon(NOTIFYICONDATAW *nid)
if
((
icon
=
get_icon
(
nid
->
hWnd
,
nid
->
uID
)))
{
WINE_WARN
(
"duplicate tray icon add, buggy app?
\n
"
);
return
;
return
FALSE
;
}
if
(
!
(
icon
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
icon
))))
{
WINE_ERR
(
"out of memory
\n
"
);
return
;
return
FALSE
;
}
icon
->
id
=
nid
->
uID
;
...
...
@@ -289,10 +290,10 @@ static void add_icon(NOTIFYICONDATAW *nid)
list_add_tail
(
&
tray
.
icons
,
&
icon
->
entry
);
modify_icon
(
nid
,
FALSE
);
return
modify_icon
(
nid
,
FALSE
);
}
static
void
delete_icon
(
const
NOTIFYICONDATAW
*
nid
)
static
BOOL
delete_icon
(
const
NOTIFYICONDATAW
*
nid
)
{
struct
icon
*
icon
=
get_icon
(
nid
->
hWnd
,
nid
->
uID
);
...
...
@@ -300,22 +301,24 @@ static void delete_icon(const NOTIFYICONDATAW *nid)
if
(
!
icon
)
{
WINE_
ERR
(
"invalid tray icon ID specified: %u
\n
"
,
nid
->
uID
);
return
;
WINE_
WARN
(
"invalid tray icon ID specified: %u
\n
"
,
nid
->
uID
);
return
FALSE
;
}
DestroyWindow
(
icon
->
tooltip
);
DestroyWindow
(
icon
->
window
);
return
TRUE
;
}
static
void
handle_incoming
(
HWND
hwndSource
,
COPYDATASTRUCT
*
cds
)
static
BOOL
handle_incoming
(
HWND
hwndSource
,
COPYDATASTRUCT
*
cds
)
{
NOTIFYICONDATAW
nid
;
DWORD
cbSize
;
BOOL
ret
=
FALSE
;
if
(
cds
->
cbData
<
NOTIFYICONDATAW_V1_SIZE
)
return
;
if
(
cds
->
cbData
<
NOTIFYICONDATAW_V1_SIZE
)
return
FALSE
;
cbSize
=
((
PNOTIFYICONDATA
)
cds
->
lpData
)
->
cbSize
;
if
(
cbSize
<
NOTIFYICONDATAW_V1_SIZE
)
return
;
if
(
cbSize
<
NOTIFYICONDATAW_V1_SIZE
)
return
FALSE
;
ZeroMemory
(
&
nid
,
sizeof
(
nid
));
memcpy
(
&
nid
,
cds
->
lpData
,
min
(
sizeof
(
nid
),
cbSize
));
...
...
@@ -343,14 +346,14 @@ static void handle_incoming(HWND hwndSource, COPYDATASTRUCT *cds)
if
(
cds
->
cbData
<
nid
.
cbSize
+
2
*
sizeof
(
BITMAP
)
+
cbMaskBits
+
cbColourBits
)
{
WINE_ERR
(
"buffer underflow
\n
"
);
return
;
return
FALSE
;
}
/* sanity check */
if
((
bmColour
.
bmWidth
!=
bmMask
.
bmWidth
)
||
(
bmColour
.
bmHeight
!=
bmMask
.
bmHeight
))
{
WINE_ERR
(
"colour and mask bitmaps aren't consistent
\n
"
);
return
;
return
FALSE
;
}
nid
.
hIcon
=
CreateIcon
(
NULL
,
bmColour
.
bmWidth
,
bmColour
.
bmHeight
,
...
...
@@ -361,13 +364,13 @@ static void handle_incoming(HWND hwndSource, COPYDATASTRUCT *cds)
switch
(
cds
->
dwData
)
{
case
NIM_ADD
:
add_icon
(
&
nid
);
ret
=
add_icon
(
&
nid
);
break
;
case
NIM_DELETE
:
delete_icon
(
&
nid
);
ret
=
delete_icon
(
&
nid
);
break
;
case
NIM_MODIFY
:
modify_icon
(
&
nid
,
TRUE
);
ret
=
modify_icon
(
&
nid
,
TRUE
);
break
;
default:
WINE_FIXME
(
"unhandled tray message: %ld
\n
"
,
cds
->
dwData
);
...
...
@@ -378,13 +381,15 @@ static void handle_incoming(HWND hwndSource, COPYDATASTRUCT *cds)
* icon handles */
if
(
nid
.
uFlags
&
NIF_ICON
)
DestroyIcon
(
nid
.
hIcon
);
return
ret
;
}
static
LRESULT
WINAPI
listener_wndproc
(
HWND
window
,
UINT
msg
,
WPARAM
wparam
,
LPARAM
lparam
)
{
if
(
msg
==
WM_COPYDATA
)
handle_incoming
((
HWND
)
wparam
,
(
COPYDATASTRUCT
*
)
lparam
);
return
handle_incoming
((
HWND
)
wparam
,
(
COPYDATASTRUCT
*
)
lparam
);
return
DefWindowProc
(
window
,
msg
,
wparam
,
lparam
);
}
...
...
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