4 * Copyright 1998 Andrew Taylor
6 * NOTES: I/O is still unbuffered; mmioSetBuffer must be implemented
7 * and mmio{Read,Write,Seek,others?} need buffer support.
8 * Buffering should almost give us memory files for free.
24 /**************************************************************************
25 * mmioDosIOProc [internal]
27 static LRESULT
mmioDosIOProc(LPMMIOINFO16 lpmmioinfo
, UINT16 uMessage
, LPARAM lParam1
, LPARAM lParam2
) {
28 TRACE(mmio
, "(%p, %X, %ld, %ld);\n", lpmmioinfo
, uMessage
, lParam1
, lParam2
);
34 * lParam1 = szFileName parameter from mmioOpen
36 * Returns: zero on success, error code on error
37 * NOTE: lDiskOffset automatically set to zero
41 LPSTR szFileName
= (LPSTR
) lParam1
;
43 if (lpmmioinfo
->dwFlags
& MMIO_GETTEMP
) {
44 FIXME(mmio
, "MMIO_GETTEMP not implemented\n");
45 return MMIOERR_CANNOTOPEN
;
48 /* if filename NULL, assume open file handle in adwInfo[0] */
52 lpmmioinfo
->adwInfo
[0] =
53 (DWORD
) OpenFile32(szFileName
, &ofs
, lpmmioinfo
->dwFlags
);
54 if (lpmmioinfo
->adwInfo
[0] == -1)
55 return MMIOERR_CANNOTOPEN
;
62 * lParam1 = wFlags parameter from mmioClose
64 * Returns: zero on success, error code on error
67 UINT16 uFlags
= (UINT16
) lParam1
;
69 if (uFlags
& MMIO_FHOPEN
)
72 _lclose32((HFILE32
)lpmmioinfo
->adwInfo
[0]);
79 * lParam1 = huge pointer to read buffer
80 * lParam2 = number of bytes to read
81 * Returns: number of bytes read, 0 for EOF, -1 for error (error code
83 * NOTE: lDiskOffset should be updated
86 HPSTR pch
= (HPSTR
) lParam1
;
87 LONG cch
= (LONG
) lParam2
;
90 count
= _lread32((HFILE32
)lpmmioinfo
->adwInfo
[0], pch
, cch
);
92 lpmmioinfo
->lDiskOffset
+= count
;
98 case MMIOM_WRITEFLUSH
: {
99 /* no internal buffering, so WRITEFLUSH handled same as WRITE */
102 * lParam1 = huge pointer to write buffer
103 * lParam2 = number of bytes to write
104 * Returns: number of bytes written, -1 for error (error code in
106 * NOTE: lDiskOffset should be updated
109 HPSTR pch
= (HPSTR
) lParam1
;
110 LONG cch
= (LONG
) lParam2
;
113 count
= _hwrite16((HFILE32
)lpmmioinfo
->adwInfo
[0], pch
, cch
);
115 lpmmioinfo
->lDiskOffset
+= count
;
122 * lParam1 = new position
123 * lParam2 = from whence to seek (SEEK_SET, SEEK_CUR, SEEK_END)
124 * Returns: new file postion, -1 on error
125 * NOTE: lDiskOffset should be updated
128 LONG Offset
= (LONG
) lParam1
;
129 LONG Whence
= (LONG
) lParam2
;
132 pos
= _llseek32((HFILE32
)lpmmioinfo
->adwInfo
[0], Offset
, Whence
);
134 lpmmioinfo
->lDiskOffset
= pos
;
143 * Returns: zero on success, non-zero on failure
146 FIXME(mmio
, "MMIOM_RENAME unimplemented\n");
147 return MMIOERR_FILENOTFOUND
;
151 FIXME(mmio
, "unexpected message %u\n", uMessage
);
158 /**************************************************************************
159 * mmioMemIOProc [internal]
161 static LRESULT
mmioMemIOProc(LPMMIOINFO16 lpmmioinfo
, UINT16 uMessage
, LPARAM lParam1
, LPARAM lParam2
) {
162 FIXME(mmio
,"(%p,0x%04x,0x%08lx,0x%08lx), stub!\n",lpmmioinfo
,uMessage
,lParam1
,lParam2
);
166 /**************************************************************************
167 * mmioOpenW [WINMM.123]
169 HMMIO32 WINAPI
mmioOpen32W(LPWSTR szFileName
, MMIOINFO32
* lpmmioinfo
,
172 LPSTR szFn
= HEAP_strdupWtoA(GetProcessHeap(),0,szFileName
);
173 HMMIO32 ret
= mmioOpen16(szFn
,(LPMMIOINFO16
)lpmmioinfo
,dwOpenFlags
);
175 HeapFree(GetProcessHeap(),0,szFn
);
179 /**************************************************************************
180 * mmioOpenA [WINMM.122]
182 HMMIO32 WINAPI
mmioOpen32A(LPSTR szFileName
, MMIOINFO32
* lpmmioinfo
,
185 return mmioOpen16(szFileName
,(LPMMIOINFO16
)lpmmioinfo
,dwOpenFlags
);
188 /**************************************************************************
189 * mmioOpen [MMSYSTEM.1210]
191 HMMIO16 WINAPI
mmioOpen16(LPSTR szFileName
, MMIOINFO16
* lpmmioinfo
,
194 LPMMIOINFO16 lpmminfo
;
198 TRACE(mmio
, "('%s', %p, %08lX);\n", szFileName
, lpmmioinfo
, dwOpenFlags
);
200 hmmio
= GlobalAlloc16(GHND
, sizeof(MMIOINFO16
));
201 lpmminfo
= (LPMMIOINFO16
)GlobalLock16(hmmio
);
202 if (lpmminfo
== NULL
)
204 memset(lpmminfo
, 0, sizeof(MMIOINFO16
));
206 /* assume DOS file if not otherwise specified */
208 (lpmmioinfo
->fccIOProc
== 0 && lpmmioinfo
->pIOProc
== NULL
)) {
210 lpmminfo
->fccIOProc
= mmioFOURCC('D', 'O', 'S', ' ');
211 lpmminfo
->pIOProc
= (LPMMIOPROC16
) mmioDosIOProc
;
213 /* if just the four character code is present, look up IO proc */
214 else if (lpmmioinfo
->pIOProc
== NULL
) {
216 lpmminfo
->fccIOProc
= lpmmioinfo
->fccIOProc
;
217 lpmminfo
->pIOProc
= mmioInstallIOProc16(lpmmioinfo
->fccIOProc
, NULL
, MMIO_FINDPROC
);
220 /* if IO proc specified, use it and specified four character code */
223 lpmminfo
->fccIOProc
= lpmmioinfo
->fccIOProc
;
224 lpmminfo
->pIOProc
= lpmmioinfo
->pIOProc
;
227 if (dwOpenFlags
& MMIO_ALLOCBUF
) {
228 if ((result
= mmioSetBuffer(hmmio
, NULL
, MMIO_DEFAULTBUFFER
, 0))) {
230 lpmmioinfo
->wErrorRet
= result
;
235 lpmminfo
->hmmio
= hmmio
;
237 /* call IO proc to actually open file */
238 result
= (UINT16
) mmioSendMessage(hmmio
, MMIOM_OPEN
, (LPARAM
) szFileName
, (LPARAM
) 0);
240 GlobalUnlock16(hmmio
);
251 /**************************************************************************
252 * mmioClose [WINMM.114]
254 MMRESULT32 WINAPI
mmioClose32(HMMIO32 hmmio
, UINT32 uFlags
)
256 LPMMIOINFO16 lpmminfo
;
259 TRACE(mmio
, "(%04X, %04X);\n", hmmio
, uFlags
);
261 lpmminfo
= (LPMMIOINFO16
) GlobalLock16(hmmio
);
262 if (lpmminfo
== NULL
)
265 /* flush the file - if error reported, ignore */
266 if (mmioFlush32(hmmio
, MMIO_EMPTYBUF
) != 0)
267 lpmminfo
->dwFlags
&= ~MMIO_DIRTY
;
269 result
= mmioSendMessage(hmmio
,MMIOM_CLOSE
,(LPARAM
)uFlags
,(LPARAM
)0);
271 mmioSetBuffer(hmmio
, NULL
, 0, 0);
273 GlobalUnlock16(hmmio
);
280 /**************************************************************************
281 * mmioClose [MMSYSTEM.1211]
283 MMRESULT16 WINAPI
mmioClose16(HMMIO16 hmmio
, UINT16 uFlags
)
285 return mmioClose32(hmmio
,uFlags
);
290 /**************************************************************************
291 * mmioRead [WINM.124]
293 LONG WINAPI
mmioRead32(HMMIO32 hmmio
, HPSTR pch
, LONG cch
)
296 LPMMIOINFO16 lpmminfo
;
298 TRACE(mmio
, "(%04X, %p, %ld);\n", hmmio
, pch
, cch
);
300 lpmminfo
= (LPMMIOINFO16
)GlobalLock16(hmmio
);
301 if (lpmminfo
== NULL
)
304 count
= mmioSendMessage(hmmio
, MMIOM_READ
, (LPARAM
) pch
, (LPARAM
) cch
);
306 GlobalUnlock16(hmmio
);
307 TRACE(mmio
, "count=%ld\n", count
);
311 /**************************************************************************
312 * mmioRead [MMSYSTEM.1212]
314 LONG WINAPI
mmioRead16(HMMIO16 hmmio
, HPSTR pch
, LONG cch
)
316 return mmioRead32(hmmio
,pch
,cch
);
319 /**************************************************************************
320 * mmioWrite [WINMM.133]
322 LONG WINAPI
mmioWrite32(HMMIO32 hmmio
, HPCSTR pch
, LONG cch
)
325 LPMMIOINFO16 lpmminfo
;
327 TRACE(mmio
, "(%04X, %p, %ld);\n", hmmio
, pch
, cch
);
329 lpmminfo
= (LPMMIOINFO16
)GlobalLock16(hmmio
);
330 if (lpmminfo
== NULL
)
333 count
= mmioSendMessage(hmmio
, MMIOM_WRITE
, (LPARAM
) pch
, (LPARAM
) cch
);
335 GlobalUnlock16(hmmio
);
336 TRACE(mmio
, "count=%ld\n", count
);
340 /**************************************************************************
341 * mmioWrite [MMSYSTEM.1213]
343 LONG WINAPI
mmioWrite16(HMMIO16 hmmio
, HPCSTR pch
, LONG cch
)
345 return mmioWrite32(hmmio
,pch
,cch
);
348 /**************************************************************************
349 * mmioSeek [MMSYSTEM.1214]
351 LONG WINAPI
mmioSeek32(HMMIO32 hmmio
, LONG lOffset
, INT32 iOrigin
)
354 LPMMIOINFO16 lpmminfo
;
356 TRACE(mmio
, "(%04X, %08lX, %d);\n", hmmio
, lOffset
, iOrigin
);
358 lpmminfo
= (LPMMIOINFO16
)GlobalLock16(hmmio
);
359 if (lpmminfo
== NULL
)
362 offset
= mmioSendMessage(hmmio
, MMIOM_SEEK
, (LPARAM
) lOffset
, (LPARAM
) iOrigin
);
364 GlobalUnlock16(hmmio
);
368 /**************************************************************************
369 * mmioSeek [MMSYSTEM.1214]
371 LONG WINAPI
mmioSeek16(HMMIO16 hmmio
, LONG lOffset
, INT16 iOrigin
)
373 return mmioSeek32(hmmio
,lOffset
,iOrigin
);
376 /**************************************************************************
377 * mmioGetInfo [MMSYSTEM.1215]
379 UINT16 WINAPI
mmioGetInfo16(HMMIO16 hmmio
, MMIOINFO16
* lpmmioinfo
, UINT16 uFlags
)
381 LPMMIOINFO16 lpmminfo
;
382 TRACE(mmio
, "mmioGetInfo\n");
383 lpmminfo
= (LPMMIOINFO16
)GlobalLock16(hmmio
);
384 if (lpmminfo
== NULL
) return 0;
385 memcpy(lpmmioinfo
, lpmminfo
, sizeof(MMIOINFO16
));
386 GlobalUnlock16(hmmio
);
390 /**************************************************************************
391 * mmioGetInfo [WINMM.118]
393 UINT32 WINAPI
mmioGetInfo32(HMMIO32 hmmio
, MMIOINFO32
*lpmmioinfo
, UINT32 uFlags
)
396 LPMMIOINFO16 lpmminfo
=&mmioinfo
;
399 TRACE(mmio
, "(0x%04x,%p,0x%08x)\n",hmmio
,lpmmioinfo
,uFlags
);
400 ret
= mmioGetInfo16(hmmio
,&mmioinfo
,uFlags
);
403 lpmmioinfo
->dwFlags
= lpmminfo
->dwFlags
;
404 lpmmioinfo
->fccIOProc
= lpmminfo
->fccIOProc
;
405 lpmmioinfo
->pIOProc
= (LPMMIOPROC32
)lpmminfo
->pIOProc
;
406 lpmmioinfo
->wErrorRet
= lpmminfo
->wErrorRet
;
407 lpmmioinfo
->htask
= lpmminfo
->htask
;
408 lpmmioinfo
->cchBuffer
= lpmminfo
->cchBuffer
;
409 lpmmioinfo
->pchBuffer
= lpmminfo
->pchBuffer
;
410 lpmmioinfo
->pchNext
= lpmminfo
->pchNext
;
411 lpmmioinfo
->pchEndRead
= lpmminfo
->pchEndRead
;
412 lpmmioinfo
->pchEndWrite
= lpmminfo
->pchEndWrite
;
413 lpmmioinfo
->lBufOffset
= lpmminfo
->lBufOffset
;
414 lpmmioinfo
->lDiskOffset
= lpmminfo
->lDiskOffset
;
415 memcpy(lpmmioinfo
->adwInfo
,lpmminfo
->adwInfo
,sizeof(lpmminfo
->adwInfo
));
416 lpmmioinfo
->dwReserved1
= lpmminfo
->dwReserved1
;
417 lpmmioinfo
->dwReserved2
= lpmminfo
->dwReserved2
;
418 lpmmioinfo
->hmmio
= lpmminfo
->hmmio
;
422 /**************************************************************************
423 * mmioSetInfo [MMSYSTEM.1216]
425 UINT16 WINAPI
mmioSetInfo(HMMIO16 hmmio
, const MMIOINFO16
* lpmmioinfo
, UINT16 uFlags
)
427 LPMMIOINFO16 lpmminfo
;
428 TRACE(mmio
, "mmioSetInfo\n");
429 lpmminfo
= (LPMMIOINFO16
)GlobalLock16(hmmio
);
430 if (lpmminfo
== NULL
) return 0;
431 GlobalUnlock16(hmmio
);
435 /**************************************************************************
436 * mmioSetBuffer [MMSYSTEM.1217]
438 UINT16 WINAPI
mmioSetBuffer(HMMIO16 hmmio
, LPSTR pchBuffer
,
439 LONG cchBuffer
, UINT16 uFlags
)
441 FIXME(mmio
, "(hmmio=%d, pchBuf=%p, cchBuf=%ld, uFlags=%#08x): stub\n",
442 hmmio
, pchBuffer
, cchBuffer
, uFlags
);
444 /* stops Corel Draw 4 (16 bit) from working
445 return MMIOERR_OUTOFMEMORY;
449 /**************************************************************************
450 * mmioFlush [WINMM.117]
452 UINT32 WINAPI
mmioFlush32(HMMIO32 hmmio
, UINT32 uFlags
)
454 LPMMIOINFO16 lpmminfo
;
455 TRACE(mmio
, "(%04X, %04X)\n", hmmio
, uFlags
);
456 lpmminfo
= (LPMMIOINFO16
)GlobalLock16(hmmio
);
457 if (lpmminfo
== NULL
) return 0;
458 GlobalUnlock16(hmmio
);
462 /**************************************************************************
463 * mmioFlush [MMSYSTEM.1218]
465 UINT16 WINAPI
mmioFlush16(HMMIO16 hmmio
, UINT16 uFlags
)
467 return mmioFlush32(hmmio
,uFlags
);
470 /**************************************************************************
471 * mmioAdvance [MMSYSTEM.1219]
473 UINT32 WINAPI
mmioAdvance32(HMMIO32 hmmio
,MMIOINFO32
*lpmmioinfo
,UINT32 uFlags
)
476 LPMMIOINFO16 lpmminfo
;
477 TRACE(mmio
, "mmioAdvance\n");
478 lpmminfo
= (LPMMIOINFO16
)GlobalLock16(hmmio
);
479 if (lpmminfo
== NULL
) return 0;
480 if (uFlags
== MMIO_READ
)
481 count
= _lread32(LOWORD(lpmminfo
->adwInfo
[0]),
482 lpmmioinfo
->pchBuffer
, lpmmioinfo
->cchBuffer
);
483 if (uFlags
== MMIO_WRITE
)
484 count
= _lwrite32(LOWORD(lpmminfo
->adwInfo
[0]),
485 lpmmioinfo
->pchBuffer
, lpmmioinfo
->cchBuffer
);
486 lpmmioinfo
->pchNext
+= count
;
487 GlobalUnlock16(hmmio
);
488 lpmminfo
->lDiskOffset
= _llseek32((HFILE32
)lpmminfo
->adwInfo
[0], 0, SEEK_CUR
);
492 /**************************************************************************
493 * mmioAdvance [MMSYSTEM.1219]
495 UINT16 WINAPI
mmioAdvance16(HMMIO16 hmmio
,MMIOINFO16
*lpmmioinfo
,UINT16 uFlags
)
498 LPMMIOINFO16 lpmminfo
;
499 TRACE(mmio
, "mmioAdvance\n");
500 lpmminfo
= (LPMMIOINFO16
)GlobalLock16(hmmio
);
501 if (lpmminfo
== NULL
) return 0;
502 if (uFlags
== MMIO_READ
)
503 count
= _lread32(LOWORD(lpmminfo
->adwInfo
[0]),
504 lpmmioinfo
->pchBuffer
, lpmmioinfo
->cchBuffer
);
505 if (uFlags
== MMIO_WRITE
)
506 count
= _lwrite32(LOWORD(lpmminfo
->adwInfo
[0]),
507 lpmmioinfo
->pchBuffer
, lpmmioinfo
->cchBuffer
);
508 lpmmioinfo
->pchNext
+= count
;
509 GlobalUnlock16(hmmio
);
510 lpmminfo
->lDiskOffset
= _llseek32((HFILE32
)lpmminfo
->adwInfo
[0], 0, SEEK_CUR
);
514 /**************************************************************************
515 * mmioStringToFOURCCA [WINMM.131]
517 FOURCC WINAPI
mmioStringToFOURCC32A(LPCSTR sz
, UINT32 uFlags
)
519 return mmioStringToFOURCC16(sz
,uFlags
);
522 /**************************************************************************
523 * mmioStringToFOURCCW [WINMM.132]
525 FOURCC WINAPI
mmioStringToFOURCC32W(LPCWSTR sz
, UINT32 uFlags
)
527 LPSTR szA
= HEAP_strdupWtoA(GetProcessHeap(),0,sz
);
528 FOURCC ret
= mmioStringToFOURCC32A(szA
,uFlags
);
530 HeapFree(GetProcessHeap(),0,szA
);
534 /**************************************************************************
535 * mmioStringToFOURCC [MMSYSTEM.1220]
537 FOURCC WINAPI
mmioStringToFOURCC16(LPCSTR sz
, UINT16 uFlags
)
539 return mmioFOURCC(sz
[0],sz
[1],sz
[2],sz
[3]);
542 /**************************************************************************
543 * mmioInstallIOProc16 [MMSYSTEM.1221]
545 LPMMIOPROC16 WINAPI
mmioInstallIOProc16(FOURCC fccIOProc
,
546 LPMMIOPROC16 pIOProc
, DWORD dwFlags
)
548 TRACE(mmio
, "(%ld, %p, %08lX)\n",
549 fccIOProc
, pIOProc
, dwFlags
);
551 if (dwFlags
& MMIO_GLOBALPROC
) {
552 FIXME(mmio
, " global procedures not implemented\n");
555 /* just handle the known procedures for now */
556 switch(dwFlags
& (MMIO_INSTALLPROC
|MMIO_REMOVEPROC
|MMIO_FINDPROC
)) {
557 case MMIO_INSTALLPROC
:
559 case MMIO_REMOVEPROC
:
562 if (fccIOProc
== FOURCC_DOS
)
563 return (LPMMIOPROC16
) mmioDosIOProc
;
564 else if (fccIOProc
== FOURCC_MEM
)
565 return (LPMMIOPROC16
) mmioMemIOProc
;
573 /**************************************************************************
574 * mmioInstallIOProc32A [WINMM.120]
576 LPMMIOPROC32 WINAPI
mmioInstallIOProc32A(FOURCC fccIOProc
,
577 LPMMIOPROC32 pIOProc
, DWORD dwFlags
)
579 FIXME(mmio
, "(%c%c%c%c,%p,0x%08lx) -- empty stub \n",
580 (char)((fccIOProc
&0xff000000)>>24),
581 (char)((fccIOProc
&0x00ff0000)>>16),
582 (char)((fccIOProc
&0x0000ff00)>> 8),
583 (char)(fccIOProc
&0x000000ff),
588 /**************************************************************************
589 * mmioSendMessage [MMSYSTEM.1222]
591 LRESULT WINAPI
mmioSendMessage(HMMIO16 hmmio
, UINT16 uMessage
,
592 LPARAM lParam1
, LPARAM lParam2
)
594 LPMMIOINFO16 lpmminfo
;
596 const char *msg
= NULL
;
600 #define msgname(x) case x: msg = #x; break;
602 msgname(MMIOM_CLOSE
);
604 msgname(MMIOM_WRITE
);
605 msgname(MMIOM_WRITEFLUSH
);
607 msgname(MMIOM_RENAME
);
613 TRACE(mmio
, "(%04X, %s, %ld, %ld)\n",
614 hmmio
, msg
, lParam1
, lParam2
);
616 TRACE(mmio
, "(%04X, %u, %ld, %ld)\n",
617 hmmio
, uMessage
, lParam1
, lParam2
);
619 lpmminfo
= (LPMMIOINFO16
)GlobalLock16(hmmio
);
621 if (lpmminfo
&& lpmminfo
->pIOProc
)
622 result
= (*lpmminfo
->pIOProc
)((LPSTR
)lpmminfo
, uMessage
, lParam1
, lParam2
);
624 result
= MMSYSERR_INVALPARAM
;
626 GlobalUnlock16(hmmio
);
631 /**************************************************************************
632 * mmioDescend [MMSYSTEM.1223]
634 UINT16 WINAPI
mmioDescend(HMMIO16 hmmio
, MMCKINFO
* lpck
,
635 const MMCKINFO
* lpckParent
, UINT16 uFlags
)
637 DWORD dwfcc
, dwOldPos
;
639 TRACE(mmio
, "(%04X, %p, %p, %04X);\n",
640 hmmio
, lpck
, lpckParent
, uFlags
);
646 TRACE(mmio
, "dwfcc=%08lX\n", dwfcc
);
648 dwOldPos
= mmioSeek32(hmmio
, 0, SEEK_CUR
);
649 TRACE(mmio
, "dwOldPos=%ld\n", dwOldPos
);
651 if (lpckParent
!= NULL
) {
652 TRACE(mmio
, "seek inside parent at %ld !\n", lpckParent
->dwDataOffset
);
653 dwOldPos
= mmioSeek32(hmmio
,lpckParent
->dwDataOffset
,SEEK_SET
);
657 It seems to be that FINDRIFF should not be treated the same as the
658 other FINDxxx so I treat it as a MMIO_FINDxxx
660 if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDRIFF) ||
661 (uFlags & MMIO_FINDLIST)) {
663 if ((uFlags
& MMIO_FINDCHUNK
) || (uFlags
& MMIO_FINDLIST
)) {
664 TRACE(mmio
, "MMIO_FINDxxxx dwfcc=%08lX !\n", dwfcc
);
668 ix
= mmioRead32(hmmio
, (LPSTR
)lpck
, sizeof(MMCKINFO
));
669 TRACE(mmio
, "after _lread32 ix = %ld req = %d, errno = %d\n",ix
,sizeof(MMCKINFO
),errno
);
670 if (ix
< sizeof(MMCKINFO
)) {
672 mmioSeek32(hmmio
, dwOldPos
, SEEK_SET
);
673 WARN(mmio
, "return ChunkNotFound\n");
674 return MMIOERR_CHUNKNOTFOUND
;
676 TRACE(mmio
, "dwfcc=%08lX ckid=%08lX cksize=%08lX !\n",
677 dwfcc
, lpck
->ckid
, lpck
->cksize
);
678 if (dwfcc
== lpck
->ckid
)
681 dwOldPos
+= lpck
->cksize
+ 2 * sizeof(DWORD
);
682 if (lpck
->ckid
== FOURCC_RIFF
|| lpck
->ckid
== FOURCC_LIST
)
683 dwOldPos
+= sizeof(DWORD
);
684 mmioSeek32(hmmio
, dwOldPos
, SEEK_SET
);
688 if (mmioRead32(hmmio
, (LPSTR
)lpck
, sizeof(MMCKINFO
)) < sizeof(MMCKINFO
)) {
689 mmioSeek32(hmmio
, dwOldPos
, SEEK_SET
);
690 WARN(mmio
, "return ChunkNotFound 2nd\n");
691 return MMIOERR_CHUNKNOTFOUND
;
694 lpck
->dwDataOffset
= dwOldPos
+ 2 * sizeof(DWORD
);
695 if (lpck
->ckid
== FOURCC_RIFF
|| lpck
->ckid
== FOURCC_LIST
)
696 lpck
->dwDataOffset
+= sizeof(DWORD
);
697 mmioSeek32(hmmio
, lpck
->dwDataOffset
, SEEK_SET
);
699 TRACE(mmio
, "lpck->ckid=%08lX lpck->cksize=%ld !\n",
700 lpck
->ckid
, lpck
->cksize
);
701 TRACE(mmio
, "lpck->fccType=%08lX !\n", lpck
->fccType
);
706 /**************************************************************************
707 * mmioAscend [WINMM.113]
709 UINT32 WINAPI
mmioAscend32(HMMIO32 hmmio
, MMCKINFO
* lpck
, UINT32 uFlags
)
711 FIXME(mmio
, "empty stub !\n");
715 /**************************************************************************
716 * mmioAscend [MMSYSTEM.1224]
718 UINT16 WINAPI
mmioAscend16(HMMIO16 hmmio
, MMCKINFO
* lpck
, UINT16 uFlags
)
720 return mmioAscend32(hmmio
,lpck
,uFlags
);
723 /**************************************************************************
724 * mmioCreateChunk [MMSYSTEM.1225]
726 UINT16 WINAPI
mmioCreateChunk(HMMIO16 hmmio
, MMCKINFO
* lpck
, UINT16 uFlags
)
728 FIXME(mmio
, "empty stub \n");
733 /**************************************************************************
734 * mmioRename [MMSYSTEM.1226]
736 UINT16 WINAPI
mmioRename(LPCSTR szFileName
, LPCSTR szNewFileName
,
737 MMIOINFO16
* lpmmioinfo
, DWORD dwRenameFlags
)
740 LPMMIOINFO16 lpmminfo
;
743 TRACE(mmio
, "('%s', '%s', %p, %08lX);\n",
744 szFileName
, szNewFileName
, lpmmioinfo
, dwRenameFlags
);
746 hmmio
= GlobalAlloc16(GHND
, sizeof(MMIOINFO16
));
747 lpmminfo
= (LPMMIOINFO16
) GlobalLock16(hmmio
);
750 memcpy(lpmminfo
, lpmmioinfo
, sizeof(MMIOINFO16
));
752 /* assume DOS file if not otherwise specified */
753 if (lpmminfo
->fccIOProc
== 0 && lpmminfo
->pIOProc
== NULL
) {
755 lpmminfo
->fccIOProc
= mmioFOURCC('D', 'O', 'S', ' ');
756 lpmminfo
->pIOProc
= (LPMMIOPROC16
) mmioDosIOProc
;
759 /* if just the four character code is present, look up IO proc */
760 else if (lpmminfo
->pIOProc
== NULL
) {
762 lpmminfo
->pIOProc
= mmioInstallIOProc16(lpmminfo
->fccIOProc
, NULL
, MMIO_FINDPROC
);
765 /* (if IO proc specified, use it and specified four character code) */
767 result
= (UINT16
) mmioSendMessage(hmmio
, MMIOM_RENAME
, (LPARAM
) szFileName
, (LPARAM
) szNewFileName
);
769 GlobalUnlock16(hmmio
);