mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-02 05:15:01 +00:00
a845b88ead
Sun May 31 13:40:13 1998 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/signal.c] Added display of exception name. * [loader/task.c] Yet another attempt at fixing SwitchStackTo/SwitchStackBack. * [memory/selector.c] [relay32/builtin32.c] [tools/build.c] [win32/kernel32.c] Generate an assembly stub for Win32 register functions to make their names available at link time. * [programs/*/Makefile.in] Added hacks to support old resource compiler. Fri May 29 16:27:14 1998 Marcus Meissner <marcus@jet.franken.de> * [tools/testrun] Merge of my testscripts at home into one single perl program (tested with perl5). Works only on Linux due to 'ps' and 'ipcs' magic. * [controls/menu.c] Added some DefaultMenuItem stubs. * [debugger/stabs.c] Fixed stabs loading, now supports (int,int) typeinfo format used by gcc-2.8 and egcs-1. If it still crashes, please mail me. * [if1632/][relay32/] Added msvideo.dll (stubs only) Replaced some ptr by str for stringcases Added some new stubs (VxDCall, FindCloseNotif....) * [misc/network.c] Some argument fixes. * [misc/registry.c][misc/cpu.c] Registry initialization partially rewritten and enhanced. * [scheduler/*.c] Some additions so we don't do kill(0,SIGUSR1) (kill processgroup instead of targeted thread) Added SetThreadContext. Thu May 28 23:59:59 1998 Bertho Stultiens <bertho@akhphd.au.dk> * [tools/wrc/*] New resource compiler version 1.0.0 (28-May-1998) * [Make.rules.in] [Makefile.in] Changed and added rc rules to point to tools/wrc/wrc. * [configure.in] [include/config.h.in] Added check for function 'stricmp'. * [include/resource.h] Commented out the old resource structure to catch references. It also includes wrc_rsc.h. * [include/wrc_rsc.h] New file. Definitions for the resources generated with wrc. * [include/windows.h] Added #ifdef RC_INVOKED to exclude stdarg.h. Added SS_NOTIFY flag. * [include/winnls.h] Added SUBLANG_* definitions and corrected some defaults. * [loader/libres.c] Changed the sysres load functions to support wrc generated resources. * [resource/sysres_*.rc] Added #include <windows.h> * [resource/sysres.c] Changed declarations to match wrc's output * [resource/Makefile.in] Changed rules to work with wrc. * [tools/makedep.c] Changed generation of .rc file dependencies to .s target. Thu May 28 22:28:39 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de> * [files/file.c][include/windows.c][relay32/kernel32.spec] Implemented GetFileAttributesEx32A/W. * [misc/imagelist.h][include/commctrl.h][relay32/comctl32.spec] Added ImageList_Read and ImageList_Write stubs. Added ImageList_AddIcon function. Added ImageList_LoadImage. It is the same as ImageList_LoadImage32A. * [controls/header.c] Fixed bitmap drawing bug. Added full bitmap support. * [include/commctrl.h] Added missing header macros. * [controls/toolbar.c][include/toolbar.h][include/commctrl.h] [controls/commctrl.c] [relay32/comctl32.spec] First implementation of toolbar control. Implemented CreateToolbar, CreateToolbarEx and CreateMappedBitmap. * [controls/progress.c][controls/status.c] Some code cleanup. * [controls/commctrl.c][include/commctrl.h][relay32/comctl32.spec] Removed CreateStatusWindow16 and DrawStatusText16. CreateStatusWindow is the same as CreateStatusWindow32A. DrawStatusText is the same as DrawStatusText32A. Thu May 28 16:01:28 1998 Matthew J. Francis <asbel@dial.pipex.com> * [objects/bitmap.c] [objects/bitmap.h] [objects/oembitmap.c] [objects/dc.c] [graphics/x11drv/bitblt.c] Added partial implementation of CreateDIBSection, with great thanks to Ulrich Weigand <weigand@informatik.uni-erlangen.de> for contributing the bulk of the patch. Wed May 27 19:04:31 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de> * [win32/kernel32.c] [if1632/thunk.c] [include/flatthunk.h] ThunkConnect16 and related functions moved to emulator. * [loader/ne/segment.c] Call DllEntryPoint with correct arguments. * [relay32/builtin32.c] Bugfix: Relay debugging did not work for multiple processes. * [controls/menu.c] Bugfix: dwItemData was not set for MF_OWNERDRAW menus. * [if1632/relay.c] [relay32/relay386.c] Relay messages converted to use DPRINTF. * [controls/desktop.c] [relay32/user32.spec] Implemented PaintDesktop. * [files/profile.c] [if1632/kernel.spec] [misc/network.c] [misc/printdrv.c] [relay32/winspool.spec] [win32/ordinals.c] [relay32/kernel32.spec] Some stubs added. * [relay32/mpr.spec] All ordinals were off by one. Tue May 26 13:32:57 1998 Bill Hawes <whawes@star.net> * [misc/lstr.c] [include/casemap.h] [tools/unimap.pl] Added Unicode case conversion routines towupper/towlower, with mapping tables casemap.h created by tools/unimap.pl. * [misc/ntdll.c] [include/winnls.h] [relay32/ntdll.spec] [relay32/advapi.spec] Minimal implementation of IsTextUnicode, just enough to get NT4 notepad to open ascii/unicode files. * [Make.rules.in] [resources/sysres_En.rc] Added include file dlgs.h for building resource files, so that resources can refer to defined values (e.g. pshHelp). * [misc/crtdll.c] [relay32/crtdll.spec] Use towupper/towlower for 32W case conversions. * [memory/string.c] Use towupper for 32W case conversions. * [ole/ole2nls.c] Use towupper for 32W case conversions; fix mem leak; minor cleanup * [controls/edit.c] Added soft break flag to edit state. Print unknown action values for WM_VSCROLL (action 190 occurs when running NT4 notepad.) Mon May 25 22:42:40 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> * [files/file.c] Care for a pathological case in SetFilePointer. * [graphics/x11drv/xfont.c] Handle longer Font names in LFD_ComposeLFD and try to catch errors. * [loader/pe_image.c] Unload Dummymodule when PE_LoadLibraryEx32A fails with PE_LoadImage (makes Encarta 98 installer proceed). * [misc/registry.c] Move a check for a special case in RegCreateKeyEx32W after the check for existence. Tue May 25 20:18:26 1998 Matthew Becker <mbecker@glasscity.net> * [misc/ntdll.c] Added some stubs, just guessing at the size of their param lists. * [misc/registry.c] Added stubs for RegUnLoadKey, RegSetKeySecurity, RegSaveKey, RegRestoreKey, and RegReplaceKey * [programs/regtest/regtest.c] Updated registry testing program. Sun May 24 18:11:40 1998 Alex Priem <alexp@sci.kun.nl> * [file/profile.c] Added flag 'return_values' to PROFILE_GetSection. Sun May 24 13:41:10 1998 James Juran <jrj120@psu.edu> * [misc/shell.c] [files/directory.c] Documentation/debugging info additions. * [*/*.c] [include/*.h] Moved many extern function definitions to appropriate header files. Cleaned up a few compile warnings. If #include "debug.h" is present, removed #include <stdio.h>. debug.h includes stdio.h, so it is not necessary to include both. * [graphics/*.c] [if1632/signal.c] [ipc/*.c] [scheduler/*.c] [win32/*.c] [windows/*.c] Final patch to convert fprintf statements to new debugging interface. Some fprintfs are still left, especially in the debugger/ directory. However, IMHO, it's not worth the effort to change the rest. Fri May 22 21:58:35 1998 Morten Welinder <terra@diku.dk> * [windows/keyboard.c] Correct handling of keys "`-=[]\;',./". Fri May 22 12:06:00 1998 Per Lindström <pelinstr@algonet.se> * [include/windows.h] [relay32/kernel32.spec] [win32/console.c] Added stub for ReadConsoleOutputCharacter32A. Thu May 21 16:45:48 1998 Pascal Cuoq <pcuoq@ens-lyon.fr> * [ole/ole2nls.c] Began better implementation of LCMapString32A. Not very well tested yet, and still need improvements. * [controls/scroll.c] Documented functions. Wed May 20 21:37:56 1998 Peter Hunnisett <hunnise@nortel.ca> * [include/windows.h][misc/main.c] Change SystemParameterInfo to support SPI_GETHIGHCONTRAST. Also include some missing SPI_ definitions. * [include/dsound.h][multimedia/dsound.c][relay32/dplayx.spec] Added stubs for DirectPlayLobbyCreate[AW]. Not sure if these should go into a new files dplayx.c? Anyone care? * [include/winnls.h] Added two missing flags for the CompareString32 functions.
675 lines
18 KiB
C
675 lines
18 KiB
C
/*
|
|
* MMIO functions
|
|
*
|
|
* Copyright 1998 Andrew Taylor
|
|
*
|
|
* NOTES: I/O is still unbuffered; mmioSetBuffer must be implemented
|
|
* and mmio{Read,Write,Seek,others?} need buffer support.
|
|
* Buffering should almost give us memory files for free.
|
|
*/
|
|
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include "windows.h"
|
|
#include "win.h"
|
|
#include "heap.h"
|
|
#include "user.h"
|
|
#include "file.h"
|
|
#include "mmsystem.h"
|
|
#include "debug.h"
|
|
#include "xmalloc.h"
|
|
|
|
/**************************************************************************
|
|
* mmioDosIOProc [internal]
|
|
*/
|
|
static LRESULT mmioDosIOProc(LPMMIOINFO16 lpmmioinfo, UINT16 uMessage, LPARAM lParam1, LPARAM lParam2) {
|
|
TRACE(mmio, "(%p, %X, %ld, %ld);\n", lpmmioinfo, uMessage, lParam1, lParam2);
|
|
|
|
switch (uMessage) {
|
|
|
|
case MMIOM_OPEN: {
|
|
/* Parameters:
|
|
* lParam1 = szFileName parameter from mmioOpen
|
|
* lParam2 = unused
|
|
* Returns: zero on success, error code on error
|
|
* NOTE: lDiskOffset automatically set to zero
|
|
*/
|
|
|
|
OFSTRUCT ofs;
|
|
LPSTR szFileName = (LPSTR) lParam1;
|
|
|
|
if (lpmmioinfo->dwFlags & MMIO_GETTEMP) {
|
|
FIXME(mmio, "MMIO_GETTEMP not implemented\n");
|
|
return MMIOERR_CANNOTOPEN;
|
|
}
|
|
|
|
/* if filename NULL, assume open file handle in adwInfo[0] */
|
|
if (!szFileName)
|
|
return 0;
|
|
|
|
lpmmioinfo->adwInfo[0] =
|
|
(DWORD) OpenFile32(szFileName, &ofs, lpmmioinfo->dwFlags);
|
|
if (lpmmioinfo->adwInfo[0] == -1)
|
|
return MMIOERR_CANNOTOPEN;
|
|
|
|
return 0;
|
|
}
|
|
|
|
case MMIOM_CLOSE: {
|
|
/* Parameters:
|
|
* lParam1 = wFlags parameter from mmioClose
|
|
* lParam2 = unused
|
|
* Returns: zero on success, error code on error
|
|
*/
|
|
|
|
UINT16 uFlags = (UINT16) lParam1;
|
|
|
|
if (uFlags & MMIO_FHOPEN)
|
|
return 0;
|
|
|
|
_lclose32((HFILE32)lpmmioinfo->adwInfo[0]);
|
|
return 0;
|
|
|
|
}
|
|
|
|
case MMIOM_READ: {
|
|
/* Parameters:
|
|
* lParam1 = huge pointer to read buffer
|
|
* lParam2 = number of bytes to read
|
|
* Returns: number of bytes read, 0 for EOF, -1 for error (error code
|
|
* in wErrorRet)
|
|
* NOTE: lDiskOffset should be updated
|
|
*/
|
|
|
|
HPSTR pch = (HPSTR) lParam1;
|
|
LONG cch = (LONG) lParam2;
|
|
LONG count;
|
|
|
|
count = _lread32((HFILE32)lpmmioinfo->adwInfo[0], pch, cch);
|
|
if (count != -1)
|
|
lpmmioinfo->lDiskOffset += count;
|
|
|
|
return count;
|
|
}
|
|
|
|
case MMIOM_WRITE:
|
|
case MMIOM_WRITEFLUSH: {
|
|
/* no internal buffering, so WRITEFLUSH handled same as WRITE */
|
|
|
|
/* Parameters:
|
|
* lParam1 = huge pointer to write buffer
|
|
* lParam2 = number of bytes to write
|
|
* Returns: number of bytes written, -1 for error (error code in
|
|
* wErrorRet)
|
|
* NOTE: lDiskOffset should be updated
|
|
*/
|
|
|
|
HPSTR pch = (HPSTR) lParam1;
|
|
LONG cch = (LONG) lParam2;
|
|
LONG count;
|
|
|
|
count = _hwrite16((HFILE32)lpmmioinfo->adwInfo[0], pch, cch);
|
|
if (count != -1)
|
|
lpmmioinfo->lDiskOffset += count;
|
|
|
|
return count;
|
|
}
|
|
|
|
case MMIOM_SEEK: {
|
|
/* Parameters:
|
|
* lParam1 = new position
|
|
* lParam2 = from whence to seek (SEEK_SET, SEEK_CUR, SEEK_END)
|
|
* Returns: new file postion, -1 on error
|
|
* NOTE: lDiskOffset should be updated
|
|
*/
|
|
|
|
LONG Offset = (LONG) lParam1;
|
|
LONG Whence = (LONG) lParam2;
|
|
LONG pos;
|
|
|
|
pos = _llseek32((HFILE32)lpmmioinfo->adwInfo[0], Offset, Whence);
|
|
if (pos != -1)
|
|
lpmmioinfo->lDiskOffset = pos;
|
|
|
|
return pos;
|
|
}
|
|
|
|
case MMIOM_RENAME: {
|
|
/* Parameters:
|
|
* lParam1 = old name
|
|
* lParam2 = new name
|
|
* Returns: zero on success, non-zero on failure
|
|
*/
|
|
|
|
FIXME(mmio, "MMIOM_RENAME unimplemented\n");
|
|
return MMIOERR_FILENOTFOUND;
|
|
}
|
|
|
|
default:
|
|
WARN(mmio, "unexpected message %u\n", uMessage);
|
|
return 0;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioDosIOProc [internal]
|
|
*/
|
|
static LRESULT mmioMemIOProc(LPMMIOINFO16 lpmmioinfo, UINT16 uMessage, LPARAM lParam1, LPARAM lParam2) {
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioOpenW [WINMM.123]
|
|
*/
|
|
HMMIO32 WINAPI mmioOpen32W(LPWSTR szFileName, MMIOINFO32 * lpmmioinfo,
|
|
DWORD dwOpenFlags)
|
|
{
|
|
LPSTR szFn = HEAP_strdupWtoA(GetProcessHeap(),0,szFileName);
|
|
HMMIO32 ret = mmioOpen16(szFn,(LPMMIOINFO16)lpmmioinfo,dwOpenFlags);
|
|
|
|
HeapFree(GetProcessHeap(),0,szFn);
|
|
return ret;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioOpenA [WINMM.122]
|
|
*/
|
|
HMMIO32 WINAPI mmioOpen32A(LPSTR szFileName, MMIOINFO32 * lpmmioinfo,
|
|
DWORD dwOpenFlags)
|
|
{
|
|
return mmioOpen16(szFileName,(LPMMIOINFO16)lpmmioinfo,dwOpenFlags);
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioOpen [MMSYSTEM.1210]
|
|
*/
|
|
HMMIO16 WINAPI mmioOpen16(LPSTR szFileName, MMIOINFO16 * lpmmioinfo,
|
|
DWORD dwOpenFlags)
|
|
{
|
|
LPMMIOINFO16 lpmminfo;
|
|
HMMIO16 hmmio;
|
|
UINT16 result;
|
|
|
|
TRACE(mmio, "('%s', %p, %08lX);\n", szFileName, lpmmioinfo, dwOpenFlags);
|
|
|
|
hmmio = GlobalAlloc16(GHND, sizeof(MMIOINFO16));
|
|
lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
|
|
if (lpmminfo == NULL)
|
|
return 0;
|
|
memset(lpmminfo, 0, sizeof(MMIOINFO16));
|
|
|
|
/* assume DOS file if not otherwise specified */
|
|
if (!lpmmioinfo ||
|
|
(lpmmioinfo->fccIOProc == 0 && lpmmioinfo->pIOProc == NULL)) {
|
|
|
|
lpmminfo->fccIOProc = mmioFOURCC('D', 'O', 'S', ' ');
|
|
lpmminfo->pIOProc = (LPMMIOPROC16) mmioDosIOProc;
|
|
}
|
|
/* if just the four character code is present, look up IO proc */
|
|
else if (lpmmioinfo->pIOProc == NULL) {
|
|
|
|
lpmminfo->fccIOProc = lpmmioinfo->fccIOProc;
|
|
lpmminfo->pIOProc = mmioInstallIOProc16(lpmmioinfo->fccIOProc, NULL, MMIO_FINDPROC);
|
|
|
|
}
|
|
/* if IO proc specified, use it and specified four character code */
|
|
else {
|
|
|
|
lpmminfo->fccIOProc = lpmmioinfo->fccIOProc;
|
|
lpmminfo->pIOProc = lpmmioinfo->pIOProc;
|
|
}
|
|
|
|
if (dwOpenFlags & MMIO_ALLOCBUF) {
|
|
if ((result = mmioSetBuffer(hmmio, NULL, MMIO_DEFAULTBUFFER, 0))) {
|
|
if (lpmmioinfo)
|
|
lpmmioinfo->wErrorRet = result;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
lpmminfo->hmmio = hmmio;
|
|
|
|
/* call IO proc to actually open file */
|
|
result = (UINT16) mmioSendMessage(hmmio, MMIOM_OPEN, (LPARAM) szFileName, (LPARAM) 0);
|
|
|
|
GlobalUnlock16(hmmio);
|
|
|
|
if (result != 0) {
|
|
GlobalFree16(hmmio);
|
|
return 0;
|
|
}
|
|
|
|
return hmmio;
|
|
}
|
|
|
|
|
|
/**************************************************************************
|
|
* mmioClose [MMSYSTEM.1211]
|
|
*/
|
|
UINT16 WINAPI mmioClose(HMMIO16 hmmio, UINT16 uFlags)
|
|
{
|
|
LPMMIOINFO16 lpmminfo;
|
|
UINT16 result;
|
|
|
|
TRACE(mmio, "(%04X, %04X);\n", hmmio, uFlags);
|
|
|
|
lpmminfo = (LPMMIOINFO16) GlobalLock16(hmmio);
|
|
if (lpmminfo == NULL)
|
|
return 0;
|
|
|
|
/* flush the file - if error reported, ignore */
|
|
if (mmioFlush(hmmio, MMIO_EMPTYBUF) != 0)
|
|
lpmminfo->dwFlags &= ~MMIO_DIRTY;
|
|
|
|
result = (UINT16) mmioSendMessage(hmmio, MMIOM_CLOSE, (LPARAM) uFlags, (LPARAM) 0);
|
|
|
|
mmioSetBuffer(hmmio, NULL, 0, 0);
|
|
|
|
GlobalUnlock16(hmmio);
|
|
GlobalFree16(hmmio);
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
* mmioRead [MMSYSTEM.1212]
|
|
*/
|
|
LONG WINAPI mmioRead(HMMIO16 hmmio, HPSTR pch, LONG cch)
|
|
{
|
|
LONG count;
|
|
LPMMIOINFO16 lpmminfo;
|
|
|
|
TRACE(mmio, "(%04X, %p, %ld);\n", hmmio, pch, cch);
|
|
|
|
lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
|
|
if (lpmminfo == NULL)
|
|
return -1;
|
|
|
|
count = mmioSendMessage(hmmio, MMIOM_READ, (LPARAM) pch, (LPARAM) cch);
|
|
|
|
GlobalUnlock16(hmmio);
|
|
TRACE(mmio, "count=%ld\n", count);
|
|
return count;
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
* mmioWrite [MMSYSTEM.1213]
|
|
*/
|
|
LONG WINAPI mmioWrite(HMMIO16 hmmio, HPCSTR pch, LONG cch)
|
|
{
|
|
LONG count;
|
|
LPMMIOINFO16 lpmminfo;
|
|
|
|
TRACE(mmio, "(%04X, %p, %ld);\n", hmmio, pch, cch);
|
|
|
|
lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
|
|
if (lpmminfo == NULL)
|
|
return -1;
|
|
|
|
count = mmioSendMessage(hmmio, MMIOM_WRITE, (LPARAM) pch, (LPARAM) cch);
|
|
|
|
GlobalUnlock16(hmmio);
|
|
TRACE(mmio, "count=%ld\n", count);
|
|
return count;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioSeek [MMSYSTEM.1214]
|
|
*/
|
|
LONG WINAPI mmioSeek(HMMIO16 hmmio, LONG lOffset, int iOrigin)
|
|
{
|
|
int offset;
|
|
LPMMIOINFO16 lpmminfo;
|
|
|
|
TRACE(mmio, "(%04X, %08lX, %d);\n", hmmio, lOffset, iOrigin);
|
|
|
|
lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
|
|
if (lpmminfo == NULL)
|
|
return 0;
|
|
|
|
offset = mmioSendMessage(hmmio, MMIOM_SEEK, (LPARAM) lOffset, (LPARAM) iOrigin);
|
|
|
|
GlobalUnlock16(hmmio);
|
|
return offset;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioGetInfo [MMSYSTEM.1215]
|
|
*/
|
|
UINT16 WINAPI mmioGetInfo(HMMIO16 hmmio, MMIOINFO16 * lpmmioinfo, UINT16 uFlags)
|
|
{
|
|
LPMMIOINFO16 lpmminfo;
|
|
TRACE(mmio, "mmioGetInfo\n");
|
|
lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
|
|
if (lpmminfo == NULL) return 0;
|
|
memcpy(lpmmioinfo, lpmminfo, sizeof(MMIOINFO16));
|
|
GlobalUnlock16(hmmio);
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioSetInfo [MMSYSTEM.1216]
|
|
*/
|
|
UINT16 WINAPI mmioSetInfo(HMMIO16 hmmio, const MMIOINFO16 * lpmmioinfo, UINT16 uFlags)
|
|
{
|
|
LPMMIOINFO16 lpmminfo;
|
|
TRACE(mmio, "mmioSetInfo\n");
|
|
lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
|
|
if (lpmminfo == NULL) return 0;
|
|
GlobalUnlock16(hmmio);
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioSetBuffer [MMSYSTEM.1217]
|
|
*/
|
|
UINT16 WINAPI mmioSetBuffer(HMMIO16 hmmio, LPSTR pchBuffer,
|
|
LONG cchBuffer, UINT16 uFlags)
|
|
{
|
|
FIXME(mmio, "(hmmio=%d, pchBuf=%p, cchBuf=%ld, uFlags=%#08x): stub\n",
|
|
hmmio, pchBuffer, cchBuffer, uFlags);
|
|
return (UINT16) 0;
|
|
/* stops Corel Draw 4 (16 bit) from working
|
|
return MMIOERR_OUTOFMEMORY;
|
|
*/
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioFlush [MMSYSTEM.1218]
|
|
*/
|
|
UINT16 WINAPI mmioFlush(HMMIO16 hmmio, UINT16 uFlags)
|
|
{
|
|
LPMMIOINFO16 lpmminfo;
|
|
TRACE(mmio, "(%04X, %04X)\n", hmmio, uFlags);
|
|
lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
|
|
if (lpmminfo == NULL) return 0;
|
|
GlobalUnlock16(hmmio);
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioAdvance [MMSYSTEM.1219]
|
|
*/
|
|
UINT16 WINAPI mmioAdvance(HMMIO16 hmmio, MMIOINFO16 * lpmmioinfo, UINT16 uFlags)
|
|
{
|
|
int count = 0;
|
|
LPMMIOINFO16 lpmminfo;
|
|
TRACE(mmio, "mmioAdvance\n");
|
|
lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
|
|
if (lpmminfo == NULL) return 0;
|
|
if (uFlags == MMIO_READ) {
|
|
count = _lread32(LOWORD(lpmminfo->adwInfo[0]),
|
|
lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer);
|
|
}
|
|
if (uFlags == MMIO_WRITE) {
|
|
count = _lwrite32(LOWORD(lpmminfo->adwInfo[0]),
|
|
lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer);
|
|
}
|
|
lpmmioinfo->pchNext += count;
|
|
GlobalUnlock16(hmmio);
|
|
lpmminfo->lDiskOffset = _llseek32((HFILE32)lpmminfo->adwInfo[0], 0, SEEK_CUR);
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioStringToFOURCCA [WINMM.131]
|
|
*/
|
|
FOURCC WINAPI mmioStringToFOURCC32A(LPCSTR sz, UINT32 uFlags)
|
|
{
|
|
return mmioStringToFOURCC16(sz,uFlags);
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioStringToFOURCCW [WINMM.132]
|
|
*/
|
|
FOURCC WINAPI mmioStringToFOURCC32W(LPCWSTR sz, UINT32 uFlags)
|
|
{
|
|
LPSTR szA = HEAP_strdupWtoA(GetProcessHeap(),0,sz);
|
|
FOURCC ret = mmioStringToFOURCC32A(szA,uFlags);
|
|
|
|
HeapFree(GetProcessHeap(),0,szA);
|
|
return ret;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioStringToFOURCC [MMSYSTEM.1220]
|
|
*/
|
|
FOURCC WINAPI mmioStringToFOURCC16(LPCSTR sz, UINT16 uFlags)
|
|
{
|
|
FIXME(mmio, "empty stub \n");
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioInstallIOProc16 [MMSYSTEM.1221]
|
|
*/
|
|
LPMMIOPROC16 WINAPI mmioInstallIOProc16(FOURCC fccIOProc,
|
|
LPMMIOPROC16 pIOProc, DWORD dwFlags)
|
|
{
|
|
TRACE(mmio, "(%ld, %p, %08lX)\n",
|
|
fccIOProc, pIOProc, dwFlags);
|
|
|
|
if (dwFlags & MMIO_GLOBALPROC) {
|
|
FIXME(mmio, " global procedures not implemented\n");
|
|
}
|
|
|
|
/* just handle the known procedures for now */
|
|
switch(dwFlags & (MMIO_INSTALLPROC|MMIO_REMOVEPROC|MMIO_FINDPROC)) {
|
|
case MMIO_INSTALLPROC:
|
|
return NULL;
|
|
case MMIO_REMOVEPROC:
|
|
return NULL;
|
|
case MMIO_FINDPROC:
|
|
if (fccIOProc == FOURCC_DOS)
|
|
return (LPMMIOPROC16) mmioDosIOProc;
|
|
else if (fccIOProc == FOURCC_MEM)
|
|
return (LPMMIOPROC16) mmioMemIOProc;
|
|
else
|
|
return NULL;
|
|
default:
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioInstallIOProc32A [WINMM.120]
|
|
*/
|
|
LPMMIOPROC32 WINAPI mmioInstallIOProc32A(FOURCC fccIOProc,
|
|
LPMMIOPROC32 pIOProc, DWORD dwFlags)
|
|
{
|
|
FIXME(mmio, "(%c%c%c%c,%p,0x%08lx) -- empty stub \n",
|
|
(char)((fccIOProc&0xff000000)>>24),
|
|
(char)((fccIOProc&0x00ff0000)>>16),
|
|
(char)((fccIOProc&0x0000ff00)>> 8),
|
|
(char)(fccIOProc&0x000000ff),
|
|
pIOProc, dwFlags );
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioSendMessage [MMSYSTEM.1222]
|
|
*/
|
|
LRESULT WINAPI mmioSendMessage(HMMIO16 hmmio, UINT16 uMessage,
|
|
LPARAM lParam1, LPARAM lParam2)
|
|
{
|
|
LPMMIOINFO16 lpmminfo;
|
|
LRESULT result;
|
|
const char *msg = NULL;
|
|
|
|
#ifdef DEBUG_RUNTIME
|
|
switch (uMessage) {
|
|
#define msgname(x) case x: msg = #x; break;
|
|
msgname(MMIOM_OPEN);
|
|
msgname(MMIOM_CLOSE);
|
|
msgname(MMIOM_READ);
|
|
msgname(MMIOM_WRITE);
|
|
msgname(MMIOM_WRITEFLUSH);
|
|
msgname(MMIOM_SEEK);
|
|
msgname(MMIOM_RENAME);
|
|
#undef msgname
|
|
}
|
|
#endif
|
|
|
|
if (msg)
|
|
TRACE(mmio, "(%04X, %s, %ld, %ld)\n",
|
|
hmmio, msg, lParam1, lParam2);
|
|
else
|
|
TRACE(mmio, "(%04X, %u, %ld, %ld)\n",
|
|
hmmio, uMessage, lParam1, lParam2);
|
|
|
|
lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
|
|
|
|
if (lpmminfo && lpmminfo->pIOProc)
|
|
result = (*lpmminfo->pIOProc)((LPSTR)lpmminfo, uMessage, lParam1, lParam2);
|
|
else
|
|
result = MMSYSERR_INVALPARAM;
|
|
|
|
GlobalUnlock16(hmmio);
|
|
|
|
return result;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioDescend [MMSYSTEM.1223]
|
|
*/
|
|
UINT16 WINAPI mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck,
|
|
const MMCKINFO * lpckParent, UINT16 uFlags)
|
|
{
|
|
DWORD dwfcc, dwOldPos;
|
|
|
|
TRACE(mmio, "(%04X, %p, %p, %04X);\n",
|
|
hmmio, lpck, lpckParent, uFlags);
|
|
|
|
if (lpck == NULL)
|
|
return 0;
|
|
|
|
dwfcc = lpck->ckid;
|
|
TRACE(mmio, "dwfcc=%08lX\n", dwfcc);
|
|
|
|
dwOldPos = mmioSeek(hmmio, 0, SEEK_CUR);
|
|
TRACE(mmio, "dwOldPos=%ld\n", dwOldPos);
|
|
|
|
if (lpckParent != NULL) {
|
|
TRACE(mmio, "seek inside parent at %ld !\n", lpckParent->dwDataOffset);
|
|
dwOldPos = mmioSeek(hmmio, lpckParent->dwDataOffset, SEEK_SET);
|
|
}
|
|
/*
|
|
|
|
It seems to be that FINDRIFF should not be treated the same as the
|
|
other FINDxxx so I treat it as a MMIO_FINDxxx
|
|
|
|
if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDRIFF) ||
|
|
(uFlags & MMIO_FINDLIST)) {
|
|
*/
|
|
if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDLIST)) {
|
|
TRACE(mmio, "MMIO_FINDxxxx dwfcc=%08lX !\n", dwfcc);
|
|
while (TRUE) {
|
|
LONG ix;
|
|
|
|
ix = mmioRead(hmmio, (LPSTR)lpck, sizeof(MMCKINFO));
|
|
TRACE(mmio, "after _lread32 ix = %ld req = %d, errno = %d\n",ix,sizeof(MMCKINFO),errno);
|
|
if (ix < sizeof(MMCKINFO)) {
|
|
|
|
mmioSeek(hmmio, dwOldPos, SEEK_SET);
|
|
WARN(mmio, "return ChunkNotFound\n");
|
|
return MMIOERR_CHUNKNOTFOUND;
|
|
}
|
|
TRACE(mmio, "dwfcc=%08lX ckid=%08lX cksize=%08lX !\n",
|
|
dwfcc, lpck->ckid, lpck->cksize);
|
|
if (dwfcc == lpck->ckid)
|
|
break;
|
|
|
|
dwOldPos += lpck->cksize + 2 * sizeof(DWORD);
|
|
if (lpck->ckid == FOURCC_RIFF || lpck->ckid == FOURCC_LIST)
|
|
dwOldPos += sizeof(DWORD);
|
|
mmioSeek(hmmio, dwOldPos, SEEK_SET);
|
|
}
|
|
}
|
|
else {
|
|
if (mmioRead(hmmio, (LPSTR)lpck, sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
|
|
mmioSeek(hmmio, dwOldPos, SEEK_SET);
|
|
WARN(mmio, "return ChunkNotFound 2nd\n");
|
|
return MMIOERR_CHUNKNOTFOUND;
|
|
}
|
|
}
|
|
lpck->dwDataOffset = dwOldPos + 2 * sizeof(DWORD);
|
|
if (lpck->ckid == FOURCC_RIFF || lpck->ckid == FOURCC_LIST)
|
|
lpck->dwDataOffset += sizeof(DWORD);
|
|
mmioSeek(hmmio, lpck->dwDataOffset, SEEK_SET);
|
|
|
|
TRACE(mmio, "lpck->ckid=%08lX lpck->cksize=%ld !\n",
|
|
lpck->ckid, lpck->cksize);
|
|
TRACE(mmio, "lpck->fccType=%08lX !\n", lpck->fccType);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioAscend [MMSYSTEM.1224]
|
|
*/
|
|
UINT16 WINAPI mmioAscend(HMMIO16 hmmio, MMCKINFO * lpck, UINT16 uFlags)
|
|
{
|
|
FIXME(mmio, "empty stub !\n");
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
* mmioCreateChunk [MMSYSTEM.1225]
|
|
*/
|
|
UINT16 WINAPI mmioCreateChunk(HMMIO16 hmmio, MMCKINFO * lpck, UINT16 uFlags)
|
|
{
|
|
FIXME(mmio, "empty stub \n");
|
|
return 0;
|
|
}
|
|
|
|
|
|
/**************************************************************************
|
|
* mmioRename [MMSYSTEM.1226]
|
|
*/
|
|
UINT16 WINAPI mmioRename(LPCSTR szFileName, LPCSTR szNewFileName,
|
|
MMIOINFO16 * lpmmioinfo, DWORD dwRenameFlags)
|
|
{
|
|
UINT16 result;
|
|
LPMMIOINFO16 lpmminfo;
|
|
HMMIO16 hmmio;
|
|
|
|
TRACE(mmio, "('%s', '%s', %p, %08lX);\n",
|
|
szFileName, szNewFileName, lpmmioinfo, dwRenameFlags);
|
|
|
|
hmmio = GlobalAlloc16(GHND, sizeof(MMIOINFO16));
|
|
lpmminfo = (LPMMIOINFO16) GlobalLock16(hmmio);
|
|
|
|
if (lpmmioinfo)
|
|
memcpy(lpmminfo, lpmmioinfo, sizeof(MMIOINFO16));
|
|
|
|
/* assume DOS file if not otherwise specified */
|
|
if (lpmminfo->fccIOProc == 0 && lpmminfo->pIOProc == NULL) {
|
|
|
|
lpmminfo->fccIOProc = mmioFOURCC('D', 'O', 'S', ' ');
|
|
lpmminfo->pIOProc = (LPMMIOPROC16) mmioDosIOProc;
|
|
|
|
}
|
|
/* if just the four character code is present, look up IO proc */
|
|
else if (lpmminfo->pIOProc == NULL) {
|
|
|
|
lpmminfo->pIOProc = mmioInstallIOProc16(lpmminfo->fccIOProc, NULL, MMIO_FINDPROC);
|
|
|
|
}
|
|
/* (if IO proc specified, use it and specified four character code) */
|
|
|
|
result = (UINT16) mmioSendMessage(hmmio, MMIOM_RENAME, (LPARAM) szFileName, (LPARAM) szNewFileName);
|
|
|
|
GlobalUnlock16(hmmio);
|
|
GlobalFree16(hmmio);
|
|
|
|
return result;
|
|
}
|
|
|