home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / TOOLKIT / MM / MCDTEMP / MCDDRVRT.C < prev    next >
C/C++ Source or Header  |  1994-11-17  |  7KB  |  117 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /* SOURCE FILE NAME:  MCDDRVRT.C                                            */
  4. /*                                                                          */
  5. /* DESCRIPTIVE NAME:  MCIDRV_RESTORE MESSAGE HANDLER                        */
  6. /*                                                                          */
  7. /* COPYRIGHT:  (c) IBM Corp. 1991 - 1993                                    */
  8. /*                                                                          */
  9. /* FUNCTION:  This file contains routines to handle the MCIDRV_RESTORE      */
  10. /*            message.  This message tells us to make this device instance  */
  11. /*            active again.  Restore the device based on the saved state    */
  12. /*            information in the instance structure.                        */
  13. /*                                                                          */
  14. /* ENTRY POINTS:                                                            */
  15. /*       MCIDRVRestore() - MCIDRV_RESTORE message handler                   */
  16. /*       MCIDRVRestoreErr() - Error handler for MCIDRV_RESTORE message      */
  17. /****************************************************************************/
  18. #define INCL_BASE                    // Base OS2 functions
  19. #define INCL_DOSSEMAPHORES           // OS2 Semaphore function
  20. #define INCL_MCIOS2                  // use the OS/2 like MMPM/2 headers
  21.  
  22. #include <os2.h>                     // OS2 defines.
  23. #include <string.h>                  // string prototypes
  24. #include <stdlib.h>                  // standard C functions
  25. #include <os2me.h>                   // MME includes files.
  26. #include "mcdtemp.h"                 // MCD Function Prototypes and typedefs
  27.  
  28. /****************************************************************************/
  29. /*                                                                          */
  30. /* SUBROUTINE NAME:  MCIDRVRestore                                          */
  31. /*                                                                          */
  32. /* DESCRIPTIVE NAME:  MCIDRV_RESTORE message handler.                       */
  33. /*                                                                          */
  34. /* FUNCTION:  Query current master audio settings, and make this instance   */
  35. /*            active.                                                       */
  36. /*                                                                          */
  37. /* PARAMETERS:                                                              */
  38. /*      FUNCTION_PARM_BLOCK  *pFuncBlock -- Pointer to function parameter   */
  39. /*                                          block.                          */
  40. /* EXIT CODES:                                                              */
  41. /*      MCIERR_SUCCESS    -- Action completed without error.                */
  42. /*            .                                                             */
  43. /*            .                                                             */
  44. /*            .                                                             */
  45. /*            .                                                             */
  46. /*                                                                          */
  47. /****************************************************************************/
  48. RC MCIDRVRestore (FUNCTION_PARM_BLOCK *pFuncBlock)
  49. {
  50.   ULONG                ulrc = MCIERR_SUCCESS;    // Propogated Error Code
  51.   ULONG                ulParam1;                 // Message flags
  52.   PMCI_GENERIC_PARMS   pDrvRestoreParms;         // Pointer to GENERIC structure
  53.   PINSTANCE            pInstance;                // Pointer to instance
  54.  
  55.   /*****************************************************/
  56.   /* dereference the values from pFuncBlock            */
  57.   /*****************************************************/
  58.   ulParam1       = pFuncBlock->ulParam1;
  59.   pInstance      = pFuncBlock->pInstance;
  60.   pDrvRestoreParms = (PMCI_GENERIC_PARMS)pFuncBlock->pParam2;
  61.  
  62.  
  63.   /*****************************************************/
  64.   /* NOTE ----->>>                                     */
  65.   /*  This is the basic function that should be        */
  66.   /*  performed.  See the other samples in the toolkit */
  67.   /*  for streaming and MMIO considerations            */
  68.   /*****************************************************/
  69.   DosRequestMutexSem (pInstance->hmtxAccessSem, -2);  // wait for semaphore
  70.   pInstance->Active = TRUE;                           // Set active to TRUE
  71.   QMAudio(pInstance);                                 // Get master audio settings
  72.   DosReleaseMutexSem (pInstance->hmtxAccessSem);      // release semaphore
  73.  
  74.  
  75.   return (ulrc);
  76.  
  77. }      /* end of Open */
  78.  
  79.  
  80. /****************************************************************************/
  81. /*                                                                          */
  82. /* SUBROUTINE NAME:  MCIDRVRestoreErr                                       */
  83. /*                                                                          */
  84. /* DESCRIPTIVE NAME:  MCIDRV_RESTORE message handler for errors             */
  85. /*                                                                          */
  86. /* FUNCTION:  Check for errors for the MCIDRV_RESTORE message.              */
  87. /*                                                                          */
  88. /* PARAMETERS:                                                              */
  89. /*      FUNCTION_PARM_BLOCK  *pFuncBlock -- Pointer to function parameter   */
  90. /*                                          block.                          */
  91. /* EXIT CODES:                                                              */
  92. /*      MCIERR_SUCCESS    -- Action completed without error.                */
  93. /*            .                                                             */
  94. /*            .                                                             */
  95. /*            .                                                             */
  96. /*            .                                                             */
  97. /*                                                                          */
  98. /****************************************************************************/
  99. RC MCIDRVRestoreErr (FUNCTION_PARM_BLOCK *pFuncBlock)
  100. {
  101.   ULONG                ulrc = MCIERR_SUCCESS;    // Propogated Error Code
  102.   ULONG                ulParam1;                 // Message flags
  103.   PMCI_GENERIC_PARMS   pDrvRestoreParms;         // Pointer to GENERIC structure
  104.   PINSTANCE            pInstance;                // Pointer to instance
  105.  
  106.   /*****************************************************/
  107.   /* dereference the values from pFuncBlock            */
  108.   /*****************************************************/
  109.   ulParam1       = pFuncBlock->ulParam1;
  110.   pInstance      = pFuncBlock->pInstance;
  111.   pDrvRestoreParms = (PMCI_GENERIC_PARMS)pFuncBlock->pParam2;
  112.  
  113.  
  114.   return (ulrc);
  115.  
  116. }      /* end of Open */
  117.