ReactOS  0.4.12-dev-918-g6c6e7b8
available_mem.cpp
Go to the documentation of this file.
1 
2 BOOL Test_GetAvailableVidMem (INT* passed, INT* failed)
3 {
5 
6  /* Preparations */
7  if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK)
8  {
9  printf("ERROR: Failed to set up ddraw\n");
10  return FALSE;
11  }
12 
13  /* Here we go */
14  DWORD Total, Free;
15  DDSCAPS2 Caps = { 0 };
16 
17  TEST (DirectDraw->GetAvailableVidMem(&Caps, NULL, NULL) == DDERR_INVALIDPARAMS);
18  TEST (DirectDraw->GetAvailableVidMem(NULL, &Total, &Free) == DDERR_INVALIDPARAMS);
19  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
20 
21  /* testing caps */
22  memset(&Caps,0,sizeof(DDSCAPS2));
24  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
25 
26  memset(&Caps,0,sizeof(DDSCAPS2));
27  Caps.dwCaps = DDSCAPS_ALPHA;
28  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
29 
30  memset(&Caps,0,sizeof(DDSCAPS2));
32  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS );
33 
34  memset(&Caps,0,sizeof(DDSCAPS2));
35  Caps.dwCaps = DDSCAPS_COMPLEX;
36  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS );
37 
38  memset(&Caps,0,sizeof(DDSCAPS2));
39  Caps.dwCaps = DDSCAPS_FLIP;
40  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS );
41 
42  memset(&Caps,0,sizeof(DDSCAPS2));
44  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS );
45 
46  memset(&Caps,0,sizeof(DDSCAPS2));
48  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
49 
50  memset(&Caps,0,sizeof(DDSCAPS2));
51  Caps.dwCaps = DDSCAPS_OVERLAY;
52  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
53 
54  memset(&Caps,0,sizeof(DDSCAPS2));
55  Caps.dwCaps = DDSCAPS_PALETTE;
56  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS );
57 
58  memset(&Caps,0,sizeof(DDSCAPS2));
60  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
61 
62  memset(&Caps,0,sizeof(DDSCAPS2));
64  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
65 
66  memset(&Caps,0,sizeof(DDSCAPS2));
68  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS );
69 
70  memset(&Caps,0,sizeof(DDSCAPS2));
71  Caps.dwCaps = DDSCAPS_TEXTURE;
72  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
73 
74  memset(&Caps,0,sizeof(DDSCAPS2));
75  Caps.dwCaps = DDSCAPS_3DDEVICE;
76  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
77 
78  memset(&Caps,0,sizeof(DDSCAPS2));
80  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
81 
82  memset(&Caps,0,sizeof(DDSCAPS2));
83  Caps.dwCaps = DDSCAPS_VISIBLE;
84  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS );
85 
86  memset(&Caps,0,sizeof(DDSCAPS2));
88  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS );
89 
90  memset(&Caps,0,sizeof(DDSCAPS2));
91  Caps.dwCaps = DDSCAPS_ZBUFFER;
92  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
93 
94  memset(&Caps,0,sizeof(DDSCAPS2));
95  Caps.dwCaps = DDSCAPS_OWNDC;
96  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDPARAMS );
97 
98  memset(&Caps,0,sizeof(DDSCAPS2));
100  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
101 
102  memset(&Caps,0,sizeof(DDSCAPS2));
103  Caps.dwCaps = DDSCAPS_HWCODEC;
104  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
105 
106  memset(&Caps,0,sizeof(DDSCAPS2));
107  Caps.dwCaps = DDSCAPS_MODEX;
108  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
109 
110  memset(&Caps,0,sizeof(DDSCAPS2));
111  Caps.dwCaps = DDSCAPS_MIPMAP;
112  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
113 
114  memset(&Caps,0,sizeof(DDSCAPS2));
115  Caps.dwCaps = DDSCAPS_RESERVED2;
116  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
117 
118  memset(&Caps,0,sizeof(DDSCAPS2));
120  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
121 
122  memset(&Caps,0,sizeof(DDSCAPS2));
123  Caps.dwCaps = DDSCAPS_VIDEOPORT;
124  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
125 
126  memset(&Caps,0,sizeof(DDSCAPS2));
128  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
129 
130  memset(&Caps,0,sizeof(DDSCAPS2));
132  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
133 
134  memset(&Caps,0,sizeof(DDSCAPS2));
135  Caps.dwCaps2 = 0x01;
136  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDCAPS);
137 
138  memset(&Caps,0,sizeof(DDSCAPS2));
140  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
141 
142  memset(&Caps,0,sizeof(DDSCAPS2));
144  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
145 
146  memset(&Caps,0,sizeof(DDSCAPS2));
148  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
149 
150  memset(&Caps,0,sizeof(DDSCAPS2));
152  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
153 
154  memset(&Caps,0,sizeof(DDSCAPS2));
156  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
157 
158  memset(&Caps,0,sizeof(DDSCAPS2));
160  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
161 
162  memset(&Caps,0,sizeof(DDSCAPS2));
163  Caps.dwCaps2 = DDSCAPS2_OPAQUE;
164  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
165 
166  memset(&Caps,0,sizeof(DDSCAPS2));
168  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
169 
170  memset(&Caps,0,sizeof(DDSCAPS2));
171  Caps.dwCaps2 = DDSCAPS2_CUBEMAP;
172  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
173 
174  memset(&Caps,0,sizeof(DDSCAPS2));
176  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
177 
178  memset(&Caps,0,sizeof(DDSCAPS2));
180  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
181 
182  memset(&Caps,0,sizeof(DDSCAPS2));
184  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
185 
186  memset(&Caps,0,sizeof(DDSCAPS2));
188  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
189 
190  memset(&Caps,0,sizeof(DDSCAPS2));
192  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
193 
194  memset(&Caps,0,sizeof(DDSCAPS2));
196  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
197 
198  memset(&Caps,0,sizeof(DDSCAPS2));
200  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
201 
202  memset(&Caps,0,sizeof(DDSCAPS2));
204  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
205 
206  memset(&Caps,0,sizeof(DDSCAPS2));
208  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
209 
210  memset(&Caps,0,sizeof(DDSCAPS2));
212  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
213 
214  memset(&Caps,0,sizeof(DDSCAPS2));
215  Caps.dwCaps2 = DDSCAPS2_VOLUME;
216  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
217 
218  memset(&Caps,0,sizeof(DDSCAPS2));
220  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
221 
222  memset(&Caps,0,sizeof(DDSCAPS2));
223  Caps.dwCaps2 = DDSCAPS2_POINTS;
224  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
225 
226  memset(&Caps,0,sizeof(DDSCAPS2));
228  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
229 
230  memset(&Caps,0,sizeof(DDSCAPS2));
231  Caps.dwCaps2 = DDSCAPS2_NPATCHES;
232  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
233 
234  memset(&Caps,0,sizeof(DDSCAPS2));
236  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
237 
238  memset(&Caps,0,sizeof(DDSCAPS2));
240  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
241 
242  memset(&Caps,0,sizeof(DDSCAPS2));
244  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
245 
246  memset(&Caps,0,sizeof(DDSCAPS2));
248  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
249 
250  memset(&Caps,0,sizeof(DDSCAPS2));
252  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
253 
254  memset(&Caps,0,sizeof(DDSCAPS2));
256  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDCAPS);
257 
258  memset(&Caps,0,sizeof(DDSCAPS2));
260  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK);
261 
262  memset(&Caps,0,sizeof(DDSCAPS2));
263  Caps.dwCaps4 = 1;
264  TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DDERR_INVALIDCAPS );
265 
266  DirectDraw->Release();
267 
268  return TRUE;
269 }
#define DDSCAPS2_RESERVED4
Definition: ddraw.h:282
#define DDSCAPS_3DDEVICE
Definition: ddraw.h:263
#define DDSCAPS3_MULTISAMPLE_QUALITY_MASK
Definition: ddraw.h:321
#define DDSCAPS2_HINTSTATIC
Definition: ddraw.h:284
#define TRUE
Definition: types.h:120
#define DDSCAPS3_AUTOGENMIPMAP
Definition: ddraw.h:326
#define DDSCAPS2_DISCARDBACKBUFFER
Definition: ddraw.h:315
#define DDSCAPS3_DMAP
Definition: ddraw.h:327
#define DDSCAPS_WRITEONLY
Definition: ddraw.h:266
DWORD dwCaps2
Definition: ddraw.h:733
#define DDSCAPS2_RESERVED3
Definition: ddraw.h:314
#define DDSCAPS_PALETTE
Definition: ddraw.h:257
#define DDSCAPS2_DONOTPERSIST
Definition: ddraw.h:306
#define DDSCAPS_TEXTURE
Definition: ddraw.h:262
#define DDSCAPS2_CUBEMAP_NEGATIVEX
Definition: ddraw.h:292
#define DDSCAPS_NONLOCALVIDMEM
Definition: ddraw.h:277
DWORD dwCaps4
Definition: ddraw.h:737
#define DDSCAPS_OWNDC
Definition: ddraw.h:268
#define DDSCAPS2_EXTENDEDFORMATPRIMARY
Definition: ddraw.h:317
#define DDSCAPS2_D3DTEXTUREMANAGE
Definition: ddraw.h:305
#define DDSCAPS2_CUBEMAP
Definition: ddraw.h:290
#define DDSCAPS_ALPHA
Definition: ddraw.h:250
HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID *lplpDD, REFIID id, LPUNKNOWN pUnkOuter)
Definition: main.c:139
int32_t INT
Definition: typedefs.h:56
#define DDSCAPS_LIVEVIDEO
Definition: ddraw.h:269
#define DDSCAPS_RESERVED1
Definition: ddraw.h:249
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:656
#define DDSCAPS2_STEREOSURFACELEFT
Definition: ddraw.h:307
#define DDSCAPS_FLIP
Definition: ddraw.h:253
#define DDSCAPS_VISIBLE
Definition: ddraw.h:265
#define DDSCAPS3_MULTISAMPLE_MASK
Definition: ddraw.h:320
#define DDSCAPS2_MIPMAPSUBLEVEL
Definition: ddraw.h:304
#define DDSCAPS_HWCODEC
Definition: ddraw.h:270
#define DD_OK
Definition: ddraw.h:186
BOOL Test_GetAvailableVidMem(INT *passed, INT *failed)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DDSCAPS_VIDEOPORT
Definition: ddraw.h:275
#define DDSCAPS_SYSTEMMEMORY
Definition: ddraw.h:261
#define DDSCAPS_RESERVED3
Definition: ddraw.h:259
DWORD dwCaps
Definition: ddraw.h:732
smooth NULL
Definition: ftsmooth.c:416
#define DDSCAPS_FRONTBUFFER
Definition: ddraw.h:254
#define DDSCAPS3_RESERVED1
Definition: ddraw.h:323
#define DDSCAPS2_TEXTUREMANAGE
Definition: ddraw.h:285
#define DDSCAPS_ZBUFFER
Definition: ddraw.h:267
#define DDSCAPS_ALLOCONLOAD
Definition: ddraw.h:274
#define DDSCAPS_VIDEOMEMORY
Definition: ddraw.h:264
#define DDSCAPS2_HINTANTIALIASING
Definition: ddraw.h:289
#define DDSCAPS_RESERVED2
Definition: ddraw.h:273
#define DDSCAPS_COMPLEX
Definition: ddraw.h:252
#define DDSCAPS2_CUBEMAP_POSITIVEX
Definition: ddraw.h:291
#define DDSCAPS2_ADDITIONALPRIMARY
Definition: ddraw.h:318
#define DDSCAPS2_CUBEMAP_NEGATIVEZ
Definition: ddraw.h:296
#define DDSCAPS_MIPMAP
Definition: ddraw.h:272
#define DDSCAPS2_VOLUME
Definition: ddraw.h:308
#define DDSCAPS2_POINTS
Definition: ddraw.h:310
#define DDSCAPS2_OPAQUE
Definition: ddraw.h:288
#define TEST(x)
Definition: precomp.h:20
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DDSCAPS2_HINTDYNAMIC
Definition: ddraw.h:283
#define DDSCAPS2_RESERVED2
Definition: ddraw.h:287
#define DDSCAPS2_CUBEMAP_POSITIVEY
Definition: ddraw.h:293
#define DDSCAPS_LOCALVIDMEM
Definition: ddraw.h:276
DWORD dwCaps3
Definition: ddraw.h:734
#define DDSCAPS2_RESERVED1
Definition: ddraw.h:286
#define DDSCAPS_OVERLAY
Definition: ddraw.h:256
#define DDSCAPS_MODEX
Definition: ddraw.h:271
LPDIRECTDRAW7 DirectDraw
Definition: create.cpp:3
#define DDSCAPS2_NOTUSERLOCKABLE
Definition: ddraw.h:309
#define DDSCAPS_BACKBUFFER
Definition: ddraw.h:251
#define DDSCAPS2_RTPATCHES
Definition: ddraw.h:312
#define DDSCAPS2_NPATCHES
Definition: ddraw.h:313
#define DDSCAPS_PRIMARYSURFACE
Definition: ddraw.h:258
DWORD * LPDIRECTDRAW7
Definition: vmrender.idl:4
#define DDSCAPS2_CUBEMAP_POSITIVEZ
Definition: ddraw.h:295
#define DDSCAPS3_RESERVED2
Definition: ddraw.h:324
#define DDERR_INVALIDCAPS
Definition: ddraw.h:75
#define DDSCAPS3_LIGHTWEIGHTMIPMAP
Definition: ddraw.h:325
#define DDSCAPS_OFFSCREENPLAIN
Definition: ddraw.h:255
#define DDSCAPS2_ENABLEALPHACHANNEL
Definition: ddraw.h:316
#define memset(x, y, z)
Definition: compat.h:39
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
#define printf
Definition: config.h:203
#define DDSCAPS2_CUBEMAP_NEGATIVEY
Definition: ddraw.h:294