CreateProperty
Creates a property for a bindery object (For cross-platform functionality, see Developing NLMs with Cross-Platform Functions ( NDK: NLM Development Concepts, Tools, and Functions) and call NWCreateProperty )
#include <\nlm\nit\nwbindry.h>
int CreateProperty (
char *objectName,
WORD objectType,
char *propertyName,
BYTE propertyFlags,
BYTE propertySecurity);
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. 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 propertyFlags parameter indicates whether the property is Dynamic or Static and whether it is of type Set or Item. A dynamic property 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 DeleteProperty.
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 property, but only the supervisor can add a value to the property.
The requesting workstation cannot create properties that have security greater than the workstation’s access to the bindery object. The password property can also be created with ChangeBinderyObjectPassword. CreateProperty can also be used to create the password property.
#include <stdio.h>
#include <\nlm\nit\nwbindry.h>
main()
{
int completionCode;
char objectName[48];
char propertyName[16];
WORD objectType;
BYTE propertyFlags;
BYTE propertySecurity;
strcpy (objectName, "BRUTH");
objectType = OT_USER;
strcpy (propertyName, "BASEBALL_TEAM");
propertyFlags = BF_STATIC | BF_SET;
propertySecurity = 0x31;
completionCode = CreateProperty (objectName, objectType,
propertyName, propertyFlags, propertySecurity);
if (completionCode)
switch (completionCode)
{
case 150:
printf ("SERVER OUT OF MEMORY\n");
break;
case 237:
printf ("PROPERTY ALREADY EXISTS\n");
break;
case 239:
printf ("INVALID NAME\n");
break;
case 240:
printf ("WILDCARD NOT ALLOWED\n");
break;
case 241:
printf ("INVALID BINDERY SECURITY\n");
break;
case 247:
printf ("NO PROPERTY CREATE PRIVILEGE\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 created property %s\n",
propertyName);
}