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
beb2dfec
Commit
beb2dfec
authored
Dec 18, 2007
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Dec 18, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add a GdiConvertToDevmodeW test, make it pass under Wine.
parent
2f83e460
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
5 deletions
+59
-5
driver.c
dlls/gdi32/driver.c
+9
-5
dc.c
dlls/gdi32/tests/dc.c
+50
-0
No files found.
dlls/gdi32/driver.c
View file @
beb2dfec
...
...
@@ -413,8 +413,12 @@ DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *dmA)
DEVMODEW
*
dmW
;
WORD
dmW_size
;
dmW_size
=
dmA
->
dmSize
+
CCHDEVICENAME
;
if
(
dmA
->
dmSize
>=
(
const
char
*
)
dmA
->
dmFormName
-
(
const
char
*
)
dmA
+
CCHFORMNAME
)
dmW_size
=
dmA
->
dmSize
;
if
(
dmW_size
>
sizeof
(
DEVMODEA
))
dmW_size
=
sizeof
(
DEVMODEA
);
dmW_size
+=
CCHDEVICENAME
;
if
(
dmA
->
dmSize
>=
FIELD_OFFSET
(
DEVMODEA
,
dmFormName
)
+
CCHFORMNAME
)
dmW_size
+=
CCHFORMNAME
;
dmW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dmW_size
+
dmA
->
dmDriverExtra
);
...
...
@@ -425,12 +429,12 @@ DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *dmA)
/* copy slightly more, to avoid long computations */
memcpy
(
&
dmW
->
dmSpecVersion
,
&
dmA
->
dmSpecVersion
,
dmA
->
dmSize
-
CCHDEVICENAME
);
if
(
dmA
->
dmSize
>=
(
const
char
*
)
dmA
->
dmFormName
-
(
const
char
*
)
dmA
+
CCHFORMNAME
)
if
(
dmA
->
dmSize
>=
FIELD_OFFSET
(
DEVMODEA
,
dmFormName
)
+
CCHFORMNAME
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
(
const
char
*
)
dmA
->
dmFormName
,
CCHFORMNAME
,
dmW
->
dmFormName
,
CCHFORMNAME
);
if
(
dmA
->
dmSize
>
(
const
char
*
)
&
dmA
->
dmLogPixels
-
(
const
char
*
)
dmA
)
memcpy
(
&
dmW
->
dmLogPixels
,
&
dmA
->
dmLogPixels
,
dmA
->
dmSize
-
((
const
char
*
)
&
dmA
->
dmLogPixels
-
(
const
char
*
)
dmA
));
if
(
dmA
->
dmSize
>
FIELD_OFFSET
(
DEVMODEA
,
dmLogPixels
)
)
memcpy
(
&
dmW
->
dmLogPixels
,
&
dmA
->
dmLogPixels
,
dmA
->
dmSize
-
FIELD_OFFSET
(
DEVMODEA
,
dmLogPixels
));
}
if
(
dmA
->
dmDriverExtra
)
...
...
dlls/gdi32/tests/dc.c
View file @
beb2dfec
...
...
@@ -173,8 +173,58 @@ static void test_savedc(void)
DeleteDC
(
hdc
);
}
static
void
test_GdiConvertToDevmodeW
(
void
)
{
DEVMODEW
*
(
WINAPI
*
pGdiConvertToDevmodeW
)(
const
DEVMODEA
*
);
DEVMODEA
dmA
;
DEVMODEW
*
dmW
;
BOOL
ret
;
pGdiConvertToDevmodeW
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"gdi32.dll"
),
"GdiConvertToDevmodeW"
);
if
(
!
pGdiConvertToDevmodeW
)
{
skip
(
"GdiConvertToDevmodeW is not available on this platform
\n
"
);
return
;
}
ret
=
EnumDisplaySettingsA
(
NULL
,
ENUM_CURRENT_SETTINGS
,
&
dmA
);
ok
(
ret
,
"EnumDisplaySettingsExA error %u
\n
"
,
GetLastError
());
ok
(
dmA
.
dmSize
>=
FIELD_OFFSET
(
DEVMODEA
,
dmICMMethod
),
"dmSize is too small: %04x
\n
"
,
dmA
.
dmSize
);
ok
(
dmA
.
dmSize
<=
sizeof
(
DEVMODEA
),
"dmSize is too large: %04x
\n
"
,
dmA
.
dmSize
);
dmW
=
pGdiConvertToDevmodeW
(
&
dmA
);
ok
(
dmW
->
dmSize
>=
FIELD_OFFSET
(
DEVMODEW
,
dmICMMethod
),
"dmSize is too small: %04x
\n
"
,
dmW
->
dmSize
);
ok
(
dmW
->
dmSize
<=
sizeof
(
DEVMODEW
),
"dmSize is too large: %04x
\n
"
,
dmW
->
dmSize
);
HeapFree
(
GetProcessHeap
(),
0
,
dmW
);
dmA
.
dmSize
=
FIELD_OFFSET
(
DEVMODEA
,
dmFields
)
+
sizeof
(
dmA
.
dmFields
);
dmW
=
pGdiConvertToDevmodeW
(
&
dmA
);
ok
(
dmW
->
dmSize
==
FIELD_OFFSET
(
DEVMODEW
,
dmFields
)
+
sizeof
(
dmW
->
dmFields
),
"expected %04x, got %04x
\n
"
,
FIELD_OFFSET
(
DEVMODEW
,
dmFields
)
+
sizeof
(
dmW
->
dmFields
),
dmW
->
dmSize
);
HeapFree
(
GetProcessHeap
(),
0
,
dmW
);
dmA
.
dmICMMethod
=
DMICMMETHOD_NONE
;
dmA
.
dmSize
=
FIELD_OFFSET
(
DEVMODEA
,
dmICMMethod
)
+
sizeof
(
dmA
.
dmICMMethod
);
dmW
=
pGdiConvertToDevmodeW
(
&
dmA
);
ok
(
dmW
->
dmSize
==
FIELD_OFFSET
(
DEVMODEW
,
dmICMMethod
)
+
sizeof
(
dmW
->
dmICMMethod
),
"expected %04x, got %04x
\n
"
,
FIELD_OFFSET
(
DEVMODEW
,
dmICMMethod
)
+
sizeof
(
dmW
->
dmICMMethod
),
dmW
->
dmSize
);
ok
(
dmW
->
dmICMMethod
==
DMICMMETHOD_NONE
,
"expected DMICMMETHOD_NONE, got %u
\n
"
,
dmW
->
dmICMMethod
);
HeapFree
(
GetProcessHeap
(),
0
,
dmW
);
dmA
.
dmSize
=
1024
;
dmW
=
pGdiConvertToDevmodeW
(
&
dmA
);
ok
(
dmW
->
dmSize
==
FIELD_OFFSET
(
DEVMODEW
,
dmPanningHeight
)
+
sizeof
(
dmW
->
dmPanningHeight
),
"expected %04x, got %04x
\n
"
,
FIELD_OFFSET
(
DEVMODEW
,
dmPanningHeight
)
+
sizeof
(
dmW
->
dmPanningHeight
),
dmW
->
dmSize
);
HeapFree
(
GetProcessHeap
(),
0
,
dmW
);
}
START_TEST
(
dc
)
{
test_savedc
();
test_savedc_2
();
test_GdiConvertToDevmodeW
();
}
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