2 * Unit tests for mmio APIs
4 * Copyright 2005 Dmitry Timoshkov
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "wine/test.h"
31 static DWORD RIFF_buf
[] =
33 FOURCC_RIFF
, 32*sizeof(DWORD
), mmioFOURCC('A','V','I',' '),
34 FOURCC_LIST
, 29*sizeof(DWORD
), listtypeAVIHEADER
, ckidAVIMAINHDR
,
35 sizeof(MainAVIHeader
), 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
36 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,0xdeadbeef,
37 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,0xdeadbeef,
38 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
39 FOURCC_LIST
, 10*sizeof(DWORD
),listtypeSTREAMHEADER
, ckidSTREAMHEADER
,
40 7*sizeof(DWORD
), streamtypeVIDEO
, 0xdeadbeef, 0xdeadbeef,
41 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
42 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
43 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
44 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
45 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
48 static void test_mmioDescend(char *fname
)
53 MMCKINFO ckRiff
, ckList
, ck
;
55 memset(&mmio
, 0, sizeof(mmio
));
56 mmio
.fccIOProc
= fname
? FOURCC_DOS
: FOURCC_MEM
;
57 mmio
.cchBuffer
= sizeof(RIFF_buf
);
58 mmio
.pchBuffer
= (char *)RIFF_buf
;
59 hmmio
= mmioOpen(fname
, &mmio
, MMIO_READ
);
62 skip("%s file is missing, skipping the test\n", fname
);
65 ok(hmmio
!= 0, "mmioOpen error %u\n", mmio
.wErrorRet
);
67 /* first normal RIFF AVI parsing */
68 ret
= mmioDescend(hmmio
, &ckRiff
, NULL
, 0);
69 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
70 ok(ckRiff
.ckid
== FOURCC_RIFF
, "wrong ckid: %04x\n", ckRiff
.ckid
);
71 ok(ckRiff
.fccType
== formtypeAVI
, "wrong fccType: %04x\n", ckRiff
.fccType
);
72 trace("ckid %4.4s cksize %04x fccType %4.4s off %04x flags %04x\n",
73 (LPCSTR
)&ckRiff
.ckid
, ckRiff
.cksize
, (LPCSTR
)&ckRiff
.fccType
,
74 ckRiff
.dwDataOffset
, ckRiff
.dwFlags
);
76 ret
= mmioDescend(hmmio
, &ckList
, &ckRiff
, 0);
77 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
78 ok(ckList
.ckid
== FOURCC_LIST
, "wrong ckid: %04x\n", ckList
.ckid
);
79 ok(ckList
.fccType
== listtypeAVIHEADER
, "wrong fccType: %04x\n", ckList
.fccType
);
80 trace("ckid %4.4s cksize %04x fccType %4.4s off %04x flags %04x\n",
81 (LPCSTR
)&ckList
.ckid
, ckList
.cksize
, (LPCSTR
)&ckList
.fccType
,
82 ckList
.dwDataOffset
, ckList
.dwFlags
);
84 ret
= mmioDescend(hmmio
, &ck
, &ckList
, 0);
85 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
86 ok(ck
.ckid
== ckidAVIMAINHDR
, "wrong ckid: %04x\n", ck
.ckid
);
87 ok(ck
.fccType
== 0, "wrong fccType: %04x\n", ck
.fccType
);
88 trace("ckid %4.4s cksize %04x fccType %4.4s off %04x flags %04x\n",
89 (LPCSTR
)&ck
.ckid
, ck
.cksize
, (LPCSTR
)&ck
.fccType
,
90 ck
.dwDataOffset
, ck
.dwFlags
);
93 mmioSeek(hmmio
, ck
.cksize
, SEEK_CUR
);
95 ret
= mmioDescend(hmmio
, &ckList
, &ckList
, 0);
96 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
97 ok(ckList
.ckid
== FOURCC_LIST
, "wrong ckid: %04x\n", ckList
.ckid
);
98 ok(ckList
.fccType
== listtypeSTREAMHEADER
, "wrong fccType: %04x\n", ckList
.fccType
);
99 trace("ckid %4.4s cksize %04x fccType %4.4s off %04x flags %04x\n",
100 (LPCSTR
)&ckList
.ckid
, ckList
.cksize
, (LPCSTR
)&ckList
.fccType
,
101 ckList
.dwDataOffset
, ckList
.dwFlags
);
103 ret
= mmioDescend(hmmio
, &ck
, &ckList
, 0);
104 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
105 ok(ck
.ckid
== ckidSTREAMHEADER
, "wrong ckid: %04x\n", ck
.ckid
);
106 ok(ck
.fccType
== 0, "wrong fccType: %04x\n", ck
.fccType
);
107 trace("ckid %4.4s cksize %04x fccType %4.4s off %04x flags %04x\n",
108 (LPCSTR
)&ck
.ckid
, ck
.cksize
, (LPCSTR
)&ck
.fccType
,
109 ck
.dwDataOffset
, ck
.dwFlags
);
111 /* test various mmioDescend flags */
113 mmioSeek(hmmio
, 0, SEEK_SET
);
114 memset(&ck
, 0x66, sizeof(ck
));
115 ret
= mmioDescend(hmmio
, &ck
, NULL
, MMIO_FINDRIFF
);
116 ok(ret
== MMIOERR_CHUNKNOTFOUND
||
117 ret
== MMIOERR_INVALIDFILE
, "mmioDescend returned %u\n", ret
);
119 mmioSeek(hmmio
, 0, SEEK_SET
);
120 memset(&ck
, 0x66, sizeof(ck
));
122 ret
= mmioDescend(hmmio
, &ck
, NULL
, MMIO_FINDRIFF
);
123 ok(ret
== MMIOERR_CHUNKNOTFOUND
||
124 ret
== MMIOERR_INVALIDFILE
, "mmioDescend returned %u\n", ret
);
126 mmioSeek(hmmio
, 0, SEEK_SET
);
127 memset(&ck
, 0x66, sizeof(ck
));
129 ret
= mmioDescend(hmmio
, &ck
, NULL
, MMIO_FINDRIFF
);
130 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
131 ok(ck
.ckid
== FOURCC_RIFF
, "wrong ckid: %04x\n", ck
.ckid
);
132 ok(ck
.fccType
== formtypeAVI
, "wrong fccType: %04x\n", ck
.fccType
);
134 mmioSeek(hmmio
, 0, SEEK_SET
);
135 memset(&ck
, 0x66, sizeof(ck
));
136 ret
= mmioDescend(hmmio
, &ck
, NULL
, 0);
137 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
138 ok(ck
.ckid
== FOURCC_RIFF
, "wrong ckid: %04x\n", ck
.ckid
);
139 ok(ck
.fccType
== formtypeAVI
, "wrong fccType: %04x\n", ck
.fccType
);
141 /* do NOT seek, use current file position */
142 memset(&ck
, 0x66, sizeof(ck
));
144 ret
= mmioDescend(hmmio
, &ck
, NULL
, MMIO_FINDLIST
);
145 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
146 ok(ck
.ckid
== FOURCC_LIST
, "wrong ckid: %04x\n", ck
.ckid
);
147 ok(ck
.fccType
== listtypeAVIHEADER
, "wrong fccType: %04x\n", ck
.fccType
);
149 mmioSeek(hmmio
, 0, SEEK_SET
);
150 memset(&ck
, 0x66, sizeof(ck
));
152 ck
.fccType
= listtypeAVIHEADER
;
153 ret
= mmioDescend(hmmio
, &ck
, NULL
, MMIO_FINDCHUNK
);
154 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
155 ok(ck
.ckid
== FOURCC_RIFF
, "wrong ckid: %04x\n", ck
.ckid
);
156 ok(ck
.fccType
== formtypeAVI
, "wrong fccType: %04x\n", ck
.fccType
);
158 /* do NOT seek, use current file position */
159 memset(&ck
, 0x66, sizeof(ck
));
160 ck
.ckid
= FOURCC_LIST
;
161 ret
= mmioDescend(hmmio
, &ck
, NULL
, MMIO_FINDCHUNK
);
162 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
163 ok(ck
.ckid
== FOURCC_LIST
, "wrong ckid: %04x\n", ck
.ckid
);
164 ok(ck
.fccType
== listtypeAVIHEADER
, "wrong fccType: %04x\n", ck
.fccType
);
166 mmioSeek(hmmio
, 0, SEEK_SET
);
167 memset(&ck
, 0x66, sizeof(ck
));
168 ck
.ckid
= FOURCC_RIFF
;
169 ret
= mmioDescend(hmmio
, &ck
, NULL
, MMIO_FINDCHUNK
);
170 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
171 ok(ck
.ckid
== FOURCC_RIFF
, "wrong ckid: %04x\n", ck
.ckid
);
172 ok(ck
.fccType
== formtypeAVI
, "wrong fccType: %04x\n", ck
.fccType
);
174 /* do NOT seek, use current file position */
175 memset(&ckList
, 0x66, sizeof(ckList
));
177 ret
= mmioDescend(hmmio
, &ckList
, &ck
, MMIO_FINDCHUNK
);
178 ok(ret
== MMSYSERR_NOERROR
, "mmioDescend error %u\n", ret
);
179 ok(ckList
.ckid
== FOURCC_LIST
, "wrong ckid: %04x\n", ckList
.ckid
);
180 ok(ckList
.fccType
== listtypeAVIHEADER
, "wrong fccType: %04x\n", ckList
.fccType
);
182 mmioSeek(hmmio
, 0, SEEK_SET
);
183 memset(&ck
, 0x66, sizeof(ck
));
184 ret
= mmioDescend(hmmio
, &ck
, NULL
, MMIO_FINDCHUNK
);
185 ok(ret
== MMIOERR_CHUNKNOTFOUND
||
186 ret
== MMIOERR_INVALIDFILE
, "mmioDescend returned %u\n", ret
);
187 ok(ck
.ckid
!= 0x66666666, "wrong ckid: %04x\n", ck
.ckid
);
188 ok(ck
.fccType
!= 0x66666666, "wrong fccType: %04x\n", ck
.fccType
);
189 ok(ck
.dwDataOffset
!= 0x66666666, "wrong dwDataOffset: %04x\n", ck
.dwDataOffset
);
191 mmioSeek(hmmio
, 0, SEEK_SET
);
192 memset(&ck
, 0x66, sizeof(ck
));
193 ret
= mmioDescend(hmmio
, &ck
, NULL
, MMIO_FINDRIFF
);
194 ok(ret
== MMIOERR_CHUNKNOTFOUND
||
195 ret
== MMIOERR_INVALIDFILE
, "mmioDescend returned %u\n", ret
);
200 static void test_mmioOpen(char *fname
)
207 memset(&mmio
, 0, sizeof(mmio
));
208 mmio
.fccIOProc
= fname
? FOURCC_DOS
: FOURCC_MEM
;
209 mmio
.cchBuffer
= sizeof(buf
);
210 mmio
.pchBuffer
= buf
;
211 hmmio
= mmioOpen(fname
, &mmio
, MMIO_READ
);
214 skip("%s file is missing, skipping the test\n", fname
);
217 ok(hmmio
!= 0, "mmioOpen error %u\n", mmio
.wErrorRet
);
219 memset(&mmio
, 0, sizeof(mmio
));
220 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
221 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
222 ok(mmio
.dwFlags
== MMIO_READ
, "expected MMIO_READ, got %x\n", mmio
.dwFlags
);
223 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
224 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
225 ok(mmio
.cchBuffer
== sizeof(buf
), "got %u\n", mmio
.cchBuffer
);
226 ok(mmio
.pchBuffer
== buf
, "expected %p, got %p\n", buf
, mmio
.pchBuffer
);
230 memset(&mmio
, 0, sizeof(mmio
));
231 mmio
.fccIOProc
= fname
? FOURCC_DOS
: FOURCC_MEM
;
233 mmio
.pchBuffer
= buf
;
234 hmmio
= mmioOpen(fname
, &mmio
, MMIO_READ
);
235 ok(hmmio
!= 0, "mmioOpen error %u\n", mmio
.wErrorRet
);
237 memset(&mmio
, 0, sizeof(mmio
));
238 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
239 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
240 ok(mmio
.dwFlags
== MMIO_READ
, "expected MMIO_READ, got %x\n", mmio
.dwFlags
);
241 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
242 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
243 ok(mmio
.cchBuffer
== 0, "expected 0, got %u\n", mmio
.cchBuffer
);
244 ok(mmio
.pchBuffer
== buf
, "expected %p, got %p\n", buf
, mmio
.pchBuffer
);
248 memset(&mmio
, 0, sizeof(mmio
));
249 mmio
.fccIOProc
= fname
? FOURCC_DOS
: FOURCC_MEM
;
251 mmio
.pchBuffer
= NULL
;
252 hmmio
= mmioOpen(fname
, &mmio
, MMIO_READ
);
253 ok(hmmio
!= 0, "mmioOpen error %u\n", mmio
.wErrorRet
);
255 memset(&mmio
, 0, sizeof(mmio
));
256 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
257 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
258 ok(mmio
.dwFlags
== MMIO_READ
, "expected MMIO_READ, got %x\n", mmio
.dwFlags
);
259 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
260 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
261 ok(mmio
.cchBuffer
== 0, "expected 0, got %u\n", mmio
.cchBuffer
);
262 ok(mmio
.pchBuffer
== NULL
, "expected NULL\n");
266 memset(&mmio
, 0, sizeof(mmio
));
267 mmio
.fccIOProc
= fname
? FOURCC_DOS
: FOURCC_MEM
;
268 mmio
.cchBuffer
= 256;
269 mmio
.pchBuffer
= NULL
;
270 hmmio
= mmioOpen(fname
, &mmio
, MMIO_READ
);
271 ok(hmmio
!= 0, "mmioOpen error %u\n", mmio
.wErrorRet
);
273 memset(&mmio
, 0, sizeof(mmio
));
274 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
275 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
276 ok(mmio
.dwFlags
== (MMIO_READ
|MMIO_ALLOCBUF
), "expected MMIO_READ|MMIO_ALLOCBUF, got %x\n", mmio
.dwFlags
);
277 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
278 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
279 ok(mmio
.cchBuffer
== 256, "expected 256, got %u\n", mmio
.cchBuffer
);
280 ok(mmio
.pchBuffer
!= NULL
, "expected not NULL\n");
284 memset(&mmio
, 0, sizeof(mmio
));
285 mmio
.fccIOProc
= fname
? FOURCC_DOS
: FOURCC_MEM
;
286 mmio
.cchBuffer
= sizeof(buf
);
287 mmio
.pchBuffer
= buf
;
288 hmmio
= mmioOpen(fname
, &mmio
, MMIO_READ
| MMIO_ALLOCBUF
);
289 ok(hmmio
!= 0, "mmioOpen error %u\n", mmio
.wErrorRet
);
291 memset(&mmio
, 0, sizeof(mmio
));
292 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
293 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
294 ok(mmio
.dwFlags
== MMIO_READ
, "expected MMIO_READ, got %x\n", mmio
.dwFlags
);
295 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
296 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
297 ok(mmio
.cchBuffer
== sizeof(buf
), "got %u\n", mmio
.cchBuffer
);
298 ok(mmio
.pchBuffer
== buf
, "expected %p, got %p\n", buf
, mmio
.pchBuffer
);
302 memset(&mmio
, 0, sizeof(mmio
));
303 mmio
.fccIOProc
= fname
? FOURCC_DOS
: FOURCC_MEM
;
305 mmio
.pchBuffer
= NULL
;
306 hmmio
= mmioOpen(fname
, &mmio
, MMIO_READ
| MMIO_ALLOCBUF
);
307 ok(hmmio
!= 0, "mmioOpen error %u\n", mmio
.wErrorRet
);
309 memset(&mmio
, 0, sizeof(mmio
));
310 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
311 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
312 ok(mmio
.dwFlags
== (MMIO_READ
|MMIO_ALLOCBUF
), "expected MMIO_READ|MMIO_ALLOCBUF, got %x\n", mmio
.dwFlags
);
313 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
314 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
315 ok(mmio
.cchBuffer
== MMIO_DEFAULTBUFFER
, "expected MMIO_DEFAULTBUFFER, got %u\n", mmio
.cchBuffer
);
316 ok(mmio
.pchBuffer
!= NULL
, "expected not NULL\n");
320 memset(&mmio
, 0, sizeof(mmio
));
321 mmio
.fccIOProc
= fname
? FOURCC_DOS
: FOURCC_MEM
;
322 mmio
.cchBuffer
= 256;
323 mmio
.pchBuffer
= NULL
;
324 hmmio
= mmioOpen(fname
, &mmio
, MMIO_READ
| MMIO_ALLOCBUF
);
325 ok(hmmio
!= 0, "mmioOpen error %u\n", mmio
.wErrorRet
);
327 memset(&mmio
, 0, sizeof(mmio
));
328 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
329 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
330 ok(mmio
.dwFlags
== (MMIO_READ
|MMIO_ALLOCBUF
), "expected MMIO_READ|MMIO_ALLOCBUF, got %x\n", mmio
.dwFlags
);
331 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
332 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
333 ok(mmio
.cchBuffer
== 256, "expected 256, got %u\n", mmio
.cchBuffer
);
334 ok(mmio
.pchBuffer
!= NULL
, "expected not NULL\n");
338 memset(&mmio
, 0, sizeof(mmio
));
339 mmio
.fccIOProc
= fname
? FOURCC_DOS
: FOURCC_MEM
;
341 mmio
.pchBuffer
= buf
;
342 hmmio
= mmioOpen(fname
, &mmio
, MMIO_READ
| MMIO_ALLOCBUF
);
343 if (!hmmio
&& mmio
.wErrorRet
== ERROR_BAD_FORMAT
)
345 /* Seen on Win9x, WinMe but also XP-SP1 */
346 skip("Some Windows versions don't like a 0 size and a given buffer\n");
349 ok(hmmio
!= 0, "mmioOpen error %u\n", mmio
.wErrorRet
);
351 memset(&mmio
, 0, sizeof(mmio
));
352 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
353 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
354 ok(mmio
.dwFlags
== MMIO_READ
, "expected MMIO_READ, got %x\n", mmio
.dwFlags
);
355 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
356 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
357 ok(mmio
.cchBuffer
== MMIO_DEFAULTBUFFER
, "expected MMIO_DEFAULTBUFFER, got %u\n", mmio
.cchBuffer
);
358 ok(mmio
.pchBuffer
== buf
, "expected %p, got %p\n", buf
, mmio
.pchBuffer
);
363 static void test_mmioSetBuffer(char *fname
)
370 memset(&mmio
, 0, sizeof(mmio
));
371 mmio
.fccIOProc
= fname
? FOURCC_DOS
: FOURCC_MEM
;
372 mmio
.cchBuffer
= sizeof(buf
);
373 mmio
.pchBuffer
= buf
;
374 hmmio
= mmioOpen(fname
, &mmio
, MMIO_READ
);
377 skip("%s file is missing, skipping the test\n", fname
);
380 ok(hmmio
!= 0, "mmioOpen error %u\n", mmio
.wErrorRet
);
382 memset(&mmio
, 0, sizeof(mmio
));
383 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
384 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
385 ok(mmio
.dwFlags
== MMIO_READ
, "expected MMIO_READ, got %x\n", mmio
.dwFlags
);
386 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
387 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
388 ok(mmio
.cchBuffer
== sizeof(buf
), "got %u\n", mmio
.cchBuffer
);
389 ok(mmio
.pchBuffer
== buf
, "expected %p, got %p\n", buf
, mmio
.pchBuffer
);
391 ret
= mmioSetBuffer(hmmio
, NULL
, 0, 0);
392 ok(ret
== MMSYSERR_NOERROR
, "mmioSetBuffer error %u\n", ret
);
394 memset(&mmio
, 0, sizeof(mmio
));
395 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
396 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
397 ok(mmio
.dwFlags
== MMIO_READ
, "expected MMIO_READ, got %x\n", mmio
.dwFlags
);
398 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
399 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
400 ok(mmio
.cchBuffer
== 0, "got not 0\n");
401 ok(mmio
.pchBuffer
== NULL
, "got not NULL buf\n");
403 ret
= mmioSetBuffer(hmmio
, NULL
, 0, MMIO_ALLOCBUF
);
404 ok(ret
== MMSYSERR_NOERROR
, "mmioSetBuffer error %u\n", ret
);
406 memset(&mmio
, 0, sizeof(mmio
));
407 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
408 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
409 ok(mmio
.dwFlags
== MMIO_READ
, "expected MMIO_READ, got %x\n", mmio
.dwFlags
);
410 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
411 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
412 ok(mmio
.cchBuffer
== 0, "got not 0\n");
413 ok(mmio
.pchBuffer
== NULL
, "got not NULL buf\n");
415 ret
= mmioSetBuffer(hmmio
, buf
, 0, MMIO_ALLOCBUF
);
416 ok(ret
== MMSYSERR_NOERROR
, "mmioSetBuffer error %u\n", ret
);
418 memset(&mmio
, 0, sizeof(mmio
));
419 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
420 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
421 ok(mmio
.dwFlags
== MMIO_READ
, "expected MMIO_READ, got %x\n", mmio
.dwFlags
);
422 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
423 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
424 ok(mmio
.cchBuffer
== 0, "got not 0\n");
425 ok(mmio
.pchBuffer
== buf
, "expected %p, got %p\n", buf
, mmio
.pchBuffer
);
427 ret
= mmioSetBuffer(hmmio
, NULL
, 256, MMIO_WRITE
|MMIO_ALLOCBUF
);
428 ok(ret
== MMSYSERR_NOERROR
, "mmioSetBuffer error %u\n", ret
);
430 memset(&mmio
, 0, sizeof(mmio
));
431 ret
= mmioGetInfo(hmmio
, &mmio
, 0);
432 ok(ret
== MMSYSERR_NOERROR
, "mmioGetInfo error %u\n", ret
);
433 ok(mmio
.dwFlags
== (MMIO_READ
|MMIO_ALLOCBUF
), "expected MMIO_READ|MMIO_ALLOCBUF, got %x\n", mmio
.dwFlags
);
434 ok(mmio
.wErrorRet
== MMSYSERR_NOERROR
, "expected MMSYSERR_NOERROR, got %u\n", mmio
.wErrorRet
);
435 ok(mmio
.fccIOProc
== (fname
? FOURCC_DOS
: FOURCC_MEM
), "got %4.4s\n", (LPCSTR
)&mmio
.fccIOProc
);
436 ok(mmio
.cchBuffer
== 256, "got %u\n", mmio
.cchBuffer
);
437 ok(mmio
.pchBuffer
!= NULL
, "expected not NULL\n");
438 ok(mmio
.pchBuffer
!= buf
, "expected != buf\n");
445 char fname
[] = "msrle.avi";
447 test_mmioDescend(NULL
);
448 test_mmioDescend(fname
);
450 test_mmioOpen(fname
);
451 test_mmioSetBuffer(NULL
);
452 test_mmioSetBuffer(fname
);