Release 940815
[wine/gsoc-2012-control.git] / misc / mmsystem.c
blobef8d5ca28e014e1453be9c5dd6248466b5280595
1 /*
2 * MMSYTEM functions
4 * Copyright 1993 Martin Ayotte
5 */
6 static char Copyright[] = "Copyright Martin Ayotte, 1993";
8 #ifndef WINELIB
10 #include "stdio.h"
11 #include <fcntl.h>
12 #include <sys/ioctl.h>
13 #include "win.h"
14 #include "user.h"
15 #include "driver.h"
16 #include "mmsystem.h"
18 static WORD mciActiveDev = 0;
19 static BOOL mmTimeStarted = FALSE;
20 static MMTIME mmSysTimeMS;
21 static MMTIME mmSysTimeSMPTE;
23 typedef struct tagTIMERENTRY {
24 WORD wDelay;
25 WORD wResol;
26 FARPROC lpFunc;
27 DWORD dwUser;
28 WORD wFlags;
29 WORD wTimerID;
30 WORD wCurTime;
31 struct tagTIMERENTRY *Next;
32 struct tagTIMERENTRY *Prev;
33 } TIMERENTRY;
34 typedef TIMERENTRY *LPTIMERENTRY;
36 static LPTIMERENTRY lpTimerList = NULL;
38 static MCI_OPEN_DRIVER_PARMS mciDrv[MAXMCIDRIVERS];
40 UINT WINAPI midiGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
41 UINT WINAPI waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
42 LRESULT DrvDefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
43 DWORD dwParam1, DWORD dwParam2);
46 /**************************************************************************
47 * MMSYSTEM_WEP [MMSYSTEM.1]
49 int MMSYSTEM_WEP(HANDLE hInstance, WORD wDataSeg,
50 WORD cbHeapSize, LPSTR lpCmdLine)
52 printf("MMSYSTEM DLL INIT ... hInst=%04X \n", hInstance);
53 return(TRUE);
56 /**************************************************************************
57 * sndPlaySound [MMSYSTEM.2]
59 BOOL WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT uFlags)
61 HMMIO hmmio;
62 MMCKINFO mmckInfo;
63 MMCKINFO ckMainRIFF;
64 PCMWAVEFORMAT pcmWaveFormat;
65 int count;
66 WAVEHDR WaveHdr;
67 WAVEOPENDESC WaveDesc;
68 DWORD dwRet;
69 char str[128];
70 LPSTR ptr;
71 printf("sndPlaySound // SoundName='%s' uFlags=%04X !\n",
72 lpszSoundName, uFlags);
73 if (lpszSoundName == NULL) {
74 printf("sndPlaySound // Stop !\n");
75 return FALSE;
77 hmmio = mmioOpen((LPSTR)lpszSoundName, NULL,
78 MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
79 if (hmmio == 0) {
80 printf("sndPlaySound // searching in SystemSound List !\n");
81 GetProfileString("Sounds", (LPSTR)lpszSoundName, "", str, sizeof(str));
82 if (strlen(str) == 0) return FALSE;
83 if ( (ptr = (LPSTR)strchr(str, ',')) != NULL) *ptr = '\0';
84 hmmio = mmioOpen(str, NULL, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
85 if (hmmio == 0) {
86 printf("sndPlaySound // can't find SystemSound='%s' !\n", str);
87 return FALSE;
90 if (mmioDescend(hmmio, &ckMainRIFF, NULL, 0) != 0) {
91 ErrSND: if (hmmio != 0) mmioClose(hmmio, 0);
92 return FALSE;
94 printf("sndPlaySound // ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
95 (LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType,
96 ckMainRIFF.cksize);
97 if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
98 (ckMainRIFF.fccType != mmioFOURCC('W', 'A', 'V', 'E'))) goto ErrSND;
99 mmckInfo.ckid = mmioFOURCC('f', 'm', 't', ' ');
100 if (mmioDescend(hmmio, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) != 0) goto ErrSND;
101 printf("sndPlaySound // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
102 (LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType,
103 mmckInfo.cksize);
104 if (mmioRead(hmmio, (HPSTR) &pcmWaveFormat,
105 (long) sizeof(PCMWAVEFORMAT)) != (long) sizeof(PCMWAVEFORMAT)) goto ErrSND;
106 mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
107 if (mmioDescend(hmmio, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) != 0) goto ErrSND;
108 printf("sndPlaySound // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
109 (LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType,
110 mmckInfo.cksize);
111 WaveDesc.hWave = 0;
112 WaveDesc.lpFormat = (LPWAVEFORMAT)&pcmWaveFormat;
113 pcmWaveFormat.wf.wFormatTag = WAVE_FORMAT_PCM;
114 /* pcmWaveFormat.wBitsPerSample = 8;
115 pcmWaveFormat.wf.nChannels = 1;
116 pcmWaveFormat.wf.nSamplesPerSec = 11025;
117 pcmWaveFormat.wf.nBlockAlign = 1; */
118 pcmWaveFormat.wf.nAvgBytesPerSec =
119 pcmWaveFormat.wf.nSamplesPerSec * pcmWaveFormat.wf.nBlockAlign;
120 dwRet = wodMessage(0, WODM_OPEN, 0, (DWORD)&WaveDesc, CALLBACK_NULL);
121 if (dwRet != MMSYSERR_NOERROR) {
122 printf("sndPlaySound // can't open WaveOut device !\n");
123 goto ErrSND;
125 WaveHdr.lpData = (LPSTR) malloc(64000);
126 WaveHdr.dwBufferLength = 32000;
127 WaveHdr.dwUser = 0L;
128 WaveHdr.dwFlags = 0L;
129 WaveHdr.dwLoops = 0L;
130 dwRet = wodMessage(0, WODM_PREPARE, 0, (DWORD)&WaveHdr, sizeof(WAVEHDR));
131 if (dwRet != MMSYSERR_NOERROR) {
132 printf("sndPlaySound // can't prepare WaveOut device !\n");
133 free(WaveHdr.lpData);
134 goto ErrSND;
136 while(TRUE) {
137 count = mmioRead(hmmio, WaveHdr.lpData, WaveHdr.dwBufferLength);
138 if (count < 1) break;
139 WaveHdr.dwBytesRecorded = count;
140 wodMessage(0, WODM_WRITE, 0, (DWORD)&WaveHdr, sizeof(WAVEHDR));
142 wodMessage(0, WODM_UNPREPARE, 0, (DWORD)&WaveHdr, sizeof(WAVEHDR));
143 wodMessage(0, WODM_CLOSE, 0, 0L, 0L);
144 free(WaveHdr.lpData);
145 if (hmmio != 0) mmioClose(hmmio, 0);
146 return TRUE;
149 /**************************************************************************
150 * mmsystemGetVersion [MMSYSTEM.5]
152 WORD WINAPI mmsystemGetVersion()
154 printf("mmsystemGetVersion // 0.4.0 ...?... :-) !\n");
155 return(0x0040);
158 /**************************************************************************
159 * DriverProc [MMSYSTEM.6]
161 LRESULT DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
162 DWORD dwParam1, DWORD dwParam2)
164 return DrvDefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
167 /**************************************************************************
168 * OutputDebugStr [MMSYSTEM.30]
170 void WINAPI OutputDebugStr(LPCSTR str)
172 printf("EMPTY STUB !!! OutputDebugStr('%s');\n", str);
175 /**************************************************************************
176 * DriverCallback [MMSYSTEM.31]
178 BOOL DriverCallback(DWORD dwCallBack, UINT uFlags, HANDLE hDev,
179 WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
181 printf("DriverCallback(%08X, %04X, %04X, %04X, %08X, %08X, %08X); !\n",
182 dwCallBack, uFlags, hDev, wMsg, dwUser, dwParam1, dwParam2);
183 switch(uFlags & DCB_TYPEMASK) {
184 case DCB_NULL:
185 printf("DriverCallback() // CALLBACK_NULL !\n");
186 break;
187 case DCB_WINDOW:
188 printf("DriverCallback() // CALLBACK_WINDOW !\n");
189 break;
190 case DCB_TASK:
191 printf("DriverCallback() // CALLBACK_TASK !\n");
192 break;
193 case DCB_FUNCTION:
194 printf("DriverCallback() // CALLBACK_FUNCTION !\n");
195 break;
197 return TRUE;
200 /**************************************************************************
201 * JoyGetNumDevs [MMSYSTEM.101]
203 WORD JoyGetNumDevs()
205 printf("EMPTY STUB !!! JoyGetNumDevs();\n");
206 return 0;
209 /**************************************************************************
210 * JoyGetDevCaps [MMSYSTEM.102]
212 WORD JoyGetDevCaps(WORD wID, LPJOYCAPS lpCaps, WORD wSize)
214 printf("EMPTY STUB !!! JoyGetDevCaps(%04X, %08X, %d);\n",
215 wID, lpCaps, wSize);
216 return MMSYSERR_NODRIVER;
219 /**************************************************************************
220 * JoyGetPos [MMSYSTEM.103]
222 WORD JoyGetPos(WORD wID, LPJOYINFO lpInfo)
224 printf("EMPTY STUB !!! JoyGetPos(%04X, %08X);\n", wID, lpInfo);
225 return MMSYSERR_NODRIVER;
228 /**************************************************************************
229 * JoyGetThreshold [MMSYSTEM.104]
231 WORD JoyGetThreshold(WORD wID, LPWORD lpThreshold)
233 printf("EMPTY STUB !!! JoyGetThreshold(%04X, %08X);\n", wID, lpThreshold);
234 return MMSYSERR_NODRIVER;
237 /**************************************************************************
238 * JoyReleaseCapture [MMSYSTEM.105]
240 WORD JoyReleaseCapture(WORD wID)
242 printf("EMPTY STUB !!! JoyReleaseCapture(%04X);\n", wID);
243 return MMSYSERR_NODRIVER;
246 /**************************************************************************
247 * JoySetCapture [MMSYSTEM.106]
249 WORD JoySetCapture(HWND hWnd, WORD wID, WORD wPeriod, BOOL bChanged)
251 printf("EMPTY STUB !!! JoySetCapture(%04X, %04X, %d, %d);\n",
252 hWnd, wID, wPeriod, bChanged);
253 return MMSYSERR_NODRIVER;
256 /**************************************************************************
257 * JoySetThreshold [MMSYSTEM.107]
259 WORD JoySetThreshold(WORD wID, WORD wThreshold)
261 printf("EMPTY STUB !!! JoySetThreshold(%04X, %d);\n", wID, wThreshold);
262 return MMSYSERR_NODRIVER;
265 /**************************************************************************
266 * JoySetCalibration [MMSYSTEM.109]
268 WORD JoySetCalibration(WORD wID)
270 printf("EMPTY STUB !!! JoySetCalibration(%04X);\n", wID);
271 return MMSYSERR_NODRIVER;
275 /**************************************************************************
276 * auxGetNumDevs [MMSYSTEM.350]
278 UINT WINAPI auxGetNumDevs()
280 UINT count = 0;
281 printf("auxGetNumDevs !\n");
282 count += auxMessage(0, AUXDM_GETNUMDEVS, 0L, 0L, 0L);
283 printf("auxGetNumDevs return %u \n", count);
284 return count;
287 /**************************************************************************
288 * auxGetDevCaps [MMSYSTEM.351]
290 UINT WINAPI auxGetDevCaps(UINT uDeviceID, AUXCAPS FAR* lpCaps, UINT uSize)
292 printf("auxGetDevCaps !\n");
293 return 0;
296 /**************************************************************************
297 * auxGetVolume [MMSYSTEM.352]
299 UINT WINAPI auxGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume)
301 printf("auxGetVolume !\n");
302 return 0;
305 /**************************************************************************
306 * auxSetVolume [MMSYSTEM.353]
308 UINT WINAPI auxSetVolume(UINT uDeviceID, DWORD dwVolume)
310 printf("auxSetVolume !\n");
311 return 0;
314 /**************************************************************************
315 * auxOutMessage [MMSYSTEM.354]
317 DWORD WINAPI auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD dw1, DWORD dw2)
319 printf("auxOutMessage !\n");
320 return 0L;
323 /**************************************************************************
324 * mciGetErrorString [MMSYSTEM.706]
326 BOOL mciGetErrorString (DWORD wError, LPSTR lpstrBuffer, UINT uLength)
328 LPSTR msgptr;
329 int maxbuf;
330 printf("mciGetErrorString(%04X, %08X, %d);\n", wError, lpstrBuffer, uLength);
331 if ((lpstrBuffer == NULL) || (uLength < 1)) return(FALSE);
332 lpstrBuffer[0] = '\0';
333 switch(wError) {
334 case MCIERR_INVALID_DEVICE_ID:
335 msgptr = "Invalid MCI device ID. Use the ID returned when opening the MCI device.";
336 break;
337 case MCIERR_UNRECOGNIZED_KEYWORD:
338 msgptr = "The driver cannot recognize the specified command parameter.";
339 break;
340 case MCIERR_UNRECOGNIZED_COMMAND:
341 msgptr = "The driver cannot recognize the specified command.";
342 break;
343 case MCIERR_HARDWARE:
344 msgptr = "There is a problem with your media device. Make sure it is working correctly or contact the device manufacturer.";
345 break;
346 case MCIERR_INVALID_DEVICE_NAME:
347 msgptr = "The specified device is not open or is not recognized by MCI.";
348 break;
349 case MCIERR_OUT_OF_MEMORY:
350 msgptr = "Not enough memory available for this task. \nQuit one or more applications to increase available memory, and then try again.";
351 break;
352 case MCIERR_DEVICE_OPEN:
353 msgptr = "The device name is already being used as an alias by this application. Use a unique alias.";
354 break;
355 case MCIERR_CANNOT_LOAD_DRIVER:
356 msgptr = "There is an undetectable problem in loading the specified device driver.";
357 break;
358 case MCIERR_MISSING_COMMAND_STRING:
359 msgptr = "No command was specified.";
360 break;
361 case MCIERR_PARAM_OVERFLOW:
362 msgptr = "The output string was to large to fit in the return buffer. Increase the size of the buffer.";
363 break;
364 case MCIERR_MISSING_STRING_ARGUMENT:
365 msgptr = "The specified command requires a character-string parameter. Please provide one.";
366 break;
367 case MCIERR_BAD_INTEGER:
368 msgptr = "The specified integer is invalid for this command.";
369 break;
370 case MCIERR_PARSER_INTERNAL:
371 msgptr = "The device driver returned an invalid return type. Check with the device manufacturer about obtaining a new driver.";
372 break;
373 case MCIERR_DRIVER_INTERNAL:
374 msgptr = "There is a problem with the device driver. Check with the device manufacturer about obtaining a new driver.";
375 break;
376 case MCIERR_MISSING_PARAMETER:
377 msgptr = "The specified command requires a parameter. Please supply one.";
378 break;
379 case MCIERR_UNSUPPORTED_FUNCTION:
380 msgptr = "The MCI device you are using does not support the specified command.";
381 break;
382 case MCIERR_FILE_NOT_FOUND:
383 msgptr = "Cannot find the specified file. Make sure the path and filename are correct.";
384 break;
385 case MCIERR_DEVICE_NOT_READY:
386 msgptr = "The device driver is not ready.";
387 break;
388 case MCIERR_INTERNAL:
389 msgptr = "A problem occurred in initializing MCI. Try restarting Windows.";
390 break;
391 case MCIERR_DRIVER:
392 msgptr = "There is a problem with the device driver. The driver has closed. Cannot access error.";
393 break;
394 case MCIERR_CANNOT_USE_ALL:
395 msgptr = "Cannot use 'all' as the device name with the specified command.";
396 break;
397 case MCIERR_MULTIPLE:
398 msgptr = "Errors occurred in more than one device. Specify each command and device separately to determine which devices caused the error";
399 break;
400 case MCIERR_EXTENSION_NOT_FOUND:
401 msgptr = "Cannot determine the device type from the given filename extension.";
402 break;
403 case MCIERR_OUTOFRANGE:
404 msgptr = "The specified parameter is out of range for the specified command.";
405 break;
406 case MCIERR_FLAGS_NOT_COMPATIBLE:
407 msgptr = "The specified parameters cannot be used together.";
408 break;
409 case MCIERR_FILE_NOT_SAVED:
410 msgptr = "Cannot save the specified file. Make sure you have enough disk space or are still connected to the network.";
411 break;
412 case MCIERR_DEVICE_TYPE_REQUIRED:
413 msgptr = "Cannot find the specified device. Make sure it is installed or that the device name is spelled correctly.";
414 break;
415 case MCIERR_DEVICE_LOCKED:
416 msgptr = "The specified device is now being closed. Wait a few seconds, and then try again.";
417 break;
418 case MCIERR_DUPLICATE_ALIAS:
419 msgptr = "The specified alias is already being used in this application. Use a unique alias.";
420 break;
421 case MCIERR_BAD_CONSTANT:
422 msgptr = "The specified parameter is invalid for this command.";
423 break;
424 case MCIERR_MUST_USE_SHAREABLE:
425 msgptr = "The device driver is already in use. To share it, use the 'shareable' parameter with each 'open' command.";
426 break;
427 case MCIERR_MISSING_DEVICE_NAME:
428 msgptr = "The specified command requires an alias, file, driver, or device name. Please supply one.";
429 break;
430 case MCIERR_BAD_TIME_FORMAT:
431 msgptr = "The specified value for the time format is invalid. Refer to the MCI documentation for valid formats.";
432 break;
433 case MCIERR_NO_CLOSING_QUOTE:
434 msgptr = "A closing double-quotation mark is missing from the parameter value. Please supply one.";
435 break;
436 case MCIERR_DUPLICATE_FLAGS:
437 msgptr = "A parameter or value was specified twice. Only specify it once.";
438 break;
439 case MCIERR_INVALID_FILE:
440 msgptr = "The specified file cannot be played on the specified MCI device. The file may be corrupt, or not in the correct format.";
441 break;
442 case MCIERR_NULL_PARAMETER_BLOCK:
443 msgptr = "A null parameter block was passed to MCI.";
444 break;
445 case MCIERR_UNNAMED_RESOURCE:
446 msgptr = "Cannot save an unnamed file. Supply a filename.";
447 break;
448 case MCIERR_NEW_REQUIRES_ALIAS:
449 msgptr = "You must specify an alias when using the 'new' parameter.";
450 break;
451 case MCIERR_NOTIFY_ON_AUTO_OPEN:
452 msgptr = "Cannot use the 'notify' flag with auto-opened devices.";
453 break;
454 case MCIERR_NO_ELEMENT_ALLOWED:
455 msgptr = "Cannot use a filename with the specified device.";
456 break;
457 case MCIERR_NONAPPLICABLE_FUNCTION:
458 msgptr = "Cannot carry out the commands in the order specified. Correct the command sequence, and then try again.";
459 break;
460 case MCIERR_ILLEGAL_FOR_AUTO_OPEN:
461 msgptr = "Cannot carry out the specified command on an auto-opened device. Wait until the device is closed, and then try again.";
462 break;
463 case MCIERR_FILENAME_REQUIRED:
464 msgptr = "The filename is invalid. Make sure the filename is not longer than 8 characters, followed by a period and an extension.";
465 break;
466 case MCIERR_EXTRA_CHARACTERS:
467 msgptr = "Cannot specify extra characters after a string enclosed in quotation marks.";
468 break;
469 case MCIERR_DEVICE_NOT_INSTALLED:
470 msgptr = "The specified device is not installed on the system. Use the Drivers option in Control Panel to install the device.";
471 break;
472 case MCIERR_GET_CD:
473 msgptr = "Cannot access the specified file or MCI device. Try changing directories or restarting your computer.";
474 break;
475 case MCIERR_SET_CD:
476 msgptr = "Cannot access the specified file or MCI device because the application cannot change directories.";
477 break;
478 case MCIERR_SET_DRIVE:
479 msgptr = "Cannot access specified file or MCI device because the application cannot change drives.";
480 break;
481 case MCIERR_DEVICE_LENGTH:
482 msgptr = "Specify a device or driver name that is less than 79 characters.";
483 break;
484 case MCIERR_DEVICE_ORD_LENGTH:
485 msgptr = "Specify a device or driver name that is less than 69 characters.";
486 break;
487 case MCIERR_NO_INTEGER:
488 msgptr = "The specified command requires an integer parameter. Please provide one.";
489 break;
490 case MCIERR_WAVE_OUTPUTSINUSE:
491 msgptr = "All wave devices that can play files in the current format are in use. Wait until a wave device is free, and then try again.";
492 break;
493 case MCIERR_WAVE_SETOUTPUTINUSE:
494 msgptr = "Cannot set the current wave device for play back because it is in use. Wait until the device is free, and then try again.";
495 break;
496 case MCIERR_WAVE_INPUTSINUSE:
497 msgptr = "All wave devices that can record files in the current format are in use. Wait until a wave device is free, and then try again.";
498 break;
499 case MCIERR_WAVE_SETINPUTINUSE:
500 msgptr = "Cannot set the current wave device for recording because it is in use. Wait until the device is free, and then try again.";
501 break;
502 case MCIERR_WAVE_OUTPUTUNSPECIFIED:
503 msgptr = "Any compatible waveform playback device may be used.";
504 break;
505 case MCIERR_WAVE_INPUTUNSPECIFIED:
506 msgptr = "Any compatible waveform recording device may be used.";
507 break;
508 case MCIERR_WAVE_OUTPUTSUNSUITABLE:
509 msgptr = "No wave device that can play files in the current format is installed. Use the Drivers option to install the wave device.";
510 break;
511 case MCIERR_WAVE_SETOUTPUTUNSUITABLE:
512 msgptr = "The device you are trying to play to cannot recognize the current file format.";
513 break;
514 case MCIERR_WAVE_INPUTSUNSUITABLE:
515 msgptr = "No wave device that can record files in the current format is installed. Use the Drivers option to install the wave device.";
516 break;
517 case MCIERR_WAVE_SETINPUTUNSUITABLE:
518 msgptr = "The device you are trying to record from cannot recognize the current file format.";
519 break;
520 case MCIERR_NO_WINDOW:
521 msgptr = "There is no display window.";
522 break;
523 case MCIERR_CREATEWINDOW:
524 msgptr = "Could not create or use window.";
525 break;
526 case MCIERR_FILE_READ:
527 msgptr = "Cannot read the specified file. Make sure the file is still present, or check your disk or network connection.";
528 break;
529 case MCIERR_FILE_WRITE:
530 msgptr = "Cannot write to the specified file. Make sure you have enough disk space or are still connected to the network.";
531 break;
534 #define MCIERR_SEQ_DIV_INCOMPATIBLE (MCIERR_BASE + 80)
535 #define MCIERR_SEQ_PORT_INUSE (MCIERR_BASE + 81)
536 #define MCIERR_SEQ_PORT_NONEXISTENT (MCIERR_BASE + 82)
537 #define MCIERR_SEQ_PORT_MAPNODEVICE (MCIERR_BASE + 83)
538 #define MCIERR_SEQ_PORT_MISCERROR (MCIERR_BASE + 84)
539 #define MCIERR_SEQ_TIMER (MCIERR_BASE + 85)
540 #define MCIERR_SEQ_PORTUNSPECIFIED (MCIERR_BASE + 86)
541 #define MCIERR_SEQ_NOMIDIPRESENT (MCIERR_BASE + 87)
543 msg# 513 : vcr
544 msg# 514 : videodisc
545 msg# 515 : overlay
546 msg# 516 : cdaudio
547 msg# 517 : dat
548 msg# 518 : scanner
549 msg# 519 : animation
550 msg# 520 : digitalvideo
551 msg# 521 : other
552 msg# 522 : waveaudio
553 msg# 523 : sequencer
554 msg# 524 : not ready
555 msg# 525 : stopped
556 msg# 526 : playing
557 msg# 527 : recording
558 msg# 528 : seeking
559 msg# 529 : paused
560 msg# 530 : open
561 msg# 531 : false
562 msg# 532 : true
563 msg# 533 : milliseconds
564 msg# 534 : hms
565 msg# 535 : msf
566 msg# 536 : frames
567 msg# 537 : smpte 24
568 msg# 538 : smpte 25
569 msg# 539 : smpte 30
570 msg# 540 : smpte 30 drop
571 msg# 541 : bytes
572 msg# 542 : samples
573 msg# 543 : tmsf
575 default:
576 msgptr = "Unkown MCI Error !\n";
577 break;
579 maxbuf = min(uLength - 1, strlen(msgptr));
580 if (maxbuf > 0) strncpy(lpstrBuffer, msgptr, maxbuf);
581 lpstrBuffer[maxbuf + 1] = '\0';
582 return(TRUE);
586 /**************************************************************************
587 * mciDriverNotify [MMSYSTEM.711]
589 BOOL WINAPI mciDriverNotify(HWND hWndCallBack, UINT wDevID, UINT wStatus)
591 printf("mciDriverNotify(%04X, %u, %04X)\n", hWndCallBack, wDevID, wStatus);
592 if (!IsWindow(hWndCallBack)) return FALSE;
593 PostMessage(hWndCallBack, MM_MCINOTIFY, wStatus,
594 MAKELONG(mciDrv[wDevID].wDeviceID, 0));
595 return TRUE;
598 /**************************************************************************
599 * mciOpen [internal]
601 DWORD mciOpen(DWORD dwParam, LPMCI_OPEN_PARMS lpParms)
603 char str[128];
604 DWORD dwDevTyp = 0;
605 UINT wDevID = 1;
606 printf("mciOpen(%08X, %08X)\n", dwParam, lpParms);
607 if (lpParms == NULL) return MCIERR_INTERNAL;
608 while(mciDrv[wDevID].wType != 0) {
609 if (++wDevID >= MAXMCIDRIVERS) {
610 printf("MCI_OPEN // MAXMCIDRIVERS reached !\n");
611 return MCIERR_INTERNAL;
614 if (dwParam & MCI_OPEN_TYPE) {
615 if (lpParms->lpstrDeviceType == NULL) return MCIERR_INTERNAL;
616 if (dwParam & MCI_OPEN_TYPE_ID) {
617 printf("MCI_OPEN // Dev=%08X !\n", lpParms->lpstrDeviceType);
618 dwDevTyp = (DWORD)lpParms->lpstrDeviceType;
620 else {
621 printf("MCI_OPEN // Dev='%s' !\n", lpParms->lpstrDeviceType);
622 strcpy(str, lpParms->lpstrDeviceType);
623 AnsiUpper(str);
624 if (strcmp(str, "CDAUDIO") == 0) {
625 dwDevTyp = MCI_DEVTYPE_CD_AUDIO;
627 else
628 if (strcmp(str, "WAVEAUDIO") == 0) {
629 dwDevTyp = MCI_DEVTYPE_WAVEFORM_AUDIO;
631 else
632 if (strcmp(str, "SEQUENCER") == 0) {
633 dwDevTyp = MCI_DEVTYPE_SEQUENCER;
635 else
636 if (strcmp(str, "ANIMATION1") == 0) {
637 dwDevTyp = MCI_DEVTYPE_ANIMATION;
640 mciDrv[wDevID].wType = dwDevTyp;
641 mciDrv[wDevID].wDeviceID = 1;
642 lpParms->wDeviceID = wDevID;
643 printf("MCI_OPEN // wDeviceID=%04X !\n", lpParms->wDeviceID);
644 switch(dwDevTyp) {
645 case MCI_DEVTYPE_CD_AUDIO:
646 #ifdef WINELIB
647 WINELIB_UNIMP ("CDAUDIO_DriverProc");
648 #else
649 return CDAUDIO_DriverProc(0, 0, MCI_OPEN_DRIVER,
651 dwParam, (DWORD)lpParms);
652 #endif
653 case MCI_DEVTYPE_WAVEFORM_AUDIO:
654 return WAVE_DriverProc(0, 0, MCI_OPEN_DRIVER,
655 dwParam, (DWORD)lpParms);
656 case MCI_DEVTYPE_SEQUENCER:
657 printf("MCI_OPEN // No SEQUENCER yet !\n");
658 return MCIERR_DEVICE_NOT_INSTALLED;
659 case MCI_DEVTYPE_ANIMATION:
660 printf("MCI_OPEN // No ANIMATION yet !\n");
661 return MCIERR_DEVICE_NOT_INSTALLED;
662 case MCI_DEVTYPE_DIGITAL_VIDEO:
663 printf("MCI_OPEN // No DIGITAL_VIDEO yet !\n");
664 return MCIERR_DEVICE_NOT_INSTALLED;
665 default:
666 printf("MCI_OPEN // Invalid Device Name '%08X' !\n", lpParms->lpstrDeviceType);
667 return MCIERR_INVALID_DEVICE_NAME;
670 return MCIERR_INTERNAL;
674 /**************************************************************************
675 * mciClose [internal]
677 DWORD mciClose(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
679 DWORD dwRet = MCIERR_INTERNAL;
680 printf("mciClose(%u, %08X, %08X)\n", wDevID, dwParam, lpParms);
681 switch(mciDrv[wDevID].wType) {
682 case MCI_DEVTYPE_CD_AUDIO:
683 #ifndef WINELIB
684 dwRet = CDAUDIO_DriverProc(mciDrv[wDevID].wDeviceID, 0,
685 MCI_CLOSE, dwParam, (DWORD)lpParms);
686 #endif
687 break;
688 case MCI_DEVTYPE_WAVEFORM_AUDIO:
689 dwRet = WAVE_DriverProc(mciDrv[wDevID].wDeviceID, 0,
690 MCI_CLOSE, dwParam, (DWORD)lpParms);
691 break;
692 default:
693 printf("mciClose() // unknown type=%04X !\n", mciDrv[wDevID].wType);
695 mciDrv[wDevID].wType = 0;
696 return dwRet;
700 /**************************************************************************
701 * mciSound [internal]
703 DWORD mciSound(UINT wDevID, DWORD dwParam, LPMCI_SOUND_PARMS lpParms)
705 if (lpParms == NULL) return MCIERR_INTERNAL;
706 if (dwParam & MCI_SOUND_NAME)
707 printf("MCI_SOUND // file='%s' !\n", lpParms->lpstrSoundName);
708 return MCIERR_INVALID_DEVICE_ID;
713 /**************************************************************************
714 * mciSendCommand [MMSYSTEM.701]
716 DWORD mciSendCommand(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2)
718 HDRVR hDrv = 0;
719 #ifdef DEBUG_MCI
720 printf("mciSendCommand(%04X, %04X, %08X, %08X)\n",
721 wDevID, wMsg, dwParam1, dwParam2);
722 #endif
723 switch(wMsg) {
724 case MCI_OPEN:
725 return mciOpen(dwParam1, (LPMCI_OPEN_PARMS)dwParam2);
726 case MCI_CLOSE:
727 return mciClose(wDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
728 default:
729 switch(mciDrv[wDevID].wType) {
730 case MCI_DEVTYPE_CD_AUDIO:
731 #ifndef WINELIB
732 return CDAUDIO_DriverProc(mciDrv[wDevID].wDeviceID, hDrv,
733 wMsg, dwParam1, dwParam2);
734 #endif
736 case MCI_DEVTYPE_WAVEFORM_AUDIO:
737 return WAVE_DriverProc(mciDrv[wDevID].wDeviceID, hDrv,
738 wMsg, dwParam1, dwParam2);
739 default:
740 printf("mciSendCommand() // unknown type=%04X !\n",
741 mciDrv[wDevID].wType);
744 return MMSYSERR_INVALPARAM;
747 /**************************************************************************
748 * mciGetDeviceID [MMSYSTEM.703]
750 UINT mciGetDeviceID (LPCSTR lpstrName)
752 char str[128];
753 printf("mciGetDeviceID(%s)\n", lpstrName);
754 if (lpstrName != NULL) {
755 strcpy(str, lpstrName);
756 AnsiUpper(str);
757 if (strcmp(str, "ALL") == 0) return MCI_ALL_DEVICE_ID;
759 return 0;
762 /**************************************************************************
763 * mciSendString [MMSYSTEM.702]
765 DWORD WINAPI mciSendString (LPCSTR lpstrCommand,
766 LPSTR lpstrReturnString, UINT uReturnLength, HWND hwndCallback)
768 printf("mciSendString('%s', %lX, %u, %X)\n",
769 lpstrCommand, lpstrReturnString,
770 uReturnLength, hwndCallback);
771 return MCIERR_MISSING_COMMAND_STRING;
774 /**************************************************************************
775 * mciSetYieldProc [MMSYSTEM.714]
777 BOOL WINAPI mciSetYieldProc (UINT uDeviceID,
778 YIELDPROC fpYieldProc, DWORD dwYieldData)
782 /**************************************************************************
783 * mciGetDeviceIDFromElementID [MMSYSTEM.715]
785 UINT WINAPI mciGetDeviceIDFromElementID(DWORD dwElementID, LPCSTR lpstrType)
789 /**************************************************************************
790 * mciGetYieldProc [MMSYSTEM.716]
792 YIELDPROC WINAPI mciGetYieldProc(UINT uDeviceID, DWORD FAR* lpdwYieldData)
796 /**************************************************************************
797 * mciGetCreatorTask [MMSYSTEM.717]
799 HTASK WINAPI mciGetCreatorTask(UINT uDeviceID)
803 /**************************************************************************
804 * midiOutGetNumDevs [MMSYSTEM.201]
806 UINT WINAPI midiOutGetNumDevs(void)
808 printf("midiOutGetNumDevs\n");
809 return 0;
812 /**************************************************************************
813 * midiOutGetDevCaps [MMSYSTEM.202]
815 UINT WINAPI midiOutGetDevCaps(UINT uDeviceID,
816 MIDIOUTCAPS FAR* lpCaps, UINT uSize)
818 printf("midiOutGetDevCaps\n");
819 return 0;
822 /**************************************************************************
823 * midiOutGetErrorText [MMSYSTEM.203]
825 UINT WINAPI midiOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
827 printf("midiOutGetErrorText\n");
828 return(midiGetErrorText(uError, lpText, uSize));
832 /**************************************************************************
833 * midiGetErrorText [internal]
835 UINT WINAPI midiGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
837 LPSTR msgptr;
838 int maxbuf;
839 if ((lpText == NULL) || (uSize < 1)) return(FALSE);
840 lpText[0] = '\0';
841 switch(uError) {
842 case MIDIERR_UNPREPARED:
843 msgptr = "The MIDI header was not prepared. Use the Prepare function to prepare the header, and then try again.";
844 break;
845 case MIDIERR_STILLPLAYING:
846 msgptr = "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing.";
847 break;
848 case MIDIERR_NOMAP:
849 msgptr = "A MIDI map was not found. There may be a problem with the driver, or the MIDIMAP.CFG file may be corrupt or missing.";
850 break;
851 case MIDIERR_NOTREADY:
852 msgptr = "The port is transmitting data to the device. Wait until the data has been transmitted, and then try again.";
853 break;
854 case MIDIERR_NODEVICE:
855 msgptr = "The current MIDI Mapper setup refers to a MIDI device that is not installed on the system. Use MIDI Mapper to edit the setup.";
856 break;
857 case MIDIERR_INVALIDSETUP:
858 msgptr = "The current MIDI setup is damaged. Copy the original MIDIMAP.CFG file to the Windows SYSTEM directory, and then try again.";
859 break;
861 msg# 336 : Cannot use the song-pointer time format and the SMPTE time-format together.
862 msg# 337 : The specified MIDI device is already in use. Wait until it is free, and then try again.
863 msg# 338 : The specified MIDI device is not installed on the system. Use the Drivers option in Control Panel to install the driver.
864 msg# 339 : The current MIDI Mapper setup refers to a MIDI device that is not installed on the system. Use MIDI Mapper to edit the setup.
865 msg# 340 : An error occurred using the specified port.
866 msg# 341 : All multimedia timers are being used by other applications. Quit one of these applications, and then try again.
867 msg# 342 : There is no current MIDI port.
868 msg# 343 : There are no MIDI devices installed on the system. Use the Drivers option in Control Panel to install the driver.
870 default:
871 msgptr = "Unkown MIDI Error !\n";
872 break;
874 maxbuf = min(uSize - 1, strlen(msgptr));
875 if (maxbuf > 0) strncpy(lpText, msgptr, maxbuf);
876 lpText[maxbuf + 1] = '\0';
877 return(TRUE);
880 /**************************************************************************
881 * midiOutOpen [MMSYSTEM.204]
883 UINT WINAPI midiOutOpen(HMIDIOUT FAR* lphMidiOut, UINT uDeviceID,
884 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
886 printf("midiOutOpen\n");
887 if (lphMidiOut != NULL) *lphMidiOut = 0;
888 return 0;
891 /**************************************************************************
892 * midiOutClose [MMSYSTEM.205]
894 UINT WINAPI midiOutClose(HMIDIOUT hMidiOut)
896 printf("midiOutClose\n");
897 return 0;
900 /**************************************************************************
901 * midiOutPrepareHeader [MMSYSTEM.206]
903 UINT WINAPI midiOutPrepareHeader(HMIDIOUT hMidiOut,
904 MIDIHDR FAR* lpMidiOutHdr, UINT uSize)
906 printf("midiOutPrepareHeader\n");
907 return 0;
910 /**************************************************************************
911 * midiOutUnprepareHeader [MMSYSTEM.207]
913 UINT WINAPI midiOutUnprepareHeader(HMIDIOUT hMidiOut,
914 MIDIHDR FAR* lpMidiOutHdr, UINT uSize)
916 printf("midiOutUnprepareHeader\n");
917 return 0;
920 /**************************************************************************
921 * midiOutShortMsg [MMSYSTEM.208]
923 UINT WINAPI midiOutShortMsg(HMIDIOUT hMidiOut, DWORD dwMsg)
925 printf("midiOutShortMsg\n");
926 return 0;
929 /**************************************************************************
930 * midiOutLongMsg [MMSYSTEM.209]
932 UINT WINAPI midiOutLongMsg(HMIDIOUT hMidiOut,
933 MIDIHDR FAR* lpMidiOutHdr, UINT uSize)
935 printf("midiOutLongMsg\n");
936 return 0;
939 /**************************************************************************
940 * midiOutReset [MMSYSTEM.210]
942 UINT WINAPI midiOutReset(HMIDIOUT hMidiOut)
944 printf("midiOutReset\n");
945 return 0;
948 /**************************************************************************
949 * midiOutGetVolume [MMSYSTEM.211]
951 UINT WINAPI midiOutGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume)
953 printf("midiOutGetVolume\n");
954 return 0;
957 /**************************************************************************
958 * midiOutSetVolume [MMSYSTEM.212]
960 UINT WINAPI midiOutSetVolume(UINT uDeviceID, DWORD dwVolume)
962 printf("midiOutSetVolume\n");
963 return 0;
966 /**************************************************************************
967 * midiOutCachePatches [MMSYSTEM.213]
969 UINT WINAPI midiOutCachePatches(HMIDIOUT hMidiOut,
970 UINT uBank, WORD FAR* lpwPatchArray, UINT uFlags)
972 printf("midiOutCachePatches\n");
973 return 0;
976 /**************************************************************************
977 * midiOutCacheDrumPatches [MMSYSTEM.214]
979 UINT WINAPI midiOutCacheDrumPatches(HMIDIOUT hMidiOut,
980 UINT uPatch, WORD FAR* lpwKeyArray, UINT uFlags)
982 printf("midiOutCacheDrumPatches\n");
983 return 0;
986 /**************************************************************************
987 * midiOutGetID [MMSYSTEM.215]
989 UINT WINAPI midiOutGetID(HMIDIOUT hMidiOut, UINT FAR* lpuDeviceID)
991 printf("midiOutGetID\n");
992 return 0;
995 /**************************************************************************
996 * midiOutMessage [MMSYSTEM.216]
998 DWORD WINAPI midiOutMessage(HMIDIOUT hMidiOut, UINT uMessage, DWORD dw1, DWORD dw2)
1000 printf("midiOutMessage\n");
1001 return 0;
1004 /**************************************************************************
1005 * midiInGetNumDevs [MMSYSTEM.301]
1007 UINT WINAPI midiInGetNumDevs(void)
1009 printf("midiInGetNumDevs\n");
1010 return 0;
1013 /**************************************************************************
1014 * midiInGetDevCaps [MMSYSTEM.302]
1016 UINT WINAPI midiInGetDevCaps(UINT uDeviceID,
1017 LPMIDIINCAPS lpCaps, UINT uSize)
1019 printf("midiInGetDevCaps\n");
1020 return 0;
1023 /**************************************************************************
1024 * midiInGetErrorText [MMSYSTEM.303]
1026 UINT WINAPI midiInGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
1028 printf("midiInGetErrorText\n");
1029 return (midiGetErrorText(uError, lpText, uSize));
1032 /**************************************************************************
1033 * midiInOpen [MMSYSTEM.304]
1035 UINT WINAPI midiInOpen(HMIDIIN FAR* lphMidiIn, UINT uDeviceID,
1036 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
1038 printf("midiInOpen\n");
1039 if (lphMidiIn != NULL) *lphMidiIn = 0;
1040 return 0;
1043 /**************************************************************************
1044 * midiInClose [MMSYSTEM.305]
1046 UINT WINAPI midiInClose(HMIDIIN hMidiIn)
1048 printf("midiInClose\n");
1049 return 0;
1052 /**************************************************************************
1053 * midiInPrepareHeader [MMSYSTEM.306]
1055 UINT WINAPI midiInPrepareHeader(HMIDIIN hMidiIn,
1056 MIDIHDR FAR* lpMidiInHdr, UINT uSize)
1058 printf("midiInPrepareHeader\n");
1059 return 0;
1062 /**************************************************************************
1063 * midiInUnprepareHeader [MMSYSTEM.307]
1065 UINT WINAPI midiInUnprepareHeader(HMIDIIN hMidiIn,
1066 MIDIHDR FAR* lpMidiInHdr, UINT uSize)
1068 printf("midiInUnprepareHeader\n");
1069 return 0;
1072 /**************************************************************************
1073 * midiInAddBuffer [MMSYSTEM.308]
1075 UINT WINAPI midiInAddBuffer(HMIDIIN hMidiIn,
1076 MIDIHDR FAR* lpMidiInHdr, UINT uSize)
1078 printf("midiInAddBuffer\n");
1079 return 0;
1082 /**************************************************************************
1083 * midiInStart [MMSYSTEM.309]
1085 UINT WINAPI midiInStart(HMIDIIN hMidiIn)
1087 printf("midiInStart\n");
1088 return 0;
1091 /**************************************************************************
1092 * midiInStop [MMSYSTEM.310]
1094 UINT WINAPI midiInStop(HMIDIIN hMidiIn)
1096 printf("midiInStop\n");
1097 return 0;
1100 /**************************************************************************
1101 * midiInReset [MMSYSTEM.311]
1103 UINT WINAPI midiInReset(HMIDIIN hMidiIn)
1105 printf("midiInReset\n");
1106 return 0;
1109 /**************************************************************************
1110 * midiInGetID [MMSYSTEM.312]
1112 UINT WINAPI midiInGetID(HMIDIIN hMidiIn, UINT FAR* lpuDeviceID)
1114 printf("midiInGetID\n");
1115 return 0;
1118 /**************************************************************************
1119 * midiInMessage [MMSYSTEM.313]
1121 DWORD WINAPI midiInMessage(HMIDIIN hMidiIn, UINT uMessage,
1122 DWORD dwParam1, DWORD dwParam2)
1124 printf("midiInMessage\n");
1125 return 0;
1129 /**************************************************************************
1130 * waveOutGetNumDevs [MMSYSTEM.401]
1132 UINT WINAPI waveOutGetNumDevs()
1134 UINT count = 0;
1135 printf("waveOutGetNumDevs\n");
1136 count += wodMessage(0, WODM_GETNUMDEVS, 0L, 0L, 0L);
1137 printf("waveOutGetNumDevs return %u \n", count);
1138 return count;
1141 /**************************************************************************
1142 * waveOutGetDevCaps [MMSYSTEM.402]
1144 UINT WINAPI waveOutGetDevCaps(UINT uDeviceID, WAVEOUTCAPS FAR* lpCaps, UINT uSize)
1146 printf("waveOutGetDevCaps\n");
1147 return wodMessage(uDeviceID, WODM_GETDEVCAPS, 0L, (DWORD)lpCaps, uSize);
1150 /**************************************************************************
1151 * waveOutGetErrorText [MMSYSTEM.403]
1153 UINT WINAPI waveOutGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
1155 printf("waveOutGetErrorText\n");
1156 return(waveGetErrorText(uError, lpText, uSize));
1160 /**************************************************************************
1161 * waveGetErrorText [internal]
1163 UINT WINAPI waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
1165 LPSTR msgptr;
1166 int maxbuf;
1167 printf("waveGetErrorText(%04X, %08X, %d);\n", uError, lpText, uSize);
1168 if ((lpText == NULL) || (uSize < 1)) return(FALSE);
1169 lpText[0] = '\0';
1170 switch(uError) {
1171 case MMSYSERR_NOERROR:
1172 msgptr = "The specified command was carried out.";
1173 break;
1174 case MMSYSERR_ERROR:
1175 msgptr = "Undefined external error.";
1176 break;
1177 case MMSYSERR_BADDEVICEID:
1178 msgptr = "A device ID has been used that is out of range for your system.";
1179 break;
1180 case MMSYSERR_NOTENABLED:
1181 msgptr = "The driver was not enabled.";
1182 break;
1183 case MMSYSERR_ALLOCATED:
1184 msgptr = "The specified device is already in use. Wait until it is free, and then try again.";
1185 break;
1186 case MMSYSERR_INVALHANDLE:
1187 msgptr = "The specified device handle is invalid.";
1188 break;
1189 case MMSYSERR_NODRIVER:
1190 msgptr = "There is no driver installed on your system !\n";
1191 break;
1192 case MMSYSERR_NOMEM:
1193 msgptr = "Not enough memory available for this task. Quit one or more applications to increase available memory, and then try again.";
1194 break;
1195 case MMSYSERR_NOTSUPPORTED:
1196 msgptr = "This function is not supported. Use the Capabilities function to determine which functions and messages the driver supports.";
1197 break;
1198 case MMSYSERR_BADERRNUM:
1199 msgptr = "An error number was specified that is not defined in the system.";
1200 break;
1201 case MMSYSERR_INVALFLAG:
1202 msgptr = "An invalid flag was passed to a system function.";
1203 break;
1204 case MMSYSERR_INVALPARAM:
1205 msgptr = "An invalid parameter was passed to a system function.";
1206 break;
1207 case WAVERR_BADFORMAT:
1208 msgptr = "The specified format is not supported or cannot be translated. Use the Capabilities function to determine the supported formats";
1209 break;
1210 case WAVERR_STILLPLAYING:
1211 msgptr = "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing.";
1212 break;
1213 case WAVERR_UNPREPARED:
1214 msgptr = "The wave header was not prepared. Use the Prepare function to prepare the header, and then try again.";
1215 break;
1216 case WAVERR_SYNC:
1217 msgptr = "Cannot open the device without using the WAVE_ALLOWSYNC flag. Use the flag, and then try again.";
1218 break;
1219 default:
1220 msgptr = "Unkown MMSYSTEM Error !\n";
1221 break;
1223 maxbuf = min(uSize - 1, strlen(msgptr));
1224 if (maxbuf > 0) strncpy(lpText, msgptr, maxbuf);
1225 lpText[maxbuf + 1] = '\0';
1226 return(TRUE);
1229 /**************************************************************************
1230 * waveOutOpen [MMSYSTEM.404]
1232 UINT WINAPI waveOutOpen(HWAVEOUT FAR* lphWaveOut, UINT uDeviceID,
1233 const LPWAVEFORMAT lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
1235 HWAVE hWaveOut;
1236 LPWAVEOPENDESC lpDesc;
1237 DWORD dwRet;
1238 BOOL bMapperFlg = FALSE;
1239 printf("waveOutOpen(%08X, %d, %08X, %08X, %08X, %08X);\n",
1240 lphWaveOut, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
1241 if (dwFlags & WAVE_FORMAT_QUERY) {
1242 printf("waveOutOpen // WAVE_FORMAT_QUERY requested !\n");
1244 if (uDeviceID == (UINT)WAVE_MAPPER) {
1245 printf("waveOutOpen // WAVE_MAPPER mode requested !\n");
1246 bMapperFlg = TRUE;
1247 uDeviceID = 0;
1249 if (lpFormat == NULL) return WAVERR_BADFORMAT;
1250 hWaveOut = GlobalAlloc(GMEM_MOVEABLE, sizeof(WAVEOPENDESC));
1251 if (lphWaveOut != NULL) *lphWaveOut = hWaveOut;
1252 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveOut);
1253 if (lpDesc == NULL) return MMSYSERR_NOMEM;
1254 lpDesc->hWave = hWaveOut;
1255 lpDesc->lpFormat = lpFormat;
1256 lpDesc->dwCallBack = dwCallback;
1257 lpDesc->dwInstance = dwInstance;
1258 while(uDeviceID < MAXWAVEDRIVERS) {
1259 dwRet = wodMessage(uDeviceID, WODM_OPEN,
1260 lpDesc->dwInstance, (DWORD)lpDesc, 0L);
1261 if (dwRet == MMSYSERR_NOERROR) break;
1262 if (!bMapperFlg) break;
1263 uDeviceID++;
1264 printf("waveOutOpen // WAVE_MAPPER mode ! try next driver...\n");
1266 if (dwFlags & WAVE_FORMAT_QUERY) {
1267 printf("waveOutOpen // End of WAVE_FORMAT_QUERY !\n");
1268 waveOutClose(hWaveOut);
1270 return dwRet;
1273 /**************************************************************************
1274 * waveOutClose [MMSYSTEM.405]
1276 UINT WINAPI waveOutClose(HWAVEOUT hWaveOut)
1278 LPWAVEOPENDESC lpDesc;
1279 printf("waveOutClose(%04X)\n", hWaveOut);
1280 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveOut);
1281 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1282 return wodMessage(0, WODM_CLOSE, lpDesc->dwInstance, 0L, 0L);
1285 /**************************************************************************
1286 * waveOutPrepareHeader [MMSYSTEM.406]
1288 UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut,
1289 WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
1291 LPWAVEOPENDESC lpDesc;
1292 printf("waveOutPrepareHeader(%04X, %08X, %u);\n",
1293 hWaveOut, lpWaveOutHdr, uSize);
1294 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveOut);
1295 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1296 return wodMessage(0, WODM_PREPARE, lpDesc->dwInstance,
1297 (DWORD)lpWaveOutHdr, uSize);
1300 /**************************************************************************
1301 * waveOutUnprepareHeader [MMSYSTEM.407]
1303 UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut,
1304 WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
1306 LPWAVEOPENDESC lpDesc;
1307 printf("waveOutUnprepareHeader(%04X, %08X, %u);\n",
1308 hWaveOut, lpWaveOutHdr, uSize);
1309 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveOut);
1310 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1311 return wodMessage(0, WODM_PREPARE, lpDesc->dwInstance,
1312 (DWORD)lpWaveOutHdr, uSize);
1315 /**************************************************************************
1316 * waveOutWrite [MMSYSTEM.408]
1318 UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, WAVEHDR FAR* lpWaveOutHdr, UINT uSize)
1320 LPWAVEOPENDESC lpDesc;
1321 printf("waveOutWrite(%04X, %08X, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
1322 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveOut);
1323 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1324 return wodMessage(0, WODM_WRITE, lpDesc->dwInstance,
1325 (DWORD)lpWaveOutHdr, uSize);
1328 /**************************************************************************
1329 * waveOutPause [MMSYSTEM.409]
1331 UINT WINAPI waveOutPause(HWAVEOUT hWaveOut)
1333 printf("waveOutPause(%04X)\n", hWaveOut);
1334 return MMSYSERR_INVALHANDLE;
1337 /**************************************************************************
1338 * waveOutRestart [MMSYSTEM.410]
1340 UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut)
1342 printf("waveOutRestart(%04X)\n", hWaveOut);
1343 return MMSYSERR_INVALHANDLE;
1346 /**************************************************************************
1347 * waveOutReset [MMSYSTEM.411]
1349 UINT WINAPI waveOutReset(HWAVEOUT hWaveOut)
1351 printf("waveOutReset(%04X)\n", hWaveOut);
1352 return MMSYSERR_INVALHANDLE;
1355 /**************************************************************************
1356 * waveOutGetPosition [MMSYSTEM.412]
1358 UINT WINAPI waveOutGetPosition(HWAVEOUT hWaveOut, MMTIME FAR* lpTime, UINT uSize)
1360 LPWAVEOPENDESC lpDesc;
1361 printf("waveOutGetPosition(%04X, %08X, %u);\n", hWaveOut, lpTime, uSize);
1362 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveOut);
1363 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1364 return wodMessage(0, WODM_GETPOS, lpDesc->dwInstance,
1365 (DWORD)lpTime, (DWORD)uSize);
1368 /**************************************************************************
1369 * waveOutGetPitch [MMSYSTEM.413]
1371 UINT WINAPI waveOutGetPitch(HWAVEOUT hWaveOut, DWORD FAR* lpdwPitch)
1373 printf("waveOutGetPitch\n");
1374 return MMSYSERR_INVALHANDLE;
1377 /**************************************************************************
1378 * waveOutSetPitch [MMSYSTEM.414]
1380 UINT WINAPI waveOutSetPitch(HWAVEOUT hWaveOut, DWORD dwPitch)
1382 printf("waveOutSetPitch\n");
1383 return MMSYSERR_INVALHANDLE;
1386 /**************************************************************************
1387 * waveOutGetVolume [MMSYSTEM.415]
1389 UINT WINAPI waveOutGetVolume(UINT uDeviceID, DWORD FAR* lpdwVolume)
1391 printf("waveOutGetVolume\n");
1392 return MMSYSERR_INVALHANDLE;
1395 /**************************************************************************
1396 * waveOutSetVolume [MMSYSTEM.416]
1398 UINT WINAPI waveOutSetVolume(UINT uDeviceID, DWORD dwVolume)
1400 printf("waveOutSetVolume\n");
1401 return MMSYSERR_INVALHANDLE;
1404 /**************************************************************************
1405 * waveOutGetPlaybackRate [MMSYSTEM.417]
1407 UINT WINAPI waveOutGetPlaybackRate(HWAVEOUT hWaveOut, DWORD FAR* lpdwRate)
1409 printf("waveOutGetPlaybackRate\n");
1410 return MMSYSERR_INVALHANDLE;
1413 /**************************************************************************
1414 * waveOutSetPlaybackRate [MMSYSTEM.418]
1416 UINT WINAPI waveOutSetPlaybackRate(HWAVEOUT hWaveOut, DWORD dwRate)
1418 printf("waveOutSetPlaybackRate\n");
1419 return MMSYSERR_INVALHANDLE;
1422 /**************************************************************************
1423 * waveOutBreakLoop [MMSYSTEM.419]
1425 UINT WINAPI waveOutBreakLoop(HWAVEOUT hWaveOut)
1427 printf("waveOutBreakLoop(%04X)\n", hWaveOut);
1428 return MMSYSERR_INVALHANDLE;
1431 /**************************************************************************
1432 * waveOutGetID [MMSYSTEM.420]
1434 UINT WINAPI waveOutGetID(HWAVEOUT hWaveOut, UINT FAR* lpuDeviceID)
1436 printf("waveOutGetID\n");
1437 return MMSYSERR_INVALHANDLE;
1440 /**************************************************************************
1441 * waveOutMessage [MMSYSTEM.421]
1443 DWORD WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage,
1444 DWORD dwParam1, DWORD dwParam2)
1448 /**************************************************************************
1449 * waveInGetNumDevs [MMSYSTEM.501]
1451 UINT WINAPI waveInGetNumDevs()
1453 UINT count = 0;
1454 printf("waveInGetNumDevs\n");
1455 count += widMessage(0, WIDM_GETNUMDEVS, 0L, 0L, 0L);
1456 printf("waveInGetNumDevs return %u \n", count);
1457 return count;
1461 /**************************************************************************
1462 * waveInGetDevCaps [MMSYSTEM.502]
1464 UINT WINAPI waveInGetDevCaps(UINT uDeviceID, WAVEINCAPS FAR* lpCaps, UINT uSize)
1466 printf("waveInGetDevCaps\n");
1467 return widMessage(uDeviceID, WIDM_GETDEVCAPS, 0L, (DWORD)lpCaps, uSize);
1471 /**************************************************************************
1472 * waveInGetErrorText [MMSYSTEM.503]
1474 UINT WINAPI waveInGetErrorText(UINT uError, LPSTR lpText, UINT uSize)
1476 printf("waveInGetErrorText\n");
1477 return(waveGetErrorText(uError, lpText, uSize));
1481 /**************************************************************************
1482 * waveInOpen [MMSYSTEM.504]
1484 UINT WINAPI waveInOpen(HWAVEIN FAR* lphWaveIn, UINT uDeviceID,
1485 const LPWAVEFORMAT lpFormat, DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
1487 HWAVE hWaveIn;
1488 LPWAVEOPENDESC lpDesc;
1489 DWORD dwRet;
1490 BOOL bMapperFlg = FALSE;
1491 printf("waveInOpen(%08X, %d, %08X, %08X, %08X, %08X);\n",
1492 lphWaveIn, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
1493 if (dwFlags & WAVE_FORMAT_QUERY) {
1494 printf("waveInOpen // WAVE_FORMAT_QUERY requested !\n");
1496 if (uDeviceID == (UINT)WAVE_MAPPER) {
1497 printf("waveInOpen // WAVE_MAPPER mode requested !\n");
1498 bMapperFlg = TRUE;
1499 uDeviceID = 0;
1501 if (lpFormat == NULL) return WAVERR_BADFORMAT;
1502 hWaveIn = GlobalAlloc(GMEM_MOVEABLE, sizeof(WAVEOPENDESC));
1503 if (lphWaveIn != NULL) *lphWaveIn = hWaveIn;
1504 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveIn);
1505 if (lpDesc == NULL) return MMSYSERR_NOMEM;
1506 lpDesc->hWave = hWaveIn;
1507 lpDesc->lpFormat = lpFormat;
1508 lpDesc->dwCallBack = dwCallback;
1509 lpDesc->dwInstance = dwInstance;
1510 while(uDeviceID < MAXWAVEDRIVERS) {
1511 dwRet = widMessage(uDeviceID, WIDM_OPEN,
1512 lpDesc->dwInstance, (DWORD)lpDesc, 0L);
1513 if (dwRet == MMSYSERR_NOERROR) break;
1514 if (!bMapperFlg) break;
1515 uDeviceID++;
1516 printf("waveInOpen // WAVE_MAPPER mode ! try next driver...\n");
1518 if (dwFlags & WAVE_FORMAT_QUERY) {
1519 printf("waveInOpen // End of WAVE_FORMAT_QUERY !\n");
1520 waveInClose(hWaveIn);
1522 return dwRet;
1526 /**************************************************************************
1527 * waveInClose [MMSYSTEM.505]
1529 UINT WINAPI waveInClose(HWAVEIN hWaveIn)
1531 LPWAVEOPENDESC lpDesc;
1532 printf("waveInClose(%04X)\n", hWaveIn);
1533 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveIn);
1534 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1535 return widMessage(0, WIDM_CLOSE, lpDesc->dwInstance, 0L, 0L);
1539 /**************************************************************************
1540 * waveInPrepareHeader [MMSYSTEM.506]
1542 UINT WINAPI waveInPrepareHeader(HWAVEIN hWaveIn,
1543 WAVEHDR FAR* lpWaveInHdr, UINT uSize)
1545 LPWAVEOPENDESC lpDesc;
1546 printf("waveInPrepareHeader(%04X, %08X, %u);\n",
1547 hWaveIn, lpWaveInHdr, uSize);
1548 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveIn);
1549 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1550 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
1551 lpWaveInHdr->lpNext = NULL;
1552 lpWaveInHdr->dwBytesRecorded = 0;
1553 printf("waveInPrepareHeader // lpData=%08X size=%u \n",
1554 lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
1555 return widMessage(0, WIDM_PREPARE, lpDesc->dwInstance,
1556 (DWORD)lpWaveInHdr, uSize);
1560 /**************************************************************************
1561 * waveInUnprepareHeader [MMSYSTEM.507]
1563 UINT WINAPI waveInUnprepareHeader(HWAVEIN hWaveIn,
1564 WAVEHDR FAR* lpWaveInHdr, UINT uSize)
1566 LPWAVEOPENDESC lpDesc;
1567 printf("waveInUnprepareHeader(%04X, %08X, %u);\n",
1568 hWaveIn, lpWaveInHdr, uSize);
1569 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveIn);
1570 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1571 USER_HEAP_FREE(HIWORD((DWORD)lpWaveInHdr->lpData));
1572 lpWaveInHdr->lpData = NULL;
1573 lpWaveInHdr->lpNext = NULL;
1574 return widMessage(0, WIDM_PREPARE, lpDesc->dwInstance,
1575 (DWORD)lpWaveInHdr, uSize);
1579 /**************************************************************************
1580 * waveInAddBuffer [MMSYSTEM.508]
1582 UINT WINAPI waveInAddBuffer(HWAVEIN hWaveIn,
1583 WAVEHDR FAR* lpWaveInHdr, UINT uSize)
1585 LPWAVEOPENDESC lpDesc;
1586 printf("waveInAddBuffer(%04X, %08X, %u);\n", hWaveIn, lpWaveInHdr, uSize);
1587 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveIn);
1588 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1589 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
1590 lpWaveInHdr->lpNext = NULL;
1591 lpWaveInHdr->dwBytesRecorded = 0;
1592 printf("waveInAddBuffer // lpData=%08X size=%u \n",
1593 lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
1594 return widMessage(0, WIDM_ADDBUFFER, lpDesc->dwInstance,
1595 (DWORD)lpWaveInHdr, uSize);
1599 /**************************************************************************
1600 * waveInStart [MMSYSTEM.509]
1602 UINT WINAPI waveInStart(HWAVEIN hWaveIn)
1604 LPWAVEOPENDESC lpDesc;
1605 printf("waveInStart(%04X)\n", hWaveIn);
1606 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveIn);
1607 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1608 return widMessage(0, WIDM_START, lpDesc->dwInstance, 0L, 0L);
1612 /**************************************************************************
1613 * waveInStop [MMSYSTEM.510]
1615 UINT WINAPI waveInStop(HWAVEIN hWaveIn)
1617 LPWAVEOPENDESC lpDesc;
1618 printf("waveInStop(%04X)\n", hWaveIn);
1619 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveIn);
1620 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1621 return widMessage(0, WIDM_STOP, lpDesc->dwInstance, 0L, 0L);
1625 /**************************************************************************
1626 * waveInReset [MMSYSTEM.511]
1628 UINT WINAPI waveInReset(HWAVEIN hWaveIn)
1630 LPWAVEOPENDESC lpDesc;
1631 printf("waveInReset(%04X)\n", hWaveIn);
1632 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveIn);
1633 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1634 return widMessage(0, WIDM_RESET, lpDesc->dwInstance, 0L, 0L);
1638 /**************************************************************************
1639 * waveInGetPosition [MMSYSTEM.512]
1641 UINT WINAPI waveInGetPosition(HWAVEIN hWaveIn, MMTIME FAR* lpTime, UINT uSize)
1643 LPWAVEOPENDESC lpDesc;
1644 printf("waveInGetPosition(%04X, %08X, %u);\n", hWaveIn, lpTime, uSize);
1645 lpDesc = (LPWAVEOPENDESC) GlobalLock(hWaveIn);
1646 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1647 return widMessage(0, WIDM_GETPOS, lpDesc->dwInstance,
1648 (DWORD)lpTime, (DWORD)uSize);
1652 /**************************************************************************
1653 * waveInGetID [MMSYSTEM.513]
1655 UINT WINAPI waveInGetID(HWAVEIN hWaveIn, UINT FAR* lpuDeviceID)
1657 printf("waveInGetID\n");
1658 if (lpuDeviceID == NULL) return MMSYSERR_INVALPARAM;
1659 return 0;
1663 /**************************************************************************
1664 * waveInMessage [MMSYSTEM.514]
1666 DWORD WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage,
1667 DWORD dwParam1, DWORD dwParam2)
1672 /**************************************************************************
1673 * MMSysTimeCallback [internal]
1675 WORD FAR PASCAL MMSysTimeCallback(HWND hWnd, WORD wMsg, int nID, DWORD dwTime)
1677 LPTIMERENTRY lpTimer = lpTimerList;
1678 mmSysTimeMS.u.ms += 33;
1679 mmSysTimeSMPTE.u.smpte.frame++;
1680 while (lpTimer != NULL) {
1681 lpTimer->wCurTime--;
1682 if (lpTimer->wCurTime == 0) {
1683 lpTimer->wCurTime = lpTimer->wDelay;
1684 if (lpTimer->lpFunc != NULL) {
1685 #ifdef DEBUG_MMTIME
1686 printf("MMSysTimeCallback // before CallBack16 !\n");
1687 fflush(stdout);
1688 #endif
1689 #ifdef WINELIB
1690 (*lpTimer->lpFunc)(lpTimer->wTimerID, (WORD)0,
1691 lpTimer->dwUser, (DWORD)0, (DWORD)0);
1692 #else
1693 CallBack16(lpTimer->lpFunc, 5,
1694 0, (int)lpTimer->wTimerID, 0, (int)0,
1695 2, lpTimer->dwUser, 2, 0, 2, 0);
1696 #endif
1697 #ifdef DEBUG_MMTIME
1698 printf("MMSysTimeCallback // after CallBack16 !\n");
1699 fflush(stdout);
1700 #endif
1702 if (lpTimer->wFlags & TIME_ONESHOT)
1703 timeKillEvent(lpTimer->wTimerID);
1705 lpTimer = lpTimer->Next;
1707 return 0;
1710 /**************************************************************************
1711 * StartMMTime [internal]
1713 void StartMMTime()
1715 if (!mmTimeStarted) {
1716 mmTimeStarted = TRUE;
1717 mmSysTimeMS.wType = TIME_MS;
1718 mmSysTimeMS.u.ms = 0;
1719 mmSysTimeSMPTE.wType = TIME_SMPTE;
1720 mmSysTimeSMPTE.u.smpte.hour = 0;
1721 mmSysTimeSMPTE.u.smpte.min = 0;
1722 mmSysTimeSMPTE.u.smpte.sec = 0;
1723 mmSysTimeSMPTE.u.smpte.frame = 0;
1724 mmSysTimeSMPTE.u.smpte.fps = 0;
1725 mmSysTimeSMPTE.u.smpte.dummy = 0;
1726 SetTimer(0, 1, 33, (FARPROC)MMSysTimeCallback);
1730 /**************************************************************************
1731 * timeGetSystemTime [MMSYSTEM.601]
1733 WORD timeGetSystemTime(LPMMTIME lpTime, WORD wSize)
1735 printf("timeGetSystemTime(%08X, %u);\n", lpTime, wSize);
1736 if (!mmTimeStarted) StartMMTime();
1737 return 0;
1740 /**************************************************************************
1741 * timeSetEvent [MMSYSTEM.602]
1743 WORD timeSetEvent(WORD wDelay, WORD wResol,
1744 LPTIMECALLBACK lpFunc,
1745 DWORD dwUser, WORD wFlags)
1747 WORD wNewID = 0;
1748 LPTIMERENTRY lpNewTimer;
1749 LPTIMERENTRY lpTimer = lpTimerList;
1750 printf("timeSetEvent(%u, %u, %08X, %08X, %04X);\n",
1751 wDelay, wResol, lpFunc, dwUser, wFlags);
1752 if (!mmTimeStarted) StartMMTime();
1753 lpNewTimer = (LPTIMERENTRY) malloc(sizeof(TIMERENTRY));
1754 if (lpNewTimer == NULL) return 0;
1755 while (lpTimer != NULL) {
1756 wNewID = max(wNewID, lpTimer->wTimerID);
1757 if (lpTimer->Next == NULL) break;
1758 lpTimer = lpTimer->Next;
1760 if (lpTimerList == NULL) {
1761 lpTimerList = lpNewTimer;
1762 lpNewTimer->Prev == NULL;
1764 else {
1765 lpTimer->Next == lpNewTimer;
1766 lpNewTimer->Prev == lpTimer;
1768 lpNewTimer->Next = NULL;
1769 lpNewTimer->wTimerID = wNewID + 1;
1770 lpNewTimer->wCurTime = wDelay;
1771 lpNewTimer->wDelay = wDelay;
1772 lpNewTimer->wResol = wResol;
1773 lpNewTimer->lpFunc = (FARPROC)lpFunc;
1774 lpNewTimer->dwUser = dwUser;
1775 lpNewTimer->wFlags = wFlags;
1776 return lpNewTimer->wTimerID;
1779 /**************************************************************************
1780 * timeKillEvent [MMSYSTEM.603]
1782 WORD timeKillEvent(WORD wID)
1784 LPTIMERENTRY lpTimer = lpTimerList;
1785 while (lpTimer != NULL) {
1786 if (wID == lpTimer->wTimerID) {
1787 if (lpTimer->Prev != NULL) lpTimer->Prev->Next = lpTimer->Next;
1788 if (lpTimer->Next != NULL) lpTimer->Next->Prev = lpTimer->Prev;
1789 free(lpTimer);
1790 return TRUE;
1792 lpTimer = lpTimer->Next;
1794 return 0;
1797 /**************************************************************************
1798 * timeGetDevCaps [MMSYSTEM.604]
1800 WORD timeGetDevCaps(LPTIMECAPS lpCaps, WORD wSize)
1802 printf("timeGetDevCaps(%08X, %u) !\n", lpCaps, wSize);
1803 return 0;
1806 /**************************************************************************
1807 * timeBeginPeriod [MMSYSTEM.605]
1809 WORD timeBeginPeriod(WORD wPeriod)
1811 printf("timeBeginPeriod(%u) !\n", wPeriod);
1812 if (!mmTimeStarted) StartMMTime();
1813 return 0;
1816 /**************************************************************************
1817 * timeEndPeriod [MMSYSTEM.606]
1819 WORD timeEndPeriod(WORD wPeriod)
1821 printf("timeEndPeriod(%u) !\n", wPeriod);
1822 return 0;
1825 /**************************************************************************
1826 * timeGetTime [MMSYSTEM.607]
1828 DWORD timeGetTime()
1830 printf("timeGetTime(); !\n");
1831 if (!mmTimeStarted) StartMMTime();
1832 return 0;
1836 /**************************************************************************
1837 * mmioOpen [MMSYSTEM.1210]
1839 HMMIO WINAPI mmioOpen(LPSTR szFileName, MMIOINFO FAR* lpmmioinfo, DWORD dwOpenFlags)
1841 int hFile;
1842 HANDLE hmmio;
1843 OFSTRUCT ofs;
1844 LPMMIOINFO lpmminfo;
1845 printf("mmioOpen('%s', %08X, %08X);\n", szFileName, lpmmioinfo, dwOpenFlags);
1846 hFile = OpenFile(szFileName, &ofs, dwOpenFlags);
1847 if (hFile == -1) return 0;
1848 hmmio = GlobalAlloc(GMEM_MOVEABLE, sizeof(MMIOINFO));
1849 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1850 if (lpmminfo == NULL) return 0;
1851 memset(lpmminfo, 0, sizeof(MMIOINFO));
1852 lpmminfo->hmmio = hmmio;
1853 lpmminfo->dwReserved2 = MAKELONG(hFile, 0);
1854 GlobalUnlock(hmmio);
1855 return (HMMIO)hmmio;
1860 /**************************************************************************
1861 * mmioClose [MMSYSTEM.1211]
1863 UINT WINAPI mmioClose(HMMIO hmmio, UINT uFlags)
1865 LPMMIOINFO lpmminfo;
1866 printf("mmioClose(%04X, %04X);\n", hmmio, uFlags);
1867 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1868 if (lpmminfo == NULL) return 0;
1869 _lclose(LOWORD(lpmminfo->dwReserved2));
1870 GlobalUnlock(hmmio);
1871 GlobalFree(hmmio);
1872 return 0;
1877 /**************************************************************************
1878 * mmioRead [MMSYSTEM.1212]
1880 LONG WINAPI mmioRead(HMMIO hmmio, HPSTR pch, LONG cch)
1882 int count;
1883 LPMMIOINFO lpmminfo;
1884 #ifdef DEBUG_MMIO
1885 printf("mmioRead(%04X, %08X, %ld);\n", hmmio, pch, cch);
1886 #endif
1887 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1888 if (lpmminfo == NULL) return 0;
1889 count = _lread(LOWORD(lpmminfo->dwReserved2), pch, cch);
1890 GlobalUnlock(hmmio);
1891 return count;
1896 /**************************************************************************
1897 * mmioWrite [MMSYSTEM.1213]
1899 LONG WINAPI mmioWrite(HMMIO hmmio, HPCSTR pch, LONG cch)
1901 int count;
1902 LPMMIOINFO lpmminfo;
1903 printf("mmioWrite(%04X, %08X, %ld);\n", hmmio, pch, cch);
1904 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1905 if (lpmminfo == NULL) return 0;
1906 count = _lwrite(LOWORD(lpmminfo->dwReserved2), (LPSTR)pch, cch);
1907 GlobalUnlock(hmmio);
1908 return count;
1911 /**************************************************************************
1912 * mmioSeek [MMSYSTEM.1214]
1914 LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, int iOrigin)
1916 int count;
1917 LPMMIOINFO lpmminfo;
1918 printf("mmioSeek(%04X, %08X, %d);\n", hmmio, lOffset, iOrigin);
1919 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1920 if (lpmminfo == NULL) return 0;
1921 count = _llseek(LOWORD(lpmminfo->dwReserved2), lOffset, iOrigin);
1922 GlobalUnlock(hmmio);
1923 return count;
1926 /**************************************************************************
1927 * mmioGetInfo [MMSYSTEM.1215]
1929 UINT WINAPI mmioGetInfo(HMMIO hmmio, MMIOINFO FAR* lpmmioinfo, UINT uFlags)
1931 LPMMIOINFO lpmminfo;
1932 printf("mmioGetInfo\n");
1933 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1934 if (lpmminfo == NULL) return 0;
1935 memcpy(lpmmioinfo, lpmminfo, sizeof(MMIOINFO));
1936 GlobalUnlock(hmmio);
1937 return 0;
1940 /**************************************************************************
1941 * mmioSetInfo [MMSYSTEM.1216]
1943 UINT WINAPI mmioSetInfo(HMMIO hmmio, const MMIOINFO FAR* lpmmioinfo, UINT uFlags)
1945 LPMMIOINFO lpmminfo;
1946 printf("mmioSetInfo\n");
1947 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1948 if (lpmminfo == NULL) return 0;
1949 GlobalUnlock(hmmio);
1950 return 0;
1953 /**************************************************************************
1954 * mmioSetBuffer [MMSYSTEM.1217]
1956 UINT WINAPI mmioSetBuffer(HMMIO hmmio, LPSTR pchBuffer,
1957 LONG cchBuffer, UINT uFlags)
1959 printf("mmioSetBuffer\n");
1960 return 0;
1963 /**************************************************************************
1964 * mmioFlush [MMSYSTEM.1218]
1966 UINT WINAPI mmioFlush(HMMIO hmmio, UINT uFlags)
1968 LPMMIOINFO lpmminfo;
1969 printf("mmioFlush(%04X, %04X)\n", hmmio, uFlags);
1970 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1971 if (lpmminfo == NULL) return 0;
1972 GlobalUnlock(hmmio);
1973 return 0;
1976 /**************************************************************************
1977 * mmioAdvance [MMSYSTEM.1219]
1979 UINT WINAPI mmioAdvance(HMMIO hmmio, MMIOINFO FAR* lpmmioinfo, UINT uFlags)
1981 int count = 0;
1982 LPMMIOINFO lpmminfo;
1983 printf("mmioAdvance\n");
1984 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
1985 if (lpmminfo == NULL) return 0;
1986 if (uFlags == MMIO_READ) {
1987 count = _lread(LOWORD(lpmminfo->dwReserved2),
1988 lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer);
1990 if (uFlags == MMIO_WRITE) {
1991 count = _lwrite(LOWORD(lpmminfo->dwReserved2),
1992 lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer);
1994 lpmmioinfo->pchNext += count;
1995 GlobalUnlock(hmmio);
1996 lpmminfo->lDiskOffset = _llseek(LOWORD(lpmminfo->dwReserved2), 0, SEEK_CUR);
1997 return 0;
2000 /**************************************************************************
2001 * mmioStringToFOURCC [MMSYSTEM.1220]
2003 FOURCC WINAPI mmioStringToFOURCC(LPCSTR sz, UINT uFlags)
2005 printf("mmioStringToFOURCC\n");
2006 return 0;
2009 /**************************************************************************
2010 * mmioInstallIOProc [MMSYSTEM.1221]
2012 LPMMIOPROC WINAPI mmioInstallIOProc(FOURCC fccIOProc,
2013 LPMMIOPROC pIOProc, DWORD dwFlags)
2015 printf("mmioInstallIOProc\n");
2016 return 0;
2019 /**************************************************************************
2020 * mmioSendMessage [MMSYSTEM.1222]
2022 LRESULT WINAPI mmioSendMessage(HMMIO hmmio, UINT uMessage,
2023 LPARAM lParam1, LPARAM lParam2)
2025 printf("mmioSendMessage\n");
2026 return 0;
2029 /**************************************************************************
2030 * mmioDescend [MMSYSTEM.1223]
2032 UINT WINAPI mmioDescend(HMMIO hmmio, MMCKINFO FAR* lpck,
2033 const MMCKINFO FAR* lpckParent, UINT uFlags)
2035 DWORD dwfcc, dwOldPos;
2036 LPMMIOINFO lpmminfo;
2037 #ifdef DEBUG_MMIO
2038 printf("mmioDescend(%04X, %08X, %08X, %04X);\n",
2039 hmmio, lpck, lpckParent, uFlags);
2040 #endif
2041 if (lpck == NULL) return 0;
2042 lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
2043 if (lpmminfo == NULL) return 0;
2044 dwfcc = lpck->ckid;
2045 dwOldPos = _llseek(LOWORD(lpmminfo->dwReserved2), 0, SEEK_CUR);
2046 if (lpckParent != NULL) {
2047 #ifdef DEBUG_MMIO
2048 printf("mmioDescend // seek inside parent at %ld !\n", lpckParent->dwDataOffset);
2049 #endif
2050 dwOldPos = _llseek(LOWORD(lpmminfo->dwReserved2),
2051 lpckParent->dwDataOffset, SEEK_SET);
2053 if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDRIFF) ||
2054 (uFlags & MMIO_FINDLIST)) {
2055 #ifdef DEBUG_MMIO
2056 printf("mmioDescend // MMIO_FINDxxxx dwfcc=%08X !\n", dwfcc);
2057 #endif
2058 while (TRUE) {
2059 if (_lread(LOWORD(lpmminfo->dwReserved2), (LPSTR)lpck,
2060 sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
2061 _llseek(LOWORD(lpmminfo->dwReserved2), dwOldPos, SEEK_SET);
2062 GlobalUnlock(hmmio);
2063 return MMIOERR_CHUNKNOTFOUND;
2065 #ifdef DEBUG_MMIO
2066 printf("mmioDescend // dwfcc=%08X ckid=%08X cksize=%08X !\n",
2067 dwfcc, lpck->ckid, lpck->cksize);
2068 #endif
2069 if (dwfcc == lpck->ckid) break;
2070 dwOldPos += lpck->cksize + 2 * sizeof(DWORD);
2071 if (lpck->ckid == FOURCC_RIFF || lpck->ckid == FOURCC_LIST)
2072 dwOldPos += sizeof(DWORD);
2073 _llseek(LOWORD(lpmminfo->dwReserved2), dwOldPos, SEEK_SET);
2076 else {
2077 if (_lread(LOWORD(lpmminfo->dwReserved2), (LPSTR)lpck,
2078 sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
2079 _llseek(LOWORD(lpmminfo->dwReserved2), dwOldPos, SEEK_SET);
2080 GlobalUnlock(hmmio);
2081 return MMIOERR_CHUNKNOTFOUND;
2084 GlobalUnlock(hmmio);
2085 lpck->dwDataOffset = dwOldPos + 2 * sizeof(DWORD);
2086 if (lpck->ckid == FOURCC_RIFF || lpck->ckid == FOURCC_LIST)
2087 lpck->dwDataOffset += sizeof(DWORD);
2088 lpmminfo->lDiskOffset = _llseek(LOWORD(lpmminfo->dwReserved2),
2089 lpck->dwDataOffset, SEEK_SET);
2090 #ifdef DEBUG_MMIO
2091 printf("mmioDescend // lpck->ckid=%08X lpck->cksize=%ld !\n",
2092 lpck->ckid, lpck->cksize);
2093 printf("mmioDescend // lpck->fccType=%08X !\n", lpck->fccType);
2094 #endif
2095 return 0;
2098 /**************************************************************************
2099 * mmioAscend [MMSYSTEM.1224]
2101 UINT WINAPI mmioAscend(HMMIO hmmio, MMCKINFO FAR* lpck, UINT uFlags)
2103 printf("mmioAscend\n");
2104 return 0;
2107 /**************************************************************************
2108 * mmioCreateChunk [MMSYSTEM.1225]
2110 UINT WINAPI mmioCreateChunk(HMMIO hmmio, MMCKINFO FAR* lpck, UINT uFlags)
2112 printf("mmioCreateChunk\n");
2113 return 0;
2117 /**************************************************************************
2118 * mmioRename [MMSYSTEM.1226]
2120 UINT WINAPI mmioRename(LPCSTR szFileName, LPCSTR szNewFileName,
2121 MMIOINFO FAR* lpmmioinfo, DWORD dwRenameFlags)
2123 printf("mmioRename('%s', '%s', %08X, %08X);\n",
2124 szFileName, szNewFileName, lpmmioinfo, dwRenameFlags);
2125 return 0;
2128 /**************************************************************************
2129 * DrvOpen [MMSYSTEM.1100]
2131 HDRVR DrvOpen(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
2133 printf("DrvOpen('%s', '%s', %08X);\n",
2134 lpDriverName, lpSectionName, lParam);
2135 return OpenDriver(lpDriverName, lpSectionName, lParam);
2139 /**************************************************************************
2140 * DrvClose [MMSYSTEM.1101]
2142 LRESULT DrvClose(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
2144 printf("DrvClose(%04X, %08X, %08X);\n", hDrvr, lParam1, lParam2);
2145 return CloseDriver(hDrvr, lParam1, lParam2);
2149 /**************************************************************************
2150 * DrvSendMessage [MMSYSTEM.1102]
2152 LRESULT WINAPI DrvSendMessage(HDRVR hDriver, WORD msg, LPARAM lParam1, LPARAM lParam2)
2154 DWORD dwDevID = 0;
2155 printf("DrvSendMessage(%04X, %04X, %08X, %08X);\n",
2156 hDriver, msg, lParam1, lParam2);
2157 #ifndef WINELIB
2158 return CDAUDIO_DriverProc(dwDevID, hDriver, msg, lParam1, lParam2);
2159 #endif
2162 /**************************************************************************
2163 * DrvGetModuleHandle [MMSYSTEM.1103]
2165 HANDLE DrvGetModuleHandle(HDRVR hDrvr)
2167 printf("DrvGetModuleHandle(%04X);\n", hDrvr);
2171 /**************************************************************************
2172 * DrvDefDriverProc [MMSYSTEM.1104]
2174 LRESULT DrvDefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
2175 DWORD dwParam1, DWORD dwParam2)
2177 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
2181 #endif /* #ifdef WINELIB */