ScanProperty

Scans the bindery for an object’s properties (For cross-platform functionality, see Developing NLMs with Cross-Platform Functions ( NDK: NLM Development Concepts, Tools, and Functions) and call NWScanProperty )

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 ScanProperty (  
      char   *objectName,  
      WORD   objectType,  
      char   *searchPropertyName,  
      long   *sequenceNumber,  
      char    *propertyName,  
      char   *propertyFlags,  
      char   *propertySecurity,  
      char   *propertyHasValue,  
      char   *moreProperties); 
   

Parameters

objectName
(IN) Specifies the string containing the name of the bindery object to search (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).
searchPropertyName
(IN) Specifies the string containing the name of the property to search for (maximum 16 characters; can contain wildcard characters, including the NULL terminator).
sequenceNumber
(IN/OUT) Contains the sequence number from the previous search (initial search requires a -1) and receives the sequence number for the matching property.
propertyName
(OUT) Receives a string containing the name of the matching property (maximum 16 characters, including the NULL terminator).
propertyFlags
(OUT) Receives the property flags of the matching property: BF_DYNAMIC or BF_STATIC is logically ORed with BF_ITEM or BF_SET (BF_STATIC |BF_ITEM, and so on).
propertySecurity
(OUT) Receives the read and write security of the matching property.
propertyHasValue
(OUT) Receives a flag that indicates if the property has an attached value that can be read (0 = no value for property, 255 = property has value).
moreProperties
(OUT) Receives a flag that indicates if the bindery object has more properties (0 = no more properties for given object, 255 = more properties to scan).

Return Values

0

(0x00)

ESUCCESS

150

(0x96)

ERR_SERVER_OUT_OF_MEMORY

241

(0xF1)

ERR_INVALID_BINDERY_SECURITY

251

(0xFB)

ERR_NO_SUCH_PROPERTY

252

(0xFC)

ERR_NO_SUCH_OBJECT

254

(0xFE)

ERR_SERVER_BINDERY_LOCKED

255

(0xFF)

ERR_BINDERY_FAILURE

Remarks

This function is used iteratively to scan the bindery for all properties of the bindery object that match the searchPropertyName parameter. This function passes the objectName, objectType, searchPropertyName, and sequenceNumber parameters. The function returns the sequenceNumber, propertyName, propertyFlags, propertySecurity, propertyHasValue, and moreProperties parameters.

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

The sequenceNumber parameter should be set to -1 for the first search. Upon return, the moreProperties flag is set if the matched property is not the last property. If it is not the last property, the sequenceNumber receives a number to be used as the sequenceNumber for the next call.

The propertyFlags parameter indicates whether the property is Dynamic or Static and whether it is of type Set or Item. A Dynamic property is a property that is created and deleted frequently. Dynamic properties are deleted from the bindery when the server is initialized. Static properties remain in the bindery until deleted with the DeleteProperty function.

The property type indicates the type of data stored in the Value of a property. The value of a Set property contains a series of bindery object IDs. Each object ID is 4 bytes long. The value of an Item property contains segments of 128-byte strings.

The propertySecurity parameter is actually two nibbles. The low-order nibble determines who can scan for and find the object. The high-order nibble determines who can add properties to the object.

The following values are defined for each nibble:

0

0 0 0 0

Anyone

1

0 0 0 1

Logged

2

0 0 1 0

Object

3

0 0 1 1

Supervisor

4

0 1 0 0

NetWare Operating System

For example, 0x31 indicates that any user logged in to the server can find the object, but only the supervisor can add a property to the object.

See Also

ReadPropertyValue, ScanBinderyObject

ScanProperty Example

   #include <stdio.h>  
   #include <\nlm\nit\nwbindry.h>  
    
   main()  
   {  
   int   completionCode;  
   WORD  objectType;  
   long  sequenceNumber;  
   char  objectName[48], searchPropertyName[16], propertyName[16];  
   char  propertyFlags, propertySecurity, propertyHasValue;  
   char  moreProperties;  
    
      printf ("\n\n");  
      printf ("Enter Object Name —> ");  
      scanf ("%s", objectName);  
      printf ("\nEnter Object Type —> ");  
      scanf ("%d", &objectType);  
      printf ("\nEnter Property Name to Search —> ");  
      scanf ("%s", searchPropertyName);  
      sequenceNumber = -1;  
      moreProperties = 0;  
      do  
      {  
         completionCode = ScanProperty (objectName, objectType,  
                  searchPropertyName, &sequenceNumber,  
                  propertyName, &propertyFlags, &propertySecurity,  
                  &propertyHasValue, &moreProperties);  
         printf ("\n\n\n");  
         if (completionCode)  
         {  
            if (completionCode == 150)  
               printf ("SERVER OUT OF MEMORY\n");  
            else if (completionCode == 241)  
               printf ("INVALID BINDERY SECURITY\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\n\n");  
            printf ("Property Name...       %s\n",  
                    propertyName);  
            printf ("Property Flags...      %d\n",  
                    propertyFlags);  
            printf ("Property Security...   %2X\n",  
                    propertySecurity);  
            printf ("Property has Value..   %d\n",  
                    propertyHasValue);  
            printf ("More Property...       %d\n",  
                    moreProperties);  
         }  
      } while (moreProperties != 0);  
   }