AddBinderyObjectToSet

Adds a bindery object to a property of type Set (For cross-platform functionality, see Developing NLMs with Cross-Platform Functions ( NDK: NLM Development Concepts, Tools, and Functions) and call NWAddObjectToSet)

Local Servers:blocking
Remote Servers:blocking
Classification:3.x, 4.x, 5.x, 6.x
Service:Server-Based Bindery

Syntax

   #include <\nlm\nit\nwbindry.h>  
    
   int AddBinderyObjectToSet (  
      char   *objectName,  
      WORD   objectType,  
      char   *propertyName,  
      char   *memberName,  
      WORD   memberType); 
   

Parameters

objectName
(IN) Specifies the string containing the name of the bindery object to which a new member is to be added (maximum 48 characters, including the NULL terminator).
objectType
(IN) Specifies the type of the bindery object to which a new member is to be added (OT_USER, OT_GROUP, OT_PRINT_SERVER, and so on).
propertyName
(IN) Specifies the string containing the name of the property to which the member is to be added (maximum 16 characters, including the NULL terminator).
memberName
(IN) Specifies the string containing the name of the bindery object to be added to the property (maximum 48 characters, including the NULL terminator).
memberType
(IN) Specifies the type of the bindery object to be added (OT_USER, OT_GROUP, OT_PRINT_SERVER, and so on).

Return Values

0

(0x00)

ESUCCESS

150

(0x96)

ERR_SERVER_OUT_OF_MEMORY

233

(0xE9)

ERR_MEMBER_ALREADY_EXISTS

235

(0xEB)

ERR_NOT_SET_PROPERTY

240

(0xF0)

ERR_WILDCARD_NOT_ALLOWED

248

(0xF8)

ERR_NO_PROPERTY_WRITE_PRIVILEGE

251

(0xFB)

ERR_NO_SUCH_PROPERTY

252

(0xFC)

ERR_NO_SUCH_OBJECT

254

(0xFE)

ERR_SERVER_BINDERY_LOCKED

255

(0xFF)

ERR_BINDERY_FAILURE

Remarks

The objectName, objectType, and propertyName parameters must uniquely identify a bindery object’s property. These parameters must not contain wildcard characters. The property must be of type Set. The objectName can be from 1 to 48 characters long, including the NULL terminator. The propertyName can be from 1 to 16 characters long, including the NULL terminator. Only printable characters can be used. Slashes, backslashes, colons, semicolons, commas, asterisks, and question marks are prohibited.

The memberName and memberType parameters must uniquely identify the bindery object to be added and must not contain wildcard characters.

This function searches consecutive segments of the property’s value for an open slot where it can record the unique bindery object ID of the new member. The new member is inserted into the first available slot. If an open slot is not found, a new segment is created and the new member’s unique bindery object ID is written to the first slot in the segment. The rest of the segment is filled with zeros.

This function requires write access to the property.

For example, to add user BILL’s object ID to group STAFF’s GROUP_MEMBERS Set property, a programmer passes BILL’s object type (OT_USER) and object name (BILL) to the server with a call to AddBinderyObjectToSet. The server uses BILL’s object type and object name to locate BILL’s object ID. The server then searches all value segments associated with STAFF’s GROUP_MEMBERS Set property until it finds an available slot. Finally, it inserts BILL’s object ID number into the empty slot.

See Also

DeleteBinderyObjectFromSet, IsBinderyObjectInSet, WritePropertyValue

AddBinderyObjectToSet Example

   #include <stdio.h>  
   #include <\nlm\nit\nwbindry.h>  
    
   main()  
   {  
      int   completionCode;  
      char  objectName[48], propertyName[16], memberName[48];  
      WORD  objectType, memberType;  
    
      /* Fill in the name of the object that is being added to */  
      strcpy (objectName, "STAFF"); 
     
      /* Fill in the type of object that is being added to */  
      objectType = OT_GROUP;  
    
      /* Fill in the property name that is being added to */  
      strcpy (propertyName, "GROUP_MEMBERS");  
    
      /* Fill in the member name to be added */  
      strcpy (memberName, "BILL");  
    
      /* Fill in the member type to be added */  
      memberType = OT_USER;  
      completionCode = AddBinderyObjectToSet (objectName, objectType,
         propertyName, memberName, memberType);  
      printf ("\n\n\n");  
      if (completionCode)  
         switch (completionCode)  
         {  
            case 150:  
            printf ("SERVER OUT OF MEMORY\n");  
            break;  
    
            case 233:  
            printf ("MEMBER ALREADY EXISTS\n");  
            break;  
    
            case 235:  
            printf ("NOT GROUP PROPERTY\n");  
            break;  
    
            case 240:  
            printf ("WILDCARD NOT ALLOWED\n");  
            break;  
    
            case 248:  
            printf ("NO PROPERTY WRITE PRIVILEGE\n");  
            break;  
    
            case 251:  
            printf ("NO SUCH PROPERTY\n");  
            break;  
    
            case 252:  
            printf ("NO SUCH OBJECT\n");  
            break;  
    
            case 254:  
            printf ("SERVER BINDERY LOCKED\n");  
            break;  
    
            case 255:  
            printf ("BINDERY FAILURE\n");  
            break;  
    
            case default:  
            printf ("completionCode = %d\n", completionCode);  
            break;  
         }  
      else  
         printf (" SUCCESSFULLY added member %s\n", memberName);  
   }