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
c331a1a6
Commit
c331a1a6
authored
Sep 07, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Don't allow CreateCompatibleDC on a metafile DC.
parent
cef1832b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
7 deletions
+48
-7
init.c
dlls/gdi32/mfdrv/init.c
+12
-1
dc.c
dlls/gdi32/tests/dc.c
+36
-6
No files found.
dlls/gdi32/mfdrv/init.c
View file @
c331a1a6
...
...
@@ -30,6 +30,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
metafile
);
static
BOOL
MFDRV_CreateCompatibleDC
(
PHYSDEV
orig
,
PHYSDEV
*
pdev
);
static
BOOL
MFDRV_DeleteDC
(
PHYSDEV
dev
);
...
...
@@ -91,7 +92,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_Chord
,
/* pChord */
MFDRV_CloseFigure
,
/* pCloseFigure */
NULL
,
/* pCreateBitmap */
NULL
,
/* pCreateCompatibleDC */
MFDRV_CreateCompatibleDC
,
/* pCreateCompatibleDC */
NULL
,
/* pCreateDC */
NULL
,
/* pCreateDIBSection */
NULL
,
/* pDeleteBitmap */
...
...
@@ -247,6 +248,16 @@ static DC *MFDRV_AllocMetaFile(void)
/**********************************************************************
* MFDRV_CreateCompatibleDC
*/
static
BOOL
MFDRV_CreateCompatibleDC
(
PHYSDEV
orig
,
PHYSDEV
*
pdev
)
{
/* not supported on metafile DCs */
return
FALSE
;
}
/**********************************************************************
* MFDRV_DeleteDC
*/
static
BOOL
MFDRV_DeleteDC
(
PHYSDEV
dev
)
...
...
dlls/gdi32/tests/dc.c
View file @
c331a1a6
...
...
@@ -265,20 +265,50 @@ static void test_GdiConvertToDevmodeW(void)
static
void
test_CreateCompatibleDC
(
void
)
{
BOOL
bRet
;
HDC
hDC
;
HDC
hNewDC
;
HDC
hdc
,
hNewDC
,
hdcMetafile
;
HBITMAP
bitmap
;
INT
caps
;
bitmap
=
CreateBitmap
(
10
,
10
,
1
,
1
,
NULL
);
/* Create a DC compatible with the screen */
hDC
=
CreateCompatibleDC
(
NULL
);
ok
(
hDC
!=
NULL
,
"CreateCompatibleDC returned %p
\n
"
,
hDC
);
hdc
=
CreateCompatibleDC
(
NULL
);
ok
(
hdc
!=
NULL
,
"CreateCompatibleDC returned %p
\n
"
,
hdc
);
ok
(
SelectObject
(
hdc
,
bitmap
)
!=
0
,
"SelectObject failed
\n
"
);
caps
=
GetDeviceCaps
(
hdc
,
TECHNOLOGY
);
ok
(
caps
==
DT_RASDISPLAY
,
"wrong caps %u
\n
"
,
caps
);
/* Delete this DC, this should succeed */
bRet
=
DeleteDC
(
h
DC
);
bRet
=
DeleteDC
(
h
dc
);
ok
(
bRet
==
TRUE
,
"DeleteDC returned %u
\n
"
,
bRet
);
/* Try to create a DC compatible to the deleted DC. This has to fail */
hNewDC
=
CreateCompatibleDC
(
h
DC
);
hNewDC
=
CreateCompatibleDC
(
h
dc
);
ok
(
hNewDC
==
NULL
,
"CreateCompatibleDC returned %p
\n
"
,
hNewDC
);
hdc
=
GetDC
(
0
);
hdcMetafile
=
CreateEnhMetaFileA
(
hdc
,
NULL
,
NULL
,
NULL
);
ok
(
hdcMetafile
!=
0
,
"CreateEnhMetaFileA failed
\n
"
);
hNewDC
=
CreateCompatibleDC
(
hdcMetafile
);
ok
(
hNewDC
!=
NULL
,
"CreateCompatibleDC failed
\n
"
);
ok
(
SelectObject
(
hNewDC
,
bitmap
)
!=
0
,
"SelectObject failed
\n
"
);
caps
=
GetDeviceCaps
(
hdcMetafile
,
TECHNOLOGY
);
ok
(
caps
==
DT_RASDISPLAY
,
"wrong caps %u
\n
"
,
caps
);
caps
=
GetDeviceCaps
(
hNewDC
,
TECHNOLOGY
);
ok
(
caps
==
DT_RASDISPLAY
,
"wrong caps %u
\n
"
,
caps
);
DeleteDC
(
hNewDC
);
DeleteEnhMetaFile
(
CloseEnhMetaFile
(
hdcMetafile
));
ReleaseDC
(
0
,
hdc
);
hdcMetafile
=
CreateMetaFileA
(
NULL
);
ok
(
hdcMetafile
!=
0
,
"CreateEnhMetaFileA failed
\n
"
);
hNewDC
=
CreateCompatibleDC
(
hdcMetafile
);
ok
(
hNewDC
==
NULL
,
"CreateCompatibleDC succeeded
\n
"
);
caps
=
GetDeviceCaps
(
hdcMetafile
,
TECHNOLOGY
);
ok
(
caps
==
DT_METAFILE
,
"wrong caps %u
\n
"
,
caps
);
DeleteMetaFile
(
CloseMetaFile
(
hdcMetafile
));
DeleteObject
(
bitmap
);
}
static
void
test_DC_bitmap
(
void
)
...
...
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