- Timestamp:
- Jul 16, 2003, 5:47:24 PM (22 years ago)
- Location:
- trunk/src/winmm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/winmm/mci.cpp
r8470 r10173 1 /* $Id: mci.cpp,v 1. 8 2002-05-22 15:50:24sandervl Exp $ */1 /* $Id: mci.cpp,v 1.9 2003-07-16 15:47:23 sandervl Exp $ */ 2 2 3 3 /* … … 25 25 #include <string.h> 26 26 #include <stdio.h> 27 #include "debugtools.h" 27 #include "debugtools.h" 28 28 29 29 #include <misc.h> … … 34 34 #include "winmm.h" 35 35 36 #define DBG_LOCALLOG 36 #define DBG_LOCALLOG DBG_mci 37 37 #include "dbglocal.h" 38 38 … … 48 48 DWORD dwParam2); 49 49 50 static LPWINE_MCIDRIVER 51 static UINT 50 static LPWINE_MCIDRIVER MCI_GetDriver(UINT16 wDevID) ; 51 static UINT MCI_GetDriverFromString(LPCSTR lpstrName); 52 52 53 53 /****************************************************************************/ … … 57 57 { 58 58 TRACE("Entering mciDriverNotify (%08X, %04x, %04X)\n", hwndCallback, uDeviceID, uStatus); 59 59 60 60 if (!IsWindow(hwndCallback)) { 61 62 61 WARN("bad hwnd for call back (0x%04x)\n", hwndCallback); 62 return FALSE; 63 63 } 64 64 TRACE("before PostMessage\n"); … … 127 127 DWORD WINAPI mciGetDriverData(UINT uDeviceID) 128 128 { 129 LPWINE_MCIDRIVER 130 129 LPWINE_MCIDRIVER wmd; 130 131 131 wmd = MCI_GetDriver(uDeviceID); 132 132 133 133 if (!wmd) { 134 134 dprintf(("WARNING: Bad uDeviceID (mciGetDriverData (mci.cpp line %d)\n",__LINE__)); 135 135 return 0L; /* Error */ 136 136 } 137 137 138 138 return wmd->dwPrivate; 139 139 } … … 183 183 char * theMsg = getWinmmMsg( mcierr ); 184 184 if ( theMsg ) 185 AsciiToUnicode ( theMsg, pszText );185 AsciiToUnicodeN( theMsg, pszText, cchText ); 186 186 else 187 187 { 188 188 char errMsg[100]; 189 189 sprintf( errMsg, "Unknown error number %d", mcierr ); 190 AsciiToUnicode ( errMsg, pszText );190 AsciiToUnicodeN( errMsg, pszText, cchText ); 191 191 } 192 192 return TRUE; … … 207 207 YIELDPROC WINAPI mciGetYieldProc(MCIDEVICEID mciId, LPDWORD pdwYieldData) 208 208 { 209 LPWINE_MCIDRIVER 210 209 LPWINE_MCIDRIVER wmd; 210 211 211 TRACE("Entering mciGetYieldProc (%u, %p) - untested\n", mciId, pdwYieldData); 212 212 213 213 if (!(wmd = MCI_GetDriver(mciId))) { 214 215 214 WARN("Bad uDeviceID\n"); 215 return NULL; 216 216 } 217 217 if (!wmd->lpfnYieldProc) { 218 219 218 WARN("No proc set\n"); 219 return NULL; 220 220 } 221 221 if (!wmd->bIs32) { 222 223 222 WARN("Proc is 32 bit\n"); 223 return NULL; 224 224 } 225 225 return wmd->lpfnYieldProc; … … 239 239 DWORD dwRet; 240 240 // dprintf(("WINMM:mciSendCommandA - entering %X %X %X %X\n", mciId, uMsg, dwParam1, dwParam2)); 241 dwRet= MCI_SendCommand((UINT) mciId, uMsg, dwParam1, dwParam2) & 0xFFFF; 241 dwRet= MCI_SendCommand((UINT) mciId, uMsg, dwParam1, dwParam2) & 0xFFFF; 242 242 return(dwRet); 243 243 } … … 269 269 BOOL WINAPI mciSetDriverData(UINT uDeviceID, DWORD dwData) 270 270 { 271 LPWINE_MCIDRIVER 272 271 LPWINE_MCIDRIVER wmd; 272 273 273 wmd = MCI_GetDriver(uDeviceID); 274 274 275 275 if (!wmd) { 276 277 278 } 279 276 dprintf(("WARNING: Bad uDeviceID (mciSetDriverData line %d)\n",__LINE__)); 277 return FALSE; 278 } 279 280 280 wmd->dwPrivate = dwData; 281 281 return TRUE; … … 285 285 BOOL WINAPI mciSetYieldProc(MCIDEVICEID mciId, YIELDPROC fpYieldProc, DWORD dwYieldData) 286 286 { 287 LPWINE_MCIDRIVER 288 287 LPWINE_MCIDRIVER wmd; 288 289 289 TRACE("WINMM:mciSetYieldProc (%u, %p, %08lx) - untested\n", mciId, fpYieldProc, dwYieldData); 290 290 291 291 if (!(wmd = MCI_GetDriver(mciId))) { 292 293 294 } 295 292 WARN("Bad uDeviceID\n"); 293 return FALSE; 294 } 295 296 296 wmd->lpfnYieldProc = fpYieldProc; 297 297 wmd->dwYieldData = dwYieldData; 298 298 wmd->bIs32 = TRUE; 299 299 300 300 return TRUE; 301 301 } … … 319 319 /**************************************************************************/ 320 320 321 static LPWINE_MM_IDATA 322 323 static LPWINE_MM_IDATAMULTIMEDIA_GetIDataNoCheck(void)324 { 325 DWORD 326 LPWINE_MM_IDATA 321 static LPWINE_MM_IDATA lpFirstIData = NULL; 322 323 static LPWINE_MM_IDATA MULTIMEDIA_GetIDataNoCheck(void) 324 { 325 DWORD pid = GetCurrentProcessId(); 326 LPWINE_MM_IDATA iData; 327 327 328 328 for (iData = lpFirstIData; iData; iData = iData->lpNextIData) { 329 329 if (iData->dwThisProcess == pid) 330 330 break; 331 331 } 332 332 return iData; … … 334 334 335 335 /************************************************************************** 336 * MULTIMEDIA_GetIData[internal]337 */ 338 LPWINE_MM_IDATA 339 { 340 LPWINE_MM_IDATA 336 * MULTIMEDIA_GetIData [internal] 337 */ 338 LPWINE_MM_IDATA MULTIMEDIA_GetIData(void) 339 { 340 LPWINE_MM_IDATA iData = MULTIMEDIA_GetIDataNoCheck(); 341 341 342 342 if (!iData) { … … 349 349 350 350 /************************************************************************** 351 * MULTIMEDIA_CreateIData[internal]351 * MULTIMEDIA_CreateIData [internal] 352 352 */ 353 353 BOOL MULTIMEDIA_CreateIData(HINSTANCE hInstDLL) 354 354 { 355 LPWINE_MM_IDATA 356 355 LPWINE_MM_IDATA iData; 356 357 357 iData = (LPWINE_MM_IDATA) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MM_IDATA)); 358 358 … … 370 370 371 371 /************************************************************************** 372 * MULTIMEDIA_DeleteIData[internal]372 * MULTIMEDIA_DeleteIData [internal] 373 373 */ 374 374 void MULTIMEDIA_DeleteIData(void) 375 375 { 376 LPWINE_MM_IDATA 377 LPWINE_MM_IDATA* 378 376 LPWINE_MM_IDATA iData = MULTIMEDIA_GetIDataNoCheck(); 377 LPWINE_MM_IDATA* ppid; 378 379 379 if (iData) { 380 381 382 383 384 385 386 /* FIXME: should also free content and resources allocated 387 388 380 for (ppid = &lpFirstIData; *ppid; ppid = &(*ppid)->lpNextIData) { 381 if (*ppid == iData) { 382 *ppid = iData->lpNextIData; 383 break; 384 } 385 } 386 /* FIXME: should also free content and resources allocated 387 * inside iData */ 388 HeapFree(GetProcessHeap(), 0, iData); 389 389 } 390 390 } … … 396 396 397 397 398 static intMCI_InstalledCount;399 static LPSTRMCI_lpInstallNames = NULL;398 static int MCI_InstalledCount; 399 static LPSTR MCI_lpInstallNames = NULL; 400 400 401 401 … … 405 405 406 406 /************************************************************************** 407 * MCI_GetDriver[internal]408 */ 409 static LPWINE_MCIDRIVER MCI_GetDriver(UINT16 wDevID)410 { 411 LPWINE_MCIDRIVER 412 LPWINE_MM_IDATA 407 * MCI_GetDriver [internal] 408 */ 409 static LPWINE_MCIDRIVER MCI_GetDriver(UINT16 wDevID) 410 { 411 LPWINE_MCIDRIVER wmd = 0; 412 LPWINE_MM_IDATA iData = MULTIMEDIA_GetIData(); 413 413 414 414 EnterCriticalSection(&iData->cs); 415 415 for (wmd = iData->lpMciDrvs; wmd; wmd = wmd->lpNext) { 416 417 416 if (wmd->wDeviceID == wDevID) 417 break; 418 418 } 419 419 LeaveCriticalSection(&iData->cs); … … 422 422 423 423 /************************************************************************** 424 * MCI_GetDriverFromString[internal]425 */ 426 static UINT 427 { 428 LPWINE_MCIDRIVER 429 LPWINE_MM_IDATA 430 UINT 424 * MCI_GetDriverFromString [internal] 425 */ 426 static UINT MCI_GetDriverFromString(LPCSTR lpstrName) 427 { 428 LPWINE_MCIDRIVER wmd; 429 LPWINE_MM_IDATA iData = MULTIMEDIA_GetIData(); 430 UINT ret = 0; 431 431 432 432 if (!lpstrName) 433 433 return 0; 434 434 435 435 if (!lstrcmpiA(lpstrName, "ALL")) 436 436 return MCI_ALL_DEVICE_ID; 437 437 438 438 EnterCriticalSection(&iData->cs); 439 439 for (wmd = iData->lpMciDrvs; wmd; wmd = wmd->lpNext) { 440 440 if (wmd->lpstrElementName && strcmp(wmd->lpstrElementName, lpstrName) == 0) { 441 442 443 } 444 441 ret = wmd->wDeviceID; 442 break; 443 } 444 445 445 if (wmd->lpstrDeviceType && strcmp(wmd->lpstrDeviceType, lpstrName) == 0) { 446 447 448 } 449 446 ret = wmd->wDeviceID; 447 break; 448 } 449 450 450 if (wmd->lpstrAlias && strcmp(wmd->lpstrAlias, lpstrName) == 0) { 451 452 451 ret = wmd->wDeviceID; 452 break; 453 453 } 454 454 } 455 455 LeaveCriticalSection(&iData->cs); 456 456 457 457 return ret; 458 458 } … … 460 460 461 461 /************************************************************************** 462 * MCI_GetDevTypeFromFileName[internal]463 */ 464 static DWORDMCI_GetDevTypeFromFileName(LPCSTR fileName, LPSTR buf, UINT len)465 { 466 LPSTR 462 * MCI_GetDevTypeFromFileName [internal] 463 */ 464 static DWORD MCI_GetDevTypeFromFileName(LPCSTR fileName, LPSTR buf, UINT len) 465 { 466 LPSTR tmp; 467 467 468 468 if ((tmp = strrchr(fileName, '.'))) { 469 469 GetProfileStringA("mci extensions", tmp + 1, "*", buf, len); 470 470 if (strcmp(buf, "*") != 0) { 471 471 return 0; 472 472 } 473 473 dprintf(("No [mci extensions] entry for '%s' found. MCI_GetDevTypeFromFileName: line %d, file 'mci.cpp'\n", tmp, __LINE__)); … … 477 477 478 478 479 #define MAX_MCICMDTABLE20480 #define MCI_COMMAND_TABLE_NOT_LOADED 481 482 483 484 /************************************************************************** 485 * MCI_DefYieldProc[internal]479 #define MAX_MCICMDTABLE 20 480 #define MCI_COMMAND_TABLE_NOT_LOADED 0xFFFE 481 482 483 484 /************************************************************************** 485 * MCI_DefYieldProc [internal] 486 486 */ 487 487 //UINT WINAPI MCI_DefYieldProc(MCIDEVICEID wDevID, DWORD data) … … 489 489 UINT16 WINAPI MCI_DefYieldProc(UINT16 wDevID, DWORD data) 490 490 { 491 INT16 492 493 #if 0 491 INT16 ret; 492 493 #if 0 494 494 dprintf(("(0x%04x, 0x%08lx)\n", wDevID, data)); 495 #endif 495 #endif 496 496 if ((HIWORD(data) != 0 && GetActiveWindow() != HIWORD(data)) || 497 497 (GetAsyncKeyState(LOWORD(data)) & 1) == 0) { 498 499 498 /* WINE stuff removed: UserYield16();*/ 499 ret = 0; 500 500 } else { 501 MSGmsg;502 503 504 505 501 MSG msg; 502 503 msg.hwnd = HIWORD(data); 504 while (!PeekMessageA(&msg, HIWORD(data), WM_KEYFIRST, WM_KEYLAST, PM_REMOVE)); 505 ret = -1; 506 506 } 507 507 return ret; … … 510 510 511 511 /************************************************************************** 512 * MCI_UnLoadMciDriver[internal]513 */ 514 static BOOLMCI_UnLoadMciDriver(LPWINE_MM_IDATA iData, LPWINE_MCIDRIVER wmd)515 { 516 LPWINE_MCIDRIVER* 512 * MCI_UnLoadMciDriver [internal] 513 */ 514 static BOOL MCI_UnLoadMciDriver(LPWINE_MM_IDATA iData, LPWINE_MCIDRIVER wmd) 515 { 516 LPWINE_MCIDRIVER* tmp; 517 517 518 518 #if 0 … … 522 522 return TRUE; 523 523 524 if (wmd->hDrv) 524 if (wmd->hDrv) 525 525 CloseDriver(wmd->hDrv, 0, 0); 526 526 … … 531 531 for (tmp = &iData->lpMciDrvs; *tmp; tmp = &(*tmp)->lpNext) { 532 532 if (*tmp == wmd) { 533 534 533 *tmp = wmd->lpNext; 534 break; 535 535 } 536 536 } … … 547 547 548 548 /************************************************************************** 549 * MCI_LoadMciDriver[internal]550 */ 551 static DWORD MCI_LoadMciDriver(LPWINE_MM_IDATA iData, LPCSTR _strDevTyp,552 553 { 554 LPSTR 555 LPWINE_MCIDRIVER 556 MCI_OPEN_DRIVER_PARMSA 557 DWORD 558 HDRVR 549 * MCI_LoadMciDriver [internal] 550 */ 551 static DWORD MCI_LoadMciDriver(LPWINE_MM_IDATA iData, LPCSTR _strDevTyp, 552 LPWINE_MCIDRIVER* lpwmd) 553 { 554 LPSTR strDevTyp = CharUpperA(HEAP_strdupA(GetProcessHeap(), 0, _strDevTyp)); 555 LPWINE_MCIDRIVER wmd = (LPWINE_MCIDRIVER)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wmd)); 556 MCI_OPEN_DRIVER_PARMSA modp; 557 DWORD dwRet = 0; 558 HDRVR hDrv = 0; 559 559 560 560 561 561 dprintf(("Entering MCI_LoadMciDriver...\n")); 562 562 563 563 if (!wmd || !strDevTyp) { 564 564 dwRet = MCIERR_OUT_OF_MEMORY; … … 579 579 iData->lpMciDrvs = wmd; 580 580 581 for (modp.wDeviceID = MCI_MAGIC; 582 MCI_GetDriver(modp.wDeviceID) != 0; 581 for (modp.wDeviceID = MCI_MAGIC; 582 MCI_GetDriver(modp.wDeviceID) != 0; 583 583 modp.wDeviceID++); 584 584 … … 592 592 593 593 hDrv = OpenDriverA(strDevTyp, "mci", (LPARAM)&modp); 594 594 595 595 if (!hDrv) { 596 596 dprintf(("Couldn't load driver for type %s.\n" … … 600 600 dwRet = MCIERR_DEVICE_NOT_INSTALLED; 601 601 goto errCleanUp; 602 } 602 } 603 603 604 604 /* FIXME: should also check that module's description is of the form … … 611 611 wmd->uTypeCmdTable = MCI_COMMAND_TABLE_NOT_LOADED; 612 612 613 dprintf(("Loaded driver %x (%s), type is %d, cmdTable=%08x\n", 614 615 616 613 dprintf(("Loaded driver %x (%s), type is %d, cmdTable=%08x\n", 614 hDrv, strDevTyp, modp.wType, modp.wCustomCommandTable)); 615 616 617 617 wmd->wType = modp.wType; 618 618 619 #if 0 620 dprintf(("mcidev=%d, uDevTyp=%04X wDeviceID=%04X !\n", 619 #if 0 620 dprintf(("mcidev=%d, uDevTyp=%04X wDeviceID=%04X !\n", 621 621 modp.wDeviceID, modp.wType, modp.wDeviceID)); 622 622 #endif … … 637 637 638 638 /************************************************************************** 639 * MCI_SendCommandFrom32[internal]639 * MCI_SendCommandFrom32 [internal] 640 640 */ 641 641 static DWORD MCI_SendCommandFrom32(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2) 642 642 { 643 DWORD 644 LPWINE_MCIDRIVER 643 DWORD dwRet = MCIERR_DEVICE_NOT_INSTALLED; 644 LPWINE_MCIDRIVER wmd = MCI_GetDriver(wDevID); 645 645 646 646 if (!wmd) { … … 649 649 switch (GetDriverFlags(wmd->hDrv) & (WINE_GDF_EXIST)) { 650 650 case WINE_GDF_EXIST: 651 652 651 dwRet = SendDriverMessage(wmd->hDrv, wMsg, dwParam1, dwParam2); 652 break; 653 653 default: 654 655 654 dprintf(("Unknown driver %u\n", wmd->hDrv)); 655 dwRet = MCIERR_DRIVER_INTERNAL; 656 656 } 657 657 } 658 658 return dwRet; 659 659 } 660 661 /************************************************************************** 662 * MCI_FinishOpen[internal]663 */ 664 static DWORD MCI_FinishOpen(LPWINE_MCIDRIVER wmd, LPMCI_OPEN_PARMSA lpParms,660 661 /************************************************************************** 662 * MCI_FinishOpen [internal] 663 */ 664 static DWORD MCI_FinishOpen(LPWINE_MCIDRIVER wmd, LPMCI_OPEN_PARMSA lpParms, 665 665 DWORD dwParam) 666 666 { 667 667 if (dwParam & MCI_OPEN_ELEMENT) 668 wmd->lpstrElementName = HEAP_strdupA(GetProcessHeap(), 0, 668 wmd->lpstrElementName = HEAP_strdupA(GetProcessHeap(), 0, 669 669 lpParms->lpstrElementName); 670 670 671 671 if (dwParam & MCI_OPEN_ALIAS) 672 673 672 wmd->lpstrAlias = HEAP_strdupA(GetProcessHeap(), 0, lpParms->lpstrAlias); 673 674 674 lpParms->wDeviceID = wmd->wDeviceID; 675 676 return MCI_SendCommandFrom32(wmd->wDeviceID, MCI_OPEN_DRIVER, dwParam, 675 676 return MCI_SendCommandFrom32(wmd->wDeviceID, MCI_OPEN_DRIVER, dwParam, 677 677 (DWORD)lpParms); 678 678 } 679 679 680 680 /************************************************************************** 681 * MCI_Open[internal]682 */ 683 static 684 { 685 char 686 DWORD dwRet;687 LPWINE_MCIDRIVER 688 689 LPWINE_MM_IDATA 681 * MCI_Open [internal] 682 */ 683 static DWORD MCI_Open(DWORD dwParam, LPMCI_OPEN_PARMSA lpParms) 684 { 685 char strDevTyp[128]; 686 DWORD dwRet; 687 LPWINE_MCIDRIVER wmd = NULL; 688 689 LPWINE_MM_IDATA iData = MULTIMEDIA_GetIData(); 690 690 691 691 dprintf(("Entering MCI_OPEN...\n")); … … 694 694 695 695 /* only two low bytes are generic, the other ones are dev type specific */ 696 #define WINE_MCIDRIVER_SUPP 696 #define WINE_MCIDRIVER_SUPP (0xFFFF0000|MCI_OPEN_SHAREABLE|MCI_OPEN_ELEMENT| \ 697 697 MCI_OPEN_ALIAS|MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID| \ 698 698 MCI_NOTIFY|MCI_WAIT) 699 699 if ((dwParam & ~WINE_MCIDRIVER_SUPP) != 0) { 700 700 dprintf(("Unsupported yet dwFlags=%08lX\n", dwParam & ~WINE_MCIDRIVER_SUPP)); 701 701 } 702 702 #undef WINE_MCIDRIVER_SUPP … … 706 706 if (dwParam & MCI_OPEN_TYPE) { 707 707 if (dwParam & MCI_OPEN_TYPE_ID) { 708 708 WORD uDevType = LOWORD((DWORD)lpParms->lpstrDeviceType); 709 709 if (uDevType < MCI_DEVTYPE_FIRST || 710 710 uDevType > MCI_DEVTYPE_LAST || … … 715 715 } 716 716 } else { 717 LPSTRptr;718 717 LPSTR ptr; 718 if (lpParms->lpstrDeviceType == NULL) { 719 719 dwRet = MCIERR_NULL_PARAMETER_BLOCK; 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 720 goto errCleanUp; 721 } 722 strcpy(strDevTyp, lpParms->lpstrDeviceType); 723 ptr = strchr(strDevTyp, '!'); 724 if (ptr) { 725 /* this behavior is not documented in windows. However, since, in 726 * some occasions, MCI_OPEN handling is translated by WinMM into 727 * a call to mciSendString("open <type>"); this code shall be correct 728 */ 729 if (dwParam & MCI_OPEN_ELEMENT) { 730 dprintf(("Both MCI_OPEN_ELEMENT(%s) and %s are used\n", 731 lpParms->lpstrElementName, strDevTyp)); 732 dwRet = MCIERR_UNRECOGNIZED_KEYWORD; 733 goto errCleanUp; 734 } 735 dwParam |= MCI_OPEN_ELEMENT; 736 *ptr++ = 0; 737 /* FIXME: not a good idea to write in user supplied buffer */ 738 lpParms->lpstrElementName = ptr; 739 } 740 741 741 } 742 742 dprintf(("MCI_OPEN (MCI_OPEN_TYPE): devType='%s' !\n", strDevTyp)); 743 743 } 744 744 745 745 if (dwParam & MCI_OPEN_ELEMENT) { 746 746 dprintf(("lpstrElementName='%s'\n", lpParms->lpstrElementName)); 747 747 748 748 if (dwParam & MCI_OPEN_ELEMENT_ID) { 749 750 751 749 dprintf(("Unsupported yet flag MCI_OPEN_ELEMENT_ID\n")); 750 dwRet = MCIERR_UNRECOGNIZED_KEYWORD; 751 goto errCleanUp; 752 752 } 753 753 754 754 if (!lpParms->lpstrElementName) { 755 756 755 dwRet = MCIERR_NULL_PARAMETER_BLOCK; 756 goto errCleanUp; 757 757 } 758 758 … … 760 760 /* Only working on my machine!! CW */ 761 761 if(lpParms->lpstrElementName[0]=='N') { 762 762 dprintf(("Discarding drive N:\n")); 763 763 dwRet = MCIERR_UNRECOGNIZED_KEYWORD; 764 764 goto errCleanUp; 765 765 } 766 766 #endif 767 767 768 768 /* type, if given as a parameter, supersedes file extension */ 769 if (!strDevTyp[0] && 770 MCI_GetDevTypeFromFileName(lpParms->lpstrElementName, 769 if (!strDevTyp[0] && 770 MCI_GetDevTypeFromFileName(lpParms->lpstrElementName, 771 771 strDevTyp, sizeof(strDevTyp))) { 772 772 if (GetDriveTypeA(lpParms->lpstrElementName) != DRIVE_CDROM) { … … 778 778 } 779 779 } 780 780 781 781 if (strDevTyp[0] == 0) { 782 782 dprintf(("Couldn't load driver (MCI_Open line %d)\n",__LINE__)); … … 788 788 dprintf(("MCI_OPEN_ALIAS requested\n")); 789 789 if (!lpParms->lpstrAlias) { 790 791 790 dwRet = MCIERR_NULL_PARAMETER_BLOCK; 791 goto errCleanUp; 792 792 } 793 793 dprintf(("Alias='%s' !\n", lpParms->lpstrAlias)); 794 794 } 795 795 796 796 if ((dwRet = MCI_LoadMciDriver(iData, strDevTyp, &wmd))) { 797 797 goto errCleanUp; … … 822 822 // mciDriverNotify16(lpParms->dwCallback, 0, MCI_NOTIFY_FAILURE); 823 823 dprintf(("FIXME: MCI_NOTIFY not implemented yet! MCI_Open (line %d)\n",__LINE__)); 824 824 825 825 dprintf(("Leaving MCI_Open on error...\n")); 826 826 return dwRet; … … 829 829 830 830 /************************************************************************** 831 * MCI_Close[internal]832 */ 833 static 834 { 835 DWORD 836 LPWINE_MCIDRIVER 837 LPWINE_MM_IDATA 838 831 * MCI_Close [internal] 832 */ 833 static DWORD MCI_Close(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms) 834 { 835 DWORD dwRet; 836 LPWINE_MCIDRIVER wmd; 837 LPWINE_MM_IDATA iData = MULTIMEDIA_GetIData(); 838 839 839 //dprintf(("(%04x, %08lX, %p)\n", wDevID, dwParam, lpParms)); 840 840 841 841 if (wDevID == MCI_ALL_DEVICE_ID) { 842 LPWINE_MCIDRIVERnext;843 844 845 /* FIXME: shall I notify once after all is done, or for 846 847 848 849 842 LPWINE_MCIDRIVER next; 843 844 EnterCriticalSection(&iData->cs); 845 /* FIXME: shall I notify once after all is done, or for 846 * each of the open drivers ? if the latest, which notif 847 * to return when only one fails ? 848 */ 849 for (wmd = iData->lpMciDrvs; wmd; ) { 850 850 next = wmd->lpNext; 851 851 MCI_Close(wmd->wDeviceID, dwParam, lpParms); 852 852 wmd = next; 853 } 854 855 853 } 854 LeaveCriticalSection(&iData->cs); 855 return 0; 856 856 } 857 857 858 858 if (!(wmd = MCI_GetDriver(wDevID))) { 859 859 return MCIERR_INVALID_DEVICE_ID; 860 860 } 861 861 862 862 dwRet = MCI_SendCommandFrom32(wDevID, MCI_CLOSE_DRIVER, dwParam, (DWORD)lpParms); 863 863 864 864 MCI_UnLoadMciDriver(iData, wmd); 865 865 866 866 if (dwParam & MCI_NOTIFY) 867 867 dprintf(("FIXME: MCI_NOTIFY not implemented yet! MCI_Close (line %d)\n",__LINE__)); 868 // 868 // mciDriverNotify16(lpParms->dwCallback, wDevID, 869 869 // (dwRet == 0) ? MCI_NOTIFY_SUCCESSFUL : MCI_NOTIFY_FAILURE); 870 870 871 871 return dwRet; 872 872 } … … 874 874 875 875 /************************************************************************** 876 * MCI_WriteString[internal]877 */ 878 DWORD 879 { 880 DWORD 876 * MCI_WriteString [internal] 877 */ 878 DWORD MCI_WriteString(LPSTR lpDstStr, DWORD dstSize, LPCSTR lpSrcStr) 879 { 880 DWORD ret = 0; 881 881 882 882 if (lpSrcStr) { 883 if (dstSize <= strlen(lpSrcStr)) { 884 lstrcpynA(lpDstStr, lpSrcStr, dstSize - 1); 885 ret = MCIERR_PARAM_OVERFLOW; 886 } else { 887 strcpy(lpDstStr, lpSrcStr); 888 } 883 if (dstSize <= strlen(lpSrcStr)) { 884 lstrcpynA(lpDstStr, lpSrcStr, dstSize - 1); 885 ret = MCIERR_PARAM_OVERFLOW; 889 886 } else { 890 *lpDstStr = 0; 887 strcpy(lpDstStr, lpSrcStr); 888 } 889 } else { 890 *lpDstStr = 0; 891 891 } 892 892 return ret; … … 895 895 896 896 /************************************************************************** 897 * MCI_Sysinfo[internal]898 */ 899 static 900 { 901 DWORD 902 LPWINE_MCIDRIVER 903 LPWINE_MM_IDATA 904 905 if (lpParms == NULL) 906 907 TRACE("(%08x, %08lX, %08lX[num=%ld, wDevTyp=%u])\n", 908 909 897 * MCI_Sysinfo [internal] 898 */ 899 static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSA lpParms) 900 { 901 DWORD ret = MCIERR_INVALID_DEVICE_ID; 902 LPWINE_MCIDRIVER wmd; 903 LPWINE_MM_IDATA iData = MULTIMEDIA_GetIData(); 904 905 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK; 906 907 TRACE("(%08x, %08lX, %08lX[num=%ld, wDevTyp=%u])\n", 908 uDevID, dwFlags, (DWORD)lpParms, lpParms->dwNumber, lpParms->wDeviceType); 909 910 910 switch (dwFlags & ~MCI_SYSINFO_OPEN) { 911 911 case MCI_SYSINFO_QUANTITY: 912 912 { 913 DWORDcnt = 0;914 915 if (lpParms->wDeviceType < MCI_DEVTYPE_FIRST || 913 DWORD cnt = 0; 914 915 if (lpParms->wDeviceType < MCI_DEVTYPE_FIRST || 916 916 lpParms->wDeviceType > MCI_DEVTYPE_LAST) { 917 917 if (dwFlags & MCI_SYSINFO_OPEN) { 918 919 920 918 TRACE("MCI_SYSINFO_QUANTITY: # of open MCI drivers\n"); 919 EnterCriticalSection(&iData->cs); 920 for (wmd = iData->lpMciDrvs; wmd; wmd = wmd->lpNext) { 921 921 cnt++; 922 923 922 } 923 LeaveCriticalSection(&iData->cs); 924 924 } else { 925 926 925 TRACE("MCI_SYSINFO_QUANTITY: # of installed MCI drivers\n"); 926 cnt = MCI_InstalledCount; 927 927 } 928 928 } else { 929 929 if (dwFlags & MCI_SYSINFO_OPEN) { 930 TRACE("MCI_SYSINFO_QUANTITY: # of open MCI drivers of type %u\n", 930 TRACE("MCI_SYSINFO_QUANTITY: # of open MCI drivers of type %u\n", 931 931 lpParms->wDeviceType); 932 933 932 EnterCriticalSection(&iData->cs); 933 for (wmd = iData->lpMciDrvs; wmd; wmd = wmd->lpNext) { 934 934 if (wmd->wType == lpParms->wDeviceType) 935 936 937 935 cnt++; 936 } 937 LeaveCriticalSection(&iData->cs); 938 938 } else { 939 TRACE("MCI_SYSINFO_QUANTITY: # of installed MCI drivers of type %u\n", 939 TRACE("MCI_SYSINFO_QUANTITY: # of installed MCI drivers of type %u\n", 940 940 lpParms->wDeviceType); 941 942 941 FIXME("Don't know how to get # of MCI devices of a given type\n"); 942 cnt = 1; 943 943 } 944 945 944 } 945 *(DWORD*)lpParms->lpstrReturn = cnt; 946 946 } 947 947 TRACE("(%ld) => '%ld'\n", lpParms->dwNumber, *(DWORD*)lpParms->lpstrReturn); … … 951 951 TRACE("MCI_SYSINFO_INSTALLNAME \n"); 952 952 if ((wmd = MCI_GetDriver(uDevID))) { 953 ret = MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, 953 ret = MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, 954 954 wmd->lpstrDeviceType); 955 955 } else { 956 957 956 *lpParms->lpstrReturn = 0; 957 ret = MCIERR_INVALID_DEVICE_ID; 958 958 } 959 959 TRACE("(%ld) => '%s'\n", lpParms->dwNumber, lpParms->lpstrReturn); … … 962 962 TRACE("MCI_SYSINFO_NAME\n"); 963 963 if (dwFlags & MCI_SYSINFO_OPEN) { 964 965 964 FIXME("Don't handle MCI_SYSINFO_NAME|MCI_SYSINFO_OPEN (yet)\n"); 965 ret = MCIERR_UNRECOGNIZED_COMMAND; 966 966 } else if (lpParms->dwNumber > MCI_InstalledCount) { 967 967 ret = MCIERR_OUTOFRANGE; 968 968 } else { 969 DWORDcount = lpParms->dwNumber;970 LPSTRptr = MCI_lpInstallNames;971 972 973 969 DWORD count = lpParms->dwNumber; 970 LPSTR ptr = MCI_lpInstallNames; 971 972 while (--count > 0) ptr += strlen(ptr) + 1; 973 ret = MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, ptr); 974 974 } 975 975 TRACE("(%ld) => '%s'\n", lpParms->dwNumber, lpParms->lpstrReturn); … … 984 984 985 985 /************************************************************************** 986 * MCI_Break[internal]987 */ 988 static 989 { 990 DWORD 991 992 if (lpParms == NULL) 986 * MCI_Break [internal] 987 */ 988 static DWORD MCI_Break(UINT wDevID, DWORD dwFlags, LPMCI_BREAK_PARMS lpParms) 989 { 990 DWORD dwRet = 0; 991 992 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK; 993 993 994 994 if (dwFlags & MCI_NOTIFY) 995 995 dprintf(("FIXME: MCI_NOTIFY not implemented yet! MCI_Break (line %d)\n",__LINE__)); 996 // 997 // 996 // mciDriverNotify16(lpParms->dwCallback, wDevID, 997 // (dwRet == 0) ? MCI_NOTIFY_SUCCESSFUL : MCI_NOTIFY_FAILURE); 998 998 999 999 return dwRet; 1000 1000 } 1001 1001 1002 1003 /************************************************************************** 1004 * MCI_SendCommand[internal]1005 */ 1006 static DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1,1007 1008 { 1009 DWORD 1002 1003 /************************************************************************** 1004 * MCI_SendCommand [internal] 1005 */ 1006 static DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1, 1007 DWORD dwParam2) 1008 { 1009 DWORD dwRet = MCIERR_UNRECOGNIZED_COMMAND; 1010 1010 1011 1011 switch (wMsg) { … … 1029 1029 default: 1030 1030 if (wDevID == MCI_ALL_DEVICE_ID) { 1031 1032 1031 dprintf(("MCI_SendCommand: unhandled MCI_ALL_DEVICE_ID\n")); 1032 dwRet = MCIERR_CANNOT_USE_ALL; 1033 1033 } else { 1034 1034 dwRet=MCI_SendCommandFrom32(wDevID, wMsg, dwParam1, dwParam2); 1035 } 1035 } 1036 1036 break; 1037 1037 } … … 1043 1043 1044 1044 /************************************************************************** 1045 * MULTIMEDIA_MciInit[internal]1045 * MULTIMEDIA_MciInit [internal] 1046 1046 * 1047 1047 * Initializes the MCI internal variables. … … 1050 1050 BOOL MULTIMEDIA_MciInit(void) 1051 1051 { 1052 LPSTR 1053 HKEY 1054 HKEY 1055 DWORD 1056 DWORD 1057 DWORD 1052 LPSTR ptr1, ptr2; 1053 HKEY hWineConf; 1054 HKEY hkey; 1055 DWORD err; 1056 DWORD type; 1057 DWORD count = 2048; 1058 1058 1059 1059 MCI_InstalledCount = 0; … … 1077 1077 TRACE("Wine => '%s' \n", ptr1); 1078 1078 while ((ptr2 = strchr(ptr1, ':')) != 0) { 1079 1080 1081 1082 1079 *ptr2++ = 0; 1080 TRACE("---> '%s' \n", ptr1); 1081 MCI_InstalledCount++; 1082 ptr1 = ptr2; 1083 1083 } 1084 1084 MCI_InstalledCount++; … … 1088 1088 GetPrivateProfileStringA("mci", NULL, "", MCI_lpInstallNames, count, "SYSTEM.INI"); 1089 1089 while (strlen(ptr1) > 0) { 1090 1091 1092 1090 TRACE("---> '%s' \n", ptr1); 1091 ptr1 += strlen(ptr1) + 1; 1092 MCI_InstalledCount++; 1093 1093 } 1094 1094 } -
trunk/src/winmm/midi.cpp
r8470 r10173 1 /* $Id: midi.cpp,v 1.1 0 2002-05-22 15:50:24 sandervl Exp $ */1 /* $Id: midi.cpp,v 1.11 2003-07-16 15:47:24 sandervl Exp $ */ 2 2 3 3 /* … … 28 28 #include <wprocess.h> 29 29 30 #define DBG_LOCALLOG 30 #define DBG_LOCALLOG DBG_midi 31 31 #include "dbglocal.h" 32 32 … … 262 262 char * theMsg = getWinmmMsg( wError ); 263 263 if ( theMsg ) 264 AsciiToUnicode ( theMsg, lpText );264 AsciiToUnicodeN( theMsg, lpText, cchText ); 265 265 else 266 266 { 267 267 char errMsg[100]; 268 268 sprintf( errMsg, "Unknown error number %d", wError ); 269 AsciiToUnicode ( errMsg, lpText );269 AsciiToUnicodeN( errMsg, lpText, cchText ); 270 270 } 271 271 return MMSYSERR_NOERROR; … … 581 581 char * theMsg = getWinmmMsg( wError ); 582 582 if ( theMsg ) 583 AsciiToUnicode ( theMsg, lpText );583 AsciiToUnicodeN( theMsg, lpText, cchText ); 584 584 else 585 585 { 586 586 char errMsg[100]; 587 587 sprintf( errMsg, "Unknown error number %d", wError ); 588 AsciiToUnicode ( errMsg, lpText );588 AsciiToUnicodeN( errMsg, lpText, cchText ); 589 589 } 590 590 return MMSYSERR_NOERROR; -
trunk/src/winmm/wavein.cpp
r8508 r10173 1 /* $Id: wavein.cpp,v 1.1 2 2002-05-28 14:09:24 sandervl Exp $ */1 /* $Id: wavein.cpp,v 1.13 2003-07-16 15:47:24 sandervl Exp $ */ 2 2 3 3 /* … … 47 47 return(WAVERR_BADFORMAT); 48 48 49 if(fdwOpen & WAVE_FORMAT_QUERY) 49 if(fdwOpen & WAVE_FORMAT_QUERY) 50 50 { 51 51 if(DartWaveIn::queryFormat(pwfx->wFormatTag, pwfx->nChannels, pwfx->nSamplesPerSec, 52 pwfx->wBitsPerSample) == TRUE) 52 pwfx->wBitsPerSample) == TRUE) 53 53 { 54 54 return(MMSYSERR_NOERROR); … … 304 304 char * theMsg = getWinmmMsg( wError ); 305 305 if ( theMsg ) 306 AsciiToUnicode ( theMsg, lpText );306 AsciiToUnicodeN( theMsg, lpText, cchText ); 307 307 else 308 308 { 309 309 char errMsg[100]; 310 310 sprintf( errMsg, "Unknown error number %d", wError ); 311 AsciiToUnicode ( errMsg, lpText );311 AsciiToUnicodeN( errMsg, lpText, cchText ); 312 312 } 313 313 return MMSYSERR_NOERROR; -
trunk/src/winmm/waveout.cpp
r9916 r10173 1 /* $Id: waveout.cpp,v 1.2 6 2003-03-06 15:42:33sandervl Exp $ */1 /* $Id: waveout.cpp,v 1.27 2003-07-16 15:47:24 sandervl Exp $ */ 2 2 //#undef DEBUG 3 3 /* … … 39 39 /******************************************************************************/ 40 40 /******************************************************************************/ 41 MMRESULT WINAPI waveOutOpen(LPHWAVEOUT phwo, UINT uDeviceID, const LPWAVEFORMATEX pwfx, 41 MMRESULT WINAPI waveOutOpen(LPHWAVEOUT phwo, UINT uDeviceID, const LPWAVEFORMATEX pwfx, 42 42 DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen) 43 43 { … … 49 49 return(WAVERR_BADFORMAT); 50 50 51 if(fdwOpen & WAVE_FORMAT_QUERY) 51 if(fdwOpen & WAVE_FORMAT_QUERY) 52 52 { 53 53 if(DartWaveOut::queryFormat(pwfx->wFormatTag, pwfx->nChannels, pwfx->nSamplesPerSec, … … 332 332 char * theMsg = getWinmmMsg( wError ); 333 333 if(theMsg) { 334 AsciiToUnicode ( theMsg, lpText );334 AsciiToUnicodeN( theMsg, lpText, cchText ); 335 335 } 336 336 else … … 338 338 char errMsg[100]; 339 339 sprintf( errMsg, "Unknown error number %d", wError ); 340 AsciiToUnicode ( errMsg, lpText );340 AsciiToUnicodeN( errMsg, lpText, cchText ); 341 341 } 342 342 return MMSYSERR_NOERROR; … … 419 419 { 420 420 WaveOut *dwave = (WaveOut *)hwo; 421 421 422 422 dprintf(("waveOutSetPlaybackRate: NOT IMPLEMENTED!!")); 423 423 if(WaveOut::find(dwave) == TRUE)
Note:
See TracChangeset
for help on using the changeset viewer.