Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
c331a1a6
Commit
c331a1a6
authored
13 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
gdi32: Don't allow CreateCompatibleDC on a metafile DC.
parent
cef1832b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/gdi32/mfdrv/init.c
+12
-1
12 additions, 1 deletion
dlls/gdi32/mfdrv/init.c
dlls/gdi32/tests/dc.c
+36
-6
36 additions, 6 deletions
dlls/gdi32/tests/dc.c
with
48 additions
and
7 deletions
dlls/gdi32/mfdrv/init.c
+
12
−
1
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 */
...
...
@@ -246,6 +247,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
*/
...
...
This diff is collapsed.
Click to expand it.
dlls/gdi32/tests/dc.c
+
36
−
6
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment