home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / runnable / mmos2 / mmtoolkt / samples / fssht / fsshass.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-06  |  4.7 KB  |  95 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*                    Copyright (c) IBM Corporation 1992                    */
  4. /*                           All Rights Reserved                            */
  5. /*                                                                          */
  6. /* SOURCE FILE NAME: FSSHASS.C                                              */
  7. /*                                                                          */
  8. /* DESCRIPTIVE NAME:  File System Stream Handler Associate routine          */
  9. /*                                                                          */
  10. /* FUNCTION: This function is associates the given object with the          */
  11. /*           specified stream.                                              */
  12. /*                                                                          */
  13. /* ENTRY POINTS: ShcAssociate                                               */
  14. /*                                                                          */
  15. /*************************** END OF SPECIFICATIONS **************************/
  16. #define  INCL_NOPMAPI                  /* no PM include files required */
  17. #define  INCL_DOSSEMAPHORES
  18. #define  INCL_DOSPROCESS
  19. #define  INCL_DOSERRORS
  20. #include <os2.h>
  21. #include <os2me.h>
  22. #include <hhpheap.h>
  23. #include <shi.h>
  24.  
  25. /************************** START OF SPECIFICATIONS *************************/
  26. /*                                                                          */
  27. /* SUBROUTINE NAME: ShcAssociate                                            */
  28. /*                                                                          */
  29. /* DESCRIPTIVE NAME: Stream Handler Command Associate Object routine        */
  30. /*                                                                          */
  31. /* FUNCTION: Associates the object passed with the specified stream         */
  32. /*                                                                          */
  33. /* NOTES:                                                                   */
  34. /*                                                                          */
  35. /* ENTRY POINT: ShcAssociate                                                */
  36. /*                                                                          */
  37. /* INPUT:                                                                   */
  38. /*                                                                          */
  39. /* EXIT-NORMAL:                                                             */
  40. /*                                                                          */
  41. /* EXIT-ERROR:                                                              */
  42. /*                                                                          */
  43. /* SIDE EFFECTS:                                                            */
  44. /*                                                                          */
  45. /* INTERNAL REFERENCES:                                                     */
  46. /*        ROUTINES:                                                         */
  47. /*                                                                          */
  48. /* EXTERNAL REFERENCES:                                                     */
  49. /*        ROUTINES:                                                         */
  50. /*        DATA STRUCTURES:                                                  */
  51. /*                                                                          */
  52. /*************************** END OF SPECIFICATIONS **************************/
  53.  
  54. RC ShcAssociate(pasparm)
  55. PPARM_ASSOC pasparm;
  56.  
  57. { /* Start of ShcAssociate */
  58.  
  59. RC rc = NO_ERROR;                       // local return code
  60. PSIB psib;                              // Stream instance block
  61.  
  62.   /*
  63.    * Find our Stream Instance Block
  64.    */
  65.   if (!(rc = ShFindSib(&psib, pasparm->hstream, pasparm->hid)))
  66.     { /* We have SIB */
  67.       if (!(psib->ulActionFlags & SIBACTFLG_THREAD_DEAD))
  68.         { /* validate ObjType */
  69.           if (pasparm->pacb->ulObjType != ACBTYPE_MMIO)
  70.             {
  71.               rc = ERROR_INVALID_OBJTYPE;
  72.             }
  73.           else
  74.             {
  75.               if (pasparm->pacb->ulACBLen < sizeof(ACB_MMIO))
  76.                 {
  77.                   rc = ERROR_INVALID_BUFFER_SIZE;
  78.                 }
  79.               else
  80.                 {
  81.                   psib->ulAssocP1 = pasparm->pacb->ulParm1;
  82.                   psib->ulStatus = SIB_RUNNING;
  83.                 }
  84.             }
  85.         } /* validate ObjType */
  86.       else
  87.         {
  88.           rc = ERROR_INVALID_SEQUENCE;
  89.         }
  90.     } /* We have SIB */
  91.  
  92.   return(rc);
  93.  
  94. } /* End of ShcAssociate */
  95.