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
0aa1af21
Commit
0aa1af21
authored
Jun 05, 2015
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Disallow format 0 in SetClipboardData.
parent
614e52e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
clipboard.c
dlls/user32/clipboard.c
+6
-0
clipboard.c
dlls/user32/tests/clipboard.c
+20
-0
No files found.
dlls/user32/clipboard.c
View file @
0aa1af21
...
@@ -400,6 +400,12 @@ HANDLE WINAPI SetClipboardData(UINT wFormat, HANDLE hData)
...
@@ -400,6 +400,12 @@ HANDLE WINAPI SetClipboardData(UINT wFormat, HANDLE hData)
TRACE
(
"(%04X, %p) !
\n
"
,
wFormat
,
hData
);
TRACE
(
"(%04X, %p) !
\n
"
,
wFormat
,
hData
);
if
(
!
wFormat
)
{
SetLastError
(
ERROR_CLIPBOARD_NOT_OPEN
);
return
0
;
}
/* If it's not owned, data can only be set if the format isn't
/* If it's not owned, data can only be set if the format isn't
available and its rendering is not delayed */
available and its rendering is not delayed */
if
(
!
CLIPBOARD_GetClipboardInfo
(
&
cbinfo
)
||
if
(
!
CLIPBOARD_GetClipboardInfo
(
&
cbinfo
)
||
...
...
dlls/user32/tests/clipboard.c
View file @
0aa1af21
...
@@ -111,6 +111,7 @@ static void test_RegisterClipboardFormatA(void)
...
@@ -111,6 +111,7 @@ static void test_RegisterClipboardFormatA(void)
char
buf
[
256
];
char
buf
[
256
];
int
len
;
int
len
;
BOOL
ret
;
BOOL
ret
;
HANDLE
handle
;
format_id
=
RegisterClipboardFormatA
(
"my_cool_clipboard_format"
);
format_id
=
RegisterClipboardFormatA
(
"my_cool_clipboard_format"
);
ok
(
format_id
>
0xc000
&&
format_id
<
0xffff
,
"invalid clipboard format id %04x
\n
"
,
format_id
);
ok
(
format_id
>
0xc000
&&
format_id
<
0xffff
,
"invalid clipboard format id %04x
\n
"
,
format_id
);
...
@@ -165,6 +166,25 @@ todo_wine
...
@@ -165,6 +166,25 @@ todo_wine
ret
=
OpenClipboard
(
0
);
ret
=
OpenClipboard
(
0
);
ok
(
ret
,
"OpenClipboard error %d
\n
"
,
GetLastError
());
ok
(
ret
,
"OpenClipboard error %d
\n
"
,
GetLastError
());
/* try some invalid/unregistered formats */
SetLastError
(
0xdeadbeef
);
handle
=
SetClipboardData
(
0
,
GlobalAlloc
(
GMEM_DDESHARE
|
GMEM_MOVEABLE
,
1
));
ok
(
!
handle
,
"SetClipboardData succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CLIPBOARD_NOT_OPEN
,
"wrong error %u
\n
"
,
GetLastError
());
handle
=
SetClipboardData
(
0x1234
,
GlobalAlloc
(
GMEM_DDESHARE
|
GMEM_MOVEABLE
,
1
));
ok
(
handle
!=
0
,
"SetClipboardData failed err %d
\n
"
,
GetLastError
());
handle
=
SetClipboardData
(
0x123456
,
GlobalAlloc
(
GMEM_DDESHARE
|
GMEM_MOVEABLE
,
1
));
ok
(
handle
!=
0
,
"SetClipboardData failed err %d
\n
"
,
GetLastError
());
handle
=
SetClipboardData
(
0xffff8765
,
GlobalAlloc
(
GMEM_DDESHARE
|
GMEM_MOVEABLE
,
1
));
ok
(
handle
!=
0
,
"SetClipboardData failed err %d
\n
"
,
GetLastError
());
ok
(
IsClipboardFormatAvailable
(
0x1234
),
"format missing
\n
"
);
ok
(
IsClipboardFormatAvailable
(
0x123456
),
"format missing
\n
"
);
ok
(
IsClipboardFormatAvailable
(
0xffff8765
),
"format missing
\n
"
);
ok
(
!
IsClipboardFormatAvailable
(
0
),
"format available
\n
"
);
ok
(
!
IsClipboardFormatAvailable
(
0x3456
),
"format available
\n
"
);
ok
(
!
IsClipboardFormatAvailable
(
0x8765
),
"format available
\n
"
);
trace
(
"# of formats available: %d
\n
"
,
CountClipboardFormats
());
trace
(
"# of formats available: %d
\n
"
,
CountClipboardFormats
());
format_id
=
0
;
format_id
=
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