home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / mm / mcdtemp / mcddrvsv.c < prev    next >
C/C++ Source or Header  |  1999-05-11  |  7KB  |  120 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /* SOURCE FILE NAME:  MCDDRVSV.C                                            */
  4. /*                                                                          */
  5. /* DESCRIPTIVE NAME:  MCIDRV_SAVE MESSAGE HANDLER                           */
  6. /*                                                                          */
  7. /* COPYRIGHT:  (c) IBM Corp. 1991 - 1993                                    */
  8. /*                                                                          */
  9. /* FUNCTION:  This file contains routines to handle the MCIDRV_SAVE message.*/
  10. /*            The MCIDRV_SAVE message tells us that MDM is save this device */
  11. /*            instance (making inactive).  Save the state of the device in  */
  12. /*            the instance structure                                        */
  13. /*                                                                          */
  14. /* ENTRY POINTS:                                                            */
  15. /*       MCIDRVSave() - MCIDRV_SAVE message handler                         */
  16. /*       MCIDRVSaveErr() - Error handler for MCIDRV_SAVE 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. /*                                                                          */
  31. /* SUBROUTINE NAME:  MCIDRVSave                                             */
  32. /*                                                                          */
  33. /* DESCRIPTIVE NAME:  MCIDRV_SAVE message processor                         */
  34. /*                                                                          */
  35. /* FUNCTION:  Process the MCIDRV_SAVE message.  Make the instance inactive. */
  36. /*                                                                          */
  37. /* PARAMETERS:                                                              */
  38. /*      FUNCTION_PARM_BLOCK  *pFuncBlock -- Pointer to function parameter   */
  39. /*                                          block. This block is allocated  */
  40. /*                                          by the main routine message     */
  41. /*                                          router.                         */
  42. /* EXIT CODES:                                                              */
  43. /*      MCIERR_SUCCESS    -- Action completed without error.                */
  44. /*            .                                                             */
  45. /*            .                                                             */
  46. /*            .                                                             */
  47. /*            .                                                             */
  48. /*                                                                          */
  49. /****************************************************************************/
  50. RC MCIDRVSave (FUNCTION_PARM_BLOCK *pFuncBlock)
  51. {
  52.   ULONG                ulrc = MCIERR_SUCCESS;    // Propogated Error Code
  53.   ULONG                ulParam1;                 // Message flags
  54.   PMCI_INFO_PARMS      pInfoParms;               // Pointer to info structure
  55.   PMCI_GENERIC_PARMS   pDrvSaveParms;            // Pointer to GENERIC structure
  56.   PINSTANCE            pInstance;                // Pointer to instance
  57.  
  58.   /*****************************************************/
  59.   /* dereference the values from pFuncBlock            */
  60.   /*****************************************************/
  61.   ulParam1       = pFuncBlock->ulParam1;
  62.   pInstance      = pFuncBlock->pInstance;
  63.   pDrvSaveParms     = (PMCI_GENERIC_PARMS)pFuncBlock->pParam2;
  64.  
  65.   /*****************************************************/
  66.   /* NOTE ----->>>                                     */
  67.   /*  This is the basic function that should be        */
  68.   /*  performed.  See the other samples in the toolkit */
  69.   /*  for streaming and MMIO considerations            */
  70.   /*****************************************************/
  71.   DosRequestMutexSem (pInstance->hmtxAccessSem, -2);  // wait for semaphore
  72.   pInstance->Active = FALSE;
  73.   DosReleaseMutexSem (pInstance->hmtxAccessSem);      // release semaphore
  74.  
  75.  
  76.   return (ulrc);
  77.  
  78. }      /* end of MCIDRVSave */
  79.  
  80.  
  81. /****************************************************************************/
  82. /*                                                                          */
  83. /* SUBROUTINE NAME:  MCIDRVSaveErr                                          */
  84. /*                                                                          */
  85. /* DESCRIPTIVE NAME:  MCIDRV_SAVE message processor for errors.             */
  86. /*                                                                          */
  87. /* FUNCTION:  Process the MCIDRV_SAVE message for errors.                   */
  88. /*                                                                          */
  89. /* PARAMETERS:                                                              */
  90. /*      FUNCTION_PARM_BLOCK  *pFuncBlock -- Pointer to function parameter   */
  91. /*                                          block.                          */
  92. /* EXIT CODES:                                                              */
  93. /*      MCIERR_SUCCESS    -- Action completed without error.                */
  94. /*            .                                                             */
  95. /*            .                                                             */
  96. /*            .                                                             */
  97. /*            .                                                             */
  98. /*                                                                          */
  99. /****************************************************************************/
  100. RC MCIDRVSaveErr (FUNCTION_PARM_BLOCK *pFuncBlock)
  101. {
  102.   ULONG                ulrc = MCIERR_SUCCESS;    // Propogated Error Code
  103.   ULONG                ulParam1;                 // Message flags
  104.   PMCI_INFO_PARMS      pInfoParms;               // Pointer to info structure
  105.   PMCI_GENERIC_PARMS   pDrvSaveParms;            // Pointer to GENERIC structure
  106.   PINSTANCE            pInstance;                // Pointer to instance
  107.  
  108.   /*****************************************************/
  109.   /* dereference the values from pFuncBlock            */
  110.   /*****************************************************/
  111.   ulParam1       = pFuncBlock->ulParam1;
  112.   pInstance      = pFuncBlock->pInstance;
  113.   pDrvSaveParms     = (PMCI_GENERIC_PARMS)pFuncBlock->pParam2;
  114.  
  115.  
  116.  
  117.   return (ulrc);
  118.  
  119. }      /* end of MCIDRVSaveErr */
  120.