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 )
#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);
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.
#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);
}