WritePropertyValue

Writes a value to a property of type Item (For cross-platform functionality, see Developing NLMs with Cross-Platform Functions ( NDK: NLM Development Concepts, Tools, and Functions) and call NWWritePropertyValue )

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 WritePropertyValue (  
      char   *objectName,  
      WORD   objectType,  
      char   *propertyName,  
      int    segmentNumber,  
      BYTE   *propertyValue,  
      BYTE   moreSegments); 
   

Parameters

objectName
(IN) Specifies the string containing the name of the bindery object (maximum 48 characters, including the NULL terminator).
objectType
(IN) Specifies the type of the bindery object (OT_USER, OT_GROUP, OT_PRINT_SERVER, and so on).
propertyName
(IN) Specifies the string containing the name of the property to which the data is to be written (maximum 16 characters, including the NULL terminator).
segmentNumber
(IN) Segment number of the data to be written: 1 = First segment of the property’s value.
propertyValue
(IN) Contains a segment of the property’s value (maximum 128 bytes).
moreSegments
(IN) Indicates if the property value has more data segments after the current segment: 0 = No more segments 255 = More segments follow.

Return Values

0

(0x00)

ESUCCESS

150

(0x96)

ERR_SERVER_OUT_OF_MEMORY

232

(0xE8)

ERR_NOT_ITEM_PROPERTY

236

(0xEC)

ERR_NO_SUCH_SEGMENT

240

(0xF0)

ERR_WILDCARD_NOT_ALLOWED

241

(0xF1)

ERR_INVALID_BINDERY_SECURITY

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 and must not contain wildcard characters. 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 segmentNumber parameter should be set to 1 to write the first data segment. When creating a property value, the segments must be written in sequential order. Before segment n can be written, all segments from 1 to n-1 must have been written. To write property data of more than one segment (128 bytes), this function should be called iteratively. Once all segments of a property value have been established, segments can be written at random.

When writing the last segment of a property value the moreSegments flag should be set to zero. The bindery truncates the property value and discards extra segments if the moreSegments flag is 0 and the bindery has segments beyond the segment written. Property values should be kept to a single segment (128 bytes) to improve bindery efficiency.

The bindery makes no attempt to coordinate activities between multiple entities that might be reading or writing data to a single property. This means that one entity might read a partially-updated property and get inconsistent data, if the property’s data extends across multiple segments. If this presents a problem, coordination on reads and writes must be handled by application programs. Logical record locks can be used to coordinate activities among applications.

Do not use this function to write values to set properties. Instead, call AddBinderyObjectToSet.

See Also

AddBinderyObjectToSet, ReadPropertyValue

WritePropertyValue Example

   #include <stdio.h>  
   #include <\nlm\nit\nwbindry.h>  
    
   main()  
   {  
   int   completionCode, segmentNumber;  
   char  objectName[48], propertyName[16];  
   WORD  objectType;  
   BYTE  propertyValue[128], moreSegments;  
    
      printf ("\n\n");  
      printf ("Enter Object Name —> ");  
      scanf ("%s", objectName);  
      printf ("\nEnter Object Type —> ");  
      scanf ("%d", &objectType);  
      printf ("\nEnter Property Name —> ");  
      scanf ("%s", propertyName);  
      printf ("\nEnter Segment Number —> ");  
      scanf ("%d", &segmentNumber);  
      printf ("\nEnter Property Value —> ");  
      scanf ("%d", &propertyValue);  
      printf ("\nEnter More Segments —> ");  
      scanf ("%d", &moreSegments);  
      completionCode = WritePropertyValue (objectName,  
         objectType, propertyName, segmentNumber,  
         propertyValue, moreSegments);  
      printf ("\n\n\n");  
      if (completionCode)  
      {  
         if (completionCode == 150)  
            printf ("SERVER OUT OF MEMORY\n");  
         else if (completionCode == 232)  
            printf ("NO ITEM PROPERTY\n");  
         else if (completionCode == 236)  
            printf ("NO SUCH SEGMENT\n");  
         else if (completionCode == 240)  
            printf ("WILDCARD NOT ALLOWED\n");  
         else if (completionCode == 241)  
            printf ("INVALID BINDERY SECURITY\n");  
         else if (completionCode == 248)  
            printf ("NO PROPERTY WRITE PRIVILEGE\n");  
         else if (completionCode == 251)  
            printf ("NO SUCH PROPERTY\n");  
         else if (completionCode == 252)  
            printf ("NO SUCH OBJECT\n");  
         else if (completionCode == 254)  
            printf ("SERVER BINDERY LOCKED\n");  
         else if (completionCode == 255)  
            printf ("BINDERY FAILURE\n");  
         else  
            printf ("completionCode = %d\n", completionCode);  
      }  
      else  
         printf (" SUCCESSFULLY COMPLETED...\n");  
   }