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
4c61c2ff
Commit
4c61c2ff
authored
Oct 08, 2009
by
Andrew Nguyen
Committed by
Alexandre Julliard
Oct 09, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Simplify and test DirectDrawEnumerateA.
parent
611fae61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
3 deletions
+78
-3
main.c
dlls/ddraw/main.c
+3
-3
ddrawmodes.c
dlls/ddraw/tests/ddrawmodes.c
+75
-0
No files found.
dlls/ddraw/main.c
View file @
4c61c2ff
...
...
@@ -368,7 +368,7 @@ HRESULT WINAPI
DirectDrawEnumerateA
(
LPDDENUMCALLBACKA
Callback
,
LPVOID
Context
)
{
BOOL
stop
=
FALSE
;
TRACE
(
"(%p, %p)
\n
"
,
Callback
,
Context
)
;
TRACE
(
" Enumerating default DirectDraw HAL interface
\n
"
);
/* We only have one driver */
...
...
@@ -377,11 +377,11 @@ DirectDrawEnumerateA(LPDDENUMCALLBACKA Callback,
static
CHAR
driver_desc
[]
=
"DirectDraw HAL"
,
driver_name
[]
=
"display"
;
stop
=
!
Callback
(
NULL
,
driver_desc
,
driver_name
,
Context
);
Callback
(
NULL
,
driver_desc
,
driver_name
,
Context
);
}
__EXCEPT_PAGE_FAULT
{
return
E_INVALIDARG
;
return
DDERR_INVALIDPARAMS
;
}
__ENDTRY
...
...
dlls/ddraw/tests/ddrawmodes.c
View file @
4c61c2ff
...
...
@@ -38,6 +38,14 @@ static int modes_cnt;
static
int
modes_size
;
static
LPDDSURFACEDESC
modes
;
static
HRESULT
(
WINAPI
*
pDirectDrawEnumerateA
)(
LPDDENUMCALLBACKA
,
LPVOID
);
static
void
init_function_pointers
(
void
)
{
HMODULE
hmod
=
GetModuleHandleA
(
"ddraw.dll"
);
pDirectDrawEnumerateA
=
(
void
*
)
GetProcAddress
(
hmod
,
"DirectDrawEnumerateA"
);
}
static
void
createwindow
(
void
)
{
wc
.
style
=
CS_HREDRAW
|
CS_VREDRAW
;
...
...
@@ -88,6 +96,68 @@ static void releasedirectdraw(void)
}
}
static
BOOL
WINAPI
crash_callbackA
(
GUID
*
lpGUID
,
LPSTR
lpDriverDescription
,
LPSTR
lpDriverName
,
LPVOID
lpContext
)
{
*
(
volatile
char
*
)
0
=
2
;
return
TRUE
;
}
static
BOOL
WINAPI
test_nullcontext_callbackA
(
GUID
*
lpGUID
,
LPSTR
lpDriverDescription
,
LPSTR
lpDriverName
,
LPVOID
lpContext
)
{
trace
(
"test_nullcontext_callbackA: %p %s %s %p
\n
"
,
lpGUID
,
lpDriverDescription
,
lpDriverName
,
lpContext
);
ok
(
!
lpContext
,
"Expected NULL lpContext
\n
"
);
return
TRUE
;
}
static
BOOL
WINAPI
test_context_callbackA
(
GUID
*
lpGUID
,
LPSTR
lpDriverDescription
,
LPSTR
lpDriverName
,
LPVOID
lpContext
)
{
trace
(
"test_context_callbackA: %p %s %s %p
\n
"
,
lpGUID
,
lpDriverDescription
,
lpDriverName
,
lpContext
);
ok
(
lpContext
==
(
LPVOID
)
0xdeadbeef
,
"Expected non-NULL lpContext
\n
"
);
return
TRUE
;
}
static
void
test_DirectDrawEnumerateA
(
void
)
{
HRESULT
ret
;
if
(
!
pDirectDrawEnumerateA
)
{
win_skip
(
"DirectDrawEnumerateA is not available
\n
"
);
return
;
}
/* Test with NULL callback parameter. */
ret
=
pDirectDrawEnumerateA
(
NULL
,
NULL
);
ok
(
ret
==
DDERR_INVALIDPARAMS
,
"Expected DDERR_INVALIDPARAMS, got %d
\n
"
,
ret
);
/* Test with invalid callback parameter. */
ret
=
pDirectDrawEnumerateA
((
LPDDENUMCALLBACKA
)
0xdeadbeef
,
NULL
);
ok
(
ret
==
DDERR_INVALIDPARAMS
,
"Expected DDERR_INVALIDPARAMS, got %d
\n
"
,
ret
);
/* Test with callback that crashes. */
ret
=
pDirectDrawEnumerateA
(
crash_callbackA
,
NULL
);
ok
(
ret
==
DDERR_INVALIDPARAMS
,
"Expected DDERR_INVALIDPARAMS, got %d
\n
"
,
ret
);
/* Test with valid callback parameter and NULL context parameter. */
trace
(
"Calling DirectDrawEnumerateA with test_nullcontext_callbackA callback and NULL context.
\n
"
);
ret
=
pDirectDrawEnumerateA
(
test_nullcontext_callbackA
,
NULL
);
ok
(
ret
==
DD_OK
,
"Expected DD_OK, got %d
\n
"
,
ret
);
/* Test with valid callback parameter and valid context parameter. */
trace
(
"Calling DirectDrawEnumerateA with test_context_callbackA callback and non-NULL context.
\n
"
);
ret
=
pDirectDrawEnumerateA
(
test_context_callbackA
,
(
LPVOID
)
0xdeadbeef
);
ok
(
ret
==
DD_OK
,
"Expected DD_OK, got %d
\n
"
,
ret
);
}
static
void
adddisplaymode
(
LPDDSURFACEDESC
lpddsd
)
{
if
(
!
modes
)
...
...
@@ -409,9 +479,14 @@ static void testddraw3(void)
START_TEST
(
ddrawmodes
)
{
init_function_pointers
();
createwindow
();
if
(
!
createdirectdraw
())
return
;
test_DirectDrawEnumerateA
();
enumdisplaymodes
();
if
(
winetest_interactive
)
testdisplaymodes
();
...
...
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