home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / nettos11.zip / BINDERY / CRTOBJ.PRG < prev    next >
Text File  |  1993-02-23  |  3KB  |  119 lines

  1. /*
  2.  * File......: CRTOBJ.PRG
  3.  * Author....: Kevin Maher/Steve Tyrakowski
  4.  * CIS ID....: 73766,1224
  5.  * Date......: $Date$
  6.  * Revision..: $Revision$
  7.  * Log file..: $Logfile$
  8.  * 
  9.  * This is an original work by Kevin Maher and Steve Tyrakowski
  10.  * and is placed in the public domain.
  11.  *
  12.  * Modification history:
  13.  * ---------------------
  14.  *
  15.  * $Log$
  16.  *
  17.  */
  18.  
  19.  
  20. /*  $DOC$
  21.  *  $FUNCNAME$
  22.  *     FN_CREBNDO()
  23.  *  $CATEGORY$
  24.  *     Bindery
  25.  *  $ONELINER$
  26.  *     Create Bindery Object
  27.  *  $SYNTAX$
  28.  *
  29.  *     FN_creBndO(cObjectName, nObjectType, lDynamic, nWrite, nRead)
  30.  *         => lCreated
  31.  *
  32.  *  $ARGUMENTS$
  33.  *
  34.  *     <cObjectName> is the name of the Bindery Object that you are
  35.  *           trying to create.   Max Length = 47
  36.  *
  37.  *     <nObjectType> is the Bindery Object Type.  Manifest constants
  38.  *           describing the defined types are included in the
  39.  *           NETTO.CH header file.
  40.  *
  41.  *     <lDynamic> if the new object will be dynamic or static. Set it
  42.  *        to true for dynamic and false for static.  Dynamic
  43.  *        objects get deleted when the file server is initialized.
  44.  *
  45.  *     <nWrite> is the object write security as an integer.
  46.  *              The integer indicates who can change the
  47.  *              bindery object.
  48.  *
  49.  *     <nRead> is the object read security as an integer.
  50.  *          The integer indicates who can read and scan
  51.  *             for properties of the bindery object.
  52.  *
  53.  *         ┌─────────────────────────────────┐
  54.  *         │ Read and Write Security Levels  │
  55.  *         ├──┬──────────────────────────────┤
  56.  *         │ 0│ Anyone                       │
  57.  *         ├──┼──────────────────────────────┤
  58.  *         │ 1│ Logged                       │
  59.  *         ├──┼──────────────────────────────┤
  60.  *         │ 2│ Object                       │
  61.  *         ├──┼──────────────────────────────┤
  62.  *         │ 3│ Supervisor                   │
  63.  *         ├──┼──────────────────────────────┤
  64.  *         │ 4│ Netware Operating System     │
  65.  *         └──┴──────────────────────────────┘
  66.  *
  67.  *
  68.  *  $RETURNS$
  69.  *
  70.  *     <lCreated> logical if object was created or not.
  71.  *
  72.  *  $DESCRIPTION$
  73.  *
  74.  *     This function creates a bindery object.
  75.  *
  76.  *  $SEEALSO$
  77.  *    fn_delBndO() fn_creProp()
  78.  *  $EXAMPLES$
  79.  *
  80.  *     // this will add the object FRANK
  81.  *     lCreated := FN_creBndO("FRANK", OT_USER, .T., 1, 1 )
  82.  *
  83.  *  $END$
  84.  */
  85.  
  86. #include "netto.ch"
  87.  
  88. #define NW_LOG 227
  89.  
  90. #xcommand DEFAULT <v1> TO <x1> [, <vN> TO <xN> ];
  91.       => IIF((<v1>)=NIL,<v1>:=<x1>,NIL) [; IF((<vN>)=NIL,<vN>:=<xN>,NIL)]
  92.  
  93. #ifdef FT_TEST
  94.   FUNCTION MAIN(cObject, nType, nWrite, nRead )
  95.     DEFAULT cObject TO "TESTUSER"
  96.     DEFAULT nType TO "1" // OT_USER
  97.     DEFAULT nWrite TO "1"
  98.     DEFAULT nRead  TO "1"
  99.     IF FN_creBndO(cObject, Val(nType), .T., Val(nWrite), Val(nRead) )
  100.       Qout("Object has been created.")
  101.     ELSE
  102.       Qout("Object has not been created.")
  103.     ENDIF
  104.  
  105.   RETURN ( nil )
  106.  
  107. #endif
  108.  
  109.  
  110. FUNCTION FN_creBndO(cObject, nType, lDynamic, nWrite, nRead )
  111.  
  112.   LOCAL cSend := I2BYTE(50);               // 32h API Request Code
  113.           + I2BYTE(Iif(lDynamic, 1, 0));   // Set Dynamic/Static bit
  114.           + I2BYTE((nWrite * 16) + nRead); // Security Level
  115.           + W2HILO(nType);                 // nw_int Object type
  116.           + fn_NameL(cObject,48)           // Object Name
  117.  
  118. RETURN _fnReq(NW_LOG,cSend,"") == ESUCCESS
  119.