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

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*                    Copyright (c) IBM Corporation 1992, 1993              */
  4. /*                           All Rights Reserved                            */
  5. /*                                                                          */
  6. /* SOURCE FILE NAME: SHGPROT.C                                              */
  7. /*                                                                          */
  8. /* DESCRIPTIVE NAME:  Stream Handler Get Protocol routine                   */
  9. /*                                                                          */
  10. /* FUNCTION: Get the protocols installed for this stream handler.           */
  11. /*                                                                          */
  12. /* ENTRY POINTS: ShcGetProtocol                                             */
  13. /*                                                                          */
  14. /*************************** END OF SPECIFICATIONS **************************/
  15. #define  INCL_NOPMAPI                  /* no PM include files required */
  16. #define  INCL_DOSSEMAPHORES
  17. #define  INCL_DOSPROCESS
  18. #define  INCL_OS2MM
  19. #include <os2.h>
  20. #include <os2me.h>
  21. #include <hhpheap.h>
  22. #include <shi.h>
  23.  
  24. /************************** START OF SPECIFICATIONS *************************/
  25. /*                                                                          */
  26. /* SUBROUTINE NAME: ShcGetProtocol                                          */
  27. /*                                                                          */
  28. /* DESCRIPTIVE NAME: Stream Handler Command Get Protocol                    */
  29. /*                                                                          */
  30. /* FUNCTION: This returns a SPCB indicated by the key passed in.            */
  31. /*                                                                          */
  32. /* NOTES:                                                                   */
  33. /*                                                                          */
  34. /* ENTRY POINT: ShcGetProtocol                                              */
  35. /*   LINKAGE:   CALL NEAR (0:32)                                            */
  36. /*                                                                          */
  37. /* INPUT: Pointer to shc get protocol parameter block (PARM_GPROT)          */
  38. /*        containing:                                                       */
  39. /*   ULONG   ulFunction  Handler command function SHC_GET_PROTOCOLS         */
  40. /*   HID     hid         handler ID                                         */
  41. /*   SPCBKEY spcbkey     key of SPCB                                        */
  42. /*   PSBCB   pspcb       pointer to SPCB (output)                           */
  43. /*                                                                          */
  44. /* EXIT-NORMAL: NO_ERROR (0)                                                */
  45. /*                                                                          */
  46. /* EXIT-ERROR:                                                              */
  47. /*   ERROR_INVALID_SPCBKEY                                                  */
  48. /*                                                                          */
  49. /* SIDE EFFECTS:                                                            */
  50. /*                                                                          */
  51. /* INTERNAL REFERENCES:                                                     */
  52. /*        ROUTINES: None                                                    */
  53. /*                                                                          */
  54. /* EXTERNAL REFERENCES:                                                     */
  55. /*   ROUTINES:                                                              */
  56. /*     ShFindESPCB                                                          */
  57. /*                                                                          */
  58. /*   DATA STRUCTURES:                                                       */
  59. /*     ESPCB                                                                */
  60. /*                                                                          */
  61. /*************************** END OF SPECIFICATIONS **************************/
  62.  
  63. RC ShcGetProtocol(pgpparm)
  64. PPARM_GPROT pgpparm;
  65.  
  66. { /* Start of ShcGetProtocol */
  67.  
  68. RC rc = NO_ERROR;                       /* local return code */
  69. PESPCB pTempEspcb;
  70.  
  71.   ENTERCRITX(rc);
  72.  
  73.   /*
  74.    * Locate the spcb and return it
  75.    */
  76.   pTempEspcb = ShFindESPCB(pgpparm->spcbkey,0L);
  77.   if (pTempEspcb)
  78.     {
  79.       *pgpparm->pspcb = pTempEspcb->spcb;
  80.     }
  81.   else
  82.     {
  83.       rc = ERROR_INVALID_SPCBKEY;
  84.     }
  85.  
  86.   EXITCRIT;
  87.   return(rc);
  88.  
  89. } /* End of ShcGetProtocol */
  90.