ReactOS
0.4.16-dev-306-g647d351
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
_
c
d
e
f
g
h
i
l
n
o
p
s
t
u
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
_
c
d
f
i
l
m
o
p
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
u
v
w
x
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Related Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
x
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Examples
create.cpp
Go to the documentation of this file.
1
#include "
ddrawtest.h
"
2
3
HWND
CreateBasicWindow
(
VOID
);
4
5
BOOL
Test_CreateDDraw
(
INT
* passed,
INT
* failed)
6
{
7
LPDIRECTDRAW7
DirectDraw
;
8
IDirectDraw* DirectDraw2;
9
10
/*** FIXME: Test first parameter using EnumDisplayDrivers ***/
11
DirectDrawCreateEx
(
NULL
, (
VOID
**)&
DirectDraw
, IID_IDirectDraw7,
NULL
);
12
13
TEST
(
DirectDrawCreateEx
(
NULL
, (
VOID
**)&
DirectDraw
, IID_IDirectDraw7, (
IUnknown
*)0xdeadbeef) ==
CLASS_E_NOAGGREGATION
);
14
TEST
(
DirectDrawCreateEx
(
NULL
, (
VOID
**)&
DirectDraw
, IID_IDirectDraw4,
NULL
) ==
DDERR_INVALIDPARAMS
);
15
TEST
(
DirectDrawCreateEx
(
NULL
,
NULL
, IID_IDirectDraw7,
NULL
) ==
DDERR_INVALIDPARAMS
);
16
17
DirectDraw
=
NULL
;
18
TEST
(
DirectDrawCreateEx
(
NULL
, (
VOID
**)&
DirectDraw
, IID_IDirectDraw7,
NULL
) ==
DD_OK
);
19
if
(
DirectDraw
)
20
{
21
TEST
(
DirectDraw
->Initialize(
NULL
) ==
DDERR_ALREADYINITIALIZED
);
22
TEST
(
DirectDraw
->Release() == 0);
23
}
24
25
DirectDraw2 =
NULL
;
26
TEST
(
DirectDrawCreate
(
NULL
,&DirectDraw2,
NULL
) ==
DD_OK
);
27
if
(DirectDraw2)
28
{
29
TEST
(DirectDraw2->QueryInterface(IID_IDirectDraw7, (
PVOID
*)&
DirectDraw
) == 0);
30
TEST
(DirectDraw2->AddRef() == 2);
31
TEST
(
DirectDraw
->AddRef() == 2);
32
TEST
(
DirectDraw
->Release() == 1);
33
TEST
(
DirectDraw
->Release() == 0);
34
TEST
(DirectDraw2->Release() == 1);
35
TEST
(DirectDraw2->Release() == 0);
36
}
37
38
return
TRUE
;
39
}
40
41
BOOL
Test_SetCooperativeLevel
(
INT
* passed,
INT
* failed)
42
{
43
HWND
hwnd
;
44
LPDIRECTDRAW7
DirectDraw
;
45
46
/* Preparations */
47
if
(
DirectDrawCreateEx
(
NULL
, (
VOID
**)&
DirectDraw
, IID_IDirectDraw7,
NULL
) !=
DD_OK
)
48
{
49
printf
(
"ERROR: Failed to set up ddraw\n"
);
50
return
FALSE
;
51
}
52
53
if
(!(
hwnd
=
CreateBasicWindow
() ))
54
{
55
printf
(
"ERROR: Failed to create window\n"
);
56
DirectDraw
->Release();
57
return
FALSE
;
58
}
59
60
/* The Test */
61
TEST
(
DirectDraw
->SetCooperativeLevel (
NULL
,
DDSCL_FULLSCREEN
) ==
DDERR_INVALIDPARAMS
);
62
TEST
(
DirectDraw
->SetCooperativeLevel (
hwnd
,
DDSCL_FULLSCREEN
) ==
DDERR_INVALIDPARAMS
);
63
64
TEST
(
DirectDraw
->SetCooperativeLevel (
hwnd
,
DDSCL_NORMAL
) ==
DD_OK
);
65
TEST
(
DirectDraw
->Compact() ==
DDERR_NOEXCLUSIVEMODE
);
66
67
68
TEST
(
DirectDraw
->SetCooperativeLevel (
NULL
,
DDSCL_FULLSCREEN
|
DDSCL_EXCLUSIVE
) ==
DDERR_INVALIDPARAMS
);
69
TEST
(
DirectDraw
->SetCooperativeLevel (
hwnd
,
DDSCL_FULLSCREEN
) ==
DDERR_INVALIDPARAMS
);
70
TEST
(
DirectDraw
->SetCooperativeLevel (
hwnd
,
DDSCL_NORMAL
|
DDSCL_ALLOWMODEX
) ==
DDERR_INVALIDPARAMS
);
71
TEST
(
DirectDraw
->SetCooperativeLevel ((
HWND
)0xdeadbeef,
DDSCL_NORMAL
) ==
DDERR_INVALIDPARAMS
);
72
73
TEST
(
DirectDraw
->SetCooperativeLevel (
hwnd
,
DDSCL_FULLSCREEN
|
DDSCL_EXCLUSIVE
) ==
DD_OK
);
74
TEST
(
DirectDraw
->Compact() ==
DD_OK
);
75
TEST
(
DirectDraw
->SetCooperativeLevel (
hwnd
,
DDSCL_FULLSCREEN
|
DDSCL_EXCLUSIVE
|
DDSCL_ALLOWMODEX
) ==
DD_OK
);
76
TEST
(
DirectDraw
->Compact() ==
DD_OK
);
77
TEST
(
DirectDraw
->SetCooperativeLevel (
NULL
,
DDSCL_NORMAL
) ==
DD_OK
);
78
TEST
(
DirectDraw
->Compact() ==
DDERR_NOEXCLUSIVEMODE
);
79
TEST
(
DirectDraw
->SetCooperativeLevel (
hwnd
,
DDSCL_NORMAL
) ==
DD_OK
);
80
TEST
(
DirectDraw
->Compact() ==
DDERR_NOEXCLUSIVEMODE
);
81
82
TEST
(
DirectDraw
->TestCooperativeLevel() ==
DD_OK
);
// I do not get what this API does it always seems to return DD_OK
83
84
DirectDraw
->Release();
85
86
return
TRUE
;
87
}
88
89
BOOL
Test_GetFourCCCodes
(
INT
* passed,
INT
* failed)
90
{
91
LPDIRECTDRAW7
DirectDraw
;
92
93
/* Preparations */
94
if
(
DirectDrawCreateEx
(
NULL
, (
VOID
**)&
DirectDraw
, IID_IDirectDraw7,
NULL
) !=
DD_OK
)
95
{
96
printf
(
"ERROR: Failed to set up ddraw\n"
);
97
return
FALSE
;
98
}
99
100
/* Here we go */
101
DWORD
dwNumCodes, *lpCodes;
102
TEST
(
DirectDraw
->GetFourCCCodes(
NULL
, (
PDWORD
)0xdeadbeef) ==
DDERR_INVALIDPARAMS
);
103
104
TEST
(
DirectDraw
->GetFourCCCodes(&dwNumCodes,
NULL
) ==
DD_OK
&& dwNumCodes);
105
lpCodes = (
PDWORD
)
HeapAlloc
(
GetProcessHeap
(), 0,
sizeof
(
DWORD
)*dwNumCodes);
106
*lpCodes = 0;
107
TEST
(
DirectDraw
->GetFourCCCodes(
NULL
, lpCodes) ==
DDERR_INVALIDPARAMS
);
108
TEST
(
DirectDraw
->GetFourCCCodes(&dwNumCodes, lpCodes) ==
DD_OK
&& *lpCodes );
109
110
DirectDraw
->Release();
111
112
return
TRUE
;
113
}
114
115
BOOL
Test_GetDeviceIdentifier
(
INT
* passed,
INT
* failed)
116
{
117
LPDIRECTDRAW7
DirectDraw
;
118
DDDEVICEIDENTIFIER2
pDDDI;
119
//OLECHAR GuidStr[100];
120
121
/* Preparations */
122
if
(
DirectDrawCreateEx
(
NULL
, (
VOID
**)&
DirectDraw
, IID_IDirectDraw7,
NULL
) !=
DD_OK
)
123
{
124
printf
(
"ERROR: Failed to set up ddraw\n"
);
125
return
FALSE
;
126
}
127
128
TEST
(
DirectDraw
->GetDeviceIdentifier(
NULL
, 0) ==
DDERR_INVALIDPARAMS
);
129
TEST
(
DirectDraw
->GetDeviceIdentifier(
NULL
, ~
DDGDI_GETHOSTIDENTIFIER
) ==
DDERR_INVALIDPARAMS
);
130
TEST
(
DirectDraw
->GetDeviceIdentifier(
NULL
,
DDGDI_GETHOSTIDENTIFIER
) ==
DDERR_INVALIDPARAMS
);
131
132
memset
(&pDDDI,0,
sizeof
(
DDDEVICEIDENTIFIER2
));
133
TEST
(
DirectDraw
->GetDeviceIdentifier(&pDDDI, 0) ==
DD_OK
);
134
135
/*
136
StringFromGUID2(pDDDI.guidDeviceIdentifier, GuidStr, 100);
137
printf("1. \n");
138
printf("szDriver : %s\n",pDDDI.szDriver);
139
printf("szDescription : %s\n",pDDDI.szDescription);
140
printf("liDriverVersion : 0x%08x . 0x%08x\n", pDDDI.liDriverVersion.HighPart, pDDDI.liDriverVersion.LowPart);
141
printf("dwVendorId : 0x%08x\n",pDDDI.dwVendorId);
142
printf("dwDeviceId : 0x%08x\n",pDDDI.dwDeviceId);
143
printf("dwSubSysId : 0x%08x\n",pDDDI.dwSubSysId);
144
printf("dwRevision : 0x%08x\n",pDDDI.dwRevision);
145
printf("guidDeviceIdentifier : %ls\n",GuidStr);
146
printf("dwWHQLLevel : 0x%08x\n",pDDDI.dwWHQLLevel);
147
*/
148
149
memset
(&pDDDI,0,
sizeof
(
DDDEVICEIDENTIFIER2
));
150
TEST
(
DirectDraw
->GetDeviceIdentifier(&pDDDI,
DDGDI_GETHOSTIDENTIFIER
) ==
DD_OK
);
151
memset
(&pDDDI,0,
sizeof
(
DDDEVICEIDENTIFIER2
));
152
TEST
(
DirectDraw
->GetDeviceIdentifier(&pDDDI, ~
DDGDI_GETHOSTIDENTIFIER
) ==
DDERR_INVALIDPARAMS
);
153
154
DirectDraw
->Release();
155
156
return
TRUE
;
157
}
DirectDraw
Definition:
ddraw_classes.idl:28
ddrawtest.h
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
DirectDrawCreateEx
HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID *lplpDD, REFIID id, LPUNKNOWN pUnkOuter)
Definition:
main.c:139
DirectDrawCreate
HRESULT WINAPI DirectDrawCreate(LPGUID lpGUID, LPDIRECTDRAW *lplpDD, LPUNKNOWN pUnkOuter)
Definition:
main.c:86
GetProcessHeap
#define GetProcessHeap()
Definition:
compat.h:736
HeapAlloc
#define HeapAlloc
Definition:
compat.h:733
LPDIRECTDRAW7
DWORD * LPDIRECTDRAW7
Definition:
vmrender.idl:6
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
printf
#define printf
Definition:
freeldr.h:97
IUnknown
Definition:
unknwn.idl:39
void
Definition:
nsiface.idl:2307
TEST
#define TEST(x)
Definition:
precomp.h:20
CreateBasicWindow
HWND CreateBasicWindow(VOID)
Test_CreateDDraw
BOOL Test_CreateDDraw(INT *passed, INT *failed)
Definition:
create.cpp:5
Test_GetFourCCCodes
BOOL Test_GetFourCCCodes(INT *passed, INT *failed)
Definition:
create.cpp:89
Test_GetDeviceIdentifier
BOOL Test_GetDeviceIdentifier(INT *passed, INT *failed)
Definition:
create.cpp:115
Test_SetCooperativeLevel
BOOL Test_SetCooperativeLevel(INT *passed, INT *failed)
Definition:
create.cpp:41
DWORD
#define DWORD
Definition:
nt_native.h:44
PDWORD
DWORD * PDWORD
Definition:
pedump.c:68
DDSCL_NORMAL
#define DDSCL_NORMAL
Definition:
ddraw.h:535
DDSCL_EXCLUSIVE
#define DDSCL_EXCLUSIVE
Definition:
ddraw.h:536
DDGDI_GETHOSTIDENTIFIER
#define DDGDI_GETHOSTIDENTIFIER
Definition:
ddraw.h:202
DDERR_NOEXCLUSIVEMODE
#define DDERR_NOEXCLUSIVEMODE
Definition:
ddraw.h:93
DD_OK
#define DD_OK
Definition:
ddraw.h:186
DDERR_INVALIDPARAMS
#define DDERR_INVALIDPARAMS
Definition:
ddraw.h:79
DDERR_ALREADYINITIALIZED
#define DDERR_ALREADYINITIALIZED
Definition:
ddraw.h:67
DDSCL_ALLOWMODEX
#define DDSCL_ALLOWMODEX
Definition:
ddraw.h:537
DDSCL_FULLSCREEN
#define DDSCL_FULLSCREEN
Definition:
ddraw.h:532
memset
#define memset(x, y, z)
Definition:
compat.h:39
tagDDDEVICEIDENTIFIER2
Definition:
ddraw.h:1344
INT
int32_t INT
Definition:
typedefs.h:58
hwnd
_In_ LONG _In_ HWND hwnd
Definition:
winddi.h:4023
CLASS_E_NOAGGREGATION
#define CLASS_E_NOAGGREGATION
Definition:
winerror.h:2662
modules
rostests
dxtest
ddraw
DDraw
create.cpp
Generated on Mon Dec 2 2024 06:10:35 for ReactOS by
1.9.6