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

  1. /********************* START OF SPECIFICATIONS *********************
  2. *
  3. * SUBROUTINE NAME: ADMCINIT.c
  4. *
  5. *              Copyright (c) IBM Corporation  1991, 1993
  6. *                        All Rights Reserved
  7. *
  8. * DESCRIPTIVE NAME: Audio MCD DLL Intialization and termination
  9. *                  functions.
  10. *
  11.  
  12. * FUNCTION: Create Global heap, carry out per process intialization.
  13. *
  14. * NOTES:
  15. *
  16. * ENTRY POINTS:
  17. *
  18. * INPUT:
  19. *
  20. * EXIT-NORMAL: Return Code 0.
  21. *
  22. * EXIT_ERROR:  Error Code.
  23. *
  24. * EFFECTS:
  25. *
  26. * Global Vars Referenced:
  27. *              hmtxProcSem, heap, UserCount,
  28. *              hEventInitCompleted,
  29. *
  30. * INTERNAL REFERENCES:   ADMCEXIT () -- DLL Termination Routine.
  31. *                        InitADMC () -- DLL Intialization Routine
  32. *
  33. * EXTERNAL REFERENCES:   DosResetEventSem ()        - OS/2 API
  34. *                        DosPostEventSem  ()        - OS/2 API
  35. *                        DosCreateMutexSem()        - OS/2 API
  36. *                        HhpCreateHeap    ()        - MME  API
  37. *                        HhpDestroyHeap   ()        - MME  API
  38. *                        HhpGetPID()      ()        - MME  API
  39. *
  40. *********************** END OF SPECIFICATIONS **********************/
  41. #define INCL_BASE
  42. #define INCL_DOSMODULEMGR
  43. #define INCL_DOSSEMAPHORES
  44.  
  45. #include <os2.h>                        // OS2 defines.
  46. #include <string.h>
  47. #include <os2medef.h>                   // MME includes files.
  48. #include <stdlib.h>                     // Math functions
  49. #include <ssm.h>                        // SSM Spi includes.
  50. #include <meerror.h>                    // MM Error Messages.
  51. #include <mmioos2.h>                    // MMIO Include.
  52. #include <mcios2.h>                     // MM System Include.
  53. #include <mcipriv.h>                    // MCI Connection stuff
  54. #include <mmdrvos2.h>                   // MCI Driver include.
  55. #include <mcd.h>                        // AudioIFDriverInterface.
  56. #include <hhpheap.h>                    // Heap Manager Definitions
  57. #include <qos.h>
  58. #include "audiomcd.h"                   // Component Definitions.
  59. #include "admcfunc.h"                   // Function Prototypes.
  60. #include <sw.h>
  61.  
  62. /********************* START OF SPECIFICATIONS *******************************
  63. *
  64. * SUBROUTINE NAME: ADMCINIT.C
  65. *
  66. * DESCRIPTIVE NAME: AudioMCD DLL Ibtialization.
  67. *
  68. * FUNCTION: Intialize the DLL and provide mem access to multiple processes.
  69. *
  70. * NOTES: Access to The Global heap is provided using the heap manager
  71. *        Routines. The DLL_InitTerm function is the first function
  72. *        called by the OS/2 DLL Loader.  If the flag variable is set to
  73. *        0, then this is DLL initialization, else it will be termination.
  74. *
  75. *        With the global variable ulUserCount, we keep track of how many
  76. *        times this dll is loaded (i.e. how many process have loaded the
  77. *        DLL).  This variable is used to monitor access to the global
  78. *        memory heap that all instances of the dll maintain.
  79. *
  80. *
  81. * ENTRY POINTS:
  82. *
  83. * INPUT:
  84. *
  85. * EXIT-NORMAL: Return Code 1 to the System Loader.
  86. *
  87. * EXIT_ERROR:  Failure To Load This Module.
  88. *
  89. * EFFECTS:
  90. *
  91. * INTERNAL REFERENCES: heap management Routines,
  92. *
  93. *               Global Variables referenced:
  94. *                      heap.
  95. *                      hmtxProcSem.
  96. *                      UserCount.
  97. *
  98. * EXTERNAL REFERENCES: DosCreateMutexSem  ()    -  OS/2 API
  99. *                      DosOpenMutexSem    ()    -  OS/2 API
  100. *                      DosReleaseMutexSem ()    -  OS/2 API
  101. *                      DosCloseMutexSem   ()    -  OS/2 API
  102. *                      DosExitList        ()    -  OS/2 API
  103. *
  104. *********************** END OF SPECIFICATIONS ********************************/
  105.  
  106. #pragma linkage (_DLL_InitTerm, system)
  107.  
  108. unsigned long APIENTRY _ADMCInitTerm (unsigned long hModhandle, unsigned long Flag );
  109.  
  110.  
  111. unsigned long _DLL_InitTerm (unsigned long hModhandle, unsigned long Flag)
  112. {
  113.   return(_ADMCInitTerm ( hModhandle,  Flag ));
  114. }
  115.  
  116.  
  117. ULONG APIENTRY  mciDriverEntry ( PVOID    ulpInstance,     // Instance Ptr
  118.                                  USHORT   usMessage,       // Message
  119.                                  ULONG    ulParam1,        // Flags
  120.                                  ULONG    ulParam2,        // Data
  121.                                  USHORT   usUserParm)      // Data
  122. {
  123.   return(MM_mciDriverEntryADMC (ulpInstance,
  124.                                 usMessage,
  125.                                 ulParam1,
  126.                                 ulParam2,
  127.                                 usUserParm));
  128.  
  129. }
  130.  
  131.